Fix warning
authorDr. Stephen Henson <steve@openssl.org>
Thu, 16 Feb 2017 01:29:14 +0000 (01:29 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 16 Feb 2017 01:44:28 +0000 (01:44 +0000)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2644)

ssl/t1_lib.c

index 6aa4decfe13ba9d415222b4b3214f51b874ea565..787f487e4cb753e043795dd1ad9a5b7c34062334 100644 (file)
@@ -2320,7 +2320,7 @@ int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)
  */
 int tls_choose_sigalg(SSL *s, int *al)
 {
-    int idx;
+    int idx = -1;
     const SIGALG_LOOKUP *lu = NULL;
 
     if (SSL_IS_TLS13(s)) {
@@ -2443,6 +2443,11 @@ int tls_choose_sigalg(SSL *s, int *al)
             }
         }
     }
+    if (idx == -1) {
+        *al = SSL_AD_INTERNAL_ERROR;
+        SSLerr(SSL_F_TLS_CHOOSE_SIGALG, ERR_R_INTERNAL_ERROR);
+        return 0;
+    }
     s->s3->tmp.cert = &s->cert->pkeys[idx];
     s->cert->key = s->s3->tmp.cert;
     s->s3->tmp.sigalg = lu;