Add comment explaining why we don't check a return value
authorMatt Caswell <matt@openssl.org>
Wed, 11 Nov 2015 10:17:22 +0000 (10:17 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 17 Nov 2015 11:21:17 +0000 (11:21 +0000)
A call to X509_verify_cert() is used to build a chain of certs for the
server to send back to the client. It isn't *actually* used for verifying
the cert at all - just building the chain. Therefore the return value is
ignored.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
ssl/ssl_cert.c

index 9a373b19ab1bab2d2de1aa48ab43d84659b3dcfb..6f9fcdb350ed66caef97f81fa7d4f1fbff995e7f 100644 (file)
@@ -914,6 +914,12 @@ int ssl_add_cert_chain(SSL *s, CERT_PKEY *cpk, unsigned long *l)
             SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_X509_LIB);
             return (0);
         }
+        /*
+         * It is valid for the chain not to be complete (because normally we
+         * don't include the root cert in the chain). Therefore we deliberately
+         * ignore the error return from this call. We're not actually verifying
+         * the cert - we're just building as much of the chain as we can
+         */
         X509_verify_cert(&xs_ctx);
         /* Don't leave errors in the queue */
         ERR_clear_error();