projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace "SSLeay" in API with OpenSSL
[oweals/openssl.git]
/
crypto
/
bn
/
bn_exp.c
diff --git
a/crypto/bn/bn_exp.c
b/crypto/bn/bn_exp.c
index 28c36931a9a8c96a5471d9ccd6eecf87501bb32c..66feddcf962daf67bf21174f6caad2d86c3830c7 100644
(file)
--- a/
crypto/bn/bn_exp.c
+++ b/
crypto/bn/bn_exp.c
@@
-109,7
+109,7
@@
*
*/
*
*/
-#include "cryptlib.h"
+#include "
internal/
cryptlib.h"
#include "bn_lcl.h"
#include <stdlib.h>
#include "bn_lcl.h"
#include <stdlib.h>
@@
-126,13
+126,7
@@
# include <alloca.h>
#endif
# include <alloca.h>
#endif
-#undef RSAZ_ENABLED
-#if defined(OPENSSL_BN_ASM_MONT) && \
- (defined(__x86_64) || defined(__x86_64__) || \
- defined(_M_AMD64) || defined(_M_X64))
-# include "rsaz_exp.h"
-# define RSAZ_ENABLED
-#endif
+#include "rsaz_exp.h"
#undef SPARC_T4_MONT
#if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc))
#undef SPARC_T4_MONT
#if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc))
@@
-668,12
+662,13
@@
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
bn_check_top(p);
bn_check_top(m);
bn_check_top(p);
bn_check_top(m);
- top = m->top;
-
- if (!(m->d[0] & 1)) {
+ if (!BN_is_odd(m)) {
BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS);
return (0);
}
BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS);
return (0);
}
+
+ top = m->top;
+
bits = BN_num_bits(p);
if (bits == 0) {
ret = BN_one(rr);
bits = BN_num_bits(p);
if (bits == 0) {
ret = BN_one(rr);
@@
-1131,8
+1126,7
@@
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
BN_MONT_CTX_free(mont);
if (powerbuf != NULL) {
OPENSSL_cleanse(powerbuf, powerbufLen);
BN_MONT_CTX_free(mont);
if (powerbuf != NULL) {
OPENSSL_cleanse(powerbuf, powerbufLen);
- if (powerbufFree)
- OPENSSL_free(powerbufFree);
+ OPENSSL_free(powerbufFree);
}
BN_CTX_end(ctx);
return (ret);
}
BN_CTX_end(ctx);
return (ret);