X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=ssl%2Fssl_lib.c;h=555a630b1ba8da6e316c2e2ed5b6111c37135e8b;hb=da8512aaffe3580e3701198ef9eba2471c5edbc2;hp=617526a66d46685ed95be940c3d31b400cd2ef03;hpb=68d2cf51bcfc1c2c1d0deec9be21c3d743737656;p=oweals%2Fopenssl.git diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 617526a66d..555a630b1b 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -2320,7 +2320,7 @@ int ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL *s) #endif /* THIS NEEDS CLEANING UP */ -static int ssl_get_server_cert_index(SSL *s) +static int ssl_get_server_cert_index(const SSL *s) { unsigned long alg_k, alg_a; @@ -2371,7 +2371,7 @@ static int ssl_get_server_cert_index(SSL *s) } } -CERT_PKEY *ssl_get_server_send_pkey(SSL *s) +CERT_PKEY *ssl_get_server_send_pkey(const SSL *s) { CERT *c; int i; @@ -2840,6 +2840,14 @@ void ssl_clear_cipher_ctx(SSL *s) /* Fix this function so that it takes an optional type parameter */ X509 *SSL_get_certificate(const SSL *s) { + if (s->server) + { + CERT_PKEY *certpkey; + certpkey = ssl_get_server_send_pkey(s); + if (certpkey && certpkey->x509) + return certpkey->x509; + } + if (s->cert != NULL) return(s->cert->key->x509); else