Check return value of ssl3_output_cert_chain
authorDr. Stephen Henson <steve@openssl.org>
Tue, 18 Mar 2014 14:19:22 +0000 (14:19 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 28 Mar 2014 14:49:04 +0000 (14:49 +0000)
ssl/s3_clnt.c
ssl/s3_srvr.c

index 70c6533268a0ab26e2f8c954c41daebdab0136db..efc3710abdf24ffecfba654c56ce1e272f4221e5 100644 (file)
@@ -3380,8 +3380,13 @@ int ssl3_send_client_certificate(SSL *s)
        if (s->state == SSL3_ST_CW_CERT_C)
                {
                s->state=SSL3_ST_CW_CERT_D;
        if (s->state == SSL3_ST_CW_CERT_C)
                {
                s->state=SSL3_ST_CW_CERT_D;
-               ssl3_output_cert_chain(s,
-                       (s->s3->tmp.cert_req == 2)?NULL:s->cert->key);
+               if (!ssl3_output_cert_chain(s,
+                       (s->s3->tmp.cert_req == 2)?NULL:s->cert->key))
+                       {
+                       SSLerr(SSL_F_SSL3_SEND_CLIENT_CERTIFICATE, ERR_R_INTERNAL_ERROR);
+                       ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INTERNAL_ERROR);
+                       return 0;
+                       }
                }
        /* SSL3_ST_CW_CERT_D */
        return ssl_do_write(s);
                }
        /* SSL3_ST_CW_CERT_D */
        return ssl_do_write(s);
index f048b76dcaee41a9c37e91519320bc62102cbb50..411b6f6af8387946dd4ae2f32404a249ab8f968e 100644 (file)
@@ -3476,7 +3476,11 @@ int ssl3_send_server_certificate(SSL *s)
                                }
                        }
 
                                }
                        }
 
-               ssl3_output_cert_chain(s,cpk);
+               if (!ssl3_output_cert_chain(s,cpk))
+                       {
+                       SSLerr(SSL_F_SSL3_SEND_SERVER_CERTIFICATE,ERR_R_INTERNAL_ERROR);
+                       return(0);
+                       }
                s->state=SSL3_ST_SW_CERT_B;
                }
 
                s->state=SSL3_ST_SW_CERT_B;
                }