提交 35295bdb 编写于 作者: A Andy Polyakov

bn_mul_recursive doesn't handle all cases correctly, which results in

BN_mul failures at certain key-length mixes.
PR: 1427
上级 aa8d6f3e
...@@ -655,16 +655,16 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, ...@@ -655,16 +655,16 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
for (;;) for (;;)
{ {
i/=2; i/=2;
if (i < tna && i < tnb) if (i <= tna && tna == tnb)
{ {
bn_mul_part_recursive(&(r[n2]), bn_mul_recursive(&(r[n2]),
&(a[n]),&(b[n]), &(a[n]),&(b[n]),
i,tna-i,tnb-i,p); i,tna-i,tnb-i,p);
break; break;
} }
else if (i <= tna && i <= tnb) else if (i < tna || i < tnb)
{ {
bn_mul_recursive(&(r[n2]), bn_mul_part_recursive(&(r[n2]),
&(a[n]),&(b[n]), &(a[n]),&(b[n]),
i,tna-i,tnb-i,p); i,tna-i,tnb-i,p);
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册