Deleted Added
full compact
s3_both.c (89837) s3_both.c (100928)
1/* ssl/s3_both.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *

--- 42 unchanged lines hidden (view full) ---

51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58/* ====================================================================
1/* ssl/s3_both.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *

--- 42 unchanged lines hidden (view full) ---

51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58/* ====================================================================
59 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
59 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *

--- 455 unchanged lines hidden (view full) ---

523 case X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE:
524 case X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY:
525 case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
526 case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
527 case X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD:
528 case X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD:
529 case X509_V_ERR_CERT_NOT_YET_VALID:
530 case X509_V_ERR_CRL_NOT_YET_VALID:
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *

--- 455 unchanged lines hidden (view full) ---

523 case X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE:
524 case X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY:
525 case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
526 case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
527 case X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD:
528 case X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD:
529 case X509_V_ERR_CERT_NOT_YET_VALID:
530 case X509_V_ERR_CRL_NOT_YET_VALID:
531 case X509_V_ERR_CERT_UNTRUSTED:
532 case X509_V_ERR_CERT_REJECTED:
531 al=SSL_AD_BAD_CERTIFICATE;
532 break;
533 case X509_V_ERR_CERT_SIGNATURE_FAILURE:
534 case X509_V_ERR_CRL_SIGNATURE_FAILURE:
535 al=SSL_AD_DECRYPT_ERROR;
536 break;
537 case X509_V_ERR_CERT_HAS_EXPIRED:
538 case X509_V_ERR_CRL_HAS_EXPIRED:

--- 5 unchanged lines hidden (view full) ---

544 case X509_V_ERR_OUT_OF_MEM:
545 al=SSL_AD_INTERNAL_ERROR;
546 break;
547 case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
548 case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
549 case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
550 case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE:
551 case X509_V_ERR_CERT_CHAIN_TOO_LONG:
533 al=SSL_AD_BAD_CERTIFICATE;
534 break;
535 case X509_V_ERR_CERT_SIGNATURE_FAILURE:
536 case X509_V_ERR_CRL_SIGNATURE_FAILURE:
537 al=SSL_AD_DECRYPT_ERROR;
538 break;
539 case X509_V_ERR_CERT_HAS_EXPIRED:
540 case X509_V_ERR_CRL_HAS_EXPIRED:

--- 5 unchanged lines hidden (view full) ---

546 case X509_V_ERR_OUT_OF_MEM:
547 al=SSL_AD_INTERNAL_ERROR;
548 break;
549 case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
550 case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
551 case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
552 case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE:
553 case X509_V_ERR_CERT_CHAIN_TOO_LONG:
554 case X509_V_ERR_PATH_LENGTH_EXCEEDED:
555 case X509_V_ERR_INVALID_CA:
552 al=SSL_AD_UNKNOWN_CA;
553 break;
554 case X509_V_ERR_APPLICATION_VERIFICATION:
555 al=SSL_AD_HANDSHAKE_FAILURE;
556 break;
556 al=SSL_AD_UNKNOWN_CA;
557 break;
558 case X509_V_ERR_APPLICATION_VERIFICATION:
559 al=SSL_AD_HANDSHAKE_FAILURE;
560 break;
561 case X509_V_ERR_INVALID_PURPOSE:
562 al=SSL_AD_UNSUPPORTED_CERTIFICATE;
563 break;
557 default:
558 al=SSL_AD_CERTIFICATE_UNKNOWN;
559 break;
560 }
561 return(al);
562 }
563
564int ssl3_setup_buffers(SSL *s)
565 {
566 unsigned char *p;
567 unsigned int extra;
564 default:
565 al=SSL_AD_CERTIFICATE_UNKNOWN;
566 break;
567 }
568 return(al);
569 }
570
571int ssl3_setup_buffers(SSL *s)
572 {
573 unsigned char *p;
574 unsigned int extra;
575 size_t len;
568
569 if (s->s3->rbuf.buf == NULL)
570 {
571 if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER)
572 extra=SSL3_RT_MAX_EXTRA;
573 else
574 extra=0;
576
577 if (s->s3->rbuf.buf == NULL)
578 {
579 if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER)
580 extra=SSL3_RT_MAX_EXTRA;
581 else
582 extra=0;
575 if ((p=OPENSSL_malloc(SSL3_RT_MAX_PACKET_SIZE+extra))
576 == NULL)
583 len = SSL3_RT_MAX_PACKET_SIZE + extra;
584 if ((p=OPENSSL_malloc(len)) == NULL)
577 goto err;
585 goto err;
578 s->s3->rbuf.buf=p;
586 s->s3->rbuf.buf = p;
587 s->s3->rbuf_len = len;
579 }
580
581 if (s->s3->wbuf.buf == NULL)
582 {
588 }
589
590 if (s->s3->wbuf.buf == NULL)
591 {
583 if ((p=OPENSSL_malloc(SSL3_RT_MAX_PACKET_SIZE))
584 == NULL)
592 len = SSL3_RT_MAX_PACKET_SIZE;
593 len += SSL3_RT_HEADER_LENGTH + 256; /* extra space for empty fragment */
594 if ((p=OPENSSL_malloc(len)) == NULL)
585 goto err;
595 goto err;
586 s->s3->wbuf.buf=p;
596 s->s3->wbuf.buf = p;
597 s->s3->wbuf_len = len;
587 }
588 s->packet= &(s->s3->rbuf.buf[0]);
589 return(1);
590err:
591 SSLerr(SSL_F_SSL3_SETUP_BUFFERS,ERR_R_MALLOC_FAILURE);
592 return(0);
593 }
598 }
599 s->packet= &(s->s3->rbuf.buf[0]);
600 return(1);
601err:
602 SSLerr(SSL_F_SSL3_SETUP_BUFFERS,ERR_R_MALLOC_FAILURE);
603 return(0);
604 }