openssl: define a startup-hook so that openssl initializes automatically

db4
Björn Lindqvist 2014-03-16 15:24:36 +01:00 committed by John Benediktsson
parent 0554e8c3fa
commit 981ea313a0
3 changed files with 3 additions and 12 deletions

View File

@ -29,7 +29,7 @@ M: evp-md-context dispose*
handle>> EVP_MD_CTX_destroy ;
: with-evp-md-context ( quot -- )
maybe-init-ssl [ <evp-md-context> ] dip with-disposal ; inline
[ <evp-md-context> ] dip with-disposal ; inline
: digest-named ( name -- md )
dup EVP_get_digestbyname

View File

@ -124,7 +124,6 @@ M: rsa dispose* handle>> RSA_free ;
H{ } clone >>sessions ;
M: openssl <secure-context> ( config -- context )
maybe-init-ssl
[
dup method>> ssl-method SSL_CTX_new
dup ssl-error <openssl-context> |dispose

View File

@ -1,6 +1,6 @@
! Copyright (C) 2007, 2008, Slava Pestov, Elie CHAFTARI.
! See http://factorcode.org/license.txt for BSD license.
USING: init kernel namespaces openssl.libcrypto openssl.libssl
USING: init io kernel namespaces openssl.libcrypto openssl.libssl
sequences ;
IN: openssl
@ -26,12 +26,4 @@ SINGLETON: openssl
OpenSSL_add_all_digests
OpenSSL_add_all_ciphers ;
SYMBOL: ssl-initialized?
: maybe-init-ssl ( -- )
ssl-initialized? get-global [
init-ssl
t ssl-initialized? set-global
] unless ;
[ f ssl-initialized? set-global ] "openssl" add-startup-hook
[ init-ssl ] "openssl" add-startup-hook