diff options
author | Matt Caswell <matt@openssl.org> | 2015-03-12 14:37:26 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-03-17 13:48:04 +0000 |
commit | fcb61b6c92ac21c51ad23e4b983600747cdd8db1 (patch) | |
tree | 4d85db613936d4eb77c9d159eee93dfa806853e7 | |
parent | b2b81639640e84046cdd5d869009eacef22448f5 (diff) |
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 <levitte@openssl.org>
(cherry picked from commit 668f6f08c62177ab5893fc26ebb67053aafdffc8)
-rw-r--r-- | ssl/t1_enc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c index 84f589606b..577885fe08 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; |