|
Hello All,
i. The following program prints the hexadecimal and
decimal encoding of a big number
***************************************************
#include <stdio.h> #include <openssl/rsa.h> int main() { RSA *public; unsigned int bits, len; char *buf, *uu; unsigned char *blob; public = RSA_generate_key(1024, 35, NULL, NULL); buf = BN_bn2dec(public->p); printf(" %s\n\n\n", buf); OPENSSL_free(buf); return 0; } *************************************************** ii. I am working on an IPF(Itanium Processor Family) HPUX machine. iii. Using the configure option
hpux-ia64-cc would be the appropriate configure option while
building OpenSSL in this platform
iv. But when I run the above
program using libcrypto built using
hpux-ia64-cc configure option I get the following
output
1180000000002285201956000000000166603435800000000026158697390000000000011464653000000000325683592500000
0000097566433900000000028556255030000000001395876489
Note : consecutive zeroes are padded in between the values v. But when I run the above program using libcrypto built using hpux-cc configure option I get the correct output as shown below. 1183823783478012402862766283670332313418098812449456690226660531071246600308477771713319834690848920139
9696675874196822730489605584601813591627576050450163
vi. The main difference between these two configure options is the definition of SIXTY_FOUR_BIT in hpux-ia64-cc and THIRTY_TWO_BIT in hpux-cc Note : In /usr/include/openssl/bn.h these two macros are defined as below. SIXTY_FOUR_BIT #undef BN_LLONG #undef BN_ULLONG #define BN_ULONG unsigned long long #define BN_LONG long long #define BN_BITS 128 #define BN_BYTES 8 #define BN_BITS2 64 #define BN_BITS4 32 #define BN_MASK2 (0xffffffffffffffffLL) #define BN_MASK2l (0xffffffffL) #define BN_MASK2h (0xffffffff00000000LL) #define BN_MASK2h1 (0xffffffff80000000LL) #define BN_TBIT (0x8000000000000000LL) #define BN_DEC_CONV (10000000000000000000ULL) #define BN_DEC_FMT1 "%llu" #define BN_DEC_FMT2 "%019llu" #define BN_DEC_NUM 19 THIRTY_TWO_BIT #define BN_ULLONG unsigned long long #define BN_ULONG unsigned long #define BN_LONG long #define BN_BITS 64 #define BN_BYTES 4 #define BN_BITS2 32 #define BN_BITS4 16 #define BN_MASK (0xffffffffffffffffLL) #define BN_MASK2 (0xffffffffL) #define BN_MASK2l (0xffff) #define BN_MASK2h1 (0xffff8000L) #define BN_MASK2h (0xffff0000L) #define BN_TBIT (0x80000000L) #define BN_DEC_CONV (1000000000L) #define BN_DEC_FMT1 "%lu" #define BN_DEC_FMT2 "%09lu" #define BN_DEC_NUM 9 What may be the reason for the padding of zeroes when I use hpux-ia64-cc option ? Thanks, Prakash __________________________________________________ |
