X-Git-Url: http://git.openwrt.org/?p=project%2Fustream-ssl.git;a=blobdiff_plain;f=ustream-openssl.c;h=787cc383a818644b9ce5624aa4a2c26bf05efc11;hp=efae44c28dd035022a5a3d783426191455636c1d;hb=67aeda4a4207f6ae0bc2efad93f25fd4bc74acb6;hpb=fc0b5ec804ee43c532978dd04ab0509c34baefb0 diff --git a/ustream-openssl.c b/ustream-openssl.c index efae44c..787cc38 100644 --- a/ustream-openssl.c +++ b/ustream-openssl.c @@ -220,10 +220,6 @@ static void ustream_ssl_verify_cert(struct ustream_ssl *us) X509 *cert; int res; - cert = SSL_get_peer_certificate(ssl); - if (!cert) - return; - res = SSL_get_verify_result(ssl); if (res != X509_V_OK) { if (us->notify_verify_error) @@ -231,8 +227,13 @@ static void ustream_ssl_verify_cert(struct ustream_ssl *us) return; } + cert = SSL_get_peer_certificate(ssl); + if (!cert) + return; + us->valid_cert = true; us->valid_cn = ustream_ssl_verify_cn(us, cert); + X509_free(cert); } #endif