1 ! Copyright (C) 2007, 2008, Slava Pestov, Elie CHAFTARI.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: init kernel namespaces openssl.libcrypto openssl.libssl
7 ! This code is based on http://www.rtfm.com/openssl-examples/
11 : (ssl-error-string) ( n -- string )
12 ERR_clear_error f ERR_error_string ;
14 : ssl-error-string ( -- string )
15 ERR_get_error ERR_clear_error f ERR_error_string ;
17 : (ssl-error) ( -- * )
18 ssl-error-string throw ;
20 : ssl-error ( obj -- )
21 { f 0 } member? [ (ssl-error) ] when ;
24 SSL_library_init ssl-error
25 SSL_load_error_strings
26 OpenSSL_add_all_digests
27 OpenSSL_add_all_ciphers ;
29 SYMBOL: ssl-initialized?
31 : maybe-init-ssl ( -- )
32 ssl-initialized? get-global [
34 t ssl-initialized? set-global
37 [ f ssl-initialized? set-global ] "openssl" add-init-hook