diff options
Diffstat (limited to 'src/lib/libcrypto/ec')
-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 |
7 files changed, 17 insertions, 30 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 |