From: Matt Caswell Date: Thu, 12 Mar 2015 14:37:26 +0000 (+0000) Subject: Add sanity check to PRF X-Git-Tag: OpenSSL_1_1_0-pre1~1523 X-Git-Url: https://git.openssl.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=668f6f08c62177ab5893fc26ebb67053aafdffc8;p=openssl.git Add sanity check to PRF The function tls1_PRF counts the number of digests in use and partitions security evenly between them. There always needs to be at least one digest in use, otherwise this is an internal error. Add a sanity check for this. Reviewed-by: Richard Levitte --- diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c index 1833eb7646..26f8415dcb 100644 --- a/ssl/t1_enc.c +++ b/ssl/t1_enc.c @@ -260,6 +260,11 @@ static int tls1_PRF(long digest_mask, if ((m << TLS1_PRF_DGST_SHIFT) & digest_mask) count++; } + if(!count) { + /* Should never happen */ + SSLerr(SSL_F_TLS1_PRF, ERR_R_INTERNAL_ERROR); + goto err; + } len = slen / count; if (count == 1) slen = 0;