summaryrefslogtreecommitdiff
path: root/src/lib/libssl/t1_enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/t1_enc.c')
-rw-r--r--src/lib/libssl/t1_enc.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c
index f79219561a..2ee521b073 100644
--- a/src/lib/libssl/t1_enc.c
+++ b/src/lib/libssl/t1_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_enc.c,v 1.94 2017/01/26 10:40:21 beck Exp $ */ 1/* $OpenBSD: t1_enc.c,v 1.95 2017/01/26 12:16:13 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -228,8 +228,7 @@ tls1_digest_cached_records(SSL *s)
228 } 228 }
229 hdatalen = BIO_get_mem_data(S3I(s)->handshake_buffer, &hdata); 229 hdatalen = BIO_get_mem_data(S3I(s)->handshake_buffer, &hdata);
230 if (hdatalen <= 0) { 230 if (hdatalen <= 0) {
231 SSLerror( 231 SSLerror(SSL_R_BAD_HANDSHAKE_LENGTH);
232 SSL_R_BAD_HANDSHAKE_LENGTH);
233 goto err; 232 goto err;
234 } 233 }
235 234
@@ -240,8 +239,7 @@ tls1_digest_cached_records(SSL *s)
240 239
241 S3I(s)->handshake_dgst[i] = EVP_MD_CTX_create(); 240 S3I(s)->handshake_dgst[i] = EVP_MD_CTX_create();
242 if (S3I(s)->handshake_dgst[i] == NULL) { 241 if (S3I(s)->handshake_dgst[i] == NULL) {
243 SSLerror( 242 SSLerror(ERR_R_MALLOC_FAILURE);
244 ERR_R_MALLOC_FAILURE);
245 goto err; 243 goto err;
246 } 244 }
247 if (!EVP_DigestInit_ex(S3I(s)->handshake_dgst[i], md, NULL)) { 245 if (!EVP_DigestInit_ex(S3I(s)->handshake_dgst[i], md, NULL)) {
@@ -385,8 +383,7 @@ tls1_PRF(long digest_mask, const void *seed1, int seed1_len, const void *seed2,
385 count++; 383 count++;
386 } 384 }
387 if (count == 0) { 385 if (count == 0) {
388 SSLerror( 386 SSLerror(SSL_R_SSL_HANDSHAKE_FAILURE);
389 SSL_R_SSL_HANDSHAKE_FAILURE);
390 goto err; 387 goto err;
391 } 388 }
392 len = slen / count; 389 len = slen / count;
@@ -397,8 +394,7 @@ tls1_PRF(long digest_mask, const void *seed1, int seed1_len, const void *seed2,
397 for (idx = 0; ssl_get_handshake_digest(idx, &m, &md); idx++) { 394 for (idx = 0; ssl_get_handshake_digest(idx, &m, &md); idx++) {
398 if ((m << TLS1_PRF_DGST_SHIFT) & digest_mask) { 395 if ((m << TLS1_PRF_DGST_SHIFT) & digest_mask) {
399 if (!md) { 396 if (!md) {
400 SSLerror( 397 SSLerror(SSL_R_UNSUPPORTED_DIGEST_TYPE);
401 SSL_R_UNSUPPORTED_DIGEST_TYPE);
402 goto err; 398 goto err;
403 } 399 }
404 if (!tls1_P_hash(md , S1, len + (slen&1), seed1, 400 if (!tls1_P_hash(md , S1, len + (slen&1), seed1,
@@ -474,8 +470,7 @@ tls1_change_cipher_state_aead(SSL *s, char is_read, const unsigned char *key,
474 EVP_AEAD_DEFAULT_TAG_LENGTH, NULL)) 470 EVP_AEAD_DEFAULT_TAG_LENGTH, NULL))
475 return (0); 471 return (0);
476 if (iv_len > sizeof(aead_ctx->fixed_nonce)) { 472 if (iv_len > sizeof(aead_ctx->fixed_nonce)) {
477 SSLerror( 473 SSLerror(ERR_R_INTERNAL_ERROR);
478 ERR_R_INTERNAL_ERROR);
479 return (0); 474 return (0);
480 } 475 }
481 memcpy(aead_ctx->fixed_nonce, iv, iv_len); 476 memcpy(aead_ctx->fixed_nonce, iv, iv_len);
@@ -491,15 +486,13 @@ tls1_change_cipher_state_aead(SSL *s, char is_read, const unsigned char *key,
491 if (aead_ctx->xor_fixed_nonce) { 486 if (aead_ctx->xor_fixed_nonce) {
492 if (aead_ctx->fixed_nonce_len != EVP_AEAD_nonce_length(aead) || 487 if (aead_ctx->fixed_nonce_len != EVP_AEAD_nonce_length(aead) ||
493 aead_ctx->variable_nonce_len > EVP_AEAD_nonce_length(aead)) { 488 aead_ctx->variable_nonce_len > EVP_AEAD_nonce_length(aead)) {
494 SSLerror( 489 SSLerror(ERR_R_INTERNAL_ERROR);
495 ERR_R_INTERNAL_ERROR);
496 return (0); 490 return (0);
497 } 491 }
498 } else { 492 } else {
499 if (aead_ctx->variable_nonce_len + aead_ctx->fixed_nonce_len != 493 if (aead_ctx->variable_nonce_len + aead_ctx->fixed_nonce_len !=
500 EVP_AEAD_nonce_length(aead)) { 494 EVP_AEAD_nonce_length(aead)) {
501 SSLerror( 495 SSLerror(ERR_R_INTERNAL_ERROR);
502 ERR_R_INTERNAL_ERROR);
503 return (0); 496 return (0);
504 } 497 }
505 } 498 }
@@ -736,8 +729,7 @@ tls1_setup_key_block(SSL *s)
736 if (s->session->cipher && 729 if (s->session->cipher &&
737 (s->session->cipher->algorithm2 & SSL_CIPHER_ALGORITHM2_AEAD)) { 730 (s->session->cipher->algorithm2 & SSL_CIPHER_ALGORITHM2_AEAD)) {
738 if (!ssl_cipher_get_evp_aead(s->session, &aead)) { 731 if (!ssl_cipher_get_evp_aead(s->session, &aead)) {
739 SSLerror( 732 SSLerror(SSL_R_CIPHER_OR_HASH_UNAVAILABLE);
740 SSL_R_CIPHER_OR_HASH_UNAVAILABLE);
741 return (0); 733 return (0);
742 } 734 }
743 key_len = EVP_AEAD_key_length(aead); 735 key_len = EVP_AEAD_key_length(aead);
@@ -745,8 +737,7 @@ tls1_setup_key_block(SSL *s)
745 } else { 737 } else {
746 if (!ssl_cipher_get_evp(s->session, &cipher, &mac, &mac_type, 738 if (!ssl_cipher_get_evp(s->session, &cipher, &mac, &mac_type,
747 &mac_secret_size)) { 739 &mac_secret_size)) {
748 SSLerror( 740 SSLerror(SSL_R_CIPHER_OR_HASH_UNAVAILABLE);
749 SSL_R_CIPHER_OR_HASH_UNAVAILABLE);
750 return (0); 741 return (0);
751 } 742 }
752 key_len = EVP_CIPHER_key_length(cipher); 743 key_len = EVP_CIPHER_key_length(cipher);
@@ -1345,8 +1336,7 @@ tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen,
1345 1336
1346 goto ret; 1337 goto ret;
1347err1: 1338err1:
1348 SSLerror( 1339 SSLerror(SSL_R_TLS_ILLEGAL_EXPORTER_LABEL);
1349 SSL_R_TLS_ILLEGAL_EXPORTER_LABEL);
1350 rv = 0; 1340 rv = 0;
1351 goto ret; 1341 goto ret;
1352err2: 1342err2: