[openssl-commits] [openssl] OpenSSL_1_1_0-stable update
Matt Caswell
matt at openssl.org
Fri Apr 27 09:00:41 UTC 2018
The branch OpenSSL_1_1_0-stable has been updated
via b3c586753b57a3899b40d3e10e2af45d1eb515a2 (commit)
from ba1cf1b1a130f31deee8736dc225e77b746fe5df (commit)
- Log -----------------------------------------------------------------
commit b3c586753b57a3899b40d3e10e2af45d1eb515a2
Author: Billy Brumley <bbrumley at gmail.com>
Date: Thu Apr 26 19:01:22 2018 +0300
fix: BN_swap mishandles flags (1.1.0)
Reviewed-by: Rich Salz <rsalz at openssl.org>
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6101)
-----------------------------------------------------------------------
Summary of changes:
crypto/bn/bn_lib.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index 07b715d..c59bdb7 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -385,6 +385,11 @@ BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
return (a);
}
+#define FLAGS_DATA(flags) ((flags) & (BN_FLG_STATIC_DATA \
+ | BN_FLG_CONSTTIME \
+ | BN_FLG_SECURE))
+#define FLAGS_STRUCT(flags) ((flags) & (BN_FLG_MALLOCED))
+
void BN_swap(BIGNUM *a, BIGNUM *b)
{
int flags_old_a, flags_old_b;
@@ -412,10 +417,8 @@ void BN_swap(BIGNUM *a, BIGNUM *b)
b->dmax = tmp_dmax;
b->neg = tmp_neg;
- a->flags =
- (flags_old_a & BN_FLG_MALLOCED) | (flags_old_b & BN_FLG_STATIC_DATA);
- b->flags =
- (flags_old_b & BN_FLG_MALLOCED) | (flags_old_a & BN_FLG_STATIC_DATA);
+ a->flags = FLAGS_STRUCT(flags_old_a) | FLAGS_DATA(flags_old_b);
+ b->flags = FLAGS_STRUCT(flags_old_b) | FLAGS_DATA(flags_old_a);
bn_check_top(a);
bn_check_top(b);
}
More information about the openssl-commits
mailing list