! Copyright (C) 2007, 2008, Slava Pestov, Elie CHAFTARI.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.c-types alien.data alien.enums
-alien.strings assocs byte-arrays classes.struct combinators
-combinators.short-circuit destructors endian io io.backend
-io.buffers io.encodings.latin1 io.encodings.string
-io.encodings.utf8 io.files io.pathnames io.ports io.sockets
-io.sockets.secure io.timeouts kernel libc math math.functions
-math.order math.parser namespaces openssl openssl.libcrypto
-openssl.libssl random sequences sets splitting unicode ;
-SLOT: alpn-supported-protocols
+alien.libraries.finder alien.strings assocs byte-arrays
+classes.struct combinators combinators.short-circuit destructors
+endian io io.backend io.buffers io.encodings.latin1
+io.encodings.string io.encodings.utf8 io.files io.pathnames
+io.ports io.sockets io.sockets.secure io.timeouts kernel libc
+math math.functions math.order math.parser namespaces openssl
+openssl.libcrypto openssl.libssl random sequences sets splitting
+unicode ;
IN: io.sockets.secure.openssl
GENERIC: ssl-method ( symbol -- method )
=
] if ;
+: get-peer-certificate-function ( -- word/f )
+ { "SSL_get1_peer_certificate" "SSL_get_peer_certificate" } "libssl" find-first-function ;
+
: check-subject-name ( host ssl-handle -- )
- SSL_get_peer_certificate [
+ get-peer-certificate-function execute( ssl -- x509 ) [
[ alternative-dns-names ]
[ subject-name ] bi suffix members
2dup [ subject-names-match? ] with any?
FUNCTION: int SSL_want ( SSL* ssl )
FUNCTION: long SSL_get_verify_result ( SSL* ssl )
FUNCTION: X509* SSL_get_peer_certificate ( SSL* s )
+FUNCTION: X509 *SSL_get0_peer_certificate ( SSL *ssl )
+FUNCTION: X509 *SSL_get1_peer_certificate ( SSL *ssl )
FUNCTION: int SSL_set_cipher_list ( SSL* ssl, c-string str )
FUNCTION: int SSL_use_RSAPrivateKey_file ( SSL* ssl, c-string str )