]> gitweb.factorcode.org Git - factor.git/commitdiff
openssl: SSL_get_peer_certificate is deprecated, use SSL_get1_peer_certificate instead
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 13 Feb 2022 22:04:58 +0000 (16:04 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 13 Feb 2022 22:04:58 +0000 (16:04 -0600)
SSL_get1_peer_certificate is an alias of SSL_get_peer_certificate but the symbol
SSL_get_peer_certificate is not in openssl 3.0.1 (ubuntu 22)

basis/io/sockets/secure/openssl/openssl.factor
basis/openssl/libssl/libssl.factor

index 6437f3b07decee7d4835b29cafd1f854f495ad1d..c67505a769ba3d808bc0acbaf56753c86fc3c400 100644 (file)
@@ -1,14 +1,14 @@
 ! 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 )
@@ -446,8 +446,11 @@ M: ssl-handle dispose*
         =
     ] 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?
index b22ff130a08d7c7971bc775357a44dd4397e97d4..c9bca772e06b8dd64bb2aa2d0fb0b3788293470a 100644 (file)
@@ -454,6 +454,8 @@ FUNCTION: int SSL_get_shutdown ( SSL* ssl )
 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 )