the following program outputs:
-----------------------
what the heck?
0 41
41 81
81 c1
c1 1
1 42
42 82
82 c2
c2 0
-----------------------
is this the expected behavior?
#include <stdio.h>
#include <string.h>
#include <openssl/bn.h>
static unsigned char data[8]={0x00,0x41,0x81,0xc1,0x01,0x42,0x82,0xc2};
int main(int argc, char* argv[])
{
unsigned char aa[8];
BIGNUM *a;
int i;
memset(aa, 0, 8);
a = BN_new();
BN_bin2bn(data, 8, a);
BN_bn2bin(a, aa);
if (memcmp(aa, data, 8) != 0)
printf("what the heck?\n");
for (i = 0; i < 8; i++)
printf("%2x %2x\n", data[i], aa[i]);
}
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]