diff options
Diffstat (limited to '')
78 files changed, 765 insertions, 149 deletions
diff --git a/src/lib/libcrypto/aes/aes_locl.h b/src/lib/libcrypto/aes/aes_locl.h index 541d1d6e84..18fc2d0747 100644 --- a/src/lib/libcrypto/aes/aes_locl.h +++ b/src/lib/libcrypto/aes/aes_locl.h | |||
| @@ -60,10 +60,7 @@ | |||
| 60 | 60 | ||
| 61 | #include <stdio.h> | 61 | #include <stdio.h> |
| 62 | #include <stdlib.h> | 62 | #include <stdlib.h> |
| 63 | |||
| 64 | #if defined(__STDC__) || defined(OPENSSL_SYS_VMS) || defined(M_XENIX) || defined(OPENSSL_SYS_MSDOS) | ||
| 65 | #include <string.h> | 63 | #include <string.h> |
| 66 | #endif | ||
| 67 | 64 | ||
| 68 | #ifdef _MSC_VER | 65 | #ifdef _MSC_VER |
| 69 | # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) | 66 | # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) |
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c index 128aa7e772..8dab29dca1 100644 --- a/src/lib/libcrypto/asn1/a_strex.c +++ b/src/lib/libcrypto/asn1/a_strex.c | |||
| @@ -77,8 +77,8 @@ | |||
| 77 | /* Three IO functions for sending data to memory, a BIO and | 77 | /* Three IO functions for sending data to memory, a BIO and |
| 78 | * and a FILE pointer. | 78 | * and a FILE pointer. |
| 79 | */ | 79 | */ |
| 80 | 80 | #if 0 /* never used */ | |
| 81 | int send_mem_chars(void *arg, const void *buf, int len) | 81 | static int send_mem_chars(void *arg, const void *buf, int len) |
| 82 | { | 82 | { |
| 83 | unsigned char **out = arg; | 83 | unsigned char **out = arg; |
| 84 | if(!out) return 1; | 84 | if(!out) return 1; |
| @@ -86,15 +86,16 @@ int send_mem_chars(void *arg, const void *buf, int len) | |||
| 86 | *out += len; | 86 | *out += len; |
| 87 | return 1; | 87 | return 1; |
| 88 | } | 88 | } |
| 89 | #endif | ||
| 89 | 90 | ||
| 90 | int send_bio_chars(void *arg, const void *buf, int len) | 91 | static int send_bio_chars(void *arg, const void *buf, int len) |
| 91 | { | 92 | { |
| 92 | if(!arg) return 1; | 93 | if(!arg) return 1; |
| 93 | if(BIO_write(arg, buf, len) != len) return 0; | 94 | if(BIO_write(arg, buf, len) != len) return 0; |
| 94 | return 1; | 95 | return 1; |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | int send_fp_chars(void *arg, const void *buf, int len) | 98 | static int send_fp_chars(void *arg, const void *buf, int len) |
| 98 | { | 99 | { |
| 99 | if(!arg) return 1; | 100 | if(!arg) return 1; |
| 100 | if(fwrite(buf, 1, len, arg) != (unsigned int)len) return 0; | 101 | if(fwrite(buf, 1, len, arg) != (unsigned int)len) return 0; |
| @@ -240,7 +241,7 @@ static int do_hex_dump(char_io *io_ch, void *arg, unsigned char *buf, int buflen | |||
| 240 | * #01234 format. | 241 | * #01234 format. |
| 241 | */ | 242 | */ |
| 242 | 243 | ||
| 243 | int do_dump(unsigned long lflags, char_io *io_ch, void *arg, ASN1_STRING *str) | 244 | static int do_dump(unsigned long lflags, char_io *io_ch, void *arg, ASN1_STRING *str) |
| 244 | { | 245 | { |
| 245 | /* Placing the ASN1_STRING in a temp ASN1_TYPE allows | 246 | /* Placing the ASN1_STRING in a temp ASN1_TYPE allows |
| 246 | * the DER encoding to readily obtained | 247 | * the DER encoding to readily obtained |
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index 0d1713f8dd..dbb30f4f22 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
| @@ -773,6 +773,7 @@ int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b); | |||
| 773 | int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len); | 773 | int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len); |
| 774 | 774 | ||
| 775 | DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) | 775 | DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) |
| 776 | DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) | ||
| 776 | DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) | 777 | DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) |
| 777 | DECLARE_ASN1_FUNCTIONS(ASN1_NULL) | 778 | DECLARE_ASN1_FUNCTIONS(ASN1_NULL) |
| 778 | DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) | 779 | DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) |
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 830ff2af3c..422685a3b4 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/asn1_mac.h> | ||
| 62 | 63 | ||
| 63 | static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max); | 64 | static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max); |
| 64 | static void asn1_put_length(unsigned char **pp, int length); | 65 | static void asn1_put_length(unsigned char **pp, int length); |
| @@ -123,15 +124,13 @@ int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, int *pclass, | |||
| 123 | (int)(omax+ *pp)); | 124 | (int)(omax+ *pp)); |
| 124 | 125 | ||
| 125 | #endif | 126 | #endif |
| 126 | #if 0 | 127 | if (*plength > (omax - (*pp - p))) |
| 127 | if ((p+ *plength) > (omax+ *pp)) | ||
| 128 | { | 128 | { |
| 129 | ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG); | 129 | ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG); |
| 130 | /* Set this so that even if things are not long enough | 130 | /* Set this so that even if things are not long enough |
| 131 | * the values are set correctly */ | 131 | * the values are set correctly */ |
| 132 | ret|=0x80; | 132 | ret|=0x80; |
| 133 | } | 133 | } |
| 134 | #endif | ||
| 135 | *pp=p; | 134 | *pp=p; |
| 136 | return(ret|inf); | 135 | return(ret|inf); |
| 137 | err: | 136 | err: |
| @@ -158,6 +157,8 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) | |||
| 158 | i= *p&0x7f; | 157 | i= *p&0x7f; |
| 159 | if (*(p++) & 0x80) | 158 | if (*(p++) & 0x80) |
| 160 | { | 159 | { |
| 160 | if (i > sizeof(long)) | ||
| 161 | return 0; | ||
| 161 | if (max-- == 0) return(0); | 162 | if (max-- == 0) return(0); |
| 162 | while (i-- > 0) | 163 | while (i-- > 0) |
| 163 | { | 164 | { |
| @@ -169,6 +170,8 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) | |||
| 169 | else | 170 | else |
| 170 | ret=i; | 171 | ret=i; |
| 171 | } | 172 | } |
| 173 | if (ret < 0) | ||
| 174 | return 0; | ||
| 172 | *pp=p; | 175 | *pp=p; |
| 173 | *rl=ret; | 176 | *rl=ret; |
| 174 | return(1); | 177 | return(1); |
| @@ -406,7 +409,7 @@ int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b) | |||
| 406 | 409 | ||
| 407 | void asn1_add_error(unsigned char *address, int offset) | 410 | void asn1_add_error(unsigned char *address, int offset) |
| 408 | { | 411 | { |
| 409 | char buf1[16],buf2[16]; | 412 | char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; |
| 410 | 413 | ||
| 411 | sprintf(buf1,"%lu",(unsigned long)address); | 414 | sprintf(buf1,"%lu",(unsigned long)address); |
| 412 | sprintf(buf2,"%d",offset); | 415 | sprintf(buf2,"%d",offset); |
diff --git a/src/lib/libcrypto/asn1/n_pkey.c b/src/lib/libcrypto/asn1/n_pkey.c index 49f80fffd2..9146ee02c9 100644 --- a/src/lib/libcrypto/asn1/n_pkey.c +++ b/src/lib/libcrypto/asn1/n_pkey.c | |||
| @@ -92,6 +92,8 @@ ASN1_BROKEN_SEQUENCE(NETSCAPE_ENCRYPTED_PKEY) = { | |||
| 92 | ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, enckey, X509_SIG) | 92 | ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, enckey, X509_SIG) |
| 93 | } ASN1_BROKEN_SEQUENCE_END(NETSCAPE_ENCRYPTED_PKEY) | 93 | } ASN1_BROKEN_SEQUENCE_END(NETSCAPE_ENCRYPTED_PKEY) |
| 94 | 94 | ||
| 95 | DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY) | ||
| 96 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY,NETSCAPE_ENCRYPTED_PKEY) | ||
| 95 | IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY) | 97 | IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY) |
| 96 | 98 | ||
| 97 | ASN1_SEQUENCE(NETSCAPE_PKEY) = { | 99 | ASN1_SEQUENCE(NETSCAPE_PKEY) = { |
| @@ -100,6 +102,8 @@ ASN1_SEQUENCE(NETSCAPE_PKEY) = { | |||
| 100 | ASN1_SIMPLE(NETSCAPE_PKEY, private_key, ASN1_OCTET_STRING) | 102 | ASN1_SIMPLE(NETSCAPE_PKEY, private_key, ASN1_OCTET_STRING) |
| 101 | } ASN1_SEQUENCE_END(NETSCAPE_PKEY) | 103 | } ASN1_SEQUENCE_END(NETSCAPE_PKEY) |
| 102 | 104 | ||
| 105 | DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_PKEY) | ||
| 106 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(NETSCAPE_PKEY,NETSCAPE_PKEY) | ||
| 103 | IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_PKEY) | 107 | IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_PKEY) |
| 104 | 108 | ||
| 105 | static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os, | 109 | static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os, |
diff --git a/src/lib/libcrypto/asn1/t_pkey.c b/src/lib/libcrypto/asn1/t_pkey.c index 8060115202..2d46914cb1 100644 --- a/src/lib/libcrypto/asn1/t_pkey.c +++ b/src/lib/libcrypto/asn1/t_pkey.c | |||
| @@ -96,10 +96,34 @@ int RSA_print(BIO *bp, const RSA *x, int off) | |||
| 96 | char str[128]; | 96 | char str[128]; |
| 97 | const char *s; | 97 | const char *s; |
| 98 | unsigned char *m=NULL; | 98 | unsigned char *m=NULL; |
| 99 | int i,ret=0; | 99 | int ret=0; |
| 100 | size_t buf_len=0, i; | ||
| 100 | 101 | ||
| 101 | i=RSA_size(x); | 102 | if (x->n) |
| 102 | m=(unsigned char *)OPENSSL_malloc((unsigned int)i+10); | 103 | buf_len = (size_t)BN_num_bytes(x->n); |
| 104 | if (x->e) | ||
| 105 | if (buf_len < (i = (size_t)BN_num_bytes(x->e))) | ||
| 106 | buf_len = i; | ||
| 107 | if (x->d) | ||
| 108 | if (buf_len < (i = (size_t)BN_num_bytes(x->d))) | ||
| 109 | buf_len = i; | ||
| 110 | if (x->p) | ||
| 111 | if (buf_len < (i = (size_t)BN_num_bytes(x->p))) | ||
| 112 | buf_len = i; | ||
| 113 | if (x->q) | ||
| 114 | if (buf_len < (i = (size_t)BN_num_bytes(x->q))) | ||
| 115 | buf_len = i; | ||
| 116 | if (x->dmp1) | ||
| 117 | if (buf_len < (i = (size_t)BN_num_bytes(x->dmp1))) | ||
| 118 | buf_len = i; | ||
| 119 | if (x->dmq1) | ||
| 120 | if (buf_len < (i = (size_t)BN_num_bytes(x->dmq1))) | ||
| 121 | buf_len = i; | ||
| 122 | if (x->iqmp) | ||
| 123 | if (buf_len < (i = (size_t)BN_num_bytes(x->iqmp))) | ||
| 124 | buf_len = i; | ||
| 125 | |||
| 126 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | ||
| 103 | if (m == NULL) | 127 | if (m == NULL) |
| 104 | { | 128 | { |
| 105 | RSAerr(RSA_F_RSA_PRINT,ERR_R_MALLOC_FAILURE); | 129 | RSAerr(RSA_F_RSA_PRINT,ERR_R_MALLOC_FAILURE); |
| @@ -161,22 +185,25 @@ int DSA_print(BIO *bp, const DSA *x, int off) | |||
| 161 | { | 185 | { |
| 162 | char str[128]; | 186 | char str[128]; |
| 163 | unsigned char *m=NULL; | 187 | unsigned char *m=NULL; |
| 164 | int i,ret=0; | 188 | int ret=0; |
| 165 | BIGNUM *bn=NULL; | 189 | size_t buf_len=0,i; |
| 166 | 190 | ||
| 167 | if (x->p != NULL) | 191 | if (x->p) |
| 168 | bn=x->p; | 192 | buf_len = (size_t)BN_num_bytes(x->p); |
| 169 | else if (x->priv_key != NULL) | 193 | if (x->q) |
| 170 | bn=x->priv_key; | 194 | if (buf_len < (i = (size_t)BN_num_bytes(x->q))) |
| 171 | else if (x->pub_key != NULL) | 195 | buf_len = i; |
| 172 | bn=x->pub_key; | 196 | if (x->g) |
| 173 | 197 | if (buf_len < (i = (size_t)BN_num_bytes(x->g))) | |
| 174 | /* larger than needed but what the hell :-) */ | 198 | buf_len = i; |
| 175 | if (bn != NULL) | 199 | if (x->priv_key) |
| 176 | i=BN_num_bytes(bn)*2; | 200 | if (buf_len < (i = (size_t)BN_num_bytes(x->priv_key))) |
| 177 | else | 201 | buf_len = i; |
| 178 | i=256; | 202 | if (x->pub_key) |
| 179 | m=(unsigned char *)OPENSSL_malloc((unsigned int)i+10); | 203 | if (buf_len < (i = (size_t)BN_num_bytes(x->pub_key))) |
| 204 | buf_len = i; | ||
| 205 | |||
| 206 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | ||
| 180 | if (m == NULL) | 207 | if (m == NULL) |
| 181 | { | 208 | { |
| 182 | DSAerr(DSA_F_DSA_PRINT,ERR_R_MALLOC_FAILURE); | 209 | DSAerr(DSA_F_DSA_PRINT,ERR_R_MALLOC_FAILURE); |
| @@ -281,10 +308,15 @@ int DHparams_print_fp(FILE *fp, const DH *x) | |||
| 281 | int DHparams_print(BIO *bp, const DH *x) | 308 | int DHparams_print(BIO *bp, const DH *x) |
| 282 | { | 309 | { |
| 283 | unsigned char *m=NULL; | 310 | unsigned char *m=NULL; |
| 284 | int reason=ERR_R_BUF_LIB,i,ret=0; | 311 | int reason=ERR_R_BUF_LIB,ret=0; |
| 312 | size_t buf_len=0, i; | ||
| 285 | 313 | ||
| 286 | i=BN_num_bytes(x->p); | 314 | if (x->p) |
| 287 | m=(unsigned char *)OPENSSL_malloc((unsigned int)i+10); | 315 | buf_len = (size_t)BN_num_bytes(x->p); |
| 316 | if (x->g) | ||
| 317 | if (buf_len < (i = (size_t)BN_num_bytes(x->g))) | ||
| 318 | buf_len = i; | ||
| 319 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | ||
| 288 | if (m == NULL) | 320 | if (m == NULL) |
| 289 | { | 321 | { |
| 290 | reason=ERR_R_MALLOC_FAILURE; | 322 | reason=ERR_R_MALLOC_FAILURE; |
| @@ -334,10 +366,18 @@ int DSAparams_print_fp(FILE *fp, const DSA *x) | |||
| 334 | int DSAparams_print(BIO *bp, const DSA *x) | 366 | int DSAparams_print(BIO *bp, const DSA *x) |
| 335 | { | 367 | { |
| 336 | unsigned char *m=NULL; | 368 | unsigned char *m=NULL; |
| 337 | int reason=ERR_R_BUF_LIB,i,ret=0; | 369 | int reason=ERR_R_BUF_LIB,ret=0; |
| 370 | size_t buf_len=0,i; | ||
| 338 | 371 | ||
| 339 | i=BN_num_bytes(x->p); | 372 | if (x->p) |
| 340 | m=(unsigned char *)OPENSSL_malloc((unsigned int)i+10); | 373 | buf_len = (size_t)BN_num_bytes(x->p); |
| 374 | if (x->q) | ||
| 375 | if (buf_len < (i = (size_t)BN_num_bytes(x->q))) | ||
| 376 | buf_len = i; | ||
| 377 | if (x->g) | ||
| 378 | if (buf_len < (i = (size_t)BN_num_bytes(x->g))) | ||
| 379 | buf_len = i; | ||
| 380 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | ||
| 341 | if (m == NULL) | 381 | if (m == NULL) |
| 342 | { | 382 | { |
| 343 | reason=ERR_R_MALLOC_FAILURE; | 383 | reason=ERR_R_MALLOC_FAILURE; |
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index dcaef68ea7..45bd7c47e8 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
| @@ -484,7 +484,11 @@ int BIO_socket_ioctl(int fd, long type, unsigned long *arg) | |||
| 484 | { | 484 | { |
| 485 | int i; | 485 | int i; |
| 486 | 486 | ||
| 487 | #ifdef __DJGPP__ | ||
| 488 | i=ioctlsocket(fd,type,(char *)arg); | ||
| 489 | #else | ||
| 487 | i=ioctlsocket(fd,type,arg); | 490 | i=ioctlsocket(fd,type,arg); |
| 491 | #endif /* __DJGPP__ */ | ||
| 488 | if (i < 0) | 492 | if (i < 0) |
| 489 | SYSerr(SYS_F_IOCTLSOCKET,get_last_socket_error()); | 493 | SYSerr(SYS_F_IOCTLSOCKET,get_last_socket_error()); |
| 490 | return(i); | 494 | return(i); |
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index b122c7069d..c5caf253c9 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
| @@ -554,7 +554,9 @@ BIO_METHOD *BIO_s_socket(void); | |||
| 554 | BIO_METHOD *BIO_s_connect(void); | 554 | BIO_METHOD *BIO_s_connect(void); |
| 555 | BIO_METHOD *BIO_s_accept(void); | 555 | BIO_METHOD *BIO_s_accept(void); |
| 556 | BIO_METHOD *BIO_s_fd(void); | 556 | BIO_METHOD *BIO_s_fd(void); |
| 557 | #ifndef OPENSSL_SYS_OS2 | ||
| 557 | BIO_METHOD *BIO_s_log(void); | 558 | BIO_METHOD *BIO_s_log(void); |
| 559 | #endif | ||
| 558 | BIO_METHOD *BIO_s_bio(void); | 560 | BIO_METHOD *BIO_s_bio(void); |
| 559 | BIO_METHOD *BIO_s_null(void); | 561 | BIO_METHOD *BIO_s_null(void); |
| 560 | BIO_METHOD *BIO_f_null(void); | 562 | BIO_METHOD *BIO_f_null(void); |
| @@ -647,6 +649,7 @@ void ERR_load_BIO_strings(void); | |||
| 647 | #define BIO_F_CONN_CTRL 127 | 649 | #define BIO_F_CONN_CTRL 127 |
| 648 | #define BIO_F_CONN_STATE 115 | 650 | #define BIO_F_CONN_STATE 115 |
| 649 | #define BIO_F_FILE_CTRL 116 | 651 | #define BIO_F_FILE_CTRL 116 |
| 652 | #define BIO_F_FILE_READ 130 | ||
| 650 | #define BIO_F_LINEBUFFER_CTRL 129 | 653 | #define BIO_F_LINEBUFFER_CTRL 129 |
| 651 | #define BIO_F_MEM_READ 128 | 654 | #define BIO_F_MEM_READ 128 |
| 652 | #define BIO_F_MEM_WRITE 117 | 655 | #define BIO_F_MEM_WRITE 117 |
diff --git a/src/lib/libcrypto/bio/bio_err.c b/src/lib/libcrypto/bio/bio_err.c index 99ca3cd0da..68a119d895 100644 --- a/src/lib/libcrypto/bio/bio_err.c +++ b/src/lib/libcrypto/bio/bio_err.c | |||
| @@ -91,6 +91,7 @@ static ERR_STRING_DATA BIO_str_functs[]= | |||
| 91 | {ERR_PACK(0,BIO_F_CONN_CTRL,0), "CONN_CTRL"}, | 91 | {ERR_PACK(0,BIO_F_CONN_CTRL,0), "CONN_CTRL"}, |
| 92 | {ERR_PACK(0,BIO_F_CONN_STATE,0), "CONN_STATE"}, | 92 | {ERR_PACK(0,BIO_F_CONN_STATE,0), "CONN_STATE"}, |
| 93 | {ERR_PACK(0,BIO_F_FILE_CTRL,0), "FILE_CTRL"}, | 93 | {ERR_PACK(0,BIO_F_FILE_CTRL,0), "FILE_CTRL"}, |
| 94 | {ERR_PACK(0,BIO_F_FILE_READ,0), "FILE_READ"}, | ||
| 94 | {ERR_PACK(0,BIO_F_LINEBUFFER_CTRL,0), "LINEBUFFER_CTRL"}, | 95 | {ERR_PACK(0,BIO_F_LINEBUFFER_CTRL,0), "LINEBUFFER_CTRL"}, |
| 95 | {ERR_PACK(0,BIO_F_MEM_READ,0), "MEM_READ"}, | 96 | {ERR_PACK(0,BIO_F_MEM_READ,0), "MEM_READ"}, |
| 96 | {ERR_PACK(0,BIO_F_MEM_WRITE,0), "MEM_WRITE"}, | 97 | {ERR_PACK(0,BIO_F_MEM_WRITE,0), "MEM_WRITE"}, |
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index 8b3ff278d9..826b361fa2 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
| @@ -162,6 +162,12 @@ static int MS_CALLBACK file_read(BIO *b, char *out, int outl) | |||
| 162 | if (b->init && (out != NULL)) | 162 | if (b->init && (out != NULL)) |
| 163 | { | 163 | { |
| 164 | ret=fread(out,1,(int)outl,(FILE *)b->ptr); | 164 | ret=fread(out,1,(int)outl,(FILE *)b->ptr); |
| 165 | if(ret == 0 && ferror((FILE *)b->ptr)) | ||
| 166 | { | ||
| 167 | SYSerr(SYS_F_FREAD,get_last_sys_error()); | ||
| 168 | BIOerr(BIO_F_FILE_READ,ERR_R_SYS_LIB); | ||
| 169 | ret=-1; | ||
| 170 | } | ||
| 165 | } | 171 | } |
| 166 | return(ret); | 172 | return(ret); |
| 167 | } | 173 | } |
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index a016cb7f53..8abe095af2 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -397,6 +397,12 @@ BIGNUM *bn_dup_expand(const BIGNUM *b, int words) | |||
| 397 | { | 397 | { |
| 398 | BIGNUM *r = NULL; | 398 | BIGNUM *r = NULL; |
| 399 | 399 | ||
| 400 | /* This function does not work if | ||
| 401 | * words <= b->dmax && top < words | ||
| 402 | * because BN_dup() does not preserve 'dmax'! | ||
| 403 | * (But bn_dup_expand() is not used anywhere yet.) | ||
| 404 | */ | ||
| 405 | |||
| 400 | if (words > b->dmax) | 406 | if (words > b->dmax) |
| 401 | { | 407 | { |
| 402 | BN_ULONG *a = bn_expand_internal(b, words); | 408 | BN_ULONG *a = bn_expand_internal(b, words); |
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c index fd598b8b3d..b03458d002 100644 --- a/src/lib/libcrypto/bn/bn_mul.c +++ b/src/lib/libcrypto/bn/bn_mul.c | |||
| @@ -66,7 +66,7 @@ | |||
| 66 | #include "cryptlib.h" | 66 | #include "cryptlib.h" |
| 67 | #include "bn_lcl.h" | 67 | #include "bn_lcl.h" |
| 68 | 68 | ||
| 69 | #if defined(OPENSSL_NO_ASM) || !(defined(__i386) || defined(__i386__))/* Assembler implementation exists only for x86 */ | 69 | #if defined(OPENSSL_NO_ASM) || !(defined(__i386) || defined(__i386__)) || defined(__DJGPP__) /* Assembler implementation exists only for x86 */ |
| 70 | /* Here follows specialised variants of bn_add_words() and | 70 | /* Here follows specialised variants of bn_add_words() and |
| 71 | bn_sub_words(). They have the property performing operations on | 71 | bn_sub_words(). They have the property performing operations on |
| 72 | arrays of different sizes. The sizes of those arrays is expressed through | 72 | arrays of different sizes. The sizes of those arrays is expressed through |
diff --git a/src/lib/libcrypto/conf/conf.h b/src/lib/libcrypto/conf/conf.h index 3c03fb19c0..f4671442ab 100644 --- a/src/lib/libcrypto/conf/conf.h +++ b/src/lib/libcrypto/conf/conf.h | |||
| @@ -129,6 +129,7 @@ int CONF_dump_fp(LHASH *conf, FILE *out); | |||
| 129 | int CONF_dump_bio(LHASH *conf, BIO *out); | 129 | int CONF_dump_bio(LHASH *conf, BIO *out); |
| 130 | 130 | ||
| 131 | void OPENSSL_config(const char *config_name); | 131 | void OPENSSL_config(const char *config_name); |
| 132 | void OPENSSL_no_config(void); | ||
| 132 | 133 | ||
| 133 | /* New conf code. The semantics are different from the functions above. | 134 | /* New conf code. The semantics are different from the functions above. |
| 134 | If that wasn't the case, the above functions would have been replaced */ | 135 | If that wasn't the case, the above functions would have been replaced */ |
| @@ -141,10 +142,10 @@ struct conf_st | |||
| 141 | }; | 142 | }; |
| 142 | 143 | ||
| 143 | CONF *NCONF_new(CONF_METHOD *meth); | 144 | CONF *NCONF_new(CONF_METHOD *meth); |
| 144 | CONF_METHOD *NCONF_default(); | 145 | CONF_METHOD *NCONF_default(void); |
| 145 | CONF_METHOD *NCONF_WIN32(); | 146 | CONF_METHOD *NCONF_WIN32(void); |
| 146 | #if 0 /* Just to give you an idea of what I have in mind */ | 147 | #if 0 /* Just to give you an idea of what I have in mind */ |
| 147 | CONF_METHOD *NCONF_XML(); | 148 | CONF_METHOD *NCONF_XML(void); |
| 148 | #endif | 149 | #endif |
| 149 | void NCONF_free(CONF *conf); | 150 | void NCONF_free(CONF *conf); |
| 150 | void NCONF_free_data(CONF *conf); | 151 | void NCONF_free_data(CONF *conf); |
| @@ -176,6 +177,7 @@ int CONF_modules_load_file(const char *filename, const char *appname, | |||
| 176 | unsigned long flags); | 177 | unsigned long flags); |
| 177 | void CONF_modules_unload(int all); | 178 | void CONF_modules_unload(int all); |
| 178 | void CONF_modules_finish(void); | 179 | void CONF_modules_finish(void); |
| 180 | void CONF_modules_free(void); | ||
| 179 | int CONF_module_add(const char *name, conf_init_func *ifunc, | 181 | int CONF_module_add(const char *name, conf_init_func *ifunc, |
| 180 | conf_finish_func *ffunc); | 182 | conf_finish_func *ffunc); |
| 181 | 183 | ||
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c index 31f2766246..5e194de60e 100644 --- a/src/lib/libcrypto/conf/conf_def.c +++ b/src/lib/libcrypto/conf/conf_def.c | |||
| @@ -67,6 +67,7 @@ | |||
| 67 | #include "conf_def.h" | 67 | #include "conf_def.h" |
| 68 | #include <openssl/buffer.h> | 68 | #include <openssl/buffer.h> |
| 69 | #include <openssl/err.h> | 69 | #include <openssl/err.h> |
| 70 | #include "cryptlib.h" | ||
| 70 | 71 | ||
| 71 | static char *eat_ws(CONF *conf, char *p); | 72 | static char *eat_ws(CONF *conf, char *p); |
| 72 | static char *eat_alpha_numeric(CONF *conf, char *p); | 73 | static char *eat_alpha_numeric(CONF *conf, char *p); |
| @@ -208,12 +209,12 @@ static int def_load(CONF *conf, const char *name, long *line) | |||
| 208 | static int def_load_bio(CONF *conf, BIO *in, long *line) | 209 | static int def_load_bio(CONF *conf, BIO *in, long *line) |
| 209 | { | 210 | { |
| 210 | #define BUFSIZE 512 | 211 | #define BUFSIZE 512 |
| 211 | char btmp[16]; | ||
| 212 | int bufnum=0,i,ii; | 212 | int bufnum=0,i,ii; |
| 213 | BUF_MEM *buff=NULL; | 213 | BUF_MEM *buff=NULL; |
| 214 | char *s,*p,*end; | 214 | char *s,*p,*end; |
| 215 | int again,n; | 215 | int again,n; |
| 216 | long eline=0; | 216 | long eline=0; |
| 217 | char btmp[DECIMAL_SIZE(eline)+1]; | ||
| 217 | CONF_VALUE *v=NULL,*tv; | 218 | CONF_VALUE *v=NULL,*tv; |
| 218 | CONF_VALUE *sv=NULL; | 219 | CONF_VALUE *sv=NULL; |
| 219 | char *section=NULL,*buf; | 220 | char *section=NULL,*buf; |
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c index 7998f34c7b..6a3cf109dd 100644 --- a/src/lib/libcrypto/conf/conf_lib.c +++ b/src/lib/libcrypto/conf/conf_lib.c | |||
| @@ -382,8 +382,9 @@ int NCONF_dump_bio(const CONF *conf, BIO *out) | |||
| 382 | return conf->meth->dump(conf, out); | 382 | return conf->meth->dump(conf, out); |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | |||
| 385 | /* This function should be avoided */ | 386 | /* This function should be avoided */ |
| 386 | #undef NCONF_get_number | 387 | #if 0 |
| 387 | long NCONF_get_number(CONF *conf,char *group,char *name) | 388 | long NCONF_get_number(CONF *conf,char *group,char *name) |
| 388 | { | 389 | { |
| 389 | int status; | 390 | int status; |
| @@ -397,4 +398,4 @@ long NCONF_get_number(CONF *conf,char *group,char *name) | |||
| 397 | } | 398 | } |
| 398 | return ret; | 399 | return ret; |
| 399 | } | 400 | } |
| 400 | 401 | #endif | |
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c index f92babc2e2..edcc08921c 100644 --- a/src/lib/libcrypto/conf/conf_mod.c +++ b/src/lib/libcrypto/conf/conf_mod.c | |||
| @@ -230,7 +230,7 @@ static int module_run(const CONF *cnf, char *name, char *value, | |||
| 230 | { | 230 | { |
| 231 | if (!(flags & CONF_MFLAGS_SILENT)) | 231 | if (!(flags & CONF_MFLAGS_SILENT)) |
| 232 | { | 232 | { |
| 233 | char rcode[10]; | 233 | char rcode[DECIMAL_SIZE(ret)+1]; |
| 234 | CONFerr(CONF_F_CONF_MODULES_LOAD, CONF_R_MODULE_INITIALIZATION_ERROR); | 234 | CONFerr(CONF_F_CONF_MODULES_LOAD, CONF_R_MODULE_INITIALIZATION_ERROR); |
| 235 | sprintf(rcode, "%-8d", ret); | 235 | sprintf(rcode, "%-8d", ret); |
| 236 | ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); | 236 | ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); |
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c index 612b3b93b4..d301b376f7 100644 --- a/src/lib/libcrypto/cryptlib.c +++ b/src/lib/libcrypto/cryptlib.c | |||
| @@ -492,3 +492,11 @@ BOOL WINAPI DLLEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, | |||
| 492 | #endif | 492 | #endif |
| 493 | 493 | ||
| 494 | #endif | 494 | #endif |
| 495 | |||
| 496 | void OpenSSLDie(const char *file,int line,const char *assertion) | ||
| 497 | { | ||
| 498 | fprintf(stderr,"%s(%d): OpenSSL internal error, assertion failed: %s\n", | ||
| 499 | file,line,assertion); | ||
| 500 | abort(); | ||
| 501 | } | ||
| 502 | |||
diff --git a/src/lib/libcrypto/cryptlib.h b/src/lib/libcrypto/cryptlib.h index a0489e57fc..985a6d377c 100644 --- a/src/lib/libcrypto/cryptlib.h +++ b/src/lib/libcrypto/cryptlib.h | |||
| @@ -89,6 +89,14 @@ extern "C" { | |||
| 89 | #define X509_CERT_DIR_EVP "SSL_CERT_DIR" | 89 | #define X509_CERT_DIR_EVP "SSL_CERT_DIR" |
| 90 | #define X509_CERT_FILE_EVP "SSL_CERT_FILE" | 90 | #define X509_CERT_FILE_EVP "SSL_CERT_FILE" |
| 91 | 91 | ||
| 92 | /* size of string represenations */ | ||
| 93 | #define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1) | ||
| 94 | #define HEX_SIZE(type) ((sizeof(type)*2) | ||
| 95 | |||
| 96 | /* die if we have to */ | ||
| 97 | void OpenSSLDie(const char *file,int line,const char *assertion); | ||
| 98 | #define die(e) ((e) ? (void)0 : OpenSSLDie(__FILE__, __LINE__, #e)) | ||
| 99 | |||
| 92 | #ifdef __cplusplus | 100 | #ifdef __cplusplus |
| 93 | } | 101 | } |
| 94 | #endif | 102 | #endif |
diff --git a/src/lib/libcrypto/doc/DH_get_ex_new_index.pod b/src/lib/libcrypto/doc/DH_get_ex_new_index.pod index 82e2548bcd..fa5eab2650 100644 --- a/src/lib/libcrypto/doc/DH_get_ex_new_index.pod +++ b/src/lib/libcrypto/doc/DH_get_ex_new_index.pod | |||
| @@ -26,7 +26,7 @@ as described in L<RSA_get_ex_new_index(3)>. | |||
| 26 | 26 | ||
| 27 | =head1 SEE ALSO | 27 | =head1 SEE ALSO |
| 28 | 28 | ||
| 29 | L<RSA_get_ex_new_index()|RSA_get_ex_new_index()>, L<dh(3)|dh(3)> | 29 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, L<dh(3)|dh(3)> |
| 30 | 30 | ||
| 31 | =head1 HISTORY | 31 | =head1 HISTORY |
| 32 | 32 | ||
diff --git a/src/lib/libcrypto/doc/EVP_DigestInit.pod b/src/lib/libcrypto/doc/EVP_DigestInit.pod index b3a61f1c5d..5901c39526 100644 --- a/src/lib/libcrypto/doc/EVP_DigestInit.pod +++ b/src/lib/libcrypto/doc/EVP_DigestInit.pod | |||
| @@ -238,14 +238,19 @@ even though they are identical digests. | |||
| 238 | 238 | ||
| 239 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, | 239 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, |
| 240 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, | 240 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, |
| 241 | L<sha(3)|sha(3)>, L<digest(1)|digest(1)> | 241 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> |
| 242 | 242 | ||
| 243 | =head1 HISTORY | 243 | =head1 HISTORY |
| 244 | 244 | ||
| 245 | EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() are | 245 | EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() are |
| 246 | available in all versions of SSLeay and OpenSSL. | 246 | available in all versions of SSLeay and OpenSSL. |
| 247 | 247 | ||
| 248 | EVP_DigestInit_ex(), EVP_DigestFinal_ex() and EVP_MD_CTX_copy_ex() | 248 | EVP_MD_CTX_init(), EVP_MD_CTX_create(), EVP_MD_CTX_copy_ex(), |
| 249 | were added in OpenSSL 0.9.7. | 249 | EVP_MD_CTX_cleanup(), EVP_MD_CTX_destroy(), EVP_DigestInit_ex() |
| 250 | and EVP_DigestFinal_ex() were added in OpenSSL 0.9.7. | ||
| 251 | |||
| 252 | EVP_md_null(), EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), | ||
| 253 | EVP_dss(), EVP_dss1(), EVP_mdc2() and EVP_ripemd160() were | ||
| 254 | changed to return truely const EVP_MD * in OpenSSL 0.9.7. | ||
| 250 | 255 | ||
| 251 | =cut | 256 | =cut |
diff --git a/src/lib/libcrypto/doc/EVP_EncryptInit.pod b/src/lib/libcrypto/doc/EVP_EncryptInit.pod index 371b6a2287..75cceb1ca2 100644 --- a/src/lib/libcrypto/doc/EVP_EncryptInit.pod +++ b/src/lib/libcrypto/doc/EVP_EncryptInit.pod | |||
| @@ -501,4 +501,9 @@ L<evp(3)|evp(3)> | |||
| 501 | 501 | ||
| 502 | =head1 HISTORY | 502 | =head1 HISTORY |
| 503 | 503 | ||
| 504 | EVP_CIPHER_CTX_init(), EVP_EncryptInit_ex(), EVP_EncryptFinal_ex(), | ||
| 505 | EVP_DecryptInit_ex(), EVP_DecryptFinal_ex(), EVP_CipherInit_ex(), | ||
| 506 | EVP_CipherFinal_ex() and EVP_CIPHER_CTX_set_padding() appeared in | ||
| 507 | OpenSSL 0.9.7. | ||
| 508 | |||
| 504 | =cut | 509 | =cut |
diff --git a/src/lib/libcrypto/doc/EVP_SignInit.pod b/src/lib/libcrypto/doc/EVP_SignInit.pod index 32e9d54809..b203c3a1c5 100644 --- a/src/lib/libcrypto/doc/EVP_SignInit.pod +++ b/src/lib/libcrypto/doc/EVP_SignInit.pod | |||
| @@ -84,13 +84,13 @@ L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, | |||
| 84 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, | 84 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, |
| 85 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, | 85 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, |
| 86 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, | 86 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, |
| 87 | L<sha(3)|sha(3)>, L<digest(1)|digest(1)> | 87 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> |
| 88 | 88 | ||
| 89 | =head1 HISTORY | 89 | =head1 HISTORY |
| 90 | 90 | ||
| 91 | EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are | 91 | EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are |
| 92 | available in all versions of SSLeay and OpenSSL. | 92 | available in all versions of SSLeay and OpenSSL. |
| 93 | 93 | ||
| 94 | EVP_SignInit_ex() was added in OpenSSL 0.9.7 | 94 | EVP_SignInit_ex() was added in OpenSSL 0.9.7. |
| 95 | 95 | ||
| 96 | =cut | 96 | =cut |
diff --git a/src/lib/libcrypto/doc/EVP_VerifyInit.pod b/src/lib/libcrypto/doc/EVP_VerifyInit.pod index 80c656fde8..b6afaedee5 100644 --- a/src/lib/libcrypto/doc/EVP_VerifyInit.pod +++ b/src/lib/libcrypto/doc/EVP_VerifyInit.pod | |||
| @@ -74,7 +74,7 @@ L<EVP_SignInit(3)|EVP_SignInit(3)>, | |||
| 74 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, | 74 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, |
| 75 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, | 75 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, |
| 76 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, | 76 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, |
| 77 | L<sha(3)|sha(3)>, L<digest(1)|digest(1)> | 77 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> |
| 78 | 78 | ||
| 79 | =head1 HISTORY | 79 | =head1 HISTORY |
| 80 | 80 | ||
diff --git a/src/lib/libcrypto/doc/RSA_check_key.pod b/src/lib/libcrypto/doc/RSA_check_key.pod index 79fed753ad..3d824a07f5 100644 --- a/src/lib/libcrypto/doc/RSA_check_key.pod +++ b/src/lib/libcrypto/doc/RSA_check_key.pod | |||
| @@ -18,7 +18,9 @@ in fact prime, and that B<n = p*q>. | |||
| 18 | It also checks that B<d*e = 1 mod (p-1*q-1)>, | 18 | It also checks that B<d*e = 1 mod (p-1*q-1)>, |
| 19 | and that B<dmp1>, B<dmq1> and B<iqmp> are set correctly or are B<NULL>. | 19 | and that B<dmp1>, B<dmq1> and B<iqmp> are set correctly or are B<NULL>. |
| 20 | 20 | ||
| 21 | The key's public components may not be B<NULL>. | 21 | As such, this function can not be used with any arbitrary RSA key object, |
| 22 | even if it is otherwise fit for regular RSA operation. See B<NOTES> for more | ||
| 23 | information. | ||
| 22 | 24 | ||
| 23 | =head1 RETURN VALUE | 25 | =head1 RETURN VALUE |
| 24 | 26 | ||
| @@ -28,12 +30,38 @@ RSA_check_key() returns 1 if B<rsa> is a valid RSA key, and 0 otherwise. | |||
| 28 | If the key is invalid or an error occurred, the reason code can be | 30 | If the key is invalid or an error occurred, the reason code can be |
| 29 | obtained using L<ERR_get_error(3)|ERR_get_error(3)>. | 31 | obtained using L<ERR_get_error(3)|ERR_get_error(3)>. |
| 30 | 32 | ||
| 33 | =head1 NOTES | ||
| 34 | |||
| 35 | This function does not work on RSA public keys that have only the modulus | ||
| 36 | and public exponent elements populated. It performs integrity checks on all | ||
| 37 | the RSA key material, so the RSA key structure must contain all the private | ||
| 38 | key data too. | ||
| 39 | |||
| 40 | Unlike most other RSA functions, this function does B<not> work | ||
| 41 | transparently with any underlying ENGINE implementation because it uses the | ||
| 42 | key data in the RSA structure directly. An ENGINE implementation can | ||
| 43 | override the way key data is stored and handled, and can even provide | ||
| 44 | support for HSM keys - in which case the RSA structure may contain B<no> | ||
| 45 | key data at all! If the ENGINE in question is only being used for | ||
| 46 | acceleration or analysis purposes, then in all likelihood the RSA key data | ||
| 47 | is complete and untouched, but this can't be assumed in the general case. | ||
| 48 | |||
| 49 | =head1 BUGS | ||
| 50 | |||
| 51 | A method of verifying the RSA key using opaque RSA API functions might need | ||
| 52 | to be considered. Right now RSA_check_key() simply uses the RSA structure | ||
| 53 | elements directly, bypassing the RSA_METHOD table altogether (and | ||
| 54 | completely violating encapsulation and object-orientation in the process). | ||
| 55 | The best fix will probably be to introduce a "check_key()" handler to the | ||
| 56 | RSA_METHOD function table so that alternative implementations can also | ||
| 57 | provide their own verifiers. | ||
| 58 | |||
| 31 | =head1 SEE ALSO | 59 | =head1 SEE ALSO |
| 32 | 60 | ||
| 33 | L<rsa(3)|rsa(3)>, L<err(3)|err(3)> | 61 | L<rsa(3)|rsa(3)>, L<err(3)|err(3)> |
| 34 | 62 | ||
| 35 | =head1 HISTORY | 63 | =head1 HISTORY |
| 36 | 64 | ||
| 37 | RSA_check() appeared in OpenSSL 0.9.4. | 65 | RSA_check_key() appeared in OpenSSL 0.9.4. |
| 38 | 66 | ||
| 39 | =cut | 67 | =cut |
diff --git a/src/lib/libcrypto/doc/rsa.pod b/src/lib/libcrypto/doc/rsa.pod index 09ad30cab1..2b93a12b65 100644 --- a/src/lib/libcrypto/doc/rsa.pod +++ b/src/lib/libcrypto/doc/rsa.pod | |||
| @@ -110,7 +110,7 @@ L<RSA_blinding_on(3)|RSA_blinding_on(3)>, | |||
| 110 | L<RSA_set_method(3)|RSA_set_method(3)>, L<RSA_print(3)|RSA_print(3)>, | 110 | L<RSA_set_method(3)|RSA_set_method(3)>, L<RSA_print(3)|RSA_print(3)>, |
| 111 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, | 111 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, |
| 112 | L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>, | 112 | L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>, |
| 113 | L<RSA_sign_ASN_OCTET_STRING(3)|RSA_sign_ASN_OCTET_STRING(3)>, | 113 | L<RSA_sign_ASN1_OCTET_STRING(3)|RSA_sign_ASN1_OCTET_STRING(3)>, |
| 114 | L<RSA_padding_add_PKCS1_type_1(3)|RSA_padding_add_PKCS1_type_1(3)> | 114 | L<RSA_padding_add_PKCS1_type_1(3)|RSA_padding_add_PKCS1_type_1(3)> |
| 115 | 115 | ||
| 116 | =cut | 116 | =cut |
diff --git a/src/lib/libcrypto/engine/eng_cnf.c b/src/lib/libcrypto/engine/eng_cnf.c index 8c0ae8a1ad..cdf670901a 100644 --- a/src/lib/libcrypto/engine/eng_cnf.c +++ b/src/lib/libcrypto/engine/eng_cnf.c | |||
| @@ -92,7 +92,7 @@ static int int_engine_init(ENGINE *e) | |||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | 94 | ||
| 95 | int int_engine_configure(char *name, char *value, const CONF *cnf) | 95 | static int int_engine_configure(char *name, char *value, const CONF *cnf) |
| 96 | { | 96 | { |
| 97 | int i; | 97 | int i; |
| 98 | int ret = 0; | 98 | int ret = 0; |
diff --git a/src/lib/libcrypto/engine/eng_dyn.c b/src/lib/libcrypto/engine/eng_dyn.c index 4fefcc0cae..4139a16e76 100644 --- a/src/lib/libcrypto/engine/eng_dyn.c +++ b/src/lib/libcrypto/engine/eng_dyn.c | |||
| @@ -157,6 +157,10 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr, | |||
| 157 | dynamic_data_ctx *ctx = (dynamic_data_ctx *)ptr; | 157 | dynamic_data_ctx *ctx = (dynamic_data_ctx *)ptr; |
| 158 | if(ctx->dynamic_dso) | 158 | if(ctx->dynamic_dso) |
| 159 | DSO_free(ctx->dynamic_dso); | 159 | DSO_free(ctx->dynamic_dso); |
| 160 | if(ctx->DYNAMIC_LIBNAME) | ||
| 161 | OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); | ||
| 162 | if(ctx->engine_id) | ||
| 163 | OPENSSL_free((void*)ctx->engine_id); | ||
| 160 | OPENSSL_free(ctx); | 164 | OPENSSL_free(ctx); |
| 161 | } | 165 | } |
| 162 | } | 166 | } |
| @@ -169,7 +173,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) | |||
| 169 | { | 173 | { |
| 170 | dynamic_data_ctx *c; | 174 | dynamic_data_ctx *c; |
| 171 | c = OPENSSL_malloc(sizeof(dynamic_data_ctx)); | 175 | c = OPENSSL_malloc(sizeof(dynamic_data_ctx)); |
| 172 | if(!ctx) | 176 | if(!c) |
| 173 | { | 177 | { |
| 174 | ENGINEerr(ENGINE_F_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); | 178 | ENGINEerr(ENGINE_F_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); |
| 175 | return 0; | 179 | return 0; |
| @@ -310,8 +314,13 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | |||
| 310 | /* a NULL 'p' or a string of zero-length is the same thing */ | 314 | /* a NULL 'p' or a string of zero-length is the same thing */ |
| 311 | if(p && (strlen((const char *)p) < 1)) | 315 | if(p && (strlen((const char *)p) < 1)) |
| 312 | p = NULL; | 316 | p = NULL; |
| 313 | ctx->DYNAMIC_LIBNAME = (const char *)p; | 317 | if(ctx->DYNAMIC_LIBNAME) |
| 314 | return 1; | 318 | OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); |
| 319 | if(p) | ||
| 320 | ctx->DYNAMIC_LIBNAME = BUF_strdup(p); | ||
| 321 | else | ||
| 322 | ctx->DYNAMIC_LIBNAME = NULL; | ||
| 323 | return (ctx->DYNAMIC_LIBNAME ? 1 : 0); | ||
| 315 | case DYNAMIC_CMD_NO_VCHECK: | 324 | case DYNAMIC_CMD_NO_VCHECK: |
| 316 | ctx->no_vcheck = ((i == 0) ? 0 : 1); | 325 | ctx->no_vcheck = ((i == 0) ? 0 : 1); |
| 317 | return 1; | 326 | return 1; |
| @@ -319,8 +328,13 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | |||
| 319 | /* a NULL 'p' or a string of zero-length is the same thing */ | 328 | /* a NULL 'p' or a string of zero-length is the same thing */ |
| 320 | if(p && (strlen((const char *)p) < 1)) | 329 | if(p && (strlen((const char *)p) < 1)) |
| 321 | p = NULL; | 330 | p = NULL; |
| 322 | ctx->engine_id = (const char *)p; | 331 | if(ctx->engine_id) |
| 323 | return 1; | 332 | OPENSSL_free((void*)ctx->engine_id); |
| 333 | if(p) | ||
| 334 | ctx->engine_id = BUF_strdup(p); | ||
| 335 | else | ||
| 336 | ctx->engine_id = NULL; | ||
| 337 | return (ctx->engine_id ? 1 : 0); | ||
| 324 | case DYNAMIC_CMD_LIST_ADD: | 338 | case DYNAMIC_CMD_LIST_ADD: |
| 325 | if((i < 0) || (i > 2)) | 339 | if((i < 0) || (i > 2)) |
| 326 | { | 340 | { |
diff --git a/src/lib/libcrypto/engine/eng_fat.c b/src/lib/libcrypto/engine/eng_fat.c index d49aa7ed40..f7edb5ad32 100644 --- a/src/lib/libcrypto/engine/eng_fat.c +++ b/src/lib/libcrypto/engine/eng_fat.c | |||
| @@ -84,7 +84,7 @@ int ENGINE_set_default(ENGINE *e, unsigned int flags) | |||
| 84 | 84 | ||
| 85 | /* Set default algorithms using a string */ | 85 | /* Set default algorithms using a string */ |
| 86 | 86 | ||
| 87 | int int_def_cb(const char *alg, int len, void *arg) | 87 | static int int_def_cb(const char *alg, int len, void *arg) |
| 88 | { | 88 | { |
| 89 | unsigned int *pflags = arg; | 89 | unsigned int *pflags = arg; |
| 90 | if (!strncmp(alg, "ALL", len)) | 90 | if (!strncmp(alg, "ALL", len)) |
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index 04773d65a6..5abe44e6d5 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c | |||
| @@ -166,6 +166,7 @@ static ERR_STRING_DATA ERR_str_functs[]= | |||
| 166 | {ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"}, | 166 | {ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"}, |
| 167 | #endif | 167 | #endif |
| 168 | {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"}, | 168 | {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"}, |
| 169 | {ERR_PACK(0,SYS_F_FREAD,0), "fread"}, | ||
| 169 | {0,NULL}, | 170 | {0,NULL}, |
| 170 | }; | 171 | }; |
| 171 | 172 | ||
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h index cc9bb649ea..988ef81aa0 100644 --- a/src/lib/libcrypto/err/err.h +++ b/src/lib/libcrypto/err/err.h | |||
| @@ -182,6 +182,7 @@ typedef struct err_state_st | |||
| 182 | #define SYS_F_ACCEPT 8 | 182 | #define SYS_F_ACCEPT 8 |
| 183 | #define SYS_F_WSASTARTUP 9 /* Winsock stuff */ | 183 | #define SYS_F_WSASTARTUP 9 /* Winsock stuff */ |
| 184 | #define SYS_F_OPENDIR 10 | 184 | #define SYS_F_OPENDIR 10 |
| 185 | #define SYS_F_FREAD 11 | ||
| 185 | 186 | ||
| 186 | 187 | ||
| 187 | /* reasons */ | 188 | /* reasons */ |
diff --git a/src/lib/libcrypto/evp/c_all.c b/src/lib/libcrypto/evp/c_all.c index 5ffd352ea0..2d3e57c4fa 100644 --- a/src/lib/libcrypto/evp/c_all.c +++ b/src/lib/libcrypto/evp/c_all.c | |||
| @@ -60,12 +60,14 @@ | |||
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 62 | 62 | ||
| 63 | #if 0 | ||
| 63 | #undef OpenSSL_add_all_algorithms | 64 | #undef OpenSSL_add_all_algorithms |
| 64 | 65 | ||
| 65 | void OpenSSL_add_all_algorithms(void) | 66 | void OpenSSL_add_all_algorithms(void) |
| 66 | { | 67 | { |
| 67 | OPENSSL_add_all_algorithms_noconf(); | 68 | OPENSSL_add_all_algorithms_noconf(); |
| 68 | } | 69 | } |
| 70 | #endif | ||
| 69 | 71 | ||
| 70 | void OPENSSL_add_all_algorithms_noconf(void) | 72 | void OPENSSL_add_all_algorithms_noconf(void) |
| 71 | { | 73 | { |
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index fb16de6852..45a25f968d 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
| @@ -74,6 +74,48 @@ | |||
| 74 | #ifndef OPENSSL_NO_BIO | 74 | #ifndef OPENSSL_NO_BIO |
| 75 | #include <openssl/bio.h> | 75 | #include <openssl/bio.h> |
| 76 | #endif | 76 | #endif |
| 77 | #ifndef OPENSSL_NO_MD2 | ||
| 78 | #include <openssl/md2.h> | ||
| 79 | #endif | ||
| 80 | #ifndef OPENSSL_NO_MD4 | ||
| 81 | #include <openssl/md4.h> | ||
| 82 | #endif | ||
| 83 | #ifndef OPENSSL_NO_MD5 | ||
| 84 | #include <openssl/md5.h> | ||
| 85 | #endif | ||
| 86 | #ifndef OPENSSL_NO_SHA | ||
| 87 | #include <openssl/sha.h> | ||
| 88 | #endif | ||
| 89 | #ifndef OPENSSL_NO_RIPEMD | ||
| 90 | #include <openssl/ripemd.h> | ||
| 91 | #endif | ||
| 92 | #ifndef OPENSSL_NO_DES | ||
| 93 | #include <openssl/des.h> | ||
| 94 | #endif | ||
| 95 | #ifndef OPENSSL_NO_RC4 | ||
| 96 | #include <openssl/rc4.h> | ||
| 97 | #endif | ||
| 98 | #ifndef OPENSSL_NO_RC2 | ||
| 99 | #include <openssl/rc2.h> | ||
| 100 | #endif | ||
| 101 | #ifndef OPENSSL_NO_RC5 | ||
| 102 | #include <openssl/rc5.h> | ||
| 103 | #endif | ||
| 104 | #ifndef OPENSSL_NO_BF | ||
| 105 | #include <openssl/blowfish.h> | ||
| 106 | #endif | ||
| 107 | #ifndef OPENSSL_NO_CAST | ||
| 108 | #include <openssl/cast.h> | ||
| 109 | #endif | ||
| 110 | #ifndef OPENSSL_NO_IDEA | ||
| 111 | #include <openssl/idea.h> | ||
| 112 | #endif | ||
| 113 | #ifndef OPENSSL_NO_MDC2 | ||
| 114 | #include <openssl/mdc2.h> | ||
| 115 | #endif | ||
| 116 | #ifndef OPENSSL_NO_AES | ||
| 117 | #include <openssl/aes.h> | ||
| 118 | #endif | ||
| 77 | 119 | ||
| 78 | /* | 120 | /* |
| 79 | #define EVP_RC2_KEY_SIZE 16 | 121 | #define EVP_RC2_KEY_SIZE 16 |
| @@ -91,6 +133,18 @@ | |||
| 91 | /* Default PKCS#5 iteration count */ | 133 | /* Default PKCS#5 iteration count */ |
| 92 | #define PKCS5_DEFAULT_ITER 2048 | 134 | #define PKCS5_DEFAULT_ITER 2048 |
| 93 | 135 | ||
| 136 | #ifndef OPENSSL_NO_RSA | ||
| 137 | #include <openssl/rsa.h> | ||
| 138 | #endif | ||
| 139 | |||
| 140 | #ifndef OPENSSL_NO_DSA | ||
| 141 | #include <openssl/dsa.h> | ||
| 142 | #endif | ||
| 143 | |||
| 144 | #ifndef OPENSSL_NO_DH | ||
| 145 | #include <openssl/dh.h> | ||
| 146 | #endif | ||
| 147 | |||
| 94 | #include <openssl/objects.h> | 148 | #include <openssl/objects.h> |
| 95 | 149 | ||
| 96 | #define EVP_PK_RSA 0x0001 | 150 | #define EVP_PK_RSA 0x0001 |
| @@ -582,6 +636,8 @@ const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ | |||
| 582 | const EVP_CIPHER *EVP_des_ecb(void); | 636 | const EVP_CIPHER *EVP_des_ecb(void); |
| 583 | const EVP_CIPHER *EVP_des_ede(void); | 637 | const EVP_CIPHER *EVP_des_ede(void); |
| 584 | const EVP_CIPHER *EVP_des_ede3(void); | 638 | const EVP_CIPHER *EVP_des_ede3(void); |
| 639 | const EVP_CIPHER *EVP_des_ede_ecb(void); | ||
| 640 | const EVP_CIPHER *EVP_des_ede3_ecb(void); | ||
| 585 | const EVP_CIPHER *EVP_des_cfb(void); | 641 | const EVP_CIPHER *EVP_des_cfb(void); |
| 586 | const EVP_CIPHER *EVP_des_ede_cfb(void); | 642 | const EVP_CIPHER *EVP_des_ede_cfb(void); |
| 587 | const EVP_CIPHER *EVP_des_ede3_cfb(void); | 643 | const EVP_CIPHER *EVP_des_ede3_cfb(void); |
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c index 06afb9d152..bcd4d29f85 100644 --- a/src/lib/libcrypto/evp/evp_pbe.c +++ b/src/lib/libcrypto/evp/evp_pbe.c | |||
| @@ -57,9 +57,9 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | ||
| 60 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 61 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 62 | #include "cryptlib.h" | ||
| 63 | 63 | ||
| 64 | /* Password based encryption (PBE) functions */ | 64 | /* Password based encryption (PBE) functions */ |
| 65 | 65 | ||
diff --git a/src/lib/libcrypto/evp/p5_crpt.c b/src/lib/libcrypto/evp/p5_crpt.c index 113c60fedb..27a8286489 100644 --- a/src/lib/libcrypto/evp/p5_crpt.c +++ b/src/lib/libcrypto/evp/p5_crpt.c | |||
| @@ -58,9 +58,9 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include "cryptlib.h" | ||
| 61 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 62 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
| 63 | #include "cryptlib.h" | ||
| 64 | 64 | ||
| 65 | /* PKCS#5 v1.5 compatible PBE functions: see PKCS#5 v2.0 for more info. | 65 | /* PKCS#5 v1.5 compatible PBE functions: see PKCS#5 v2.0 for more info. |
| 66 | */ | 66 | */ |
diff --git a/src/lib/libcrypto/evp/p5_crpt2.c b/src/lib/libcrypto/evp/p5_crpt2.c index 7881860b53..7485d6a278 100644 --- a/src/lib/libcrypto/evp/p5_crpt2.c +++ b/src/lib/libcrypto/evp/p5_crpt2.c | |||
| @@ -58,10 +58,10 @@ | |||
| 58 | #if !defined(OPENSSL_NO_HMAC) && !defined(OPENSSL_NO_SHA) | 58 | #if !defined(OPENSSL_NO_HMAC) && !defined(OPENSSL_NO_SHA) |
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include "cryptlib.h" | ||
| 61 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 62 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
| 63 | #include <openssl/hmac.h> | 64 | #include <openssl/hmac.h> |
| 64 | #include "cryptlib.h" | ||
| 65 | 65 | ||
| 66 | /* set this to print out info about the keygen algorithm */ | 66 | /* set this to print out info about the keygen algorithm */ |
| 67 | /* #define DEBUG_PKCS5V2 */ | 67 | /* #define DEBUG_PKCS5V2 */ |
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index 3ff64bb8d1..02c3719f04 100644 --- a/src/lib/libcrypto/objects/obj_dat.c +++ b/src/lib/libcrypto/objects/obj_dat.c | |||
| @@ -436,7 +436,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
| 436 | unsigned long l; | 436 | unsigned long l; |
| 437 | unsigned char *p; | 437 | unsigned char *p; |
| 438 | const char *s; | 438 | const char *s; |
| 439 | char tbuf[32]; | 439 | char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2]; |
| 440 | 440 | ||
| 441 | if (buf_len <= 0) return(0); | 441 | if (buf_len <= 0) return(0); |
| 442 | 442 | ||
diff --git a/src/lib/libcrypto/objects/obj_mac.num b/src/lib/libcrypto/objects/obj_mac.num index 02b39062fe..1486199661 100644 --- a/src/lib/libcrypto/objects/obj_mac.num +++ b/src/lib/libcrypto/objects/obj_mac.num | |||
| @@ -507,3 +507,141 @@ mime_mhs_bodies 506 | |||
| 507 | id_hex_partial_message 507 | 507 | id_hex_partial_message 507 |
| 508 | id_hex_multipart_message 508 | 508 | id_hex_multipart_message 508 |
| 509 | generationQualifier 509 | 509 | generationQualifier 509 |
| 510 | pseudonym 510 | ||
| 511 | InternationalRA 511 | ||
| 512 | id_set 512 | ||
| 513 | set_ctype 513 | ||
| 514 | set_msgExt 514 | ||
| 515 | set_attr 515 | ||
| 516 | set_policy 516 | ||
| 517 | set_certExt 517 | ||
| 518 | set_brand 518 | ||
| 519 | setct_PANData 519 | ||
| 520 | setct_PANToken 520 | ||
| 521 | setct_PANOnly 521 | ||
| 522 | setct_OIData 522 | ||
| 523 | setct_PI 523 | ||
| 524 | setct_PIData 524 | ||
| 525 | setct_PIDataUnsigned 525 | ||
| 526 | setct_HODInput 526 | ||
| 527 | setct_AuthResBaggage 527 | ||
| 528 | setct_AuthRevReqBaggage 528 | ||
| 529 | setct_AuthRevResBaggage 529 | ||
| 530 | setct_CapTokenSeq 530 | ||
| 531 | setct_PInitResData 531 | ||
| 532 | setct_PI_TBS 532 | ||
| 533 | setct_PResData 533 | ||
| 534 | setct_AuthReqTBS 534 | ||
| 535 | setct_AuthResTBS 535 | ||
| 536 | setct_AuthResTBSX 536 | ||
| 537 | setct_AuthTokenTBS 537 | ||
| 538 | setct_CapTokenData 538 | ||
| 539 | setct_CapTokenTBS 539 | ||
| 540 | setct_AcqCardCodeMsg 540 | ||
| 541 | setct_AuthRevReqTBS 541 | ||
| 542 | setct_AuthRevResData 542 | ||
| 543 | setct_AuthRevResTBS 543 | ||
| 544 | setct_CapReqTBS 544 | ||
| 545 | setct_CapReqTBSX 545 | ||
| 546 | setct_CapResData 546 | ||
| 547 | setct_CapRevReqTBS 547 | ||
| 548 | setct_CapRevReqTBSX 548 | ||
| 549 | setct_CapRevResData 549 | ||
| 550 | setct_CredReqTBS 550 | ||
| 551 | setct_CredReqTBSX 551 | ||
| 552 | setct_CredResData 552 | ||
| 553 | setct_CredRevReqTBS 553 | ||
| 554 | setct_CredRevReqTBSX 554 | ||
| 555 | setct_CredRevResData 555 | ||
| 556 | setct_PCertReqData 556 | ||
| 557 | setct_PCertResTBS 557 | ||
| 558 | setct_BatchAdminReqData 558 | ||
| 559 | setct_BatchAdminResData 559 | ||
| 560 | setct_CardCInitResTBS 560 | ||
| 561 | setct_MeAqCInitResTBS 561 | ||
| 562 | setct_RegFormResTBS 562 | ||
| 563 | setct_CertReqData 563 | ||
| 564 | setct_CertReqTBS 564 | ||
| 565 | setct_CertResData 565 | ||
| 566 | setct_CertInqReqTBS 566 | ||
| 567 | setct_ErrorTBS 567 | ||
| 568 | setct_PIDualSignedTBE 568 | ||
| 569 | setct_PIUnsignedTBE 569 | ||
| 570 | setct_AuthReqTBE 570 | ||
| 571 | setct_AuthResTBE 571 | ||
| 572 | setct_AuthResTBEX 572 | ||
| 573 | setct_AuthTokenTBE 573 | ||
| 574 | setct_CapTokenTBE 574 | ||
| 575 | setct_CapTokenTBEX 575 | ||
| 576 | setct_AcqCardCodeMsgTBE 576 | ||
| 577 | setct_AuthRevReqTBE 577 | ||
| 578 | setct_AuthRevResTBE 578 | ||
| 579 | setct_AuthRevResTBEB 579 | ||
| 580 | setct_CapReqTBE 580 | ||
| 581 | setct_CapReqTBEX 581 | ||
| 582 | setct_CapResTBE 582 | ||
| 583 | setct_CapRevReqTBE 583 | ||
| 584 | setct_CapRevReqTBEX 584 | ||
| 585 | setct_CapRevResTBE 585 | ||
| 586 | setct_CredReqTBE 586 | ||
| 587 | setct_CredReqTBEX 587 | ||
| 588 | setct_CredResTBE 588 | ||
| 589 | setct_CredRevReqTBE 589 | ||
| 590 | setct_CredRevReqTBEX 590 | ||
| 591 | setct_CredRevResTBE 591 | ||
| 592 | setct_BatchAdminReqTBE 592 | ||
| 593 | setct_BatchAdminResTBE 593 | ||
| 594 | setct_RegFormReqTBE 594 | ||
| 595 | setct_CertReqTBE 595 | ||
| 596 | setct_CertReqTBEX 596 | ||
| 597 | setct_CertResTBE 597 | ||
| 598 | setct_CRLNotificationTBS 598 | ||
| 599 | setct_CRLNotificationResTBS 599 | ||
| 600 | setct_BCIDistributionTBS 600 | ||
| 601 | setext_genCrypt 601 | ||
| 602 | setext_miAuth 602 | ||
| 603 | setext_pinSecure 603 | ||
| 604 | setext_pinAny 604 | ||
| 605 | setext_track2 605 | ||
| 606 | setext_cv 606 | ||
| 607 | set_policy_root 607 | ||
| 608 | setCext_hashedRoot 608 | ||
| 609 | setCext_certType 609 | ||
| 610 | setCext_merchData 610 | ||
| 611 | setCext_cCertRequired 611 | ||
| 612 | setCext_tunneling 612 | ||
| 613 | setCext_setExt 613 | ||
| 614 | setCext_setQualf 614 | ||
| 615 | setCext_PGWYcapabilities 615 | ||
| 616 | setCext_TokenIdentifier 616 | ||
| 617 | setCext_Track2Data 617 | ||
| 618 | setCext_TokenType 618 | ||
| 619 | setCext_IssuerCapabilities 619 | ||
| 620 | setAttr_Cert 620 | ||
| 621 | setAttr_PGWYcap 621 | ||
| 622 | setAttr_TokenType 622 | ||
| 623 | setAttr_IssCap 623 | ||
| 624 | set_rootKeyThumb 624 | ||
| 625 | set_addPolicy 625 | ||
| 626 | setAttr_Token_EMV 626 | ||
| 627 | setAttr_Token_B0Prime 627 | ||
| 628 | setAttr_IssCap_CVM 628 | ||
| 629 | setAttr_IssCap_T2 629 | ||
| 630 | setAttr_IssCap_Sig 630 | ||
| 631 | setAttr_GenCryptgrm 631 | ||
| 632 | setAttr_T2Enc 632 | ||
| 633 | setAttr_T2cleartxt 633 | ||
| 634 | setAttr_TokICCsig 634 | ||
| 635 | setAttr_SecDevSig 635 | ||
| 636 | set_brand_IATA_ATA 636 | ||
| 637 | set_brand_Diners 637 | ||
| 638 | set_brand_AmericanExpress 638 | ||
| 639 | set_brand_JCB 639 | ||
| 640 | set_brand_Visa 640 | ||
| 641 | set_brand_MasterCard 641 | ||
| 642 | set_brand_Novus 642 | ||
| 643 | des_cdmf 643 | ||
| 644 | rsaOAEPEncryptionSET 644 | ||
| 645 | itu_t 645 | ||
| 646 | joint_iso_itu_t 646 | ||
| 647 | international_organizations 647 | ||
diff --git a/src/lib/libcrypto/objects/objects.txt b/src/lib/libcrypto/objects/objects.txt index 65d0b15629..71a4908485 100644 --- a/src/lib/libcrypto/objects/objects.txt +++ b/src/lib/libcrypto/objects/objects.txt | |||
| @@ -542,6 +542,7 @@ X509 43 : : initials | |||
| 542 | X509 44 : : generationQualifier | 542 | X509 44 : : generationQualifier |
| 543 | X509 45 : : x500UniqueIdentifier | 543 | X509 45 : : x500UniqueIdentifier |
| 544 | X509 46 : dnQualifier : dnQualifier | 544 | X509 46 : dnQualifier : dnQualifier |
| 545 | X509 65 : : pseudonym | ||
| 545 | X509 72 : role : role | 546 | X509 72 : role : role |
| 546 | 547 | ||
| 547 | X500 8 : X500algorithms : directory services - algorithms | 548 | X500 8 : X500algorithms : directory services - algorithms |
| @@ -762,3 +763,150 @@ pilotAttributeType 53 : : personalSignature | |||
| 762 | pilotAttributeType 54 : : dITRedirect | 763 | pilotAttributeType 54 : : dITRedirect |
| 763 | pilotAttributeType 55 : audio | 764 | pilotAttributeType 55 : audio |
| 764 | pilotAttributeType 56 : : documentPublisher | 765 | pilotAttributeType 56 : : documentPublisher |
| 766 | |||
| 767 | 2 23 42 : id-set : Secure Electronic Transactions | ||
| 768 | |||
| 769 | id-set 0 : set-ctype : content types | ||
| 770 | id-set 1 : set-msgExt : message extensions | ||
| 771 | id-set 3 : set-attr | ||
| 772 | id-set 5 : set-policy | ||
| 773 | id-set 7 : set-certExt : certificate extensions | ||
| 774 | id-set 8 : set-brand | ||
| 775 | |||
| 776 | set-ctype 0 : setct-PANData | ||
| 777 | set-ctype 1 : setct-PANToken | ||
| 778 | set-ctype 2 : setct-PANOnly | ||
| 779 | set-ctype 3 : setct-OIData | ||
| 780 | set-ctype 4 : setct-PI | ||
| 781 | set-ctype 5 : setct-PIData | ||
| 782 | set-ctype 6 : setct-PIDataUnsigned | ||
| 783 | set-ctype 7 : setct-HODInput | ||
| 784 | set-ctype 8 : setct-AuthResBaggage | ||
| 785 | set-ctype 9 : setct-AuthRevReqBaggage | ||
| 786 | set-ctype 10 : setct-AuthRevResBaggage | ||
| 787 | set-ctype 11 : setct-CapTokenSeq | ||
| 788 | set-ctype 12 : setct-PInitResData | ||
| 789 | set-ctype 13 : setct-PI-TBS | ||
| 790 | set-ctype 14 : setct-PResData | ||
| 791 | set-ctype 16 : setct-AuthReqTBS | ||
| 792 | set-ctype 17 : setct-AuthResTBS | ||
| 793 | set-ctype 18 : setct-AuthResTBSX | ||
| 794 | set-ctype 19 : setct-AuthTokenTBS | ||
| 795 | set-ctype 20 : setct-CapTokenData | ||
| 796 | set-ctype 21 : setct-CapTokenTBS | ||
| 797 | set-ctype 22 : setct-AcqCardCodeMsg | ||
| 798 | set-ctype 23 : setct-AuthRevReqTBS | ||
| 799 | set-ctype 24 : setct-AuthRevResData | ||
| 800 | set-ctype 25 : setct-AuthRevResTBS | ||
| 801 | set-ctype 26 : setct-CapReqTBS | ||
| 802 | set-ctype 27 : setct-CapReqTBSX | ||
| 803 | set-ctype 28 : setct-CapResData | ||
| 804 | set-ctype 29 : setct-CapRevReqTBS | ||
| 805 | set-ctype 30 : setct-CapRevReqTBSX | ||
| 806 | set-ctype 31 : setct-CapRevResData | ||
| 807 | set-ctype 32 : setct-CredReqTBS | ||
| 808 | set-ctype 33 : setct-CredReqTBSX | ||
| 809 | set-ctype 34 : setct-CredResData | ||
| 810 | set-ctype 35 : setct-CredRevReqTBS | ||
| 811 | set-ctype 36 : setct-CredRevReqTBSX | ||
| 812 | set-ctype 37 : setct-CredRevResData | ||
| 813 | set-ctype 38 : setct-PCertReqData | ||
| 814 | set-ctype 39 : setct-PCertResTBS | ||
| 815 | set-ctype 40 : setct-BatchAdminReqData | ||
| 816 | set-ctype 41 : setct-BatchAdminResData | ||
| 817 | set-ctype 42 : setct-CardCInitResTBS | ||
| 818 | set-ctype 43 : setct-MeAqCInitResTBS | ||
| 819 | set-ctype 44 : setct-RegFormResTBS | ||
| 820 | set-ctype 45 : setct-CertReqData | ||
| 821 | set-ctype 46 : setct-CertReqTBS | ||
| 822 | set-ctype 47 : setct-CertResData | ||
| 823 | set-ctype 48 : setct-CertInqReqTBS | ||
| 824 | set-ctype 49 : setct-ErrorTBS | ||
| 825 | set-ctype 50 : setct-PIDualSignedTBE | ||
| 826 | set-ctype 51 : setct-PIUnsignedTBE | ||
| 827 | set-ctype 52 : setct-AuthReqTBE | ||
| 828 | set-ctype 53 : setct-AuthResTBE | ||
| 829 | set-ctype 54 : setct-AuthResTBEX | ||
| 830 | set-ctype 55 : setct-AuthTokenTBE | ||
| 831 | set-ctype 56 : setct-CapTokenTBE | ||
| 832 | set-ctype 57 : setct-CapTokenTBEX | ||
| 833 | set-ctype 58 : setct-AcqCardCodeMsgTBE | ||
| 834 | set-ctype 59 : setct-AuthRevReqTBE | ||
| 835 | set-ctype 60 : setct-AuthRevResTBE | ||
| 836 | set-ctype 61 : setct-AuthRevResTBEB | ||
| 837 | set-ctype 62 : setct-CapReqTBE | ||
| 838 | set-ctype 63 : setct-CapReqTBEX | ||
| 839 | set-ctype 64 : setct-CapResTBE | ||
| 840 | set-ctype 65 : setct-CapRevReqTBE | ||
| 841 | set-ctype 66 : setct-CapRevReqTBEX | ||
| 842 | set-ctype 67 : setct-CapRevResTBE | ||
| 843 | set-ctype 68 : setct-CredReqTBE | ||
| 844 | set-ctype 69 : setct-CredReqTBEX | ||
| 845 | set-ctype 70 : setct-CredResTBE | ||
| 846 | set-ctype 71 : setct-CredRevReqTBE | ||
| 847 | set-ctype 72 : setct-CredRevReqTBEX | ||
| 848 | set-ctype 73 : setct-CredRevResTBE | ||
| 849 | set-ctype 74 : setct-BatchAdminReqTBE | ||
| 850 | set-ctype 75 : setct-BatchAdminResTBE | ||
| 851 | set-ctype 76 : setct-RegFormReqTBE | ||
| 852 | set-ctype 77 : setct-CertReqTBE | ||
| 853 | set-ctype 78 : setct-CertReqTBEX | ||
| 854 | set-ctype 79 : setct-CertResTBE | ||
| 855 | set-ctype 80 : setct-CRLNotificationTBS | ||
| 856 | set-ctype 81 : setct-CRLNotificationResTBS | ||
| 857 | set-ctype 82 : setct-BCIDistributionTBS | ||
| 858 | |||
| 859 | set-msgExt 1 : setext-genCrypt : generic cryptogram | ||
| 860 | set-msgExt 3 : setext-miAuth : merchant initiated auth | ||
| 861 | set-msgExt 4 : setext-pinSecure | ||
| 862 | set-msgExt 5 : setext-pinAny | ||
| 863 | set-msgExt 7 : setext-track2 | ||
| 864 | set-msgExt 8 : setext-cv : additional verification | ||
| 865 | |||
| 866 | set-policy 0 : set-policy-root | ||
| 867 | |||
| 868 | set-certExt 0 : setCext-hashedRoot | ||
| 869 | set-certExt 1 : setCext-certType | ||
| 870 | set-certExt 2 : setCext-merchData | ||
| 871 | set-certExt 3 : setCext-cCertRequired | ||
| 872 | set-certExt 4 : setCext-tunneling | ||
| 873 | set-certExt 5 : setCext-setExt | ||
| 874 | set-certExt 6 : setCext-setQualf | ||
| 875 | set-certExt 7 : setCext-PGWYcapabilities | ||
| 876 | set-certExt 8 : setCext-TokenIdentifier | ||
| 877 | set-certExt 9 : setCext-Track2Data | ||
| 878 | set-certExt 10 : setCext-TokenType | ||
| 879 | set-certExt 11 : setCext-IssuerCapabilities | ||
| 880 | |||
| 881 | set-attr 0 : setAttr-Cert | ||
| 882 | set-attr 1 : setAttr-PGWYcap : payment gateway capabilities | ||
| 883 | set-attr 2 : setAttr-TokenType | ||
| 884 | set-attr 3 : setAttr-IssCap : issuer capabilities | ||
| 885 | |||
| 886 | setAttr-Cert 0 : set-rootKeyThumb | ||
| 887 | setAttr-Cert 1 : set-addPolicy | ||
| 888 | |||
| 889 | setAttr-TokenType 1 : setAttr-Token-EMV | ||
| 890 | setAttr-TokenType 2 : setAttr-Token-B0Prime | ||
| 891 | |||
| 892 | setAttr-IssCap 3 : setAttr-IssCap-CVM | ||
| 893 | setAttr-IssCap 4 : setAttr-IssCap-T2 | ||
| 894 | setAttr-IssCap 5 : setAttr-IssCap-Sig | ||
| 895 | |||
| 896 | setAttr-IssCap-CVM 1 : setAttr-GenCryptgrm : generate cryptogram | ||
| 897 | setAttr-IssCap-T2 1 : setAttr-T2Enc : encrypted track 2 | ||
| 898 | setAttr-IssCap-T2 2 : setAttr-T2cleartxt : cleartext track 2 | ||
| 899 | |||
| 900 | setAttr-IssCap-Sig 1 : setAttr-TokICCsig : ICC or token signature | ||
| 901 | setAttr-IssCap-Sig 2 : setAttr-SecDevSig : secure device signature | ||
| 902 | |||
| 903 | set-brand 1 : set-brand-IATA-ATA | ||
| 904 | set-brand 30 : set-brand-Diners | ||
| 905 | set-brand 34 : set-brand-AmericanExpress | ||
| 906 | set-brand 35 : set-brand-JCB | ||
| 907 | set-brand 4 : set-brand-Visa | ||
| 908 | set-brand 5 : set-brand-MasterCard | ||
| 909 | set-brand 6011 : set-brand-Novus | ||
| 910 | |||
| 911 | rsadsi 3 10 : DES-CDMF : des-cdmf | ||
| 912 | rsadsi 1 1 6 : rsaOAEPEncryptionSET | ||
diff --git a/src/lib/libcrypto/opensslv.h b/src/lib/libcrypto/opensslv.h index 0d23a02fb2..9689b49c5b 100644 --- a/src/lib/libcrypto/opensslv.h +++ b/src/lib/libcrypto/opensslv.h | |||
| @@ -25,8 +25,8 @@ | |||
| 25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for | 25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for |
| 26 | * major minor fix final patch/beta) | 26 | * major minor fix final patch/beta) |
| 27 | */ | 27 | */ |
| 28 | #define OPENSSL_VERSION_NUMBER 0x00907001L | 28 | #define OPENSSL_VERSION_NUMBER 0x00907003L |
| 29 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7-beta1 01 Jun 2002" | 29 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7-beta3 30 Jul 2002" |
| 30 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT | 30 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT |
| 31 | 31 | ||
| 32 | 32 | ||
diff --git a/src/lib/libcrypto/pem/pem2.h b/src/lib/libcrypto/pem/pem2.h index 4e484bcd82..f31790d69c 100644 --- a/src/lib/libcrypto/pem/pem2.h +++ b/src/lib/libcrypto/pem/pem2.h | |||
| @@ -61,7 +61,9 @@ | |||
| 61 | extern "C" { | 61 | extern "C" { |
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | #ifndef HEADER_PEM_H | ||
| 64 | void ERR_load_PEM_strings(void); | 65 | void ERR_load_PEM_strings(void); |
| 66 | #endif | ||
| 65 | 67 | ||
| 66 | #ifdef __cplusplus | 68 | #ifdef __cplusplus |
| 67 | } | 69 | } |
diff --git a/src/lib/libcrypto/pem/pem_pkey.c b/src/lib/libcrypto/pem/pem_pkey.c index 270892d72b..d96ecf6940 100644 --- a/src/lib/libcrypto/pem/pem_pkey.c +++ b/src/lib/libcrypto/pem/pem_pkey.c | |||
| @@ -85,6 +85,7 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, vo | |||
| 85 | else if (strcmp(nm,PEM_STRING_PKCS8INF) == 0) { | 85 | else if (strcmp(nm,PEM_STRING_PKCS8INF) == 0) { |
| 86 | PKCS8_PRIV_KEY_INFO *p8inf; | 86 | PKCS8_PRIV_KEY_INFO *p8inf; |
| 87 | p8inf=d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len); | 87 | p8inf=d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len); |
| 88 | if(!p8inf) goto p8err; | ||
| 88 | ret = EVP_PKCS82PKEY(p8inf); | 89 | ret = EVP_PKCS82PKEY(p8inf); |
| 89 | PKCS8_PRIV_KEY_INFO_free(p8inf); | 90 | PKCS8_PRIV_KEY_INFO_free(p8inf); |
| 90 | } else if (strcmp(nm,PEM_STRING_PKCS8) == 0) { | 91 | } else if (strcmp(nm,PEM_STRING_PKCS8) == 0) { |
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl index 81c6e64e87..9a3d85b098 100644 --- a/src/lib/libcrypto/perlasm/x86asm.pl +++ b/src/lib/libcrypto/perlasm/x86asm.pl | |||
| @@ -87,6 +87,12 @@ $tmp | |||
| 87 | #ifdef OUT | 87 | #ifdef OUT |
| 88 | #define OK 1 | 88 | #define OK 1 |
| 89 | #define ALIGN 4 | 89 | #define ALIGN 4 |
| 90 | #if defined(__CYGWIN__) || defined(__DJGPP__) | ||
| 91 | #undef SIZE | ||
| 92 | #undef TYPE | ||
| 93 | #define SIZE(a,b) | ||
| 94 | #define TYPE(a,b) | ||
| 95 | #endif /* __CYGWIN || __DJGPP */ | ||
| 90 | #endif | 96 | #endif |
| 91 | 97 | ||
| 92 | #if defined(BSDI) && !defined(ELF) | 98 | #if defined(BSDI) && !defined(ELF) |
diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h index 1786b6d4f3..dd338f266c 100644 --- a/src/lib/libcrypto/pkcs12/pkcs12.h +++ b/src/lib/libcrypto/pkcs12/pkcs12.h | |||
| @@ -156,8 +156,8 @@ union { | |||
| 156 | #define M_PKCS12_decrypt_skey PKCS12_decrypt_skey | 156 | #define M_PKCS12_decrypt_skey PKCS12_decrypt_skey |
| 157 | #define M_PKCS8_decrypt PKCS8_decrypt | 157 | #define M_PKCS8_decrypt PKCS8_decrypt |
| 158 | 158 | ||
| 159 | #define M_PKCS12_bag_type(bag) OBJ_obj2nid(bag->type) | 159 | #define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type) |
| 160 | #define M_PKCS12_cert_bag_type(bag) OBJ_obj2nid(bag->value.bag->type) | 160 | #define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type) |
| 161 | #define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type | 161 | #define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type |
| 162 | 162 | ||
| 163 | #define PKCS12_get_attr(bag, attr_nid) \ | 163 | #define PKCS12_get_attr(bag, attr_nid) \ |
diff --git a/src/lib/libcrypto/rand/rand.h b/src/lib/libcrypto/rand/rand.h index e17aa7a9f7..66e39991ec 100644 --- a/src/lib/libcrypto/rand/rand.h +++ b/src/lib/libcrypto/rand/rand.h | |||
| @@ -61,6 +61,11 @@ | |||
| 61 | 61 | ||
| 62 | #include <stdlib.h> | 62 | #include <stdlib.h> |
| 63 | #include <openssl/ossl_typ.h> | 63 | #include <openssl/ossl_typ.h> |
| 64 | #include <openssl/e_os2.h> | ||
| 65 | |||
| 66 | #if defined(OPENSSL_SYS_WINDOWS) | ||
| 67 | #include <windows.h> | ||
| 68 | #endif | ||
| 64 | 69 | ||
| 65 | #ifdef __cplusplus | 70 | #ifdef __cplusplus |
| 66 | extern "C" { | 71 | extern "C" { |
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h index 030a6c88e5..98b3bd7cc5 100644 --- a/src/lib/libcrypto/rsa/rsa.h +++ b/src/lib/libcrypto/rsa/rsa.h | |||
| @@ -276,6 +276,9 @@ int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | |||
| 276 | int RSA_set_ex_data(RSA *r,int idx,void *arg); | 276 | int RSA_set_ex_data(RSA *r,int idx,void *arg); |
| 277 | void *RSA_get_ex_data(const RSA *r, int idx); | 277 | void *RSA_get_ex_data(const RSA *r, int idx); |
| 278 | 278 | ||
| 279 | RSA *RSAPublicKey_dup(RSA *rsa); | ||
| 280 | RSA *RSAPrivateKey_dup(RSA *rsa); | ||
| 281 | |||
| 279 | /* BEGIN ERROR CODES */ | 282 | /* BEGIN ERROR CODES */ |
| 280 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 283 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 281 | * made after this point may be overwritten when the script is next run. | 284 | * made after this point may be overwritten when the script is next run. |
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c index 4e12165410..2c2fbc0443 100644 --- a/src/lib/libcrypto/ui/ui_openssl.c +++ b/src/lib/libcrypto/ui/ui_openssl.c | |||
| @@ -269,7 +269,7 @@ static long tty_orig[3], tty_new[3]; /* XXX Is there any guarantee that this w | |||
| 269 | static long status; | 269 | static long status; |
| 270 | static unsigned short channel = 0; | 270 | static unsigned short channel = 0; |
| 271 | #else | 271 | #else |
| 272 | #ifndef OPENSSL_SYS_MSDOS | 272 | #if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__) |
| 273 | static TTY_STRUCT tty_orig,tty_new; | 273 | static TTY_STRUCT tty_orig,tty_new; |
| 274 | #endif | 274 | #endif |
| 275 | #endif | 275 | #endif |
diff --git a/src/lib/libcrypto/ui/ui_util.c b/src/lib/libcrypto/ui/ui_util.c index 7c6f7d3a73..f05573df33 100644 --- a/src/lib/libcrypto/ui/ui_util.c +++ b/src/lib/libcrypto/ui/ui_util.c | |||
| @@ -71,12 +71,15 @@ int UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify) | |||
| 71 | int ok = 0; | 71 | int ok = 0; |
| 72 | UI *ui; | 72 | UI *ui; |
| 73 | 73 | ||
| 74 | if (size < 1) | ||
| 75 | return -1; | ||
| 76 | |||
| 74 | ui = UI_new(); | 77 | ui = UI_new(); |
| 75 | if (ui) | 78 | if (ui) |
| 76 | { | 79 | { |
| 77 | ok = UI_add_input_string(ui,prompt,0,buf,0,BUFSIZ-1); | 80 | ok = UI_add_input_string(ui,prompt,0,buf,0,size-1); |
| 78 | if (ok == 0 && verify) | 81 | if (ok == 0 && verify) |
| 79 | ok = UI_add_verify_string(ui,prompt,0,buff,0,BUFSIZ-1, | 82 | ok = UI_add_verify_string(ui,prompt,0,buff,0,size-1, |
| 80 | buf); | 83 | buf); |
| 81 | if (ok == 0) | 84 | if (ok == 0) |
| 82 | ok=UI_process(ui); | 85 | ok=UI_process(ui); |
diff --git a/src/lib/libcrypto/x509v3/ext_dat.h b/src/lib/libcrypto/x509v3/ext_dat.h index 586f116db5..2fb97d8925 100644 --- a/src/lib/libcrypto/x509v3/ext_dat.h +++ b/src/lib/libcrypto/x509v3/ext_dat.h | |||
| @@ -99,8 +99,8 @@ static X509V3_EXT_METHOD *standard_exts[] = { | |||
| 99 | &v3_ocsp_nocheck, | 99 | &v3_ocsp_nocheck, |
| 100 | &v3_ocsp_acutoff, | 100 | &v3_ocsp_acutoff, |
| 101 | &v3_ocsp_serviceloc, | 101 | &v3_ocsp_serviceloc, |
| 102 | &v3_crl_hold, | 102 | &v3_sinfo, |
| 103 | &v3_sinfo | 103 | &v3_crl_hold |
| 104 | }; | 104 | }; |
| 105 | 105 | ||
| 106 | /* Number of standard extensions */ | 106 | /* Number of standard extensions */ |
diff --git a/src/lib/libcrypto/x509v3/v3_info.c b/src/lib/libcrypto/x509v3/v3_info.c index 7f17f3231d..e1cf01a9b4 100644 --- a/src/lib/libcrypto/x509v3/v3_info.c +++ b/src/lib/libcrypto/x509v3/v3_info.c | |||
| @@ -158,6 +158,7 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *metho | |||
| 158 | objlen = ptmp - cnf->name; | 158 | objlen = ptmp - cnf->name; |
| 159 | ctmp.name = ptmp + 1; | 159 | ctmp.name = ptmp + 1; |
| 160 | ctmp.value = cnf->value; | 160 | ctmp.value = cnf->value; |
| 161 | GENERAL_NAME_free(acc->location); | ||
| 161 | if(!(acc->location = v2i_GENERAL_NAME(method, ctx, &ctmp))) | 162 | if(!(acc->location = v2i_GENERAL_NAME(method, ctx, &ctmp))) |
| 162 | goto err; | 163 | goto err; |
| 163 | if(!(objtmp = OPENSSL_malloc(objlen + 1))) { | 164 | if(!(objtmp = OPENSSL_malloc(objlen + 1))) { |
diff --git a/src/lib/libssl/s23_clnt.c b/src/lib/libssl/s23_clnt.c index b2be8340fb..019e9aecee 100644 --- a/src/lib/libssl/s23_clnt.c +++ b/src/lib/libssl/s23_clnt.c | |||
| @@ -57,11 +57,11 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "ssl_locl.h" | ||
| 60 | #include <openssl/buffer.h> | 61 | #include <openssl/buffer.h> |
| 61 | #include <openssl/rand.h> | 62 | #include <openssl/rand.h> |
| 62 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 63 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 64 | #include "ssl_locl.h" | ||
| 65 | 65 | ||
| 66 | static SSL_METHOD *ssl23_get_client_method(int ver); | 66 | static SSL_METHOD *ssl23_get_client_method(int ver); |
| 67 | static int ssl23_client_hello(SSL *s); | 67 | static int ssl23_client_hello(SSL *s); |
diff --git a/src/lib/libssl/s23_pkt.c b/src/lib/libssl/s23_pkt.c index f45e1ce3d8..4ca6a1b258 100644 --- a/src/lib/libssl/s23_pkt.c +++ b/src/lib/libssl/s23_pkt.c | |||
| @@ -59,9 +59,9 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <errno.h> | 60 | #include <errno.h> |
| 61 | #define USE_SOCKETS | 61 | #define USE_SOCKETS |
| 62 | #include "ssl_locl.h" | ||
| 62 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
| 63 | #include <openssl/buffer.h> | 64 | #include <openssl/buffer.h> |
| 64 | #include "ssl_locl.h" | ||
| 65 | 65 | ||
| 66 | int ssl23_write_bytes(SSL *s) | 66 | int ssl23_write_bytes(SSL *s) |
| 67 | { | 67 | { |
diff --git a/src/lib/libssl/s23_srvr.c b/src/lib/libssl/s23_srvr.c index 9e89cc7f9a..8743b61cbb 100644 --- a/src/lib/libssl/s23_srvr.c +++ b/src/lib/libssl/s23_srvr.c | |||
| @@ -110,11 +110,11 @@ | |||
| 110 | */ | 110 | */ |
| 111 | 111 | ||
| 112 | #include <stdio.h> | 112 | #include <stdio.h> |
| 113 | #include "ssl_locl.h" | ||
| 113 | #include <openssl/buffer.h> | 114 | #include <openssl/buffer.h> |
| 114 | #include <openssl/rand.h> | 115 | #include <openssl/rand.h> |
| 115 | #include <openssl/objects.h> | 116 | #include <openssl/objects.h> |
| 116 | #include <openssl/evp.h> | 117 | #include <openssl/evp.h> |
| 117 | #include "ssl_locl.h" | ||
| 118 | 118 | ||
| 119 | static SSL_METHOD *ssl23_get_server_method(int ver); | 119 | static SSL_METHOD *ssl23_get_server_method(int ver); |
| 120 | int ssl23_get_client_hello(SSL *s); | 120 | int ssl23_get_client_hello(SSL *s); |
diff --git a/src/lib/libssl/s3_both.c b/src/lib/libssl/s3_both.c index 58a24cd883..8864366f59 100644 --- a/src/lib/libssl/s3_both.c +++ b/src/lib/libssl/s3_both.c | |||
| @@ -112,12 +112,12 @@ | |||
| 112 | #include <limits.h> | 112 | #include <limits.h> |
| 113 | #include <string.h> | 113 | #include <string.h> |
| 114 | #include <stdio.h> | 114 | #include <stdio.h> |
| 115 | #include "ssl_locl.h" | ||
| 115 | #include <openssl/buffer.h> | 116 | #include <openssl/buffer.h> |
| 116 | #include <openssl/rand.h> | 117 | #include <openssl/rand.h> |
| 117 | #include <openssl/objects.h> | 118 | #include <openssl/objects.h> |
| 118 | #include <openssl/evp.h> | 119 | #include <openssl/evp.h> |
| 119 | #include <openssl/x509.h> | 120 | #include <openssl/x509.h> |
| 120 | #include "ssl_locl.h" | ||
| 121 | 121 | ||
| 122 | /* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC) */ | 122 | /* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC) */ |
| 123 | int ssl3_do_write(SSL *s, int type) | 123 | int ssl3_do_write(SSL *s, int type) |
diff --git a/src/lib/libssl/s3_clnt.c b/src/lib/libssl/s3_clnt.c index e5853ede95..2699b5863b 100644 --- a/src/lib/libssl/s3_clnt.c +++ b/src/lib/libssl/s3_clnt.c | |||
| @@ -110,13 +110,14 @@ | |||
| 110 | */ | 110 | */ |
| 111 | 111 | ||
| 112 | #include <stdio.h> | 112 | #include <stdio.h> |
| 113 | #include "ssl_locl.h" | ||
| 114 | #include "kssl_lcl.h" | ||
| 113 | #include <openssl/buffer.h> | 115 | #include <openssl/buffer.h> |
| 114 | #include <openssl/rand.h> | 116 | #include <openssl/rand.h> |
| 115 | #include <openssl/objects.h> | 117 | #include <openssl/objects.h> |
| 116 | #include <openssl/evp.h> | 118 | #include <openssl/evp.h> |
| 117 | #include "ssl_locl.h" | ||
| 118 | #include "kssl_lcl.h" | ||
| 119 | #include <openssl/md5.h> | 119 | #include <openssl/md5.h> |
| 120 | #include "cryptlib.h" | ||
| 120 | 121 | ||
| 121 | static SSL_METHOD *ssl3_get_client_method(int ver); | 122 | static SSL_METHOD *ssl3_get_client_method(int ver); |
| 122 | static int ssl3_client_hello(SSL *s); | 123 | static int ssl3_client_hello(SSL *s); |
| @@ -545,6 +546,7 @@ static int ssl3_client_hello(SSL *s) | |||
| 545 | *(p++)=i; | 546 | *(p++)=i; |
| 546 | if (i != 0) | 547 | if (i != 0) |
| 547 | { | 548 | { |
| 549 | die(i <= sizeof s->session->session_id); | ||
| 548 | memcpy(p,s->session->session_id,i); | 550 | memcpy(p,s->session->session_id,i); |
| 549 | p+=i; | 551 | p+=i; |
| 550 | } | 552 | } |
| @@ -626,6 +628,14 @@ static int ssl3_get_server_hello(SSL *s) | |||
| 626 | /* get the session-id */ | 628 | /* get the session-id */ |
| 627 | j= *(p++); | 629 | j= *(p++); |
| 628 | 630 | ||
| 631 | if(j > sizeof s->session->session_id) | ||
| 632 | { | ||
| 633 | al=SSL_AD_ILLEGAL_PARAMETER; | ||
| 634 | SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, | ||
| 635 | SSL_R_SSL3_SESSION_ID_TOO_LONG); | ||
| 636 | goto f_err; | ||
| 637 | } | ||
| 638 | |||
| 629 | if ((j != 0) && (j != SSL3_SESSION_ID_SIZE)) | 639 | if ((j != 0) && (j != SSL3_SESSION_ID_SIZE)) |
| 630 | { | 640 | { |
| 631 | /* SSLref returns 16 :-( */ | 641 | /* SSLref returns 16 :-( */ |
| @@ -1588,6 +1598,7 @@ static int ssl3_send_client_key_exchange(SSL *s) | |||
| 1588 | SSL_MAX_MASTER_KEY_LENGTH); | 1598 | SSL_MAX_MASTER_KEY_LENGTH); |
| 1589 | EVP_EncryptFinal_ex(&ciph_ctx,&(epms[outl]),&padl); | 1599 | EVP_EncryptFinal_ex(&ciph_ctx,&(epms[outl]),&padl); |
| 1590 | outl += padl; | 1600 | outl += padl; |
| 1601 | die(outl <= sizeof epms); | ||
| 1591 | EVP_CIPHER_CTX_cleanup(&ciph_ctx); | 1602 | EVP_CIPHER_CTX_cleanup(&ciph_ctx); |
| 1592 | 1603 | ||
| 1593 | /* KerberosWrapper.EncryptedPreMasterSecret */ | 1604 | /* KerberosWrapper.EncryptedPreMasterSecret */ |
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c index 686992406c..14b2f13ae2 100644 --- a/src/lib/libssl/s3_lib.c +++ b/src/lib/libssl/s3_lib.c | |||
| @@ -129,7 +129,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 129 | SSL3_TXT_RSA_NULL_MD5, | 129 | SSL3_TXT_RSA_NULL_MD5, |
| 130 | SSL3_CK_RSA_NULL_MD5, | 130 | SSL3_CK_RSA_NULL_MD5, |
| 131 | SSL_kRSA|SSL_aRSA|SSL_eNULL |SSL_MD5|SSL_SSLV3, | 131 | SSL_kRSA|SSL_aRSA|SSL_eNULL |SSL_MD5|SSL_SSLV3, |
| 132 | SSL_NOT_EXP, | 132 | SSL_NOT_EXP|SSL_STRONG_NONE, |
| 133 | 0, | 133 | 0, |
| 134 | 0, | 134 | 0, |
| 135 | 0, | 135 | 0, |
| @@ -142,7 +142,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 142 | SSL3_TXT_RSA_NULL_SHA, | 142 | SSL3_TXT_RSA_NULL_SHA, |
| 143 | SSL3_CK_RSA_NULL_SHA, | 143 | SSL3_CK_RSA_NULL_SHA, |
| 144 | SSL_kRSA|SSL_aRSA|SSL_eNULL |SSL_SHA1|SSL_SSLV3, | 144 | SSL_kRSA|SSL_aRSA|SSL_eNULL |SSL_SHA1|SSL_SSLV3, |
| 145 | SSL_NOT_EXP, | 145 | SSL_NOT_EXP|SSL_STRONG_NONE, |
| 146 | 0, | 146 | 0, |
| 147 | 0, | 147 | 0, |
| 148 | 0, | 148 | 0, |
| @@ -490,7 +490,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 490 | SSL3_TXT_FZA_DMS_NULL_SHA, | 490 | SSL3_TXT_FZA_DMS_NULL_SHA, |
| 491 | SSL3_CK_FZA_DMS_NULL_SHA, | 491 | SSL3_CK_FZA_DMS_NULL_SHA, |
| 492 | SSL_kFZA|SSL_aFZA |SSL_eNULL |SSL_SHA1|SSL_SSLV3, | 492 | SSL_kFZA|SSL_aFZA |SSL_eNULL |SSL_SHA1|SSL_SSLV3, |
| 493 | SSL_NOT_EXP, | 493 | SSL_NOT_EXP|SSL_STRONG_NONE, |
| 494 | 0, | 494 | 0, |
| 495 | 0, | 495 | 0, |
| 496 | 0, | 496 | 0, |
| @@ -504,7 +504,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 504 | SSL3_TXT_FZA_DMS_FZA_SHA, | 504 | SSL3_TXT_FZA_DMS_FZA_SHA, |
| 505 | SSL3_CK_FZA_DMS_FZA_SHA, | 505 | SSL3_CK_FZA_DMS_FZA_SHA, |
| 506 | SSL_kFZA|SSL_aFZA |SSL_eFZA |SSL_SHA1|SSL_SSLV3, | 506 | SSL_kFZA|SSL_aFZA |SSL_eFZA |SSL_SHA1|SSL_SSLV3, |
| 507 | SSL_NOT_EXP, | 507 | SSL_NOT_EXP|SSL_STRONG_NONE, |
| 508 | 0, | 508 | 0, |
| 509 | 0, | 509 | 0, |
| 510 | 0, | 510 | 0, |
diff --git a/src/lib/libssl/s3_pkt.c b/src/lib/libssl/s3_pkt.c index 43e8502b66..6ccea9aee5 100644 --- a/src/lib/libssl/s3_pkt.c +++ b/src/lib/libssl/s3_pkt.c | |||
| @@ -112,9 +112,9 @@ | |||
| 112 | #include <stdio.h> | 112 | #include <stdio.h> |
| 113 | #include <errno.h> | 113 | #include <errno.h> |
| 114 | #define USE_SOCKETS | 114 | #define USE_SOCKETS |
| 115 | #include "ssl_locl.h" | ||
| 115 | #include <openssl/evp.h> | 116 | #include <openssl/evp.h> |
| 116 | #include <openssl/buffer.h> | 117 | #include <openssl/buffer.h> |
| 117 | #include "ssl_locl.h" | ||
| 118 | 118 | ||
| 119 | static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, | 119 | static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, |
| 120 | unsigned int len, int create_empty_fragment); | 120 | unsigned int len, int create_empty_fragment); |
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c index 99b6a86983..782b57f57a 100644 --- a/src/lib/libssl/s3_srvr.c +++ b/src/lib/libssl/s3_srvr.c | |||
| @@ -114,15 +114,16 @@ | |||
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | #include <stdio.h> | 116 | #include <stdio.h> |
| 117 | #include "ssl_locl.h" | ||
| 118 | #include "kssl_lcl.h" | ||
| 117 | #include <openssl/buffer.h> | 119 | #include <openssl/buffer.h> |
| 118 | #include <openssl/rand.h> | 120 | #include <openssl/rand.h> |
| 119 | #include <openssl/objects.h> | 121 | #include <openssl/objects.h> |
| 120 | #include <openssl/evp.h> | 122 | #include <openssl/evp.h> |
| 121 | #include <openssl/x509.h> | 123 | #include <openssl/x509.h> |
| 122 | #include <openssl/krb5_asn.h> | 124 | #include <openssl/krb5_asn.h> |
| 123 | #include "ssl_locl.h" | ||
| 124 | #include "kssl_lcl.h" | ||
| 125 | #include <openssl/md5.h> | 125 | #include <openssl/md5.h> |
| 126 | #include "cryptlib.h" | ||
| 126 | 127 | ||
| 127 | static SSL_METHOD *ssl3_get_server_method(int ver); | 128 | static SSL_METHOD *ssl3_get_server_method(int ver); |
| 128 | static int ssl3_get_client_hello(SSL *s); | 129 | static int ssl3_get_client_hello(SSL *s); |
| @@ -964,6 +965,7 @@ static int ssl3_send_server_hello(SSL *s) | |||
| 964 | s->session->session_id_length=0; | 965 | s->session->session_id_length=0; |
| 965 | 966 | ||
| 966 | sl=s->session->session_id_length; | 967 | sl=s->session->session_id_length; |
| 968 | die(sl <= sizeof s->session->session_id); | ||
| 967 | *(p++)=sl; | 969 | *(p++)=sl; |
| 968 | memcpy(p,s->session->session_id,sl); | 970 | memcpy(p,s->session->session_id,sl); |
| 969 | p+=sl; | 971 | p+=sl; |
| @@ -1559,8 +1561,8 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
| 1559 | EVP_CIPHER *enc = NULL; | 1561 | EVP_CIPHER *enc = NULL; |
| 1560 | unsigned char iv[EVP_MAX_IV_LENGTH]; | 1562 | unsigned char iv[EVP_MAX_IV_LENGTH]; |
| 1561 | unsigned char pms[SSL_MAX_MASTER_KEY_LENGTH | 1563 | unsigned char pms[SSL_MAX_MASTER_KEY_LENGTH |
| 1562 | + EVP_MAX_IV_LENGTH + 1]; | 1564 | + EVP_MAX_BLOCK_LENGTH]; |
| 1563 | int padl, outl = sizeof(pms); | 1565 | int padl, outl; |
| 1564 | krb5_timestamp authtime = 0; | 1566 | krb5_timestamp authtime = 0; |
| 1565 | krb5_ticket_times ttimes; | 1567 | krb5_ticket_times ttimes; |
| 1566 | 1568 | ||
| @@ -1583,6 +1585,16 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
| 1583 | enc_pms.data = (char *)p; | 1585 | enc_pms.data = (char *)p; |
| 1584 | p+=enc_pms.length; | 1586 | p+=enc_pms.length; |
| 1585 | 1587 | ||
| 1588 | /* Note that the length is checked again below, | ||
| 1589 | ** after decryption | ||
| 1590 | */ | ||
| 1591 | if(enc.pms_length > sizeof pms) | ||
| 1592 | { | ||
| 1593 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | ||
| 1594 | SSL_R_DATA_LENGTH_TOO_LONG); | ||
| 1595 | goto err; | ||
| 1596 | } | ||
| 1597 | |||
| 1586 | if (n != enc_ticket.length + authenticator.length + | 1598 | if (n != enc_ticket.length + authenticator.length + |
| 1587 | enc_pms.length + 6) | 1599 | enc_pms.length + 6) |
| 1588 | { | 1600 | { |
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h index 833f761690..d9949e8eb2 100644 --- a/src/lib/libssl/ssl.h +++ b/src/lib/libssl/ssl.h | |||
| @@ -253,7 +253,7 @@ extern "C" { | |||
| 253 | #define SSL_TXT_RC4 "RC4" | 253 | #define SSL_TXT_RC4 "RC4" |
| 254 | #define SSL_TXT_RC2 "RC2" | 254 | #define SSL_TXT_RC2 "RC2" |
| 255 | #define SSL_TXT_IDEA "IDEA" | 255 | #define SSL_TXT_IDEA "IDEA" |
| 256 | #define SSL_TXT_AES "AESdraft" /* AES ciphersuites are not yet official (thus excluded from 'ALL') */ | 256 | #define SSL_TXT_AES "AES" |
| 257 | #define SSL_TXT_MD5 "MD5" | 257 | #define SSL_TXT_MD5 "MD5" |
| 258 | #define SSL_TXT_SHA1 "SHA1" | 258 | #define SSL_TXT_SHA1 "SHA1" |
| 259 | #define SSL_TXT_SHA "SHA" | 259 | #define SSL_TXT_SHA "SHA" |
| @@ -266,6 +266,23 @@ extern "C" { | |||
| 266 | #define SSL_TXT_TLSV1 "TLSv1" | 266 | #define SSL_TXT_TLSV1 "TLSv1" |
| 267 | #define SSL_TXT_ALL "ALL" | 267 | #define SSL_TXT_ALL "ALL" |
| 268 | 268 | ||
| 269 | /* | ||
| 270 | * COMPLEMENTOF* definitions. These identifiers are used to (de-select) | ||
| 271 | * ciphers normally not being used. | ||
| 272 | * Example: "RC4" will activate all ciphers using RC4 including ciphers | ||
| 273 | * without authentication, which would normally disabled by DEFAULT (due | ||
| 274 | * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" | ||
| 275 | * will make sure that it is also disabled in the specific selection. | ||
| 276 | * COMPLEMENTOF* identifiers are portable between version, as adjustments | ||
| 277 | * to the default cipher setup will also be included here. | ||
| 278 | * | ||
| 279 | * COMPLEMENTOFDEFAULT does not experience the same special treatment that | ||
| 280 | * DEFAULT gets, as only selection is being done and no sorting as needed | ||
| 281 | * for DEFAULT. | ||
| 282 | */ | ||
| 283 | #define SSL_TXT_CMPALL "COMPLEMENTOFALL" | ||
| 284 | #define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" | ||
| 285 | |||
| 269 | /* The following cipher list is used by default. | 286 | /* The following cipher list is used by default. |
| 270 | * It also is substituted when an application-defined cipher list string | 287 | * It also is substituted when an application-defined cipher list string |
| 271 | * starts with 'DEFAULT'. */ | 288 | * starts with 'DEFAULT'. */ |
| @@ -429,6 +446,7 @@ typedef struct ssl_session_st | |||
| 429 | struct ssl_session_st *prev,*next; | 446 | struct ssl_session_st *prev,*next; |
| 430 | } SSL_SESSION; | 447 | } SSL_SESSION; |
| 431 | 448 | ||
| 449 | |||
| 432 | #define SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001L | 450 | #define SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001L |
| 433 | #define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002L | 451 | #define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002L |
| 434 | #define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L | 452 | #define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L |
| @@ -439,6 +457,19 @@ typedef struct ssl_session_st | |||
| 439 | #define SSL_OP_TLS_D5_BUG 0x00000100L | 457 | #define SSL_OP_TLS_D5_BUG 0x00000100L |
| 440 | #define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L | 458 | #define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L |
| 441 | 459 | ||
| 460 | /* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added | ||
| 461 | * in OpenSSL 0.9.6d. Usually (depending on the application protocol) | ||
| 462 | * the workaround is not needed. Unfortunately some broken SSL/TLS | ||
| 463 | * implementations cannot handle it at all, which is why we include | ||
| 464 | * it in SSL_OP_ALL. */ | ||
| 465 | #define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800L /* added in 0.9.6e */ | ||
| 466 | |||
| 467 | /* SSL_OP_ALL: various bug workarounds that should be rather harmless. | ||
| 468 | * This used to be 0x000FFFFFL before 0.9.7. */ | ||
| 469 | #define SSL_OP_ALL 0x00000FFFL | ||
| 470 | |||
| 471 | /* As server, disallow session resumption on renegotiation */ | ||
| 472 | #define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000L | ||
| 442 | /* If set, always create a new key when using tmp_dh parameters */ | 473 | /* If set, always create a new key when using tmp_dh parameters */ |
| 443 | #define SSL_OP_SINGLE_DH_USE 0x00100000L | 474 | #define SSL_OP_SINGLE_DH_USE 0x00100000L |
| 444 | /* Set to always use the tmp_rsa key when doing RSA operations, | 475 | /* Set to always use the tmp_rsa key when doing RSA operations, |
| @@ -452,8 +483,10 @@ typedef struct ssl_session_st | |||
| 452 | * (version 3.1) was announced in the client hello. Normally this is | 483 | * (version 3.1) was announced in the client hello. Normally this is |
| 453 | * forbidden to prevent version rollback attacks. */ | 484 | * forbidden to prevent version rollback attacks. */ |
| 454 | #define SSL_OP_TLS_ROLLBACK_BUG 0x00800000L | 485 | #define SSL_OP_TLS_ROLLBACK_BUG 0x00800000L |
| 455 | /* As server, disallow session resumption on renegotiation */ | 486 | |
| 456 | #define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x01000000L | 487 | #define SSL_OP_NO_SSLv2 0x01000000L |
| 488 | #define SSL_OP_NO_SSLv3 0x02000000L | ||
| 489 | #define SSL_OP_NO_TLSv1 0x04000000L | ||
| 457 | 490 | ||
| 458 | /* The next flag deliberately changes the ciphertest, this is a check | 491 | /* The next flag deliberately changes the ciphertest, this is a check |
| 459 | * for the PKCS#1 attack */ | 492 | * for the PKCS#1 attack */ |
| @@ -461,11 +494,7 @@ typedef struct ssl_session_st | |||
| 461 | #define SSL_OP_PKCS1_CHECK_2 0x10000000L | 494 | #define SSL_OP_PKCS1_CHECK_2 0x10000000L |
| 462 | #define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L | 495 | #define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L |
| 463 | #define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x40000000L | 496 | #define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x40000000L |
| 464 | #define SSL_OP_ALL 0x000FFFFFL | ||
| 465 | 497 | ||
| 466 | #define SSL_OP_NO_SSLv2 0x01000000L | ||
| 467 | #define SSL_OP_NO_SSLv3 0x02000000L | ||
| 468 | #define SSL_OP_NO_TLSv1 0x04000000L | ||
| 469 | 498 | ||
| 470 | /* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success | 499 | /* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success |
| 471 | * when just a single record has been written): */ | 500 | * when just a single record has been written): */ |
| @@ -479,6 +508,7 @@ typedef struct ssl_session_st | |||
| 479 | * is blocking: */ | 508 | * is blocking: */ |
| 480 | #define SSL_MODE_AUTO_RETRY 0x00000004L | 509 | #define SSL_MODE_AUTO_RETRY 0x00000004L |
| 481 | 510 | ||
| 511 | |||
| 482 | /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, | 512 | /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, |
| 483 | * they cannot be used to clear bits. */ | 513 | * they cannot be used to clear bits. */ |
| 484 | 514 | ||
| @@ -1637,6 +1667,7 @@ void ERR_load_SSL_strings(void); | |||
| 1637 | #define SSL_R_INVALID_COMMAND 280 | 1667 | #define SSL_R_INVALID_COMMAND 280 |
| 1638 | #define SSL_R_INVALID_PURPOSE 278 | 1668 | #define SSL_R_INVALID_PURPOSE 278 |
| 1639 | #define SSL_R_INVALID_TRUST 279 | 1669 | #define SSL_R_INVALID_TRUST 279 |
| 1670 | #define SSL_R_KEY_ARG_TOO_LONG 1112 | ||
| 1640 | #define SSL_R_KRB5 1104 | 1671 | #define SSL_R_KRB5 1104 |
| 1641 | #define SSL_R_KRB5_C_CC_PRINC 1094 | 1672 | #define SSL_R_KRB5_C_CC_PRINC 1094 |
| 1642 | #define SSL_R_KRB5_C_GET_CRED 1095 | 1673 | #define SSL_R_KRB5_C_GET_CRED 1095 |
| @@ -1716,6 +1747,7 @@ void ERR_load_SSL_strings(void); | |||
| 1716 | #define SSL_R_SHORT_READ 219 | 1747 | #define SSL_R_SHORT_READ 219 |
| 1717 | #define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 | 1748 | #define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 |
| 1718 | #define SSL_R_SSL23_DOING_SESSION_ID_REUSE 221 | 1749 | #define SSL_R_SSL23_DOING_SESSION_ID_REUSE 221 |
| 1750 | #define SSL_R_SSL3_SESSION_ID_TOO_LONG 1113 | ||
| 1719 | #define SSL_R_SSL3_SESSION_ID_TOO_SHORT 222 | 1751 | #define SSL_R_SSL3_SESSION_ID_TOO_SHORT 222 |
| 1720 | #define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 | 1752 | #define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 |
| 1721 | #define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 | 1753 | #define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 |
diff --git a/src/lib/libssl/ssl_asn1.c b/src/lib/libssl/ssl_asn1.c index c5eeeb6bc5..1638c6b525 100644 --- a/src/lib/libssl/ssl_asn1.c +++ b/src/lib/libssl/ssl_asn1.c | |||
| @@ -58,10 +58,11 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include "ssl_locl.h" | ||
| 61 | #include <openssl/asn1_mac.h> | 62 | #include <openssl/asn1_mac.h> |
| 62 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 63 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 64 | #include "ssl_locl.h" | 65 | #include "cryptlib.h" |
| 65 | 66 | ||
| 66 | typedef struct ssl_session_asn1_st | 67 | typedef struct ssl_session_asn1_st |
| 67 | { | 68 | { |
| @@ -296,6 +297,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, | |||
| 296 | os.length=i; | 297 | os.length=i; |
| 297 | 298 | ||
| 298 | ret->session_id_length=os.length; | 299 | ret->session_id_length=os.length; |
| 300 | die(os.length <= sizeof ret->session_id); | ||
| 299 | memcpy(ret->session_id,os.data,os.length); | 301 | memcpy(ret->session_id,os.data,os.length); |
| 300 | 302 | ||
| 301 | M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING); | 303 | M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING); |
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c index cdd8dde128..37f58886a6 100644 --- a/src/lib/libssl/ssl_ciph.c +++ b/src/lib/libssl/ssl_ciph.c | |||
| @@ -100,9 +100,10 @@ typedef struct cipher_order_st | |||
| 100 | } CIPHER_ORDER; | 100 | } CIPHER_ORDER; |
| 101 | 101 | ||
| 102 | static const SSL_CIPHER cipher_aliases[]={ | 102 | static const SSL_CIPHER cipher_aliases[]={ |
| 103 | /* Don't include eNULL unless specifically enabled. | 103 | /* Don't include eNULL unless specifically enabled. */ |
| 104 | * Similarly, don't include AES in ALL because these ciphers are not yet official. */ | 104 | {0,SSL_TXT_ALL, 0,SSL_ALL & ~SSL_eNULL, SSL_ALL ,0,0,0,SSL_ALL,SSL_ALL}, /* must be first */ |
| 105 | {0,SSL_TXT_ALL, 0,SSL_ALL & ~SSL_eNULL & ~SSL_AES, SSL_ALL ,0,0,0,SSL_ALL,SSL_ALL}, /* must be first */ | 105 | {0,SSL_TXT_CMPALL,0,SSL_eNULL,0,0,0,0,SSL_ENC_MASK,0}, /* COMPLEMENT OF ALL */ |
| 106 | {0,SSL_TXT_CMPDEF,0,SSL_ADH, 0,0,0,0,SSL_AUTH_MASK,0}, | ||
| 106 | {0,SSL_TXT_kKRB5,0,SSL_kKRB5,0,0,0,0,SSL_MKEY_MASK,0}, /* VRS Kerberos5 */ | 107 | {0,SSL_TXT_kKRB5,0,SSL_kKRB5,0,0,0,0,SSL_MKEY_MASK,0}, /* VRS Kerberos5 */ |
| 107 | {0,SSL_TXT_kRSA,0,SSL_kRSA, 0,0,0,0,SSL_MKEY_MASK,0}, | 108 | {0,SSL_TXT_kRSA,0,SSL_kRSA, 0,0,0,0,SSL_MKEY_MASK,0}, |
| 108 | {0,SSL_TXT_kDHr,0,SSL_kDHr, 0,0,0,0,SSL_MKEY_MASK,0}, | 109 | {0,SSL_TXT_kDHr,0,SSL_kDHr, 0,0,0,0,SSL_MKEY_MASK,0}, |
| @@ -999,10 +1000,10 @@ char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int len) | |||
| 999 | case SSL_AES: | 1000 | case SSL_AES: |
| 1000 | switch(cipher->strength_bits) | 1001 | switch(cipher->strength_bits) |
| 1001 | { | 1002 | { |
| 1002 | case 128: enc="AESdraft(128)"; break; | 1003 | case 128: enc="AES(128)"; break; |
| 1003 | case 192: enc="AESdraft(192)"; break; | 1004 | case 192: enc="AES(192)"; break; |
| 1004 | case 256: enc="AESdraft(256)"; break; | 1005 | case 256: enc="AES(256)"; break; |
| 1005 | default: enc="AESdraft(?""?""?)"; break; | 1006 | default: enc="AES(?""?""?)"; break; |
| 1006 | } | 1007 | } |
| 1007 | break; | 1008 | break; |
| 1008 | default: | 1009 | default: |
diff --git a/src/lib/libssl/ssl_err.c b/src/lib/libssl/ssl_err.c index c32c4ef6e9..0cad32c855 100644 --- a/src/lib/libssl/ssl_err.c +++ b/src/lib/libssl/ssl_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* ssl/ssl_err.c */ | 1 | /* ssl/ssl_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -275,6 +275,7 @@ static ERR_STRING_DATA SSL_str_reasons[]= | |||
| 275 | {SSL_R_INVALID_COMMAND ,"invalid command"}, | 275 | {SSL_R_INVALID_COMMAND ,"invalid command"}, |
| 276 | {SSL_R_INVALID_PURPOSE ,"invalid purpose"}, | 276 | {SSL_R_INVALID_PURPOSE ,"invalid purpose"}, |
| 277 | {SSL_R_INVALID_TRUST ,"invalid trust"}, | 277 | {SSL_R_INVALID_TRUST ,"invalid trust"}, |
| 278 | {SSL_R_KEY_ARG_TOO_LONG ,"key arg too long"}, | ||
| 278 | {SSL_R_KRB5 ,"krb5"}, | 279 | {SSL_R_KRB5 ,"krb5"}, |
| 279 | {SSL_R_KRB5_C_CC_PRINC ,"krb5 client cc principal (no tkt?)"}, | 280 | {SSL_R_KRB5_C_CC_PRINC ,"krb5 client cc principal (no tkt?)"}, |
| 280 | {SSL_R_KRB5_C_GET_CRED ,"krb5 client get cred"}, | 281 | {SSL_R_KRB5_C_GET_CRED ,"krb5 client get cred"}, |
| @@ -354,6 +355,7 @@ static ERR_STRING_DATA SSL_str_reasons[]= | |||
| 354 | {SSL_R_SHORT_READ ,"short read"}, | 355 | {SSL_R_SHORT_READ ,"short read"}, |
| 355 | {SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE,"signature for non signing certificate"}, | 356 | {SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE,"signature for non signing certificate"}, |
| 356 | {SSL_R_SSL23_DOING_SESSION_ID_REUSE ,"ssl23 doing session id reuse"}, | 357 | {SSL_R_SSL23_DOING_SESSION_ID_REUSE ,"ssl23 doing session id reuse"}, |
| 358 | {SSL_R_SSL3_SESSION_ID_TOO_LONG ,"ssl3 session id too long"}, | ||
| 357 | {SSL_R_SSL3_SESSION_ID_TOO_SHORT ,"ssl3 session id too short"}, | 359 | {SSL_R_SSL3_SESSION_ID_TOO_SHORT ,"ssl3 session id too short"}, |
| 358 | {SSL_R_SSLV3_ALERT_BAD_CERTIFICATE ,"sslv3 alert bad certificate"}, | 360 | {SSL_R_SSLV3_ALERT_BAD_CERTIFICATE ,"sslv3 alert bad certificate"}, |
| 359 | {SSL_R_SSLV3_ALERT_BAD_RECORD_MAC ,"sslv3 alert bad record mac"}, | 361 | {SSL_R_SSLV3_ALERT_BAD_RECORD_MAC ,"sslv3 alert bad record mac"}, |
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index df307a80c5..ab172aeaec 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
| @@ -116,11 +116,11 @@ | |||
| 116 | # include <assert.h> | 116 | # include <assert.h> |
| 117 | #endif | 117 | #endif |
| 118 | #include <stdio.h> | 118 | #include <stdio.h> |
| 119 | #include "ssl_locl.h" | ||
| 120 | #include "kssl_lcl.h" | ||
| 119 | #include <openssl/objects.h> | 121 | #include <openssl/objects.h> |
| 120 | #include <openssl/lhash.h> | 122 | #include <openssl/lhash.h> |
| 121 | #include <openssl/x509v3.h> | 123 | #include <openssl/x509v3.h> |
| 122 | #include "ssl_locl.h" | ||
| 123 | #include "kssl_lcl.h" | ||
| 124 | 124 | ||
| 125 | const char *SSL_version_str=OPENSSL_VERSION_TEXT; | 125 | const char *SSL_version_str=OPENSSL_VERSION_TEXT; |
| 126 | 126 | ||
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h index 17e9bef832..fe4ac839cf 100644 --- a/src/lib/libssl/ssl_locl.h +++ b/src/lib/libssl/ssl_locl.h | |||
| @@ -293,16 +293,17 @@ | |||
| 293 | #define SSL_NOT_EXP 0x00000001L | 293 | #define SSL_NOT_EXP 0x00000001L |
| 294 | #define SSL_EXPORT 0x00000002L | 294 | #define SSL_EXPORT 0x00000002L |
| 295 | 295 | ||
| 296 | #define SSL_STRONG_MASK 0x0000007cL | 296 | #define SSL_STRONG_MASK 0x000000fcL |
| 297 | #define SSL_EXP40 0x00000004L | 297 | #define SSL_STRONG_NONE 0x00000004L |
| 298 | #define SSL_EXP40 0x00000008L | ||
| 298 | #define SSL_MICRO (SSL_EXP40) | 299 | #define SSL_MICRO (SSL_EXP40) |
| 299 | #define SSL_EXP56 0x00000008L | 300 | #define SSL_EXP56 0x00000010L |
| 300 | #define SSL_MINI (SSL_EXP56) | 301 | #define SSL_MINI (SSL_EXP56) |
| 301 | #define SSL_LOW 0x00000010L | 302 | #define SSL_LOW 0x00000020L |
| 302 | #define SSL_MEDIUM 0x00000020L | 303 | #define SSL_MEDIUM 0x00000040L |
| 303 | #define SSL_HIGH 0x00000040L | 304 | #define SSL_HIGH 0x00000080L |
| 304 | 305 | ||
| 305 | /* we have used 0000007f - 25 bits left to go */ | 306 | /* we have used 000000ff - 24 bits left to go */ |
| 306 | 307 | ||
| 307 | /* | 308 | /* |
| 308 | * Macros to check the export status and cipher strength for export ciphers. | 309 | * Macros to check the export status and cipher strength for export ciphers. |
diff --git a/src/lib/libssl/ssl_rsa.c b/src/lib/libssl/ssl_rsa.c index 1cf8e20934..03828b6632 100644 --- a/src/lib/libssl/ssl_rsa.c +++ b/src/lib/libssl/ssl_rsa.c | |||
| @@ -57,12 +57,12 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "ssl_locl.h" | ||
| 60 | #include <openssl/bio.h> | 61 | #include <openssl/bio.h> |
| 61 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 62 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
| 63 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 64 | #include <openssl/pem.h> | 65 | #include <openssl/pem.h> |
| 65 | #include "ssl_locl.h" | ||
| 66 | 66 | ||
| 67 | static int ssl_set_cert(CERT *c, X509 *x509); | 67 | static int ssl_set_cert(CERT *c, X509 *x509); |
| 68 | static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey); | 68 | static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey); |
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c index 6424f775e2..8bfc382bb6 100644 --- a/src/lib/libssl/ssl_sess.c +++ b/src/lib/libssl/ssl_sess.c | |||
| @@ -60,6 +60,7 @@ | |||
| 60 | #include <openssl/lhash.h> | 60 | #include <openssl/lhash.h> |
| 61 | #include <openssl/rand.h> | 61 | #include <openssl/rand.h> |
| 62 | #include "ssl_locl.h" | 62 | #include "ssl_locl.h" |
| 63 | #include "cryptlib.h" | ||
| 63 | 64 | ||
| 64 | static void SSL_SESSION_list_remove(SSL_CTX *ctx, SSL_SESSION *s); | 65 | static void SSL_SESSION_list_remove(SSL_CTX *ctx, SSL_SESSION *s); |
| 65 | static void SSL_SESSION_list_add(SSL_CTX *ctx,SSL_SESSION *s); | 66 | static void SSL_SESSION_list_add(SSL_CTX *ctx,SSL_SESSION *s); |
| @@ -250,6 +251,7 @@ int ssl_get_new_session(SSL *s, int session) | |||
| 250 | ss->session_id_length=0; | 251 | ss->session_id_length=0; |
| 251 | } | 252 | } |
| 252 | 253 | ||
| 254 | die(s->sid_ctx_length <= sizeof ss->sid_ctx); | ||
| 253 | memcpy(ss->sid_ctx,s->sid_ctx,s->sid_ctx_length); | 255 | memcpy(ss->sid_ctx,s->sid_ctx,s->sid_ctx_length); |
| 254 | ss->sid_ctx_length=s->sid_ctx_length; | 256 | ss->sid_ctx_length=s->sid_ctx_length; |
| 255 | s->session=ss; | 257 | s->session=ss; |
diff --git a/src/lib/libssl/t1_clnt.c b/src/lib/libssl/t1_clnt.c index 9745630a00..9ad518f9f4 100644 --- a/src/lib/libssl/t1_clnt.c +++ b/src/lib/libssl/t1_clnt.c | |||
| @@ -57,11 +57,11 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "ssl_locl.h" | ||
| 60 | #include <openssl/buffer.h> | 61 | #include <openssl/buffer.h> |
| 61 | #include <openssl/rand.h> | 62 | #include <openssl/rand.h> |
| 62 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 63 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 64 | #include "ssl_locl.h" | ||
| 65 | 65 | ||
| 66 | static SSL_METHOD *tls1_get_client_method(int ver); | 66 | static SSL_METHOD *tls1_get_client_method(int ver); |
| 67 | static SSL_METHOD *tls1_get_client_method(int ver) | 67 | static SSL_METHOD *tls1_get_client_method(int ver) |
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c index b80525f3ba..5290bf6665 100644 --- a/src/lib/libssl/t1_enc.c +++ b/src/lib/libssl/t1_enc.c | |||
| @@ -110,10 +110,10 @@ | |||
| 110 | */ | 110 | */ |
| 111 | 111 | ||
| 112 | #include <stdio.h> | 112 | #include <stdio.h> |
| 113 | #include "ssl_locl.h" | ||
| 113 | #include <openssl/comp.h> | 114 | #include <openssl/comp.h> |
| 114 | #include <openssl/evp.h> | 115 | #include <openssl/evp.h> |
| 115 | #include <openssl/hmac.h> | 116 | #include <openssl/hmac.h> |
| 116 | #include "ssl_locl.h" | ||
| 117 | #include <openssl/md5.h> | 117 | #include <openssl/md5.h> |
| 118 | 118 | ||
| 119 | static void tls1_P_hash(const EVP_MD *md, const unsigned char *sec, | 119 | static void tls1_P_hash(const EVP_MD *md, const unsigned char *sec, |
| @@ -483,14 +483,25 @@ printf("\nkey block\n"); | |||
| 483 | { int z; for (z=0; z<num; z++) printf("%02X%c",p1[z],((z+1)%16)?' ':'\n'); } | 483 | { int z; for (z=0; z<num; z++) printf("%02X%c",p1[z],((z+1)%16)?' ':'\n'); } |
| 484 | #endif | 484 | #endif |
| 485 | 485 | ||
| 486 | /* enable vulnerability countermeasure for CBC ciphers with | 486 | if (!(s->options & SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS)) |
| 487 | * known-IV problem (http://www.openssl.org/~bodo/tls-cbc.txt) */ | 487 | { |
| 488 | s->s3->need_empty_fragments = 1; | 488 | /* enable vulnerability countermeasure for CBC ciphers with |
| 489 | #ifndef NO_RC4 | 489 | * known-IV problem (http://www.openssl.org/~bodo/tls-cbc.txt) |
| 490 | if ((s->session->cipher != NULL) && ((s->session->cipher->algorithms & SSL_ENC_MASK) == SSL_RC4)) | 490 | */ |
| 491 | s->s3->need_empty_fragments = 0; | 491 | s->s3->need_empty_fragments = 1; |
| 492 | |||
| 493 | if (s->session->cipher != NULL) | ||
| 494 | { | ||
| 495 | if ((s->session->cipher->algorithms & SSL_ENC_MASK) == SSL_eNULL) | ||
| 496 | s->s3->need_empty_fragments = 0; | ||
| 497 | |||
| 498 | #ifndef OPENSSL_NO_RC4 | ||
| 499 | if ((s->session->cipher->algorithms & SSL_ENC_MASK) == SSL_RC4) | ||
| 500 | s->s3->need_empty_fragments = 0; | ||
| 492 | #endif | 501 | #endif |
| 493 | 502 | } | |
| 503 | } | ||
| 504 | |||
| 494 | return(1); | 505 | return(1); |
| 495 | err: | 506 | err: |
| 496 | SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,ERR_R_MALLOC_FAILURE); | 507 | SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libssl/t1_srvr.c b/src/lib/libssl/t1_srvr.c index 996b7ca8e2..6e765e587f 100644 --- a/src/lib/libssl/t1_srvr.c +++ b/src/lib/libssl/t1_srvr.c | |||
| @@ -57,12 +57,12 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "ssl_locl.h" | ||
| 60 | #include <openssl/buffer.h> | 61 | #include <openssl/buffer.h> |
| 61 | #include <openssl/rand.h> | 62 | #include <openssl/rand.h> |
| 62 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 63 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 65 | #include "ssl_locl.h" | ||
| 66 | 66 | ||
| 67 | static SSL_METHOD *tls1_get_server_method(int ver); | 67 | static SSL_METHOD *tls1_get_server_method(int ver); |
| 68 | static SSL_METHOD *tls1_get_server_method(int ver) | 68 | static SSL_METHOD *tls1_get_server_method(int ver) |
diff --git a/src/lib/libssl/test/tcrl b/src/lib/libssl/test/tcrl index acaf8f3c47..f71ef7a863 100644 --- a/src/lib/libssl/test/tcrl +++ b/src/lib/libssl/test/tcrl | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | PATH=../apps:$PATH | 3 | if test "$OSTYPE" = msdosdjgpp; then |
| 4 | PATH=../apps\;$PATH | ||
| 5 | else | ||
| 6 | PATH=../apps:$PATH | ||
| 7 | fi | ||
| 4 | export PATH | 8 | export PATH |
| 5 | 9 | ||
| 6 | cmd='../apps/openssl crl' | 10 | cmd='../apps/openssl crl' |
diff --git a/src/lib/libssl/test/testca b/src/lib/libssl/test/testca index 88c186b6ab..8215ebb5d1 100644 --- a/src/lib/libssl/test/testca +++ b/src/lib/libssl/test/testca | |||
| @@ -1,7 +1,11 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | SH="/bin/sh" | 3 | SH="/bin/sh" |
| 4 | PATH=../apps:$PATH | 4 | if test "$OSTYPE" = msdosdjgpp; then |
| 5 | PATH=./apps\;../apps\;$PATH | ||
| 6 | else | ||
| 7 | PATH=../apps:$PATH | ||
| 8 | fi | ||
| 5 | export SH PATH | 9 | export SH PATH |
| 6 | 10 | ||
| 7 | SSLEAY_CONFIG="-config CAss.cnf" | 11 | SSLEAY_CONFIG="-config CAss.cnf" |
diff --git a/src/lib/libssl/test/testgen b/src/lib/libssl/test/testgen index 6a4b6b9221..55c496f4bc 100644 --- a/src/lib/libssl/test/testgen +++ b/src/lib/libssl/test/testgen | |||
| @@ -6,7 +6,11 @@ CA=../certs/testca.pem | |||
| 6 | 6 | ||
| 7 | /bin/rm -f $T.1 $T.2 $T.key | 7 | /bin/rm -f $T.1 $T.2 $T.key |
| 8 | 8 | ||
| 9 | PATH=../apps:$PATH; | 9 | if test "$OSTYPE" = msdosdjgpp; then |
| 10 | PATH=../apps\;$PATH; | ||
| 11 | else | ||
| 12 | PATH=../apps:$PATH; | ||
| 13 | fi | ||
| 10 | export PATH | 14 | export PATH |
| 11 | 15 | ||
| 12 | echo "generating certificate request" | 16 | echo "generating certificate request" |
diff --git a/src/lib/libssl/test/tpkcs7 b/src/lib/libssl/test/tpkcs7 index 15bbba42c0..cf3bd9fadb 100644 --- a/src/lib/libssl/test/tpkcs7 +++ b/src/lib/libssl/test/tpkcs7 | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | PATH=../apps:$PATH | 3 | if test "$OSTYPE" = msdosdjgpp; then |
| 4 | PATH=../apps\;$PATH | ||
| 5 | else | ||
| 6 | PATH=../apps:$PATH | ||
| 7 | fi | ||
| 4 | export PATH | 8 | export PATH |
| 5 | 9 | ||
| 6 | cmd='../apps/openssl pkcs7' | 10 | cmd='../apps/openssl pkcs7' |
diff --git a/src/lib/libssl/test/tpkcs7d b/src/lib/libssl/test/tpkcs7d index 46e5aa2bd6..18f9311b06 100644 --- a/src/lib/libssl/test/tpkcs7d +++ b/src/lib/libssl/test/tpkcs7d | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | PATH=../apps:$PATH | 3 | if test "$OSTYPE" = msdosdjgpp; then |
| 4 | PATH=../apps\;$PATH | ||
| 5 | else | ||
| 6 | PATH=../apps:$PATH | ||
| 7 | fi | ||
| 4 | export PATH | 8 | export PATH |
| 5 | 9 | ||
| 6 | cmd='../apps/openssl pkcs7' | 10 | cmd='../apps/openssl pkcs7' |
diff --git a/src/lib/libssl/test/treq b/src/lib/libssl/test/treq index 9f5eb7eea5..47a8273cde 100644 --- a/src/lib/libssl/test/treq +++ b/src/lib/libssl/test/treq | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | PATH=../apps:$PATH | 3 | if test "$OSTYPE" = msdosdjgpp; then |
| 4 | PATH=../apps\;$PATH | ||
| 5 | else | ||
| 6 | PATH=../apps:$PATH | ||
| 7 | fi | ||
| 4 | export PATH | 8 | export PATH |
| 5 | 9 | ||
| 6 | cmd='../apps/openssl req -config ../apps/openssl.cnf' | 10 | cmd='../apps/openssl req -config ../apps/openssl.cnf' |
diff --git a/src/lib/libssl/test/trsa b/src/lib/libssl/test/trsa index bd6c07650a..413e2ec0a0 100644 --- a/src/lib/libssl/test/trsa +++ b/src/lib/libssl/test/trsa | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | PATH=../apps:$PATH | 3 | if test "$OSTYPE" = msdosdjgpp; then |
| 4 | PATH=../apps\;$PATH | ||
| 5 | else | ||
| 6 | PATH=../apps:$PATH | ||
| 7 | fi | ||
| 4 | export PATH | 8 | export PATH |
| 5 | 9 | ||
| 6 | if ../apps/openssl no-rsa; then | 10 | if ../apps/openssl no-rsa; then |
diff --git a/src/lib/libssl/test/tsid b/src/lib/libssl/test/tsid index 9e0854516c..40a1dfa97c 100644 --- a/src/lib/libssl/test/tsid +++ b/src/lib/libssl/test/tsid | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | PATH=../apps:$PATH | 3 | if test "$OSTYPE" = msdosdjgpp; then |
| 4 | PATH=../apps\;$PATH | ||
| 5 | else | ||
| 6 | PATH=../apps:$PATH | ||
| 7 | fi | ||
| 4 | export PATH | 8 | export PATH |
| 5 | 9 | ||
| 6 | cmd='../apps/openssl sess_id' | 10 | cmd='../apps/openssl sess_id' |
diff --git a/src/lib/libssl/test/tx509 b/src/lib/libssl/test/tx509 index 35169f3a43..d380963abc 100644 --- a/src/lib/libssl/test/tx509 +++ b/src/lib/libssl/test/tx509 | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | PATH=../apps:$PATH | 3 | if test "$OSTYPE" = msdosdjgpp; then |
| 4 | PATH=../apps\;$PATH | ||
| 5 | else | ||
| 6 | PATH=../apps:$PATH | ||
| 7 | fi | ||
| 4 | export PATH | 8 | export PATH |
| 5 | 9 | ||
| 6 | cmd='../apps/openssl x509' | 10 | cmd='../apps/openssl x509' |
diff --git a/src/lib/libssl/tls1.h b/src/lib/libssl/tls1.h index 88ec5fb527..38838ea9a5 100644 --- a/src/lib/libssl/tls1.h +++ b/src/lib/libssl/tls1.h | |||
| @@ -96,7 +96,7 @@ extern "C" { | |||
| 96 | #define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA 0x03000065 | 96 | #define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA 0x03000065 |
| 97 | #define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA 0x03000066 | 97 | #define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA 0x03000066 |
| 98 | 98 | ||
| 99 | /* AES ciphersuites from draft ietf-tls-ciphersuite-03.txt */ | 99 | /* AES ciphersuites from RFC3268 */ |
| 100 | 100 | ||
| 101 | #define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F | 101 | #define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F |
| 102 | #define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 | 102 | #define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 |
| @@ -126,20 +126,21 @@ extern "C" { | |||
| 126 | #define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA "EXP1024-RC4-SHA" | 126 | #define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA "EXP1024-RC4-SHA" |
| 127 | #define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA "EXP1024-DHE-DSS-RC4-SHA" | 127 | #define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA "EXP1024-DHE-DSS-RC4-SHA" |
| 128 | #define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" | 128 | #define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" |
| 129 | /* AES ciphersuites from draft-ietf-tls-ciphersuite-06.txt */ | 129 | |
| 130 | #define TLS1_TXT_RSA_WITH_AES_128_SHA "AESdraft128-SHA" | 130 | /* AES ciphersuites from RFC3268 */ |
| 131 | #define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AESdraft128-SHA" | 131 | #define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" |
| 132 | #define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AESdraft128-SHA" | 132 | #define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" |
| 133 | #define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AESdraft128-SHA" | 133 | #define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" |
| 134 | #define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AESdraft128-SHA" | 134 | #define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" |
| 135 | #define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AESdraft128-SHA" | 135 | #define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" |
| 136 | 136 | #define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" | |
| 137 | #define TLS1_TXT_RSA_WITH_AES_256_SHA "AESdraft256-SHA" | 137 | |
| 138 | #define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AESdraft256-SHA" | 138 | #define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" |
| 139 | #define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AESdraft256-SHA" | 139 | #define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" |
| 140 | #define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AESdraft256-SHA" | 140 | #define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" |
| 141 | #define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AESdraft256-SHA" | 141 | #define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" |
| 142 | #define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AESdraft256-SHA" | 142 | #define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" |
| 143 | #define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" | ||
| 143 | 144 | ||
| 144 | 145 | ||
| 145 | #define TLS_CT_RSA_SIGN 1 | 146 | #define TLS_CT_RSA_SIGN 1 |
