diff options
Diffstat (limited to 'src/lib/libssl/src/crypto/rsa/rsa_pk1.c')
-rw-r--r-- | src/lib/libssl/src/crypto/rsa/rsa_pk1.c | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_pk1.c b/src/lib/libssl/src/crypto/rsa/rsa_pk1.c index 2791291b94..f0ae51f234 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_pk1.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_pk1.c | |||
@@ -58,27 +58,12 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include "bn.h" | 61 | #include <openssl/bn.h> |
62 | #include "rsa.h" | 62 | #include <openssl/rsa.h> |
63 | #include "rand.h" | 63 | #include <openssl/rand.h> |
64 | |||
65 | #ifndef NOPROTO | ||
66 | int RSA_padding_add_PKCS1_type_1(); | ||
67 | int RSA_padding_check_PKCS1_type_1(); | ||
68 | int RSA_padding_add_PKCS1_type_2(); | ||
69 | int RSA_padding_check_PKCS1_type_2(); | ||
70 | int RSA_padding_add_SSLv23(); | ||
71 | int RSA_padding_check_SSLv23(); | ||
72 | int RSA_padding_add_none(); | ||
73 | int RSA_padding_check_none(); | ||
74 | 64 | ||
75 | #endif | 65 | int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, |
76 | 66 | unsigned char *from, int flen) | |
77 | int RSA_padding_add_PKCS1_type_1(to,tlen,from,flen) | ||
78 | unsigned char *to; | ||
79 | int tlen; | ||
80 | unsigned char *from; | ||
81 | int flen; | ||
82 | { | 67 | { |
83 | int j; | 68 | int j; |
84 | unsigned char *p; | 69 | unsigned char *p; |
@@ -103,17 +88,14 @@ int flen; | |||
103 | return(1); | 88 | return(1); |
104 | } | 89 | } |
105 | 90 | ||
106 | int RSA_padding_check_PKCS1_type_1(to,tlen,from,flen) | 91 | int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, |
107 | unsigned char *to; | 92 | unsigned char *from, int flen, int num) |
108 | int tlen; | ||
109 | unsigned char *from; | ||
110 | int flen; | ||
111 | { | 93 | { |
112 | int i,j; | 94 | int i,j; |
113 | unsigned char *p; | 95 | unsigned char *p; |
114 | 96 | ||
115 | p=from; | 97 | p=from; |
116 | if (*(p++) != 01) | 98 | if ((num != (flen+1)) || (*(p++) != 01)) |
117 | { | 99 | { |
118 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,RSA_R_BLOCK_TYPE_IS_NOT_01); | 100 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,RSA_R_BLOCK_TYPE_IS_NOT_01); |
119 | return(-1); | 101 | return(-1); |
@@ -153,11 +135,8 @@ int flen; | |||
153 | return(j); | 135 | return(j); |
154 | } | 136 | } |
155 | 137 | ||
156 | int RSA_padding_add_PKCS1_type_2(to,tlen,from,flen) | 138 | int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, |
157 | unsigned char *to; | 139 | unsigned char *from, int flen) |
158 | int tlen; | ||
159 | unsigned char *from; | ||
160 | int flen; | ||
161 | { | 140 | { |
162 | int i,j; | 141 | int i,j; |
163 | unsigned char *p; | 142 | unsigned char *p; |
@@ -192,21 +171,21 @@ int flen; | |||
192 | return(1); | 171 | return(1); |
193 | } | 172 | } |
194 | 173 | ||
195 | int RSA_padding_check_PKCS1_type_2(to,tlen,from,flen) | 174 | int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, |
196 | unsigned char *to; | 175 | unsigned char *from, int flen, int num) |
197 | int tlen; | ||
198 | unsigned char *from; | ||
199 | int flen; | ||
200 | { | 176 | { |
201 | int i,j; | 177 | int i,j; |
202 | unsigned char *p; | 178 | unsigned char *p; |
203 | 179 | ||
204 | p=from; | 180 | p=from; |
205 | if (*(p++) != 02) | 181 | if ((num != (flen+1)) || (*(p++) != 02)) |
206 | { | 182 | { |
207 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2,RSA_R_BLOCK_TYPE_IS_NOT_02); | 183 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2,RSA_R_BLOCK_TYPE_IS_NOT_02); |
208 | return(-1); | 184 | return(-1); |
209 | } | 185 | } |
186 | #ifdef PKCS1_CHECK | ||
187 | return(num-11); | ||
188 | #endif | ||
210 | 189 | ||
211 | /* scan over padding data */ | 190 | /* scan over padding data */ |
212 | j=flen-1; /* one for type. */ | 191 | j=flen-1; /* one for type. */ |