From f610a516a0e1236e21b385c4719c97403fde4a98 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 6 Jun 2011 11:49:36 +0000 Subject: Backport from HEAD: New option to disable characteristic two fields in EC code. Make no-ec2m work on Win32 build. --- crypto/bn/bn.h | 4 ++++ crypto/bn/bn_gf2m.c | 3 +++ crypto/bn/bntest.c | 8 ++++---- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'crypto/bn') diff --git a/crypto/bn/bn.h b/crypto/bn/bn.h index dc4fec4616..f34248ec4f 100644 --- a/crypto/bn/bn.h +++ b/crypto/bn/bn.h @@ -623,6 +623,8 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, BN_CTX *ctx); +#ifndef OPENSSL_NO_EC2M + /* Functions for arithmetic over binary polynomials represented by BIGNUMs. * * The BIGNUM::neg property of BIGNUMs representing binary polynomials is @@ -674,6 +676,8 @@ int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); int BN_GF2m_arr2poly(const int p[], BIGNUM *a); +#endif + /* faster mod functions for the 'NIST primes' * 0 <= a < p^2 */ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); diff --git a/crypto/bn/bn_gf2m.c b/crypto/bn/bn_gf2m.c index 527b0fa15b..3bf017feda 100644 --- a/crypto/bn/bn_gf2m.c +++ b/crypto/bn/bn_gf2m.c @@ -94,6 +94,8 @@ #include "cryptlib.h" #include "bn_lcl.h" +#ifndef OPENSSL_NO_EC2M + /* Maximum number of iterations before BN_GF2m_mod_solve_quad_arr should fail. */ #define MAX_ITERATIONS 50 @@ -1032,3 +1034,4 @@ int BN_GF2m_arr2poly(const int p[], BIGNUM *a) return 1; } +#endif diff --git a/crypto/bn/bntest.c b/crypto/bn/bntest.c index 0cd99c5b4b..06f5954acc 100644 --- a/crypto/bn/bntest.c +++ b/crypto/bn/bntest.c @@ -262,7 +262,7 @@ int main(int argc, char *argv[]) message(out,"BN_mod_sqrt"); if (!test_sqrt(out,ctx)) goto err; (void)BIO_flush(out); - +#ifndef OPENSSL_NO_EC2M message(out,"BN_GF2m_add"); if (!test_gf2m_add(out)) goto err; (void)BIO_flush(out); @@ -298,7 +298,7 @@ int main(int argc, char *argv[]) message(out,"BN_GF2m_mod_solve_quad"); if (!test_gf2m_mod_solve_quad(out,ctx)) goto err; (void)BIO_flush(out); - +#endif BN_CTX_free(ctx); BIO_free(out); @@ -1061,7 +1061,7 @@ int test_exp(BIO *bp, BN_CTX *ctx) BN_free(one); return(1); } - +#ifndef OPENSSL_NO_EC2M int test_gf2m_add(BIO *bp) { BIGNUM a,b,c; @@ -1636,7 +1636,7 @@ int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx) BN_free(e); return ret; } - +#endif static int genprime_cb(int p, int n, BN_GENCB *arg) { char c='*'; -- cgit v1.2.1