diff options
Diffstat (limited to 'src/lib/libssl/s3_both.c')
-rw-r--r-- | src/lib/libssl/s3_both.c | 85 |
1 files changed, 42 insertions, 43 deletions
diff --git a/src/lib/libssl/s3_both.c b/src/lib/libssl/s3_both.c index 6de62e1591..f3f27715d5 100644 --- a/src/lib/libssl/s3_both.c +++ b/src/lib/libssl/s3_both.c | |||
@@ -57,24 +57,15 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "buffer.h" | 60 | #include <openssl/buffer.h> |
61 | #include "rand.h" | 61 | #include <openssl/rand.h> |
62 | #include "objects.h" | 62 | #include <openssl/objects.h> |
63 | #include "evp.h" | 63 | #include <openssl/evp.h> |
64 | #include "x509.h" | 64 | #include <openssl/x509.h> |
65 | #include "ssl_locl.h" | 65 | #include "ssl_locl.h" |
66 | 66 | ||
67 | #define BREAK break | 67 | int ssl3_send_finished(SSL *s, int a, int b, unsigned char *sender, |
68 | 68 | int slen) | |
69 | /* SSL3err(SSL_F_SSL3_GET_FINISHED,SSL_R_EXCESSIVE_MESSAGE_SIZE); | ||
70 | */ | ||
71 | |||
72 | int ssl3_send_finished(s,a,b,sender,slen) | ||
73 | SSL *s; | ||
74 | int a; | ||
75 | int b; | ||
76 | unsigned char *sender; | ||
77 | int slen; | ||
78 | { | 69 | { |
79 | unsigned char *p,*d; | 70 | unsigned char *p,*d; |
80 | int i; | 71 | int i; |
@@ -92,6 +83,13 @@ int slen; | |||
92 | p+=i; | 83 | p+=i; |
93 | l=i; | 84 | l=i; |
94 | 85 | ||
86 | #ifdef WIN16 | ||
87 | /* MSVC 1.5 does not clear the top bytes of the word unless | ||
88 | * I do this. | ||
89 | */ | ||
90 | l&=0xffff; | ||
91 | #endif | ||
92 | |||
95 | *(d++)=SSL3_MT_FINISHED; | 93 | *(d++)=SSL3_MT_FINISHED; |
96 | l2n3(l,d); | 94 | l2n3(l,d); |
97 | s->init_num=(int)l+4; | 95 | s->init_num=(int)l+4; |
@@ -104,10 +102,7 @@ int slen; | |||
104 | return(ssl3_do_write(s,SSL3_RT_HANDSHAKE)); | 102 | return(ssl3_do_write(s,SSL3_RT_HANDSHAKE)); |
105 | } | 103 | } |
106 | 104 | ||
107 | int ssl3_get_finished(s,a,b) | 105 | int ssl3_get_finished(SSL *s, int a, int b) |
108 | SSL *s; | ||
109 | int a; | ||
110 | int b; | ||
111 | { | 106 | { |
112 | int al,i,ok; | 107 | int al,i,ok; |
113 | long n; | 108 | long n; |
@@ -167,9 +162,7 @@ f_err: | |||
167 | * ssl->session->read_compression assign | 162 | * ssl->session->read_compression assign |
168 | * ssl->session->read_hash assign | 163 | * ssl->session->read_hash assign |
169 | */ | 164 | */ |
170 | int ssl3_send_change_cipher_spec(s,a,b) | 165 | int ssl3_send_change_cipher_spec(SSL *s, int a, int b) |
171 | SSL *s; | ||
172 | int a,b; | ||
173 | { | 166 | { |
174 | unsigned char *p; | 167 | unsigned char *p; |
175 | 168 | ||
@@ -187,9 +180,7 @@ int a,b; | |||
187 | return(ssl3_do_write(s,SSL3_RT_CHANGE_CIPHER_SPEC)); | 180 | return(ssl3_do_write(s,SSL3_RT_CHANGE_CIPHER_SPEC)); |
188 | } | 181 | } |
189 | 182 | ||
190 | unsigned long ssl3_output_cert_chain(s,x) | 183 | unsigned long ssl3_output_cert_chain(SSL *s, X509 *x) |
191 | SSL *s; | ||
192 | X509 *x; | ||
193 | { | 184 | { |
194 | unsigned char *p; | 185 | unsigned char *p; |
195 | int n,i; | 186 | int n,i; |
@@ -236,6 +227,23 @@ X509 *x; | |||
236 | X509_STORE_CTX_cleanup(&xs_ctx); | 227 | X509_STORE_CTX_cleanup(&xs_ctx); |
237 | } | 228 | } |
238 | 229 | ||
230 | /* Thawte special :-) */ | ||
231 | if (s->ctx->extra_certs != NULL) | ||
232 | for (i=0; i<sk_X509_num(s->ctx->extra_certs); i++) | ||
233 | { | ||
234 | x=sk_X509_value(s->ctx->extra_certs,i); | ||
235 | n=i2d_X509(x,NULL); | ||
236 | if (!BUF_MEM_grow(buf,(int)(n+l+3))) | ||
237 | { | ||
238 | SSLerr(SSL_F_SSL3_OUTPUT_CERT_CHAIN,ERR_R_BUF_LIB); | ||
239 | return(0); | ||
240 | } | ||
241 | p=(unsigned char *)&(buf->data[l]); | ||
242 | l2n3(n,p); | ||
243 | i2d_X509(x,&p); | ||
244 | l+=n+3; | ||
245 | } | ||
246 | |||
239 | l-=7; | 247 | l-=7; |
240 | p=(unsigned char *)&(buf->data[4]); | 248 | p=(unsigned char *)&(buf->data[4]); |
241 | l2n3(l,p); | 249 | l2n3(l,p); |
@@ -247,11 +255,7 @@ X509 *x; | |||
247 | return(l); | 255 | return(l); |
248 | } | 256 | } |
249 | 257 | ||
250 | long ssl3_get_message(s,st1,stn,mt,max,ok) | 258 | long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) |
251 | SSL *s; | ||
252 | int st1,stn,mt; | ||
253 | long max; | ||
254 | int *ok; | ||
255 | { | 259 | { |
256 | unsigned char *p; | 260 | unsigned char *p; |
257 | unsigned long l; | 261 | unsigned long l; |
@@ -275,9 +279,8 @@ int *ok; | |||
275 | 279 | ||
276 | if (s->state == st1) | 280 | if (s->state == st1) |
277 | { | 281 | { |
278 | i=ssl3_read_bytes(s,SSL3_RT_HANDSHAKE, | 282 | i=ssl3_read_bytes(s,SSL3_RT_HANDSHAKE,&p[s->init_num], |
279 | (char *)&(p[s->init_num]), | 283 | 4-s->init_num); |
280 | 4-s->init_num); | ||
281 | if (i < (4-s->init_num)) | 284 | if (i < (4-s->init_num)) |
282 | { | 285 | { |
283 | *ok=0; | 286 | *ok=0; |
@@ -315,8 +318,7 @@ int *ok; | |||
315 | n=s->s3->tmp.message_size; | 318 | n=s->s3->tmp.message_size; |
316 | if (n > 0) | 319 | if (n > 0) |
317 | { | 320 | { |
318 | i=ssl3_read_bytes(s,SSL3_RT_HANDSHAKE, | 321 | i=ssl3_read_bytes(s,SSL3_RT_HANDSHAKE,&p[s->init_num],n); |
319 | (char *)&(p[s->init_num]),(int)n); | ||
320 | if (i != (int)n) | 322 | if (i != (int)n) |
321 | { | 323 | { |
322 | *ok=0; | 324 | *ok=0; |
@@ -332,9 +334,7 @@ err: | |||
332 | return(-1); | 334 | return(-1); |
333 | } | 335 | } |
334 | 336 | ||
335 | int ssl_cert_type(x,pkey) | 337 | int ssl_cert_type(X509 *x, EVP_PKEY *pkey) |
336 | X509 *x; | ||
337 | EVP_PKEY *pkey; | ||
338 | { | 338 | { |
339 | EVP_PKEY *pk; | 339 | EVP_PKEY *pk; |
340 | int ret= -1,i,j; | 340 | int ret= -1,i,j; |
@@ -380,11 +380,11 @@ EVP_PKEY *pkey; | |||
380 | ret= -1; | 380 | ret= -1; |
381 | 381 | ||
382 | err: | 382 | err: |
383 | if(!pkey) EVP_PKEY_free(pk); | ||
383 | return(ret); | 384 | return(ret); |
384 | } | 385 | } |
385 | 386 | ||
386 | int ssl_verify_alarm_type(type) | 387 | int ssl_verify_alarm_type(long type) |
387 | long type; | ||
388 | { | 388 | { |
389 | int al; | 389 | int al; |
390 | 390 | ||
@@ -436,8 +436,7 @@ long type; | |||
436 | return(al); | 436 | return(al); |
437 | } | 437 | } |
438 | 438 | ||
439 | int ssl3_setup_buffers(s) | 439 | int ssl3_setup_buffers(SSL *s) |
440 | SSL *s; | ||
441 | { | 440 | { |
442 | unsigned char *p; | 441 | unsigned char *p; |
443 | unsigned int extra; | 442 | unsigned int extra; |