summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_div.c
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2000-02-02 16:18:12 +0000
committerAndy Polyakov <appro@openssl.org>2000-02-02 16:18:12 +0000
commitfb81ac5e6be4041e59df9362cd63880b21e2cafc (patch)
treeca35a62e7e39a135465937ef7b37bcab9d15add2 /crypto/bn/bn_div.c
parent54a34aecc38b95115704565ac77a2715688be400 (diff)
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."
Diffstat (limited to 'crypto/bn/bn_div.c')
-rw-r--r--crypto/bn/bn_div.c5
1 files changed, 5 insertions, 0 deletions
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 (;;)
{