From 64a44dc0899e92d8c1b708fb754ad1b2126c67fe Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 16 Jun 2007 21:34:48 +0000 Subject: [PATCH] Some OpenSSL frobbing --- openssl/openssl_sml.c | 4 ++++ openssl/openssl_sml.h | 1 + src/main.sml | 8 +++++--- src/openssl.sml | 19 +++++++++---------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/openssl/openssl_sml.c b/openssl/openssl_sml.c index fc82769..407e74f 100644 --- a/openssl/openssl_sml.c +++ b/openssl/openssl_sml.c @@ -24,6 +24,10 @@ int OpenSSL_SML_get_error() { return ERR_get_error(); } +int OpenSSL_SML_should_retry(BIO *b) { + return BIO_should_retry(b); +} + const char *OpenSSL_SML_lib_error_string(int err) { return ERR_lib_error_string(err); } diff --git a/openssl/openssl_sml.h b/openssl/openssl_sml.h index 0568d29..3d5cd46 100644 --- a/openssl/openssl_sml.h +++ b/openssl/openssl_sml.h @@ -7,6 +7,7 @@ void OpenSSL_SML_load_error_strings(void); void OpenSSL_SML_load_BIO_strings(void); int OpenSSL_SML_get_error(void); +int OpenSSL_SML_should_retry(BIO *b); const char *OpenSSL_SML_lib_error_string(int err); const char *OpenSSL_SML_func_error_string(int err); const char *OpenSSL_SML_reason_error_string(int err); diff --git a/src/main.sml b/src/main.sml index 798ede2..fd4ff63 100644 --- a/src/main.sml +++ b/src/main.sml @@ -942,8 +942,9 @@ fun service () = (print msgLocal; print "\n"; Msg.send (bio, MsgOk))) - handle OpenSSL.OpenSSL _ => - print "OpenSSL error\n" + handle e as (OpenSSL.OpenSSL s) => + (print "OpenSSL error\n"; + app (fn x => print (x ^ "\n")) (SMLofNJ.exnHistory e)) | OS.SysErr (s, _) => (print "System error: "; print s; @@ -1268,8 +1269,9 @@ fun service () = in cmdLoop () end - handle OpenSSL.OpenSSL s => + handle e as (OpenSSL.OpenSSL s) => (print ("OpenSSL error: " ^ s ^ "\n"); + app (fn x => print (x ^ "\n")) (SMLofNJ.exnHistory e); OpenSSL.close bio handle OpenSSL.OpenSSL _ => (); loop ()) diff --git a/src/openssl.sml b/src/openssl.sml index 3f3b292..df63276 100644 --- a/src/openssl.sml +++ b/src/openssl.sml @@ -45,16 +45,15 @@ fun ssl_err s = else (print (ZString.toML lib); print ":"); - if C.Ptr.isNull func then - () - else - (print (ZString.toML func); - print ":"); - if C.Ptr.isNull reason then - () - else - print (ZString.toML reason); - print "\n" + if C.Ptr.isNull func then + () + else + (print (ZString.toML func); + print ":"); + if C.Ptr.isNull reason then + () + else + print (ZString.toML reason) end val readBuf : (C.uchar, C.rw) C.obj C.ptr' = C.alloc' C.S.uchar (Word.fromInt Config.bufSize) -- 2.20.1