diff options
| author | jsing <> | 2015-09-10 15:56:26 +0000 |
|---|---|---|
| committer | jsing <> | 2015-09-10 15:56:26 +0000 |
| commit | 1b9402de2dd1b97eca2be1996ed51c82f0663c92 (patch) | |
| tree | 27c1922db8e3f519794fe6a13a1dfba3d4759090 /src/lib/libcrypto/pem | |
| parent | e1b77a3f14ebb06ead650e78b43ddd6546237b0a (diff) | |
| download | openbsd-1b9402de2dd1b97eca2be1996ed51c82f0663c92.tar.gz openbsd-1b9402de2dd1b97eca2be1996ed51c82f0663c92.tar.bz2 openbsd-1b9402de2dd1b97eca2be1996ed51c82f0663c92.zip | |
Correct spelling of OPENSSL_cleanse.
ok miod@
Diffstat (limited to 'src/lib/libcrypto/pem')
| -rw-r--r-- | src/lib/libcrypto/pem/pem_info.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/pem/pem_lib.c | 22 | ||||
| -rw-r--r-- | src/lib/libcrypto/pem/pem_pk8.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/pem/pem_pkey.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/pem/pem_seal.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/pem/pvkfmt.c | 10 |
6 files changed, 26 insertions, 25 deletions
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c index 6fe72ce742..191e3b5b10 100644 --- a/src/lib/libcrypto/pem/pem_info.c +++ b/src/lib/libcrypto/pem/pem_info.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_info.c,v 1.20 2015/02/10 09:52:35 miod Exp $ */ | 1 | /* $OpenBSD: pem_info.c,v 1.21 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 | * |
| @@ -400,7 +400,7 @@ PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, | |||
| 400 | ret = 1; | 400 | ret = 1; |
| 401 | 401 | ||
| 402 | err: | 402 | err: |
| 403 | OPENSSL_cleanse((char *)&ctx, sizeof(ctx)); | 403 | explicit_bzero((char *)&ctx, sizeof(ctx)); |
| 404 | OPENSSL_cleanse(buf, PEM_BUFSIZE); | 404 | explicit_bzero(buf, PEM_BUFSIZE); |
| 405 | return (ret); | 405 | return (ret); |
| 406 | } | 406 | } |
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index 6f8759a9ee..852b0eaf86 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_lib.c,v 1.41 2015/07/19 18:29:31 miod Exp $ */ | 1 | /* $OpenBSD: pem_lib.c,v 1.42 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 | * |
| @@ -403,7 +403,7 @@ PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, | |||
| 403 | goto err; | 403 | goto err; |
| 404 | 404 | ||
| 405 | if (kstr == (unsigned char *)buf) | 405 | if (kstr == (unsigned char *)buf) |
| 406 | OPENSSL_cleanse(buf, PEM_BUFSIZE); | 406 | explicit_bzero(buf, PEM_BUFSIZE); |
| 407 | 407 | ||
| 408 | if (strlen(objstr) + 23 + 2 * enc->iv_len + 13 > sizeof buf) { | 408 | if (strlen(objstr) + 23 + 2 * enc->iv_len + 13 > sizeof buf) { |
| 409 | PEMerr(PEM_F_PEM_ASN1_WRITE_BIO, | 409 | PEMerr(PEM_F_PEM_ASN1_WRITE_BIO, |
| @@ -434,12 +434,12 @@ PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, | |||
| 434 | if (i <= 0) | 434 | if (i <= 0) |
| 435 | ret = 0; | 435 | ret = 0; |
| 436 | err: | 436 | err: |
| 437 | OPENSSL_cleanse(key, sizeof(key)); | 437 | explicit_bzero(key, sizeof(key)); |
| 438 | OPENSSL_cleanse(iv, sizeof(iv)); | 438 | explicit_bzero(iv, sizeof(iv)); |
| 439 | OPENSSL_cleanse((char *)&ctx, sizeof(ctx)); | 439 | explicit_bzero((char *)&ctx, sizeof(ctx)); |
| 440 | OPENSSL_cleanse(buf, PEM_BUFSIZE); | 440 | explicit_bzero(buf, PEM_BUFSIZE); |
| 441 | if (data != NULL) { | 441 | if (data != NULL) { |
| 442 | OPENSSL_cleanse(data, (unsigned int)dsize); | 442 | explicit_bzero(data, (unsigned int)dsize); |
| 443 | free(data); | 443 | free(data); |
| 444 | } | 444 | } |
| 445 | return (ret); | 445 | return (ret); |
| @@ -480,8 +480,8 @@ PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen, | |||
| 480 | if (o) | 480 | if (o) |
| 481 | o = EVP_DecryptFinal_ex(&ctx, &(data[i]), &j); | 481 | o = EVP_DecryptFinal_ex(&ctx, &(data[i]), &j); |
| 482 | EVP_CIPHER_CTX_cleanup(&ctx); | 482 | EVP_CIPHER_CTX_cleanup(&ctx); |
| 483 | OPENSSL_cleanse((char *)buf, sizeof(buf)); | 483 | explicit_bzero((char *)buf, sizeof(buf)); |
| 484 | OPENSSL_cleanse((char *)key, sizeof(key)); | 484 | explicit_bzero((char *)key, sizeof(key)); |
| 485 | if (!o) { | 485 | if (!o) { |
| 486 | PEMerr(PEM_F_PEM_DO_HEADER, PEM_R_BAD_DECRYPT); | 486 | PEMerr(PEM_F_PEM_DO_HEADER, PEM_R_BAD_DECRYPT); |
| 487 | return (0); | 487 | return (0); |
| @@ -640,7 +640,7 @@ PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data, | |||
| 640 | EVP_EncodeFinal(&ctx, buf, &outl); | 640 | EVP_EncodeFinal(&ctx, buf, &outl); |
| 641 | if ((outl > 0) && (BIO_write(bp, (char *)buf, outl) != outl)) | 641 | if ((outl > 0) && (BIO_write(bp, (char *)buf, outl) != outl)) |
| 642 | goto err; | 642 | goto err; |
| 643 | OPENSSL_cleanse(buf, PEM_BUFSIZE * 8); | 643 | explicit_bzero(buf, PEM_BUFSIZE * 8); |
| 644 | free(buf); | 644 | free(buf); |
| 645 | buf = NULL; | 645 | buf = NULL; |
| 646 | if ((BIO_write(bp, "-----END ", 9) != 9) || | 646 | if ((BIO_write(bp, "-----END ", 9) != 9) || |
| @@ -651,7 +651,7 @@ PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data, | |||
| 651 | 651 | ||
| 652 | err: | 652 | err: |
| 653 | if (buf) { | 653 | if (buf) { |
| 654 | OPENSSL_cleanse(buf, PEM_BUFSIZE * 8); | 654 | explicit_bzero(buf, PEM_BUFSIZE * 8); |
| 655 | free(buf); | 655 | free(buf); |
| 656 | } | 656 | } |
| 657 | PEMerr(PEM_F_PEM_WRITE_BIO, reason); | 657 | PEMerr(PEM_F_PEM_WRITE_BIO, reason); |
diff --git a/src/lib/libcrypto/pem/pem_pk8.c b/src/lib/libcrypto/pem/pem_pk8.c index 5b0fcc236b..d02dec1546 100644 --- a/src/lib/libcrypto/pem/pem_pk8.c +++ b/src/lib/libcrypto/pem/pem_pk8.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_pk8.c,v 1.9 2014/10/18 17:20:40 jsing Exp $ */ | 1 | /* $OpenBSD: pem_pk8.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/buffer.h> | 62 | #include <openssl/buffer.h> |
| 62 | #include <openssl/err.h> | 63 | #include <openssl/err.h> |
| @@ -135,7 +136,7 @@ do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid, const EVP_CIPHER *enc, | |||
| 135 | } | 136 | } |
| 136 | p8 = PKCS8_encrypt(nid, enc, kstr, klen, NULL, 0, 0, p8inf); | 137 | p8 = PKCS8_encrypt(nid, enc, kstr, klen, NULL, 0, 0, p8inf); |
| 137 | if (kstr == buf) | 138 | if (kstr == buf) |
| 138 | OPENSSL_cleanse(buf, klen); | 139 | explicit_bzero(buf, klen); |
| 139 | PKCS8_PRIV_KEY_INFO_free(p8inf); | 140 | PKCS8_PRIV_KEY_INFO_free(p8inf); |
| 140 | if (isder) | 141 | if (isder) |
| 141 | ret = i2d_PKCS8_bio(bp, p8); | 142 | ret = i2d_PKCS8_bio(bp, p8); |
diff --git a/src/lib/libcrypto/pem/pem_pkey.c b/src/lib/libcrypto/pem/pem_pkey.c index e9c0a8b1c9..afb476f818 100644 --- a/src/lib/libcrypto/pem/pem_pkey.c +++ b/src/lib/libcrypto/pem/pem_pkey.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_pkey.c,v 1.20 2015/02/11 03:19:37 doug Exp $ */ | 1 | /* $OpenBSD: pem_pkey.c,v 1.21 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 | * |
| @@ -144,7 +144,7 @@ p8err: | |||
| 144 | PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY, ERR_R_ASN1_LIB); | 144 | PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY, ERR_R_ASN1_LIB); |
| 145 | err: | 145 | err: |
| 146 | free(nm); | 146 | free(nm); |
| 147 | OPENSSL_cleanse(data, len); | 147 | explicit_bzero(data, len); |
| 148 | free(data); | 148 | free(data); |
| 149 | return (ret); | 149 | return (ret); |
| 150 | } | 150 | } |
diff --git a/src/lib/libcrypto/pem/pem_seal.c b/src/lib/libcrypto/pem/pem_seal.c index 08837bd7f7..96687eb77f 100644 --- a/src/lib/libcrypto/pem/pem_seal.c +++ b/src/lib/libcrypto/pem/pem_seal.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pem_seal.c,v 1.21 2014/10/18 17:20:40 jsing Exp $ */ | 1 | /* $OpenBSD: pem_seal.c,v 1.22 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 | * |
| @@ -117,7 +117,7 @@ PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, | |||
| 117 | 117 | ||
| 118 | err: | 118 | err: |
| 119 | free(s); | 119 | free(s); |
| 120 | OPENSSL_cleanse(key, EVP_MAX_KEY_LENGTH); | 120 | explicit_bzero(key, EVP_MAX_KEY_LENGTH); |
| 121 | return (ret); | 121 | return (ret); |
| 122 | } | 122 | } |
| 123 | 123 | ||
diff --git a/src/lib/libcrypto/pem/pvkfmt.c b/src/lib/libcrypto/pem/pvkfmt.c index 025381bcc0..f5a9de39fc 100644 --- a/src/lib/libcrypto/pem/pvkfmt.c +++ b/src/lib/libcrypto/pem/pvkfmt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pvkfmt.c,v 1.13 2015/05/15 11:00:14 jsg Exp $ */ | 1 | /* $OpenBSD: pvkfmt.c,v 1.14 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 2005. | 3 | * project 2005. |
| 4 | */ | 4 | */ |
| @@ -765,7 +765,7 @@ do_PVK_body(const unsigned char **in, unsigned int saltlen, | |||
| 765 | if (!EVP_DecryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf, | 765 | if (!EVP_DecryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf, |
| 766 | NULL)) | 766 | NULL)) |
| 767 | goto err; | 767 | goto err; |
| 768 | OPENSSL_cleanse(keybuf, 20); | 768 | explicit_bzero(keybuf, 20); |
| 769 | if (!EVP_DecryptUpdate(&cctx, q, &enctmplen, p, inlen)) | 769 | if (!EVP_DecryptUpdate(&cctx, q, &enctmplen, p, inlen)) |
| 770 | goto err; | 770 | goto err; |
| 771 | if (!EVP_DecryptFinal_ex(&cctx, q + enctmplen, | 771 | if (!EVP_DecryptFinal_ex(&cctx, q + enctmplen, |
| @@ -777,7 +777,7 @@ do_PVK_body(const unsigned char **in, unsigned int saltlen, | |||
| 777 | goto err; | 777 | goto err; |
| 778 | } | 778 | } |
| 779 | } else | 779 | } else |
| 780 | OPENSSL_cleanse(keybuf, 20); | 780 | explicit_bzero(keybuf, 20); |
| 781 | p = enctmp; | 781 | p = enctmp; |
| 782 | } | 782 | } |
| 783 | 783 | ||
| @@ -823,7 +823,7 @@ b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u) | |||
| 823 | 823 | ||
| 824 | err: | 824 | err: |
| 825 | if (buf) { | 825 | if (buf) { |
| 826 | OPENSSL_cleanse(buf, buflen); | 826 | explicit_bzero(buf, buflen); |
| 827 | free(buf); | 827 | free(buf); |
| 828 | } | 828 | } |
| 829 | return ret; | 829 | return ret; |
| @@ -894,7 +894,7 @@ i2b_PVK(unsigned char **out, EVP_PKEY*pk, int enclevel, pem_password_cb *cb, | |||
| 894 | p = salt + PVK_SALTLEN + 8; | 894 | p = salt + PVK_SALTLEN + 8; |
| 895 | if (!EVP_EncryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf, NULL)) | 895 | if (!EVP_EncryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf, NULL)) |
| 896 | goto error; | 896 | goto error; |
| 897 | OPENSSL_cleanse(keybuf, 20); | 897 | explicit_bzero(keybuf, 20); |
| 898 | if (!EVP_DecryptUpdate(&cctx, p, &enctmplen, p, pklen - 8)) | 898 | if (!EVP_DecryptUpdate(&cctx, p, &enctmplen, p, pklen - 8)) |
| 899 | goto error; | 899 | goto error; |
| 900 | if (!EVP_DecryptFinal_ex(&cctx, p + enctmplen, &enctmplen)) | 900 | if (!EVP_DecryptFinal_ex(&cctx, p + enctmplen, &enctmplen)) |
