bn_word.c: fix overflow bug in BN_add_word.
[openssl.git] / crypto / bn / bntest.c
index 565590a1f17bf58a6012dc7ebb879642467adf56..06f5954acc39083ea56981b6ccb8730d64ff5026 100644 (file)
@@ -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);
 
@@ -928,7 +928,7 @@ int test_mod_exp(BIO *bp, BN_CTX *ctx)
                BN_bntest_rand(b,2+i,0,0); /**/
 
                if (!BN_mod_exp(d,a,b,c,ctx))
-                       return(00);
+                       return(0);
 
                if (bp != NULL)
                        {
@@ -1029,8 +1029,8 @@ int test_exp(BIO *bp, BN_CTX *ctx)
                BN_bntest_rand(a,20+i*5,0,0); /**/
                BN_bntest_rand(b,2+i,0,0); /**/
 
-               if (!BN_exp(d,a,b,ctx))
-                       return(00);
+               if (BN_exp(d,a,b,ctx) <= 0)
+                       return(0);
 
                if (bp != NULL)
                        {
@@ -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='*';