diff options
author | Andy Polyakov <appro@openssl.org> | 2004-07-22 09:32:11 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2004-07-22 09:32:11 +0000 |
commit | 8169dd73f90df9acaebb601bde2bbb0d36bf9893 (patch) | |
tree | 17aeaaa61d44d9d76bbafdf93e18c1f4b1858eaa | |
parent | 765e231a7c38f75c24a8e4690c9c8924cb309a2f (diff) |
All SIXTY_FOUR_BIT platforms (mind the difference between SIXTY_FOUR_BIT and
SIXTY_FOUR_BIT_LONG) were failing to pass 'cd test; make test_bn'.
-rw-r--r-- | crypto/bn/bntest.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/crypto/bn/bntest.c b/crypto/bn/bntest.c index d4cb92f847..9169cc8813 100644 --- a/crypto/bn/bntest.c +++ b/crypto/bn/bntest.c @@ -468,6 +468,22 @@ int test_div(BIO *bp, BN_CTX *ctx) return(1); } +static void print_word(BIO *bp,BN_ULONG w) + { +#ifdef SIXTY_FOUR_BIT + if (sizeof(w) > sizeof(unsigned long)) + { + unsigned long h=(unsigned long)(w>>32), + l=(unsigned long)(w); + + if (h) BIO_printf(bp,"%lX%08lX",h,l); + else BIO_printf(bp,"%lX",l); + return; + } +#endif + BIO_printf(bp,"%lX",w); + } + int test_div_word(BIO *bp) { BIGNUM a,b; @@ -494,7 +510,7 @@ int test_div_word(BIO *bp) { BN_print(bp,&a); BIO_puts(bp," / "); - BIO_printf(bp,"%lX",s); + print_word(bp,s); BIO_puts(bp," - "); } BN_print(bp,&b); @@ -504,10 +520,10 @@ int test_div_word(BIO *bp) { BN_print(bp,&a); BIO_puts(bp," % "); - BIO_printf(bp,"%lX",s); + print_word(bp,s); BIO_puts(bp," - "); } - BIO_printf(bp,"%lX",r); + print_word(bp,r); BIO_puts(bp,"\n"); } BN_mul_word(&b,s); |