projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT2210: Add missing EVP_cleanup to example
[oweals/openssl.git]
/
crypto
/
bn
/
bn_mod.c
diff --git
a/crypto/bn/bn_mod.c
b/crypto/bn/bn_mod.c
index 5cf82480d7bafb8e61b52ef62f44118e1acf9d30..49c74fbb834daee5605531e4b3f8cc3dadf456f6 100644
(file)
--- a/
crypto/bn/bn_mod.c
+++ b/
crypto/bn/bn_mod.c
@@
-111,6
+111,8
@@
* [including the GNU Public Licence.]
*/
* [including the GNU Public Licence.]
*/
+#define OPENSSL_FIPSAPI
+
#include "cryptlib.h"
#include "bn_lcl.h"
#include "cryptlib.h"
#include "bn_lcl.h"
@@
-149,7
+151,7
@@
int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_
* and less than m */
int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m)
{
* and less than m */
int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m)
{
- if (!BN_add(r, a, b)) return 0;
+ if (!BN_
u
add(r, a, b)) return 0;
if (BN_ucmp(r, m) >= 0)
return BN_usub(r, r, m);
return 1;
if (BN_ucmp(r, m) >= 0)
return BN_usub(r, r, m);
return 1;
@@
-192,6
+194,7
@@
int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
else
{ if (!BN_mul(t,a,b,ctx)) goto err; }
if (!BN_nnmod(r,t,m,ctx)) goto err;
else
{ if (!BN_mul(t,a,b,ctx)) goto err; }
if (!BN_nnmod(r,t,m,ctx)) goto err;
+ bn_check_top(r);
ret=1;
err:
BN_CTX_end(ctx);
ret=1;
err:
BN_CTX_end(ctx);
@@
-210,6
+213,7
@@
int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
{
if (!BN_lshift1(r, a)) return 0;
int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
{
if (!BN_lshift1(r, a)) return 0;
+ bn_check_top(r);
return BN_nnmod(r, r, m, ctx);
}
return BN_nnmod(r, r, m, ctx);
}
@@
-219,6
+223,7
@@
int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m)
{
if (!BN_lshift1(r, a)) return 0;
int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m)
{
if (!BN_lshift1(r, a)) return 0;
+ bn_check_top(r);
if (BN_cmp(r, m) >= 0)
return BN_sub(r, r, m);
return 1;
if (BN_cmp(r, m) >= 0)
return BN_sub(r, r, m);
return 1;
@@
-240,6
+245,7
@@
int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ct
}
ret = BN_mod_lshift_quick(r, r, n, (abs_m ? abs_m : m));
}
ret = BN_mod_lshift_quick(r, r, n, (abs_m ? abs_m : m));
+ bn_check_top(r);
if (abs_m)
BN_free(abs_m);
if (abs_m)
BN_free(abs_m);
@@
-291,6
+297,7
@@
int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m)
if (!BN_sub(r, r, m)) return 0;
}
}
if (!BN_sub(r, r, m)) return 0;
}
}
+ bn_check_top(r);
return 1;
}
return 1;
}