summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto')
-rw-r--r--src/lib/libcrypto/aes/aes_locl.h3
-rw-r--r--src/lib/libcrypto/asn1/a_strex.c11
-rw-r--r--src/lib/libcrypto/asn1/asn1.h1
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c11
-rw-r--r--src/lib/libcrypto/asn1/n_pkey.c4
-rw-r--r--src/lib/libcrypto/asn1/t_pkey.c88
-rw-r--r--src/lib/libcrypto/bio/b_sock.c4
-rw-r--r--src/lib/libcrypto/bio/bio.h3
-rw-r--r--src/lib/libcrypto/bio/bio_err.c1
-rw-r--r--src/lib/libcrypto/bio/bss_file.c6
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c6
-rw-r--r--src/lib/libcrypto/bn/bn_mul.c2
-rw-r--r--src/lib/libcrypto/conf/conf.h8
-rw-r--r--src/lib/libcrypto/conf/conf_def.c3
-rw-r--r--src/lib/libcrypto/conf/conf_lib.c5
-rw-r--r--src/lib/libcrypto/conf/conf_mod.c2
-rw-r--r--src/lib/libcrypto/cryptlib.c8
-rw-r--r--src/lib/libcrypto/cryptlib.h8
-rw-r--r--src/lib/libcrypto/doc/DH_get_ex_new_index.pod2
-rw-r--r--src/lib/libcrypto/doc/EVP_DigestInit.pod11
-rw-r--r--src/lib/libcrypto/doc/EVP_EncryptInit.pod5
-rw-r--r--src/lib/libcrypto/doc/EVP_SignInit.pod4
-rw-r--r--src/lib/libcrypto/doc/EVP_VerifyInit.pod2
-rw-r--r--src/lib/libcrypto/doc/RSA_check_key.pod32
-rw-r--r--src/lib/libcrypto/doc/rsa.pod2
-rw-r--r--src/lib/libcrypto/engine/eng_cnf.c2
-rw-r--r--src/lib/libcrypto/engine/eng_dyn.c24
-rw-r--r--src/lib/libcrypto/engine/eng_fat.c2
-rw-r--r--src/lib/libcrypto/err/err.c1
-rw-r--r--src/lib/libcrypto/err/err.h1
-rw-r--r--src/lib/libcrypto/evp/c_all.c2
-rw-r--r--src/lib/libcrypto/evp/evp.h56
-rw-r--r--src/lib/libcrypto/evp/evp_pbe.c2
-rw-r--r--src/lib/libcrypto/evp/p5_crpt.c2
-rw-r--r--src/lib/libcrypto/evp/p5_crpt2.c2
-rw-r--r--src/lib/libcrypto/objects/obj_dat.c2
-rw-r--r--src/lib/libcrypto/objects/obj_mac.num138
-rw-r--r--src/lib/libcrypto/objects/objects.txt148
-rw-r--r--src/lib/libcrypto/opensslv.h4
-rw-r--r--src/lib/libcrypto/pem/pem2.h2
-rw-r--r--src/lib/libcrypto/pem/pem_pkey.c1
-rw-r--r--src/lib/libcrypto/perlasm/x86asm.pl6
-rw-r--r--src/lib/libcrypto/pkcs12/pkcs12.h4
-rw-r--r--src/lib/libcrypto/rand/rand.h5
-rw-r--r--src/lib/libcrypto/rsa/rsa.h3
-rw-r--r--src/lib/libcrypto/ui/ui_openssl.c2
-rw-r--r--src/lib/libcrypto/ui/ui_util.c7
-rw-r--r--src/lib/libcrypto/x509v3/ext_dat.h4
-rw-r--r--src/lib/libcrypto/x509v3/v3_info.c1
49 files changed, 579 insertions, 74 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 */
81int send_mem_chars(void *arg, const void *buf, int len) 81static 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
90int send_bio_chars(void *arg, const void *buf, int len) 91static 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
97int send_fp_chars(void *arg, const void *buf, int len) 98static 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
243int do_dump(unsigned long lflags, char_io *io_ch, void *arg, ASN1_STRING *str) 244static 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);
773int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len); 773int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len);
774 774
775DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) 775DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
776DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
776DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) 777DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)
777DECLARE_ASN1_FUNCTIONS(ASN1_NULL) 778DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
778DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) 779DECLARE_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
63static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max); 64static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max);
64static void asn1_put_length(unsigned char **pp, int length); 65static 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);
137err: 136err:
@@ -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
407void asn1_add_error(unsigned char *address, int offset) 410void 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
95DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY)
96DECLARE_ASN1_ENCODE_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY,NETSCAPE_ENCRYPTED_PKEY)
95IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY) 97IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY)
96 98
97ASN1_SEQUENCE(NETSCAPE_PKEY) = { 99ASN1_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
105DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_PKEY)
106DECLARE_ASN1_ENCODE_FUNCTIONS_const(NETSCAPE_PKEY,NETSCAPE_PKEY)
103IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_PKEY) 107IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_PKEY)
104 108
105static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os, 109static 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)
281int DHparams_print(BIO *bp, const DH *x) 308int 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)
334int DSAparams_print(BIO *bp, const DSA *x) 366int 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);
554BIO_METHOD *BIO_s_connect(void); 554BIO_METHOD *BIO_s_connect(void);
555BIO_METHOD *BIO_s_accept(void); 555BIO_METHOD *BIO_s_accept(void);
556BIO_METHOD *BIO_s_fd(void); 556BIO_METHOD *BIO_s_fd(void);
557#ifndef OPENSSL_SYS_OS2
557BIO_METHOD *BIO_s_log(void); 558BIO_METHOD *BIO_s_log(void);
559#endif
558BIO_METHOD *BIO_s_bio(void); 560BIO_METHOD *BIO_s_bio(void);
559BIO_METHOD *BIO_s_null(void); 561BIO_METHOD *BIO_s_null(void);
560BIO_METHOD *BIO_f_null(void); 562BIO_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);
129int CONF_dump_bio(LHASH *conf, BIO *out); 129int CONF_dump_bio(LHASH *conf, BIO *out);
130 130
131void OPENSSL_config(const char *config_name); 131void OPENSSL_config(const char *config_name);
132void 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
143CONF *NCONF_new(CONF_METHOD *meth); 144CONF *NCONF_new(CONF_METHOD *meth);
144CONF_METHOD *NCONF_default(); 145CONF_METHOD *NCONF_default(void);
145CONF_METHOD *NCONF_WIN32(); 146CONF_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 */
147CONF_METHOD *NCONF_XML(); 148CONF_METHOD *NCONF_XML(void);
148#endif 149#endif
149void NCONF_free(CONF *conf); 150void NCONF_free(CONF *conf);
150void NCONF_free_data(CONF *conf); 151void 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);
177void CONF_modules_unload(int all); 178void CONF_modules_unload(int all);
178void CONF_modules_finish(void); 179void CONF_modules_finish(void);
180void CONF_modules_free(void);
179int CONF_module_add(const char *name, conf_init_func *ifunc, 181int 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
71static char *eat_ws(CONF *conf, char *p); 72static char *eat_ws(CONF *conf, char *p);
72static char *eat_alpha_numeric(CONF *conf, char *p); 73static char *eat_alpha_numeric(CONF *conf, char *p);
@@ -208,12 +209,12 @@ static int def_load(CONF *conf, const char *name, long *line)
208static int def_load_bio(CONF *conf, BIO *in, long *line) 209static 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
387long NCONF_get_number(CONF *conf,char *group,char *name) 388long 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
496void 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 */
97void 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
29L<RSA_get_ex_new_index()|RSA_get_ex_new_index()>, L<dh(3)|dh(3)> 29L<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
239L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, 239L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
240L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, 240L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>,
241L<sha(3)|sha(3)>, L<digest(1)|digest(1)> 241L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)>
242 242
243=head1 HISTORY 243=head1 HISTORY
244 244
245EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() are 245EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() are
246available in all versions of SSLeay and OpenSSL. 246available in all versions of SSLeay and OpenSSL.
247 247
248EVP_DigestInit_ex(), EVP_DigestFinal_ex() and EVP_MD_CTX_copy_ex() 248EVP_MD_CTX_init(), EVP_MD_CTX_create(), EVP_MD_CTX_copy_ex(),
249were added in OpenSSL 0.9.7. 249EVP_MD_CTX_cleanup(), EVP_MD_CTX_destroy(), EVP_DigestInit_ex()
250and EVP_DigestFinal_ex() were added in OpenSSL 0.9.7.
251
252EVP_md_null(), EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(),
253EVP_dss(), EVP_dss1(), EVP_mdc2() and EVP_ripemd160() were
254changed 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
504EVP_CIPHER_CTX_init(), EVP_EncryptInit_ex(), EVP_EncryptFinal_ex(),
505EVP_DecryptInit_ex(), EVP_DecryptFinal_ex(), EVP_CipherInit_ex(),
506EVP_CipherFinal_ex() and EVP_CIPHER_CTX_set_padding() appeared in
507OpenSSL 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)>,
84L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, 84L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>,
85L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, 85L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
86L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, 86L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>,
87L<sha(3)|sha(3)>, L<digest(1)|digest(1)> 87L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)>
88 88
89=head1 HISTORY 89=head1 HISTORY
90 90
91EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are 91EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are
92available in all versions of SSLeay and OpenSSL. 92available in all versions of SSLeay and OpenSSL.
93 93
94EVP_SignInit_ex() was added in OpenSSL 0.9.7 94EVP_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)>,
74L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, 74L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>,
75L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, 75L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
76L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, 76L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>,
77L<sha(3)|sha(3)>, L<digest(1)|digest(1)> 77L<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>.
18It also checks that B<d*e = 1 mod (p-1*q-1)>, 18It also checks that B<d*e = 1 mod (p-1*q-1)>,
19and that B<dmp1>, B<dmq1> and B<iqmp> are set correctly or are B<NULL>. 19and that B<dmp1>, B<dmq1> and B<iqmp> are set correctly or are B<NULL>.
20 20
21The key's public components may not be B<NULL>. 21As such, this function can not be used with any arbitrary RSA key object,
22even if it is otherwise fit for regular RSA operation. See B<NOTES> for more
23information.
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.
28If the key is invalid or an error occurred, the reason code can be 30If the key is invalid or an error occurred, the reason code can be
29obtained using L<ERR_get_error(3)|ERR_get_error(3)>. 31obtained using L<ERR_get_error(3)|ERR_get_error(3)>.
30 32
33=head1 NOTES
34
35This function does not work on RSA public keys that have only the modulus
36and public exponent elements populated. It performs integrity checks on all
37the RSA key material, so the RSA key structure must contain all the private
38key data too.
39
40Unlike most other RSA functions, this function does B<not> work
41transparently with any underlying ENGINE implementation because it uses the
42key data in the RSA structure directly. An ENGINE implementation can
43override the way key data is stored and handled, and can even provide
44support for HSM keys - in which case the RSA structure may contain B<no>
45key data at all! If the ENGINE in question is only being used for
46acceleration or analysis purposes, then in all likelihood the RSA key data
47is complete and untouched, but this can't be assumed in the general case.
48
49=head1 BUGS
50
51A method of verifying the RSA key using opaque RSA API functions might need
52to be considered. Right now RSA_check_key() simply uses the RSA structure
53elements directly, bypassing the RSA_METHOD table altogether (and
54completely violating encapsulation and object-orientation in the process).
55The best fix will probably be to introduce a "check_key()" handler to the
56RSA_METHOD function table so that alternative implementations can also
57provide their own verifiers.
58
31=head1 SEE ALSO 59=head1 SEE ALSO
32 60
33L<rsa(3)|rsa(3)>, L<err(3)|err(3)> 61L<rsa(3)|rsa(3)>, L<err(3)|err(3)>
34 62
35=head1 HISTORY 63=head1 HISTORY
36 64
37RSA_check() appeared in OpenSSL 0.9.4. 65RSA_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)>,
110L<RSA_set_method(3)|RSA_set_method(3)>, L<RSA_print(3)|RSA_print(3)>, 110L<RSA_set_method(3)|RSA_set_method(3)>, L<RSA_print(3)|RSA_print(3)>,
111L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, 111L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>,
112L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>, 112L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>,
113L<RSA_sign_ASN_OCTET_STRING(3)|RSA_sign_ASN_OCTET_STRING(3)>, 113L<RSA_sign_ASN1_OCTET_STRING(3)|RSA_sign_ASN1_OCTET_STRING(3)>,
114L<RSA_padding_add_PKCS1_type_1(3)|RSA_padding_add_PKCS1_type_1(3)> 114L<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
95int int_engine_configure(char *name, char *value, const CONF *cnf) 95static 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
87int int_def_cb(const char *alg, int len, void *arg) 87static 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
65void OpenSSL_add_all_algorithms(void) 66void 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
70void OPENSSL_add_all_algorithms_noconf(void) 72void 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 :-) */
582const EVP_CIPHER *EVP_des_ecb(void); 636const EVP_CIPHER *EVP_des_ecb(void);
583const EVP_CIPHER *EVP_des_ede(void); 637const EVP_CIPHER *EVP_des_ede(void);
584const EVP_CIPHER *EVP_des_ede3(void); 638const EVP_CIPHER *EVP_des_ede3(void);
639const EVP_CIPHER *EVP_des_ede_ecb(void);
640const EVP_CIPHER *EVP_des_ede3_ecb(void);
585const EVP_CIPHER *EVP_des_cfb(void); 641const EVP_CIPHER *EVP_des_cfb(void);
586const EVP_CIPHER *EVP_des_ede_cfb(void); 642const EVP_CIPHER *EVP_des_ede_cfb(void);
587const EVP_CIPHER *EVP_des_ede3_cfb(void); 643const 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
507id_hex_partial_message 507 507id_hex_partial_message 507
508id_hex_multipart_message 508 508id_hex_multipart_message 508
509generationQualifier 509 509generationQualifier 509
510pseudonym 510
511InternationalRA 511
512id_set 512
513set_ctype 513
514set_msgExt 514
515set_attr 515
516set_policy 516
517set_certExt 517
518set_brand 518
519setct_PANData 519
520setct_PANToken 520
521setct_PANOnly 521
522setct_OIData 522
523setct_PI 523
524setct_PIData 524
525setct_PIDataUnsigned 525
526setct_HODInput 526
527setct_AuthResBaggage 527
528setct_AuthRevReqBaggage 528
529setct_AuthRevResBaggage 529
530setct_CapTokenSeq 530
531setct_PInitResData 531
532setct_PI_TBS 532
533setct_PResData 533
534setct_AuthReqTBS 534
535setct_AuthResTBS 535
536setct_AuthResTBSX 536
537setct_AuthTokenTBS 537
538setct_CapTokenData 538
539setct_CapTokenTBS 539
540setct_AcqCardCodeMsg 540
541setct_AuthRevReqTBS 541
542setct_AuthRevResData 542
543setct_AuthRevResTBS 543
544setct_CapReqTBS 544
545setct_CapReqTBSX 545
546setct_CapResData 546
547setct_CapRevReqTBS 547
548setct_CapRevReqTBSX 548
549setct_CapRevResData 549
550setct_CredReqTBS 550
551setct_CredReqTBSX 551
552setct_CredResData 552
553setct_CredRevReqTBS 553
554setct_CredRevReqTBSX 554
555setct_CredRevResData 555
556setct_PCertReqData 556
557setct_PCertResTBS 557
558setct_BatchAdminReqData 558
559setct_BatchAdminResData 559
560setct_CardCInitResTBS 560
561setct_MeAqCInitResTBS 561
562setct_RegFormResTBS 562
563setct_CertReqData 563
564setct_CertReqTBS 564
565setct_CertResData 565
566setct_CertInqReqTBS 566
567setct_ErrorTBS 567
568setct_PIDualSignedTBE 568
569setct_PIUnsignedTBE 569
570setct_AuthReqTBE 570
571setct_AuthResTBE 571
572setct_AuthResTBEX 572
573setct_AuthTokenTBE 573
574setct_CapTokenTBE 574
575setct_CapTokenTBEX 575
576setct_AcqCardCodeMsgTBE 576
577setct_AuthRevReqTBE 577
578setct_AuthRevResTBE 578
579setct_AuthRevResTBEB 579
580setct_CapReqTBE 580
581setct_CapReqTBEX 581
582setct_CapResTBE 582
583setct_CapRevReqTBE 583
584setct_CapRevReqTBEX 584
585setct_CapRevResTBE 585
586setct_CredReqTBE 586
587setct_CredReqTBEX 587
588setct_CredResTBE 588
589setct_CredRevReqTBE 589
590setct_CredRevReqTBEX 590
591setct_CredRevResTBE 591
592setct_BatchAdminReqTBE 592
593setct_BatchAdminResTBE 593
594setct_RegFormReqTBE 594
595setct_CertReqTBE 595
596setct_CertReqTBEX 596
597setct_CertResTBE 597
598setct_CRLNotificationTBS 598
599setct_CRLNotificationResTBS 599
600setct_BCIDistributionTBS 600
601setext_genCrypt 601
602setext_miAuth 602
603setext_pinSecure 603
604setext_pinAny 604
605setext_track2 605
606setext_cv 606
607set_policy_root 607
608setCext_hashedRoot 608
609setCext_certType 609
610setCext_merchData 610
611setCext_cCertRequired 611
612setCext_tunneling 612
613setCext_setExt 613
614setCext_setQualf 614
615setCext_PGWYcapabilities 615
616setCext_TokenIdentifier 616
617setCext_Track2Data 617
618setCext_TokenType 618
619setCext_IssuerCapabilities 619
620setAttr_Cert 620
621setAttr_PGWYcap 621
622setAttr_TokenType 622
623setAttr_IssCap 623
624set_rootKeyThumb 624
625set_addPolicy 625
626setAttr_Token_EMV 626
627setAttr_Token_B0Prime 627
628setAttr_IssCap_CVM 628
629setAttr_IssCap_T2 629
630setAttr_IssCap_Sig 630
631setAttr_GenCryptgrm 631
632setAttr_T2Enc 632
633setAttr_T2cleartxt 633
634setAttr_TokICCsig 634
635setAttr_SecDevSig 635
636set_brand_IATA_ATA 636
637set_brand_Diners 637
638set_brand_AmericanExpress 638
639set_brand_JCB 639
640set_brand_Visa 640
641set_brand_MasterCard 641
642set_brand_Novus 642
643des_cdmf 643
644rsaOAEPEncryptionSET 644
645itu_t 645
646joint_iso_itu_t 646
647international_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
542X509 44 : : generationQualifier 542X509 44 : : generationQualifier
543X509 45 : : x500UniqueIdentifier 543X509 45 : : x500UniqueIdentifier
544X509 46 : dnQualifier : dnQualifier 544X509 46 : dnQualifier : dnQualifier
545X509 65 : : pseudonym
545X509 72 : role : role 546X509 72 : role : role
546 547
547X500 8 : X500algorithms : directory services - algorithms 548X500 8 : X500algorithms : directory services - algorithms
@@ -762,3 +763,150 @@ pilotAttributeType 53 : : personalSignature
762pilotAttributeType 54 : : dITRedirect 763pilotAttributeType 54 : : dITRedirect
763pilotAttributeType 55 : audio 764pilotAttributeType 55 : audio
764pilotAttributeType 56 : : documentPublisher 765pilotAttributeType 56 : : documentPublisher
766
7672 23 42 : id-set : Secure Electronic Transactions
768
769id-set 0 : set-ctype : content types
770id-set 1 : set-msgExt : message extensions
771id-set 3 : set-attr
772id-set 5 : set-policy
773id-set 7 : set-certExt : certificate extensions
774id-set 8 : set-brand
775
776set-ctype 0 : setct-PANData
777set-ctype 1 : setct-PANToken
778set-ctype 2 : setct-PANOnly
779set-ctype 3 : setct-OIData
780set-ctype 4 : setct-PI
781set-ctype 5 : setct-PIData
782set-ctype 6 : setct-PIDataUnsigned
783set-ctype 7 : setct-HODInput
784set-ctype 8 : setct-AuthResBaggage
785set-ctype 9 : setct-AuthRevReqBaggage
786set-ctype 10 : setct-AuthRevResBaggage
787set-ctype 11 : setct-CapTokenSeq
788set-ctype 12 : setct-PInitResData
789set-ctype 13 : setct-PI-TBS
790set-ctype 14 : setct-PResData
791set-ctype 16 : setct-AuthReqTBS
792set-ctype 17 : setct-AuthResTBS
793set-ctype 18 : setct-AuthResTBSX
794set-ctype 19 : setct-AuthTokenTBS
795set-ctype 20 : setct-CapTokenData
796set-ctype 21 : setct-CapTokenTBS
797set-ctype 22 : setct-AcqCardCodeMsg
798set-ctype 23 : setct-AuthRevReqTBS
799set-ctype 24 : setct-AuthRevResData
800set-ctype 25 : setct-AuthRevResTBS
801set-ctype 26 : setct-CapReqTBS
802set-ctype 27 : setct-CapReqTBSX
803set-ctype 28 : setct-CapResData
804set-ctype 29 : setct-CapRevReqTBS
805set-ctype 30 : setct-CapRevReqTBSX
806set-ctype 31 : setct-CapRevResData
807set-ctype 32 : setct-CredReqTBS
808set-ctype 33 : setct-CredReqTBSX
809set-ctype 34 : setct-CredResData
810set-ctype 35 : setct-CredRevReqTBS
811set-ctype 36 : setct-CredRevReqTBSX
812set-ctype 37 : setct-CredRevResData
813set-ctype 38 : setct-PCertReqData
814set-ctype 39 : setct-PCertResTBS
815set-ctype 40 : setct-BatchAdminReqData
816set-ctype 41 : setct-BatchAdminResData
817set-ctype 42 : setct-CardCInitResTBS
818set-ctype 43 : setct-MeAqCInitResTBS
819set-ctype 44 : setct-RegFormResTBS
820set-ctype 45 : setct-CertReqData
821set-ctype 46 : setct-CertReqTBS
822set-ctype 47 : setct-CertResData
823set-ctype 48 : setct-CertInqReqTBS
824set-ctype 49 : setct-ErrorTBS
825set-ctype 50 : setct-PIDualSignedTBE
826set-ctype 51 : setct-PIUnsignedTBE
827set-ctype 52 : setct-AuthReqTBE
828set-ctype 53 : setct-AuthResTBE
829set-ctype 54 : setct-AuthResTBEX
830set-ctype 55 : setct-AuthTokenTBE
831set-ctype 56 : setct-CapTokenTBE
832set-ctype 57 : setct-CapTokenTBEX
833set-ctype 58 : setct-AcqCardCodeMsgTBE
834set-ctype 59 : setct-AuthRevReqTBE
835set-ctype 60 : setct-AuthRevResTBE
836set-ctype 61 : setct-AuthRevResTBEB
837set-ctype 62 : setct-CapReqTBE
838set-ctype 63 : setct-CapReqTBEX
839set-ctype 64 : setct-CapResTBE
840set-ctype 65 : setct-CapRevReqTBE
841set-ctype 66 : setct-CapRevReqTBEX
842set-ctype 67 : setct-CapRevResTBE
843set-ctype 68 : setct-CredReqTBE
844set-ctype 69 : setct-CredReqTBEX
845set-ctype 70 : setct-CredResTBE
846set-ctype 71 : setct-CredRevReqTBE
847set-ctype 72 : setct-CredRevReqTBEX
848set-ctype 73 : setct-CredRevResTBE
849set-ctype 74 : setct-BatchAdminReqTBE
850set-ctype 75 : setct-BatchAdminResTBE
851set-ctype 76 : setct-RegFormReqTBE
852set-ctype 77 : setct-CertReqTBE
853set-ctype 78 : setct-CertReqTBEX
854set-ctype 79 : setct-CertResTBE
855set-ctype 80 : setct-CRLNotificationTBS
856set-ctype 81 : setct-CRLNotificationResTBS
857set-ctype 82 : setct-BCIDistributionTBS
858
859set-msgExt 1 : setext-genCrypt : generic cryptogram
860set-msgExt 3 : setext-miAuth : merchant initiated auth
861set-msgExt 4 : setext-pinSecure
862set-msgExt 5 : setext-pinAny
863set-msgExt 7 : setext-track2
864set-msgExt 8 : setext-cv : additional verification
865
866set-policy 0 : set-policy-root
867
868set-certExt 0 : setCext-hashedRoot
869set-certExt 1 : setCext-certType
870set-certExt 2 : setCext-merchData
871set-certExt 3 : setCext-cCertRequired
872set-certExt 4 : setCext-tunneling
873set-certExt 5 : setCext-setExt
874set-certExt 6 : setCext-setQualf
875set-certExt 7 : setCext-PGWYcapabilities
876set-certExt 8 : setCext-TokenIdentifier
877set-certExt 9 : setCext-Track2Data
878set-certExt 10 : setCext-TokenType
879set-certExt 11 : setCext-IssuerCapabilities
880
881set-attr 0 : setAttr-Cert
882set-attr 1 : setAttr-PGWYcap : payment gateway capabilities
883set-attr 2 : setAttr-TokenType
884set-attr 3 : setAttr-IssCap : issuer capabilities
885
886setAttr-Cert 0 : set-rootKeyThumb
887setAttr-Cert 1 : set-addPolicy
888
889setAttr-TokenType 1 : setAttr-Token-EMV
890setAttr-TokenType 2 : setAttr-Token-B0Prime
891
892setAttr-IssCap 3 : setAttr-IssCap-CVM
893setAttr-IssCap 4 : setAttr-IssCap-T2
894setAttr-IssCap 5 : setAttr-IssCap-Sig
895
896setAttr-IssCap-CVM 1 : setAttr-GenCryptgrm : generate cryptogram
897setAttr-IssCap-T2 1 : setAttr-T2Enc : encrypted track 2
898setAttr-IssCap-T2 2 : setAttr-T2cleartxt : cleartext track 2
899
900setAttr-IssCap-Sig 1 : setAttr-TokICCsig : ICC or token signature
901setAttr-IssCap-Sig 2 : setAttr-SecDevSig : secure device signature
902
903set-brand 1 : set-brand-IATA-ATA
904set-brand 30 : set-brand-Diners
905set-brand 34 : set-brand-AmericanExpress
906set-brand 35 : set-brand-JCB
907set-brand 4 : set-brand-Visa
908set-brand 5 : set-brand-MasterCard
909set-brand 6011 : set-brand-Novus
910
911rsadsi 3 10 : DES-CDMF : des-cdmf
912rsadsi 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 @@
61extern "C" { 61extern "C" {
62#endif 62#endif
63 63
64#ifndef HEADER_PEM_H
64void ERR_load_PEM_strings(void); 65void 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
66extern "C" { 71extern "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,
276int RSA_set_ex_data(RSA *r,int idx,void *arg); 276int RSA_set_ex_data(RSA *r,int idx,void *arg);
277void *RSA_get_ex_data(const RSA *r, int idx); 277void *RSA_get_ex_data(const RSA *r, int idx);
278 278
279RSA *RSAPublicKey_dup(RSA *rsa);
280RSA *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
269static long status; 269static long status;
270static unsigned short channel = 0; 270static unsigned short channel = 0;
271#else 271#else
272#ifndef OPENSSL_SYS_MSDOS 272#if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__)
273static TTY_STRUCT tty_orig,tty_new; 273static 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))) {