One additional piece of information - the test program will also fail on 
OpenSSL 0.9.8 if debug mode (./config -d) is enabled.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Tom Wu
Sent: Wednesday, January 30, 2013 4:58 PM
To: [email protected]
Subject: Assertion failure in BN_mul_word?

The attached test program prints "10000000000000000" against OpenSSL 0.9.8, but 
gets the following assertion failure when built against OpenSSL 1.0.1c:

bnpow: bn_lib.c:428: bn_expand2: Assertion `(_bnum2->top == 0) || 
(_bnum2->d[_bnum2->top - 1] != 0)' failed.

Platform: Linux x86_64

Program:

#include <stdio.h>
#include <openssl/bn.h>

void bnpow(BIGNUM *n, unsigned int b, unsigned int e) {
  int i;
  BN_set_word(n, 1);
  for(i = 0; i < e; ++i)
    BN_mul_word(n, b);
}

main()
{
  BIGNUM *n = BN_new();
  bnpow(n, 65536, 4);
  BN_print_fp(stdout, n);
  putchar('\n');
  BN_free(n);
  return 0;
}

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to