提交 a78c0632 编写于 作者: D Dr. Stephen Henson

Fix for padding X9.31 padding check and zero padding bytes.

上级 8fa6a40b
...@@ -115,9 +115,9 @@ int RSA_padding_check_X931(unsigned char *to, int tlen, ...@@ -115,9 +115,9 @@ int RSA_padding_check_X931(unsigned char *to, int tlen,
return -1; return -1;
} }
j=flen-3;
if (*p++ == 0x6B) if (*p++ == 0x6B)
{ {
j=flen-3;
for (i = 0; i < j; i++) for (i = 0; i < j; i++)
{ {
unsigned char c = *p++; unsigned char c = *p++;
...@@ -130,15 +130,17 @@ int RSA_padding_check_X931(unsigned char *to, int tlen, ...@@ -130,15 +130,17 @@ int RSA_padding_check_X931(unsigned char *to, int tlen,
return -1; return -1;
} }
} }
}
j -= i; j -= i;
if (i == 0)
{
RSAerr(RSA_F_RSA_PADDING_CHECK_X931, RSA_R_INVALID_PADDING);
return -1;
}
if (i == 0)
{
RSAerr(RSA_F_RSA_PADDING_CHECK_X931, RSA_R_INVALID_PADDING);
return -1;
} }
else j = flen - 2;
if (p[j] != 0xCC) if (p[j] != 0xCC)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册