diff options
author | aSoujyuTanaka <soujyu.tanaka@access-company.com> | 2020-04-12 03:58:44 +0900 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-07-15 23:06:03 +0200 |
commit | 88bc70366b0cfd77616083c550a40fb0f84c5379 (patch) | |
tree | 9d7794f229b93b45889ad4d2d30ab2a99731ac89 | |
parent | 4da1981faacf2e141aab2b4965fccfd676765648 (diff) |
Disable optimiization of BN_num_bits_word() for VS2005 ARM compiler due to
its miscompilation of the function.
https://mta.openssl.org/pipermail/openssl-users/2018-August/008465.html
Reviewed-by: Mark J. Cox <mark@awe.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11526)
(cherry picked from commit 7a09fab2b3d201062a2cc07c1a40d09d61ea31bd)
-rw-r--r-- | crypto/bn/bn_lib.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c index 759d4c70ed..438743e48d 100644 --- a/crypto/bn/bn_lib.c +++ b/crypto/bn/bn_lib.c @@ -87,6 +87,15 @@ const BIGNUM *BN_value_one(void) return &const_one; } +/* + * Old Visual Studio ARM compiler miscompiles BN_num_bits_word() + * https://mta.openssl.org/pipermail/openssl-users/2018-August/008465.html + */ +#if defined(_MSC_VER) && defined(_ARM_) && defined(_WIN32_WCE) \ + && _MSC_VER>=1400 && _MSC_VER<1501 +# define MS_BROKEN_BN_num_bits_word +# pragma optimize("", off) +#endif int BN_num_bits_word(BN_ULONG l) { BN_ULONG x, mask; @@ -131,6 +140,9 @@ int BN_num_bits_word(BN_ULONG l) return bits; } +#ifdef MS_BROKEN_BN_num_bits_word +# pragma optimize("", on) +#endif /* * This function still leaks `a->dmax`: it's caller's responsibility to |