-/* $OpenBSD: bn_test.c,v 1.15 2023/04/10 20:59:33 tb Exp $ */
+/* $OpenBSD: bn_test.c,v 1.16 2023/04/17 19:56:39 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int test_mod_exp_mont5(BIO *bp, BN_CTX *ctx);
int test_mod_exp_sizes(BIO *bp, BN_CTX *ctx);
int test_exp(BIO *bp, BN_CTX *ctx);
-int test_gf2m_add(BIO *bp, BN_CTX *ctx);
-int test_gf2m_mod(BIO *bp, BN_CTX *ctx);
-int test_gf2m_mod_mul(BIO *bp, BN_CTX *ctx);
-int test_gf2m_mod_sqr(BIO *bp, BN_CTX *ctx);
-int test_gf2m_mod_inv(BIO *bp, BN_CTX *ctx);
-int test_gf2m_mod_div(BIO *bp, BN_CTX *ctx);
-int test_gf2m_mod_exp(BIO *bp, BN_CTX *ctx);
-int test_gf2m_mod_sqrt(BIO *bp, BN_CTX *ctx);
-int test_gf2m_mod_solve_quad(BIO *bp, BN_CTX *ctx);
int test_kron(BIO *bp, BN_CTX *ctx);
int test_sqrt(BIO *bp, BN_CTX *ctx);
int rand_neg(void);
goto err;
(void)BIO_flush(out);
-#ifndef OPENSSL_NO_EC2M
- message(out, "BN_GF2m_add");
- if (!test_gf2m_add(out, ctx))
- goto err;
- (void)BIO_flush(out);
-
- message(out, "BN_GF2m_mod");
- if (!test_gf2m_mod(out, ctx))
- goto err;
- (void)BIO_flush(out);
-
- message(out, "BN_GF2m_mod_mul");
- if (!test_gf2m_mod_mul(out, ctx))
- goto err;
- (void)BIO_flush(out);
-
- message(out, "BN_GF2m_mod_sqr");
- if (!test_gf2m_mod_sqr(out, ctx))
- goto err;
- (void)BIO_flush(out);
-
- message(out, "BN_GF2m_mod_inv");
- if (!test_gf2m_mod_inv(out, ctx))
- goto err;
- (void)BIO_flush(out);
-
- message(out, "BN_GF2m_mod_div");
- if (!test_gf2m_mod_div(out, ctx))
- goto err;
- (void)BIO_flush(out);
-
- message(out, "BN_GF2m_mod_exp");
- if (!test_gf2m_mod_exp(out, ctx))
- goto err;
- (void)BIO_flush(out);
-
- message(out, "BN_GF2m_mod_sqrt");
- if (!test_gf2m_mod_sqrt(out, ctx))
- goto err;
- (void)BIO_flush(out);
-
- 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);
return ret;
}
-#ifndef OPENSSL_NO_EC2M
-int
-test_gf2m_add(BIO *bp, BN_CTX *ctx)
-{
- BIGNUM *a, *b, *c;
- int i;
- int ret = 0;
-
- BN_CTX_start(ctx);
-
- if ((a = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((c = BN_CTX_get(ctx)) == NULL)
- goto err;
-
- for (i = 0; i < num0; i++) {
- CHECK_GOTO(BN_rand(a, 512, 0, 0));
- CHECK_GOTO(bn_copy(b, BN_value_one()));
- BN_set_negative(a, rand_neg());
- BN_set_negative(b, rand_neg());
- CHECK_GOTO(BN_GF2m_add(c, a, b));
-#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
- if (bp != NULL) {
- if (!results) {
- CHECK_GOTO(BN_print(bp, a));
- BIO_puts(bp, " ^ ");
- CHECK_GOTO(BN_print(bp, b));
- BIO_puts(bp, " = ");
- }
- CHECK_GOTO(BN_print(bp, c));
- BIO_puts(bp, "\n");
- }
-#endif
- /* Test that two added values have the correct parity. */
- if ((BN_is_odd(a) && BN_is_odd(c))
- || (!BN_is_odd(a) && !BN_is_odd(c))) {
- fprintf(stderr, "GF(2^m) addition test (a) failed!\n");
- goto err;
- }
- CHECK_GOTO(BN_GF2m_add(c, c, c));
- /* Test that c + c = 0. */
- if (!BN_is_zero(c)) {
- fprintf(stderr, "GF(2^m) addition test (b) failed!\n");
- goto err;
- }
- }
-
- ret = 1;
- err:
- BN_CTX_end(ctx);
-
- return ret;
-}
-
-int
-test_gf2m_mod(BIO *bp, BN_CTX *ctx)
-{
- BIGNUM *a, *b[2] = { 0 }, *c, *d, *e;
- int p0[] = { 163, 7, 6, 3, 0, -1 };
- int p1[] = { 193, 15, 0, -1, 0 };
- int i, j;
- int ret = 0;
-
- BN_CTX_start(ctx);
-
- if ((a = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[0] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[1] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((c = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((d = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((e = BN_CTX_get(ctx)) == NULL)
- goto err;
-
- CHECK_GOTO(BN_GF2m_arr2poly(p0, b[0]));
- CHECK_GOTO(BN_GF2m_arr2poly(p1, b[1]));
-
- for (i = 0; i < num0; i++) {
- CHECK_GOTO(BN_bntest_rand(a, 1024, 0, 0));
- for (j = 0; j < 2; j++) {
- CHECK_GOTO(BN_GF2m_mod(c, a, b[j]));
-#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
- if (bp != NULL) {
- if (!results) {
- CHECK_GOTO(BN_print(bp, a));
- BIO_puts(bp, " % ");
- CHECK_GOTO(BN_print(bp, b[j]));
- BIO_puts(bp, " - ");
- CHECK_GOTO(BN_print(bp, c));
- BIO_puts(bp, "\n");
- }
- }
-#endif
- CHECK_GOTO(BN_GF2m_add(d, a, c));
- CHECK_GOTO(BN_GF2m_mod(e, d, b[j]));
- /* Test that a + (a mod p) mod p == 0. */
- if (!BN_is_zero(e)) {
- fprintf(stderr, "GF(2^m) modulo test failed!\n");
- goto err;
- }
- }
- }
-
- ret = 1;
- err:
- BN_CTX_end(ctx);
-
- return ret;
-}
-
-int
-test_gf2m_mod_mul(BIO *bp, BN_CTX *ctx)
-{
- BIGNUM *a, *b[2] = { 0 }, *c, *d, *e, *f, *g, *h;
- int p0[] = { 163, 7, 6, 3, 0, -1 };
- int p1[] = { 193, 15, 0, -1 };
- int i, j;
- int ret = 0;
-
- BN_CTX_start(ctx);
-
- if ((a = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[0] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[1] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((c = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((d = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((e = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((f = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((g = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((h = BN_CTX_get(ctx)) == NULL)
- goto err;
-
- CHECK_GOTO(BN_GF2m_arr2poly(p0, b[0]));
- CHECK_GOTO(BN_GF2m_arr2poly(p1, b[1]));
-
- for (i = 0; i < num0; i++) {
- CHECK_GOTO(BN_bntest_rand(a, 1024, 0, 0));
- CHECK_GOTO(BN_bntest_rand(c, 1024, 0, 0));
- CHECK_GOTO(BN_bntest_rand(d, 1024, 0, 0));
- for (j = 0; j < 2; j++) {
- CHECK_GOTO(BN_GF2m_mod_mul(e, a, c, b[j], ctx));
-#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
- if (bp != NULL) {
- if (!results) {
- CHECK_GOTO(BN_print(bp, a));
- BIO_puts(bp, " * ");
- CHECK_GOTO(BN_print(bp, c));
- BIO_puts(bp, " % ");
- CHECK_GOTO(BN_print(bp, b[j]));
- BIO_puts(bp, " - ");
- CHECK_GOTO(BN_print(bp, e));
- BIO_puts(bp, "\n");
- }
- }
-#endif
- CHECK_GOTO(BN_GF2m_add(f, a, d));
- CHECK_GOTO(BN_GF2m_mod_mul(g, f, c, b[j], ctx));
- CHECK_GOTO(BN_GF2m_mod_mul(h, d, c, b[j], ctx));
- CHECK_GOTO(BN_GF2m_add(f, e, g));
- CHECK_GOTO(BN_GF2m_add(f, f, h));
- /* Test that (a+d)*c = a*c + d*c. */
- if (!BN_is_zero(f)) {
- fprintf(stderr, "GF(2^m) modular multiplication test failed!\n");
- goto err;
- }
- }
- }
-
- ret = 1;
- err:
- BN_CTX_end(ctx);
-
- return ret;
-}
-
-int
-test_gf2m_mod_sqr(BIO *bp, BN_CTX *ctx)
-{
- BIGNUM *a, *b[2] = { 0 }, *c, *d;
- int p0[] = { 163, 7, 6, 3, 0, -1 };
- int p1[] = { 193, 15, 0, -1 };
- int i, j;
- int ret = 0;
-
- BN_CTX_start(ctx);
-
- if ((a = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[0] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[1] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((c = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((d = BN_CTX_get(ctx)) == NULL)
- goto err;
-
- CHECK_GOTO(BN_GF2m_arr2poly(p0, b[0]));
- CHECK_GOTO(BN_GF2m_arr2poly(p1, b[1]));
-
- for (i = 0; i < num0; i++) {
- CHECK_GOTO(BN_bntest_rand(a, 1024, 0, 0));
- for (j = 0; j < 2; j++) {
- CHECK_GOTO(BN_GF2m_mod_sqr(c, a, b[j], ctx));
- CHECK_GOTO(bn_copy(d, a));
- CHECK_GOTO(BN_GF2m_mod_mul(d, a, d, b[j], ctx));
-#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
- if (bp != NULL) {
- if (!results) {
- CHECK_GOTO(BN_print(bp, a));
- BIO_puts(bp, " ^ 2 % ");
- CHECK_GOTO(BN_print(bp, b[j]));
- BIO_puts(bp, " = ");
- CHECK_GOTO(BN_print(bp, c));
- BIO_puts(bp, "; a * a = ");
- CHECK_GOTO(BN_print(bp, d));
- BIO_puts(bp, "\n");
- }
- }
-#endif
- CHECK_GOTO(BN_GF2m_add(d, c, d));
- /* Test that a*a = a^2. */
- if (!BN_is_zero(d)) {
- fprintf(stderr, "GF(2^m) modular squaring test failed!\n");
- goto err;
- }
- }
- }
-
- ret = 1;
- err:
- BN_CTX_end(ctx);
-
- return ret;
-}
-
-int
-test_gf2m_mod_inv(BIO *bp, BN_CTX *ctx)
-{
- BIGNUM *a, *b[2] = { 0 }, *c, *d;
- int p0[] = { 163, 7, 6, 3, 0, -1 };
- int p1[] = { 193, 15, 0, -1 };
- int i, j;
- int ret = 0;
-
- BN_CTX_start(ctx);
-
- if ((a = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[0] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[1] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((c = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((d = BN_CTX_get(ctx)) == NULL)
- goto err;
-
- CHECK_GOTO(BN_GF2m_arr2poly(p0, b[0]));
- CHECK_GOTO(BN_GF2m_arr2poly(p1, b[1]));
-
- for (i = 0; i < num0; i++) {
- CHECK_GOTO(BN_bntest_rand(a, 512, 0, 0));
- for (j = 0; j < 2; j++) {
- CHECK_GOTO(BN_GF2m_mod_inv(c, a, b[j], ctx));
- CHECK_GOTO(BN_GF2m_mod_mul(d, a, c, b[j], ctx));
-#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
- if (bp != NULL) {
- if (!results) {
- CHECK_GOTO(BN_print(bp, a));
- BIO_puts(bp, " * ");
- CHECK_GOTO(BN_print(bp, c));
- BIO_puts(bp, " - 1 % ");
- CHECK_GOTO(BN_print(bp, b[j]));
- BIO_puts(bp, "\n");
- }
- }
-#endif
- /* Test that ((1/a)*a) = 1. */
- if (!BN_is_one(d)) {
- fprintf(stderr, "GF(2^m) modular inversion test failed!\n");
- goto err;
- }
- }
- }
-
- ret = 1;
- err:
- BN_CTX_end(ctx);
-
- return ret;
-}
-
-int
-test_gf2m_mod_div(BIO *bp, BN_CTX *ctx)
-{
- BIGNUM *a, *b[2] = { 0 }, *c, *d, *e, *f;
- int p0[] = { 163, 7, 6, 3, 0, -1 };
- int p1[] = { 193, 15, 0, -1 };
- int i, j;
- int ret = 0;
-
- BN_CTX_start(ctx);
-
- if ((a = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[0] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[1] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((c = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((d = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((e = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((f = BN_CTX_get(ctx)) == NULL)
- goto err;
-
- CHECK_GOTO(BN_GF2m_arr2poly(p0, b[0]));
- CHECK_GOTO(BN_GF2m_arr2poly(p1, b[1]));
-
- for (i = 0; i < num0; i++) {
- CHECK_GOTO(BN_bntest_rand(a, 512, 0, 0));
- CHECK_GOTO(BN_bntest_rand(c, 512, 0, 0));
- for (j = 0; j < 2; j++) {
- CHECK_GOTO(BN_GF2m_mod_div(d, a, c, b[j], ctx));
- CHECK_GOTO(BN_GF2m_mod_mul(e, d, c, b[j], ctx));
- CHECK_GOTO(BN_GF2m_mod_div(f, a, e, b[j], ctx));
-#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
- if (bp != NULL) {
- if (!results) {
- CHECK_GOTO(BN_print(bp, a));
- BIO_puts(bp, " = ");
- CHECK_GOTO(BN_print(bp, c));
- BIO_puts(bp, " * ");
- CHECK_GOTO(BN_print(bp, d));
- BIO_puts(bp, " % ");
- CHECK_GOTO(BN_print(bp, b[j]));
- BIO_puts(bp, "\n");
- }
- }
-#endif
- /* Test that ((a/c)*c)/a = 1. */
- if (!BN_is_one(f)) {
- fprintf(stderr, "GF(2^m) modular division test failed!\n");
- goto err;
- }
- }
- }
-
- ret = 1;
- err:
- BN_CTX_end(ctx);
-
- return ret;
-}
-
-int
-test_gf2m_mod_exp(BIO *bp, BN_CTX *ctx)
-{
- BIGNUM *a, *b[2] = { 0 }, *c, *d, *e, *f;
- int p0[] = { 163, 7, 6, 3, 0, -1 };
- int p1[] = { 193, 15, 0, -1 };
- int i, j;
- int ret = 0;
-
- BN_CTX_start(ctx);
-
- if ((a = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[0] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[1] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((c = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((d = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((e = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((f = BN_CTX_get(ctx)) == NULL)
- goto err;
-
- CHECK_GOTO(BN_GF2m_arr2poly(p0, b[0]));
- CHECK_GOTO(BN_GF2m_arr2poly(p1, b[1]));
-
- for (i = 0; i < num0; i++) {
- CHECK_GOTO(BN_bntest_rand(a, 512, 0, 0));
- CHECK_GOTO(BN_bntest_rand(c, 512, 0, 0));
- CHECK_GOTO(BN_bntest_rand(d, 512, 0, 0));
- for (j = 0; j < 2; j++) {
- CHECK_GOTO(BN_GF2m_mod_exp(e, a, c, b[j], ctx));
- CHECK_GOTO(BN_GF2m_mod_exp(f, a, d, b[j], ctx));
- CHECK_GOTO(BN_GF2m_mod_mul(e, e, f, b[j], ctx));
- CHECK_GOTO(BN_add(f, c, d));
- CHECK_GOTO(BN_GF2m_mod_exp(f, a, f, b[j], ctx));
-#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
- if (bp != NULL) {
- if (!results) {
- CHECK_GOTO(BN_print(bp, a));
- BIO_puts(bp, " ^ (");
- CHECK_GOTO(BN_print(bp, c));
- BIO_puts(bp, " + ");
- CHECK_GOTO(BN_print(bp, d));
- BIO_puts(bp, ") = ");
- CHECK_GOTO(BN_print(bp, e));
- BIO_puts(bp, "; - ");
- CHECK_GOTO(BN_print(bp, f));
- BIO_puts(bp, " % ");
- CHECK_GOTO(BN_print(bp, b[j]));
- BIO_puts(bp, "\n");
- }
- }
-#endif
- CHECK_GOTO(BN_GF2m_add(f, e, f));
- /* Test that a^(c+d)=a^c*a^d. */
- if (!BN_is_zero(f)) {
- fprintf(stderr, "GF(2^m) modular exponentiation test failed!\n");
- goto err;
- }
- }
- }
-
- ret = 1;
- err:
- BN_CTX_end(ctx);
-
- return ret;
-}
-
-int
-test_gf2m_mod_sqrt(BIO *bp, BN_CTX *ctx)
-{
- BIGNUM *a, *b[2] = { 0 }, *c, *d, *e, *f;
- int p0[] = { 163, 7, 6, 3, 0, -1 };
- int p1[] = { 193, 15, 0, -1 };
- int i, j;
- int ret = 0;
-
- BN_CTX_start(ctx);
-
- if ((a = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[0] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[1] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((c = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((d = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((e = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((f = BN_CTX_get(ctx)) == NULL)
- goto err;
-
- CHECK_GOTO(BN_GF2m_arr2poly(p0, b[0]));
- CHECK_GOTO(BN_GF2m_arr2poly(p1, b[1]));
-
- for (i = 0; i < num0; i++) {
- CHECK_GOTO(BN_bntest_rand(a, 512, 0, 0));
- for (j = 0; j < 2; j++) {
- CHECK_GOTO(BN_GF2m_mod(c, a, b[j]));
- CHECK_GOTO(BN_GF2m_mod_sqrt(d, a, b[j], ctx));
- CHECK_GOTO(BN_GF2m_mod_sqr(e, d, b[j], ctx));
-#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
- if (bp != NULL) {
- if (!results) {
- CHECK_GOTO(BN_print(bp, d));
- BIO_puts(bp, " ^ 2 - ");
- CHECK_GOTO(BN_print(bp, a));
- BIO_puts(bp, "\n");
- }
- }
-#endif
- CHECK_GOTO(BN_GF2m_add(f, c, e));
- /* Test that d^2 = a, where d = sqrt(a). */
- if (!BN_is_zero(f)) {
- fprintf(stderr, "GF(2^m) modular square root test failed!\n");
- goto err;
- }
- }
- }
-
- ret = 1;
- err:
- BN_CTX_end(ctx);
-
- return ret;
-}
-
-int
-test_gf2m_mod_solve_quad(BIO *bp, BN_CTX *ctx)
-{
- BIGNUM *a, *b[2] = { 0 }, *c, *d, *e;
- int p0[] = { 163, 7, 6, 3, 0, -1 };
- int p1[] = { 193, 15, 0, -1 };
- int i, j, s = 0, t;
- int ret = 0;
-
- BN_CTX_start(ctx);
-
- if ((a = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[0] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((b[1] = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((c = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((d = BN_CTX_get(ctx)) == NULL)
- goto err;
- if ((e = BN_CTX_get(ctx)) == NULL)
- goto err;
-
- CHECK_GOTO(BN_GF2m_arr2poly(p0, b[0]));
- CHECK_GOTO(BN_GF2m_arr2poly(p1, b[1]));
-
- for (i = 0; i < num0; i++) {
- CHECK_GOTO(BN_bntest_rand(a, 512, 0, 0));
- for (j = 0; j < 2; j++) {
- t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx);
- if (t) {
- s++;
- CHECK_GOTO(BN_GF2m_mod_sqr(d, c, b[j], ctx));
- CHECK_GOTO(BN_GF2m_add(d, c, d));
- CHECK_GOTO(BN_GF2m_mod(e, a, b[j]));
-#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
- if (bp != NULL) {
- if (!results) {
- CHECK_GOTO(BN_print(bp, c));
- BIO_puts(bp, " is root of z^2 + z = ");
- CHECK_GOTO(BN_print(bp, a));
- BIO_puts(bp, " % ");
- CHECK_GOTO(BN_print(bp, b[j]));
- BIO_puts(bp, "\n");
- }
- }
-#endif
- CHECK_GOTO(BN_GF2m_add(e, e, d));
- /* Test that solution of quadratic c satisfies c^2 + c = a. */
- if (!BN_is_zero(e)) {
- fprintf(stderr, "GF(2^m) modular solve quadratic test failed!\n");
- goto err;
- }
-
- } else {
-#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
- if (bp != NULL) {
- if (!results) {
- BIO_puts(bp, "There are no roots of z^2 + z = ");
- CHECK_GOTO(BN_print(bp, a));
- BIO_puts(bp, " % ");
- CHECK_GOTO(BN_print(bp, b[j]));
- BIO_puts(bp, "\n");
- }
- }
-#endif
- }
- }
- }
- if (s == 0) {
- fprintf(stderr, "All %d tests of GF(2^m) modular solve quadratic resulted in no roots;\n", num0);
- fprintf(stderr, "this is very unlikely and probably indicates an error.\n");
- goto err;
- }
-
- ret = 1;
- err:
- BN_CTX_end(ctx);
-
- return ret;
-}
-#endif
-
static int
genprime_cb(int p, int n, BN_GENCB *arg)
{