From fb81ac5e6be4041e59df9362cd63880b21e2cafc Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Wed, 2 Feb 2000 16:18:12 +0000 Subject: Support for "multiply high" instruction, see BN_UMULT_HIGH comment in crypto/bn/bn_lcl.h for further details. It should be noted that for the moment of this writing the code was tested only on Alpha. If compiled with DEC C the C implementation exhibits 12% performance improvement over the crypto/bn/asm/alpha.s (on EV56 box running AlphaLinux). GNU C is (unfortunately) 8% behind the assembler implementation. But it's OpenVMS Alpha users who *may* benefit most as 'apps/openssl speed rsa' exhibits 6 (six) times performance improvement over the original VMS bignum implementation. Where "*may*" means "as soon as code is enabled though #define SIXTY_FOUR_BIT and crypto/bn/asm/vms.mar is skipped." --- crypto/bn/bn_div.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crypto/bn/bn_div.c') diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c index d8c31e1db0..39d7602c30 100644 --- a/crypto/bn/bn_div.c +++ b/crypto/bn/bn_div.c @@ -280,9 +280,14 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, */ rem=(n1-q*d0)&BN_MASK2; #endif +#ifdef BN_UMULT_HIGH + t2l = d1 * q; + t2h = BN_UMULT_HIGH(d1,q); +#else t2l=LBITS(d1); t2h=HBITS(d1); ql =LBITS(q); qh =HBITS(q); mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ +#endif for (;;) { -- cgit v1.2.3