aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/rsa
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2005-06-06 22:39:43 +0000
committerDr. Stephen Henson <steve@openssl.org>2005-06-06 22:39:43 +0000
commita78c0632edd4c9c257362045dbf7c8ca4a045052 (patch)
tree7c4cc91394a0fe83aa085a35ebab12260d6aeccd /crypto/rsa
parent8fa6a40be2935ca109a28cc43d28cd27051ada01 (diff)
downloadopenssl-a78c0632edd4c9c257362045dbf7c8ca4a045052.tar.gz
Fix for padding X9.31 padding check and zero padding bytes.
Diffstat (limited to 'crypto/rsa')
-rw-r--r--crypto/rsa/rsa_x931.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/crypto/rsa/rsa_x931.c b/crypto/rsa/rsa_x931.c
index 7d77213d13..e918654176 100644
--- a/crypto/rsa/rsa_x931.c
+++ b/crypto/rsa/rsa_x931.c
@@ -115,9 +115,9 @@ int RSA_padding_check_X931(unsigned char *to, int tlen,
return -1;
}
- j=flen-3;
if (*p++ == 0x6B)
{
+ j=flen-3;
for (i = 0; i < j; i++)
{
unsigned char c = *p++;
@@ -130,15 +130,17 @@ int RSA_padding_check_X931(unsigned char *to, int tlen,
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)
{