summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp
diff options
context:
space:
mode:
authorjsing <>2015-09-10 15:56:26 +0000
committerjsing <>2015-09-10 15:56:26 +0000
commit1b9402de2dd1b97eca2be1996ed51c82f0663c92 (patch)
tree27c1922db8e3f519794fe6a13a1dfba3d4759090 /src/lib/libcrypto/evp
parente1b77a3f14ebb06ead650e78b43ddd6546237b0a (diff)
downloadopenbsd-1b9402de2dd1b97eca2be1996ed51c82f0663c92.tar.gz
openbsd-1b9402de2dd1b97eca2be1996ed51c82f0663c92.tar.bz2
openbsd-1b9402de2dd1b97eca2be1996ed51c82f0663c92.zip
Correct spelling of OPENSSL_cleanse.
ok miod@
Diffstat (limited to 'src/lib/libcrypto/evp')
-rw-r--r--src/lib/libcrypto/evp/bio_enc.c4
-rw-r--r--src/lib/libcrypto/evp/e_aes.c10
-rw-r--r--src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c4
-rw-r--r--src/lib/libcrypto/evp/e_chacha20poly1305.c4
-rw-r--r--src/lib/libcrypto/evp/e_idea.c5
-rw-r--r--src/lib/libcrypto/evp/evp_enc.c4
-rw-r--r--src/lib/libcrypto/evp/evp_key.c6
-rw-r--r--src/lib/libcrypto/evp/p5_crpt.c8
-rw-r--r--src/lib/libcrypto/evp/p5_crpt2.c4
-rw-r--r--src/lib/libcrypto/evp/p_open.c5
10 files changed, 28 insertions, 26 deletions
diff --git a/src/lib/libcrypto/evp/bio_enc.c b/src/lib/libcrypto/evp/bio_enc.c
index e367faa967..1920c6d180 100644
--- a/src/lib/libcrypto/evp/bio_enc.c
+++ b/src/lib/libcrypto/evp/bio_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_enc.c,v 1.18 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: bio_enc.c,v 1.19 2015/09/10 15:56:25 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 *
@@ -135,7 +135,7 @@ enc_free(BIO *a)
135 return (0); 135 return (0);
136 b = (BIO_ENC_CTX *)a->ptr; 136 b = (BIO_ENC_CTX *)a->ptr;
137 EVP_CIPHER_CTX_cleanup(&(b->cipher)); 137 EVP_CIPHER_CTX_cleanup(&(b->cipher));
138 OPENSSL_cleanse(a->ptr, sizeof(BIO_ENC_CTX)); 138 explicit_bzero(a->ptr, sizeof(BIO_ENC_CTX));
139 free(a->ptr); 139 free(a->ptr);
140 a->ptr = NULL; 140 a->ptr = NULL;
141 a->init = 0; 141 a->init = 0;
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c
index 0a9455a5d2..a6d48085c3 100644
--- a/src/lib/libcrypto/evp/e_aes.c
+++ b/src/lib/libcrypto/evp/e_aes.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_aes.c,v 1.28 2015/06/20 12:01:14 jsing Exp $ */ 1/* $OpenBSD: e_aes.c,v 1.29 2015/09/10 15:56:25 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -690,7 +690,7 @@ aes_gcm_cleanup(EVP_CIPHER_CTX *c)
690 690
691 if (gctx->iv != c->iv) 691 if (gctx->iv != c->iv)
692 free(gctx->iv); 692 free(gctx->iv);
693 OPENSSL_cleanse(gctx, sizeof(*gctx)); 693 explicit_bzero(gctx, sizeof(*gctx));
694 return 1; 694 return 1;
695} 695}
696 696
@@ -972,7 +972,7 @@ aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
972 972
973 /* If tag mismatch wipe buffer */ 973 /* If tag mismatch wipe buffer */
974 if (memcmp(ctx->buf, in + len, EVP_GCM_TLS_TAG_LEN)) { 974 if (memcmp(ctx->buf, in + len, EVP_GCM_TLS_TAG_LEN)) {
975 OPENSSL_cleanse(out, len); 975 explicit_bzero(out, len);
976 goto err; 976 goto err;
977 } 977 }
978 rv = len; 978 rv = len;
@@ -1339,7 +1339,7 @@ aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
1339 } 1339 }
1340 } 1340 }
1341 if (rv == -1) 1341 if (rv == -1)
1342 OPENSSL_cleanse(out, len); 1342 explicit_bzero(out, len);
1343 cctx->iv_set = 0; 1343 cctx->iv_set = 0;
1344 cctx->tag_set = 0; 1344 cctx->tag_set = 0;
1345 cctx->len_set = 0; 1345 cctx->len_set = 0;
@@ -1417,7 +1417,7 @@ aead_aes_gcm_cleanup(EVP_AEAD_CTX *ctx)
1417{ 1417{
1418 struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state; 1418 struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state;
1419 1419
1420 OPENSSL_cleanse(gcm_ctx, sizeof(*gcm_ctx)); 1420 explicit_bzero(gcm_ctx, sizeof(*gcm_ctx));
1421 free(gcm_ctx); 1421 free(gcm_ctx);
1422} 1422}
1423 1423
diff --git a/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c b/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
index 7c23face34..c76c2b1c52 100644
--- a/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
+++ b/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_aes_cbc_hmac_sha1.c,v 1.8 2014/07/12 20:37:07 miod Exp $ */ 1/* $OpenBSD: e_aes_cbc_hmac_sha1.c,v 1.9 2015/09/10 15:56:25 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -502,7 +502,7 @@ aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
502 SHA1_Init(&key->tail); 502 SHA1_Init(&key->tail);
503 SHA1_Update(&key->tail, hmac_key, sizeof(hmac_key)); 503 SHA1_Update(&key->tail, hmac_key, sizeof(hmac_key));
504 504
505 OPENSSL_cleanse(hmac_key, sizeof(hmac_key)); 505 explicit_bzero(hmac_key, sizeof(hmac_key));
506 506
507 return 1; 507 return 1;
508 } 508 }
diff --git a/src/lib/libcrypto/evp/e_chacha20poly1305.c b/src/lib/libcrypto/evp/e_chacha20poly1305.c
index c003b0ba7f..9deb40b72a 100644
--- a/src/lib/libcrypto/evp/e_chacha20poly1305.c
+++ b/src/lib/libcrypto/evp/e_chacha20poly1305.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_chacha20poly1305.c,v 1.9 2015/06/20 12:01:14 jsing Exp $ */ 1/* $OpenBSD: e_chacha20poly1305.c,v 1.10 2015/09/10 15:56:25 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -71,7 +71,7 @@ aead_chacha20_poly1305_cleanup(EVP_AEAD_CTX *ctx)
71{ 71{
72 struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state; 72 struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state;
73 73
74 OPENSSL_cleanse(c20_ctx->key, sizeof(c20_ctx->key)); 74 explicit_bzero(c20_ctx->key, sizeof(c20_ctx->key));
75 free(c20_ctx); 75 free(c20_ctx);
76} 76}
77 77
diff --git a/src/lib/libcrypto/evp/e_idea.c b/src/lib/libcrypto/evp/e_idea.c
index 3ba4dbcdb9..454ad4e672 100644
--- a/src/lib/libcrypto/evp/e_idea.c
+++ b/src/lib/libcrypto/evp/e_idea.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_idea.c,v 1.9 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: e_idea.c,v 1.10 2015/09/10 15:56:25 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 *
@@ -57,6 +57,7 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h>
60 61
61#include <openssl/opensslconf.h> 62#include <openssl/opensslconf.h>
62 63
@@ -115,7 +116,7 @@ idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
115 116
116 idea_set_encrypt_key(key, &tmp); 117 idea_set_encrypt_key(key, &tmp);
117 idea_set_decrypt_key(&tmp, ctx->cipher_data); 118 idea_set_decrypt_key(&tmp, ctx->cipher_data);
118 OPENSSL_cleanse((unsigned char *)&tmp, 119 explicit_bzero((unsigned char *)&tmp,
119 sizeof(IDEA_KEY_SCHEDULE)); 120 sizeof(IDEA_KEY_SCHEDULE));
120 } 121 }
121 return 1; 122 return 1;
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c
index 42ccfceec9..99bf59e05f 100644
--- a/src/lib/libcrypto/evp/evp_enc.c
+++ b/src/lib/libcrypto/evp/evp_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_enc.c,v 1.26 2015/02/10 09:52:35 miod Exp $ */ 1/* $OpenBSD: evp_enc.c,v 1.27 2015/09/10 15:56:25 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 *
@@ -562,7 +562,7 @@ EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
562 return 0; 562 return 0;
563 /* Cleanse cipher context data */ 563 /* Cleanse cipher context data */
564 if (c->cipher_data) 564 if (c->cipher_data)
565 OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); 565 explicit_bzero(c->cipher_data, c->cipher->ctx_size);
566 } 566 }
567 free(c->cipher_data); 567 free(c->cipher_data);
568#ifndef OPENSSL_NO_ENGINE 568#ifndef OPENSSL_NO_ENGINE
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c
index 0678536ccb..2c76743e42 100644
--- a/src/lib/libcrypto/evp/evp_key.c
+++ b/src/lib/libcrypto/evp/evp_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_key.c,v 1.22 2015/02/10 09:55:39 miod Exp $ */ 1/* $OpenBSD: evp_key.c,v 1.23 2015/09/10 15:56:25 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 *
@@ -116,7 +116,7 @@ EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt,
116 } 116 }
117 ret = UI_process(ui); 117 ret = UI_process(ui);
118 UI_free(ui); 118 UI_free(ui);
119 OPENSSL_cleanse(buff, BUFSIZ); 119 explicit_bzero(buff, BUFSIZ);
120 return ret; 120 return ret;
121} 121}
122 122
@@ -201,6 +201,6 @@ EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
201 201
202err: 202err:
203 EVP_MD_CTX_cleanup(&c); 203 EVP_MD_CTX_cleanup(&c);
204 OPENSSL_cleanse(md_buf, sizeof md_buf); 204 explicit_bzero(md_buf, sizeof md_buf);
205 return rv; 205 return rv;
206} 206}
diff --git a/src/lib/libcrypto/evp/p5_crpt.c b/src/lib/libcrypto/evp/p5_crpt.c
index 112a69114c..626910fd7a 100644
--- a/src/lib/libcrypto/evp/p5_crpt.c
+++ b/src/lib/libcrypto/evp/p5_crpt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p5_crpt.c,v 1.15 2015/02/10 09:52:35 miod Exp $ */ 1/* $OpenBSD: p5_crpt.c,v 1.16 2015/09/10 15:56:25 jsing Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -147,9 +147,9 @@ PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
147 EVP_CIPHER_iv_length(cipher)); 147 EVP_CIPHER_iv_length(cipher));
148 if (!EVP_CipherInit_ex(cctx, cipher, NULL, key, iv, en_de)) 148 if (!EVP_CipherInit_ex(cctx, cipher, NULL, key, iv, en_de))
149 goto err; 149 goto err;
150 OPENSSL_cleanse(md_tmp, EVP_MAX_MD_SIZE); 150 explicit_bzero(md_tmp, EVP_MAX_MD_SIZE);
151 OPENSSL_cleanse(key, EVP_MAX_KEY_LENGTH); 151 explicit_bzero(key, EVP_MAX_KEY_LENGTH);
152 OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH); 152 explicit_bzero(iv, EVP_MAX_IV_LENGTH);
153 rv = 1; 153 rv = 1;
154err: 154err:
155 EVP_MD_CTX_cleanup(&ctx); 155 EVP_MD_CTX_cleanup(&ctx);
diff --git a/src/lib/libcrypto/evp/p5_crpt2.c b/src/lib/libcrypto/evp/p5_crpt2.c
index afafb9551f..632c2c76ce 100644
--- a/src/lib/libcrypto/evp/p5_crpt2.c
+++ b/src/lib/libcrypto/evp/p5_crpt2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p5_crpt2.c,v 1.20 2015/02/14 15:49:51 miod Exp $ */ 1/* $OpenBSD: p5_crpt2.c,v 1.21 2015/09/10 15:56:25 jsing Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -300,7 +300,7 @@ PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
300 rv = EVP_CipherInit_ex(ctx, NULL, NULL, key, NULL, en_de); 300 rv = EVP_CipherInit_ex(ctx, NULL, NULL, key, NULL, en_de);
301 301
302err: 302err:
303 OPENSSL_cleanse(key, keylen); 303 explicit_bzero(key, keylen);
304 PBKDF2PARAM_free(kdf); 304 PBKDF2PARAM_free(kdf);
305 return rv; 305 return rv;
306} 306}
diff --git a/src/lib/libcrypto/evp/p_open.c b/src/lib/libcrypto/evp/p_open.c
index aca83e74f6..002a6dea70 100644
--- a/src/lib/libcrypto/evp/p_open.c
+++ b/src/lib/libcrypto/evp/p_open.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_open.c,v 1.16 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: p_open.c,v 1.17 2015/09/10 15:56:25 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 *
@@ -57,6 +57,7 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h>
60 61
61#include <openssl/opensslconf.h> 62#include <openssl/opensslconf.h>
62 63
@@ -109,7 +110,7 @@ EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
109 110
110err: 111err:
111 if (key != NULL) 112 if (key != NULL)
112 OPENSSL_cleanse(key, size); 113 explicit_bzero(key, size);
113 free(key); 114 free(key);
114 return (ret); 115 return (ret);
115} 116}