Greetings.

I'm implementing elliptic curve software on top of OpenSSL Bignum 
library.  When testing it on NIST's standard curves, I found a problem that 
seems not to be in my code: Bignum reports that NIST's 384-bit prime is not 
prime!  I've checked the value with MIRACL and Java (which in turn uses 
Colin Plumb's Bnlib), and both say that P384 is indeed prime, as expected.

If anyone would like to check it, here's a test program that reveals the error:

------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>

#include "bn.h"

void main(void) {
        BN_CTX *ctx;
        BIGNUM *q;
        int isPrime;

        if ((ctx = BN_CTX_new()) == NULL) {
                exit(EXIT_FAILURE);
        }
        q = BN_new();
        /* load NIST's 384-bit prime: */
        BN_dec2bn(&q, 
"394020061963944792122790401001436138050797392704654466679482934042457217714 
96870329047266088258938001861606973112319");
        /* BN_hex2bn(&q, 
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff000 
0000000000000ffffffff"); */
        isPrime = BN_is_prime(q, 50, NULL, ctx, NULL);
        printf("Is P384 prime? %s.\n", isPrime ? "Yes" : "No");
        BN_free(q);
        BN_CTX_free(ctx);
}
------------------------------------------------------------------------

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to