diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_key.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 13 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_mult.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp224.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp256.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp521.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nistz256.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/ecdh/ech_lib.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/ecdsa/ecs_lib.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/ecdsa/ecs_vrf.c | 7 |
10 files changed, 23 insertions, 43 deletions
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c index 5a23a9823d..595b88cefc 100644 --- a/src/lib/libcrypto/ec/ec_key.c +++ b/src/lib/libcrypto/ec/ec_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_key.c,v 1.13 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: ec_key.c,v 1.14 2017/05/02 03:59:44 deraadt Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -122,9 +122,7 @@ EC_KEY_free(EC_KEY * r) | |||
| 122 | 122 | ||
| 123 | EC_EX_DATA_free_all_data(&r->method_data); | 123 | EC_EX_DATA_free_all_data(&r->method_data); |
| 124 | 124 | ||
| 125 | explicit_bzero((void *) r, sizeof(EC_KEY)); | 125 | freezero(r, sizeof(EC_KEY)); |
| 126 | |||
| 127 | free(r); | ||
| 128 | } | 126 | } |
| 129 | 127 | ||
| 130 | EC_KEY * | 128 | EC_KEY * |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index baddbf6dc8..0d062111b5 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_lib.c,v 1.23 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.24 2017/05/02 03:59:44 deraadt Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -151,12 +151,8 @@ EC_GROUP_clear_free(EC_GROUP * group) | |||
| 151 | BN_clear_free(&group->order); | 151 | BN_clear_free(&group->order); |
| 152 | BN_clear_free(&group->cofactor); | 152 | BN_clear_free(&group->cofactor); |
| 153 | 153 | ||
| 154 | if (group->seed) { | 154 | freezero(group->seed, group->seed_len); |
| 155 | explicit_bzero(group->seed, group->seed_len); | 155 | freezero(group, sizeof *group); |
| 156 | free(group->seed); | ||
| 157 | } | ||
| 158 | explicit_bzero(group, sizeof *group); | ||
| 159 | free(group); | ||
| 160 | } | 156 | } |
| 161 | 157 | ||
| 162 | 158 | ||
| @@ -743,8 +739,7 @@ EC_POINT_clear_free(EC_POINT * point) | |||
| 743 | point->meth->point_clear_finish(point); | 739 | point->meth->point_clear_finish(point); |
| 744 | else if (point->meth->point_finish != 0) | 740 | else if (point->meth->point_finish != 0) |
| 745 | point->meth->point_finish(point); | 741 | point->meth->point_finish(point); |
| 746 | explicit_bzero(point, sizeof *point); | 742 | freezero(point, sizeof *point); |
| 747 | free(point); | ||
| 748 | } | 743 | } |
| 749 | 744 | ||
| 750 | 745 | ||
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c index e44104d21c..a565263bb6 100644 --- a/src/lib/libcrypto/ec/ec_mult.c +++ b/src/lib/libcrypto/ec/ec_mult.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_mult.c,v 1.20 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: ec_mult.c,v 1.21 2017/05/02 03:59:44 deraadt Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. | 3 | * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -177,8 +177,7 @@ ec_pre_comp_clear_free(void *pre_) | |||
| 177 | } | 177 | } |
| 178 | free(pre->points); | 178 | free(pre->points); |
| 179 | } | 179 | } |
| 180 | explicit_bzero(pre, sizeof *pre); | 180 | freezero(pre, sizeof *pre); |
| 181 | free(pre); | ||
| 182 | } | 181 | } |
| 183 | 182 | ||
| 184 | 183 | ||
diff --git a/src/lib/libcrypto/ec/ecp_nistp224.c b/src/lib/libcrypto/ec/ecp_nistp224.c index 38dd83b6d9..fce74578c7 100644 --- a/src/lib/libcrypto/ec/ecp_nistp224.c +++ b/src/lib/libcrypto/ec/ecp_nistp224.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecp_nistp224.c,v 1.18 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: ecp_nistp224.c,v 1.19 2017/05/02 03:59:44 deraadt Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Emilia Kasper (Google) for the OpenSSL project. | 3 | * Written by Emilia Kasper (Google) for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -1239,8 +1239,7 @@ nistp224_pre_comp_clear_free(void *pre_) | |||
| 1239 | if (i > 0) | 1239 | if (i > 0) |
| 1240 | return; | 1240 | return; |
| 1241 | 1241 | ||
| 1242 | explicit_bzero(pre, sizeof *pre); | 1242 | freezero(pre, sizeof *pre); |
| 1243 | free(pre); | ||
| 1244 | } | 1243 | } |
| 1245 | 1244 | ||
| 1246 | /******************************************************************************/ | 1245 | /******************************************************************************/ |
diff --git a/src/lib/libcrypto/ec/ecp_nistp256.c b/src/lib/libcrypto/ec/ecp_nistp256.c index 4771a92efd..6f3ec3c250 100644 --- a/src/lib/libcrypto/ec/ecp_nistp256.c +++ b/src/lib/libcrypto/ec/ecp_nistp256.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecp_nistp256.c,v 1.17 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: ecp_nistp256.c,v 1.18 2017/05/02 03:59:44 deraadt Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Adam Langley (Google) for the OpenSSL project | 3 | * Written by Adam Langley (Google) for the OpenSSL project |
| 4 | */ | 4 | */ |
| @@ -1788,8 +1788,7 @@ nistp256_pre_comp_clear_free(void *pre_) | |||
| 1788 | if (i > 0) | 1788 | if (i > 0) |
| 1789 | return; | 1789 | return; |
| 1790 | 1790 | ||
| 1791 | explicit_bzero(pre, sizeof *pre); | 1791 | freezero(pre, sizeof *pre); |
| 1792 | free(pre); | ||
| 1793 | } | 1792 | } |
| 1794 | 1793 | ||
| 1795 | /******************************************************************************/ | 1794 | /******************************************************************************/ |
diff --git a/src/lib/libcrypto/ec/ecp_nistp521.c b/src/lib/libcrypto/ec/ecp_nistp521.c index 22bafe392f..6dbc266937 100644 --- a/src/lib/libcrypto/ec/ecp_nistp521.c +++ b/src/lib/libcrypto/ec/ecp_nistp521.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecp_nistp521.c,v 1.18 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: ecp_nistp521.c,v 1.19 2017/05/02 03:59:44 deraadt Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Adam Langley (Google) for the OpenSSL project | 3 | * Written by Adam Langley (Google) for the OpenSSL project |
| 4 | */ | 4 | */ |
| @@ -1679,8 +1679,7 @@ nistp521_pre_comp_clear_free(void *pre_) | |||
| 1679 | if (i > 0) | 1679 | if (i > 0) |
| 1680 | return; | 1680 | return; |
| 1681 | 1681 | ||
| 1682 | explicit_bzero(pre, sizeof(*pre)); | 1682 | freezero(pre, sizeof(*pre)); |
| 1683 | free(pre); | ||
| 1684 | } | 1683 | } |
| 1685 | 1684 | ||
| 1686 | /******************************************************************************/ | 1685 | /******************************************************************************/ |
diff --git a/src/lib/libcrypto/ec/ecp_nistz256.c b/src/lib/libcrypto/ec/ecp_nistz256.c index 848f15cb17..b3b8f74b14 100644 --- a/src/lib/libcrypto/ec/ecp_nistz256.c +++ b/src/lib/libcrypto/ec/ecp_nistz256.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecp_nistz256.c,v 1.2 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: ecp_nistz256.c,v 1.3 2017/05/02 03:59:44 deraadt Exp $ */ |
| 2 | /* Copyright (c) 2014, Intel Corporation. | 2 | /* Copyright (c) 2014, Intel Corporation. |
| 3 | * | 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for any | 4 | * Permission to use, copy, modify, and/or distribute this software for any |
| @@ -1118,11 +1118,9 @@ ecp_nistz256_pre_comp_clear_free(void *pre_) | |||
| 1118 | * here, but the only place where we allocate this uses | 1118 | * here, but the only place where we allocate this uses |
| 1119 | * PRECOMP256_ROW (i.e. 64 P256_POINT_AFFINE) but sets w == 7. | 1119 | * PRECOMP256_ROW (i.e. 64 P256_POINT_AFFINE) but sets w == 7. |
| 1120 | */ | 1120 | */ |
| 1121 | explicit_bzero(pre->precomp, 37 * sizeof(PRECOMP256_ROW)); | 1121 | freezero(pre->precomp, 37 * sizeof(PRECOMP256_ROW)); |
| 1122 | free(pre->precomp); | ||
| 1123 | } | 1122 | } |
| 1124 | explicit_bzero(pre, sizeof *pre); | 1123 | freezero(pre, sizeof *pre); |
| 1125 | free(pre); | ||
| 1126 | } | 1124 | } |
| 1127 | 1125 | ||
| 1128 | static int | 1126 | static int |
diff --git a/src/lib/libcrypto/ecdh/ech_lib.c b/src/lib/libcrypto/ecdh/ech_lib.c index 06e6a1ee22..2846a88612 100644 --- a/src/lib/libcrypto/ecdh/ech_lib.c +++ b/src/lib/libcrypto/ecdh/ech_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ech_lib.c,v 1.12 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: ech_lib.c,v 1.13 2017/05/02 03:59:44 deraadt Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 4 | * | 4 | * |
| @@ -182,9 +182,7 @@ ecdh_data_free(void *data) | |||
| 182 | 182 | ||
| 183 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, r, &r->ex_data); | 183 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, r, &r->ex_data); |
| 184 | 184 | ||
| 185 | explicit_bzero((void *)r, sizeof(ECDH_DATA)); | 185 | freezero(r, sizeof(ECDH_DATA)); |
| 186 | |||
| 187 | free(r); | ||
| 188 | } | 186 | } |
| 189 | 187 | ||
| 190 | ECDH_DATA * | 188 | ECDH_DATA * |
diff --git a/src/lib/libcrypto/ecdsa/ecs_lib.c b/src/lib/libcrypto/ecdsa/ecs_lib.c index ca0f51b366..4fbe1e060b 100644 --- a/src/lib/libcrypto/ecdsa/ecs_lib.c +++ b/src/lib/libcrypto/ecdsa/ecs_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecs_lib.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: ecs_lib.c,v 1.12 2017/05/02 03:59:44 deraadt Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -169,9 +169,7 @@ ecdsa_data_free(void *data) | |||
| 169 | #endif | 169 | #endif |
| 170 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, r, &r->ex_data); | 170 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, r, &r->ex_data); |
| 171 | 171 | ||
| 172 | explicit_bzero((void *)r, sizeof(ECDSA_DATA)); | 172 | freezero(r, sizeof(ECDSA_DATA)); |
| 173 | |||
| 174 | free(r); | ||
| 175 | } | 173 | } |
| 176 | 174 | ||
| 177 | ECDSA_DATA * | 175 | ECDSA_DATA * |
diff --git a/src/lib/libcrypto/ecdsa/ecs_vrf.c b/src/lib/libcrypto/ecdsa/ecs_vrf.c index a4b627ace6..270af94c0d 100644 --- a/src/lib/libcrypto/ecdsa/ecs_vrf.c +++ b/src/lib/libcrypto/ecdsa/ecs_vrf.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecs_vrf.c,v 1.5 2015/02/08 13:35:07 jsing Exp $ */ | 1 | /* $OpenBSD: ecs_vrf.c,v 1.6 2017/05/02 03:59:44 deraadt Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project | 3 | * Written by Nils Larsch for the OpenSSL project |
| 4 | */ | 4 | */ |
| @@ -107,10 +107,7 @@ ECDSA_verify(int type, const unsigned char *dgst, int dgst_len, | |||
| 107 | ret = ECDSA_do_verify(dgst, dgst_len, s, eckey); | 107 | ret = ECDSA_do_verify(dgst, dgst_len, s, eckey); |
| 108 | 108 | ||
| 109 | err: | 109 | err: |
| 110 | if (derlen > 0) { | 110 | freezero(der, derlen); |
| 111 | explicit_bzero(der, derlen); | ||
| 112 | free(der); | ||
| 113 | } | ||
| 114 | ECDSA_SIG_free(s); | 111 | ECDSA_SIG_free(s); |
| 115 | return (ret); | 112 | return (ret); |
| 116 | } | 113 | } |
