summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_asm.c
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2008-12-16 07:28:38 +0000
committerAndy Polyakov <appro@openssl.org>2008-12-16 07:28:38 +0000
commit3ebbe8853f0597bc859d6fad5206229aff3ce784 (patch)
tree215a2ec81e38ff6f01050d0910ef4fe4f57eb2a6 /crypto/bn/bn_asm.c
parentac71d81e84d0ced7c546e70dc6a7fdf70288be86 (diff)
Bring C bn_mul_mont template closer to assembler.
Diffstat (limited to 'crypto/bn/bn_asm.c')
-rw-r--r--crypto/bn/bn_asm.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/crypto/bn/bn_asm.c b/crypto/bn/bn_asm.c
index 230258bcdd..c43c91cc09 100644
--- a/crypto/bn/bn_asm.c
+++ b/crypto/bn/bn_asm.c
@@ -860,13 +860,35 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_U
n0 = *n0p;
- tp[num] = bn_mul_words(tp,ap,num,bp[0]);
+ c0 = 0;
+ ml = bp[0];
+#ifdef mul64
+ mh = HBITS(ml);
+ ml = LBITS(ml);
+ for (j=0;j<num;++j)
+ mul(tp[j],ap[j],ml,mh,c0);
+#else
+ for (j=0;j<num;++j)
+ mul(tp[j],ap[j],ml,c0);
+#endif
+
+ tp[num] = c0;
tp[num+1] = 0;
goto enter;
for(i=0;i<num;i++)
{
- c0 = bn_mul_add_words(tp,ap,num,bp[i]);
+ c0 = 0;
+ ml = bp[i];
+#ifdef mul64
+ mh = HBITS(ml);
+ ml = LBITS(ml);
+ for (j=0;j<num;++j)
+ mul_add(tp[j],ap[j],ml,mh,c0);
+#else
+ for (j=0;j<num;++j)
+ mul_add(tp[j],ap[j],ml,c0);
+#endif
c1 = (tp[num] + c0)&BN_MASK2;
tp[num] = c1;
tp[num+1] = (c1<c0?1:0);