summaryrefslogtreecommitdiff
path: root/crypto/rsa/rsa_pk1.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/rsa/rsa_pk1.c')
-rw-r--r--crypto/rsa/rsa_pk1.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/crypto/rsa/rsa_pk1.c b/crypto/rsa/rsa_pk1.c
index 2791291b94..4638187970 100644
--- a/crypto/rsa/rsa_pk1.c
+++ b/crypto/rsa/rsa_pk1.c
@@ -103,17 +103,18 @@ int flen;
return(1);
}
-int RSA_padding_check_PKCS1_type_1(to,tlen,from,flen)
+int RSA_padding_check_PKCS1_type_1(to,tlen,from,flen,num)
unsigned char *to;
int tlen;
unsigned char *from;
int flen;
+int num;
{
int i,j;
unsigned char *p;
p=from;
- if (*(p++) != 01)
+ if ((num != (flen+1)) || (*(p++) != 01))
{
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,RSA_R_BLOCK_TYPE_IS_NOT_01);
return(-1);
@@ -192,21 +193,25 @@ int flen;
return(1);
}
-int RSA_padding_check_PKCS1_type_2(to,tlen,from,flen)
+int RSA_padding_check_PKCS1_type_2(to,tlen,from,flen,num)
unsigned char *to;
int tlen;
unsigned char *from;
int flen;
+int num;
{
int i,j;
unsigned char *p;
p=from;
- if (*(p++) != 02)
+ if ((num != (flen+1)) || (*(p++) != 02))
{
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2,RSA_R_BLOCK_TYPE_IS_NOT_02);
return(-1);
}
+#ifdef PKCS1_CHECK
+ return(num-11);
+#endif
/* scan over padding data */
j=flen-1; /* one for type. */