summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2014-06-13 14:15:14 +0000
committerjsing <>2014-06-13 14:15:14 +0000
commitcb80be8ff44b1d20a4df76193e41656c8864d57a (patch)
tree1933b1005cb4378b77382177555866ecf50c8a18
parent2bae5c546a9a1dda04dc24f7bc3309d87f7e82dc (diff)
downloadopenbsd-cb80be8ff44b1d20a4df76193e41656c8864d57a.tar.gz
openbsd-cb80be8ff44b1d20a4df76193e41656c8864d57a.tar.bz2
openbsd-cb80be8ff44b1d20a4df76193e41656c8864d57a.zip
The export_key/export_iv variables are only used in the is_export case.
Also use c rather than &c[0].
-rw-r--r--src/lib/libssl/src/ssl/s3_enc.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/libssl/src/ssl/s3_enc.c b/src/lib/libssl/src/ssl/s3_enc.c
index 38ccc46724..1fdccbb842 100644
--- a/src/lib/libssl/src/ssl/s3_enc.c
+++ b/src/lib/libssl/src/ssl/s3_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_enc.c,v 1.42 2014/06/13 14:11:35 jsing Exp $ */ 1/* $OpenBSD: s3_enc.c,v 1.43 2014/06/13 14:15:14 jsing 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 *
@@ -355,23 +355,26 @@ ssl3_change_cipher_state(SSL *s, int which)
355 EVP_DigestUpdate(&mac_ctx, key, j); 355 EVP_DigestUpdate(&mac_ctx, key, j);
356 EVP_DigestUpdate(&mac_ctx, er1, SSL3_RANDOM_SIZE); 356 EVP_DigestUpdate(&mac_ctx, er1, SSL3_RANDOM_SIZE);
357 EVP_DigestUpdate(&mac_ctx, er2, SSL3_RANDOM_SIZE); 357 EVP_DigestUpdate(&mac_ctx, er2, SSL3_RANDOM_SIZE);
358 EVP_DigestFinal_ex(&mac_ctx, &(export_key[0]), NULL); 358 EVP_DigestFinal_ex(&mac_ctx, export_key, NULL);
359 key = &(export_key[0]); 359 key = export_key;
360 360
361 if (k > 0) { 361 if (k > 0) {
362 EVP_DigestInit_ex(&mac_ctx, EVP_md5(), NULL); 362 EVP_DigestInit_ex(&mac_ctx, EVP_md5(), NULL);
363 EVP_DigestUpdate(&mac_ctx, er1, SSL3_RANDOM_SIZE); 363 EVP_DigestUpdate(&mac_ctx, er1, SSL3_RANDOM_SIZE);
364 EVP_DigestUpdate(&mac_ctx, er2, SSL3_RANDOM_SIZE); 364 EVP_DigestUpdate(&mac_ctx, er2, SSL3_RANDOM_SIZE);
365 EVP_DigestFinal_ex(&mac_ctx, &(export_iv[0]), NULL); 365 EVP_DigestFinal_ex(&mac_ctx, export_iv, NULL);
366 iv = &(export_iv[0]); 366 iv = export_iv;
367 } 367 }
368 } 368 }
369 369
370 EVP_CipherInit_ex(cipher_ctx, cipher, NULL, key, iv, 370 EVP_CipherInit_ex(cipher_ctx, cipher, NULL, key, iv,
371 (which & SSL3_CC_WRITE)); 371 (which & SSL3_CC_WRITE));
372 372
373 OPENSSL_cleanse(&(export_key[0]), sizeof(export_key)); 373 if (is_export) {
374 OPENSSL_cleanse(&(export_iv[0]), sizeof(export_iv)); 374 OPENSSL_cleanse(export_key, sizeof(export_key));
375 OPENSSL_cleanse(export_iv, sizeof(export_iv));
376 }
377
375 EVP_MD_CTX_cleanup(&mac_ctx); 378 EVP_MD_CTX_cleanup(&mac_ctx);
376 return (1); 379 return (1);
377err: 380err: