diff options
Diffstat (limited to 'src')
558 files changed, 8825 insertions, 2743 deletions
diff --git a/src/lib/libcrypto/aes/aes.h b/src/lib/libcrypto/aes/aes.h index da067f4a8f..8a3ea0b883 100644 --- a/src/lib/libcrypto/aes/aes.h +++ b/src/lib/libcrypto/aes/aes.h | |||
@@ -52,6 +52,8 @@ | |||
52 | #ifndef HEADER_AES_H | 52 | #ifndef HEADER_AES_H |
53 | #define HEADER_AES_H | 53 | #define HEADER_AES_H |
54 | 54 | ||
55 | #include <openssl/e_os2.h> | ||
56 | |||
55 | #ifdef OPENSSL_NO_AES | 57 | #ifdef OPENSSL_NO_AES |
56 | #error AES is disabled. | 58 | #error AES is disabled. |
57 | #endif | 59 | #endif |
@@ -64,6 +66,10 @@ | |||
64 | #define AES_MAXNR 14 | 66 | #define AES_MAXNR 14 |
65 | #define AES_BLOCK_SIZE 16 | 67 | #define AES_BLOCK_SIZE 16 |
66 | 68 | ||
69 | #if defined(OPENSSL_FIPS) | ||
70 | #define FIPS_AES_SIZE_T int | ||
71 | #endif | ||
72 | |||
67 | #ifdef __cplusplus | 73 | #ifdef __cplusplus |
68 | extern "C" { | 74 | extern "C" { |
69 | #endif | 75 | #endif |
@@ -95,6 +101,15 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | |||
95 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, | 101 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, |
96 | const unsigned long length, const AES_KEY *key, | 102 | const unsigned long length, const AES_KEY *key, |
97 | unsigned char *ivec, int *num, const int enc); | 103 | unsigned char *ivec, int *num, const int enc); |
104 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, | ||
105 | const unsigned long length, const AES_KEY *key, | ||
106 | unsigned char *ivec, int *num, const int enc); | ||
107 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, | ||
108 | const unsigned long length, const AES_KEY *key, | ||
109 | unsigned char *ivec, int *num, const int enc); | ||
110 | void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out, | ||
111 | const int nbits,const AES_KEY *key, | ||
112 | unsigned char *ivec,const int enc); | ||
98 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, | 113 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, |
99 | const unsigned long length, const AES_KEY *key, | 114 | const unsigned long length, const AES_KEY *key, |
100 | unsigned char *ivec, int *num); | 115 | unsigned char *ivec, int *num); |
diff --git a/src/lib/libcrypto/aes/aes_cbc.c b/src/lib/libcrypto/aes/aes_cbc.c index 1222a21002..d2ba6bcdb4 100644 --- a/src/lib/libcrypto/aes/aes_cbc.c +++ b/src/lib/libcrypto/aes/aes_cbc.c | |||
@@ -66,6 +66,7 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | |||
66 | unsigned long n; | 66 | unsigned long n; |
67 | unsigned long len = length; | 67 | unsigned long len = length; |
68 | unsigned char tmp[AES_BLOCK_SIZE]; | 68 | unsigned char tmp[AES_BLOCK_SIZE]; |
69 | const unsigned char *iv = ivec; | ||
69 | 70 | ||
70 | assert(in && out && key && ivec); | 71 | assert(in && out && key && ivec); |
71 | assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc)); | 72 | assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc)); |
@@ -73,22 +74,39 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | |||
73 | if (AES_ENCRYPT == enc) { | 74 | if (AES_ENCRYPT == enc) { |
74 | while (len >= AES_BLOCK_SIZE) { | 75 | while (len >= AES_BLOCK_SIZE) { |
75 | for(n=0; n < AES_BLOCK_SIZE; ++n) | 76 | for(n=0; n < AES_BLOCK_SIZE; ++n) |
76 | tmp[n] = in[n] ^ ivec[n]; | 77 | out[n] = in[n] ^ iv[n]; |
77 | AES_encrypt(tmp, out, key); | 78 | AES_encrypt(out, out, key); |
78 | memcpy(ivec, out, AES_BLOCK_SIZE); | 79 | iv = out; |
79 | len -= AES_BLOCK_SIZE; | 80 | len -= AES_BLOCK_SIZE; |
80 | in += AES_BLOCK_SIZE; | 81 | in += AES_BLOCK_SIZE; |
81 | out += AES_BLOCK_SIZE; | 82 | out += AES_BLOCK_SIZE; |
82 | } | 83 | } |
83 | if (len) { | 84 | if (len) { |
84 | for(n=0; n < len; ++n) | 85 | for(n=0; n < len; ++n) |
85 | tmp[n] = in[n] ^ ivec[n]; | 86 | out[n] = in[n] ^ iv[n]; |
86 | for(n=len; n < AES_BLOCK_SIZE; ++n) | 87 | for(n=len; n < AES_BLOCK_SIZE; ++n) |
87 | tmp[n] = ivec[n]; | 88 | out[n] = iv[n]; |
88 | AES_encrypt(tmp, tmp, key); | 89 | AES_encrypt(out, out, key); |
89 | memcpy(out, tmp, AES_BLOCK_SIZE); | 90 | iv = out; |
90 | memcpy(ivec, tmp, AES_BLOCK_SIZE); | 91 | } |
91 | } | 92 | memcpy(ivec,iv,AES_BLOCK_SIZE); |
93 | } else if (in != out) { | ||
94 | while (len >= AES_BLOCK_SIZE) { | ||
95 | AES_decrypt(in, out, key); | ||
96 | for(n=0; n < AES_BLOCK_SIZE; ++n) | ||
97 | out[n] ^= iv[n]; | ||
98 | iv = in; | ||
99 | len -= AES_BLOCK_SIZE; | ||
100 | in += AES_BLOCK_SIZE; | ||
101 | out += AES_BLOCK_SIZE; | ||
102 | } | ||
103 | if (len) { | ||
104 | AES_decrypt(in,tmp,key); | ||
105 | for(n=0; n < len; ++n) | ||
106 | out[n] = tmp[n] ^ iv[n]; | ||
107 | iv = in; | ||
108 | } | ||
109 | memcpy(ivec,iv,AES_BLOCK_SIZE); | ||
92 | } else { | 110 | } else { |
93 | while (len >= AES_BLOCK_SIZE) { | 111 | while (len >= AES_BLOCK_SIZE) { |
94 | memcpy(tmp, in, AES_BLOCK_SIZE); | 112 | memcpy(tmp, in, AES_BLOCK_SIZE); |
@@ -102,10 +120,12 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | |||
102 | } | 120 | } |
103 | if (len) { | 121 | if (len) { |
104 | memcpy(tmp, in, AES_BLOCK_SIZE); | 122 | memcpy(tmp, in, AES_BLOCK_SIZE); |
105 | AES_decrypt(tmp, tmp, key); | 123 | AES_decrypt(tmp, out, key); |
106 | for(n=0; n < len; ++n) | 124 | for(n=0; n < len; ++n) |
107 | out[n] = tmp[n] ^ ivec[n]; | 125 | out[n] ^= ivec[n]; |
126 | for(n=len; n < AES_BLOCK_SIZE; ++n) | ||
127 | out[n] = tmp[n]; | ||
108 | memcpy(ivec, tmp, AES_BLOCK_SIZE); | 128 | memcpy(ivec, tmp, AES_BLOCK_SIZE); |
109 | } | 129 | } |
110 | } | 130 | } |
111 | } | 131 | } |
diff --git a/src/lib/libcrypto/aes/aes_cfb.c b/src/lib/libcrypto/aes/aes_cfb.c index 9b569dda90..49f0411010 100644 --- a/src/lib/libcrypto/aes/aes_cfb.c +++ b/src/lib/libcrypto/aes/aes_cfb.c | |||
@@ -114,6 +114,7 @@ | |||
114 | 114 | ||
115 | #include <openssl/aes.h> | 115 | #include <openssl/aes.h> |
116 | #include "aes_locl.h" | 116 | #include "aes_locl.h" |
117 | #include "e_os.h" | ||
117 | 118 | ||
118 | /* The input and output encrypted as though 128bit cfb mode is being | 119 | /* The input and output encrypted as though 128bit cfb mode is being |
119 | * used. The extra state information to record how much of the | 120 | * used. The extra state information to record how much of the |
@@ -155,3 +156,70 @@ void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, | |||
155 | *num=n; | 156 | *num=n; |
156 | } | 157 | } |
157 | 158 | ||
159 | /* This expects a single block of size nbits for both in and out. Note that | ||
160 | it corrupts any extra bits in the last byte of out */ | ||
161 | void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out, | ||
162 | const int nbits,const AES_KEY *key, | ||
163 | unsigned char *ivec,const int enc) | ||
164 | { | ||
165 | int n,rem,num; | ||
166 | unsigned char ovec[AES_BLOCK_SIZE*2]; | ||
167 | |||
168 | if (nbits<=0 || nbits>128) return; | ||
169 | |||
170 | /* fill in the first half of the new IV with the current IV */ | ||
171 | memcpy(ovec,ivec,AES_BLOCK_SIZE); | ||
172 | /* construct the new IV */ | ||
173 | AES_encrypt(ivec,ivec,key); | ||
174 | num = (nbits+7)/8; | ||
175 | if (enc) /* encrypt the input */ | ||
176 | for(n=0 ; n < num ; ++n) | ||
177 | out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n] ^ ivec[n]); | ||
178 | else /* decrypt the input */ | ||
179 | for(n=0 ; n < num ; ++n) | ||
180 | out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n]) ^ ivec[n]; | ||
181 | /* shift ovec left... */ | ||
182 | rem = nbits%8; | ||
183 | num = nbits/8; | ||
184 | if(rem==0) | ||
185 | memcpy(ivec,ovec+num,AES_BLOCK_SIZE); | ||
186 | else | ||
187 | for(n=0 ; n < AES_BLOCK_SIZE ; ++n) | ||
188 | ivec[n] = ovec[n+num]<<rem | ovec[n+num+1]>>(8-rem); | ||
189 | |||
190 | /* it is not necessary to cleanse ovec, since the IV is not secret */ | ||
191 | } | ||
192 | |||
193 | /* N.B. This expects the input to be packed, MS bit first */ | ||
194 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, | ||
195 | const unsigned long length, const AES_KEY *key, | ||
196 | unsigned char *ivec, int *num, const int enc) | ||
197 | { | ||
198 | unsigned int n; | ||
199 | unsigned char c[1],d[1]; | ||
200 | |||
201 | assert(in && out && key && ivec && num); | ||
202 | assert(*num == 0); | ||
203 | |||
204 | memset(out,0,(length+7)/8); | ||
205 | for(n=0 ; n < length ; ++n) | ||
206 | { | ||
207 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | ||
208 | AES_cfbr_encrypt_block(c,d,1,key,ivec,enc); | ||
209 | out[n/8]=(out[n/8]&~(1 << (7-n%8)))|((d[0]&0x80) >> (n%8)); | ||
210 | } | ||
211 | } | ||
212 | |||
213 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, | ||
214 | const unsigned long length, const AES_KEY *key, | ||
215 | unsigned char *ivec, int *num, const int enc) | ||
216 | { | ||
217 | unsigned int n; | ||
218 | |||
219 | assert(in && out && key && ivec && num); | ||
220 | assert(*num == 0); | ||
221 | |||
222 | for(n=0 ; n < length ; ++n) | ||
223 | AES_cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc); | ||
224 | } | ||
225 | |||
diff --git a/src/lib/libcrypto/aes/aes_core.c b/src/lib/libcrypto/aes/aes_core.c index 2f41a825f8..ed566a8123 100644 --- a/src/lib/libcrypto/aes/aes_core.c +++ b/src/lib/libcrypto/aes/aes_core.c | |||
@@ -37,8 +37,11 @@ | |||
37 | 37 | ||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <openssl/aes.h> | 39 | #include <openssl/aes.h> |
40 | #include <openssl/fips.h> | ||
40 | #include "aes_locl.h" | 41 | #include "aes_locl.h" |
41 | 42 | ||
43 | #ifndef OPENSSL_FIPS | ||
44 | |||
42 | /* | 45 | /* |
43 | Te0[x] = S [x].[02, 01, 01, 03]; | 46 | Te0[x] = S [x].[02, 01, 01, 03]; |
44 | Te1[x] = S [x].[03, 02, 01, 01]; | 47 | Te1[x] = S [x].[03, 02, 01, 01]; |
@@ -1255,3 +1258,4 @@ void AES_decrypt(const unsigned char *in, unsigned char *out, | |||
1255 | PUTU32(out + 12, s3); | 1258 | PUTU32(out + 12, s3); |
1256 | } | 1259 | } |
1257 | 1260 | ||
1261 | #endif /* ndef OPENSSL_FIPS */ | ||
diff --git a/src/lib/libcrypto/aes/aes_ctr.c b/src/lib/libcrypto/aes/aes_ctr.c index 79e1c18f19..f36982be1e 100644 --- a/src/lib/libcrypto/aes/aes_ctr.c +++ b/src/lib/libcrypto/aes/aes_ctr.c | |||
@@ -59,7 +59,7 @@ | |||
59 | #include <openssl/aes.h> | 59 | #include <openssl/aes.h> |
60 | #include "aes_locl.h" | 60 | #include "aes_locl.h" |
61 | 61 | ||
62 | /* NOTE: CTR mode is big-endian. The rest of the AES code | 62 | /* NOTE: the IV/counter CTR mode is big-endian. The rest of the AES code |
63 | * is endian-neutral. */ | 63 | * is endian-neutral. */ |
64 | 64 | ||
65 | /* increment counter (128-bit int) by 1 */ | 65 | /* increment counter (128-bit int) by 1 */ |
@@ -67,61 +67,36 @@ static void AES_ctr128_inc(unsigned char *counter) { | |||
67 | unsigned long c; | 67 | unsigned long c; |
68 | 68 | ||
69 | /* Grab bottom dword of counter and increment */ | 69 | /* Grab bottom dword of counter and increment */ |
70 | #ifdef L_ENDIAN | ||
71 | c = GETU32(counter + 0); | ||
72 | c++; | ||
73 | PUTU32(counter + 0, c); | ||
74 | #else | ||
75 | c = GETU32(counter + 12); | 70 | c = GETU32(counter + 12); |
76 | c++; | 71 | c++; c &= 0xFFFFFFFF; |
77 | PUTU32(counter + 12, c); | 72 | PUTU32(counter + 12, c); |
78 | #endif | ||
79 | 73 | ||
80 | /* if no overflow, we're done */ | 74 | /* if no overflow, we're done */ |
81 | if (c) | 75 | if (c) |
82 | return; | 76 | return; |
83 | 77 | ||
84 | /* Grab 1st dword of counter and increment */ | 78 | /* Grab 1st dword of counter and increment */ |
85 | #ifdef L_ENDIAN | ||
86 | c = GETU32(counter + 4); | ||
87 | c++; | ||
88 | PUTU32(counter + 4, c); | ||
89 | #else | ||
90 | c = GETU32(counter + 8); | 79 | c = GETU32(counter + 8); |
91 | c++; | 80 | c++; c &= 0xFFFFFFFF; |
92 | PUTU32(counter + 8, c); | 81 | PUTU32(counter + 8, c); |
93 | #endif | ||
94 | 82 | ||
95 | /* if no overflow, we're done */ | 83 | /* if no overflow, we're done */ |
96 | if (c) | 84 | if (c) |
97 | return; | 85 | return; |
98 | 86 | ||
99 | /* Grab 2nd dword of counter and increment */ | 87 | /* Grab 2nd dword of counter and increment */ |
100 | #ifdef L_ENDIAN | ||
101 | c = GETU32(counter + 8); | ||
102 | c++; | ||
103 | PUTU32(counter + 8, c); | ||
104 | #else | ||
105 | c = GETU32(counter + 4); | 88 | c = GETU32(counter + 4); |
106 | c++; | 89 | c++; c &= 0xFFFFFFFF; |
107 | PUTU32(counter + 4, c); | 90 | PUTU32(counter + 4, c); |
108 | #endif | ||
109 | 91 | ||
110 | /* if no overflow, we're done */ | 92 | /* if no overflow, we're done */ |
111 | if (c) | 93 | if (c) |
112 | return; | 94 | return; |
113 | 95 | ||
114 | /* Grab top dword of counter and increment */ | 96 | /* Grab top dword of counter and increment */ |
115 | #ifdef L_ENDIAN | ||
116 | c = GETU32(counter + 12); | ||
117 | c++; | ||
118 | PUTU32(counter + 12, c); | ||
119 | #else | ||
120 | c = GETU32(counter + 0); | 97 | c = GETU32(counter + 0); |
121 | c++; | 98 | c++; c &= 0xFFFFFFFF; |
122 | PUTU32(counter + 0, c); | 99 | PUTU32(counter + 0, c); |
123 | #endif | ||
124 | |||
125 | } | 100 | } |
126 | 101 | ||
127 | /* The input encrypted as though 128bit counter mode is being | 102 | /* The input encrypted as though 128bit counter mode is being |
diff --git a/src/lib/libcrypto/aes/aes_locl.h b/src/lib/libcrypto/aes/aes_locl.h index f290946058..4184729e34 100644 --- a/src/lib/libcrypto/aes/aes_locl.h +++ b/src/lib/libcrypto/aes/aes_locl.h | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <stdlib.h> | 62 | #include <stdlib.h> |
63 | #include <string.h> | 63 | #include <string.h> |
64 | 64 | ||
65 | #if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE) | 65 | #if defined(_MSC_VER) && !defined(_M_IA64) && !defined(OPENSSL_SYS_WINCE) |
66 | # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) | 66 | # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) |
67 | # define GETU32(p) SWAP(*((u32 *)(p))) | 67 | # define GETU32(p) SWAP(*((u32 *)(p))) |
68 | # define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } | 68 | # define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } |
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index f4ea96cd54..b81bf4fc81 100644 --- a/src/lib/libcrypto/asn1/a_bitstr.c +++ b/src/lib/libcrypto/asn1/a_bitstr.c | |||
@@ -194,8 +194,12 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) | |||
194 | c=(unsigned char *)OPENSSL_realloc_clean(a->data, | 194 | c=(unsigned char *)OPENSSL_realloc_clean(a->data, |
195 | a->length, | 195 | a->length, |
196 | w+1); | 196 | w+1); |
197 | if (c == NULL) return(0); | 197 | if (c == NULL) |
198 | if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length); | 198 | { |
199 | ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT,ERR_R_MALLOC_FAILURE); | ||
200 | return 0; | ||
201 | } | ||
202 | if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length); | ||
199 | a->data=c; | 203 | a->data=c; |
200 | a->length=w+1; | 204 | a->length=w+1; |
201 | } | 205 | } |
diff --git a/src/lib/libcrypto/asn1/a_digest.c b/src/lib/libcrypto/asn1/a_digest.c index 4931e222a0..7182e9fa5d 100644 --- a/src/lib/libcrypto/asn1/a_digest.c +++ b/src/lib/libcrypto/asn1/a_digest.c | |||
@@ -65,6 +65,7 @@ | |||
65 | # include <sys/types.h> | 65 | # include <sys/types.h> |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #include <openssl/err.h> | ||
68 | #include <openssl/evp.h> | 69 | #include <openssl/evp.h> |
69 | #include <openssl/buffer.h> | 70 | #include <openssl/buffer.h> |
70 | #include <openssl/x509.h> | 71 | #include <openssl/x509.h> |
@@ -78,7 +79,11 @@ int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data, | |||
78 | unsigned char *str,*p; | 79 | unsigned char *str,*p; |
79 | 80 | ||
80 | i=i2d(data,NULL); | 81 | i=i2d(data,NULL); |
81 | if ((str=(unsigned char *)OPENSSL_malloc(i)) == NULL) return(0); | 82 | if ((str=(unsigned char *)OPENSSL_malloc(i)) == NULL) |
83 | { | ||
84 | ASN1err(ASN1_F_ASN1_DIGEST,ERR_R_MALLOC_FAILURE); | ||
85 | return(0); | ||
86 | } | ||
82 | p=str; | 87 | p=str; |
83 | i2d(data,&p); | 88 | i2d(data,&p); |
84 | 89 | ||
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c index ad8f0ffd1a..03ede68d1c 100644 --- a/src/lib/libcrypto/asn1/a_enum.c +++ b/src/lib/libcrypto/asn1/a_enum.c | |||
@@ -156,7 +156,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai) | |||
156 | unsigned char *new_data=OPENSSL_realloc(ret->data, len+4); | 156 | unsigned char *new_data=OPENSSL_realloc(ret->data, len+4); |
157 | if (!new_data) | 157 | if (!new_data) |
158 | { | 158 | { |
159 | ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); | 159 | ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); |
160 | goto err; | 160 | goto err; |
161 | } | 161 | } |
162 | ret->data=new_data; | 162 | ret->data=new_data; |
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c index 8581007868..0dfd576211 100644 --- a/src/lib/libcrypto/asn1/a_gentm.c +++ b/src/lib/libcrypto/asn1/a_gentm.c | |||
@@ -192,8 +192,9 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str) | |||
192 | { | 192 | { |
193 | if (s != NULL) | 193 | if (s != NULL) |
194 | { | 194 | { |
195 | ASN1_STRING_set((ASN1_STRING *)s, | 195 | if (!ASN1_STRING_set((ASN1_STRING *)s, |
196 | (unsigned char *)str,t.length); | 196 | (unsigned char *)str,t.length)) |
197 | return 0; | ||
197 | s->type=V_ASN1_GENERALIZEDTIME; | 198 | s->type=V_ASN1_GENERALIZEDTIME; |
198 | } | 199 | } |
199 | return(1); | 200 | return(1); |
@@ -223,7 +224,12 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, | |||
223 | if ((p == NULL) || ((size_t)s->length < len)) | 224 | if ((p == NULL) || ((size_t)s->length < len)) |
224 | { | 225 | { |
225 | p=OPENSSL_malloc(len); | 226 | p=OPENSSL_malloc(len); |
226 | if (p == NULL) return(NULL); | 227 | if (p == NULL) |
228 | { | ||
229 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_SET, | ||
230 | ERR_R_MALLOC_FAILURE); | ||
231 | return(NULL); | ||
232 | } | ||
227 | if (s->data != NULL) | 233 | if (s->data != NULL) |
228 | OPENSSL_free(s->data); | 234 | OPENSSL_free(s->data); |
229 | s->data=(unsigned char *)p; | 235 | s->data=(unsigned char *)p; |
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c index edb243c021..21cc64bb23 100644 --- a/src/lib/libcrypto/asn1/a_int.c +++ b/src/lib/libcrypto/asn1/a_int.c | |||
@@ -64,7 +64,26 @@ ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x) | |||
64 | { return M_ASN1_INTEGER_dup(x);} | 64 | { return M_ASN1_INTEGER_dup(x);} |
65 | 65 | ||
66 | int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y) | 66 | int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y) |
67 | { return M_ASN1_INTEGER_cmp(x,y);} | 67 | { |
68 | int neg, ret; | ||
69 | /* Compare signs */ | ||
70 | neg = x->type & V_ASN1_NEG; | ||
71 | if (neg != (y->type & V_ASN1_NEG)) | ||
72 | { | ||
73 | if (neg) | ||
74 | return -1; | ||
75 | else | ||
76 | return 1; | ||
77 | } | ||
78 | |||
79 | ret = ASN1_STRING_cmp(x, y); | ||
80 | |||
81 | if (neg) | ||
82 | return -ret; | ||
83 | else | ||
84 | return ret; | ||
85 | } | ||
86 | |||
68 | 87 | ||
69 | /* | 88 | /* |
70 | * This converts an ASN1 INTEGER into its content encoding. | 89 | * This converts an ASN1 INTEGER into its content encoding. |
diff --git a/src/lib/libcrypto/asn1/a_print.c b/src/lib/libcrypto/asn1/a_print.c index 8035513f04..d18e772320 100644 --- a/src/lib/libcrypto/asn1/a_print.c +++ b/src/lib/libcrypto/asn1/a_print.c | |||
@@ -60,7 +60,7 @@ | |||
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
62 | 62 | ||
63 | int ASN1_PRINTABLE_type(unsigned char *s, int len) | 63 | int ASN1_PRINTABLE_type(const unsigned char *s, int len) |
64 | { | 64 | { |
65 | int c; | 65 | int c; |
66 | int ia5=0; | 66 | int ia5=0; |
diff --git a/src/lib/libcrypto/asn1/a_set.c b/src/lib/libcrypto/asn1/a_set.c index 0f839822ff..e24061c545 100644 --- a/src/lib/libcrypto/asn1/a_set.c +++ b/src/lib/libcrypto/asn1/a_set.c | |||
@@ -118,8 +118,13 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag, | |||
118 | } | 118 | } |
119 | 119 | ||
120 | pStart = p; /* Catch the beg of Setblobs*/ | 120 | pStart = p; /* Catch the beg of Setblobs*/ |
121 | if (!(rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)))) return 0; /* In this array | 121 | /* In this array we will store the SET blobs */ |
122 | we will store the SET blobs */ | 122 | rgSetBlob = (MYBLOB *)OPENSSL_malloc(sk_num(a) * sizeof(MYBLOB)); |
123 | if (rgSetBlob == NULL) | ||
124 | { | ||
125 | ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE); | ||
126 | return(0); | ||
127 | } | ||
123 | 128 | ||
124 | for (i=0; i<sk_num(a); i++) | 129 | for (i=0; i<sk_num(a); i++) |
125 | { | 130 | { |
@@ -135,7 +140,11 @@ SetBlob | |||
135 | /* Now we have to sort the blobs. I am using a simple algo. | 140 | /* Now we have to sort the blobs. I am using a simple algo. |
136 | *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ | 141 | *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ |
137 | qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); | 142 | qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); |
138 | if (!(pTempMem = OPENSSL_malloc(totSize))) return 0; | 143 | if (!(pTempMem = OPENSSL_malloc(totSize))) |
144 | { | ||
145 | ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE); | ||
146 | return(0); | ||
147 | } | ||
139 | 148 | ||
140 | /* Copy to temp mem */ | 149 | /* Copy to temp mem */ |
141 | p = pTempMem; | 150 | p = pTempMem; |
@@ -160,7 +169,13 @@ STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length, | |||
160 | STACK *ret=NULL; | 169 | STACK *ret=NULL; |
161 | 170 | ||
162 | if ((a == NULL) || ((*a) == NULL)) | 171 | if ((a == NULL) || ((*a) == NULL)) |
163 | { if ((ret=sk_new_null()) == NULL) goto err; } | 172 | { |
173 | if ((ret=sk_new_null()) == NULL) | ||
174 | { | ||
175 | ASN1err(ASN1_F_D2I_ASN1_SET,ERR_R_MALLOC_FAILURE); | ||
176 | goto err; | ||
177 | } | ||
178 | } | ||
164 | else | 179 | else |
165 | ret=(*a); | 180 | ret=(*a); |
166 | 181 | ||
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c index bde666a6ff..a07122ba47 100644 --- a/src/lib/libcrypto/asn1/a_strex.c +++ b/src/lib/libcrypto/asn1/a_strex.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2000-2004 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -553,7 +553,12 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in) | |||
553 | if((type < 0) || (type > 30)) return -1; | 553 | if((type < 0) || (type > 30)) return -1; |
554 | mbflag = tag2nbyte[type]; | 554 | mbflag = tag2nbyte[type]; |
555 | if(mbflag == -1) return -1; | 555 | if(mbflag == -1) return -1; |
556 | mbflag |= MBSTRING_FLAG; | 556 | if (mbflag == 0) |
557 | mbflag = MBSTRING_UTF8; | ||
558 | else if (mbflag == 4) | ||
559 | mbflag = MBSTRING_UNIV; | ||
560 | else | ||
561 | mbflag |= MBSTRING_FLAG; | ||
557 | stmp.data = NULL; | 562 | stmp.data = NULL; |
558 | ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); | 563 | ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); |
559 | if(ret < 0) return ret; | 564 | if(ret < 0) return ret; |
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c index fe3fcd40b0..2292d49b93 100644 --- a/src/lib/libcrypto/asn1/a_type.c +++ b/src/lib/libcrypto/asn1/a_type.c | |||
@@ -71,7 +71,10 @@ int ASN1_TYPE_get(ASN1_TYPE *a) | |||
71 | void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) | 71 | void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) |
72 | { | 72 | { |
73 | if (a->value.ptr != NULL) | 73 | if (a->value.ptr != NULL) |
74 | ASN1_primitive_free((ASN1_VALUE **)&a, NULL); | 74 | { |
75 | ASN1_TYPE **tmp_a = &a; | ||
76 | ASN1_primitive_free((ASN1_VALUE **)tmp_a, NULL); | ||
77 | } | ||
75 | a->type=type; | 78 | a->type=type; |
76 | a->value.ptr=value; | 79 | a->value.ptr=value; |
77 | } | 80 | } |
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c index 999852dae5..7b25fed331 100644 --- a/src/lib/libcrypto/asn1/a_utctm.c +++ b/src/lib/libcrypto/asn1/a_utctm.c | |||
@@ -173,8 +173,9 @@ int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str) | |||
173 | { | 173 | { |
174 | if (s != NULL) | 174 | if (s != NULL) |
175 | { | 175 | { |
176 | ASN1_STRING_set((ASN1_STRING *)s, | 176 | if (!ASN1_STRING_set((ASN1_STRING *)s, |
177 | (unsigned char *)str,t.length); | 177 | (unsigned char *)str,t.length)) |
178 | return 0; | ||
178 | s->type = V_ASN1_UTCTIME; | 179 | s->type = V_ASN1_UTCTIME; |
179 | } | 180 | } |
180 | return(1); | 181 | return(1); |
@@ -203,7 +204,11 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) | |||
203 | if ((p == NULL) || ((size_t)s->length < len)) | 204 | if ((p == NULL) || ((size_t)s->length < len)) |
204 | { | 205 | { |
205 | p=OPENSSL_malloc(len); | 206 | p=OPENSSL_malloc(len); |
206 | if (p == NULL) return(NULL); | 207 | if (p == NULL) |
208 | { | ||
209 | ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE); | ||
210 | return(NULL); | ||
211 | } | ||
207 | if (s->data != NULL) | 212 | if (s->data != NULL) |
208 | OPENSSL_free(s->data); | 213 | OPENSSL_free(s->data); |
209 | s->data=(unsigned char *)p; | 214 | s->data=(unsigned char *)p; |
diff --git a/src/lib/libcrypto/asn1/a_verify.c b/src/lib/libcrypto/asn1/a_verify.c index da2a0a6d69..18ef0acf00 100644 --- a/src/lib/libcrypto/asn1/a_verify.c +++ b/src/lib/libcrypto/asn1/a_verify.c | |||
@@ -142,6 +142,13 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat | |||
142 | goto err; | 142 | goto err; |
143 | } | 143 | } |
144 | 144 | ||
145 | if (!EVP_VerifyInit_ex(&ctx,type, NULL)) | ||
146 | { | ||
147 | ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB); | ||
148 | ret=0; | ||
149 | goto err; | ||
150 | } | ||
151 | |||
145 | inl = ASN1_item_i2d(asn, &buf_in, it); | 152 | inl = ASN1_item_i2d(asn, &buf_in, it); |
146 | 153 | ||
147 | if (buf_in == NULL) | 154 | if (buf_in == NULL) |
@@ -150,7 +157,6 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat | |||
150 | goto err; | 157 | goto err; |
151 | } | 158 | } |
152 | 159 | ||
153 | EVP_VerifyInit_ex(&ctx,type, NULL); | ||
154 | EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl); | 160 | EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl); |
155 | 161 | ||
156 | OPENSSL_cleanse(buf_in,(unsigned int)inl); | 162 | OPENSSL_cleanse(buf_in,(unsigned int)inl); |
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index 3414509f1b..ceaeb4cbe3 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
@@ -829,7 +829,7 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); | |||
829 | 829 | ||
830 | /* General */ | 830 | /* General */ |
831 | /* given a string, return the correct type, max is the maximum length */ | 831 | /* given a string, return the correct type, max is the maximum length */ |
832 | int ASN1_PRINTABLE_type(unsigned char *s, int max); | 832 | int ASN1_PRINTABLE_type(const unsigned char *s, int max); |
833 | 833 | ||
834 | int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); | 834 | int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); |
835 | ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, | 835 | ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, |
@@ -950,16 +950,19 @@ void ERR_load_ASN1_strings(void); | |||
950 | #define ASN1_F_A2I_ASN1_ENUMERATED 101 | 950 | #define ASN1_F_A2I_ASN1_ENUMERATED 101 |
951 | #define ASN1_F_A2I_ASN1_INTEGER 102 | 951 | #define ASN1_F_A2I_ASN1_INTEGER 102 |
952 | #define ASN1_F_A2I_ASN1_STRING 103 | 952 | #define ASN1_F_A2I_ASN1_STRING 103 |
953 | #define ASN1_F_ASN1_BIT_STRING_SET_BIT 176 | ||
953 | #define ASN1_F_ASN1_CHECK_TLEN 104 | 954 | #define ASN1_F_ASN1_CHECK_TLEN 104 |
954 | #define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 | 955 | #define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 |
955 | #define ASN1_F_ASN1_COLLECT 106 | 956 | #define ASN1_F_ASN1_COLLECT 106 |
956 | #define ASN1_F_ASN1_D2I_BIO 107 | 957 | #define ASN1_F_ASN1_D2I_BIO 107 |
957 | #define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 | 958 | #define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 |
958 | #define ASN1_F_ASN1_D2I_FP 109 | 959 | #define ASN1_F_ASN1_D2I_FP 109 |
960 | #define ASN1_F_ASN1_DIGEST 177 | ||
959 | #define ASN1_F_ASN1_DO_ADB 110 | 961 | #define ASN1_F_ASN1_DO_ADB 110 |
960 | #define ASN1_F_ASN1_DUP 111 | 962 | #define ASN1_F_ASN1_DUP 111 |
961 | #define ASN1_F_ASN1_ENUMERATED_SET 112 | 963 | #define ASN1_F_ASN1_ENUMERATED_SET 112 |
962 | #define ASN1_F_ASN1_ENUMERATED_TO_BN 113 | 964 | #define ASN1_F_ASN1_ENUMERATED_TO_BN 113 |
965 | #define ASN1_F_ASN1_GENERALIZEDTIME_SET 178 | ||
963 | #define ASN1_F_ASN1_GET_OBJECT 114 | 966 | #define ASN1_F_ASN1_GET_OBJECT 114 |
964 | #define ASN1_F_ASN1_HEADER_NEW 115 | 967 | #define ASN1_F_ASN1_HEADER_NEW 115 |
965 | #define ASN1_F_ASN1_I2D_BIO 116 | 968 | #define ASN1_F_ASN1_I2D_BIO 116 |
@@ -975,6 +978,7 @@ void ERR_load_ASN1_strings(void); | |||
975 | #define ASN1_F_ASN1_SEQ_PACK 126 | 978 | #define ASN1_F_ASN1_SEQ_PACK 126 |
976 | #define ASN1_F_ASN1_SEQ_UNPACK 127 | 979 | #define ASN1_F_ASN1_SEQ_UNPACK 127 |
977 | #define ASN1_F_ASN1_SIGN 128 | 980 | #define ASN1_F_ASN1_SIGN 128 |
981 | #define ASN1_F_ASN1_STRING_SET 179 | ||
978 | #define ASN1_F_ASN1_STRING_TABLE_ADD 129 | 982 | #define ASN1_F_ASN1_STRING_TABLE_ADD 129 |
979 | #define ASN1_F_ASN1_STRING_TYPE_NEW 130 | 983 | #define ASN1_F_ASN1_STRING_TYPE_NEW 130 |
980 | #define ASN1_F_ASN1_TEMPLATE_D2I 131 | 984 | #define ASN1_F_ASN1_TEMPLATE_D2I 131 |
@@ -984,6 +988,7 @@ void ERR_load_ASN1_strings(void); | |||
984 | #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 | 988 | #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 |
985 | #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 | 989 | #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 |
986 | #define ASN1_F_ASN1_UNPACK_STRING 136 | 990 | #define ASN1_F_ASN1_UNPACK_STRING 136 |
991 | #define ASN1_F_ASN1_UTCTIME_SET 180 | ||
987 | #define ASN1_F_ASN1_VERIFY 137 | 992 | #define ASN1_F_ASN1_VERIFY 137 |
988 | #define ASN1_F_BN_TO_ASN1_ENUMERATED 138 | 993 | #define ASN1_F_BN_TO_ASN1_ENUMERATED 138 |
989 | #define ASN1_F_BN_TO_ASN1_INTEGER 139 | 994 | #define ASN1_F_BN_TO_ASN1_INTEGER 139 |
@@ -1007,6 +1012,7 @@ void ERR_load_ASN1_strings(void); | |||
1007 | #define ASN1_F_D2I_X509_CINF 157 | 1012 | #define ASN1_F_D2I_X509_CINF 157 |
1008 | #define ASN1_F_D2I_X509_NAME 158 | 1013 | #define ASN1_F_D2I_X509_NAME 158 |
1009 | #define ASN1_F_D2I_X509_PKEY 159 | 1014 | #define ASN1_F_D2I_X509_PKEY 159 |
1015 | #define ASN1_F_I2D_ASN1_SET 181 | ||
1010 | #define ASN1_F_I2D_ASN1_TIME 160 | 1016 | #define ASN1_F_I2D_ASN1_TIME 160 |
1011 | #define ASN1_F_I2D_DSA_PUBKEY 161 | 1017 | #define ASN1_F_I2D_DSA_PUBKEY 161 |
1012 | #define ASN1_F_I2D_NETSCAPE_RSA 162 | 1018 | #define ASN1_F_I2D_NETSCAPE_RSA 162 |
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c index 094ec06fda..3b57c8fbae 100644 --- a/src/lib/libcrypto/asn1/asn1_err.c +++ b/src/lib/libcrypto/asn1/asn1_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/asn1/asn1_err.c */ | 1 | /* crypto/asn1/asn1_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2004 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 |
@@ -70,16 +70,19 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
70 | {ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"}, | 70 | {ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"}, |
71 | {ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"}, | 71 | {ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"}, |
72 | {ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"}, | 72 | {ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"}, |
73 | {ERR_PACK(0,ASN1_F_ASN1_BIT_STRING_SET_BIT,0), "ASN1_BIT_STRING_set_bit"}, | ||
73 | {ERR_PACK(0,ASN1_F_ASN1_CHECK_TLEN,0), "ASN1_CHECK_TLEN"}, | 74 | {ERR_PACK(0,ASN1_F_ASN1_CHECK_TLEN,0), "ASN1_CHECK_TLEN"}, |
74 | {ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"}, | 75 | {ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"}, |
75 | {ERR_PACK(0,ASN1_F_ASN1_COLLECT,0), "ASN1_COLLECT"}, | 76 | {ERR_PACK(0,ASN1_F_ASN1_COLLECT,0), "ASN1_COLLECT"}, |
76 | {ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"}, | 77 | {ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"}, |
77 | {ERR_PACK(0,ASN1_F_ASN1_D2I_EX_PRIMITIVE,0), "ASN1_D2I_EX_PRIMITIVE"}, | 78 | {ERR_PACK(0,ASN1_F_ASN1_D2I_EX_PRIMITIVE,0), "ASN1_D2I_EX_PRIMITIVE"}, |
78 | {ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"}, | 79 | {ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"}, |
80 | {ERR_PACK(0,ASN1_F_ASN1_DIGEST,0), "ASN1_digest"}, | ||
79 | {ERR_PACK(0,ASN1_F_ASN1_DO_ADB,0), "ASN1_DO_ADB"}, | 81 | {ERR_PACK(0,ASN1_F_ASN1_DO_ADB,0), "ASN1_DO_ADB"}, |
80 | {ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"}, | 82 | {ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"}, |
81 | {ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"}, | 83 | {ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"}, |
82 | {ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"}, | 84 | {ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"}, |
85 | {ERR_PACK(0,ASN1_F_ASN1_GENERALIZEDTIME_SET,0), "ASN1_GENERALIZEDTIME_set"}, | ||
83 | {ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"}, | 86 | {ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"}, |
84 | {ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"}, | 87 | {ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"}, |
85 | {ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"}, | 88 | {ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"}, |
@@ -95,6 +98,7 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
95 | {ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"}, | 98 | {ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"}, |
96 | {ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"}, | 99 | {ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"}, |
97 | {ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"}, | 100 | {ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"}, |
101 | {ERR_PACK(0,ASN1_F_ASN1_STRING_SET,0), "ASN1_STRING_set"}, | ||
98 | {ERR_PACK(0,ASN1_F_ASN1_STRING_TABLE_ADD,0), "ASN1_STRING_TABLE_add"}, | 102 | {ERR_PACK(0,ASN1_F_ASN1_STRING_TABLE_ADD,0), "ASN1_STRING_TABLE_add"}, |
99 | {ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"}, | 103 | {ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"}, |
100 | {ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_D2I,0), "ASN1_TEMPLATE_D2I"}, | 104 | {ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_D2I,0), "ASN1_TEMPLATE_D2I"}, |
@@ -104,6 +108,7 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
104 | {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"}, | 108 | {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"}, |
105 | {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"}, | 109 | {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"}, |
106 | {ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"}, | 110 | {ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"}, |
111 | {ERR_PACK(0,ASN1_F_ASN1_UTCTIME_SET,0), "ASN1_UTCTIME_set"}, | ||
107 | {ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"}, | 112 | {ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"}, |
108 | {ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"}, | 113 | {ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"}, |
109 | {ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"}, | 114 | {ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"}, |
@@ -127,6 +132,7 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
127 | {ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "D2I_X509_CINF"}, | 132 | {ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "D2I_X509_CINF"}, |
128 | {ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "D2I_X509_NAME"}, | 133 | {ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "D2I_X509_NAME"}, |
129 | {ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"}, | 134 | {ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"}, |
135 | {ERR_PACK(0,ASN1_F_I2D_ASN1_SET,0), "i2d_ASN1_SET"}, | ||
130 | {ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "I2D_ASN1_TIME"}, | 136 | {ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "I2D_ASN1_TIME"}, |
131 | {ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"}, | 137 | {ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"}, |
132 | {ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"}, | 138 | {ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"}, |
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index a74f1368d3..97b9b35f4b 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
@@ -349,6 +349,7 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | |||
349 | 349 | ||
350 | if (str->data == NULL) | 350 | if (str->data == NULL) |
351 | { | 351 | { |
352 | ASN1err(ASN1_F_ASN1_STRING_SET,ERR_R_MALLOC_FAILURE); | ||
352 | str->data=c; | 353 | str->data=c; |
353 | return(0); | 354 | return(0); |
354 | } | 355 | } |
diff --git a/src/lib/libcrypto/asn1/evp_asn1.c b/src/lib/libcrypto/asn1/evp_asn1.c index 3506005a71..f92ce6cb5d 100644 --- a/src/lib/libcrypto/asn1/evp_asn1.c +++ b/src/lib/libcrypto/asn1/evp_asn1.c | |||
@@ -115,7 +115,11 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, | |||
115 | 115 | ||
116 | if ((osp=ASN1_STRING_new()) == NULL) return(0); | 116 | if ((osp=ASN1_STRING_new()) == NULL) return(0); |
117 | /* Grow the 'string' */ | 117 | /* Grow the 'string' */ |
118 | ASN1_STRING_set(osp,NULL,size); | 118 | if (!ASN1_STRING_set(osp,NULL,size)) |
119 | { | ||
120 | ASN1_STRING_free(osp); | ||
121 | return(0); | ||
122 | } | ||
119 | 123 | ||
120 | M_ASN1_STRING_length_set(osp, size); | 124 | M_ASN1_STRING_length_set(osp, size); |
121 | p=M_ASN1_STRING_data(osp); | 125 | p=M_ASN1_STRING_data(osp); |
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c index 891150638e..ec788267e0 100644 --- a/src/lib/libcrypto/asn1/p5_pbe.c +++ b/src/lib/libcrypto/asn1/p5_pbe.c | |||
@@ -76,47 +76,55 @@ IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM) | |||
76 | X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, | 76 | X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, |
77 | int saltlen) | 77 | int saltlen) |
78 | { | 78 | { |
79 | PBEPARAM *pbe; | 79 | PBEPARAM *pbe=NULL; |
80 | ASN1_OBJECT *al; | 80 | ASN1_OBJECT *al; |
81 | X509_ALGOR *algor; | 81 | X509_ALGOR *algor; |
82 | ASN1_TYPE *astype; | 82 | ASN1_TYPE *astype=NULL; |
83 | 83 | ||
84 | if (!(pbe = PBEPARAM_new ())) { | 84 | if (!(pbe = PBEPARAM_new ())) { |
85 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | 85 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); |
86 | return NULL; | 86 | goto err; |
87 | } | 87 | } |
88 | if(iter <= 0) iter = PKCS5_DEFAULT_ITER; | 88 | if(iter <= 0) iter = PKCS5_DEFAULT_ITER; |
89 | ASN1_INTEGER_set (pbe->iter, iter); | 89 | if (!ASN1_INTEGER_set(pbe->iter, iter)) { |
90 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | ||
91 | goto err; | ||
92 | } | ||
90 | if (!saltlen) saltlen = PKCS5_SALT_LEN; | 93 | if (!saltlen) saltlen = PKCS5_SALT_LEN; |
91 | if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) { | 94 | if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) { |
92 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | 95 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); |
93 | return NULL; | 96 | goto err; |
94 | } | 97 | } |
95 | pbe->salt->length = saltlen; | 98 | pbe->salt->length = saltlen; |
96 | if (salt) memcpy (pbe->salt->data, salt, saltlen); | 99 | if (salt) memcpy (pbe->salt->data, salt, saltlen); |
97 | else if (RAND_pseudo_bytes (pbe->salt->data, saltlen) < 0) | 100 | else if (RAND_pseudo_bytes (pbe->salt->data, saltlen) < 0) |
98 | return NULL; | 101 | goto err; |
99 | 102 | ||
100 | if (!(astype = ASN1_TYPE_new())) { | 103 | if (!(astype = ASN1_TYPE_new())) { |
101 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | 104 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); |
102 | return NULL; | 105 | goto err; |
103 | } | 106 | } |
104 | 107 | ||
105 | astype->type = V_ASN1_SEQUENCE; | 108 | astype->type = V_ASN1_SEQUENCE; |
106 | if(!ASN1_pack_string(pbe, i2d_PBEPARAM, &astype->value.sequence)) { | 109 | if(!ASN1_pack_string(pbe, i2d_PBEPARAM, &astype->value.sequence)) { |
107 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | 110 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); |
108 | return NULL; | 111 | goto err; |
109 | } | 112 | } |
110 | PBEPARAM_free (pbe); | 113 | PBEPARAM_free (pbe); |
114 | pbe = NULL; | ||
111 | 115 | ||
112 | al = OBJ_nid2obj(alg); /* never need to free al */ | 116 | al = OBJ_nid2obj(alg); /* never need to free al */ |
113 | if (!(algor = X509_ALGOR_new())) { | 117 | if (!(algor = X509_ALGOR_new())) { |
114 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | 118 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); |
115 | return NULL; | 119 | goto err; |
116 | } | 120 | } |
117 | ASN1_OBJECT_free(algor->algorithm); | 121 | ASN1_OBJECT_free(algor->algorithm); |
118 | algor->algorithm = al; | 122 | algor->algorithm = al; |
119 | algor->parameter = astype; | 123 | algor->parameter = astype; |
120 | 124 | ||
121 | return (algor); | 125 | return (algor); |
126 | err: | ||
127 | if (pbe != NULL) PBEPARAM_free(pbe); | ||
128 | if (astype != NULL) ASN1_TYPE_free(astype); | ||
129 | return NULL; | ||
122 | } | 130 | } |
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c index 91e1c8987d..e0dc0ec4ee 100644 --- a/src/lib/libcrypto/asn1/p5_pbev2.c +++ b/src/lib/libcrypto/asn1/p5_pbev2.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* p5_pbev2.c */ | 1 | /* p5_pbev2.c */ |
2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999-2004. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
@@ -113,7 +113,8 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
113 | if(!(scheme->parameter = ASN1_TYPE_new())) goto merr; | 113 | if(!(scheme->parameter = ASN1_TYPE_new())) goto merr; |
114 | 114 | ||
115 | /* Create random IV */ | 115 | /* Create random IV */ |
116 | if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) | 116 | if (EVP_CIPHER_iv_length(cipher) && |
117 | RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) | ||
117 | goto err; | 118 | goto err; |
118 | 119 | ||
119 | EVP_CIPHER_CTX_init(&ctx); | 120 | EVP_CIPHER_CTX_init(&ctx); |
@@ -123,6 +124,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
123 | if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { | 124 | if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { |
124 | ASN1err(ASN1_F_PKCS5_PBE2_SET, | 125 | ASN1err(ASN1_F_PKCS5_PBE2_SET, |
125 | ASN1_R_ERROR_SETTING_CIPHER_PARAMS); | 126 | ASN1_R_ERROR_SETTING_CIPHER_PARAMS); |
127 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
126 | goto err; | 128 | goto err; |
127 | } | 129 | } |
128 | EVP_CIPHER_CTX_cleanup(&ctx); | 130 | EVP_CIPHER_CTX_cleanup(&ctx); |
diff --git a/src/lib/libcrypto/asn1/t_bitst.c b/src/lib/libcrypto/asn1/t_bitst.c index 8ee789f082..397332d9b8 100644 --- a/src/lib/libcrypto/asn1/t_bitst.c +++ b/src/lib/libcrypto/asn1/t_bitst.c | |||
@@ -84,7 +84,10 @@ int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, | |||
84 | int bitnum; | 84 | int bitnum; |
85 | bitnum = ASN1_BIT_STRING_num_asc(name, tbl); | 85 | bitnum = ASN1_BIT_STRING_num_asc(name, tbl); |
86 | if(bitnum < 0) return 0; | 86 | if(bitnum < 0) return 0; |
87 | if(bs) ASN1_BIT_STRING_set_bit(bs, bitnum, value); | 87 | if(bs) { |
88 | if(!ASN1_BIT_STRING_set_bit(bs, bitnum, value)) | ||
89 | return 0; | ||
90 | } | ||
88 | return 1; | 91 | return 1; |
89 | } | 92 | } |
90 | 93 | ||
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c index 11fce96825..b99f8fc522 100644 --- a/src/lib/libcrypto/asn1/x_crl.c +++ b/src/lib/libcrypto/asn1/x_crl.c | |||
@@ -63,8 +63,6 @@ | |||
63 | 63 | ||
64 | static int X509_REVOKED_cmp(const X509_REVOKED * const *a, | 64 | static int X509_REVOKED_cmp(const X509_REVOKED * const *a, |
65 | const X509_REVOKED * const *b); | 65 | const X509_REVOKED * const *b); |
66 | static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a, | ||
67 | const X509_REVOKED * const *b); | ||
68 | 66 | ||
69 | ASN1_SEQUENCE(X509_REVOKED) = { | 67 | ASN1_SEQUENCE(X509_REVOKED) = { |
70 | ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER), | 68 | ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER), |
@@ -72,43 +70,28 @@ ASN1_SEQUENCE(X509_REVOKED) = { | |||
72 | ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION) | 70 | ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION) |
73 | } ASN1_SEQUENCE_END(X509_REVOKED) | 71 | } ASN1_SEQUENCE_END(X509_REVOKED) |
74 | 72 | ||
75 | /* The X509_CRL_INFO structure needs a bit of customisation. This is actually | 73 | /* The X509_CRL_INFO structure needs a bit of customisation. |
76 | * mirroring the old behaviour: its purpose is to allow the use of | 74 | * Since we cache the original encoding the signature wont be affected by |
77 | * sk_X509_REVOKED_find to lookup revoked certificates. Unfortunately | 75 | * reordering of the revoked field. |
78 | * this will zap the original order and the signature so we keep a copy | ||
79 | * of the original positions and reorder appropriately before encoding. | ||
80 | * | ||
81 | * Might want to see if there's a better way of doing this later... | ||
82 | */ | 76 | */ |
83 | static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 77 | static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) |
84 | { | 78 | { |
85 | X509_CRL_INFO *a = (X509_CRL_INFO *)*pval; | 79 | X509_CRL_INFO *a = (X509_CRL_INFO *)*pval; |
86 | int i; | ||
87 | int (*old_cmp)(const X509_REVOKED * const *, | ||
88 | const X509_REVOKED * const *); | ||
89 | 80 | ||
90 | if(!a || !a->revoked) return 1; | 81 | if(!a || !a->revoked) return 1; |
91 | switch(operation) { | 82 | switch(operation) { |
92 | 83 | /* Just set cmp function here. We don't sort because that | |
93 | /* Save original order */ | 84 | * would affect the output of X509_CRL_print(). |
85 | */ | ||
94 | case ASN1_OP_D2I_POST: | 86 | case ASN1_OP_D2I_POST: |
95 | for (i=0; i<sk_X509_REVOKED_num(a->revoked); i++) | ||
96 | sk_X509_REVOKED_value(a->revoked,i)->sequence=i; | ||
97 | sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp); | 87 | sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp); |
98 | break; | 88 | break; |
99 | |||
100 | /* Restore original order */ | ||
101 | case ASN1_OP_I2D_PRE: | ||
102 | old_cmp=sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_seq_cmp); | ||
103 | sk_X509_REVOKED_sort(a->revoked); | ||
104 | sk_X509_REVOKED_set_cmp_func(a->revoked,old_cmp); | ||
105 | break; | ||
106 | } | 89 | } |
107 | return 1; | 90 | return 1; |
108 | } | 91 | } |
109 | 92 | ||
110 | 93 | ||
111 | ASN1_SEQUENCE_cb(X509_CRL_INFO, crl_inf_cb) = { | 94 | ASN1_SEQUENCE_enc(X509_CRL_INFO, enc, crl_inf_cb) = { |
112 | ASN1_OPT(X509_CRL_INFO, version, ASN1_INTEGER), | 95 | ASN1_OPT(X509_CRL_INFO, version, ASN1_INTEGER), |
113 | ASN1_SIMPLE(X509_CRL_INFO, sig_alg, X509_ALGOR), | 96 | ASN1_SIMPLE(X509_CRL_INFO, sig_alg, X509_ALGOR), |
114 | ASN1_SIMPLE(X509_CRL_INFO, issuer, X509_NAME), | 97 | ASN1_SIMPLE(X509_CRL_INFO, issuer, X509_NAME), |
@@ -116,7 +99,7 @@ ASN1_SEQUENCE_cb(X509_CRL_INFO, crl_inf_cb) = { | |||
116 | ASN1_OPT(X509_CRL_INFO, nextUpdate, ASN1_TIME), | 99 | ASN1_OPT(X509_CRL_INFO, nextUpdate, ASN1_TIME), |
117 | ASN1_SEQUENCE_OF_OPT(X509_CRL_INFO, revoked, X509_REVOKED), | 100 | ASN1_SEQUENCE_OF_OPT(X509_CRL_INFO, revoked, X509_REVOKED), |
118 | ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0) | 101 | ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0) |
119 | } ASN1_SEQUENCE_END_cb(X509_CRL_INFO, X509_CRL_INFO) | 102 | } ASN1_SEQUENCE_END_enc(X509_CRL_INFO, X509_CRL_INFO) |
120 | 103 | ||
121 | ASN1_SEQUENCE_ref(X509_CRL, 0, CRYPTO_LOCK_X509_CRL) = { | 104 | ASN1_SEQUENCE_ref(X509_CRL, 0, CRYPTO_LOCK_X509_CRL) = { |
122 | ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO), | 105 | ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO), |
@@ -137,12 +120,6 @@ static int X509_REVOKED_cmp(const X509_REVOKED * const *a, | |||
137 | (ASN1_STRING *)(*b)->serialNumber)); | 120 | (ASN1_STRING *)(*b)->serialNumber)); |
138 | } | 121 | } |
139 | 122 | ||
140 | static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a, | ||
141 | const X509_REVOKED * const *b) | ||
142 | { | ||
143 | return((*a)->sequence-(*b)->sequence); | ||
144 | } | ||
145 | |||
146 | int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) | 123 | int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) |
147 | { | 124 | { |
148 | X509_CRL_INFO *inf; | 125 | X509_CRL_INFO *inf; |
@@ -153,6 +130,7 @@ int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) | |||
153 | ASN1err(ASN1_F_X509_CRL_ADD0_REVOKED, ERR_R_MALLOC_FAILURE); | 130 | ASN1err(ASN1_F_X509_CRL_ADD0_REVOKED, ERR_R_MALLOC_FAILURE); |
154 | return 0; | 131 | return 0; |
155 | } | 132 | } |
133 | inf->enc.modified = 1; | ||
156 | return 1; | 134 | return 1; |
157 | } | 135 | } |
158 | 136 | ||
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c index caece0f158..31f3377b64 100644 --- a/src/lib/libcrypto/asn1/x_name.c +++ b/src/lib/libcrypto/asn1/x_name.c | |||
@@ -160,21 +160,22 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, unsigned char **in, long len, cons | |||
160 | int tag, int aclass, char opt, ASN1_TLC *ctx) | 160 | int tag, int aclass, char opt, ASN1_TLC *ctx) |
161 | { | 161 | { |
162 | unsigned char *p = *in, *q; | 162 | unsigned char *p = *in, *q; |
163 | STACK *intname = NULL; | 163 | STACK *intname = NULL, **intname_pp = &intname; |
164 | int i, j, ret; | 164 | int i, j, ret; |
165 | X509_NAME *nm = NULL; | 165 | X509_NAME *nm = NULL, **nm_pp = &nm; |
166 | STACK_OF(X509_NAME_ENTRY) *entries; | 166 | STACK_OF(X509_NAME_ENTRY) *entries; |
167 | X509_NAME_ENTRY *entry; | 167 | X509_NAME_ENTRY *entry; |
168 | q = p; | 168 | q = p; |
169 | 169 | ||
170 | /* Get internal representation of Name */ | 170 | /* Get internal representation of Name */ |
171 | ret = ASN1_item_ex_d2i((ASN1_VALUE **)&intname, &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL), | 171 | ret = ASN1_item_ex_d2i((ASN1_VALUE **)intname_pp, |
172 | tag, aclass, opt, ctx); | 172 | &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL), |
173 | tag, aclass, opt, ctx); | ||
173 | 174 | ||
174 | if(ret <= 0) return ret; | 175 | if(ret <= 0) return ret; |
175 | 176 | ||
176 | if(*val) x509_name_ex_free(val, NULL); | 177 | if(*val) x509_name_ex_free(val, NULL); |
177 | if(!x509_name_ex_new((ASN1_VALUE **)&nm, NULL)) goto err; | 178 | if(!x509_name_ex_new((ASN1_VALUE **)nm_pp, NULL)) goto err; |
178 | /* We've decoded it: now cache encoding */ | 179 | /* We've decoded it: now cache encoding */ |
179 | if(!BUF_MEM_grow(nm->bytes, p - q)) goto err; | 180 | if(!BUF_MEM_grow(nm->bytes, p - q)) goto err; |
180 | memcpy(nm->bytes->data, q, p - q); | 181 | memcpy(nm->bytes->data, q, p - q); |
@@ -218,7 +219,7 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_IT | |||
218 | 219 | ||
219 | static int x509_name_encode(X509_NAME *a) | 220 | static int x509_name_encode(X509_NAME *a) |
220 | { | 221 | { |
221 | STACK *intname = NULL; | 222 | STACK *intname = NULL, **intname_pp = &intname; |
222 | int len; | 223 | int len; |
223 | unsigned char *p; | 224 | unsigned char *p; |
224 | STACK_OF(X509_NAME_ENTRY) *entries = NULL; | 225 | STACK_OF(X509_NAME_ENTRY) *entries = NULL; |
@@ -236,10 +237,12 @@ static int x509_name_encode(X509_NAME *a) | |||
236 | } | 237 | } |
237 | if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr; | 238 | if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr; |
238 | } | 239 | } |
239 | len = ASN1_item_ex_i2d((ASN1_VALUE **)&intname, NULL, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | 240 | len = ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp, NULL, |
241 | ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | ||
240 | if (!BUF_MEM_grow(a->bytes,len)) goto memerr; | 242 | if (!BUF_MEM_grow(a->bytes,len)) goto memerr; |
241 | p=(unsigned char *)a->bytes->data; | 243 | p=(unsigned char *)a->bytes->data; |
242 | ASN1_item_ex_i2d((ASN1_VALUE **)&intname, &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | 244 | ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp, |
245 | &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | ||
243 | sk_pop_free(intname, sk_internal_free); | 246 | sk_pop_free(intname, sk_internal_free); |
244 | a->modified = 0; | 247 | a->modified = 0; |
245 | return len; | 248 | return len; |
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index d958540120..7d6d71af88 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c | |||
@@ -80,8 +80,7 @@ IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) | |||
80 | 80 | ||
81 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | 81 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) |
82 | { | 82 | { |
83 | int ok=0; | 83 | X509_PUBKEY *pk=NULL; |
84 | X509_PUBKEY *pk; | ||
85 | X509_ALGOR *a; | 84 | X509_ALGOR *a; |
86 | ASN1_OBJECT *o; | 85 | ASN1_OBJECT *o; |
87 | unsigned char *s,*p = NULL; | 86 | unsigned char *s,*p = NULL; |
@@ -104,7 +103,11 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
104 | (a->parameter->type != V_ASN1_NULL)) | 103 | (a->parameter->type != V_ASN1_NULL)) |
105 | { | 104 | { |
106 | ASN1_TYPE_free(a->parameter); | 105 | ASN1_TYPE_free(a->parameter); |
107 | a->parameter=ASN1_TYPE_new(); | 106 | if (!(a->parameter=ASN1_TYPE_new())) |
107 | { | ||
108 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
109 | goto err; | ||
110 | } | ||
108 | a->parameter->type=V_ASN1_NULL; | 111 | a->parameter->type=V_ASN1_NULL; |
109 | } | 112 | } |
110 | } | 113 | } |
@@ -118,14 +121,34 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
118 | dsa=pkey->pkey.dsa; | 121 | dsa=pkey->pkey.dsa; |
119 | dsa->write_params=0; | 122 | dsa->write_params=0; |
120 | ASN1_TYPE_free(a->parameter); | 123 | ASN1_TYPE_free(a->parameter); |
121 | i=i2d_DSAparams(dsa,NULL); | 124 | if ((i=i2d_DSAparams(dsa,NULL)) <= 0) |
122 | if ((p=(unsigned char *)OPENSSL_malloc(i)) == NULL) goto err; | 125 | goto err; |
126 | if (!(p=(unsigned char *)OPENSSL_malloc(i))) | ||
127 | { | ||
128 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
129 | goto err; | ||
130 | } | ||
123 | pp=p; | 131 | pp=p; |
124 | i2d_DSAparams(dsa,&pp); | 132 | i2d_DSAparams(dsa,&pp); |
125 | a->parameter=ASN1_TYPE_new(); | 133 | if (!(a->parameter=ASN1_TYPE_new())) |
134 | { | ||
135 | OPENSSL_free(p); | ||
136 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
137 | goto err; | ||
138 | } | ||
126 | a->parameter->type=V_ASN1_SEQUENCE; | 139 | a->parameter->type=V_ASN1_SEQUENCE; |
127 | a->parameter->value.sequence=ASN1_STRING_new(); | 140 | if (!(a->parameter->value.sequence=ASN1_STRING_new())) |
128 | ASN1_STRING_set(a->parameter->value.sequence,p,i); | 141 | { |
142 | OPENSSL_free(p); | ||
143 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
144 | goto err; | ||
145 | } | ||
146 | if (!ASN1_STRING_set(a->parameter->value.sequence,p,i)) | ||
147 | { | ||
148 | OPENSSL_free(p); | ||
149 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
150 | goto err; | ||
151 | } | ||
129 | OPENSSL_free(p); | 152 | OPENSSL_free(p); |
130 | } | 153 | } |
131 | else | 154 | else |
@@ -143,7 +166,11 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
143 | } | 166 | } |
144 | p=s; | 167 | p=s; |
145 | i2d_PublicKey(pkey,&p); | 168 | i2d_PublicKey(pkey,&p); |
146 | if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err; | 169 | if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) |
170 | { | ||
171 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
172 | goto err; | ||
173 | } | ||
147 | /* Set number of unused bits to zero */ | 174 | /* Set number of unused bits to zero */ |
148 | pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); | 175 | pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); |
149 | pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT; | 176 | pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT; |
@@ -159,12 +186,11 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
159 | X509_PUBKEY_free(*x); | 186 | X509_PUBKEY_free(*x); |
160 | 187 | ||
161 | *x=pk; | 188 | *x=pk; |
162 | pk=NULL; | ||
163 | 189 | ||
164 | ok=1; | 190 | return 1; |
165 | err: | 191 | err: |
166 | if (pk != NULL) X509_PUBKEY_free(pk); | 192 | if (pk != NULL) X509_PUBKEY_free(pk); |
167 | return(ok); | 193 | return 0; |
168 | } | 194 | } |
169 | 195 | ||
170 | EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) | 196 | EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) |
diff --git a/src/lib/libcrypto/bf/bf_skey.c b/src/lib/libcrypto/bf/bf_skey.c index 3673cdee6e..fc5bebefce 100644 --- a/src/lib/libcrypto/bf/bf_skey.c +++ b/src/lib/libcrypto/bf/bf_skey.c | |||
@@ -58,11 +58,12 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <openssl/crypto.h> | ||
61 | #include <openssl/blowfish.h> | 62 | #include <openssl/blowfish.h> |
62 | #include "bf_locl.h" | 63 | #include "bf_locl.h" |
63 | #include "bf_pi.h" | 64 | #include "bf_pi.h" |
64 | 65 | ||
65 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data) | 66 | FIPS_NON_FIPS_VCIPHER_Init(BF) |
66 | { | 67 | { |
67 | int i; | 68 | int i; |
68 | BF_LONG *p,ri,in[2]; | 69 | BF_LONG *p,ri,in[2]; |
diff --git a/src/lib/libcrypto/bf/blowfish.h b/src/lib/libcrypto/bf/blowfish.h index cd49e85ab2..b4d8774961 100644 --- a/src/lib/libcrypto/bf/blowfish.h +++ b/src/lib/libcrypto/bf/blowfish.h | |||
@@ -104,7 +104,10 @@ typedef struct bf_key_st | |||
104 | BF_LONG S[4*256]; | 104 | BF_LONG S[4*256]; |
105 | } BF_KEY; | 105 | } BF_KEY; |
106 | 106 | ||
107 | 107 | ||
108 | #ifdef OPENSSL_FIPS | ||
109 | void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data); | ||
110 | #endif | ||
108 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); | 111 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); |
109 | 112 | ||
110 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); | 113 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); |
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index 880dc69303..8b753e7ca0 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c | |||
@@ -641,7 +641,7 @@ fmtfp( | |||
641 | multiplying by a factor of 10 */ | 641 | multiplying by a factor of 10 */ |
642 | fracpart = roundv((pow10(max)) * (ufvalue - intpart)); | 642 | fracpart = roundv((pow10(max)) * (ufvalue - intpart)); |
643 | 643 | ||
644 | if (fracpart >= pow10(max)) { | 644 | if (fracpart >= (long)pow10(max)) { |
645 | intpart++; | 645 | intpart++; |
646 | fracpart -= (long)pow10(max); | 646 | fracpart -= (long)pow10(max); |
647 | } | 647 | } |
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index fbbc16d00c..2eb703830f 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
@@ -347,6 +347,7 @@ typedef struct bio_f_buffer_ctx_struct | |||
347 | #define BIO_C_NWRITE0 145 | 347 | #define BIO_C_NWRITE0 145 |
348 | #define BIO_C_NWRITE 146 | 348 | #define BIO_C_NWRITE 146 |
349 | #define BIO_C_RESET_READ_REQUEST 147 | 349 | #define BIO_C_RESET_READ_REQUEST 147 |
350 | #define BIO_C_SET_MD_CTX 148 | ||
350 | 351 | ||
351 | 352 | ||
352 | #define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) | 353 | #define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) |
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index 9cdf159f82..8034ac93f9 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
@@ -213,13 +213,14 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
213 | b->shutdown=(int)num&BIO_CLOSE; | 213 | b->shutdown=(int)num&BIO_CLOSE; |
214 | b->ptr=(char *)ptr; | 214 | b->ptr=(char *)ptr; |
215 | b->init=1; | 215 | b->init=1; |
216 | { | ||
216 | #if defined(OPENSSL_SYS_WINDOWS) | 217 | #if defined(OPENSSL_SYS_WINDOWS) |
218 | int fd = fileno((FILE*)ptr); | ||
217 | if (num & BIO_FP_TEXT) | 219 | if (num & BIO_FP_TEXT) |
218 | _setmode(fileno((FILE *)ptr),_O_TEXT); | 220 | _setmode(fd,_O_TEXT); |
219 | else | 221 | else |
220 | _setmode(fileno((FILE *)ptr),_O_BINARY); | 222 | _setmode(fd,_O_BINARY); |
221 | #elif defined(OPENSSL_SYS_MSDOS) | 223 | #elif defined(OPENSSL_SYS_MSDOS) |
222 | { | ||
223 | int fd = fileno((FILE*)ptr); | 224 | int fd = fileno((FILE*)ptr); |
224 | /* Set correct text/binary mode */ | 225 | /* Set correct text/binary mode */ |
225 | if (num & BIO_FP_TEXT) | 226 | if (num & BIO_FP_TEXT) |
@@ -235,13 +236,14 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
235 | else | 236 | else |
236 | _setmode(fd,_O_BINARY); | 237 | _setmode(fd,_O_BINARY); |
237 | } | 238 | } |
238 | } | ||
239 | #elif defined(OPENSSL_SYS_OS2) | 239 | #elif defined(OPENSSL_SYS_OS2) |
240 | int fd = fileno((FILE*)ptr); | ||
240 | if (num & BIO_FP_TEXT) | 241 | if (num & BIO_FP_TEXT) |
241 | setmode(fileno((FILE *)ptr), O_TEXT); | 242 | setmode(fd, O_TEXT); |
242 | else | 243 | else |
243 | setmode(fileno((FILE *)ptr), O_BINARY); | 244 | setmode(fd, O_BINARY); |
244 | #endif | 245 | #endif |
246 | } | ||
245 | break; | 247 | break; |
246 | case BIO_C_SET_FILENAME: | 248 | case BIO_C_SET_FILENAME: |
247 | file_free(b); | 249 | file_free(b); |
@@ -264,7 +266,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
264 | ret=0; | 266 | ret=0; |
265 | break; | 267 | break; |
266 | } | 268 | } |
267 | #if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) | 269 | #if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) |
268 | if (!(num & BIO_FP_TEXT)) | 270 | if (!(num & BIO_FP_TEXT)) |
269 | strcat(p,"b"); | 271 | strcat(p,"b"); |
270 | else | 272 | else |
diff --git a/src/lib/libcrypto/bn/asm/ia64.S b/src/lib/libcrypto/bn/asm/ia64.S index 7dfda85566..7b82b820e6 100644 --- a/src/lib/libcrypto/bn/asm/ia64.S +++ b/src/lib/libcrypto/bn/asm/ia64.S | |||
@@ -1,6 +1,6 @@ | |||
1 | .explicit | 1 | .explicit |
2 | .text | 2 | .text |
3 | .ident "ia64.S, Version 2.0" | 3 | .ident "ia64.S, Version 2.1" |
4 | .ident "IA-64 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>" | 4 | .ident "IA-64 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>" |
5 | 5 | ||
6 | // | 6 | // |
@@ -35,7 +35,7 @@ | |||
35 | // What does it mean? You might ratiocinate that the original code | 35 | // What does it mean? You might ratiocinate that the original code |
36 | // should run just faster... Because sum of latencies is smaller... | 36 | // should run just faster... Because sum of latencies is smaller... |
37 | // Wrong! Note that getf latency increased. This means that if a loop is | 37 | // Wrong! Note that getf latency increased. This means that if a loop is |
38 | // scheduled for lower latency (and they are), then it will suffer from | 38 | // scheduled for lower latency (as they were), then it will suffer from |
39 | // stall condition and the code will therefore turn anti-scalable, e.g. | 39 | // stall condition and the code will therefore turn anti-scalable, e.g. |
40 | // original bn_mul_words spun at 5*n or 2.5 times slower than expected | 40 | // original bn_mul_words spun at 5*n or 2.5 times slower than expected |
41 | // on Itanium2! What to do? Reschedule loops for Itanium2? But then | 41 | // on Itanium2! What to do? Reschedule loops for Itanium2? But then |
@@ -145,6 +145,12 @@ | |||
145 | // -Drum=nop.m in command line. | 145 | // -Drum=nop.m in command line. |
146 | // | 146 | // |
147 | 147 | ||
148 | #if defined(_HPUX_SOURCE) && !defined(_LP64) | ||
149 | #define ADDP addp4 | ||
150 | #else | ||
151 | #define ADDP add | ||
152 | #endif | ||
153 | |||
148 | #if 1 | 154 | #if 1 |
149 | // | 155 | // |
150 | // bn_[add|sub]_words routines. | 156 | // bn_[add|sub]_words routines. |
@@ -178,27 +184,12 @@ bn_add_words: | |||
178 | brp.loop.imp .L_bn_add_words_ctop,.L_bn_add_words_cend-16 | 184 | brp.loop.imp .L_bn_add_words_ctop,.L_bn_add_words_cend-16 |
179 | } | 185 | } |
180 | .body | 186 | .body |
181 | { .mib; | 187 | { .mib; ADDP r14=0,r32 // rp |
182 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
183 | addp4 r14=0,r32 // rp | ||
184 | #else | ||
185 | mov r14=r32 // rp | ||
186 | #endif | ||
187 | mov r9=pr };; | 188 | mov r9=pr };; |
188 | { .mii; | 189 | { .mii; ADDP r15=0,r33 // ap |
189 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
190 | addp4 r15=0,r33 // ap | ||
191 | #else | ||
192 | mov r15=r33 // ap | ||
193 | #endif | ||
194 | mov ar.lc=r10 | 190 | mov ar.lc=r10 |
195 | mov ar.ec=6 } | 191 | mov ar.ec=6 } |
196 | { .mib; | 192 | { .mib; ADDP r16=0,r34 // bp |
197 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
198 | addp4 r16=0,r34 // bp | ||
199 | #else | ||
200 | mov r16=r34 // bp | ||
201 | #endif | ||
202 | mov pr.rot=1<<16 };; | 193 | mov pr.rot=1<<16 };; |
203 | 194 | ||
204 | .L_bn_add_words_ctop: | 195 | .L_bn_add_words_ctop: |
@@ -246,27 +237,12 @@ bn_sub_words: | |||
246 | brp.loop.imp .L_bn_sub_words_ctop,.L_bn_sub_words_cend-16 | 237 | brp.loop.imp .L_bn_sub_words_ctop,.L_bn_sub_words_cend-16 |
247 | } | 238 | } |
248 | .body | 239 | .body |
249 | { .mib; | 240 | { .mib; ADDP r14=0,r32 // rp |
250 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
251 | addp4 r14=0,r32 // rp | ||
252 | #else | ||
253 | mov r14=r32 // rp | ||
254 | #endif | ||
255 | mov r9=pr };; | 241 | mov r9=pr };; |
256 | { .mii; | 242 | { .mii; ADDP r15=0,r33 // ap |
257 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
258 | addp4 r15=0,r33 // ap | ||
259 | #else | ||
260 | mov r15=r33 // ap | ||
261 | #endif | ||
262 | mov ar.lc=r10 | 243 | mov ar.lc=r10 |
263 | mov ar.ec=6 } | 244 | mov ar.ec=6 } |
264 | { .mib; | 245 | { .mib; ADDP r16=0,r34 // bp |
265 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
266 | addp4 r16=0,r34 // bp | ||
267 | #else | ||
268 | mov r16=r34 // bp | ||
269 | #endif | ||
270 | mov pr.rot=1<<16 };; | 246 | mov pr.rot=1<<16 };; |
271 | 247 | ||
272 | .L_bn_sub_words_ctop: | 248 | .L_bn_sub_words_ctop: |
@@ -332,16 +308,10 @@ bn_mul_words: | |||
332 | 308 | ||
333 | #ifndef XMA_TEMPTATION | 309 | #ifndef XMA_TEMPTATION |
334 | 310 | ||
335 | { .mii; | 311 | { .mmi; ADDP r14=0,r32 // rp |
336 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 312 | ADDP r15=0,r33 // ap |
337 | addp4 r14=0,r32 // rp | ||
338 | addp4 r15=0,r33 // ap | ||
339 | #else | ||
340 | mov r14=r32 // rp | ||
341 | mov r15=r33 // ap | ||
342 | #endif | ||
343 | mov ar.lc=r10 } | 313 | mov ar.lc=r10 } |
344 | { .mii; mov r40=0 // serves as r35 at first (p27) | 314 | { .mmi; mov r40=0 // serves as r35 at first (p27) |
345 | mov ar.ec=13 };; | 315 | mov ar.ec=13 };; |
346 | 316 | ||
347 | // This loop spins in 2*(n+12) ticks. It's scheduled for data in Itanium | 317 | // This loop spins in 2*(n+12) ticks. It's scheduled for data in Itanium |
@@ -424,89 +394,64 @@ bn_mul_words: | |||
424 | .global bn_mul_add_words# | 394 | .global bn_mul_add_words# |
425 | .proc bn_mul_add_words# | 395 | .proc bn_mul_add_words# |
426 | .align 64 | 396 | .align 64 |
427 | //.skip 0 // makes the loop split at 64-byte boundary | 397 | .skip 48 // makes the loop body aligned at 64-byte boundary |
428 | bn_mul_add_words: | 398 | bn_mul_add_words: |
429 | .prologue | 399 | .prologue |
430 | .fframe 0 | 400 | .fframe 0 |
431 | .save ar.pfs,r2 | 401 | .save ar.pfs,r2 |
432 | { .mii; alloc r2=ar.pfs,4,12,0,16 | ||
433 | cmp4.le p6,p0=r34,r0 };; | ||
434 | { .mfb; mov r8=r0 // return value | ||
435 | (p6) br.ret.spnt.many b0 };; | ||
436 | |||
437 | .save ar.lc,r3 | 402 | .save ar.lc,r3 |
438 | { .mii; sub r10=r34,r0,1 | 403 | .save pr,r9 |
439 | mov r3=ar.lc | 404 | { .mmi; alloc r2=ar.pfs,4,4,0,8 |
440 | mov r9=pr };; | 405 | cmp4.le p6,p0=r34,r0 |
406 | mov r3=ar.lc };; | ||
407 | { .mib; mov r8=r0 // return value | ||
408 | sub r10=r34,r0,1 | ||
409 | (p6) br.ret.spnt.many b0 };; | ||
441 | 410 | ||
442 | .body | 411 | .body |
443 | { .mib; setf.sig f8=r35 // w | 412 | { .mib; setf.sig f8=r35 // w |
444 | mov pr.rot=0x800001<<16 | 413 | mov r9=pr |
445 | // ------^----- serves as (p50) at first (p27) | ||
446 | brp.loop.imp .L_bn_mul_add_words_ctop,.L_bn_mul_add_words_cend-16 | 414 | brp.loop.imp .L_bn_mul_add_words_ctop,.L_bn_mul_add_words_cend-16 |
447 | } | 415 | } |
448 | { .mii; | 416 | { .mmi; ADDP r14=0,r32 // rp |
449 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 417 | ADDP r15=0,r33 // ap |
450 | addp4 r14=0,r32 // rp | ||
451 | addp4 r15=0,r33 // ap | ||
452 | #else | ||
453 | mov r14=r32 // rp | ||
454 | mov r15=r33 // ap | ||
455 | #endif | ||
456 | mov ar.lc=r10 } | 418 | mov ar.lc=r10 } |
457 | { .mii; mov r40=0 // serves as r35 at first (p27) | 419 | { .mii; ADDP r16=0,r32 // rp copy |
458 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 420 | mov pr.rot=0x2001<<16 |
459 | addp4 r18=0,r32 // rp copy | 421 | // ------^----- serves as (p40) at first (p27) |
460 | #else | 422 | mov ar.ec=11 };; |
461 | mov r18=r32 // rp copy | 423 | |
462 | #endif | 424 | // This loop spins in 3*(n+10) ticks on Itanium and in 2*(n+10) on |
463 | mov ar.ec=15 };; | 425 | // Itanium 2. Yes, unlike previous versions it scales:-) Previous |
464 | 426 | // version was peforming *all* additions in IALU and was starving | |
465 | // This loop spins in 3*(n+14) ticks on Itanium and should spin in | 427 | // for those even on Itanium 2. In this version one addition is |
466 | // 2*(n+14) on "wider" IA-64 implementations (to be verified with new | 428 | // moved to FPU and is folded with multiplication. This is at cost |
467 | // µ-architecture manuals as they become available). As usual it's | 429 | // of propogating the result from previous call to this subroutine |
468 | // possible to compress the epilogue, down to 10 in this case, at the | 430 | // to L2 cache... In other words negligible even for shorter keys. |
469 | // cost of scalability. Compressed (and therefore non-scalable) loop | 431 | // *Overall* performance improvement [over previous version] varies |
470 | // running at 3*(n+11) would buy you ~10% on Itanium but take ~35% | 432 | // from 11 to 22 percent depending on key length. |
471 | // from "wider" IA-64 so let it be scalable! Special attention was | ||
472 | // paid for having the loop body split at 64-byte boundary. ld8 is | ||
473 | // scheduled for L1 cache as the data is more than likely there. | ||
474 | // Indeed, bn_mul_words has put it there a moment ago:-) | ||
475 | .L_bn_mul_add_words_ctop: | 433 | .L_bn_mul_add_words_ctop: |
476 | { .mfi; (p25) getf.sig r36=f52 // low | 434 | .pred.rel "mutex",p40,p42 |
477 | (p21) xmpy.lu f48=f37,f8 | 435 | { .mfi; (p23) getf.sig r36=f45 // low |
478 | (p28) cmp.ltu p54,p50=r41,r39 } | 436 | (p20) xma.lu f42=f36,f8,f50 // low |
479 | { .mfi; (p16) ldf8 f32=[r15],8 | 437 | (p40) add r39=r39,r35 } // (p27) |
480 | (p21) xmpy.hu f40=f37,f8 | 438 | { .mfi; (p16) ldf8 f32=[r15],8 // *(ap++) |
481 | (p28) add r45=r45,r41 };; | 439 | (p20) xma.hu f36=f36,f8,f50 // high |
482 | { .mii; (p25) getf.sig r32=f44 // high | 440 | (p42) add r39=r39,r35,1 };; // (p27) |
483 | .pred.rel "mutex",p50,p54 | 441 | { .mmi; (p24) getf.sig r32=f40 // high |
484 | (p50) add r40=r38,r35 // (p27) | 442 | (p16) ldf8 f46=[r16],8 // *(rp1++) |
485 | (p54) add r40=r38,r35,1 } // (p27) | 443 | (p40) cmp.ltu p41,p39=r39,r35 } // (p27) |
486 | { .mfb; (p28) cmp.ltu.unc p60,p0=r45,r41 | 444 | { .mib; (p26) st8 [r14]=r39,8 // *(rp2++) |
487 | (p0) nop.f 0x0 | 445 | (p42) cmp.leu p41,p39=r39,r35 // (p27) |
488 | (p0) nop.b 0x0 } | ||
489 | { .mii; (p27) ld8 r44=[r18],8 | ||
490 | (p62) cmp.eq.or p61,p0=-1,r46 | ||
491 | (p62) add r46=1,r46 } | ||
492 | { .mfb; (p30) st8 [r14]=r47,8 | ||
493 | (p0) nop.f 0x0 | ||
494 | br.ctop.sptk .L_bn_mul_add_words_ctop};; | 446 | br.ctop.sptk .L_bn_mul_add_words_ctop};; |
495 | .L_bn_mul_add_words_cend: | 447 | .L_bn_mul_add_words_cend: |
496 | 448 | ||
497 | { .mii; nop.m 0x0 | 449 | { .mmi; .pred.rel "mutex",p40,p42 |
498 | .pred.rel "mutex",p53,p57 | 450 | (p40) add r8=r35,r0 |
499 | (p53) add r8=r38,r0 | 451 | (p42) add r8=r35,r0,1 |
500 | (p57) add r8=r38,r0,1 } | 452 | mov pr=r9,0x1ffff } |
501 | { .mfb; nop.m 0x0 | 453 | { .mib; rum 1<<5 // clear um.mfh |
502 | nop.f 0x0 | 454 | mov ar.lc=r3 |
503 | nop.b 0x0 };; | ||
504 | { .mii; | ||
505 | (p63) add r8=1,r8 | ||
506 | mov pr=r9,0x1ffff | ||
507 | mov ar.lc=r3 } | ||
508 | { .mfb; rum 1<<5 // clear um.mfh | ||
509 | nop.f 0x0 | ||
510 | br.ret.sptk.many b0 };; | 455 | br.ret.sptk.many b0 };; |
511 | .endp bn_mul_add_words# | 456 | .endp bn_mul_add_words# |
512 | #endif | 457 | #endif |
@@ -527,7 +472,8 @@ bn_sqr_words: | |||
527 | sxt4 r34=r34 };; | 472 | sxt4 r34=r34 };; |
528 | { .mii; cmp.le p6,p0=r34,r0 | 473 | { .mii; cmp.le p6,p0=r34,r0 |
529 | mov r8=r0 } // return value | 474 | mov r8=r0 } // return value |
530 | { .mfb; nop.f 0x0 | 475 | { .mfb; ADDP r32=0,r32 |
476 | nop.f 0x0 | ||
531 | (p6) br.ret.spnt.many b0 };; | 477 | (p6) br.ret.spnt.many b0 };; |
532 | 478 | ||
533 | .save ar.lc,r3 | 479 | .save ar.lc,r3 |
@@ -536,11 +482,7 @@ bn_sqr_words: | |||
536 | mov r9=pr };; | 482 | mov r9=pr };; |
537 | 483 | ||
538 | .body | 484 | .body |
539 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 485 | { .mib; ADDP r33=0,r33 |
540 | { .mii; addp4 r32=0,r32 | ||
541 | addp4 r33=0,r33 };; | ||
542 | #endif | ||
543 | { .mib; | ||
544 | mov pr.rot=1<<16 | 486 | mov pr.rot=1<<16 |
545 | brp.loop.imp .L_bn_sqr_words_ctop,.L_bn_sqr_words_cend-16 | 487 | brp.loop.imp .L_bn_sqr_words_ctop,.L_bn_sqr_words_cend-16 |
546 | } | 488 | } |
@@ -605,7 +547,7 @@ bn_sqr_comba8: | |||
605 | .prologue | 547 | .prologue |
606 | .fframe 0 | 548 | .fframe 0 |
607 | .save ar.pfs,r2 | 549 | .save ar.pfs,r2 |
608 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 550 | #if defined(_HPUX_SOURCE) && !defined(_LP64) |
609 | { .mii; alloc r2=ar.pfs,2,1,0,0 | 551 | { .mii; alloc r2=ar.pfs,2,1,0,0 |
610 | addp4 r33=0,r33 | 552 | addp4 r33=0,r33 |
611 | addp4 r32=0,r32 };; | 553 | addp4 r32=0,r32 };; |
@@ -631,6 +573,10 @@ bn_sqr_comba8: | |||
631 | // clause in Itanium µ-architecture manual? Comments are welcomed and | 573 | // clause in Itanium µ-architecture manual? Comments are welcomed and |
632 | // highly appreciated. | 574 | // highly appreciated. |
633 | // | 575 | // |
576 | // On Itanium 2 it takes ~190 ticks. This is because of stalls on | ||
577 | // result from getf.sig. I do nothing about it at this point for | ||
578 | // reasons depicted below. | ||
579 | // | ||
634 | // However! It should be noted that even 160 ticks is darn good result | 580 | // However! It should be noted that even 160 ticks is darn good result |
635 | // as it's over 10 (yes, ten, spelled as t-e-n) times faster than the | 581 | // as it's over 10 (yes, ten, spelled as t-e-n) times faster than the |
636 | // C version (compiled with gcc with inline assembler). I really | 582 | // C version (compiled with gcc with inline assembler). I really |
@@ -673,7 +619,7 @@ bn_mul_comba8: | |||
673 | .prologue | 619 | .prologue |
674 | .fframe 0 | 620 | .fframe 0 |
675 | .save ar.pfs,r2 | 621 | .save ar.pfs,r2 |
676 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 622 | #if defined(_HPUX_SOURCE) && !defined(_LP64) |
677 | { .mii; alloc r2=ar.pfs,3,0,0,0 | 623 | { .mii; alloc r2=ar.pfs,3,0,0,0 |
678 | addp4 r33=0,r33 | 624 | addp4 r33=0,r33 |
679 | addp4 r34=0,r34 };; | 625 | addp4 r34=0,r34 };; |
@@ -1231,7 +1177,7 @@ bn_sqr_comba4: | |||
1231 | .prologue | 1177 | .prologue |
1232 | .fframe 0 | 1178 | .fframe 0 |
1233 | .save ar.pfs,r2 | 1179 | .save ar.pfs,r2 |
1234 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 1180 | #if defined(_HPUX_SOURCE) && !defined(_LP64) |
1235 | { .mii; alloc r2=ar.pfs,2,1,0,0 | 1181 | { .mii; alloc r2=ar.pfs,2,1,0,0 |
1236 | addp4 r32=0,r32 | 1182 | addp4 r32=0,r32 |
1237 | addp4 r33=0,r33 };; | 1183 | addp4 r33=0,r33 };; |
@@ -1264,7 +1210,7 @@ bn_mul_comba4: | |||
1264 | .prologue | 1210 | .prologue |
1265 | .fframe 0 | 1211 | .fframe 0 |
1266 | .save ar.pfs,r2 | 1212 | .save ar.pfs,r2 |
1267 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 1213 | #if defined(_HPUX_SOURCE) && !defined(_LP64) |
1268 | { .mii; alloc r2=ar.pfs,3,0,0,0 | 1214 | { .mii; alloc r2=ar.pfs,3,0,0,0 |
1269 | addp4 r33=0,r33 | 1215 | addp4 r33=0,r33 |
1270 | addp4 r34=0,r34 };; | 1216 | addp4 r34=0,r34 };; |
@@ -1448,8 +1394,8 @@ bn_mul_comba4: | |||
1448 | #define I r21 | 1394 | #define I r21 |
1449 | 1395 | ||
1450 | #if 0 | 1396 | #if 0 |
1451 | // Some preprocessors (most notably HP-UX) apper to be allergic to | 1397 | // Some preprocessors (most notably HP-UX) appear to be allergic to |
1452 | // macros enclosed to parenthesis as these three will be. | 1398 | // macros enclosed to parenthesis [as these three were]. |
1453 | #define cont p16 | 1399 | #define cont p16 |
1454 | #define break p0 // p20 | 1400 | #define break p0 // p20 |
1455 | #define equ p24 | 1401 | #define equ p24 |
@@ -1581,9 +1527,18 @@ bn_div_words: | |||
1581 | // output: f8 = (int)(a/b) | 1527 | // output: f8 = (int)(a/b) |
1582 | // clobbered: f8,f9,f10,f11,pred | 1528 | // clobbered: f8,f9,f10,f11,pred |
1583 | pred=p15 | 1529 | pred=p15 |
1584 | // This procedure is essentially Intel code and therefore is | 1530 | // One can argue that this snippet is copyrighted to Intel |
1585 | // copyrighted to Intel Corporation (I suppose...). It's sligtly | 1531 | // Corporation, as it's essentially identical to one of those |
1586 | // modified for specific needs. | 1532 | // found in "Divide, Square Root and Remainder" section at |
1533 | // http://www.intel.com/software/products/opensource/libraries/num.htm. | ||
1534 | // Yes, I admit that the referred code was used as template, | ||
1535 | // but after I realized that there hardly is any other instruction | ||
1536 | // sequence which would perform this operation. I mean I figure that | ||
1537 | // any independent attempt to implement high-performance division | ||
1538 | // will result in code virtually identical to the Intel code. It | ||
1539 | // should be noted though that below division kernel is 1 cycle | ||
1540 | // faster than Intel one (note commented splits:-), not to mention | ||
1541 | // original prologue (rather lack of one) and epilogue. | ||
1587 | .align 32 | 1542 | .align 32 |
1588 | .skip 16 | 1543 | .skip 16 |
1589 | .L_udiv64_32_b6: | 1544 | .L_udiv64_32_b6: |
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index c9ebdbaabe..b79b1b60da 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c | |||
@@ -273,7 +273,7 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
273 | 273 | ||
274 | BN_init(&Ri); | 274 | BN_init(&Ri); |
275 | R= &(mont->RR); /* grab RR as a temp */ | 275 | R= &(mont->RR); /* grab RR as a temp */ |
276 | BN_copy(&(mont->N),mod); /* Set N */ | 276 | if (!BN_copy(&(mont->N),mod)) goto err; /* Set N */ |
277 | mont->N.neg = 0; | 277 | mont->N.neg = 0; |
278 | 278 | ||
279 | #ifdef MONT_WORD | 279 | #ifdef MONT_WORD |
diff --git a/src/lib/libcrypto/bn/bntest.c b/src/lib/libcrypto/bn/bntest.c index 8ef733013d..79d813d85e 100644 --- a/src/lib/libcrypto/bn/bntest.c +++ b/src/lib/libcrypto/bn/bntest.c | |||
@@ -232,7 +232,7 @@ int main(int argc, char *argv[]) | |||
232 | EXIT(0); | 232 | EXIT(0); |
233 | err: | 233 | err: |
234 | BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices | 234 | BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices |
235 | * the failure, see test_bn in test/Makefile.ssl*/ | 235 | * the failure, see test_bn in test/Makefile */ |
236 | BIO_flush(out); | 236 | BIO_flush(out); |
237 | ERR_load_crypto_strings(); | 237 | ERR_load_crypto_strings(); |
238 | ERR_print_errors_fp(stderr); | 238 | ERR_print_errors_fp(stderr); |
diff --git a/src/lib/libcrypto/cast/c_skey.c b/src/lib/libcrypto/cast/c_skey.c index 76e40005c9..dc4791a8cf 100644 --- a/src/lib/libcrypto/cast/c_skey.c +++ b/src/lib/libcrypto/cast/c_skey.c | |||
@@ -56,7 +56,9 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/crypto.h> | ||
59 | #include <openssl/cast.h> | 60 | #include <openssl/cast.h> |
61 | |||
60 | #include "cast_lcl.h" | 62 | #include "cast_lcl.h" |
61 | #include "cast_s.h" | 63 | #include "cast_s.h" |
62 | 64 | ||
@@ -72,7 +74,7 @@ | |||
72 | #define S6 CAST_S_table6 | 74 | #define S6 CAST_S_table6 |
73 | #define S7 CAST_S_table7 | 75 | #define S7 CAST_S_table7 |
74 | 76 | ||
75 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data) | 77 | FIPS_NON_FIPS_VCIPHER_Init(CAST) |
76 | { | 78 | { |
77 | CAST_LONG x[16]; | 79 | CAST_LONG x[16]; |
78 | CAST_LONG z[16]; | 80 | CAST_LONG z[16]; |
diff --git a/src/lib/libcrypto/cast/cast.h b/src/lib/libcrypto/cast/cast.h index b28e4e4f3b..9e300178d9 100644 --- a/src/lib/libcrypto/cast/cast.h +++ b/src/lib/libcrypto/cast/cast.h | |||
@@ -81,7 +81,10 @@ typedef struct cast_key_st | |||
81 | int short_key; /* Use reduced rounds for short key */ | 81 | int short_key; /* Use reduced rounds for short key */ |
82 | } CAST_KEY; | 82 | } CAST_KEY; |
83 | 83 | ||
84 | 84 | ||
85 | #ifdef OPENSSL_FIPS | ||
86 | void private_CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); | ||
87 | #endif | ||
85 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); | 88 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); |
86 | void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out,CAST_KEY *key, | 89 | void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out,CAST_KEY *key, |
87 | int enc); | 90 | int enc); |
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c index 8c0876151a..1bd2850d15 100644 --- a/src/lib/libcrypto/comp/c_zlib.c +++ b/src/lib/libcrypto/comp/c_zlib.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include <openssl/objects.h> | 4 | #include <openssl/objects.h> |
5 | #include <openssl/comp.h> | 5 | #include <openssl/comp.h> |
6 | #include <openssl/err.h> | ||
6 | 7 | ||
7 | COMP_METHOD *COMP_zlib(void ); | 8 | COMP_METHOD *COMP_zlib(void ); |
8 | 9 | ||
@@ -189,7 +190,17 @@ COMP_METHOD *COMP_zlib(void) | |||
189 | if (!zlib_loaded) | 190 | if (!zlib_loaded) |
190 | { | 191 | { |
191 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | 192 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) |
192 | zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0); | 193 | zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0); |
194 | if (!zlib_dso) | ||
195 | { | ||
196 | zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0); | ||
197 | if (zlib_dso) | ||
198 | { | ||
199 | /* Clear the errors from the first failed | ||
200 | DSO_load() */ | ||
201 | ERR_clear_error(); | ||
202 | } | ||
203 | } | ||
193 | #else | 204 | #else |
194 | zlib_dso = DSO_load(NULL, "z", NULL, 0); | 205 | zlib_dso = DSO_load(NULL, "z", NULL, 0); |
195 | #endif | 206 | #endif |
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c index 2e9f52f1fd..b5a876ae68 100644 --- a/src/lib/libcrypto/conf/conf_def.c +++ b/src/lib/libcrypto/conf/conf_def.c | |||
@@ -632,6 +632,11 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from) | |||
632 | BUF_MEM_grow_clean(buf,(strlen(p)+len-(e-from))); | 632 | BUF_MEM_grow_clean(buf,(strlen(p)+len-(e-from))); |
633 | while (*p) | 633 | while (*p) |
634 | buf->data[to++]= *(p++); | 634 | buf->data[to++]= *(p++); |
635 | |||
636 | /* Since we change the pointer 'from', we also have | ||
637 | to change the perceived length of the string it | ||
638 | points at. /RL */ | ||
639 | len -= e-from; | ||
635 | from=e; | 640 | from=e; |
636 | } | 641 | } |
637 | else | 642 | else |
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c index 2924def2bb..fef0afb29f 100644 --- a/src/lib/libcrypto/cryptlib.c +++ b/src/lib/libcrypto/cryptlib.c | |||
@@ -105,7 +105,9 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] = | |||
105 | "engine", | 105 | "engine", |
106 | "ui", | 106 | "ui", |
107 | "hwcrhk", /* This is a HACK which will disappear in 0.9.8 */ | 107 | "hwcrhk", /* This is a HACK which will disappear in 0.9.8 */ |
108 | #if CRYPTO_NUM_LOCKS != 33 | 108 | "fips", |
109 | "fips2", | ||
110 | #if CRYPTO_NUM_LOCKS != 35 | ||
109 | # error "Inconsistency between crypto.h and cryptlib.c" | 111 | # error "Inconsistency between crypto.h and cryptlib.c" |
110 | #endif | 112 | #endif |
111 | }; | 113 | }; |
@@ -478,13 +480,12 @@ const char *CRYPTO_get_lock_name(int type) | |||
478 | return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS)); | 480 | return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS)); |
479 | } | 481 | } |
480 | 482 | ||
481 | #ifdef _DLL | 483 | #if defined(_WIN32) && defined(_WINDLL) |
482 | #ifdef OPENSSL_SYS_WIN32 | ||
483 | 484 | ||
484 | /* All we really need to do is remove the 'error' state when a thread | 485 | /* All we really need to do is remove the 'error' state when a thread |
485 | * detaches */ | 486 | * detaches */ |
486 | 487 | ||
487 | BOOL WINAPI DLLEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, | 488 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, |
488 | LPVOID lpvReserved) | 489 | LPVOID lpvReserved) |
489 | { | 490 | { |
490 | switch(fdwReason) | 491 | switch(fdwReason) |
@@ -503,8 +504,6 @@ BOOL WINAPI DLLEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, | |||
503 | } | 504 | } |
504 | #endif | 505 | #endif |
505 | 506 | ||
506 | #endif | ||
507 | |||
508 | void OpenSSLDie(const char *file,int line,const char *assertion) | 507 | void OpenSSLDie(const char *file,int line,const char *assertion) |
509 | { | 508 | { |
510 | fprintf(stderr, | 509 | fprintf(stderr, |
@@ -512,3 +511,122 @@ void OpenSSLDie(const char *file,int line,const char *assertion) | |||
512 | file,line,assertion); | 511 | file,line,assertion); |
513 | abort(); | 512 | abort(); |
514 | } | 513 | } |
514 | |||
515 | #ifdef OPENSSL_FIPS | ||
516 | static int fips_started = 0; | ||
517 | static int fips_mode = 0; | ||
518 | static void *fips_rand_check = 0; | ||
519 | static unsigned long fips_thread = 0; | ||
520 | |||
521 | void fips_set_started(void) | ||
522 | { | ||
523 | fips_started = 1; | ||
524 | } | ||
525 | |||
526 | int fips_is_started(void) | ||
527 | { | ||
528 | return fips_started; | ||
529 | } | ||
530 | |||
531 | int fips_is_owning_thread(void) | ||
532 | { | ||
533 | int ret = 0; | ||
534 | |||
535 | if (fips_is_started()) | ||
536 | { | ||
537 | CRYPTO_r_lock(CRYPTO_LOCK_FIPS2); | ||
538 | if (fips_thread != 0 && fips_thread == CRYPTO_thread_id()) | ||
539 | ret = 1; | ||
540 | CRYPTO_r_unlock(CRYPTO_LOCK_FIPS2); | ||
541 | } | ||
542 | return ret; | ||
543 | } | ||
544 | |||
545 | int fips_set_owning_thread(void) | ||
546 | { | ||
547 | int ret = 0; | ||
548 | |||
549 | if (fips_is_started()) | ||
550 | { | ||
551 | CRYPTO_w_lock(CRYPTO_LOCK_FIPS2); | ||
552 | if (fips_thread == 0) | ||
553 | { | ||
554 | fips_thread = CRYPTO_thread_id(); | ||
555 | ret = 1; | ||
556 | } | ||
557 | CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2); | ||
558 | } | ||
559 | return ret; | ||
560 | } | ||
561 | |||
562 | int fips_clear_owning_thread(void) | ||
563 | { | ||
564 | int ret = 0; | ||
565 | |||
566 | if (fips_is_started()) | ||
567 | { | ||
568 | CRYPTO_w_lock(CRYPTO_LOCK_FIPS2); | ||
569 | if (fips_thread == CRYPTO_thread_id()) | ||
570 | { | ||
571 | fips_thread = 0; | ||
572 | ret = 1; | ||
573 | } | ||
574 | CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2); | ||
575 | } | ||
576 | return ret; | ||
577 | } | ||
578 | |||
579 | void fips_set_mode(int onoff) | ||
580 | { | ||
581 | int owning_thread = fips_is_owning_thread(); | ||
582 | |||
583 | if (fips_is_started()) | ||
584 | { | ||
585 | if (!owning_thread) CRYPTO_w_lock(CRYPTO_LOCK_FIPS); | ||
586 | fips_mode = onoff; | ||
587 | if (!owning_thread) CRYPTO_w_unlock(CRYPTO_LOCK_FIPS); | ||
588 | } | ||
589 | } | ||
590 | |||
591 | void fips_set_rand_check(void *rand_check) | ||
592 | { | ||
593 | int owning_thread = fips_is_owning_thread(); | ||
594 | |||
595 | if (fips_is_started()) | ||
596 | { | ||
597 | if (!owning_thread) CRYPTO_w_lock(CRYPTO_LOCK_FIPS); | ||
598 | fips_rand_check = rand_check; | ||
599 | if (!owning_thread) CRYPTO_w_unlock(CRYPTO_LOCK_FIPS); | ||
600 | } | ||
601 | } | ||
602 | |||
603 | int FIPS_mode(void) | ||
604 | { | ||
605 | int ret = 0; | ||
606 | int owning_thread = fips_is_owning_thread(); | ||
607 | |||
608 | if (fips_is_started()) | ||
609 | { | ||
610 | if (!owning_thread) CRYPTO_r_lock(CRYPTO_LOCK_FIPS); | ||
611 | ret = fips_mode; | ||
612 | if (!owning_thread) CRYPTO_r_unlock(CRYPTO_LOCK_FIPS); | ||
613 | } | ||
614 | return ret; | ||
615 | } | ||
616 | |||
617 | void *FIPS_rand_check(void) | ||
618 | { | ||
619 | void *ret = 0; | ||
620 | int owning_thread = fips_is_owning_thread(); | ||
621 | |||
622 | if (fips_is_started()) | ||
623 | { | ||
624 | if (!owning_thread) CRYPTO_r_lock(CRYPTO_LOCK_FIPS); | ||
625 | ret = fips_rand_check; | ||
626 | if (!owning_thread) CRYPTO_r_unlock(CRYPTO_LOCK_FIPS); | ||
627 | } | ||
628 | return ret; | ||
629 | } | ||
630 | |||
631 | #endif /* OPENSSL_FIPS */ | ||
632 | |||
diff --git a/src/lib/libcrypto/crypto-lib.com b/src/lib/libcrypto/crypto-lib.com index 39e78c69e5..c044ce0099 100644 --- a/src/lib/libcrypto/crypto-lib.com +++ b/src/lib/libcrypto/crypto-lib.com | |||
@@ -158,7 +158,7 @@ $! | |||
158 | $ APPS_DES = "DES/DES,CBC3_ENC" | 158 | $ APPS_DES = "DES/DES,CBC3_ENC" |
159 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" | 159 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" |
160 | $ | 160 | $ |
161 | $ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time" | 161 | $ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time,o_str" |
162 | $ LIB_MD2 = "md2_dgst,md2_one" | 162 | $ LIB_MD2 = "md2_dgst,md2_one" |
163 | $ LIB_MD4 = "md4_dgst,md4_one" | 163 | $ LIB_MD4 = "md4_dgst,md4_one" |
164 | $ LIB_MD5 = "md5_dgst,md5_one" | 164 | $ LIB_MD5 = "md5_dgst,md5_one" |
@@ -247,7 +247,7 @@ $ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ - | |||
247 | $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ - | 247 | $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ - |
248 | "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ - | 248 | "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ - |
249 | "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ - | 249 | "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ - |
250 | "v3_ocsp,v3_akeya" | 250 | "v3_ocsp,v3_akeya,v3_pcia,v3_pci" |
251 | $ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap" | 251 | $ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap" |
252 | $ LIB_TXT_DB = "txt_db" | 252 | $ LIB_TXT_DB = "txt_db" |
253 | $ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ - | 253 | $ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ - |
@@ -752,8 +752,8 @@ $ WRITE SYS$OUTPUT "" | |||
752 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" | 752 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" |
753 | $ WRITE SYS$OUTPUT "" | 753 | $ WRITE SYS$OUTPUT "" |
754 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything." | 754 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything." |
755 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.SSL]LIBCRYPTO.OLB Library." | 755 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library." |
756 | $ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.SSL]*.EXE Programs." | 756 | $ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.CRYPTO]*.EXE Programs." |
757 | $ WRITE SYS$OUTPUT "" | 757 | $ WRITE SYS$OUTPUT "" |
758 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:" | 758 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:" |
759 | $ WRITE SYS$OUTPUT "" | 759 | $ WRITE SYS$OUTPUT "" |
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index 273bc5e3f8..4d1dfac7f1 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h | |||
@@ -128,7 +128,9 @@ extern "C" { | |||
128 | #define CRYPTO_LOCK_ENGINE 30 | 128 | #define CRYPTO_LOCK_ENGINE 30 |
129 | #define CRYPTO_LOCK_UI 31 | 129 | #define CRYPTO_LOCK_UI 31 |
130 | #define CRYPTO_LOCK_HWCRHK 32 /* This is a HACK which will disappear in 0.9.8 */ | 130 | #define CRYPTO_LOCK_HWCRHK 32 /* This is a HACK which will disappear in 0.9.8 */ |
131 | #define CRYPTO_NUM_LOCKS 33 | 131 | #define CRYPTO_LOCK_FIPS 33 |
132 | #define CRYPTO_LOCK_FIPS2 34 | ||
133 | #define CRYPTO_NUM_LOCKS 35 | ||
132 | 134 | ||
133 | #define CRYPTO_LOCK 1 | 135 | #define CRYPTO_LOCK 1 |
134 | #define CRYPTO_UNLOCK 2 | 136 | #define CRYPTO_UNLOCK 2 |
@@ -434,6 +436,63 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); | |||
434 | void OpenSSLDie(const char *file,int line,const char *assertion); | 436 | void OpenSSLDie(const char *file,int line,const char *assertion); |
435 | #define OPENSSL_assert(e) ((e) ? (void)0 : OpenSSLDie(__FILE__, __LINE__, #e)) | 437 | #define OPENSSL_assert(e) ((e) ? (void)0 : OpenSSLDie(__FILE__, __LINE__, #e)) |
436 | 438 | ||
439 | #ifdef OPENSSL_FIPS | ||
440 | int FIPS_mode(void); | ||
441 | void *FIPS_rand_check(void); | ||
442 | |||
443 | #define FIPS_ERROR_IGNORED(alg) OpenSSLDie(__FILE__, __LINE__, \ | ||
444 | alg " previous FIPS forbidden algorithm error ignored"); | ||
445 | |||
446 | #define FIPS_BAD_ABORT(alg) OpenSSLDie(__FILE__, __LINE__, \ | ||
447 | #alg " Algorithm forbidden in FIPS mode"); | ||
448 | |||
449 | #ifdef OPENSSL_FIPS_STRICT | ||
450 | #define FIPS_BAD_ALGORITHM(alg) FIPS_BAD_ABORT(alg) | ||
451 | #else | ||
452 | #define FIPS_BAD_ALGORITHM(alg) \ | ||
453 | { \ | ||
454 | FIPSerr(FIPS_F_HASH_FINAL,FIPS_R_NON_FIPS_METHOD); \ | ||
455 | ERR_add_error_data(2, "Algorithm=", #alg); \ | ||
456 | return 0; \ | ||
457 | } | ||
458 | #endif | ||
459 | |||
460 | /* Low level digest API blocking macro */ | ||
461 | |||
462 | #define FIPS_NON_FIPS_MD_Init(alg) \ | ||
463 | int alg##_Init(alg##_CTX *c) \ | ||
464 | { \ | ||
465 | if (FIPS_mode()) \ | ||
466 | FIPS_BAD_ALGORITHM(alg) \ | ||
467 | return private_##alg##_Init(c); \ | ||
468 | } \ | ||
469 | int private_##alg##_Init(alg##_CTX *c) | ||
470 | |||
471 | /* For ciphers the API often varies from cipher to cipher and each needs to | ||
472 | * be treated as a special case. Variable key length ciphers (Blowfish, RC4, | ||
473 | * CAST) however are very similar and can use a blocking macro. | ||
474 | */ | ||
475 | |||
476 | #define FIPS_NON_FIPS_VCIPHER_Init(alg) \ | ||
477 | void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) \ | ||
478 | { \ | ||
479 | if (FIPS_mode()) \ | ||
480 | FIPS_BAD_ABORT(alg) \ | ||
481 | private_##alg##_set_key(key, len, data); \ | ||
482 | } \ | ||
483 | void private_##alg##_set_key(alg##_KEY *key, int len, \ | ||
484 | const unsigned char *data) | ||
485 | |||
486 | #else | ||
487 | |||
488 | #define FIPS_NON_FIPS_VCIPHER_Init(alg) \ | ||
489 | void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) | ||
490 | |||
491 | #define FIPS_NON_FIPS_MD_Init(alg) \ | ||
492 | int alg##_Init(alg##_CTX *c) | ||
493 | |||
494 | #endif /* def OPENSSL_FIPS */ | ||
495 | |||
437 | /* BEGIN ERROR CODES */ | 496 | /* BEGIN ERROR CODES */ |
438 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 497 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
439 | * made after this point may be overwritten when the script is next run. | 498 | * made after this point may be overwritten when the script is next run. |
diff --git a/src/lib/libcrypto/des/cfb64ede.c b/src/lib/libcrypto/des/cfb64ede.c index 60c1aa08db..f3c6018528 100644 --- a/src/lib/libcrypto/des/cfb64ede.c +++ b/src/lib/libcrypto/des/cfb64ede.c | |||
@@ -57,6 +57,7 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | #include "e_os.h" | ||
60 | 61 | ||
61 | /* The input and output encrypted as though 64bit cfb mode is being | 62 | /* The input and output encrypted as though 64bit cfb mode is being |
62 | * used. The extra state information to record how much of the | 63 | * used. The extra state information to record how much of the |
@@ -140,3 +141,114 @@ void DES_ede2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | |||
140 | DES_ede3_cfb64_encrypt(in,out,length,ks1,ks2,ks1,ivec,num,enc); | 141 | DES_ede3_cfb64_encrypt(in,out,length,ks1,ks2,ks1,ivec,num,enc); |
141 | } | 142 | } |
142 | #endif | 143 | #endif |
144 | |||
145 | /* This is compatible with the single key CFB-r for DES, even thought that's | ||
146 | * not what EVP needs. | ||
147 | */ | ||
148 | |||
149 | void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out, | ||
150 | int numbits,long length,DES_key_schedule *ks1, | ||
151 | DES_key_schedule *ks2,DES_key_schedule *ks3, | ||
152 | DES_cblock *ivec,int enc) | ||
153 | { | ||
154 | register DES_LONG d0,d1,v0,v1; | ||
155 | register long l=length; | ||
156 | register int num=numbits,n=(numbits+7)/8,i; | ||
157 | DES_LONG ti[2]; | ||
158 | unsigned char *iv; | ||
159 | unsigned char ovec[16]; | ||
160 | |||
161 | if (num > 64) return; | ||
162 | iv = &(*ivec)[0]; | ||
163 | c2l(iv,v0); | ||
164 | c2l(iv,v1); | ||
165 | if (enc) | ||
166 | { | ||
167 | while (l >= n) | ||
168 | { | ||
169 | l-=n; | ||
170 | ti[0]=v0; | ||
171 | ti[1]=v1; | ||
172 | DES_encrypt3(ti,ks1,ks2,ks3); | ||
173 | c2ln(in,d0,d1,n); | ||
174 | in+=n; | ||
175 | d0^=ti[0]; | ||
176 | d1^=ti[1]; | ||
177 | l2cn(d0,d1,out,n); | ||
178 | out+=n; | ||
179 | /* 30-08-94 - eay - changed because l>>32 and | ||
180 | * l<<32 are bad under gcc :-( */ | ||
181 | if (num == 32) | ||
182 | { v0=v1; v1=d0; } | ||
183 | else if (num == 64) | ||
184 | { v0=d0; v1=d1; } | ||
185 | else | ||
186 | { | ||
187 | iv=&ovec[0]; | ||
188 | l2c(v0,iv); | ||
189 | l2c(v1,iv); | ||
190 | l2c(d0,iv); | ||
191 | l2c(d1,iv); | ||
192 | /* shift ovec left most of the bits... */ | ||
193 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); | ||
194 | /* now the remaining bits */ | ||
195 | if(num%8 != 0) | ||
196 | for(i=0 ; i < 8 ; ++i) | ||
197 | { | ||
198 | ovec[i]<<=num%8; | ||
199 | ovec[i]|=ovec[i+1]>>(8-num%8); | ||
200 | } | ||
201 | iv=&ovec[0]; | ||
202 | c2l(iv,v0); | ||
203 | c2l(iv,v1); | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | while (l >= n) | ||
210 | { | ||
211 | l-=n; | ||
212 | ti[0]=v0; | ||
213 | ti[1]=v1; | ||
214 | DES_encrypt3(ti,ks1,ks2,ks3); | ||
215 | c2ln(in,d0,d1,n); | ||
216 | in+=n; | ||
217 | /* 30-08-94 - eay - changed because l>>32 and | ||
218 | * l<<32 are bad under gcc :-( */ | ||
219 | if (num == 32) | ||
220 | { v0=v1; v1=d0; } | ||
221 | else if (num == 64) | ||
222 | { v0=d0; v1=d1; } | ||
223 | else | ||
224 | { | ||
225 | iv=&ovec[0]; | ||
226 | l2c(v0,iv); | ||
227 | l2c(v1,iv); | ||
228 | l2c(d0,iv); | ||
229 | l2c(d1,iv); | ||
230 | /* shift ovec left most of the bits... */ | ||
231 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); | ||
232 | /* now the remaining bits */ | ||
233 | if(num%8 != 0) | ||
234 | for(i=0 ; i < 8 ; ++i) | ||
235 | { | ||
236 | ovec[i]<<=num%8; | ||
237 | ovec[i]|=ovec[i+1]>>(8-num%8); | ||
238 | } | ||
239 | iv=&ovec[0]; | ||
240 | c2l(iv,v0); | ||
241 | c2l(iv,v1); | ||
242 | } | ||
243 | d0^=ti[0]; | ||
244 | d1^=ti[1]; | ||
245 | l2cn(d0,d1,out,n); | ||
246 | out+=n; | ||
247 | } | ||
248 | } | ||
249 | iv = &(*ivec)[0]; | ||
250 | l2c(v0,iv); | ||
251 | l2c(v1,iv); | ||
252 | v0=v1=d0=d1=ti[0]=ti[1]=0; | ||
253 | } | ||
254 | |||
diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h index dfe5ff64e4..81bd874edd 100644 --- a/src/lib/libcrypto/des/des.h +++ b/src/lib/libcrypto/des/des.h | |||
@@ -130,7 +130,7 @@ OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode); /* defaults to DES_PCBC_MODE */ | |||
130 | #define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode) | 130 | #define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode) |
131 | 131 | ||
132 | const char *DES_options(void); | 132 | const char *DES_options(void); |
133 | void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, | 133 | void DES_ecb3_encrypt(const unsigned char *input, unsigned char *output, |
134 | DES_key_schedule *ks1,DES_key_schedule *ks2, | 134 | DES_key_schedule *ks1,DES_key_schedule *ks2, |
135 | DES_key_schedule *ks3, int enc); | 135 | DES_key_schedule *ks3, int enc); |
136 | DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output, | 136 | DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output, |
@@ -189,6 +189,10 @@ void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out, | |||
189 | long length,DES_key_schedule *ks1, | 189 | long length,DES_key_schedule *ks1, |
190 | DES_key_schedule *ks2,DES_key_schedule *ks3, | 190 | DES_key_schedule *ks2,DES_key_schedule *ks3, |
191 | DES_cblock *ivec,int *num,int enc); | 191 | DES_cblock *ivec,int *num,int enc); |
192 | void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out, | ||
193 | int numbits,long length,DES_key_schedule *ks1, | ||
194 | DES_key_schedule *ks2,DES_key_schedule *ks3, | ||
195 | DES_cblock *ivec,int enc); | ||
192 | void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out, | 196 | void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out, |
193 | long length,DES_key_schedule *ks1, | 197 | long length,DES_key_schedule *ks1, |
194 | DES_key_schedule *ks2,DES_key_schedule *ks3, | 198 | DES_key_schedule *ks2,DES_key_schedule *ks3, |
diff --git a/src/lib/libcrypto/des/des_enc.c b/src/lib/libcrypto/des/des_enc.c index 4f09804c44..6a49ec4a55 100644 --- a/src/lib/libcrypto/des/des_enc.c +++ b/src/lib/libcrypto/des/des_enc.c | |||
@@ -58,7 +58,9 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | #ifndef OPENSSL_FIPS | ||
61 | #ifndef OPENBSD_DES_ASM | 62 | #ifndef OPENBSD_DES_ASM |
63 | |||
62 | void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) | 64 | void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) |
63 | { | 65 | { |
64 | register DES_LONG l,r,t,u; | 66 | register DES_LONG l,r,t,u; |
@@ -289,8 +291,12 @@ void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, | |||
289 | data[1]=r; | 291 | data[1]=r; |
290 | } | 292 | } |
291 | 293 | ||
294 | #endif /* ndef OPENSSL_FIPS */ | ||
295 | |||
292 | #ifndef DES_DEFAULT_OPTIONS | 296 | #ifndef DES_DEFAULT_OPTIONS |
293 | 297 | ||
298 | #if !defined(OPENSSL_FIPS_DES_ASM) | ||
299 | |||
294 | #undef CBC_ENC_C__DONT_UPDATE_IV | 300 | #undef CBC_ENC_C__DONT_UPDATE_IV |
295 | #include "ncbc_enc.c" /* DES_ncbc_encrypt */ | 301 | #include "ncbc_enc.c" /* DES_ncbc_encrypt */ |
296 | 302 | ||
@@ -406,4 +412,6 @@ void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, | |||
406 | tin[0]=tin[1]=0; | 412 | tin[0]=tin[1]=0; |
407 | } | 413 | } |
408 | 414 | ||
415 | #endif /* !defined(OPENSSL_FIPS_DES_ASM) */ | ||
416 | |||
409 | #endif /* DES_DEFAULT_OPTIONS */ | 417 | #endif /* DES_DEFAULT_OPTIONS */ |
diff --git a/src/lib/libcrypto/des/des_old.c b/src/lib/libcrypto/des/des_old.c index 7e4cd7180d..88e9802aad 100644 --- a/src/lib/libcrypto/des/des_old.c +++ b/src/lib/libcrypto/des/des_old.c | |||
@@ -84,7 +84,7 @@ void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock | |||
84 | des_key_schedule ks1,des_key_schedule ks2, | 84 | des_key_schedule ks1,des_key_schedule ks2, |
85 | des_key_schedule ks3, int enc) | 85 | des_key_schedule ks3, int enc) |
86 | { | 86 | { |
87 | DES_ecb3_encrypt((const_DES_cblock *)input, output, | 87 | DES_ecb3_encrypt((const unsigned char *)input, (unsigned char *)output, |
88 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | 88 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, |
89 | (DES_key_schedule *)ks3, enc); | 89 | (DES_key_schedule *)ks3, enc); |
90 | } | 90 | } |
diff --git a/src/lib/libcrypto/des/destest.c b/src/lib/libcrypto/des/destest.c index 3983ac8e5f..e3e9d77f14 100644 --- a/src/lib/libcrypto/des/destest.c +++ b/src/lib/libcrypto/des/destest.c | |||
@@ -439,8 +439,8 @@ int main(int argc, char *argv[]) | |||
439 | memcpy(in,plain_data[i],8); | 439 | memcpy(in,plain_data[i],8); |
440 | memset(out,0,8); | 440 | memset(out,0,8); |
441 | memset(outin,0,8); | 441 | memset(outin,0,8); |
442 | des_ecb2_encrypt(&in,&out,ks,ks2,DES_ENCRYPT); | 442 | des_ecb2_encrypt(in,out,ks,ks2,DES_ENCRYPT); |
443 | des_ecb2_encrypt(&out,&outin,ks,ks2,DES_DECRYPT); | 443 | des_ecb2_encrypt(out,outin,ks,ks2,DES_DECRYPT); |
444 | 444 | ||
445 | if (memcmp(out,cipher_ecb2[i],8) != 0) | 445 | if (memcmp(out,cipher_ecb2[i],8) != 0) |
446 | { | 446 | { |
diff --git a/src/lib/libcrypto/des/ecb3_enc.c b/src/lib/libcrypto/des/ecb3_enc.c index c3437bc606..fa0c9c4d4f 100644 --- a/src/lib/libcrypto/des/ecb3_enc.c +++ b/src/lib/libcrypto/des/ecb3_enc.c | |||
@@ -58,15 +58,13 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, | 61 | void DES_ecb3_encrypt(const unsigned char *in, unsigned char *out, |
62 | DES_key_schedule *ks1, DES_key_schedule *ks2, | 62 | DES_key_schedule *ks1, DES_key_schedule *ks2, |
63 | DES_key_schedule *ks3, | 63 | DES_key_schedule *ks3, |
64 | int enc) | 64 | int enc) |
65 | { | 65 | { |
66 | register DES_LONG l0,l1; | 66 | register DES_LONG l0,l1; |
67 | DES_LONG ll[2]; | 67 | DES_LONG ll[2]; |
68 | const unsigned char *in = &(*input)[0]; | ||
69 | unsigned char *out = &(*output)[0]; | ||
70 | 68 | ||
71 | c2l(in,l0); | 69 | c2l(in,l0); |
72 | c2l(in,l1); | 70 | c2l(in,l1); |
diff --git a/src/lib/libcrypto/des/set_key.c b/src/lib/libcrypto/des/set_key.c index 143008ed9c..8881d46a7a 100644 --- a/src/lib/libcrypto/des/set_key.c +++ b/src/lib/libcrypto/des/set_key.c | |||
@@ -65,6 +65,8 @@ | |||
65 | */ | 65 | */ |
66 | #include "des_locl.h" | 66 | #include "des_locl.h" |
67 | 67 | ||
68 | #ifndef OPENSSL_FIPS | ||
69 | |||
68 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key); /* defaults to false */ | 70 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key); /* defaults to false */ |
69 | 71 | ||
70 | static const unsigned char odd_parity[256]={ | 72 | static const unsigned char odd_parity[256]={ |
@@ -405,3 +407,5 @@ void des_fixup_key_parity(des_cblock *key) | |||
405 | des_set_odd_parity(key); | 407 | des_set_odd_parity(key); |
406 | } | 408 | } |
407 | */ | 409 | */ |
410 | |||
411 | #endif /* ndef OPENSSL_FIPS */ | ||
diff --git a/src/lib/libcrypto/dh/dh_check.c b/src/lib/libcrypto/dh/dh_check.c index f0373f7d68..a7e9920efb 100644 --- a/src/lib/libcrypto/dh/dh_check.c +++ b/src/lib/libcrypto/dh/dh_check.c | |||
@@ -70,6 +70,8 @@ | |||
70 | * should hold. | 70 | * should hold. |
71 | */ | 71 | */ |
72 | 72 | ||
73 | #ifndef OPENSSL_FIPS | ||
74 | |||
73 | int DH_check(const DH *dh, int *ret) | 75 | int DH_check(const DH *dh, int *ret) |
74 | { | 76 | { |
75 | int ok=0; | 77 | int ok=0; |
@@ -118,3 +120,5 @@ err: | |||
118 | if (q != NULL) BN_free(q); | 120 | if (q != NULL) BN_free(q); |
119 | return(ok); | 121 | return(ok); |
120 | } | 122 | } |
123 | |||
124 | #endif | ||
diff --git a/src/lib/libcrypto/dh/dh_err.c b/src/lib/libcrypto/dh/dh_err.c index d837950aec..c2715044c9 100644 --- a/src/lib/libcrypto/dh/dh_err.c +++ b/src/lib/libcrypto/dh/dh_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/dh/dh_err.c */ | 1 | /* crypto/dh/dh_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2003 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 |
diff --git a/src/lib/libcrypto/dh/dh_gen.c b/src/lib/libcrypto/dh/dh_gen.c index 06f78b35ab..23777f5a16 100644 --- a/src/lib/libcrypto/dh/dh_gen.c +++ b/src/lib/libcrypto/dh/dh_gen.c | |||
@@ -86,6 +86,9 @@ | |||
86 | * It's just as OK (and in some sense better) to use a generator of the | 86 | * It's just as OK (and in some sense better) to use a generator of the |
87 | * order-q subgroup. | 87 | * order-q subgroup. |
88 | */ | 88 | */ |
89 | |||
90 | #ifndef OPENSSL_FIPS | ||
91 | |||
89 | DH *DH_generate_parameters(int prime_len, int generator, | 92 | DH *DH_generate_parameters(int prime_len, int generator, |
90 | void (*callback)(int,int,void *), void *cb_arg) | 93 | void (*callback)(int,int,void *), void *cb_arg) |
91 | { | 94 | { |
@@ -146,6 +149,7 @@ DH *DH_generate_parameters(int prime_len, int generator, | |||
146 | if (callback != NULL) callback(3,0,cb_arg); | 149 | if (callback != NULL) callback(3,0,cb_arg); |
147 | ret->p=p; | 150 | ret->p=p; |
148 | ret->g=BN_new(); | 151 | ret->g=BN_new(); |
152 | if (ret->g == NULL) goto err; | ||
149 | if (!BN_set_word(ret->g,g)) goto err; | 153 | if (!BN_set_word(ret->g,g)) goto err; |
150 | ok=1; | 154 | ok=1; |
151 | err: | 155 | err: |
@@ -167,3 +171,5 @@ err: | |||
167 | } | 171 | } |
168 | return(ret); | 172 | return(ret); |
169 | } | 173 | } |
174 | |||
175 | #endif | ||
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c index 77f2f50b51..ff125c2296 100644 --- a/src/lib/libcrypto/dh/dh_key.c +++ b/src/lib/libcrypto/dh/dh_key.c | |||
@@ -62,6 +62,8 @@ | |||
62 | #include <openssl/rand.h> | 62 | #include <openssl/rand.h> |
63 | #include <openssl/dh.h> | 63 | #include <openssl/dh.h> |
64 | 64 | ||
65 | #ifndef OPENSSL_FIPS | ||
66 | |||
65 | static int generate_key(DH *dh); | 67 | static int generate_key(DH *dh); |
66 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); | 68 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); |
67 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, | 69 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, |
@@ -220,3 +222,5 @@ static int dh_finish(DH *dh) | |||
220 | BN_MONT_CTX_free((BN_MONT_CTX *)dh->method_mont_p); | 222 | BN_MONT_CTX_free((BN_MONT_CTX *)dh->method_mont_p); |
221 | return(1); | 223 | return(1); |
222 | } | 224 | } |
225 | |||
226 | #endif | ||
diff --git a/src/lib/libcrypto/doc/ERR_error_string.pod b/src/lib/libcrypto/doc/ERR_error_string.pod index e01beb817a..cdfa7fe1fe 100644 --- a/src/lib/libcrypto/doc/ERR_error_string.pod +++ b/src/lib/libcrypto/doc/ERR_error_string.pod | |||
@@ -11,7 +11,7 @@ error message | |||
11 | #include <openssl/err.h> | 11 | #include <openssl/err.h> |
12 | 12 | ||
13 | char *ERR_error_string(unsigned long e, char *buf); | 13 | char *ERR_error_string(unsigned long e, char *buf); |
14 | char *ERR_error_string_n(unsigned long e, char *buf, size_t len); | 14 | void ERR_error_string_n(unsigned long e, char *buf, size_t len); |
15 | 15 | ||
16 | const char *ERR_lib_error_string(unsigned long e); | 16 | const char *ERR_lib_error_string(unsigned long e); |
17 | const char *ERR_func_error_string(unsigned long e); | 17 | const char *ERR_func_error_string(unsigned long e); |
diff --git a/src/lib/libcrypto/doc/EVP_EncryptInit.pod b/src/lib/libcrypto/doc/EVP_EncryptInit.pod index daf57e5895..40e525dd56 100644 --- a/src/lib/libcrypto/doc/EVP_EncryptInit.pod +++ b/src/lib/libcrypto/doc/EVP_EncryptInit.pod | |||
@@ -479,6 +479,7 @@ General encryption, decryption function example using FILE I/O and RC2 with an | |||
479 | if(!EVP_CipherUpdate(&ctx, outbuf, &outlen, inbuf, inlen)) | 479 | if(!EVP_CipherUpdate(&ctx, outbuf, &outlen, inbuf, inlen)) |
480 | { | 480 | { |
481 | /* Error */ | 481 | /* Error */ |
482 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
482 | return 0; | 483 | return 0; |
483 | } | 484 | } |
484 | fwrite(outbuf, 1, outlen, out); | 485 | fwrite(outbuf, 1, outlen, out); |
@@ -486,6 +487,7 @@ General encryption, decryption function example using FILE I/O and RC2 with an | |||
486 | if(!EVP_CipherFinal_ex(&ctx, outbuf, &outlen)) | 487 | if(!EVP_CipherFinal_ex(&ctx, outbuf, &outlen)) |
487 | { | 488 | { |
488 | /* Error */ | 489 | /* Error */ |
490 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
489 | return 0; | 491 | return 0; |
490 | } | 492 | } |
491 | fwrite(outbuf, 1, outlen, out); | 493 | fwrite(outbuf, 1, outlen, out); |
diff --git a/src/lib/libcrypto/doc/EVP_SealInit.pod b/src/lib/libcrypto/doc/EVP_SealInit.pod index b5e477e294..48a0e29954 100644 --- a/src/lib/libcrypto/doc/EVP_SealInit.pod +++ b/src/lib/libcrypto/doc/EVP_SealInit.pod | |||
@@ -8,8 +8,9 @@ EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption | |||
8 | 8 | ||
9 | #include <openssl/evp.h> | 9 | #include <openssl/evp.h> |
10 | 10 | ||
11 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, | 11 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
12 | int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); | 12 | unsigned char **ek, int *ekl, unsigned char *iv, |
13 | EVP_PKEY **pubk, int npubk); | ||
13 | int EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 14 | int EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
14 | int *outl, unsigned char *in, int inl); | 15 | int *outl, unsigned char *in, int inl); |
15 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | 16 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, |
diff --git a/src/lib/libcrypto/doc/EVP_SignInit.pod b/src/lib/libcrypto/doc/EVP_SignInit.pod index e65e54ce52..0bace24938 100644 --- a/src/lib/libcrypto/doc/EVP_SignInit.pod +++ b/src/lib/libcrypto/doc/EVP_SignInit.pod | |||
@@ -29,11 +29,10 @@ EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the | |||
29 | signature context B<ctx>. This function can be called several times on the | 29 | signature context B<ctx>. This function can be called several times on the |
30 | same B<ctx> to include additional data. | 30 | same B<ctx> to include additional data. |
31 | 31 | ||
32 | EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> | 32 | EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> and |
33 | and places the signature in B<sig>. If the B<s> parameter is not NULL | 33 | places the signature in B<sig>. The number of bytes of data written (i.e. the |
34 | then the number of bytes of data written (i.e. the length of the signature) | 34 | length of the signature) will be written to the integer at B<s>, at most |
35 | will be written to the integer at B<s>, at most EVP_PKEY_size(pkey) bytes | 35 | EVP_PKEY_size(pkey) bytes will be written. |
36 | will be written. | ||
37 | 36 | ||
38 | EVP_SignInit() initializes a signing context B<ctx> to use the default | 37 | EVP_SignInit() initializes a signing context B<ctx> to use the default |
39 | implementation of digest B<type>. | 38 | implementation of digest B<type>. |
diff --git a/src/lib/libcrypto/doc/RSA_public_encrypt.pod b/src/lib/libcrypto/doc/RSA_public_encrypt.pod index d53e19d2b7..ab0fe3b2cd 100644 --- a/src/lib/libcrypto/doc/RSA_public_encrypt.pod +++ b/src/lib/libcrypto/doc/RSA_public_encrypt.pod | |||
@@ -47,9 +47,10 @@ Encrypting user data directly with RSA is insecure. | |||
47 | =back | 47 | =back |
48 | 48 | ||
49 | B<flen> must be less than RSA_size(B<rsa>) - 11 for the PKCS #1 v1.5 | 49 | B<flen> must be less than RSA_size(B<rsa>) - 11 for the PKCS #1 v1.5 |
50 | based padding modes, and less than RSA_size(B<rsa>) - 41 for | 50 | based padding modes, less than RSA_size(B<rsa>) - 41 for |
51 | RSA_PKCS1_OAEP_PADDING. The random number generator must be seeded | 51 | RSA_PKCS1_OAEP_PADDING and exactly RSA_size(B<rsa>) for RSA_NO_PADDING. |
52 | prior to calling RSA_public_encrypt(). | 52 | The random number generator must be seeded prior to calling |
53 | RSA_public_encrypt(). | ||
53 | 54 | ||
54 | RSA_private_decrypt() decrypts the B<flen> bytes at B<from> using the | 55 | RSA_private_decrypt() decrypts the B<flen> bytes at B<from> using the |
55 | private key B<rsa> and stores the plaintext in B<to>. B<to> must point | 56 | private key B<rsa> and stores the plaintext in B<to>. B<to> must point |
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 9b3baadf2c..225ff391f9 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
@@ -81,6 +81,10 @@ | |||
81 | 81 | ||
82 | #define DSA_FLAG_CACHE_MONT_P 0x01 | 82 | #define DSA_FLAG_CACHE_MONT_P 0x01 |
83 | 83 | ||
84 | #if defined(OPENSSL_FIPS) | ||
85 | #define FIPS_DSA_SIZE_T int | ||
86 | #endif | ||
87 | |||
84 | #ifdef __cplusplus | 88 | #ifdef __cplusplus |
85 | extern "C" { | 89 | extern "C" { |
86 | #endif | 90 | #endif |
diff --git a/src/lib/libcrypto/dsa/dsa_gen.c b/src/lib/libcrypto/dsa/dsa_gen.c index dc9c249310..e40afeea51 100644 --- a/src/lib/libcrypto/dsa/dsa_gen.c +++ b/src/lib/libcrypto/dsa/dsa_gen.c | |||
@@ -80,6 +80,7 @@ | |||
80 | #include <openssl/rand.h> | 80 | #include <openssl/rand.h> |
81 | #include <openssl/sha.h> | 81 | #include <openssl/sha.h> |
82 | 82 | ||
83 | #ifndef OPENSSL_FIPS | ||
83 | DSA *DSA_generate_parameters(int bits, | 84 | DSA *DSA_generate_parameters(int bits, |
84 | unsigned char *seed_in, int seed_len, | 85 | unsigned char *seed_in, int seed_len, |
85 | int *counter_ret, unsigned long *h_ret, | 86 | int *counter_ret, unsigned long *h_ret, |
@@ -127,8 +128,9 @@ DSA *DSA_generate_parameters(int bits, | |||
127 | c = BN_CTX_get(ctx2); | 128 | c = BN_CTX_get(ctx2); |
128 | p = BN_CTX_get(ctx2); | 129 | p = BN_CTX_get(ctx2); |
129 | test = BN_CTX_get(ctx2); | 130 | test = BN_CTX_get(ctx2); |
131 | if (test == NULL) goto err; | ||
130 | 132 | ||
131 | BN_lshift(test,BN_value_one(),bits-1); | 133 | if (!BN_lshift(test,BN_value_one(),bits-1)) goto err; |
132 | 134 | ||
133 | for (;;) | 135 | for (;;) |
134 | { | 136 | { |
@@ -196,7 +198,7 @@ DSA *DSA_generate_parameters(int bits, | |||
196 | callback(0,counter,cb_arg); | 198 | callback(0,counter,cb_arg); |
197 | 199 | ||
198 | /* step 7 */ | 200 | /* step 7 */ |
199 | BN_zero(W); | 201 | if (!BN_zero(W)) goto err; |
200 | /* now 'buf' contains "SEED + offset - 1" */ | 202 | /* now 'buf' contains "SEED + offset - 1" */ |
201 | for (k=0; k<=n; k++) | 203 | for (k=0; k<=n; k++) |
202 | { | 204 | { |
@@ -212,20 +214,20 @@ DSA *DSA_generate_parameters(int bits, | |||
212 | /* step 8 */ | 214 | /* step 8 */ |
213 | if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,r0)) | 215 | if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,r0)) |
214 | goto err; | 216 | goto err; |
215 | BN_lshift(r0,r0,160*k); | 217 | if (!BN_lshift(r0,r0,160*k)) goto err; |
216 | BN_add(W,W,r0); | 218 | if (!BN_add(W,W,r0)) goto err; |
217 | } | 219 | } |
218 | 220 | ||
219 | /* more of step 8 */ | 221 | /* more of step 8 */ |
220 | BN_mask_bits(W,bits-1); | 222 | if (!BN_mask_bits(W,bits-1)) goto err; |
221 | BN_copy(X,W); /* this should be ok */ | 223 | if (!BN_copy(X,W)) goto err; |
222 | BN_add(X,X,test); /* this should be ok */ | 224 | if (!BN_add(X,X,test)) goto err; |
223 | 225 | ||
224 | /* step 9 */ | 226 | /* step 9 */ |
225 | BN_lshift1(r0,q); | 227 | if (!BN_lshift1(r0,q)) goto err; |
226 | BN_mod(c,X,r0,ctx); | 228 | if (!BN_mod(c,X,r0,ctx)) goto err; |
227 | BN_sub(r0,c,BN_value_one()); | 229 | if (!BN_sub(r0,c,BN_value_one())) goto err; |
228 | BN_sub(p,X,r0); | 230 | if (!BN_sub(p,X,r0)) goto err; |
229 | 231 | ||
230 | /* step 10 */ | 232 | /* step 10 */ |
231 | if (BN_cmp(p,test) >= 0) | 233 | if (BN_cmp(p,test) >= 0) |
@@ -251,18 +253,18 @@ end: | |||
251 | 253 | ||
252 | /* We now need to generate g */ | 254 | /* We now need to generate g */ |
253 | /* Set r0=(p-1)/q */ | 255 | /* Set r0=(p-1)/q */ |
254 | BN_sub(test,p,BN_value_one()); | 256 | if (!BN_sub(test,p,BN_value_one())) goto err; |
255 | BN_div(r0,NULL,test,q,ctx); | 257 | if (!BN_div(r0,NULL,test,q,ctx)) goto err; |
256 | 258 | ||
257 | BN_set_word(test,h); | 259 | if (!BN_set_word(test,h)) goto err; |
258 | BN_MONT_CTX_set(mont,p,ctx); | 260 | if (!BN_MONT_CTX_set(mont,p,ctx)) goto err; |
259 | 261 | ||
260 | for (;;) | 262 | for (;;) |
261 | { | 263 | { |
262 | /* g=test^r0%p */ | 264 | /* g=test^r0%p */ |
263 | BN_mod_exp_mont(g,test,r0,p,ctx,mont); | 265 | if (!BN_mod_exp_mont(g,test,r0,p,ctx,mont)) goto err; |
264 | if (!BN_is_one(g)) break; | 266 | if (!BN_is_one(g)) break; |
265 | BN_add(test,test,BN_value_one()); | 267 | if (!BN_add(test,test,BN_value_one())) goto err; |
266 | h++; | 268 | h++; |
267 | } | 269 | } |
268 | 270 | ||
@@ -279,6 +281,11 @@ err: | |||
279 | ret->p=BN_dup(p); | 281 | ret->p=BN_dup(p); |
280 | ret->q=BN_dup(q); | 282 | ret->q=BN_dup(q); |
281 | ret->g=BN_dup(g); | 283 | ret->g=BN_dup(g); |
284 | if (ret->p == NULL || ret->q == NULL || ret->g == NULL) | ||
285 | { | ||
286 | ok=0; | ||
287 | goto err; | ||
288 | } | ||
282 | if ((m > 1) && (seed_in != NULL)) memcpy(seed_in,seed,20); | 289 | if ((m > 1) && (seed_in != NULL)) memcpy(seed_in,seed,20); |
283 | if (counter_ret != NULL) *counter_ret=counter; | 290 | if (counter_ret != NULL) *counter_ret=counter; |
284 | if (h_ret != NULL) *h_ret=h; | 291 | if (h_ret != NULL) *h_ret=h; |
@@ -293,4 +300,6 @@ err: | |||
293 | if (mont != NULL) BN_MONT_CTX_free(mont); | 300 | if (mont != NULL) BN_MONT_CTX_free(mont); |
294 | return(ok?ret:NULL); | 301 | return(ok?ret:NULL); |
295 | } | 302 | } |
296 | #endif | 303 | #endif /* ndef OPENSSL_FIPS */ |
304 | #endif /* ndef OPENSSL_NO_SHA */ | ||
305 | |||
diff --git a/src/lib/libcrypto/dsa/dsa_key.c b/src/lib/libcrypto/dsa/dsa_key.c index ef87c3e637..30607ca579 100644 --- a/src/lib/libcrypto/dsa/dsa_key.c +++ b/src/lib/libcrypto/dsa/dsa_key.c | |||
@@ -64,6 +64,7 @@ | |||
64 | #include <openssl/dsa.h> | 64 | #include <openssl/dsa.h> |
65 | #include <openssl/rand.h> | 65 | #include <openssl/rand.h> |
66 | 66 | ||
67 | #ifndef OPENSSL_FIPS | ||
67 | int DSA_generate_key(DSA *dsa) | 68 | int DSA_generate_key(DSA *dsa) |
68 | { | 69 | { |
69 | int ok=0; | 70 | int ok=0; |
@@ -103,3 +104,4 @@ err: | |||
103 | return(ok); | 104 | return(ok); |
104 | } | 105 | } |
105 | #endif | 106 | #endif |
107 | #endif | ||
diff --git a/src/lib/libcrypto/dsa/dsa_ossl.c b/src/lib/libcrypto/dsa/dsa_ossl.c index b9e7f3ea5c..f1a85afcde 100644 --- a/src/lib/libcrypto/dsa/dsa_ossl.c +++ b/src/lib/libcrypto/dsa/dsa_ossl.c | |||
@@ -65,6 +65,7 @@ | |||
65 | #include <openssl/rand.h> | 65 | #include <openssl/rand.h> |
66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
67 | 67 | ||
68 | #ifndef OPENSSL_FIPS | ||
68 | static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); | 69 | static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); |
69 | static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp); | 70 | static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp); |
70 | static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | 71 | static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, |
@@ -346,3 +347,4 @@ static int dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, | |||
346 | { | 347 | { |
347 | return BN_mod_exp_mont(r, a, p, m, ctx, m_ctx); | 348 | return BN_mod_exp_mont(r, a, p, m, ctx, m_ctx); |
348 | } | 349 | } |
350 | #endif | ||
diff --git a/src/lib/libcrypto/dsa/dsa_sign.c b/src/lib/libcrypto/dsa/dsa_sign.c index 89205026f0..3c9753bac3 100644 --- a/src/lib/libcrypto/dsa/dsa_sign.c +++ b/src/lib/libcrypto/dsa/dsa_sign.c | |||
@@ -64,9 +64,17 @@ | |||
64 | #include <openssl/dsa.h> | 64 | #include <openssl/dsa.h> |
65 | #include <openssl/rand.h> | 65 | #include <openssl/rand.h> |
66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
67 | #ifndef OPENSSL_NO_ENGINE | ||
68 | #include <openssl/engine.h> | ||
69 | #endif | ||
70 | #include <openssl/fips.h> | ||
67 | 71 | ||
68 | DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | 72 | DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) |
69 | { | 73 | { |
74 | #ifdef OPENSSL_FIPS | ||
75 | if(FIPS_mode() && !FIPS_dsa_check(dsa)) | ||
76 | return NULL; | ||
77 | #endif | ||
70 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); | 78 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); |
71 | } | 79 | } |
72 | 80 | ||
@@ -87,6 +95,10 @@ int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, | |||
87 | 95 | ||
88 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | 96 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) |
89 | { | 97 | { |
98 | #ifdef OPENSSL_FIPS | ||
99 | if(FIPS_mode() && !FIPS_dsa_check(dsa)) | ||
100 | return 0; | ||
101 | #endif | ||
90 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); | 102 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); |
91 | } | 103 | } |
92 | 104 | ||
diff --git a/src/lib/libcrypto/dsa/dsa_vrf.c b/src/lib/libcrypto/dsa/dsa_vrf.c index c4aeddd056..8ef0c45025 100644 --- a/src/lib/libcrypto/dsa/dsa_vrf.c +++ b/src/lib/libcrypto/dsa/dsa_vrf.c | |||
@@ -65,10 +65,18 @@ | |||
65 | #include <openssl/rand.h> | 65 | #include <openssl/rand.h> |
66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
67 | #include <openssl/asn1_mac.h> | 67 | #include <openssl/asn1_mac.h> |
68 | #ifndef OPENSSL_NO_ENGINE | ||
69 | #include <openssl/engine.h> | ||
70 | #endif | ||
71 | #include <openssl/fips.h> | ||
68 | 72 | ||
69 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | 73 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, |
70 | DSA *dsa) | 74 | DSA *dsa) |
71 | { | 75 | { |
76 | #ifdef OPENSSL_FIPS | ||
77 | if(FIPS_mode() && !FIPS_dsa_check(dsa)) | ||
78 | return -1; | ||
79 | #endif | ||
72 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); | 80 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); |
73 | } | 81 | } |
74 | 82 | ||
diff --git a/src/lib/libcrypto/dso/dso_win32.c b/src/lib/libcrypto/dso/dso_win32.c index 6c30deb250..3fa90eb27c 100644 --- a/src/lib/libcrypto/dso/dso_win32.c +++ b/src/lib/libcrypto/dso/dso_win32.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/dso.h> | 62 | #include <openssl/dso.h> |
63 | 63 | ||
64 | #if !defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE) | 64 | #if !defined(DSO_WIN32) |
65 | DSO_METHOD *DSO_METHOD_win32(void) | 65 | DSO_METHOD *DSO_METHOD_win32(void) |
66 | { | 66 | { |
67 | return NULL; | 67 | return NULL; |
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index 0ca442af8a..41184b6786 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
@@ -93,7 +93,7 @@ static int open_dev_crypto(void); | |||
93 | static int get_dev_crypto(void); | 93 | static int get_dev_crypto(void); |
94 | static struct dev_crypto_cipher *cipher_nid_to_cryptodev(int nid); | 94 | static struct dev_crypto_cipher *cipher_nid_to_cryptodev(int nid); |
95 | static int get_cryptodev_ciphers(const int **cnids); | 95 | static int get_cryptodev_ciphers(const int **cnids); |
96 | static int get_cryptodev_digests(const int **cnids); | 96 | /*static int get_cryptodev_digests(const int **cnids);*/ |
97 | static int cryptodev_usable_ciphers(const int **nids); | 97 | static int cryptodev_usable_ciphers(const int **nids); |
98 | static int cryptodev_usable_digests(const int **nids); | 98 | static int cryptodev_usable_digests(const int **nids); |
99 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 99 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
@@ -150,6 +150,7 @@ static struct dev_crypto_cipher ciphers[] = { | |||
150 | { 0, NID_undef, 0, 0, }, | 150 | { 0, NID_undef, 0, 0, }, |
151 | }; | 151 | }; |
152 | 152 | ||
153 | #if 0 /* UNUSED */ | ||
153 | static struct { | 154 | static struct { |
154 | int id; | 155 | int id; |
155 | int nid; | 156 | int nid; |
@@ -162,6 +163,7 @@ static struct { | |||
162 | { CRYPTO_SHA1, NID_undef, }, | 163 | { CRYPTO_SHA1, NID_undef, }, |
163 | { 0, NID_undef, }, | 164 | { 0, NID_undef, }, |
164 | }; | 165 | }; |
166 | #endif | ||
165 | 167 | ||
166 | /* | 168 | /* |
167 | * Return a fd if /dev/crypto seems usable, -1 otherwise. | 169 | * Return a fd if /dev/crypto seems usable, -1 otherwise. |
@@ -297,6 +299,7 @@ get_cryptodev_ciphers(const int **cnids) | |||
297 | * returning them here is harmless, as long as we return NULL | 299 | * returning them here is harmless, as long as we return NULL |
298 | * when asked for a handler in the cryptodev_engine_digests routine | 300 | * when asked for a handler in the cryptodev_engine_digests routine |
299 | */ | 301 | */ |
302 | #if 0 /* UNUSED */ | ||
300 | static int | 303 | static int |
301 | get_cryptodev_digests(const int **cnids) | 304 | get_cryptodev_digests(const int **cnids) |
302 | { | 305 | { |
@@ -326,6 +329,7 @@ get_cryptodev_digests(const int **cnids) | |||
326 | *cnids = NULL; | 329 | *cnids = NULL; |
327 | return (count); | 330 | return (count); |
328 | } | 331 | } |
332 | #endif | ||
329 | 333 | ||
330 | /* | 334 | /* |
331 | * Find the useable ciphers|digests from dev/crypto - this is the first | 335 | * Find the useable ciphers|digests from dev/crypto - this is the first |
@@ -832,7 +836,7 @@ static int | |||
832 | bn2crparam(const BIGNUM *a, struct crparam *crp) | 836 | bn2crparam(const BIGNUM *a, struct crparam *crp) |
833 | { | 837 | { |
834 | int i, j, k; | 838 | int i, j, k; |
835 | ssize_t words, bytes, bits; | 839 | ssize_t bytes, bits; |
836 | u_char *b; | 840 | u_char *b; |
837 | 841 | ||
838 | crp->crp_p = NULL; | 842 | crp->crp_p = NULL; |
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index 792f329600..c78790a54c 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c | |||
@@ -149,6 +149,7 @@ static ERR_STRING_DATA ERR_str_libraries[]= | |||
149 | {ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"}, | 149 | {ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"}, |
150 | {ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"}, | 150 | {ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"}, |
151 | {ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"}, | 151 | {ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"}, |
152 | {ERR_PACK(ERR_LIB_FIPS,0,0) ,"FIPS routines"}, | ||
152 | {0,NULL}, | 153 | {0,NULL}, |
153 | }; | 154 | }; |
154 | 155 | ||
@@ -167,6 +168,7 @@ static ERR_STRING_DATA ERR_str_functs[]= | |||
167 | #endif | 168 | #endif |
168 | {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"}, | 169 | {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"}, |
169 | {ERR_PACK(0,SYS_F_FREAD,0), "fread"}, | 170 | {ERR_PACK(0,SYS_F_FREAD,0), "fread"}, |
171 | {ERR_PACK(0,SYS_F_GETADDRINFO,0), "getaddrinfo"}, | ||
170 | {0,NULL}, | 172 | {0,NULL}, |
171 | }; | 173 | }; |
172 | 174 | ||
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h index 8faa3a7b4f..2efa18866a 100644 --- a/src/lib/libcrypto/err/err.h +++ b/src/lib/libcrypto/err/err.h | |||
@@ -131,6 +131,7 @@ typedef struct err_state_st | |||
131 | #define ERR_LIB_OCSP 39 | 131 | #define ERR_LIB_OCSP 39 |
132 | #define ERR_LIB_UI 40 | 132 | #define ERR_LIB_UI 40 |
133 | #define ERR_LIB_COMP 41 | 133 | #define ERR_LIB_COMP 41 |
134 | #define ERR_LIB_FIPS 42 | ||
134 | 135 | ||
135 | #define ERR_LIB_USER 128 | 136 | #define ERR_LIB_USER 128 |
136 | 137 | ||
@@ -159,6 +160,7 @@ typedef struct err_state_st | |||
159 | #define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__) | 160 | #define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__) |
160 | #define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__) | 161 | #define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__) |
161 | #define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__) | 162 | #define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__) |
163 | #define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__) | ||
162 | 164 | ||
163 | /* Borland C seems too stupid to be able to shift and do longs in | 165 | /* Borland C seems too stupid to be able to shift and do longs in |
164 | * the pre-processor :-( */ | 166 | * the pre-processor :-( */ |
@@ -183,6 +185,7 @@ typedef struct err_state_st | |||
183 | #define SYS_F_WSASTARTUP 9 /* Winsock stuff */ | 185 | #define SYS_F_WSASTARTUP 9 /* Winsock stuff */ |
184 | #define SYS_F_OPENDIR 10 | 186 | #define SYS_F_OPENDIR 10 |
185 | #define SYS_F_FREAD 11 | 187 | #define SYS_F_FREAD 11 |
188 | #define SYS_F_GETADDRINFO 12 | ||
186 | 189 | ||
187 | 190 | ||
188 | /* reasons */ | 191 | /* reasons */ |
diff --git a/src/lib/libcrypto/err/err_all.c b/src/lib/libcrypto/err/err_all.c index dc505d9d9d..4dc9300892 100644 --- a/src/lib/libcrypto/err/err_all.c +++ b/src/lib/libcrypto/err/err_all.c | |||
@@ -87,6 +87,7 @@ | |||
87 | #endif | 87 | #endif |
88 | #include <openssl/ocsp.h> | 88 | #include <openssl/ocsp.h> |
89 | #include <openssl/err.h> | 89 | #include <openssl/err.h> |
90 | #include <openssl/fips.h> | ||
90 | 91 | ||
91 | void ERR_load_crypto_strings(void) | 92 | void ERR_load_crypto_strings(void) |
92 | { | 93 | { |
@@ -130,4 +131,7 @@ void ERR_load_crypto_strings(void) | |||
130 | ERR_load_OCSP_strings(); | 131 | ERR_load_OCSP_strings(); |
131 | ERR_load_UI_strings(); | 132 | ERR_load_UI_strings(); |
132 | #endif | 133 | #endif |
134 | #ifdef OPENSSL_FIPS | ||
135 | ERR_load_FIPS_strings(); | ||
136 | #endif | ||
133 | } | 137 | } |
diff --git a/src/lib/libcrypto/err/openssl.ec b/src/lib/libcrypto/err/openssl.ec index 29a69dfdd4..447a7f87ed 100644 --- a/src/lib/libcrypto/err/openssl.ec +++ b/src/lib/libcrypto/err/openssl.ec | |||
@@ -27,6 +27,7 @@ L DSO crypto/dso/dso.h crypto/dso/dso_err.c | |||
27 | L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c | 27 | L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c |
28 | L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c | 28 | L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c |
29 | L UI crypto/ui/ui.h crypto/ui/ui_err.c | 29 | L UI crypto/ui/ui.h crypto/ui/ui_err.c |
30 | L FIPS fips/fips.h fips/fips_err.h | ||
30 | 31 | ||
31 | # additional header files to be scanned for function names | 32 | # additional header files to be scanned for function names |
32 | L NONE crypto/x509/x509_vfy.h NONE | 33 | L NONE crypto/x509/x509_vfy.h NONE |
diff --git a/src/lib/libcrypto/evp/bio_md.c b/src/lib/libcrypto/evp/bio_md.c index c632dfb202..f4aa41ac4b 100644 --- a/src/lib/libcrypto/evp/bio_md.c +++ b/src/lib/libcrypto/evp/bio_md.c | |||
@@ -176,10 +176,11 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
176 | { | 176 | { |
177 | case BIO_CTRL_RESET: | 177 | case BIO_CTRL_RESET: |
178 | if (b->init) | 178 | if (b->init) |
179 | EVP_DigestInit_ex(ctx,ctx->digest, NULL); | 179 | ret = EVP_DigestInit_ex(ctx,ctx->digest, NULL); |
180 | else | 180 | else |
181 | ret=0; | 181 | ret=0; |
182 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 182 | if (ret > 0) |
183 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
183 | break; | 184 | break; |
184 | case BIO_C_GET_MD: | 185 | case BIO_C_GET_MD: |
185 | if (b->init) | 186 | if (b->init) |
@@ -191,11 +192,12 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
191 | ret=0; | 192 | ret=0; |
192 | break; | 193 | break; |
193 | case BIO_C_GET_MD_CTX: | 194 | case BIO_C_GET_MD_CTX: |
195 | pctx=ptr; | ||
196 | *pctx=ctx; | ||
197 | break; | ||
198 | case BIO_C_SET_MD_CTX: | ||
194 | if (b->init) | 199 | if (b->init) |
195 | { | 200 | b->ptr=ptr; |
196 | pctx=ptr; | ||
197 | *pctx=ctx; | ||
198 | } | ||
199 | else | 201 | else |
200 | ret=0; | 202 | ret=0; |
201 | break; | 203 | break; |
@@ -207,8 +209,9 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
207 | 209 | ||
208 | case BIO_C_SET_MD: | 210 | case BIO_C_SET_MD: |
209 | md=ptr; | 211 | md=ptr; |
210 | EVP_DigestInit_ex(ctx,md, NULL); | 212 | ret = EVP_DigestInit_ex(ctx,md, NULL); |
211 | b->init=1; | 213 | if (ret > 0) |
214 | b->init=1; | ||
212 | break; | 215 | break; |
213 | case BIO_CTRL_DUP: | 216 | case BIO_CTRL_DUP: |
214 | dbio=ptr; | 217 | dbio=ptr; |
diff --git a/src/lib/libcrypto/evp/c_allc.c b/src/lib/libcrypto/evp/c_allc.c index 341a958fd4..fc96812365 100644 --- a/src/lib/libcrypto/evp/c_allc.c +++ b/src/lib/libcrypto/evp/c_allc.c | |||
@@ -67,6 +67,8 @@ void OpenSSL_add_all_ciphers(void) | |||
67 | 67 | ||
68 | #ifndef OPENSSL_NO_DES | 68 | #ifndef OPENSSL_NO_DES |
69 | EVP_add_cipher(EVP_des_cfb()); | 69 | EVP_add_cipher(EVP_des_cfb()); |
70 | EVP_add_cipher(EVP_des_cfb1()); | ||
71 | EVP_add_cipher(EVP_des_cfb8()); | ||
70 | EVP_add_cipher(EVP_des_ede_cfb()); | 72 | EVP_add_cipher(EVP_des_ede_cfb()); |
71 | EVP_add_cipher(EVP_des_ede3_cfb()); | 73 | EVP_add_cipher(EVP_des_ede3_cfb()); |
72 | 74 | ||
@@ -150,6 +152,8 @@ void OpenSSL_add_all_ciphers(void) | |||
150 | EVP_add_cipher(EVP_aes_128_ecb()); | 152 | EVP_add_cipher(EVP_aes_128_ecb()); |
151 | EVP_add_cipher(EVP_aes_128_cbc()); | 153 | EVP_add_cipher(EVP_aes_128_cbc()); |
152 | EVP_add_cipher(EVP_aes_128_cfb()); | 154 | EVP_add_cipher(EVP_aes_128_cfb()); |
155 | EVP_add_cipher(EVP_aes_128_cfb1()); | ||
156 | EVP_add_cipher(EVP_aes_128_cfb8()); | ||
153 | EVP_add_cipher(EVP_aes_128_ofb()); | 157 | EVP_add_cipher(EVP_aes_128_ofb()); |
154 | #if 0 | 158 | #if 0 |
155 | EVP_add_cipher(EVP_aes_128_ctr()); | 159 | EVP_add_cipher(EVP_aes_128_ctr()); |
@@ -159,6 +163,8 @@ void OpenSSL_add_all_ciphers(void) | |||
159 | EVP_add_cipher(EVP_aes_192_ecb()); | 163 | EVP_add_cipher(EVP_aes_192_ecb()); |
160 | EVP_add_cipher(EVP_aes_192_cbc()); | 164 | EVP_add_cipher(EVP_aes_192_cbc()); |
161 | EVP_add_cipher(EVP_aes_192_cfb()); | 165 | EVP_add_cipher(EVP_aes_192_cfb()); |
166 | EVP_add_cipher(EVP_aes_192_cfb1()); | ||
167 | EVP_add_cipher(EVP_aes_192_cfb8()); | ||
162 | EVP_add_cipher(EVP_aes_192_ofb()); | 168 | EVP_add_cipher(EVP_aes_192_ofb()); |
163 | #if 0 | 169 | #if 0 |
164 | EVP_add_cipher(EVP_aes_192_ctr()); | 170 | EVP_add_cipher(EVP_aes_192_ctr()); |
@@ -168,6 +174,8 @@ void OpenSSL_add_all_ciphers(void) | |||
168 | EVP_add_cipher(EVP_aes_256_ecb()); | 174 | EVP_add_cipher(EVP_aes_256_ecb()); |
169 | EVP_add_cipher(EVP_aes_256_cbc()); | 175 | EVP_add_cipher(EVP_aes_256_cbc()); |
170 | EVP_add_cipher(EVP_aes_256_cfb()); | 176 | EVP_add_cipher(EVP_aes_256_cfb()); |
177 | EVP_add_cipher(EVP_aes_256_cfb1()); | ||
178 | EVP_add_cipher(EVP_aes_256_cfb8()); | ||
171 | EVP_add_cipher(EVP_aes_256_ofb()); | 179 | EVP_add_cipher(EVP_aes_256_ofb()); |
172 | #if 0 | 180 | #if 0 |
173 | EVP_add_cipher(EVP_aes_256_ctr()); | 181 | EVP_add_cipher(EVP_aes_256_ctr()); |
diff --git a/src/lib/libcrypto/evp/c_alld.c b/src/lib/libcrypto/evp/c_alld.c index be91cdb037..aae7bf7482 100644 --- a/src/lib/libcrypto/evp/c_alld.c +++ b/src/lib/libcrypto/evp/c_alld.c | |||
@@ -75,7 +75,7 @@ void OpenSSL_add_all_digests(void) | |||
75 | EVP_add_digest_alias(SN_md5,"ssl2-md5"); | 75 | EVP_add_digest_alias(SN_md5,"ssl2-md5"); |
76 | EVP_add_digest_alias(SN_md5,"ssl3-md5"); | 76 | EVP_add_digest_alias(SN_md5,"ssl3-md5"); |
77 | #endif | 77 | #endif |
78 | #ifndef OPENSSL_NO_SHA | 78 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) |
79 | EVP_add_digest(EVP_sha()); | 79 | EVP_add_digest(EVP_sha()); |
80 | #ifndef OPENSSL_NO_DSA | 80 | #ifndef OPENSSL_NO_DSA |
81 | EVP_add_digest(EVP_dss()); | 81 | EVP_add_digest(EVP_dss()); |
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c index 0623ddf1f0..f21c63842c 100644 --- a/src/lib/libcrypto/evp/digest.c +++ b/src/lib/libcrypto/evp/digest.c | |||
@@ -137,6 +137,39 @@ int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) | |||
137 | return EVP_DigestInit_ex(ctx, type, NULL); | 137 | return EVP_DigestInit_ex(ctx, type, NULL); |
138 | } | 138 | } |
139 | 139 | ||
140 | #ifdef OPENSSL_FIPS | ||
141 | |||
142 | /* The purpose of these is to trap programs that attempt to use non FIPS | ||
143 | * algorithms in FIPS mode and ignore the errors. | ||
144 | */ | ||
145 | |||
146 | static int bad_init(EVP_MD_CTX *ctx) | ||
147 | { FIPS_ERROR_IGNORED("Digest init"); return 0;} | ||
148 | |||
149 | static int bad_update(EVP_MD_CTX *ctx,const void *data,unsigned long count) | ||
150 | { FIPS_ERROR_IGNORED("Digest update"); return 0;} | ||
151 | |||
152 | static int bad_final(EVP_MD_CTX *ctx,unsigned char *md) | ||
153 | { FIPS_ERROR_IGNORED("Digest Final"); return 0;} | ||
154 | |||
155 | static const EVP_MD bad_md = | ||
156 | { | ||
157 | 0, | ||
158 | 0, | ||
159 | 0, | ||
160 | 0, | ||
161 | bad_init, | ||
162 | bad_update, | ||
163 | bad_final, | ||
164 | NULL, | ||
165 | NULL, | ||
166 | NULL, | ||
167 | 0, | ||
168 | {0,0,0,0}, | ||
169 | }; | ||
170 | |||
171 | #endif | ||
172 | |||
140 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | 173 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) |
141 | { | 174 | { |
142 | EVP_MD_CTX_clear_flags(ctx,EVP_MD_CTX_FLAG_CLEANED); | 175 | EVP_MD_CTX_clear_flags(ctx,EVP_MD_CTX_FLAG_CLEANED); |
@@ -195,6 +228,18 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | |||
195 | #endif | 228 | #endif |
196 | if (ctx->digest != type) | 229 | if (ctx->digest != type) |
197 | { | 230 | { |
231 | #ifdef OPENSSL_FIPS | ||
232 | if (FIPS_mode()) | ||
233 | { | ||
234 | if (!(type->flags & EVP_MD_FLAG_FIPS) | ||
235 | && !(ctx->flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)) | ||
236 | { | ||
237 | EVPerr(EVP_F_EVP_DIGESTINIT, EVP_R_DISABLED_FOR_FIPS); | ||
238 | ctx->digest = &bad_md; | ||
239 | return 0; | ||
240 | } | ||
241 | } | ||
242 | #endif | ||
198 | if (ctx->digest && ctx->digest->ctx_size) | 243 | if (ctx->digest && ctx->digest->ctx_size) |
199 | OPENSSL_free(ctx->md_data); | 244 | OPENSSL_free(ctx->md_data); |
200 | ctx->digest=type; | 245 | ctx->digest=type; |
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index fe8bcda631..f35036c9d7 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c | |||
@@ -67,34 +67,52 @@ typedef struct | |||
67 | 67 | ||
68 | IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY, | 68 | IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY, |
69 | NID_aes_128, 16, 16, 16, 128, | 69 | NID_aes_128, 16, 16, 16, 128, |
70 | 0, aes_init_key, NULL, | 70 | EVP_CIPH_FLAG_FIPS, aes_init_key, NULL, |
71 | EVP_CIPHER_set_asn1_iv, | 71 | EVP_CIPHER_set_asn1_iv, |
72 | EVP_CIPHER_get_asn1_iv, | 72 | EVP_CIPHER_get_asn1_iv, |
73 | NULL) | 73 | NULL) |
74 | IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY, | 74 | IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY, |
75 | NID_aes_192, 16, 24, 16, 128, | 75 | NID_aes_192, 16, 24, 16, 128, |
76 | 0, aes_init_key, NULL, | 76 | EVP_CIPH_FLAG_FIPS, aes_init_key, NULL, |
77 | EVP_CIPHER_set_asn1_iv, | 77 | EVP_CIPHER_set_asn1_iv, |
78 | EVP_CIPHER_get_asn1_iv, | 78 | EVP_CIPHER_get_asn1_iv, |
79 | NULL) | 79 | NULL) |
80 | IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY, | 80 | IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY, |
81 | NID_aes_256, 16, 32, 16, 128, | 81 | NID_aes_256, 16, 32, 16, 128, |
82 | 0, aes_init_key, NULL, | 82 | EVP_CIPH_FLAG_FIPS, aes_init_key, NULL, |
83 | EVP_CIPHER_set_asn1_iv, | 83 | EVP_CIPHER_set_asn1_iv, |
84 | EVP_CIPHER_get_asn1_iv, | 84 | EVP_CIPHER_get_asn1_iv, |
85 | NULL) | 85 | NULL) |
86 | 86 | ||
87 | #define IMPLEMENT_AES_CFBR(ksize,cbits,flags) IMPLEMENT_CFBR(aes,AES,EVP_AES_KEY,ks,ksize,cbits,16,flags) | ||
88 | |||
89 | IMPLEMENT_AES_CFBR(128,1,0) | ||
90 | IMPLEMENT_AES_CFBR(192,1,0) | ||
91 | IMPLEMENT_AES_CFBR(256,1,0) | ||
92 | |||
93 | IMPLEMENT_AES_CFBR(128,8,EVP_CIPH_FLAG_FIPS) | ||
94 | IMPLEMENT_AES_CFBR(192,8,EVP_CIPH_FLAG_FIPS) | ||
95 | IMPLEMENT_AES_CFBR(256,8,EVP_CIPH_FLAG_FIPS) | ||
96 | |||
87 | static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 97 | static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
88 | const unsigned char *iv, int enc) { | 98 | const unsigned char *iv, int enc) |
99 | { | ||
100 | int ret; | ||
89 | 101 | ||
90 | if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE | 102 | if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE |
91 | || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE | 103 | || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE |
92 | || enc) | 104 | || enc) |
93 | AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data); | 105 | ret=AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data); |
94 | else | 106 | else |
95 | AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data); | 107 | ret=AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data); |
108 | |||
109 | if(ret < 0) | ||
110 | { | ||
111 | EVPerr(EVP_F_AES_INIT_KEY,EVP_R_AES_KEY_SETUP_FAILED); | ||
112 | return 0; | ||
113 | } | ||
96 | 114 | ||
97 | return 1; | 115 | return 1; |
98 | } | 116 | } |
99 | 117 | ||
100 | #endif | 118 | #endif |
diff --git a/src/lib/libcrypto/evp/e_des.c b/src/lib/libcrypto/evp/e_des.c index 105266a4b3..46e2899825 100644 --- a/src/lib/libcrypto/evp/e_des.c +++ b/src/lib/libcrypto/evp/e_des.c | |||
@@ -56,9 +56,9 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_DES | ||
60 | #include <stdio.h> | 59 | #include <stdio.h> |
61 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #ifndef OPENSSL_NO_DES | ||
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
64 | #include "evp_locl.h" | 64 | #include "evp_locl.h" |
@@ -92,20 +92,55 @@ static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
92 | return 1; | 92 | return 1; |
93 | } | 93 | } |
94 | 94 | ||
95 | static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 95 | static int des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
96 | const unsigned char *in, unsigned int inl) | 96 | const unsigned char *in, unsigned int inl) |
97 | { | 97 | { |
98 | DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data, | 98 | DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data, |
99 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); | 99 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); |
100 | return 1; | 100 | return 1; |
101 | } | 101 | } |
102 | 102 | ||
103 | /* Although we have a CFB-r implementation for DES, it doesn't pack the right | ||
104 | way, so wrap it here */ | ||
105 | static int des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
106 | const unsigned char *in, unsigned int inl) | ||
107 | { | ||
108 | unsigned int n; | ||
109 | unsigned char c[1],d[1]; | ||
110 | |||
111 | for(n=0 ; n < inl ; ++n) | ||
112 | { | ||
113 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | ||
114 | DES_cfb_encrypt(c,d,1,1,ctx->cipher_data,(DES_cblock *)ctx->iv, | ||
115 | ctx->encrypt); | ||
116 | out[n/8]=(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8)); | ||
117 | } | ||
118 | return 1; | ||
119 | } | ||
120 | |||
121 | static int des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
122 | const unsigned char *in, unsigned int inl) | ||
123 | { | ||
124 | DES_cfb_encrypt(in,out,8,inl,ctx->cipher_data,(DES_cblock *)ctx->iv, | ||
125 | ctx->encrypt); | ||
126 | return 1; | ||
127 | } | ||
128 | |||
103 | BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64, | 129 | BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64, |
104 | 0, des_init_key, NULL, | 130 | EVP_CIPH_FLAG_FIPS, des_init_key, NULL, |
105 | EVP_CIPHER_set_asn1_iv, | 131 | EVP_CIPHER_set_asn1_iv, |
106 | EVP_CIPHER_get_asn1_iv, | 132 | EVP_CIPHER_get_asn1_iv, |
107 | NULL) | 133 | NULL) |
108 | 134 | ||
135 | BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,1, | ||
136 | EVP_CIPH_FLAG_FIPS,des_init_key,NULL, | ||
137 | EVP_CIPHER_set_asn1_iv, | ||
138 | EVP_CIPHER_get_asn1_iv,NULL) | ||
139 | |||
140 | BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,8, | ||
141 | EVP_CIPH_FLAG_FIPS,des_init_key,NULL, | ||
142 | EVP_CIPHER_set_asn1_iv, | ||
143 | EVP_CIPHER_get_asn1_iv,NULL) | ||
109 | 144 | ||
110 | static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 145 | static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
111 | const unsigned char *iv, int enc) | 146 | const unsigned char *iv, int enc) |
diff --git a/src/lib/libcrypto/evp/e_des3.c b/src/lib/libcrypto/evp/e_des3.c index 077860e7b6..677322bf02 100644 --- a/src/lib/libcrypto/evp/e_des3.c +++ b/src/lib/libcrypto/evp/e_des3.c | |||
@@ -56,9 +56,9 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_DES | ||
60 | #include <stdio.h> | 59 | #include <stdio.h> |
61 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #ifndef OPENSSL_NO_DES | ||
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
64 | #include "evp_locl.h" | 64 | #include "evp_locl.h" |
@@ -85,7 +85,7 @@ static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
85 | const unsigned char *in, unsigned int inl) | 85 | const unsigned char *in, unsigned int inl) |
86 | { | 86 | { |
87 | BLOCK_CIPHER_ecb_loop() | 87 | BLOCK_CIPHER_ecb_loop() |
88 | DES_ecb3_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i), | 88 | DES_ecb3_encrypt(in + i,out + i, |
89 | &data(ctx)->ks1, &data(ctx)->ks2, | 89 | &data(ctx)->ks1, &data(ctx)->ks2, |
90 | &data(ctx)->ks3, | 90 | &data(ctx)->ks3, |
91 | ctx->encrypt); | 91 | ctx->encrypt); |
@@ -121,7 +121,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
121 | return 1; | 121 | return 1; |
122 | } | 122 | } |
123 | 123 | ||
124 | static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 124 | static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
125 | const unsigned char *in, unsigned int inl) | 125 | const unsigned char *in, unsigned int inl) |
126 | { | 126 | { |
127 | DES_ede3_cfb64_encrypt(in, out, (long)inl, | 127 | DES_ede3_cfb64_encrypt(in, out, (long)inl, |
@@ -130,23 +130,62 @@ static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
130 | return 1; | 130 | return 1; |
131 | } | 131 | } |
132 | 132 | ||
133 | /* Although we have a CFB-r implementation for 3-DES, it doesn't pack the right | ||
134 | way, so wrap it here */ | ||
135 | static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
136 | const unsigned char *in, unsigned int inl) | ||
137 | { | ||
138 | unsigned int n; | ||
139 | unsigned char c[1],d[1]; | ||
140 | |||
141 | for(n=0 ; n < inl ; ++n) | ||
142 | { | ||
143 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | ||
144 | DES_ede3_cfb_encrypt(c,d,1,1, | ||
145 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, | ||
146 | (DES_cblock *)ctx->iv,ctx->encrypt); | ||
147 | out[n/8]=(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8)); | ||
148 | } | ||
149 | |||
150 | return 1; | ||
151 | } | ||
152 | |||
153 | static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
154 | const unsigned char *in, unsigned int inl) | ||
155 | { | ||
156 | DES_ede3_cfb_encrypt(in,out,8,inl, | ||
157 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, | ||
158 | (DES_cblock *)ctx->iv,ctx->encrypt); | ||
159 | return 1; | ||
160 | } | ||
161 | |||
133 | BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64, | 162 | BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64, |
134 | 0, des_ede_init_key, NULL, | 163 | EVP_CIPH_FLAG_FIPS, des_ede_init_key, NULL, |
135 | EVP_CIPHER_set_asn1_iv, | 164 | EVP_CIPHER_set_asn1_iv, |
136 | EVP_CIPHER_get_asn1_iv, | 165 | EVP_CIPHER_get_asn1_iv, |
137 | NULL) | 166 | NULL) |
138 | 167 | ||
139 | #define des_ede3_cfb_cipher des_ede_cfb_cipher | 168 | #define des_ede3_cfb64_cipher des_ede_cfb64_cipher |
140 | #define des_ede3_ofb_cipher des_ede_ofb_cipher | 169 | #define des_ede3_ofb_cipher des_ede_ofb_cipher |
141 | #define des_ede3_cbc_cipher des_ede_cbc_cipher | 170 | #define des_ede3_cbc_cipher des_ede_cbc_cipher |
142 | #define des_ede3_ecb_cipher des_ede_ecb_cipher | 171 | #define des_ede3_ecb_cipher des_ede_ecb_cipher |
143 | 172 | ||
144 | BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64, | 173 | BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64, |
145 | 0, des_ede3_init_key, NULL, | 174 | EVP_CIPH_FLAG_FIPS, des_ede3_init_key, NULL, |
146 | EVP_CIPHER_set_asn1_iv, | 175 | EVP_CIPHER_set_asn1_iv, |
147 | EVP_CIPHER_get_asn1_iv, | 176 | EVP_CIPHER_get_asn1_iv, |
148 | NULL) | 177 | NULL) |
149 | 178 | ||
179 | BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,1, | ||
180 | EVP_CIPH_FLAG_FIPS, des_ede3_init_key,NULL, | ||
181 | EVP_CIPHER_set_asn1_iv, | ||
182 | EVP_CIPHER_get_asn1_iv,NULL) | ||
183 | |||
184 | BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,8, | ||
185 | EVP_CIPH_FLAG_FIPS, des_ede3_init_key,NULL, | ||
186 | EVP_CIPHER_set_asn1_iv, | ||
187 | EVP_CIPHER_get_asn1_iv,NULL) | ||
188 | |||
150 | static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 189 | static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
151 | const unsigned char *iv, int enc) | 190 | const unsigned char *iv, int enc) |
152 | { | 191 | { |
diff --git a/src/lib/libcrypto/evp/e_null.c b/src/lib/libcrypto/evp/e_null.c index 2420d7e5af..a84b0f14b1 100644 --- a/src/lib/libcrypto/evp/e_null.c +++ b/src/lib/libcrypto/evp/e_null.c | |||
@@ -69,7 +69,7 @@ static const EVP_CIPHER n_cipher= | |||
69 | { | 69 | { |
70 | NID_undef, | 70 | NID_undef, |
71 | 1,0,0, | 71 | 1,0,0, |
72 | 0, | 72 | EVP_CIPH_FLAG_FIPS, |
73 | null_init_key, | 73 | null_init_key, |
74 | null_cipher, | 74 | null_cipher, |
75 | NULL, | 75 | NULL, |
diff --git a/src/lib/libcrypto/evp/e_rc4.c b/src/lib/libcrypto/evp/e_rc4.c index d58f507837..8aa70585b9 100644 --- a/src/lib/libcrypto/evp/e_rc4.c +++ b/src/lib/libcrypto/evp/e_rc4.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
63 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
64 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
65 | #include "evp_locl.h" | ||
65 | #include <openssl/rc4.h> | 66 | #include <openssl/rc4.h> |
66 | 67 | ||
67 | /* FIXME: surely this is available elsewhere? */ | 68 | /* FIXME: surely this is available elsewhere? */ |
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index f9b48792ce..62d95354ef 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
@@ -75,6 +75,10 @@ | |||
75 | #include <openssl/bio.h> | 75 | #include <openssl/bio.h> |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | #ifdef OPENSSL_FIPS | ||
79 | #include <openssl/fips.h> | ||
80 | #endif | ||
81 | |||
78 | /* | 82 | /* |
79 | #define EVP_RC2_KEY_SIZE 16 | 83 | #define EVP_RC2_KEY_SIZE 16 |
80 | #define EVP_RC4_KEY_SIZE 16 | 84 | #define EVP_RC4_KEY_SIZE 16 |
@@ -236,6 +240,7 @@ struct env_md_st | |||
236 | 240 | ||
237 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single | 241 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single |
238 | * block */ | 242 | * block */ |
243 | #define EVP_MD_FLAG_FIPS 0x0400 /* Note if suitable for use in FIPS mode */ | ||
239 | 244 | ||
240 | #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} | 245 | #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} |
241 | 246 | ||
@@ -278,6 +283,9 @@ struct env_md_ctx_st | |||
278 | #define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data | 283 | #define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data |
279 | * in EVP_MD_CTX_cleanup */ | 284 | * in EVP_MD_CTX_cleanup */ |
280 | 285 | ||
286 | #define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008 /* Allow use of non FIPS digest | ||
287 | * in FIPS mode */ | ||
288 | |||
281 | struct evp_cipher_st | 289 | struct evp_cipher_st |
282 | { | 290 | { |
283 | int nid; | 291 | int nid; |
@@ -319,6 +327,10 @@ struct evp_cipher_st | |||
319 | #define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 | 327 | #define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 |
320 | /* Don't use standard block padding */ | 328 | /* Don't use standard block padding */ |
321 | #define EVP_CIPH_NO_PADDING 0x100 | 329 | #define EVP_CIPH_NO_PADDING 0x100 |
330 | /* Note if suitable for use in FIPS mode */ | ||
331 | #define EVP_CIPH_FLAG_FIPS 0x400 | ||
332 | /* Allow non FIPS cipher in FIPS mode */ | ||
333 | #define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x800 | ||
322 | 334 | ||
323 | /* ctrl() values */ | 335 | /* ctrl() values */ |
324 | 336 | ||
@@ -425,6 +437,9 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
425 | #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) | 437 | #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) |
426 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) | 438 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) |
427 | #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) | 439 | #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) |
440 | #define EVP_CIPHER_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs)) | ||
441 | #define EVP_CIPHER_CTX_clear_flags(ctx,flgs) ((ctx)->flags&=~(flgs)) | ||
442 | #define EVP_CIPHER_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs)) | ||
428 | #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) | 443 | #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) |
429 | 444 | ||
430 | #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) | 445 | #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) |
@@ -446,6 +461,7 @@ void BIO_set_md(BIO *,const EVP_MD *md); | |||
446 | #endif | 461 | #endif |
447 | #define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) | 462 | #define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) |
448 | #define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) | 463 | #define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) |
464 | #define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp) | ||
449 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) | 465 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) |
450 | #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) | 466 | #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) |
451 | 467 | ||
@@ -587,9 +603,20 @@ const EVP_CIPHER *EVP_des_ede(void); | |||
587 | const EVP_CIPHER *EVP_des_ede3(void); | 603 | const EVP_CIPHER *EVP_des_ede3(void); |
588 | const EVP_CIPHER *EVP_des_ede_ecb(void); | 604 | const EVP_CIPHER *EVP_des_ede_ecb(void); |
589 | const EVP_CIPHER *EVP_des_ede3_ecb(void); | 605 | const EVP_CIPHER *EVP_des_ede3_ecb(void); |
590 | const EVP_CIPHER *EVP_des_cfb(void); | 606 | const EVP_CIPHER *EVP_des_cfb64(void); |
591 | const EVP_CIPHER *EVP_des_ede_cfb(void); | 607 | # define EVP_des_cfb EVP_des_cfb64 |
592 | const EVP_CIPHER *EVP_des_ede3_cfb(void); | 608 | const EVP_CIPHER *EVP_des_cfb1(void); |
609 | const EVP_CIPHER *EVP_des_cfb8(void); | ||
610 | const EVP_CIPHER *EVP_des_ede_cfb64(void); | ||
611 | # define EVP_des_ede_cfb EVP_des_ede_cfb64 | ||
612 | #if 0 | ||
613 | const EVP_CIPHER *EVP_des_ede_cfb1(void); | ||
614 | const EVP_CIPHER *EVP_des_ede_cfb8(void); | ||
615 | #endif | ||
616 | const EVP_CIPHER *EVP_des_ede3_cfb64(void); | ||
617 | # define EVP_des_ede3_cfb EVP_des_ede3_cfb64 | ||
618 | const EVP_CIPHER *EVP_des_ede3_cfb1(void); | ||
619 | const EVP_CIPHER *EVP_des_ede3_cfb8(void); | ||
593 | const EVP_CIPHER *EVP_des_ofb(void); | 620 | const EVP_CIPHER *EVP_des_ofb(void); |
594 | const EVP_CIPHER *EVP_des_ede_ofb(void); | 621 | const EVP_CIPHER *EVP_des_ede_ofb(void); |
595 | const EVP_CIPHER *EVP_des_ede3_ofb(void); | 622 | const EVP_CIPHER *EVP_des_ede3_ofb(void); |
@@ -613,7 +640,8 @@ const EVP_CIPHER *EVP_rc4_40(void); | |||
613 | #endif | 640 | #endif |
614 | #ifndef OPENSSL_NO_IDEA | 641 | #ifndef OPENSSL_NO_IDEA |
615 | const EVP_CIPHER *EVP_idea_ecb(void); | 642 | const EVP_CIPHER *EVP_idea_ecb(void); |
616 | const EVP_CIPHER *EVP_idea_cfb(void); | 643 | const EVP_CIPHER *EVP_idea_cfb64(void); |
644 | # define EVP_idea_cfb EVP_idea_cfb64 | ||
617 | const EVP_CIPHER *EVP_idea_ofb(void); | 645 | const EVP_CIPHER *EVP_idea_ofb(void); |
618 | const EVP_CIPHER *EVP_idea_cbc(void); | 646 | const EVP_CIPHER *EVP_idea_cbc(void); |
619 | #endif | 647 | #endif |
@@ -622,45 +650,58 @@ const EVP_CIPHER *EVP_rc2_ecb(void); | |||
622 | const EVP_CIPHER *EVP_rc2_cbc(void); | 650 | const EVP_CIPHER *EVP_rc2_cbc(void); |
623 | const EVP_CIPHER *EVP_rc2_40_cbc(void); | 651 | const EVP_CIPHER *EVP_rc2_40_cbc(void); |
624 | const EVP_CIPHER *EVP_rc2_64_cbc(void); | 652 | const EVP_CIPHER *EVP_rc2_64_cbc(void); |
625 | const EVP_CIPHER *EVP_rc2_cfb(void); | 653 | const EVP_CIPHER *EVP_rc2_cfb64(void); |
654 | # define EVP_rc2_cfb EVP_rc2_cfb64 | ||
626 | const EVP_CIPHER *EVP_rc2_ofb(void); | 655 | const EVP_CIPHER *EVP_rc2_ofb(void); |
627 | #endif | 656 | #endif |
628 | #ifndef OPENSSL_NO_BF | 657 | #ifndef OPENSSL_NO_BF |
629 | const EVP_CIPHER *EVP_bf_ecb(void); | 658 | const EVP_CIPHER *EVP_bf_ecb(void); |
630 | const EVP_CIPHER *EVP_bf_cbc(void); | 659 | const EVP_CIPHER *EVP_bf_cbc(void); |
631 | const EVP_CIPHER *EVP_bf_cfb(void); | 660 | const EVP_CIPHER *EVP_bf_cfb64(void); |
661 | # define EVP_bf_cfb EVP_bf_cfb64 | ||
632 | const EVP_CIPHER *EVP_bf_ofb(void); | 662 | const EVP_CIPHER *EVP_bf_ofb(void); |
633 | #endif | 663 | #endif |
634 | #ifndef OPENSSL_NO_CAST | 664 | #ifndef OPENSSL_NO_CAST |
635 | const EVP_CIPHER *EVP_cast5_ecb(void); | 665 | const EVP_CIPHER *EVP_cast5_ecb(void); |
636 | const EVP_CIPHER *EVP_cast5_cbc(void); | 666 | const EVP_CIPHER *EVP_cast5_cbc(void); |
637 | const EVP_CIPHER *EVP_cast5_cfb(void); | 667 | const EVP_CIPHER *EVP_cast5_cfb64(void); |
668 | # define EVP_cast5_cfb EVP_cast5_cfb64 | ||
638 | const EVP_CIPHER *EVP_cast5_ofb(void); | 669 | const EVP_CIPHER *EVP_cast5_ofb(void); |
639 | #endif | 670 | #endif |
640 | #ifndef OPENSSL_NO_RC5 | 671 | #ifndef OPENSSL_NO_RC5 |
641 | const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); | 672 | const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); |
642 | const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); | 673 | const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); |
643 | const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void); | 674 | const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); |
675 | # define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 | ||
644 | const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); | 676 | const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); |
645 | #endif | 677 | #endif |
646 | #ifndef OPENSSL_NO_AES | 678 | #ifndef OPENSSL_NO_AES |
647 | const EVP_CIPHER *EVP_aes_128_ecb(void); | 679 | const EVP_CIPHER *EVP_aes_128_ecb(void); |
648 | const EVP_CIPHER *EVP_aes_128_cbc(void); | 680 | const EVP_CIPHER *EVP_aes_128_cbc(void); |
649 | const EVP_CIPHER *EVP_aes_128_cfb(void); | 681 | const EVP_CIPHER *EVP_aes_128_cfb1(void); |
682 | const EVP_CIPHER *EVP_aes_128_cfb8(void); | ||
683 | const EVP_CIPHER *EVP_aes_128_cfb128(void); | ||
684 | # define EVP_aes_128_cfb EVP_aes_128_cfb128 | ||
650 | const EVP_CIPHER *EVP_aes_128_ofb(void); | 685 | const EVP_CIPHER *EVP_aes_128_ofb(void); |
651 | #if 0 | 686 | #if 0 |
652 | const EVP_CIPHER *EVP_aes_128_ctr(void); | 687 | const EVP_CIPHER *EVP_aes_128_ctr(void); |
653 | #endif | 688 | #endif |
654 | const EVP_CIPHER *EVP_aes_192_ecb(void); | 689 | const EVP_CIPHER *EVP_aes_192_ecb(void); |
655 | const EVP_CIPHER *EVP_aes_192_cbc(void); | 690 | const EVP_CIPHER *EVP_aes_192_cbc(void); |
656 | const EVP_CIPHER *EVP_aes_192_cfb(void); | 691 | const EVP_CIPHER *EVP_aes_192_cfb1(void); |
692 | const EVP_CIPHER *EVP_aes_192_cfb8(void); | ||
693 | const EVP_CIPHER *EVP_aes_192_cfb128(void); | ||
694 | # define EVP_aes_192_cfb EVP_aes_192_cfb128 | ||
657 | const EVP_CIPHER *EVP_aes_192_ofb(void); | 695 | const EVP_CIPHER *EVP_aes_192_ofb(void); |
658 | #if 0 | 696 | #if 0 |
659 | const EVP_CIPHER *EVP_aes_192_ctr(void); | 697 | const EVP_CIPHER *EVP_aes_192_ctr(void); |
660 | #endif | 698 | #endif |
661 | const EVP_CIPHER *EVP_aes_256_ecb(void); | 699 | const EVP_CIPHER *EVP_aes_256_ecb(void); |
662 | const EVP_CIPHER *EVP_aes_256_cbc(void); | 700 | const EVP_CIPHER *EVP_aes_256_cbc(void); |
663 | const EVP_CIPHER *EVP_aes_256_cfb(void); | 701 | const EVP_CIPHER *EVP_aes_256_cfb1(void); |
702 | const EVP_CIPHER *EVP_aes_256_cfb8(void); | ||
703 | const EVP_CIPHER *EVP_aes_256_cfb128(void); | ||
704 | # define EVP_aes_256_cfb EVP_aes_256_cfb128 | ||
664 | const EVP_CIPHER *EVP_aes_256_ofb(void); | 705 | const EVP_CIPHER *EVP_aes_256_ofb(void); |
665 | #if 0 | 706 | #if 0 |
666 | const EVP_CIPHER *EVP_aes_256_ctr(void); | 707 | const EVP_CIPHER *EVP_aes_256_ctr(void); |
@@ -775,13 +816,18 @@ void ERR_load_EVP_strings(void); | |||
775 | /* Error codes for the EVP functions. */ | 816 | /* Error codes for the EVP functions. */ |
776 | 817 | ||
777 | /* Function codes. */ | 818 | /* Function codes. */ |
819 | #define EVP_F_AES_INIT_KEY 129 | ||
778 | #define EVP_F_D2I_PKEY 100 | 820 | #define EVP_F_D2I_PKEY 100 |
821 | #define EVP_F_EVP_ADD_CIPHER 130 | ||
822 | #define EVP_F_EVP_ADD_DIGEST 131 | ||
779 | #define EVP_F_EVP_CIPHERINIT 123 | 823 | #define EVP_F_EVP_CIPHERINIT 123 |
780 | #define EVP_F_EVP_CIPHER_CTX_CTRL 124 | 824 | #define EVP_F_EVP_CIPHER_CTX_CTRL 124 |
781 | #define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 | 825 | #define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 |
782 | #define EVP_F_EVP_DECRYPTFINAL 101 | 826 | #define EVP_F_EVP_DECRYPTFINAL 101 |
783 | #define EVP_F_EVP_DIGESTINIT 128 | 827 | #define EVP_F_EVP_DIGESTINIT 128 |
784 | #define EVP_F_EVP_ENCRYPTFINAL 127 | 828 | #define EVP_F_EVP_ENCRYPTFINAL 127 |
829 | #define EVP_F_EVP_GET_CIPHERBYNAME 132 | ||
830 | #define EVP_F_EVP_GET_DIGESTBYNAME 133 | ||
785 | #define EVP_F_EVP_MD_CTX_COPY 110 | 831 | #define EVP_F_EVP_MD_CTX_COPY 110 |
786 | #define EVP_F_EVP_OPENINIT 102 | 832 | #define EVP_F_EVP_OPENINIT 102 |
787 | #define EVP_F_EVP_PBE_ALG_ADD 115 | 833 | #define EVP_F_EVP_PBE_ALG_ADD 115 |
@@ -805,6 +851,7 @@ void ERR_load_EVP_strings(void); | |||
805 | #define EVP_F_RC5_CTRL 125 | 851 | #define EVP_F_RC5_CTRL 125 |
806 | 852 | ||
807 | /* Reason codes. */ | 853 | /* Reason codes. */ |
854 | #define EVP_R_AES_KEY_SETUP_FAILED 140 | ||
808 | #define EVP_R_BAD_BLOCK_LENGTH 136 | 855 | #define EVP_R_BAD_BLOCK_LENGTH 136 |
809 | #define EVP_R_BAD_DECRYPT 100 | 856 | #define EVP_R_BAD_DECRYPT 100 |
810 | #define EVP_R_BAD_KEY_LENGTH 137 | 857 | #define EVP_R_BAD_KEY_LENGTH 137 |
@@ -816,6 +863,7 @@ void ERR_load_EVP_strings(void); | |||
816 | #define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 | 863 | #define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 |
817 | #define EVP_R_DECODE_ERROR 114 | 864 | #define EVP_R_DECODE_ERROR 114 |
818 | #define EVP_R_DIFFERENT_KEY_TYPES 101 | 865 | #define EVP_R_DIFFERENT_KEY_TYPES 101 |
866 | #define EVP_R_DISABLED_FOR_FIPS 141 | ||
819 | #define EVP_R_ENCODE_ERROR 115 | 867 | #define EVP_R_ENCODE_ERROR 115 |
820 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 | 868 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 |
821 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 | 869 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 |
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index 8ea5aa935d..f549eeb437 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
@@ -82,6 +82,48 @@ int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | |||
82 | return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc); | 82 | return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc); |
83 | } | 83 | } |
84 | 84 | ||
85 | #ifdef OPENSSL_FIPS | ||
86 | |||
87 | /* The purpose of these is to trap programs that attempt to use non FIPS | ||
88 | * algorithms in FIPS mode and ignore the errors. | ||
89 | */ | ||
90 | |||
91 | int bad_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
92 | const unsigned char *iv, int enc) | ||
93 | { FIPS_ERROR_IGNORED("Cipher init"); return 0;} | ||
94 | |||
95 | int bad_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
96 | const unsigned char *in, unsigned int inl) | ||
97 | { FIPS_ERROR_IGNORED("Cipher update"); return 0;} | ||
98 | |||
99 | /* NB: no cleanup because it is allowed after failed init */ | ||
100 | |||
101 | int bad_set_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *typ) | ||
102 | { FIPS_ERROR_IGNORED("Cipher set_asn1"); return 0;} | ||
103 | int bad_get_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *typ) | ||
104 | { FIPS_ERROR_IGNORED("Cipher get_asn1"); return 0;} | ||
105 | int bad_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
106 | { FIPS_ERROR_IGNORED("Cipher ctrl"); return 0;} | ||
107 | |||
108 | static const EVP_CIPHER bad_cipher = | ||
109 | { | ||
110 | 0, | ||
111 | 0, | ||
112 | 0, | ||
113 | 0, | ||
114 | 0, | ||
115 | bad_init, | ||
116 | bad_do_cipher, | ||
117 | NULL, | ||
118 | 0, | ||
119 | bad_set_asn1, | ||
120 | bad_get_asn1, | ||
121 | bad_ctrl, | ||
122 | NULL | ||
123 | }; | ||
124 | |||
125 | #endif | ||
126 | |||
85 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | 127 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, |
86 | const unsigned char *key, const unsigned char *iv, int enc) | 128 | const unsigned char *key, const unsigned char *iv, int enc) |
87 | { | 129 | { |
@@ -146,7 +188,6 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp | |||
146 | else | 188 | else |
147 | ctx->engine = NULL; | 189 | ctx->engine = NULL; |
148 | #endif | 190 | #endif |
149 | |||
150 | ctx->cipher=cipher; | 191 | ctx->cipher=cipher; |
151 | if (ctx->cipher->ctx_size) | 192 | if (ctx->cipher->ctx_size) |
152 | { | 193 | { |
@@ -210,6 +251,24 @@ skip_to_init: | |||
210 | } | 251 | } |
211 | } | 252 | } |
212 | 253 | ||
254 | #ifdef OPENSSL_FIPS | ||
255 | /* After 'key' is set no further parameters changes are permissible. | ||
256 | * So only check for non FIPS enabling at this point. | ||
257 | */ | ||
258 | if (key && FIPS_mode()) | ||
259 | { | ||
260 | if (!(ctx->cipher->flags & EVP_CIPH_FLAG_FIPS) | ||
261 | & !(ctx->flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW)) | ||
262 | { | ||
263 | EVPerr(EVP_F_EVP_CIPHERINIT, EVP_R_DISABLED_FOR_FIPS); | ||
264 | ERR_add_error_data(2, "cipher=", | ||
265 | EVP_CIPHER_name(ctx->cipher)); | ||
266 | ctx->cipher = &bad_cipher; | ||
267 | return 0; | ||
268 | } | ||
269 | } | ||
270 | #endif | ||
271 | |||
213 | if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { | 272 | if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { |
214 | if(!ctx->cipher->init(ctx,key,iv,enc)) return 0; | 273 | if(!ctx->cipher->init(ctx,key,iv,enc)) return 0; |
215 | } | 274 | } |
diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c index 3a23d21c21..40135d0729 100644 --- a/src/lib/libcrypto/evp/evp_err.c +++ b/src/lib/libcrypto/evp/evp_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/evp/evp_err.c */ | 1 | /* crypto/evp/evp_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2005 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 |
@@ -66,13 +66,18 @@ | |||
66 | #ifndef OPENSSL_NO_ERR | 66 | #ifndef OPENSSL_NO_ERR |
67 | static ERR_STRING_DATA EVP_str_functs[]= | 67 | static ERR_STRING_DATA EVP_str_functs[]= |
68 | { | 68 | { |
69 | {ERR_PACK(0,EVP_F_AES_INIT_KEY,0), "AES_INIT_KEY"}, | ||
69 | {ERR_PACK(0,EVP_F_D2I_PKEY,0), "D2I_PKEY"}, | 70 | {ERR_PACK(0,EVP_F_D2I_PKEY,0), "D2I_PKEY"}, |
71 | {ERR_PACK(0,EVP_F_EVP_ADD_CIPHER,0), "EVP_add_cipher"}, | ||
72 | {ERR_PACK(0,EVP_F_EVP_ADD_DIGEST,0), "EVP_add_digest"}, | ||
70 | {ERR_PACK(0,EVP_F_EVP_CIPHERINIT,0), "EVP_CipherInit"}, | 73 | {ERR_PACK(0,EVP_F_EVP_CIPHERINIT,0), "EVP_CipherInit"}, |
71 | {ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_CTRL,0), "EVP_CIPHER_CTX_ctrl"}, | 74 | {ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_CTRL,0), "EVP_CIPHER_CTX_ctrl"}, |
72 | {ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH,0), "EVP_CIPHER_CTX_set_key_length"}, | 75 | {ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH,0), "EVP_CIPHER_CTX_set_key_length"}, |
73 | {ERR_PACK(0,EVP_F_EVP_DECRYPTFINAL,0), "EVP_DecryptFinal"}, | 76 | {ERR_PACK(0,EVP_F_EVP_DECRYPTFINAL,0), "EVP_DecryptFinal"}, |
74 | {ERR_PACK(0,EVP_F_EVP_DIGESTINIT,0), "EVP_DigestInit"}, | 77 | {ERR_PACK(0,EVP_F_EVP_DIGESTINIT,0), "EVP_DigestInit"}, |
75 | {ERR_PACK(0,EVP_F_EVP_ENCRYPTFINAL,0), "EVP_EncryptFinal"}, | 78 | {ERR_PACK(0,EVP_F_EVP_ENCRYPTFINAL,0), "EVP_EncryptFinal"}, |
79 | {ERR_PACK(0,EVP_F_EVP_GET_CIPHERBYNAME,0), "EVP_get_cipherbyname"}, | ||
80 | {ERR_PACK(0,EVP_F_EVP_GET_DIGESTBYNAME,0), "EVP_get_digestbyname"}, | ||
76 | {ERR_PACK(0,EVP_F_EVP_MD_CTX_COPY,0), "EVP_MD_CTX_copy"}, | 81 | {ERR_PACK(0,EVP_F_EVP_MD_CTX_COPY,0), "EVP_MD_CTX_copy"}, |
77 | {ERR_PACK(0,EVP_F_EVP_OPENINIT,0), "EVP_OpenInit"}, | 82 | {ERR_PACK(0,EVP_F_EVP_OPENINIT,0), "EVP_OpenInit"}, |
78 | {ERR_PACK(0,EVP_F_EVP_PBE_ALG_ADD,0), "EVP_PBE_alg_add"}, | 83 | {ERR_PACK(0,EVP_F_EVP_PBE_ALG_ADD,0), "EVP_PBE_alg_add"}, |
@@ -99,6 +104,7 @@ static ERR_STRING_DATA EVP_str_functs[]= | |||
99 | 104 | ||
100 | static ERR_STRING_DATA EVP_str_reasons[]= | 105 | static ERR_STRING_DATA EVP_str_reasons[]= |
101 | { | 106 | { |
107 | {EVP_R_AES_KEY_SETUP_FAILED ,"aes key setup failed"}, | ||
102 | {EVP_R_BAD_BLOCK_LENGTH ,"bad block length"}, | 108 | {EVP_R_BAD_BLOCK_LENGTH ,"bad block length"}, |
103 | {EVP_R_BAD_DECRYPT ,"bad decrypt"}, | 109 | {EVP_R_BAD_DECRYPT ,"bad decrypt"}, |
104 | {EVP_R_BAD_KEY_LENGTH ,"bad key length"}, | 110 | {EVP_R_BAD_KEY_LENGTH ,"bad key length"}, |
@@ -110,6 +116,7 @@ static ERR_STRING_DATA EVP_str_reasons[]= | |||
110 | {EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH ,"data not multiple of block length"}, | 116 | {EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH ,"data not multiple of block length"}, |
111 | {EVP_R_DECODE_ERROR ,"decode error"}, | 117 | {EVP_R_DECODE_ERROR ,"decode error"}, |
112 | {EVP_R_DIFFERENT_KEY_TYPES ,"different key types"}, | 118 | {EVP_R_DIFFERENT_KEY_TYPES ,"different key types"}, |
119 | {EVP_R_DISABLED_FOR_FIPS ,"disabled for fips"}, | ||
113 | {EVP_R_ENCODE_ERROR ,"encode error"}, | 120 | {EVP_R_ENCODE_ERROR ,"encode error"}, |
114 | {EVP_R_EVP_PBE_CIPHERINIT_ERROR ,"evp pbe cipherinit error"}, | 121 | {EVP_R_EVP_PBE_CIPHERINIT_ERROR ,"evp pbe cipherinit error"}, |
115 | {EVP_R_EXPECTING_AN_RSA_KEY ,"expecting an rsa key"}, | 122 | {EVP_R_EXPECTING_AN_RSA_KEY ,"expecting an rsa key"}, |
diff --git a/src/lib/libcrypto/evp/evp_lib.c b/src/lib/libcrypto/evp/evp_lib.c index 52a3b287be..a63ba19317 100644 --- a/src/lib/libcrypto/evp/evp_lib.c +++ b/src/lib/libcrypto/evp/evp_lib.c | |||
@@ -68,7 +68,7 @@ int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | |||
68 | if (c->cipher->set_asn1_parameters != NULL) | 68 | if (c->cipher->set_asn1_parameters != NULL) |
69 | ret=c->cipher->set_asn1_parameters(c,type); | 69 | ret=c->cipher->set_asn1_parameters(c,type); |
70 | else | 70 | else |
71 | ret=1; | 71 | return -1; |
72 | return(ret); | 72 | return(ret); |
73 | } | 73 | } |
74 | 74 | ||
@@ -79,7 +79,7 @@ int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | |||
79 | if (c->cipher->get_asn1_parameters != NULL) | 79 | if (c->cipher->get_asn1_parameters != NULL) |
80 | ret=c->cipher->get_asn1_parameters(c,type); | 80 | ret=c->cipher->get_asn1_parameters(c,type); |
81 | else | 81 | else |
82 | ret=1; | 82 | return -1; |
83 | return(ret); | 83 | return(ret); |
84 | } | 84 | } |
85 | 85 | ||
@@ -133,6 +133,30 @@ int EVP_CIPHER_type(const EVP_CIPHER *ctx) | |||
133 | 133 | ||
134 | return NID_rc4; | 134 | return NID_rc4; |
135 | 135 | ||
136 | case NID_aes_128_cfb128: | ||
137 | case NID_aes_128_cfb8: | ||
138 | case NID_aes_128_cfb1: | ||
139 | |||
140 | return NID_aes_128_cfb128; | ||
141 | |||
142 | case NID_aes_192_cfb128: | ||
143 | case NID_aes_192_cfb8: | ||
144 | case NID_aes_192_cfb1: | ||
145 | |||
146 | return NID_aes_192_cfb128; | ||
147 | |||
148 | case NID_aes_256_cfb128: | ||
149 | case NID_aes_256_cfb8: | ||
150 | case NID_aes_256_cfb1: | ||
151 | |||
152 | return NID_aes_256_cfb128; | ||
153 | |||
154 | case NID_des_cfb64: | ||
155 | case NID_des_cfb8: | ||
156 | case NID_des_cfb1: | ||
157 | |||
158 | return NID_des_cfb64; | ||
159 | |||
136 | default: | 160 | default: |
137 | /* Check it has an OID and it is valid */ | 161 | /* Check it has an OID and it is valid */ |
138 | otmp = OBJ_nid2obj(nid); | 162 | otmp = OBJ_nid2obj(nid); |
diff --git a/src/lib/libcrypto/evp/evp_locl.h b/src/lib/libcrypto/evp/evp_locl.h index 4d81a3bf4c..f8c5343620 100644 --- a/src/lib/libcrypto/evp/evp_locl.h +++ b/src/lib/libcrypto/evp/evp_locl.h | |||
@@ -90,7 +90,7 @@ static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const uns | |||
90 | } | 90 | } |
91 | 91 | ||
92 | #define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \ | 92 | #define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \ |
93 | static int cname##_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ | 93 | static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ |
94 | {\ | 94 | {\ |
95 | cprefix##_cfb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\ | 95 | cprefix##_cfb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\ |
96 | return 1;\ | 96 | return 1;\ |
@@ -127,7 +127,7 @@ BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \ | |||
127 | #define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \ | 127 | #define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \ |
128 | iv_len, cbits, flags, init_key, cleanup, \ | 128 | iv_len, cbits, flags, init_key, cleanup, \ |
129 | set_asn1, get_asn1, ctrl) \ | 129 | set_asn1, get_asn1, ctrl) \ |
130 | BLOCK_CIPHER_def1(cname, cfb##cbits, cfb, CFB, kstruct, nid, 1, \ | 130 | BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, \ |
131 | key_len, iv_len, flags, init_key, cleanup, set_asn1, \ | 131 | key_len, iv_len, flags, init_key, cleanup, set_asn1, \ |
132 | get_asn1, ctrl) | 132 | get_asn1, ctrl) |
133 | 133 | ||
@@ -225,3 +225,28 @@ const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; } | |||
225 | get_asn1, ctrl) | 225 | get_asn1, ctrl) |
226 | 226 | ||
227 | #define EVP_C_DATA(kstruct, ctx) ((kstruct *)(ctx)->cipher_data) | 227 | #define EVP_C_DATA(kstruct, ctx) ((kstruct *)(ctx)->cipher_data) |
228 | |||
229 | #define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len,flags) \ | ||
230 | BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \ | ||
231 | BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \ | ||
232 | NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \ | ||
233 | flags, cipher##_init_key, NULL, \ | ||
234 | EVP_CIPHER_set_asn1_iv, \ | ||
235 | EVP_CIPHER_get_asn1_iv, \ | ||
236 | NULL) | ||
237 | |||
238 | #ifdef OPENSSL_FIPS | ||
239 | #define RC2_set_key private_RC2_set_key | ||
240 | #define RC4_set_key private_RC4_set_key | ||
241 | #define CAST_set_key private_CAST_set_key | ||
242 | #define RC5_32_set_key private_RC5_32_set_key | ||
243 | #define BF_set_key private_BF_set_key | ||
244 | #define idea_set_encrypt_key private_idea_set_encrypt_key | ||
245 | |||
246 | #define MD5_Init private_MD5_Init | ||
247 | #define MD4_Init private_MD4_Init | ||
248 | #define MD2_Init private_MD2_Init | ||
249 | #define MDC2_Init private_MDC2_Init | ||
250 | #define SHA_Init private_SHA_Init | ||
251 | |||
252 | #endif | ||
diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c index eb481ec661..47a69932a5 100644 --- a/src/lib/libcrypto/evp/evp_pkey.c +++ b/src/lib/libcrypto/evp/evp_pkey.c | |||
@@ -235,7 +235,11 @@ PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken) | |||
235 | return NULL; | 235 | return NULL; |
236 | } | 236 | } |
237 | p8->broken = broken; | 237 | p8->broken = broken; |
238 | ASN1_INTEGER_set (p8->version, 0); | 238 | if (!ASN1_INTEGER_set(p8->version, 0)) { |
239 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
240 | PKCS8_PRIV_KEY_INFO_free (p8); | ||
241 | return NULL; | ||
242 | } | ||
239 | if (!(p8->pkeyalg->parameter = ASN1_TYPE_new ())) { | 243 | if (!(p8->pkeyalg->parameter = ASN1_TYPE_new ())) { |
240 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | 244 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
241 | PKCS8_PRIV_KEY_INFO_free (p8); | 245 | PKCS8_PRIV_KEY_INFO_free (p8); |
@@ -303,29 +307,35 @@ PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken) | |||
303 | #ifndef OPENSSL_NO_DSA | 307 | #ifndef OPENSSL_NO_DSA |
304 | static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | 308 | static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) |
305 | { | 309 | { |
306 | ASN1_STRING *params; | 310 | ASN1_STRING *params = NULL; |
307 | ASN1_INTEGER *prkey; | 311 | ASN1_INTEGER *prkey = NULL; |
308 | ASN1_TYPE *ttmp; | 312 | ASN1_TYPE *ttmp = NULL; |
309 | STACK_OF(ASN1_TYPE) *ndsa; | 313 | STACK_OF(ASN1_TYPE) *ndsa = NULL; |
310 | unsigned char *p, *q; | 314 | unsigned char *p = NULL, *q; |
311 | int len; | 315 | int len; |
312 | 316 | ||
313 | p8->pkeyalg->algorithm = OBJ_nid2obj(NID_dsa); | 317 | p8->pkeyalg->algorithm = OBJ_nid2obj(NID_dsa); |
314 | len = i2d_DSAparams (pkey->pkey.dsa, NULL); | 318 | len = i2d_DSAparams (pkey->pkey.dsa, NULL); |
315 | if (!(p = OPENSSL_malloc(len))) { | 319 | if (!(p = OPENSSL_malloc(len))) { |
316 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | 320 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
317 | PKCS8_PRIV_KEY_INFO_free (p8); | 321 | goto err; |
318 | return 0; | ||
319 | } | 322 | } |
320 | q = p; | 323 | q = p; |
321 | i2d_DSAparams (pkey->pkey.dsa, &q); | 324 | i2d_DSAparams (pkey->pkey.dsa, &q); |
322 | params = ASN1_STRING_new(); | 325 | if (!(params = ASN1_STRING_new())) { |
323 | ASN1_STRING_set(params, p, len); | 326 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
327 | goto err; | ||
328 | } | ||
329 | if (!ASN1_STRING_set(params, p, len)) { | ||
330 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
331 | goto err; | ||
332 | } | ||
324 | OPENSSL_free(p); | 333 | OPENSSL_free(p); |
334 | p = NULL; | ||
325 | /* Get private key into integer */ | 335 | /* Get private key into integer */ |
326 | if (!(prkey = BN_to_ASN1_INTEGER (pkey->pkey.dsa->priv_key, NULL))) { | 336 | if (!(prkey = BN_to_ASN1_INTEGER (pkey->pkey.dsa->priv_key, NULL))) { |
327 | EVPerr(EVP_F_EVP_PKEY2PKCS8,EVP_R_ENCODE_ERROR); | 337 | EVPerr(EVP_F_EVP_PKEY2PKCS8,EVP_R_ENCODE_ERROR); |
328 | return 0; | 338 | goto err; |
329 | } | 339 | } |
330 | 340 | ||
331 | switch(p8->broken) { | 341 | switch(p8->broken) { |
@@ -336,12 +346,13 @@ static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | |||
336 | if (!ASN1_pack_string((char *)prkey, i2d_ASN1_INTEGER, | 346 | if (!ASN1_pack_string((char *)prkey, i2d_ASN1_INTEGER, |
337 | &p8->pkey->value.octet_string)) { | 347 | &p8->pkey->value.octet_string)) { |
338 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | 348 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
339 | M_ASN1_INTEGER_free (prkey); | 349 | goto err; |
340 | return 0; | ||
341 | } | 350 | } |
342 | 351 | ||
343 | M_ASN1_INTEGER_free (prkey); | 352 | M_ASN1_INTEGER_free (prkey); |
353 | prkey = NULL; | ||
344 | p8->pkeyalg->parameter->value.sequence = params; | 354 | p8->pkeyalg->parameter->value.sequence = params; |
355 | params = NULL; | ||
345 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; | 356 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; |
346 | 357 | ||
347 | break; | 358 | break; |
@@ -349,32 +360,51 @@ static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | |||
349 | case PKCS8_NS_DB: | 360 | case PKCS8_NS_DB: |
350 | 361 | ||
351 | p8->pkeyalg->parameter->value.sequence = params; | 362 | p8->pkeyalg->parameter->value.sequence = params; |
363 | params = NULL; | ||
352 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; | 364 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; |
353 | ndsa = sk_ASN1_TYPE_new_null(); | 365 | if (!(ndsa = sk_ASN1_TYPE_new_null())) { |
354 | ttmp = ASN1_TYPE_new(); | 366 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
355 | if (!(ttmp->value.integer = BN_to_ASN1_INTEGER (pkey->pkey.dsa->pub_key, NULL))) { | 367 | goto err; |
368 | } | ||
369 | if (!(ttmp = ASN1_TYPE_new())) { | ||
370 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
371 | goto err; | ||
372 | } | ||
373 | if (!(ttmp->value.integer = | ||
374 | BN_to_ASN1_INTEGER(pkey->pkey.dsa->pub_key, NULL))) { | ||
356 | EVPerr(EVP_F_EVP_PKEY2PKCS8,EVP_R_ENCODE_ERROR); | 375 | EVPerr(EVP_F_EVP_PKEY2PKCS8,EVP_R_ENCODE_ERROR); |
357 | PKCS8_PRIV_KEY_INFO_free(p8); | 376 | goto err; |
358 | return 0; | ||
359 | } | 377 | } |
360 | ttmp->type = V_ASN1_INTEGER; | 378 | ttmp->type = V_ASN1_INTEGER; |
361 | sk_ASN1_TYPE_push(ndsa, ttmp); | 379 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { |
380 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
381 | goto err; | ||
382 | } | ||
362 | 383 | ||
363 | ttmp = ASN1_TYPE_new(); | 384 | if (!(ttmp = ASN1_TYPE_new())) { |
385 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
386 | goto err; | ||
387 | } | ||
364 | ttmp->value.integer = prkey; | 388 | ttmp->value.integer = prkey; |
389 | prkey = NULL; | ||
365 | ttmp->type = V_ASN1_INTEGER; | 390 | ttmp->type = V_ASN1_INTEGER; |
366 | sk_ASN1_TYPE_push(ndsa, ttmp); | 391 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { |
392 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
393 | goto err; | ||
394 | } | ||
395 | ttmp = NULL; | ||
367 | 396 | ||
368 | p8->pkey->value.octet_string = ASN1_OCTET_STRING_new(); | 397 | if (!(p8->pkey->value.octet_string = ASN1_OCTET_STRING_new())) { |
398 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
399 | goto err; | ||
400 | } | ||
369 | 401 | ||
370 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, | 402 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, |
371 | &p8->pkey->value.octet_string->data, | 403 | &p8->pkey->value.octet_string->data, |
372 | &p8->pkey->value.octet_string->length)) { | 404 | &p8->pkey->value.octet_string->length)) { |
373 | 405 | ||
374 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | 406 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
375 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | 407 | goto err; |
376 | M_ASN1_INTEGER_free(prkey); | ||
377 | return 0; | ||
378 | } | 408 | } |
379 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | 409 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); |
380 | break; | 410 | break; |
@@ -382,31 +412,57 @@ static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | |||
382 | case PKCS8_EMBEDDED_PARAM: | 412 | case PKCS8_EMBEDDED_PARAM: |
383 | 413 | ||
384 | p8->pkeyalg->parameter->type = V_ASN1_NULL; | 414 | p8->pkeyalg->parameter->type = V_ASN1_NULL; |
385 | ndsa = sk_ASN1_TYPE_new_null(); | 415 | if (!(ndsa = sk_ASN1_TYPE_new_null())) { |
386 | ttmp = ASN1_TYPE_new(); | 416 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
417 | goto err; | ||
418 | } | ||
419 | if (!(ttmp = ASN1_TYPE_new())) { | ||
420 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
421 | goto err; | ||
422 | } | ||
387 | ttmp->value.sequence = params; | 423 | ttmp->value.sequence = params; |
424 | params = NULL; | ||
388 | ttmp->type = V_ASN1_SEQUENCE; | 425 | ttmp->type = V_ASN1_SEQUENCE; |
389 | sk_ASN1_TYPE_push(ndsa, ttmp); | 426 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { |
427 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
428 | goto err; | ||
429 | } | ||
390 | 430 | ||
391 | ttmp = ASN1_TYPE_new(); | 431 | if (!(ttmp = ASN1_TYPE_new())) { |
432 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
433 | goto err; | ||
434 | } | ||
392 | ttmp->value.integer = prkey; | 435 | ttmp->value.integer = prkey; |
436 | prkey = NULL; | ||
393 | ttmp->type = V_ASN1_INTEGER; | 437 | ttmp->type = V_ASN1_INTEGER; |
394 | sk_ASN1_TYPE_push(ndsa, ttmp); | 438 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { |
439 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
440 | goto err; | ||
441 | } | ||
442 | ttmp = NULL; | ||
395 | 443 | ||
396 | p8->pkey->value.octet_string = ASN1_OCTET_STRING_new(); | 444 | if (!(p8->pkey->value.octet_string = ASN1_OCTET_STRING_new())) { |
445 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
446 | goto err; | ||
447 | } | ||
397 | 448 | ||
398 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, | 449 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, |
399 | &p8->pkey->value.octet_string->data, | 450 | &p8->pkey->value.octet_string->data, |
400 | &p8->pkey->value.octet_string->length)) { | 451 | &p8->pkey->value.octet_string->length)) { |
401 | 452 | ||
402 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | 453 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
403 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | 454 | goto err; |
404 | M_ASN1_INTEGER_free (prkey); | ||
405 | return 0; | ||
406 | } | 455 | } |
407 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | 456 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); |
408 | break; | 457 | break; |
409 | } | 458 | } |
410 | return 1; | 459 | return 1; |
460 | err: | ||
461 | if (p != NULL) OPENSSL_free(p); | ||
462 | if (params != NULL) ASN1_STRING_free(params); | ||
463 | if (prkey != NULL) M_ASN1_INTEGER_free(prkey); | ||
464 | if (ttmp != NULL) ASN1_TYPE_free(ttmp); | ||
465 | if (ndsa != NULL) sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
466 | return 0; | ||
411 | } | 467 | } |
412 | #endif | 468 | #endif |
diff --git a/src/lib/libcrypto/evp/evp_test.c b/src/lib/libcrypto/evp/evp_test.c index 28460173f7..a624cfd248 100644 --- a/src/lib/libcrypto/evp/evp_test.c +++ b/src/lib/libcrypto/evp/evp_test.c | |||
@@ -136,7 +136,7 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
136 | const unsigned char *iv,int in, | 136 | const unsigned char *iv,int in, |
137 | const unsigned char *plaintext,int pn, | 137 | const unsigned char *plaintext,int pn, |
138 | const unsigned char *ciphertext,int cn, | 138 | const unsigned char *ciphertext,int cn, |
139 | int encdec) | 139 | int encdec,int multiplier) |
140 | { | 140 | { |
141 | EVP_CIPHER_CTX ctx; | 141 | EVP_CIPHER_CTX ctx; |
142 | unsigned char out[4096]; | 142 | unsigned char out[4096]; |
@@ -162,22 +162,25 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
162 | if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv)) | 162 | if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv)) |
163 | { | 163 | { |
164 | fprintf(stderr,"EncryptInit failed\n"); | 164 | fprintf(stderr,"EncryptInit failed\n"); |
165 | ERR_print_errors_fp(stderr); | ||
165 | test1_exit(10); | 166 | test1_exit(10); |
166 | } | 167 | } |
167 | EVP_CIPHER_CTX_set_padding(&ctx,0); | 168 | EVP_CIPHER_CTX_set_padding(&ctx,0); |
168 | 169 | ||
169 | if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn)) | 170 | if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn*multiplier)) |
170 | { | 171 | { |
171 | fprintf(stderr,"Encrypt failed\n"); | 172 | fprintf(stderr,"Encrypt failed\n"); |
173 | ERR_print_errors_fp(stderr); | ||
172 | test1_exit(6); | 174 | test1_exit(6); |
173 | } | 175 | } |
174 | if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2)) | 176 | if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2)) |
175 | { | 177 | { |
176 | fprintf(stderr,"EncryptFinal failed\n"); | 178 | fprintf(stderr,"EncryptFinal failed\n"); |
179 | ERR_print_errors_fp(stderr); | ||
177 | test1_exit(7); | 180 | test1_exit(7); |
178 | } | 181 | } |
179 | 182 | ||
180 | if(outl+outl2 != cn) | 183 | if(outl+outl2 != cn*multiplier) |
181 | { | 184 | { |
182 | fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n", | 185 | fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n", |
183 | outl+outl2,cn); | 186 | outl+outl2,cn); |
@@ -198,22 +201,25 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
198 | if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv)) | 201 | if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv)) |
199 | { | 202 | { |
200 | fprintf(stderr,"DecryptInit failed\n"); | 203 | fprintf(stderr,"DecryptInit failed\n"); |
204 | ERR_print_errors_fp(stderr); | ||
201 | test1_exit(11); | 205 | test1_exit(11); |
202 | } | 206 | } |
203 | EVP_CIPHER_CTX_set_padding(&ctx,0); | 207 | EVP_CIPHER_CTX_set_padding(&ctx,0); |
204 | 208 | ||
205 | if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn)) | 209 | if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn*multiplier)) |
206 | { | 210 | { |
207 | fprintf(stderr,"Decrypt failed\n"); | 211 | fprintf(stderr,"Decrypt failed\n"); |
212 | ERR_print_errors_fp(stderr); | ||
208 | test1_exit(6); | 213 | test1_exit(6); |
209 | } | 214 | } |
210 | if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2)) | 215 | if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2)) |
211 | { | 216 | { |
212 | fprintf(stderr,"DecryptFinal failed\n"); | 217 | fprintf(stderr,"DecryptFinal failed\n"); |
218 | ERR_print_errors_fp(stderr); | ||
213 | test1_exit(7); | 219 | test1_exit(7); |
214 | } | 220 | } |
215 | 221 | ||
216 | if(outl+outl2 != cn) | 222 | if(outl+outl2 != cn*multiplier) |
217 | { | 223 | { |
218 | fprintf(stderr,"Plaintext length mismatch got %d expected %d\n", | 224 | fprintf(stderr,"Plaintext length mismatch got %d expected %d\n", |
219 | outl+outl2,cn); | 225 | outl+outl2,cn); |
@@ -238,7 +244,7 @@ static int test_cipher(const char *cipher,const unsigned char *key,int kn, | |||
238 | const unsigned char *iv,int in, | 244 | const unsigned char *iv,int in, |
239 | const unsigned char *plaintext,int pn, | 245 | const unsigned char *plaintext,int pn, |
240 | const unsigned char *ciphertext,int cn, | 246 | const unsigned char *ciphertext,int cn, |
241 | int encdec) | 247 | int encdec,int multiplier) |
242 | { | 248 | { |
243 | const EVP_CIPHER *c; | 249 | const EVP_CIPHER *c; |
244 | 250 | ||
@@ -246,7 +252,7 @@ static int test_cipher(const char *cipher,const unsigned char *key,int kn, | |||
246 | if(!c) | 252 | if(!c) |
247 | return 0; | 253 | return 0; |
248 | 254 | ||
249 | test1(c,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec); | 255 | test1(c,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec,multiplier); |
250 | 256 | ||
251 | return 1; | 257 | return 1; |
252 | } | 258 | } |
@@ -272,16 +278,19 @@ static int test_digest(const char *digest, | |||
272 | if(!EVP_DigestInit_ex(&ctx,d, NULL)) | 278 | if(!EVP_DigestInit_ex(&ctx,d, NULL)) |
273 | { | 279 | { |
274 | fprintf(stderr,"DigestInit failed\n"); | 280 | fprintf(stderr,"DigestInit failed\n"); |
281 | ERR_print_errors_fp(stderr); | ||
275 | EXIT(100); | 282 | EXIT(100); |
276 | } | 283 | } |
277 | if(!EVP_DigestUpdate(&ctx,plaintext,pn)) | 284 | if(!EVP_DigestUpdate(&ctx,plaintext,pn)) |
278 | { | 285 | { |
279 | fprintf(stderr,"DigestUpdate failed\n"); | 286 | fprintf(stderr,"DigestUpdate failed\n"); |
287 | ERR_print_errors_fp(stderr); | ||
280 | EXIT(101); | 288 | EXIT(101); |
281 | } | 289 | } |
282 | if(!EVP_DigestFinal_ex(&ctx,md,&mdn)) | 290 | if(!EVP_DigestFinal_ex(&ctx,md,&mdn)) |
283 | { | 291 | { |
284 | fprintf(stderr,"DigestFinal failed\n"); | 292 | fprintf(stderr,"DigestFinal failed\n"); |
293 | ERR_print_errors_fp(stderr); | ||
285 | EXIT(101); | 294 | EXIT(101); |
286 | } | 295 | } |
287 | EVP_MD_CTX_cleanup(&ctx); | 296 | EVP_MD_CTX_cleanup(&ctx); |
@@ -359,6 +368,7 @@ int main(int argc,char **argv) | |||
359 | unsigned char *iv,*key,*plaintext,*ciphertext; | 368 | unsigned char *iv,*key,*plaintext,*ciphertext; |
360 | int encdec; | 369 | int encdec; |
361 | int kn,in,pn,cn; | 370 | int kn,in,pn,cn; |
371 | int multiplier=1; | ||
362 | 372 | ||
363 | if(!fgets((char *)line,sizeof line,f)) | 373 | if(!fgets((char *)line,sizeof line,f)) |
364 | break; | 374 | break; |
@@ -383,7 +393,15 @@ int main(int argc,char **argv) | |||
383 | pn=convert(plaintext); | 393 | pn=convert(plaintext); |
384 | cn=convert(ciphertext); | 394 | cn=convert(ciphertext); |
385 | 395 | ||
386 | if(!test_cipher(cipher,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec) | 396 | if(strchr(cipher,'*')) |
397 | { | ||
398 | p=cipher; | ||
399 | sstrsep(&p,"*"); | ||
400 | multiplier=atoi(sstrsep(&p,"*")); | ||
401 | } | ||
402 | |||
403 | if(!test_cipher(cipher,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec, | ||
404 | multiplier) | ||
387 | && !test_digest(cipher,plaintext,pn,ciphertext,cn)) | 405 | && !test_digest(cipher,plaintext,pn,ciphertext,cn)) |
388 | { | 406 | { |
389 | fprintf(stderr,"Can't find %s\n",cipher); | 407 | fprintf(stderr,"Can't find %s\n",cipher); |
diff --git a/src/lib/libcrypto/evp/evptests.txt b/src/lib/libcrypto/evp/evptests.txt index 80bd9c7765..dfe91a5bc0 100644 --- a/src/lib/libcrypto/evp/evptests.txt +++ b/src/lib/libcrypto/evp/evptests.txt | |||
@@ -92,7 +92,102 @@ AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000 | |||
92 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:F58C4C04D6E5F1BA779EABFB5F7BFBD6:AE2D8A571E03AC9C9EB76FAC45AF8E51:9CFC4E967EDB808D679F777BC6702C7D | 92 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:F58C4C04D6E5F1BA779EABFB5F7BFBD6:AE2D8A571E03AC9C9EB76FAC45AF8E51:9CFC4E967EDB808D679F777BC6702C7D |
93 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:9CFC4E967EDB808D679F777BC6702C7D:30C81C46A35CE411E5FBC1191A0A52EF:39F23369A9D9BACFA530E26304231461 | 93 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:9CFC4E967EDB808D679F777BC6702C7D:30C81C46A35CE411E5FBC1191A0A52EF:39F23369A9D9BACFA530E26304231461 |
94 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39F23369A9D9BACFA530E26304231461:F69F2445DF4F9B17AD2B417BE66C3710:B2EB05E2C39BE9FCDA6C19078C6A9D1B | 94 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39F23369A9D9BACFA530E26304231461:F69F2445DF4F9B17AD2B417BE66C3710:B2EB05E2C39BE9FCDA6C19078C6A9D1B |
95 | # We don't support CFB{1,8}-AESxxx.{En,De}crypt | 95 | |
96 | # CFB1-AES128.Encrypt | ||
97 | |||
98 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:00:00:1 | ||
99 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00020406080a0c0e10121416181a1c1e:80:80:1 | ||
100 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0004080c1014181c2024282c3034383d:80:80:1 | ||
101 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0008101820283038404850586068707b:00:00:1 | ||
102 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00102030405060708090a0b0c0d0e0f6:80:80:1 | ||
103 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0020406080a0c0e10121416181a1c1ed:00:00:1 | ||
104 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:004080c1014181c2024282c3034383da:80:00:1 | ||
105 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:008101820283038404850586068707b4:80:00:1 | ||
106 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f68:80:80:1 | ||
107 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:020406080a0c0e10121416181a1c1ed1:80:00:1 | ||
108 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:04080c1014181c2024282c3034383da2:00:80:1 | ||
109 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:08101820283038404850586068707b45:00:80:1 | ||
110 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:102030405060708090a0b0c0d0e0f68b:00:00:1 | ||
111 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:20406080a0c0e10121416181a1c1ed16:00:00:1 | ||
112 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:4080c1014181c2024282c3034383da2c:00:80:1 | ||
113 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:8101820283038404850586068707b459:80:80:1 | ||
114 | # all of the above packed into one... | ||
115 | # in: 0110 1011 1100 0001 = 6bc1 | ||
116 | # out: 0110 1000 1011 0011 = 68b3 | ||
117 | AES-128-CFB1*8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1:68b3:1 | ||
118 | |||
119 | # CFB1-AES128.Decrypt | ||
120 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:00:00:0 | ||
121 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00020406080a0c0e10121416181a1c1e:80:80:0 | ||
122 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0004080c1014181c2024282c3034383d:80:80:0 | ||
123 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0008101820283038404850586068707b:00:00:0 | ||
124 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00102030405060708090a0b0c0d0e0f6:80:80:0 | ||
125 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0020406080a0c0e10121416181a1c1ed:00:00:0 | ||
126 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:004080c1014181c2024282c3034383da:80:00:0 | ||
127 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:008101820283038404850586068707b4:80:00:0 | ||
128 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f68:80:80:0 | ||
129 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:020406080a0c0e10121416181a1c1ed1:80:00:0 | ||
130 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:04080c1014181c2024282c3034383da2:00:80:0 | ||
131 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:08101820283038404850586068707b45:00:80:0 | ||
132 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:102030405060708090a0b0c0d0e0f68b:00:00:0 | ||
133 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:20406080a0c0e10121416181a1c1ed16:00:00:0 | ||
134 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:4080c1014181c2024282c3034383da2c:00:80:0 | ||
135 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:8101820283038404850586068707b459:80:80:0 | ||
136 | # all of the above packed into one... | ||
137 | # in: 0110 1000 1011 0011 = 68b3 | ||
138 | # out: 0110 1011 1100 0001 = 6bc1 | ||
139 | AES-128-CFB1*8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1:68b3:0 | ||
140 | |||
141 | # TODO: CFB1-AES192 and 256 | ||
142 | |||
143 | # CFB8-AES128.Encrypt | ||
144 | |||
145 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6b:3b:1 | ||
146 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f3b:c1:79:1 | ||
147 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:02030405060708090a0b0c0d0e0f3b79:be:42:1 | ||
148 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:030405060708090a0b0c0d0e0f3b7942:e2:4c:1 | ||
149 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0405060708090a0b0c0d0e0f3b79424c:2e:9c:1 | ||
150 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:05060708090a0b0c0d0e0f3b79424c9c:40:0d:1 | ||
151 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:060708090a0b0c0d0e0f3b79424c9c0d:9f:d4:1 | ||
152 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0708090a0b0c0d0e0f3b79424c9c0dd4:96:36:1 | ||
153 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:08090a0b0c0d0e0f3b79424c9c0dd436:e9:ba:1 | ||
154 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:090a0b0c0d0e0f3b79424c9c0dd436ba:3d:ce:1 | ||
155 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0a0b0c0d0e0f3b79424c9c0dd436bace:7e:9e:1 | ||
156 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0b0c0d0e0f3b79424c9c0dd436bace9e:11:0e:1 | ||
157 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0c0d0e0f3b79424c9c0dd436bace9e0e:73:d4:1 | ||
158 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0d0e0f3b79424c9c0dd436bace9e0ed4:93:58:1 | ||
159 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0e0f3b79424c9c0dd436bace9e0ed458:17:6a:1 | ||
160 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0f3b79424c9c0dd436bace9e0ed4586a:2a:4f:1 | ||
161 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:3b79424c9c0dd436bace9e0ed4586a4f:ae:32:1 | ||
162 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:79424c9c0dd436bace9e0ed4586a4f32:2d:b9:1 | ||
163 | # all of the above packed into one | ||
164 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1bee22e409f96e93d7e117393172aae2d:3b79424c9c0dd436bace9e0ed4586a4f32b9:1 | ||
165 | |||
166 | # CFB8-AES128.Decrypt | ||
167 | |||
168 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6b:3b:0 | ||
169 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f3b:c1:79:0 | ||
170 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:02030405060708090a0b0c0d0e0f3b79:be:42:0 | ||
171 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:030405060708090a0b0c0d0e0f3b7942:e2:4c:0 | ||
172 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0405060708090a0b0c0d0e0f3b79424c:2e:9c:0 | ||
173 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:05060708090a0b0c0d0e0f3b79424c9c:40:0d:0 | ||
174 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:060708090a0b0c0d0e0f3b79424c9c0d:9f:d4:0 | ||
175 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0708090a0b0c0d0e0f3b79424c9c0dd4:96:36:0 | ||
176 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:08090a0b0c0d0e0f3b79424c9c0dd436:e9:ba:0 | ||
177 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:090a0b0c0d0e0f3b79424c9c0dd436ba:3d:ce:0 | ||
178 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0a0b0c0d0e0f3b79424c9c0dd436bace:7e:9e:0 | ||
179 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0b0c0d0e0f3b79424c9c0dd436bace9e:11:0e:0 | ||
180 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0c0d0e0f3b79424c9c0dd436bace9e0e:73:d4:0 | ||
181 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0d0e0f3b79424c9c0dd436bace9e0ed4:93:58:0 | ||
182 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0e0f3b79424c9c0dd436bace9e0ed458:17:6a:0 | ||
183 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0f3b79424c9c0dd436bace9e0ed4586a:2a:4f:0 | ||
184 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:3b79424c9c0dd436bace9e0ed4586a4f:ae:32:0 | ||
185 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:79424c9c0dd436bace9e0ed4586a4f32:2d:b9:0 | ||
186 | # all of the above packed into one | ||
187 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1bee22e409f96e93d7e117393172aae2d:3b79424c9c0dd436bace9e0ed4586a4f32b9:0 | ||
188 | |||
189 | # TODO: 192 and 256 bit keys | ||
190 | |||
96 | # For all CFB128 encrypts and decrypts, the transformed sequence is | 191 | # For all CFB128 encrypts and decrypts, the transformed sequence is |
97 | # AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec | 192 | # AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec |
98 | # CFB128-AES128.Encrypt | 193 | # CFB128-AES128.Encrypt |
@@ -174,6 +269,16 @@ DESX-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363 | |||
174 | # DES EDE3 CBC tests (from destest) | 269 | # DES EDE3 CBC tests (from destest) |
175 | DES-EDE3-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D41C673812CFDE9675 | 270 | DES-EDE3-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D41C673812CFDE9675 |
176 | 271 | ||
272 | # DES CFB1 from FIPS 81 | ||
273 | # plaintext: 0100 1110 0110 1111 0111 0111 = 4e6f77 | ||
274 | # ciphertext: 1100 1101 0001 1110 1100 1001 = cd1ec9 | ||
275 | |||
276 | DES-CFB1*8:0123456789abcdef:1234567890abcdef:4e6f77:cd1ec9 | ||
277 | |||
278 | # DES CFB8 from FIPS 81 | ||
279 | |||
280 | DES-CFB8:0123456789abcdef:1234567890abcdef:4e6f7720697320746865:f31fda07011462ee187f | ||
281 | |||
177 | # RC4 tests (from rc4test) | 282 | # RC4 tests (from rc4test) |
178 | RC4:0123456789abcdef0123456789abcdef::0123456789abcdef:75b7878099e0c596 | 283 | RC4:0123456789abcdef0123456789abcdef::0123456789abcdef:75b7878099e0c596 |
179 | RC4:0123456789abcdef0123456789abcdef::0000000000000000:7494c2e7104b0879 | 284 | RC4:0123456789abcdef0123456789abcdef::0000000000000000:7494c2e7104b0879 |
diff --git a/src/lib/libcrypto/evp/m_dss.c b/src/lib/libcrypto/evp/m_dss.c index beb8d7fc5c..d393eb3400 100644 --- a/src/lib/libcrypto/evp/m_dss.c +++ b/src/lib/libcrypto/evp/m_dss.c | |||
@@ -77,7 +77,7 @@ static const EVP_MD dsa_md= | |||
77 | NID_dsaWithSHA, | 77 | NID_dsaWithSHA, |
78 | NID_dsaWithSHA, | 78 | NID_dsaWithSHA, |
79 | SHA_DIGEST_LENGTH, | 79 | SHA_DIGEST_LENGTH, |
80 | 0, | 80 | EVP_MD_FLAG_FIPS, |
81 | init, | 81 | init, |
82 | update, | 82 | update, |
83 | final, | 83 | final, |
diff --git a/src/lib/libcrypto/evp/m_md2.c b/src/lib/libcrypto/evp/m_md2.c index 50914c83b3..0df48e5199 100644 --- a/src/lib/libcrypto/evp/m_md2.c +++ b/src/lib/libcrypto/evp/m_md2.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include "evp_locl.h" | ||
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | #include <openssl/md2.h> | 66 | #include <openssl/md2.h> |
diff --git a/src/lib/libcrypto/evp/m_md4.c b/src/lib/libcrypto/evp/m_md4.c index e19b663754..0605e4b707 100644 --- a/src/lib/libcrypto/evp/m_md4.c +++ b/src/lib/libcrypto/evp/m_md4.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include "evp_locl.h" | ||
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | #include <openssl/md4.h> | 66 | #include <openssl/md4.h> |
diff --git a/src/lib/libcrypto/evp/m_md5.c b/src/lib/libcrypto/evp/m_md5.c index b00a03e048..752615d473 100644 --- a/src/lib/libcrypto/evp/m_md5.c +++ b/src/lib/libcrypto/evp/m_md5.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include "evp_locl.h" | ||
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | #include <openssl/md5.h> | 66 | #include <openssl/md5.h> |
diff --git a/src/lib/libcrypto/evp/m_mdc2.c b/src/lib/libcrypto/evp/m_mdc2.c index 9f6467c931..62de1336b8 100644 --- a/src/lib/libcrypto/evp/m_mdc2.c +++ b/src/lib/libcrypto/evp/m_mdc2.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include "evp_locl.h" | ||
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | #include <openssl/mdc2.h> | 66 | #include <openssl/mdc2.h> |
diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c index 10697c7ed3..d1785e5f74 100644 --- a/src/lib/libcrypto/evp/m_sha.c +++ b/src/lib/libcrypto/evp/m_sha.c | |||
@@ -56,10 +56,11 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_SHA | 59 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) |
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include "evp_locl.h" | ||
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | 66 | ||
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c index d6be3502f0..fe4402389a 100644 --- a/src/lib/libcrypto/evp/m_sha1.c +++ b/src/lib/libcrypto/evp/m_sha1.c | |||
@@ -77,7 +77,7 @@ static const EVP_MD sha1_md= | |||
77 | NID_sha1, | 77 | NID_sha1, |
78 | NID_sha1WithRSAEncryption, | 78 | NID_sha1WithRSAEncryption, |
79 | SHA_DIGEST_LENGTH, | 79 | SHA_DIGEST_LENGTH, |
80 | 0, | 80 | EVP_MD_FLAG_FIPS, |
81 | init, | 81 | init, |
82 | update, | 82 | update, |
83 | final, | 83 | final, |
diff --git a/src/lib/libcrypto/evp/names.c b/src/lib/libcrypto/evp/names.c index eb9f4329cd..7712453046 100644 --- a/src/lib/libcrypto/evp/names.c +++ b/src/lib/libcrypto/evp/names.c | |||
@@ -61,6 +61,9 @@ | |||
61 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
62 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
63 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
64 | #ifdef OPENSSL_FIPS | ||
65 | #include <openssl/fips.h> | ||
66 | #endif | ||
64 | 67 | ||
65 | int EVP_add_cipher(const EVP_CIPHER *c) | 68 | int EVP_add_cipher(const EVP_CIPHER *c) |
66 | { | 69 | { |
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index 4c91f919d5..06ee80761f 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
@@ -77,6 +77,15 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
77 | 77 | ||
78 | if (key != NULL) | 78 | if (key != NULL) |
79 | { | 79 | { |
80 | #ifdef OPENSSL_FIPS | ||
81 | if (FIPS_mode() && !(md->flags & EVP_MD_FLAG_FIPS) | ||
82 | && (!(ctx->md_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW) | ||
83 | || !(ctx->i_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW) | ||
84 | || !(ctx->o_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW))) | ||
85 | OpenSSLDie(__FILE__,__LINE__, | ||
86 | "HMAC: digest not allowed in FIPS mode"); | ||
87 | #endif | ||
88 | |||
80 | reset=1; | 89 | reset=1; |
81 | j=EVP_MD_block_size(md); | 90 | j=EVP_MD_block_size(md); |
82 | OPENSSL_assert(j <= sizeof ctx->key); | 91 | OPENSSL_assert(j <= sizeof ctx->key); |
@@ -171,3 +180,10 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | |||
171 | return(md); | 180 | return(md); |
172 | } | 181 | } |
173 | 182 | ||
183 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags) | ||
184 | { | ||
185 | EVP_MD_CTX_set_flags(&ctx->i_ctx, flags); | ||
186 | EVP_MD_CTX_set_flags(&ctx->o_ctx, flags); | ||
187 | EVP_MD_CTX_set_flags(&ctx->md_ctx, flags); | ||
188 | } | ||
189 | |||
diff --git a/src/lib/libcrypto/hmac/hmac.h b/src/lib/libcrypto/hmac/hmac.h index 0364a1fcbd..294ab3b36a 100644 --- a/src/lib/libcrypto/hmac/hmac.h +++ b/src/lib/libcrypto/hmac/hmac.h | |||
@@ -98,6 +98,7 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | |||
98 | const unsigned char *d, int n, unsigned char *md, | 98 | const unsigned char *d, int n, unsigned char *md, |
99 | unsigned int *md_len); | 99 | unsigned int *md_len); |
100 | 100 | ||
101 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); | ||
101 | 102 | ||
102 | #ifdef __cplusplus | 103 | #ifdef __cplusplus |
103 | } | 104 | } |
diff --git a/src/lib/libcrypto/idea/idea.h b/src/lib/libcrypto/idea/idea.h index 67132414ee..bf41844fd7 100644 --- a/src/lib/libcrypto/idea/idea.h +++ b/src/lib/libcrypto/idea/idea.h | |||
@@ -82,6 +82,10 @@ typedef struct idea_key_st | |||
82 | const char *idea_options(void); | 82 | const char *idea_options(void); |
83 | void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, | 83 | void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, |
84 | IDEA_KEY_SCHEDULE *ks); | 84 | IDEA_KEY_SCHEDULE *ks); |
85 | #ifdef OPENSSL_FIPS | ||
86 | void private_idea_set_encrypt_key(const unsigned char *key, | ||
87 | IDEA_KEY_SCHEDULE *ks); | ||
88 | #endif | ||
85 | void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); | 89 | void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); |
86 | void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); | 90 | void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); |
87 | void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, | 91 | void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, |
diff --git a/src/lib/libcrypto/md2/md2.h b/src/lib/libcrypto/md2/md2.h index ad9241455c..d0ef9da08e 100644 --- a/src/lib/libcrypto/md2/md2.h +++ b/src/lib/libcrypto/md2/md2.h | |||
@@ -80,6 +80,9 @@ typedef struct MD2state_st | |||
80 | } MD2_CTX; | 80 | } MD2_CTX; |
81 | 81 | ||
82 | const char *MD2_options(void); | 82 | const char *MD2_options(void); |
83 | #ifdef OPENSSL_FIPS | ||
84 | int private_MD2_Init(MD2_CTX *c); | ||
85 | #endif | ||
83 | int MD2_Init(MD2_CTX *c); | 86 | int MD2_Init(MD2_CTX *c); |
84 | int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len); | 87 | int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len); |
85 | int MD2_Final(unsigned char *md, MD2_CTX *c); | 88 | int MD2_Final(unsigned char *md, MD2_CTX *c); |
diff --git a/src/lib/libcrypto/md2/md2_dgst.c b/src/lib/libcrypto/md2/md2_dgst.c index ecb64f0ec4..8124acd687 100644 --- a/src/lib/libcrypto/md2/md2_dgst.c +++ b/src/lib/libcrypto/md2/md2_dgst.c | |||
@@ -62,6 +62,8 @@ | |||
62 | #include <openssl/md2.h> | 62 | #include <openssl/md2.h> |
63 | #include <openssl/opensslv.h> | 63 | #include <openssl/opensslv.h> |
64 | #include <openssl/crypto.h> | 64 | #include <openssl/crypto.h> |
65 | #include <openssl/fips.h> | ||
66 | #include <openssl/err.h> | ||
65 | 67 | ||
66 | const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT; | 68 | const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT; |
67 | 69 | ||
@@ -116,7 +118,7 @@ const char *MD2_options(void) | |||
116 | return("md2(int)"); | 118 | return("md2(int)"); |
117 | } | 119 | } |
118 | 120 | ||
119 | int MD2_Init(MD2_CTX *c) | 121 | FIPS_NON_FIPS_MD_Init(MD2) |
120 | { | 122 | { |
121 | c->num=0; | 123 | c->num=0; |
122 | memset(c->state,0,sizeof c->state); | 124 | memset(c->state,0,sizeof c->state); |
diff --git a/src/lib/libcrypto/md32_common.h b/src/lib/libcrypto/md32_common.h index 573850b122..733da6acaf 100644 --- a/src/lib/libcrypto/md32_common.h +++ b/src/lib/libcrypto/md32_common.h | |||
@@ -128,6 +128,10 @@ | |||
128 | * <appro@fy.chalmers.se> | 128 | * <appro@fy.chalmers.se> |
129 | */ | 129 | */ |
130 | 130 | ||
131 | #include <openssl/crypto.h> | ||
132 | #include <openssl/fips.h> | ||
133 | #include <openssl/err.h> | ||
134 | |||
131 | #if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN) | 135 | #if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN) |
132 | #error "DATA_ORDER must be defined!" | 136 | #error "DATA_ORDER must be defined!" |
133 | #endif | 137 | #endif |
@@ -207,7 +211,7 @@ | |||
207 | : "cc"); \ | 211 | : "cc"); \ |
208 | ret; \ | 212 | ret; \ |
209 | }) | 213 | }) |
210 | # elif defined(__powerpc) || defined(__ppc) | 214 | # elif defined(__powerpc) || defined(__ppc__) || defined(__powerpc64__) |
211 | # define ROTATE(a,n) ({ register unsigned int ret; \ | 215 | # define ROTATE(a,n) ({ register unsigned int ret; \ |
212 | asm ( \ | 216 | asm ( \ |
213 | "rlwinm %0,%1,%2,0,31" \ | 217 | "rlwinm %0,%1,%2,0,31" \ |
@@ -555,6 +559,14 @@ int HASH_FINAL (unsigned char *md, HASH_CTX *c) | |||
555 | static const unsigned char end[4]={0x80,0x00,0x00,0x00}; | 559 | static const unsigned char end[4]={0x80,0x00,0x00,0x00}; |
556 | const unsigned char *cp=end; | 560 | const unsigned char *cp=end; |
557 | 561 | ||
562 | #if 0 | ||
563 | if(FIPS_mode() && !FIPS_md5_allowed()) | ||
564 | { | ||
565 | FIPSerr(FIPS_F_HASH_FINAL,FIPS_R_NON_FIPS_METHOD); | ||
566 | return 0; | ||
567 | } | ||
568 | #endif | ||
569 | |||
558 | /* c->num should definitly have room for at least one more byte. */ | 570 | /* c->num should definitly have room for at least one more byte. */ |
559 | p=c->data; | 571 | p=c->data; |
560 | i=c->num>>2; | 572 | i=c->num>>2; |
diff --git a/src/lib/libcrypto/md4/md4.h b/src/lib/libcrypto/md4/md4.h index 7a7b23682f..7e761efb62 100644 --- a/src/lib/libcrypto/md4/md4.h +++ b/src/lib/libcrypto/md4/md4.h | |||
@@ -104,6 +104,9 @@ typedef struct MD4state_st | |||
104 | int num; | 104 | int num; |
105 | } MD4_CTX; | 105 | } MD4_CTX; |
106 | 106 | ||
107 | #ifdef OPENSSL_FIPS | ||
108 | int private_MD4_Init(MD4_CTX *c); | ||
109 | #endif | ||
107 | int MD4_Init(MD4_CTX *c); | 110 | int MD4_Init(MD4_CTX *c); |
108 | int MD4_Update(MD4_CTX *c, const void *data, unsigned long len); | 111 | int MD4_Update(MD4_CTX *c, const void *data, unsigned long len); |
109 | int MD4_Final(unsigned char *md, MD4_CTX *c); | 112 | int MD4_Final(unsigned char *md, MD4_CTX *c); |
diff --git a/src/lib/libcrypto/md4/md4_dgst.c b/src/lib/libcrypto/md4/md4_dgst.c index 7afb7185b6..ee7cc72262 100644 --- a/src/lib/libcrypto/md4/md4_dgst.c +++ b/src/lib/libcrypto/md4/md4_dgst.c | |||
@@ -70,7 +70,7 @@ const char *MD4_version="MD4" OPENSSL_VERSION_PTEXT; | |||
70 | #define INIT_DATA_C (unsigned long)0x98badcfeL | 70 | #define INIT_DATA_C (unsigned long)0x98badcfeL |
71 | #define INIT_DATA_D (unsigned long)0x10325476L | 71 | #define INIT_DATA_D (unsigned long)0x10325476L |
72 | 72 | ||
73 | int MD4_Init(MD4_CTX *c) | 73 | FIPS_NON_FIPS_MD_Init(MD4) |
74 | { | 74 | { |
75 | c->A=INIT_DATA_A; | 75 | c->A=INIT_DATA_A; |
76 | c->B=INIT_DATA_B; | 76 | c->B=INIT_DATA_B; |
diff --git a/src/lib/libcrypto/md5/md5.h b/src/lib/libcrypto/md5/md5.h index a252e02115..c663dd1816 100644 --- a/src/lib/libcrypto/md5/md5.h +++ b/src/lib/libcrypto/md5/md5.h | |||
@@ -104,6 +104,9 @@ typedef struct MD5state_st | |||
104 | int num; | 104 | int num; |
105 | } MD5_CTX; | 105 | } MD5_CTX; |
106 | 106 | ||
107 | #ifdef OPENSSL_FIPS | ||
108 | int private_MD5_Init(MD5_CTX *c); | ||
109 | #endif | ||
107 | int MD5_Init(MD5_CTX *c); | 110 | int MD5_Init(MD5_CTX *c); |
108 | int MD5_Update(MD5_CTX *c, const void *data, unsigned long len); | 111 | int MD5_Update(MD5_CTX *c, const void *data, unsigned long len); |
109 | int MD5_Final(unsigned char *md, MD5_CTX *c); | 112 | int MD5_Final(unsigned char *md, MD5_CTX *c); |
diff --git a/src/lib/libcrypto/md5/md5_dgst.c b/src/lib/libcrypto/md5/md5_dgst.c index 9c7abc3697..54b33c6509 100644 --- a/src/lib/libcrypto/md5/md5_dgst.c +++ b/src/lib/libcrypto/md5/md5_dgst.c | |||
@@ -70,7 +70,7 @@ const char *MD5_version="MD5" OPENSSL_VERSION_PTEXT; | |||
70 | #define INIT_DATA_C (unsigned long)0x98badcfeL | 70 | #define INIT_DATA_C (unsigned long)0x98badcfeL |
71 | #define INIT_DATA_D (unsigned long)0x10325476L | 71 | #define INIT_DATA_D (unsigned long)0x10325476L |
72 | 72 | ||
73 | int MD5_Init(MD5_CTX *c) | 73 | FIPS_NON_FIPS_MD_Init(MD5) |
74 | { | 74 | { |
75 | c->A=INIT_DATA_A; | 75 | c->A=INIT_DATA_A; |
76 | c->B=INIT_DATA_B; | 76 | c->B=INIT_DATA_B; |
diff --git a/src/lib/libcrypto/mdc2/Makefile b/src/lib/libcrypto/mdc2/Makefile new file mode 100644 index 0000000000..38c785bf95 --- /dev/null +++ b/src/lib/libcrypto/mdc2/Makefile | |||
@@ -0,0 +1,98 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/mdc2/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= mdc2 | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALL_PREFIX= | ||
11 | OPENSSLDIR= /usr/local/ssl | ||
12 | INSTALLTOP=/usr/local/ssl | ||
13 | MAKEDEPPROG= makedepend | ||
14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
15 | MAKEFILE= Makefile | ||
16 | AR= ar r | ||
17 | |||
18 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
19 | |||
20 | GENERAL=Makefile | ||
21 | TEST= mdc2test.c | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC=mdc2dgst.c mdc2_one.c | ||
26 | LIBOBJ=mdc2dgst.o mdc2_one.o | ||
27 | |||
28 | SRC= $(LIBSRC) | ||
29 | |||
30 | EXHEADER= mdc2.h | ||
31 | HEADER= $(EXHEADER) | ||
32 | |||
33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
34 | |||
35 | top: | ||
36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
37 | |||
38 | all: lib | ||
39 | |||
40 | lib: $(LIBOBJ) | ||
41 | $(AR) $(LIB) $(LIBOBJ) | ||
42 | $(RANLIB) $(LIB) || echo Never mind. | ||
43 | @touch lib | ||
44 | |||
45 | files: | ||
46 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
47 | |||
48 | links: | ||
49 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
50 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
51 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
57 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
79 | |||
80 | mdc2_one.o: ../../e_os.h ../../include/openssl/bio.h | ||
81 | mdc2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
82 | mdc2_one.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
83 | mdc2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
84 | mdc2_one.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h | ||
85 | mdc2_one.o: ../../include/openssl/opensslconf.h | ||
86 | mdc2_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
87 | mdc2_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
88 | mdc2_one.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
89 | mdc2_one.o: ../cryptlib.h mdc2_one.c | ||
90 | mdc2dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
91 | mdc2dgst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
92 | mdc2dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
93 | mdc2dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
94 | mdc2dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/opensslconf.h | ||
95 | mdc2dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
96 | mdc2dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
97 | mdc2dgst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
98 | mdc2dgst.o: mdc2dgst.c | ||
diff --git a/src/lib/libcrypto/mdc2/mdc2.h b/src/lib/libcrypto/mdc2/mdc2.h index 793a8a0f13..4cba101f37 100644 --- a/src/lib/libcrypto/mdc2/mdc2.h +++ b/src/lib/libcrypto/mdc2/mdc2.h | |||
@@ -80,7 +80,9 @@ typedef struct mdc2_ctx_st | |||
80 | int pad_type; /* either 1 or 2, default 1 */ | 80 | int pad_type; /* either 1 or 2, default 1 */ |
81 | } MDC2_CTX; | 81 | } MDC2_CTX; |
82 | 82 | ||
83 | 83 | #ifdef OPENSSL_FIPS | |
84 | int private_MDC2_Init(MDC2_CTX *c); | ||
85 | #endif | ||
84 | int MDC2_Init(MDC2_CTX *c); | 86 | int MDC2_Init(MDC2_CTX *c); |
85 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len); | 87 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len); |
86 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); | 88 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); |
diff --git a/src/lib/libcrypto/o_time.c b/src/lib/libcrypto/o_time.c index 785468131e..e29091d650 100644 --- a/src/lib/libcrypto/o_time.c +++ b/src/lib/libcrypto/o_time.c | |||
@@ -114,16 +114,28 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | |||
114 | return NULL; | 114 | return NULL; |
115 | logvalue[reslen] = '\0'; | 115 | logvalue[reslen] = '\0'; |
116 | 116 | ||
117 | t = *timer; | ||
118 | |||
119 | /* The following is extracted from the DEC C header time.h */ | ||
120 | /* | ||
121 | ** Beginning in OpenVMS Version 7.0 mktime, time, ctime, strftime | ||
122 | ** have two implementations. One implementation is provided | ||
123 | ** for compatibility and deals with time in terms of local time, | ||
124 | ** the other __utc_* deals with time in terms of UTC. | ||
125 | */ | ||
126 | /* We use the same conditions as in said time.h to check if we should | ||
127 | assume that t contains local time (and should therefore be adjusted) | ||
128 | or UTC (and should therefore be left untouched). */ | ||
129 | #if __CRTL_VER < 70000000 || defined _VMS_V6_SOURCE | ||
117 | /* Get the numerical value of the equivalence string */ | 130 | /* Get the numerical value of the equivalence string */ |
118 | status = atoi(logvalue); | 131 | status = atoi(logvalue); |
119 | 132 | ||
120 | /* and use it to move time to GMT */ | 133 | /* and use it to move time to GMT */ |
121 | t = *timer - status; | 134 | t -= status; |
135 | #endif | ||
122 | 136 | ||
123 | /* then convert the result to the time structure */ | 137 | /* then convert the result to the time structure */ |
124 | #ifndef OPENSSL_THREADS | 138 | |
125 | ts=(struct tm *)localtime(&t); | ||
126 | #else | ||
127 | /* Since there was no gmtime_r() to do this stuff for us, | 139 | /* Since there was no gmtime_r() to do this stuff for us, |
128 | we have to do it the hard way. */ | 140 | we have to do it the hard way. */ |
129 | { | 141 | { |
@@ -198,7 +210,6 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | |||
198 | result->tm_isdst = 0; /* There's no way to know... */ | 210 | result->tm_isdst = 0; /* There's no way to know... */ |
199 | 211 | ||
200 | ts = result; | 212 | ts = result; |
201 | #endif | ||
202 | } | 213 | } |
203 | } | 214 | } |
204 | #endif | 215 | #endif |
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c index b4453b4a98..28c9370ca3 100644 --- a/src/lib/libcrypto/objects/o_names.c +++ b/src/lib/libcrypto/objects/o_names.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <string.h> | 3 | #include <string.h> |
4 | 4 | ||
5 | #include <openssl/err.h> | ||
5 | #include <openssl/lhash.h> | 6 | #include <openssl/lhash.h> |
6 | #include <openssl/objects.h> | 7 | #include <openssl/objects.h> |
7 | #include <openssl/safestack.h> | 8 | #include <openssl/safestack.h> |
@@ -80,7 +81,11 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), | |||
80 | MemCheck_off(); | 81 | MemCheck_off(); |
81 | name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS)); | 82 | name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS)); |
82 | MemCheck_on(); | 83 | MemCheck_on(); |
83 | if (!name_funcs) return(0); | 84 | if (!name_funcs) |
85 | { | ||
86 | OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX,ERR_R_MALLOC_FAILURE); | ||
87 | return(0); | ||
88 | } | ||
84 | name_funcs->hash_func = lh_strhash; | 89 | name_funcs->hash_func = lh_strhash; |
85 | name_funcs->cmp_func = OPENSSL_strcmp; | 90 | name_funcs->cmp_func = OPENSSL_strcmp; |
86 | name_funcs->free_func = 0; /* NULL is often declared to | 91 | name_funcs->free_func = 0; /* NULL is often declared to |
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index 4534dc0985..f549d078ef 100644 --- a/src/lib/libcrypto/objects/obj_dat.c +++ b/src/lib/libcrypto/objects/obj_dat.c | |||
@@ -236,13 +236,13 @@ int OBJ_add_object(const ASN1_OBJECT *obj) | |||
236 | if (added == NULL) | 236 | if (added == NULL) |
237 | if (!init_added()) return(0); | 237 | if (!init_added()) return(0); |
238 | if ((o=OBJ_dup(obj)) == NULL) goto err; | 238 | if ((o=OBJ_dup(obj)) == NULL) goto err; |
239 | if (!(ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err; | 239 | if (!(ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; |
240 | if ((o->length != 0) && (obj->data != NULL)) | 240 | if ((o->length != 0) && (obj->data != NULL)) |
241 | ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)); | 241 | if (!(ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; |
242 | if (o->sn != NULL) | 242 | if (o->sn != NULL) |
243 | ao[ADDED_SNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)); | 243 | if (!(ao[ADDED_SNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; |
244 | if (o->ln != NULL) | 244 | if (o->ln != NULL) |
245 | ao[ADDED_LNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)); | 245 | if (!(ao[ADDED_LNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; |
246 | 246 | ||
247 | for (i=ADDED_DATA; i<=ADDED_NID; i++) | 247 | for (i=ADDED_DATA; i<=ADDED_NID; i++) |
248 | { | 248 | { |
@@ -260,6 +260,8 @@ int OBJ_add_object(const ASN1_OBJECT *obj) | |||
260 | ASN1_OBJECT_FLAG_DYNAMIC_DATA); | 260 | ASN1_OBJECT_FLAG_DYNAMIC_DATA); |
261 | 261 | ||
262 | return(o->nid); | 262 | return(o->nid); |
263 | err2: | ||
264 | OBJerr(OBJ_F_OBJ_ADD_OBJECT,ERR_R_MALLOC_FAILURE); | ||
263 | err: | 265 | err: |
264 | for (i=ADDED_DATA; i<=ADDED_NID; i++) | 266 | for (i=ADDED_DATA; i<=ADDED_NID; i++) |
265 | if (ao[i] != NULL) OPENSSL_free(ao[i]); | 267 | if (ao[i] != NULL) OPENSSL_free(ao[i]); |
@@ -648,7 +650,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) | |||
648 | 650 | ||
649 | if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL) | 651 | if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL) |
650 | { | 652 | { |
651 | OBJerr(OBJ_F_OBJ_CREATE,OBJ_R_MALLOC_FAILURE); | 653 | OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE); |
652 | return(0); | 654 | return(0); |
653 | } | 655 | } |
654 | i=a2d_ASN1_OBJECT(buf,i,oid,-1); | 656 | i=a2d_ASN1_OBJECT(buf,i,oid,-1); |
diff --git a/src/lib/libcrypto/objects/obj_err.c b/src/lib/libcrypto/objects/obj_err.c index 80ab6855af..2b5f43e3cc 100644 --- a/src/lib/libcrypto/objects/obj_err.c +++ b/src/lib/libcrypto/objects/obj_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/objects/obj_err.c */ | 1 | /* crypto/objects/obj_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2004 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 |
@@ -66,8 +66,10 @@ | |||
66 | #ifndef OPENSSL_NO_ERR | 66 | #ifndef OPENSSL_NO_ERR |
67 | static ERR_STRING_DATA OBJ_str_functs[]= | 67 | static ERR_STRING_DATA OBJ_str_functs[]= |
68 | { | 68 | { |
69 | {ERR_PACK(0,OBJ_F_OBJ_ADD_OBJECT,0), "OBJ_add_object"}, | ||
69 | {ERR_PACK(0,OBJ_F_OBJ_CREATE,0), "OBJ_create"}, | 70 | {ERR_PACK(0,OBJ_F_OBJ_CREATE,0), "OBJ_create"}, |
70 | {ERR_PACK(0,OBJ_F_OBJ_DUP,0), "OBJ_dup"}, | 71 | {ERR_PACK(0,OBJ_F_OBJ_DUP,0), "OBJ_dup"}, |
72 | {ERR_PACK(0,OBJ_F_OBJ_NAME_NEW_INDEX,0), "OBJ_NAME_new_index"}, | ||
71 | {ERR_PACK(0,OBJ_F_OBJ_NID2LN,0), "OBJ_nid2ln"}, | 73 | {ERR_PACK(0,OBJ_F_OBJ_NID2LN,0), "OBJ_nid2ln"}, |
72 | {ERR_PACK(0,OBJ_F_OBJ_NID2OBJ,0), "OBJ_nid2obj"}, | 74 | {ERR_PACK(0,OBJ_F_OBJ_NID2OBJ,0), "OBJ_nid2obj"}, |
73 | {ERR_PACK(0,OBJ_F_OBJ_NID2SN,0), "OBJ_nid2sn"}, | 75 | {ERR_PACK(0,OBJ_F_OBJ_NID2SN,0), "OBJ_nid2sn"}, |
diff --git a/src/lib/libcrypto/objects/obj_mac.num b/src/lib/libcrypto/objects/obj_mac.num index 9838072b65..0e64a929ba 100644 --- a/src/lib/libcrypto/objects/obj_mac.num +++ b/src/lib/libcrypto/objects/obj_mac.num | |||
@@ -647,3 +647,21 @@ joint_iso_itu_t 646 | |||
647 | international_organizations 647 | 647 | international_organizations 647 |
648 | ms_smartcard_login 648 | 648 | ms_smartcard_login 648 |
649 | ms_upn 649 | 649 | ms_upn 649 |
650 | aes_128_cfb1 650 | ||
651 | aes_192_cfb1 651 | ||
652 | aes_256_cfb1 652 | ||
653 | aes_128_cfb8 653 | ||
654 | aes_192_cfb8 654 | ||
655 | aes_256_cfb8 655 | ||
656 | des_cfb1 656 | ||
657 | des_cfb8 657 | ||
658 | des_ede3_cfb1 658 | ||
659 | des_ede3_cfb8 659 | ||
660 | streetAddress 660 | ||
661 | postalCode 661 | ||
662 | id_ppl 662 | ||
663 | proxyCertInfo 663 | ||
664 | id_ppl_anyLanguage 664 | ||
665 | id_ppl_inheritAll 665 | ||
666 | id_ppl_independent 666 | ||
667 | Independent 667 | ||
diff --git a/src/lib/libcrypto/objects/objects.h b/src/lib/libcrypto/objects/objects.h index de10532813..f859d859b8 100644 --- a/src/lib/libcrypto/objects/objects.h +++ b/src/lib/libcrypto/objects/objects.h | |||
@@ -1026,8 +1026,10 @@ void ERR_load_OBJ_strings(void); | |||
1026 | /* Error codes for the OBJ functions. */ | 1026 | /* Error codes for the OBJ functions. */ |
1027 | 1027 | ||
1028 | /* Function codes. */ | 1028 | /* Function codes. */ |
1029 | #define OBJ_F_OBJ_ADD_OBJECT 105 | ||
1029 | #define OBJ_F_OBJ_CREATE 100 | 1030 | #define OBJ_F_OBJ_CREATE 100 |
1030 | #define OBJ_F_OBJ_DUP 101 | 1031 | #define OBJ_F_OBJ_DUP 101 |
1032 | #define OBJ_F_OBJ_NAME_NEW_INDEX 106 | ||
1031 | #define OBJ_F_OBJ_NID2LN 102 | 1033 | #define OBJ_F_OBJ_NID2LN 102 |
1032 | #define OBJ_F_OBJ_NID2OBJ 103 | 1034 | #define OBJ_F_OBJ_NID2OBJ 103 |
1033 | #define OBJ_F_OBJ_NID2SN 104 | 1035 | #define OBJ_F_OBJ_NID2SN 104 |
diff --git a/src/lib/libcrypto/objects/objects.txt b/src/lib/libcrypto/objects/objects.txt index 3ba11f65cc..50e9031e61 100644 --- a/src/lib/libcrypto/objects/objects.txt +++ b/src/lib/libcrypto/objects/objects.txt | |||
@@ -312,6 +312,7 @@ id-pkix 9 : id-pda | |||
312 | id-pkix 10 : id-aca | 312 | id-pkix 10 : id-aca |
313 | id-pkix 11 : id-qcs | 313 | id-pkix 11 : id-qcs |
314 | id-pkix 12 : id-cct | 314 | id-pkix 12 : id-cct |
315 | id-pkix 21 : id-ppl | ||
315 | id-pkix 48 : id-ad | 316 | id-pkix 48 : id-ad |
316 | 317 | ||
317 | # PKIX Modules | 318 | # PKIX Modules |
@@ -346,6 +347,7 @@ id-pe 9 : sbqp-routerIdentifier | |||
346 | id-pe 10 : ac-proxying | 347 | id-pe 10 : ac-proxying |
347 | !Cname sinfo-access | 348 | !Cname sinfo-access |
348 | id-pe 11 : subjectInfoAccess : Subject Information Access | 349 | id-pe 11 : subjectInfoAccess : Subject Information Access |
350 | id-pe 14 : proxyCertInfo : Proxy Certificate Information | ||
349 | 351 | ||
350 | # PKIX policyQualifiers for Internet policy qualifiers | 352 | # PKIX policyQualifiers for Internet policy qualifiers |
351 | id-qt 1 : id-qt-cps : Policy Qualifier CPS | 353 | id-qt 1 : id-qt-cps : Policy Qualifier CPS |
@@ -461,6 +463,11 @@ id-cct 1 : id-cct-crs | |||
461 | id-cct 2 : id-cct-PKIData | 463 | id-cct 2 : id-cct-PKIData |
462 | id-cct 3 : id-cct-PKIResponse | 464 | id-cct 3 : id-cct-PKIResponse |
463 | 465 | ||
466 | # Predefined Proxy Certificate policy languages | ||
467 | id-ppl 0 : id-ppl-anyLanguage : Any language | ||
468 | id-ppl 1 : id-ppl-inheritAll : Inherit all | ||
469 | id-ppl 2 : id-ppl-independent : Independent | ||
470 | |||
464 | # access descriptors for authority info access extension | 471 | # access descriptors for authority info access extension |
465 | !Cname ad-OCSP | 472 | !Cname ad-OCSP |
466 | id-ad 1 : OCSP : OCSP | 473 | id-ad 1 : OCSP : OCSP |
@@ -536,10 +543,12 @@ X509 5 : : serialNumber | |||
536 | X509 6 : C : countryName | 543 | X509 6 : C : countryName |
537 | X509 7 : L : localityName | 544 | X509 7 : L : localityName |
538 | X509 8 : ST : stateOrProvinceName | 545 | X509 8 : ST : stateOrProvinceName |
546 | X509 9 : : streetAddress | ||
539 | X509 10 : O : organizationName | 547 | X509 10 : O : organizationName |
540 | X509 11 : OU : organizationalUnitName | 548 | X509 11 : OU : organizationalUnitName |
541 | X509 12 : : title | 549 | X509 12 : : title |
542 | X509 13 : : description | 550 | X509 13 : : description |
551 | X509 17 : : postalCode | ||
543 | X509 41 : name : name | 552 | X509 41 : name : name |
544 | X509 42 : GN : givenName | 553 | X509 42 : GN : givenName |
545 | X509 43 : : initials | 554 | X509 43 : : initials |
@@ -681,6 +690,19 @@ aes 43 : AES-256-OFB : aes-256-ofb | |||
681 | !Cname aes-256-cfb128 | 690 | !Cname aes-256-cfb128 |
682 | aes 44 : AES-256-CFB : aes-256-cfb | 691 | aes 44 : AES-256-CFB : aes-256-cfb |
683 | 692 | ||
693 | # There are no OIDs for these modes... | ||
694 | |||
695 | : AES-128-CFB1 : aes-128-cfb1 | ||
696 | : AES-192-CFB1 : aes-192-cfb1 | ||
697 | : AES-256-CFB1 : aes-256-cfb1 | ||
698 | : AES-128-CFB8 : aes-128-cfb8 | ||
699 | : AES-192-CFB8 : aes-192-cfb8 | ||
700 | : AES-256-CFB8 : aes-256-cfb8 | ||
701 | : DES-CFB1 : des-cfb1 | ||
702 | : DES-CFB8 : des-cfb8 | ||
703 | : DES-EDE3-CFB1 : des-ede3-cfb1 | ||
704 | : DES-EDE3-CFB8 : des-ede3-cfb8 | ||
705 | |||
684 | # Hold instruction CRL entry extension | 706 | # Hold instruction CRL entry extension |
685 | !Cname hold-instruction-code | 707 | !Cname hold-instruction-code |
686 | id-ce 23 : holdInstructionCode : Hold Instruction Code | 708 | id-ce 23 : holdInstructionCode : Hold Instruction Code |
diff --git a/src/lib/libcrypto/opensslv.h b/src/lib/libcrypto/opensslv.h index 02f1710fb3..5d5f688edd 100644 --- a/src/lib/libcrypto/opensslv.h +++ b/src/lib/libcrypto/opensslv.h | |||
@@ -25,8 +25,12 @@ | |||
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 0x0090704fL | 28 | #define OPENSSL_VERSION_NUMBER 0x0090707fL |
29 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7d 17 Mar 2004" | 29 | #ifdef OPENSSL_FIPS |
30 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7g-fips 11 Apr 2005" | ||
31 | #else | ||
32 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7g 11 Apr 2005" | ||
33 | #endif | ||
30 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT | 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT |
31 | 35 | ||
32 | 36 | ||
diff --git a/src/lib/libcrypto/pem/pem_all.c b/src/lib/libcrypto/pem/pem_all.c index e72b7134ce..07963314c9 100644 --- a/src/lib/libcrypto/pem/pem_all.c +++ b/src/lib/libcrypto/pem/pem_all.c | |||
@@ -64,6 +64,7 @@ | |||
64 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
65 | #include <openssl/pkcs7.h> | 65 | #include <openssl/pkcs7.h> |
66 | #include <openssl/pem.h> | 66 | #include <openssl/pem.h> |
67 | #include <openssl/fips.h> | ||
67 | 68 | ||
68 | #ifndef OPENSSL_NO_RSA | 69 | #ifndef OPENSSL_NO_RSA |
69 | static RSA *pkey_get_rsa(EVP_PKEY *key, RSA **rsa); | 70 | static RSA *pkey_get_rsa(EVP_PKEY *key, RSA **rsa); |
@@ -128,7 +129,49 @@ RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb, | |||
128 | 129 | ||
129 | #endif | 130 | #endif |
130 | 131 | ||
132 | #ifdef OPENSSL_FIPS | ||
133 | |||
134 | int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, | ||
135 | unsigned char *kstr, int klen, | ||
136 | pem_password_cb *cb, void *u) | ||
137 | { | ||
138 | EVP_PKEY *k; | ||
139 | int ret; | ||
140 | k = EVP_PKEY_new(); | ||
141 | if (!k) | ||
142 | return 0; | ||
143 | EVP_PKEY_set1_RSA(k, x); | ||
144 | |||
145 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
146 | EVP_PKEY_free(k); | ||
147 | return ret; | ||
148 | } | ||
149 | |||
150 | #ifndef OPENSSL_NO_FP_API | ||
151 | int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, | ||
152 | unsigned char *kstr, int klen, | ||
153 | pem_password_cb *cb, void *u) | ||
154 | { | ||
155 | EVP_PKEY *k; | ||
156 | int ret; | ||
157 | k = EVP_PKEY_new(); | ||
158 | if (!k) | ||
159 | return 0; | ||
160 | |||
161 | EVP_PKEY_set1_RSA(k, x); | ||
162 | |||
163 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
164 | EVP_PKEY_free(k); | ||
165 | return ret; | ||
166 | } | ||
167 | #endif | ||
168 | |||
169 | #else | ||
170 | |||
131 | IMPLEMENT_PEM_write_cb(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) | 171 | IMPLEMENT_PEM_write_cb(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) |
172 | |||
173 | #endif | ||
174 | |||
132 | IMPLEMENT_PEM_rw(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) | 175 | IMPLEMENT_PEM_rw(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) |
133 | IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) | 176 | IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) |
134 | 177 | ||
@@ -158,7 +201,48 @@ DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb, | |||
158 | return pkey_get_dsa(pktmp, dsa); | 201 | return pkey_get_dsa(pktmp, dsa); |
159 | } | 202 | } |
160 | 203 | ||
204 | |||
205 | #ifdef OPENSSL_FIPS | ||
206 | |||
207 | int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, | ||
208 | unsigned char *kstr, int klen, | ||
209 | pem_password_cb *cb, void *u) | ||
210 | { | ||
211 | EVP_PKEY *k; | ||
212 | int ret; | ||
213 | k = EVP_PKEY_new(); | ||
214 | if (!k) | ||
215 | return 0; | ||
216 | EVP_PKEY_set1_DSA(k, x); | ||
217 | |||
218 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
219 | EVP_PKEY_free(k); | ||
220 | return ret; | ||
221 | } | ||
222 | |||
223 | #ifndef OPENSSL_NO_FP_API | ||
224 | int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, | ||
225 | unsigned char *kstr, int klen, | ||
226 | pem_password_cb *cb, void *u) | ||
227 | { | ||
228 | EVP_PKEY *k; | ||
229 | int ret; | ||
230 | k = EVP_PKEY_new(); | ||
231 | if (!k) | ||
232 | return 0; | ||
233 | EVP_PKEY_set1_DSA(k, x); | ||
234 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
235 | EVP_PKEY_free(k); | ||
236 | return ret; | ||
237 | } | ||
238 | #endif | ||
239 | |||
240 | #else | ||
241 | |||
161 | IMPLEMENT_PEM_write_cb(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) | 242 | IMPLEMENT_PEM_write_cb(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) |
243 | |||
244 | #endif | ||
245 | |||
162 | IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) | 246 | IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) |
163 | 247 | ||
164 | #ifndef OPENSSL_NO_FP_API | 248 | #ifndef OPENSSL_NO_FP_API |
@@ -190,7 +274,42 @@ IMPLEMENT_PEM_rw(DHparams, DH, PEM_STRING_DHPARAMS, DHparams) | |||
190 | * (When reading, parameter PEM_STRING_EVP_PKEY is a wildcard for anything | 274 | * (When reading, parameter PEM_STRING_EVP_PKEY is a wildcard for anything |
191 | * appropriate.) | 275 | * appropriate.) |
192 | */ | 276 | */ |
277 | |||
278 | #ifdef OPENSSL_FIPS | ||
279 | |||
280 | int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
281 | unsigned char *kstr, int klen, | ||
282 | pem_password_cb *cb, void *u) | ||
283 | { | ||
284 | if (FIPS_mode()) | ||
285 | return PEM_write_bio_PKCS8PrivateKey(bp, x, enc, | ||
286 | (char *)kstr, klen, cb, u); | ||
287 | else | ||
288 | return PEM_ASN1_write_bio((int (*)())i2d_PrivateKey, | ||
289 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), | ||
290 | bp,(char *)x,enc,kstr,klen,cb,u); | ||
291 | } | ||
292 | |||
293 | #ifndef OPENSSL_NO_FP_API | ||
294 | int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
295 | unsigned char *kstr, int klen, | ||
296 | pem_password_cb *cb, void *u) | ||
297 | { | ||
298 | if (FIPS_mode()) | ||
299 | return PEM_write_PKCS8PrivateKey(fp, x, enc, | ||
300 | (char *)kstr, klen, cb, u); | ||
301 | else | ||
302 | return PEM_ASN1_write((int (*)())i2d_PrivateKey, | ||
303 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), | ||
304 | fp,(char *)x,enc,kstr,klen,cb,u); | ||
305 | } | ||
306 | #endif | ||
307 | |||
308 | #else | ||
309 | |||
193 | IMPLEMENT_PEM_write_cb(PrivateKey, EVP_PKEY, ((x->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), PrivateKey) | 310 | IMPLEMENT_PEM_write_cb(PrivateKey, EVP_PKEY, ((x->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), PrivateKey) |
194 | 311 | ||
312 | #endif | ||
313 | |||
195 | IMPLEMENT_PEM_rw(PUBKEY, EVP_PKEY, PEM_STRING_PUBLIC, PUBKEY) | 314 | IMPLEMENT_PEM_rw(PUBKEY, EVP_PKEY, PEM_STRING_PUBLIC, PUBKEY) |
196 | 315 | ||
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index 7785039b99..82815067b3 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c | |||
@@ -73,7 +73,7 @@ const char *PEM_version="PEM" OPENSSL_VERSION_PTEXT; | |||
73 | 73 | ||
74 | #define MIN_LENGTH 4 | 74 | #define MIN_LENGTH 4 |
75 | 75 | ||
76 | static int load_iv(unsigned char **fromp,unsigned char *to, int num); | 76 | static int load_iv(char **fromp,unsigned char *to, int num); |
77 | static int check_pem(const char *nm, const char *name); | 77 | static int check_pem(const char *nm, const char *name); |
78 | 78 | ||
79 | int PEM_def_callback(char *buf, int num, int w, void *key) | 79 | int PEM_def_callback(char *buf, int num, int w, void *key) |
@@ -301,7 +301,7 @@ int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x, | |||
301 | 301 | ||
302 | if ((dsize=i2d(x,NULL)) < 0) | 302 | if ((dsize=i2d(x,NULL)) < 0) |
303 | { | 303 | { |
304 | PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE); | 304 | PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_ASN1_LIB); |
305 | dsize=0; | 305 | dsize=0; |
306 | goto err; | 306 | goto err; |
307 | } | 307 | } |
@@ -432,6 +432,7 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) | |||
432 | int o; | 432 | int o; |
433 | const EVP_CIPHER *enc=NULL; | 433 | const EVP_CIPHER *enc=NULL; |
434 | char *p,c; | 434 | char *p,c; |
435 | char **header_pp = &header; | ||
435 | 436 | ||
436 | cipher->cipher=NULL; | 437 | cipher->cipher=NULL; |
437 | if ((header == NULL) || (*header == '\0') || (*header == '\n')) | 438 | if ((header == NULL) || (*header == '\0') || (*header == '\n')) |
@@ -478,15 +479,16 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) | |||
478 | PEMerr(PEM_F_PEM_GET_EVP_CIPHER_INFO,PEM_R_UNSUPPORTED_ENCRYPTION); | 479 | PEMerr(PEM_F_PEM_GET_EVP_CIPHER_INFO,PEM_R_UNSUPPORTED_ENCRYPTION); |
479 | return(0); | 480 | return(0); |
480 | } | 481 | } |
481 | if (!load_iv((unsigned char **)&header,&(cipher->iv[0]),enc->iv_len)) return(0); | 482 | if (!load_iv(header_pp,&(cipher->iv[0]),enc->iv_len)) |
483 | return(0); | ||
482 | 484 | ||
483 | return(1); | 485 | return(1); |
484 | } | 486 | } |
485 | 487 | ||
486 | static int load_iv(unsigned char **fromp, unsigned char *to, int num) | 488 | static int load_iv(char **fromp, unsigned char *to, int num) |
487 | { | 489 | { |
488 | int v,i; | 490 | int v,i; |
489 | unsigned char *from; | 491 | char *from; |
490 | 492 | ||
491 | from= *fromp; | 493 | from= *fromp; |
492 | for (i=0; i<num; i++) to[i]=0; | 494 | for (i=0; i<num; i++) to[i]=0; |
@@ -623,6 +625,9 @@ int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, | |||
623 | dataB=BUF_MEM_new(); | 625 | dataB=BUF_MEM_new(); |
624 | if ((nameB == NULL) || (headerB == NULL) || (dataB == NULL)) | 626 | if ((nameB == NULL) || (headerB == NULL) || (dataB == NULL)) |
625 | { | 627 | { |
628 | BUF_MEM_free(nameB); | ||
629 | BUF_MEM_free(headerB); | ||
630 | BUF_MEM_free(dataB); | ||
626 | PEMerr(PEM_F_PEM_READ_BIO,ERR_R_MALLOC_FAILURE); | 631 | PEMerr(PEM_F_PEM_READ_BIO,ERR_R_MALLOC_FAILURE); |
627 | return(0); | 632 | return(0); |
628 | } | 633 | } |
diff --git a/src/lib/libcrypto/pem/pem_pkey.c b/src/lib/libcrypto/pem/pem_pkey.c index f77c949e87..9ecdbd5419 100644 --- a/src/lib/libcrypto/pem/pem_pkey.c +++ b/src/lib/libcrypto/pem/pem_pkey.c | |||
@@ -104,6 +104,7 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, vo | |||
104 | if (klen <= 0) { | 104 | if (klen <= 0) { |
105 | PEMerr(PEM_F_PEM_ASN1_READ_BIO, | 105 | PEMerr(PEM_F_PEM_ASN1_READ_BIO, |
106 | PEM_R_BAD_PASSWORD_READ); | 106 | PEM_R_BAD_PASSWORD_READ); |
107 | X509_SIG_free(p8); | ||
107 | goto err; | 108 | goto err; |
108 | } | 109 | } |
109 | p8inf = PKCS8_decrypt(p8, psbuf, klen); | 110 | p8inf = PKCS8_decrypt(p8, psbuf, klen); |
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl index 7c675e3ced..60233f80e8 100644 --- a/src/lib/libcrypto/perlasm/x86asm.pl +++ b/src/lib/libcrypto/perlasm/x86asm.pl | |||
@@ -130,4 +130,6 @@ BSDI - a.out with a very primative version of as. | |||
130 | EOF | 130 | EOF |
131 | } | 131 | } |
132 | 132 | ||
133 | sub main'align() {} # swallow align statements in 0.9.7 context | ||
134 | |||
133 | 1; | 135 | 1; |
diff --git a/src/lib/libcrypto/perlasm/x86ms.pl b/src/lib/libcrypto/perlasm/x86ms.pl index fbb4afb9bd..b6bd744057 100644 --- a/src/lib/libcrypto/perlasm/x86ms.pl +++ b/src/lib/libcrypto/perlasm/x86ms.pl | |||
@@ -160,6 +160,7 @@ sub main'not { &out1("not",@_); } | |||
160 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } | 160 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } |
161 | sub main'ret { &out0("ret"); } | 161 | sub main'ret { &out0("ret"); } |
162 | sub main'nop { &out0("nop"); } | 162 | sub main'nop { &out0("nop"); } |
163 | sub main'movz { &out2("movzx",@_); } | ||
163 | 164 | ||
164 | sub out2 | 165 | sub out2 |
165 | { | 166 | { |
diff --git a/src/lib/libcrypto/perlasm/x86nasm.pl b/src/lib/libcrypto/perlasm/x86nasm.pl index 30346af4ea..5009acb4b3 100644 --- a/src/lib/libcrypto/perlasm/x86nasm.pl +++ b/src/lib/libcrypto/perlasm/x86nasm.pl | |||
@@ -86,7 +86,7 @@ sub get_mem | |||
86 | { | 86 | { |
87 | my($size,$addr,$reg1,$reg2,$idx)=@_; | 87 | my($size,$addr,$reg1,$reg2,$idx)=@_; |
88 | my($t,$post); | 88 | my($t,$post); |
89 | my($ret)="["; | 89 | my($ret)="$size ["; |
90 | $addr =~ s/^\s+//; | 90 | $addr =~ s/^\s+//; |
91 | if ($addr =~ /^(.+)\+(.+)$/) | 91 | if ($addr =~ /^(.+)\+(.+)$/) |
92 | { | 92 | { |
@@ -169,6 +169,7 @@ sub main'not { &out1("not",@_); } | |||
169 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } | 169 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } |
170 | sub main'ret { &out0("ret"); } | 170 | sub main'ret { &out0("ret"); } |
171 | sub main'nop { &out0("nop"); } | 171 | sub main'nop { &out0("nop"); } |
172 | sub main'movz { &out2("movzx",@_); } | ||
172 | 173 | ||
173 | sub out2 | 174 | sub out2 |
174 | { | 175 | { |
@@ -176,6 +177,11 @@ sub out2 | |||
176 | my($l,$t); | 177 | my($l,$t); |
177 | 178 | ||
178 | push(@out,"\t$name\t"); | 179 | push(@out,"\t$name\t"); |
180 | if ($name eq "lea") | ||
181 | { | ||
182 | $p1 =~ s/^[^\[]*\[/\[/; | ||
183 | $p2 =~ s/^[^\[]*\[/\[/; | ||
184 | } | ||
179 | $t=&conv($p1).","; | 185 | $t=&conv($p1).","; |
180 | $l=length($t); | 186 | $l=length($t); |
181 | push(@out,$t); | 187 | push(@out,$t); |
diff --git a/src/lib/libcrypto/perlasm/x86unix.pl b/src/lib/libcrypto/perlasm/x86unix.pl index 53ad5f4927..9717d18557 100644 --- a/src/lib/libcrypto/perlasm/x86unix.pl +++ b/src/lib/libcrypto/perlasm/x86unix.pl | |||
@@ -143,12 +143,12 @@ sub main'shl { &out2("sall",@_); } | |||
143 | sub main'shr { &out2("shrl",@_); } | 143 | sub main'shr { &out2("shrl",@_); } |
144 | sub main'xor { &out2("xorl",@_); } | 144 | sub main'xor { &out2("xorl",@_); } |
145 | sub main'xorb { &out2("xorb",@_); } | 145 | sub main'xorb { &out2("xorb",@_); } |
146 | sub main'add { &out2("addl",@_); } | 146 | sub main'add { &out2($_[0]=~/%[a-d][lh]/?"addb":"addl",@_); } |
147 | sub main'adc { &out2("adcl",@_); } | 147 | sub main'adc { &out2("adcl",@_); } |
148 | sub main'sub { &out2("subl",@_); } | 148 | sub main'sub { &out2("subl",@_); } |
149 | sub main'rotl { &out2("roll",@_); } | 149 | sub main'rotl { &out2("roll",@_); } |
150 | sub main'rotr { &out2("rorl",@_); } | 150 | sub main'rotr { &out2("rorl",@_); } |
151 | sub main'exch { &out2("xchg",@_); } | 151 | sub main'exch { &out2($_[0]=~/%[a-d][lh]/?"xchgb":"xchgl",@_); } |
152 | sub main'cmp { &out2("cmpl",@_); } | 152 | sub main'cmp { &out2("cmpl",@_); } |
153 | sub main'lea { &out2("leal",@_); } | 153 | sub main'lea { &out2("leal",@_); } |
154 | sub main'mul { &out1("mull",@_); } | 154 | sub main'mul { &out1("mull",@_); } |
@@ -170,7 +170,7 @@ sub main'jc { &out1("jc",@_); } | |||
170 | sub main'jnc { &out1("jnc",@_); } | 170 | sub main'jnc { &out1("jnc",@_); } |
171 | sub main'jno { &out1("jno",@_); } | 171 | sub main'jno { &out1("jno",@_); } |
172 | sub main'dec { &out1("decl",@_); } | 172 | sub main'dec { &out1("decl",@_); } |
173 | sub main'inc { &out1("incl",@_); } | 173 | sub main'inc { &out1($_[0]=~/%[a-d][hl]/?"incb":"incl",@_); } |
174 | sub main'push { &out1("pushl",@_); $stack+=4; } | 174 | sub main'push { &out1("pushl",@_); $stack+=4; } |
175 | sub main'pop { &out1("popl",@_); $stack-=4; } | 175 | sub main'pop { &out1("popl",@_); $stack-=4; } |
176 | sub main'pushf { &out0("pushf"); $stack+=4; } | 176 | sub main'pushf { &out0("pushf"); $stack+=4; } |
@@ -179,6 +179,7 @@ sub main'not { &out1("notl",@_); } | |||
179 | sub main'call { &out1("call",($_[0]=~/^\.L/?'':$under).$_[0]); } | 179 | sub main'call { &out1("call",($_[0]=~/^\.L/?'':$under).$_[0]); } |
180 | sub main'ret { &out0("ret"); } | 180 | sub main'ret { &out0("ret"); } |
181 | sub main'nop { &out0("nop"); } | 181 | sub main'nop { &out0("nop"); } |
182 | sub main'movz { &out2("movzbl",@_); } | ||
182 | 183 | ||
183 | # The bswapl instruction is new for the 486. Emulate if i386. | 184 | # The bswapl instruction is new for the 486. Emulate if i386. |
184 | sub main'bswap | 185 | sub main'bswap |
diff --git a/src/lib/libcrypto/pkcs12/p12_crpt.c b/src/lib/libcrypto/pkcs12/p12_crpt.c index 5e8958612b..003ec7a33e 100644 --- a/src/lib/libcrypto/pkcs12/p12_crpt.c +++ b/src/lib/libcrypto/pkcs12/p12_crpt.c | |||
@@ -88,7 +88,7 @@ int PKCS12_PBE_keyivgen (EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
88 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de) | 88 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de) |
89 | { | 89 | { |
90 | PBEPARAM *pbe; | 90 | PBEPARAM *pbe; |
91 | int saltlen, iter; | 91 | int saltlen, iter, ret; |
92 | unsigned char *salt, *pbuf; | 92 | unsigned char *salt, *pbuf; |
93 | unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH]; | 93 | unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH]; |
94 | 94 | ||
@@ -117,8 +117,8 @@ int PKCS12_PBE_keyivgen (EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | PBEPARAM_free(pbe); | 119 | PBEPARAM_free(pbe); |
120 | EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, en_de); | 120 | ret = EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, en_de); |
121 | OPENSSL_cleanse(key, EVP_MAX_KEY_LENGTH); | 121 | OPENSSL_cleanse(key, EVP_MAX_KEY_LENGTH); |
122 | OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH); | 122 | OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH); |
123 | return 1; | 123 | return ret; |
124 | } | 124 | } |
diff --git a/src/lib/libcrypto/pkcs12/p12_init.c b/src/lib/libcrypto/pkcs12/p12_init.c index eb837a78cf..5276b12669 100644 --- a/src/lib/libcrypto/pkcs12/p12_init.c +++ b/src/lib/libcrypto/pkcs12/p12_init.c | |||
@@ -76,15 +76,17 @@ PKCS12 *PKCS12_init (int mode) | |||
76 | if (!(pkcs12->authsafes->d.data = | 76 | if (!(pkcs12->authsafes->d.data = |
77 | M_ASN1_OCTET_STRING_new())) { | 77 | M_ASN1_OCTET_STRING_new())) { |
78 | PKCS12err(PKCS12_F_PKCS12_INIT,ERR_R_MALLOC_FAILURE); | 78 | PKCS12err(PKCS12_F_PKCS12_INIT,ERR_R_MALLOC_FAILURE); |
79 | return NULL; | 79 | goto err; |
80 | } | 80 | } |
81 | break; | 81 | break; |
82 | default: | 82 | default: |
83 | PKCS12err(PKCS12_F_PKCS12_INIT,PKCS12_R_UNSUPPORTED_PKCS12_MODE); | 83 | PKCS12err(PKCS12_F_PKCS12_INIT, |
84 | PKCS12_free(pkcs12); | 84 | PKCS12_R_UNSUPPORTED_PKCS12_MODE); |
85 | return NULL; | 85 | goto err; |
86 | break; | ||
87 | } | 86 | } |
88 | 87 | ||
89 | return pkcs12; | 88 | return pkcs12; |
89 | err: | ||
90 | if (pkcs12 != NULL) PKCS12_free(pkcs12); | ||
91 | return NULL; | ||
90 | } | 92 | } |
diff --git a/src/lib/libcrypto/pkcs12/p12_kiss.c b/src/lib/libcrypto/pkcs12/p12_kiss.c index 885087ad00..2b31999e11 100644 --- a/src/lib/libcrypto/pkcs12/p12_kiss.c +++ b/src/lib/libcrypto/pkcs12/p12_kiss.c | |||
@@ -249,14 +249,26 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, | |||
249 | if (M_PKCS12_cert_bag_type(bag) != NID_x509Certificate ) | 249 | if (M_PKCS12_cert_bag_type(bag) != NID_x509Certificate ) |
250 | return 1; | 250 | return 1; |
251 | if (!(x509 = PKCS12_certbag2x509(bag))) return 0; | 251 | if (!(x509 = PKCS12_certbag2x509(bag))) return 0; |
252 | if(ckid) X509_keyid_set1(x509, ckid->data, ckid->length); | 252 | if(ckid) |
253 | { | ||
254 | if (!X509_keyid_set1(x509, ckid->data, ckid->length)) | ||
255 | { | ||
256 | X509_free(x509); | ||
257 | return 0; | ||
258 | } | ||
259 | } | ||
253 | if(fname) { | 260 | if(fname) { |
254 | int len; | 261 | int len, r; |
255 | unsigned char *data; | 262 | unsigned char *data; |
256 | len = ASN1_STRING_to_UTF8(&data, fname); | 263 | len = ASN1_STRING_to_UTF8(&data, fname); |
257 | if(len > 0) { | 264 | if(len > 0) { |
258 | X509_alias_set1(x509, data, len); | 265 | r = X509_alias_set1(x509, data, len); |
259 | OPENSSL_free(data); | 266 | OPENSSL_free(data); |
267 | if (!r) | ||
268 | { | ||
269 | X509_free(x509); | ||
270 | return 0; | ||
271 | } | ||
260 | } | 272 | } |
261 | } | 273 | } |
262 | 274 | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c index 0fb67f74b8..4886b9b289 100644 --- a/src/lib/libcrypto/pkcs12/p12_mutl.c +++ b/src/lib/libcrypto/pkcs12/p12_mutl.c | |||
@@ -148,7 +148,10 @@ int PKCS12_setup_mac (PKCS12 *p12, int iter, unsigned char *salt, int saltlen, | |||
148 | PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); | 148 | PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); |
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
151 | ASN1_INTEGER_set(p12->mac->iter, iter); | 151 | if (!ASN1_INTEGER_set(p12->mac->iter, iter)) { |
152 | PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); | ||
153 | return 0; | ||
154 | } | ||
152 | } | 155 | } |
153 | if (!saltlen) saltlen = PKCS12_SALT_LEN; | 156 | if (!saltlen) saltlen = PKCS12_SALT_LEN; |
154 | p12->mac->salt->length = saltlen; | 157 | p12->mac->salt->length = saltlen; |
diff --git a/src/lib/libcrypto/pkcs7/pk7_attr.c b/src/lib/libcrypto/pkcs7/pk7_attr.c index 5ff5a88b5c..039141027a 100644 --- a/src/lib/libcrypto/pkcs7/pk7_attr.c +++ b/src/lib/libcrypto/pkcs7/pk7_attr.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 2001. | 3 | * project 2001. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2001-2004 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -94,17 +94,18 @@ int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap) | |||
94 | } | 94 | } |
95 | 95 | ||
96 | STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si) | 96 | STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si) |
97 | { | 97 | { |
98 | ASN1_TYPE *cap; | 98 | ASN1_TYPE *cap; |
99 | unsigned char *p; | 99 | unsigned char *p; |
100 | cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities); | 100 | cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities); |
101 | if (!cap) return NULL; | 101 | if (!cap || (cap->type != V_ASN1_SEQUENCE)) |
102 | return NULL; | ||
102 | p = cap->value.sequence->data; | 103 | p = cap->value.sequence->data; |
103 | return d2i_ASN1_SET_OF_X509_ALGOR(NULL, &p, | 104 | return d2i_ASN1_SET_OF_X509_ALGOR(NULL, &p, |
104 | cap->value.sequence->length, | 105 | cap->value.sequence->length, |
105 | d2i_X509_ALGOR, X509_ALGOR_free, | 106 | d2i_X509_ALGOR, X509_ALGOR_free, |
106 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); | 107 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); |
107 | } | 108 | } |
108 | 109 | ||
109 | /* Basic smime-capabilities OID and optional integer arg */ | 110 | /* Basic smime-capabilities OID and optional integer arg */ |
110 | int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) | 111 | int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) |
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index b78e22819c..4ac29ae14d 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
@@ -239,7 +239,13 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | |||
239 | OPENSSL_free(tmp); | 239 | OPENSSL_free(tmp); |
240 | goto err; | 240 | goto err; |
241 | } | 241 | } |
242 | M_ASN1_OCTET_STRING_set(ri->enc_key,tmp,jj); | 242 | if (!M_ASN1_OCTET_STRING_set(ri->enc_key,tmp,jj)) |
243 | { | ||
244 | PKCS7err(PKCS7_F_PKCS7_DATAINIT, | ||
245 | ERR_R_MALLOC_FAILURE); | ||
246 | OPENSSL_free(tmp); | ||
247 | goto err; | ||
248 | } | ||
243 | } | 249 | } |
244 | OPENSSL_free(tmp); | 250 | OPENSSL_free(tmp); |
245 | OPENSSL_cleanse(key, keylen); | 251 | OPENSSL_cleanse(key, keylen); |
@@ -520,12 +526,20 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
520 | case NID_pkcs7_signedAndEnveloped: | 526 | case NID_pkcs7_signedAndEnveloped: |
521 | /* XXXXXXXXXXXXXXXX */ | 527 | /* XXXXXXXXXXXXXXXX */ |
522 | si_sk=p7->d.signed_and_enveloped->signer_info; | 528 | si_sk=p7->d.signed_and_enveloped->signer_info; |
523 | os=M_ASN1_OCTET_STRING_new(); | 529 | if (!(os=M_ASN1_OCTET_STRING_new())) |
530 | { | ||
531 | PKCS7err(PKCS7_F_PKCS7_DATASIGN,ERR_R_MALLOC_FAILURE); | ||
532 | goto err; | ||
533 | } | ||
524 | p7->d.signed_and_enveloped->enc_data->enc_data=os; | 534 | p7->d.signed_and_enveloped->enc_data->enc_data=os; |
525 | break; | 535 | break; |
526 | case NID_pkcs7_enveloped: | 536 | case NID_pkcs7_enveloped: |
527 | /* XXXXXXXXXXXXXXXX */ | 537 | /* XXXXXXXXXXXXXXXX */ |
528 | os=M_ASN1_OCTET_STRING_new(); | 538 | if (!(os=M_ASN1_OCTET_STRING_new())) |
539 | { | ||
540 | PKCS7err(PKCS7_F_PKCS7_DATASIGN,ERR_R_MALLOC_FAILURE); | ||
541 | goto err; | ||
542 | } | ||
529 | p7->d.enveloped->enc_data->enc_data=os; | 543 | p7->d.enveloped->enc_data->enc_data=os; |
530 | break; | 544 | break; |
531 | case NID_pkcs7_signed: | 545 | case NID_pkcs7_signed: |
@@ -599,7 +613,12 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
599 | if (!PKCS7_get_signed_attribute(si, | 613 | if (!PKCS7_get_signed_attribute(si, |
600 | NID_pkcs9_signingTime)) | 614 | NID_pkcs9_signingTime)) |
601 | { | 615 | { |
602 | sign_time=X509_gmtime_adj(NULL,0); | 616 | if (!(sign_time=X509_gmtime_adj(NULL,0))) |
617 | { | ||
618 | PKCS7err(PKCS7_F_PKCS7_DATASIGN, | ||
619 | ERR_R_MALLOC_FAILURE); | ||
620 | goto err; | ||
621 | } | ||
603 | PKCS7_add_signed_attribute(si, | 622 | PKCS7_add_signed_attribute(si, |
604 | NID_pkcs9_signingTime, | 623 | NID_pkcs9_signingTime, |
605 | V_ASN1_UTCTIME,sign_time); | 624 | V_ASN1_UTCTIME,sign_time); |
@@ -608,8 +627,19 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
608 | /* Add digest */ | 627 | /* Add digest */ |
609 | md_tmp=EVP_MD_CTX_md(&ctx_tmp); | 628 | md_tmp=EVP_MD_CTX_md(&ctx_tmp); |
610 | EVP_DigestFinal_ex(&ctx_tmp,md_data,&md_len); | 629 | EVP_DigestFinal_ex(&ctx_tmp,md_data,&md_len); |
611 | digest=M_ASN1_OCTET_STRING_new(); | 630 | if (!(digest=M_ASN1_OCTET_STRING_new())) |
612 | M_ASN1_OCTET_STRING_set(digest,md_data,md_len); | 631 | { |
632 | PKCS7err(PKCS7_F_PKCS7_DATASIGN, | ||
633 | ERR_R_MALLOC_FAILURE); | ||
634 | goto err; | ||
635 | } | ||
636 | if (!M_ASN1_OCTET_STRING_set(digest,md_data, | ||
637 | md_len)) | ||
638 | { | ||
639 | PKCS7err(PKCS7_F_PKCS7_DATASIGN, | ||
640 | ERR_R_MALLOC_FAILURE); | ||
641 | goto err; | ||
642 | } | ||
613 | PKCS7_add_signed_attribute(si, | 643 | PKCS7_add_signed_attribute(si, |
614 | NID_pkcs9_messageDigest, | 644 | NID_pkcs9_messageDigest, |
615 | V_ASN1_OCTET_STRING,digest); | 645 | V_ASN1_OCTET_STRING,digest); |
diff --git a/src/lib/libcrypto/pkcs7/pk7_lib.c b/src/lib/libcrypto/pkcs7/pk7_lib.c index 985b07245c..ee1817c7af 100644 --- a/src/lib/libcrypto/pkcs7/pk7_lib.c +++ b/src/lib/libcrypto/pkcs7/pk7_lib.c | |||
@@ -164,7 +164,12 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
164 | p7->type=obj; | 164 | p7->type=obj; |
165 | if ((p7->d.sign=PKCS7_SIGNED_new()) == NULL) | 165 | if ((p7->d.sign=PKCS7_SIGNED_new()) == NULL) |
166 | goto err; | 166 | goto err; |
167 | ASN1_INTEGER_set(p7->d.sign->version,1); | 167 | if (!ASN1_INTEGER_set(p7->d.sign->version,1)) |
168 | { | ||
169 | PKCS7_SIGNED_free(p7->d.sign); | ||
170 | p7->d.sign=NULL; | ||
171 | goto err; | ||
172 | } | ||
168 | break; | 173 | break; |
169 | case NID_pkcs7_data: | 174 | case NID_pkcs7_data: |
170 | p7->type=obj; | 175 | p7->type=obj; |
@@ -176,6 +181,8 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
176 | if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new()) | 181 | if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new()) |
177 | == NULL) goto err; | 182 | == NULL) goto err; |
178 | ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1); | 183 | ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1); |
184 | if (!ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1)) | ||
185 | goto err; | ||
179 | p7->d.signed_and_enveloped->enc_data->content_type | 186 | p7->d.signed_and_enveloped->enc_data->content_type |
180 | = OBJ_nid2obj(NID_pkcs7_data); | 187 | = OBJ_nid2obj(NID_pkcs7_data); |
181 | break; | 188 | break; |
@@ -183,7 +190,8 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
183 | p7->type=obj; | 190 | p7->type=obj; |
184 | if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) | 191 | if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) |
185 | == NULL) goto err; | 192 | == NULL) goto err; |
186 | ASN1_INTEGER_set(p7->d.enveloped->version,0); | 193 | if (!ASN1_INTEGER_set(p7->d.enveloped->version,0)) |
194 | goto err; | ||
187 | p7->d.enveloped->enc_data->content_type | 195 | p7->d.enveloped->enc_data->content_type |
188 | = OBJ_nid2obj(NID_pkcs7_data); | 196 | = OBJ_nid2obj(NID_pkcs7_data); |
189 | break; | 197 | break; |
@@ -191,7 +199,8 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
191 | p7->type=obj; | 199 | p7->type=obj; |
192 | if ((p7->d.encrypted=PKCS7_ENCRYPT_new()) | 200 | if ((p7->d.encrypted=PKCS7_ENCRYPT_new()) |
193 | == NULL) goto err; | 201 | == NULL) goto err; |
194 | ASN1_INTEGER_set(p7->d.encrypted->version,0); | 202 | if (!ASN1_INTEGER_set(p7->d.encrypted->version,0)) |
203 | goto err; | ||
195 | p7->d.encrypted->enc_data->content_type | 204 | p7->d.encrypted->enc_data->content_type |
196 | = OBJ_nid2obj(NID_pkcs7_data); | 205 | = OBJ_nid2obj(NID_pkcs7_data); |
197 | break; | 206 | break; |
@@ -318,15 +327,18 @@ int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, | |||
318 | if (pkey->type == EVP_PKEY_DSA) is_dsa = 1; | 327 | if (pkey->type == EVP_PKEY_DSA) is_dsa = 1; |
319 | else is_dsa = 0; | 328 | else is_dsa = 0; |
320 | /* We now need to add another PKCS7_SIGNER_INFO entry */ | 329 | /* We now need to add another PKCS7_SIGNER_INFO entry */ |
321 | ASN1_INTEGER_set(p7i->version,1); | 330 | if (!ASN1_INTEGER_set(p7i->version,1)) |
322 | X509_NAME_set(&p7i->issuer_and_serial->issuer, | 331 | goto err; |
323 | X509_get_issuer_name(x509)); | 332 | if (!X509_NAME_set(&p7i->issuer_and_serial->issuer, |
333 | X509_get_issuer_name(x509))) | ||
334 | goto err; | ||
324 | 335 | ||
325 | /* because ASN1_INTEGER_set is used to set a 'long' we will do | 336 | /* because ASN1_INTEGER_set is used to set a 'long' we will do |
326 | * things the ugly way. */ | 337 | * things the ugly way. */ |
327 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); | 338 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); |
328 | p7i->issuer_and_serial->serial= | 339 | if (!(p7i->issuer_and_serial->serial= |
329 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)); | 340 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)))) |
341 | goto err; | ||
330 | 342 | ||
331 | /* lets keep the pkey around for a while */ | 343 | /* lets keep the pkey around for a while */ |
332 | CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); | 344 | CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); |
@@ -423,16 +435,20 @@ int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri) | |||
423 | 435 | ||
424 | int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) | 436 | int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) |
425 | { | 437 | { |
426 | ASN1_INTEGER_set(p7i->version,0); | 438 | if (!ASN1_INTEGER_set(p7i->version,0)) |
427 | X509_NAME_set(&p7i->issuer_and_serial->issuer, | 439 | return 0; |
428 | X509_get_issuer_name(x509)); | 440 | if (!X509_NAME_set(&p7i->issuer_and_serial->issuer, |
441 | X509_get_issuer_name(x509))) | ||
442 | return 0; | ||
429 | 443 | ||
430 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); | 444 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); |
431 | p7i->issuer_and_serial->serial= | 445 | if (!(p7i->issuer_and_serial->serial= |
432 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)); | 446 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)))) |
447 | return 0; | ||
433 | 448 | ||
434 | X509_ALGOR_free(p7i->key_enc_algor); | 449 | X509_ALGOR_free(p7i->key_enc_algor); |
435 | p7i->key_enc_algor= X509_ALGOR_dup(x509->cert_info->key->algor); | 450 | if (!(p7i->key_enc_algor= X509_ALGOR_dup(x509->cert_info->key->algor))) |
451 | return 0; | ||
436 | 452 | ||
437 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); | 453 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); |
438 | p7i->cert=x509; | 454 | p7i->cert=x509; |
diff --git a/src/lib/libcrypto/pkcs7/pk7_smime.c b/src/lib/libcrypto/pkcs7/pk7_smime.c index 6e5735de11..a852b49235 100644 --- a/src/lib/libcrypto/pkcs7/pk7_smime.c +++ b/src/lib/libcrypto/pkcs7/pk7_smime.c | |||
@@ -155,7 +155,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | |||
155 | char buf[4096]; | 155 | char buf[4096]; |
156 | int i, j=0, k, ret = 0; | 156 | int i, j=0, k, ret = 0; |
157 | BIO *p7bio; | 157 | BIO *p7bio; |
158 | BIO *tmpout; | 158 | BIO *tmpin, *tmpout; |
159 | 159 | ||
160 | if(!p7) { | 160 | if(!p7) { |
161 | PKCS7err(PKCS7_F_PKCS7_VERIFY,PKCS7_R_INVALID_NULL_POINTER); | 161 | PKCS7err(PKCS7_F_PKCS7_VERIFY,PKCS7_R_INVALID_NULL_POINTER); |
@@ -228,7 +228,30 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | |||
228 | /* Check for revocation status here */ | 228 | /* Check for revocation status here */ |
229 | } | 229 | } |
230 | 230 | ||
231 | p7bio=PKCS7_dataInit(p7,indata); | 231 | /* Performance optimization: if the content is a memory BIO then |
232 | * store its contents in a temporary read only memory BIO. This | ||
233 | * avoids potentially large numbers of slow copies of data which will | ||
234 | * occur when reading from a read write memory BIO when signatures | ||
235 | * are calculated. | ||
236 | */ | ||
237 | |||
238 | if (indata && (BIO_method_type(indata) == BIO_TYPE_MEM)) | ||
239 | { | ||
240 | char *ptr; | ||
241 | long len; | ||
242 | len = BIO_get_mem_data(indata, &ptr); | ||
243 | tmpin = BIO_new_mem_buf(ptr, len); | ||
244 | if (tmpin == NULL) | ||
245 | { | ||
246 | PKCS7err(PKCS7_F_PKCS7_VERIFY,ERR_R_MALLOC_FAILURE); | ||
247 | return 0; | ||
248 | } | ||
249 | } | ||
250 | else | ||
251 | tmpin = indata; | ||
252 | |||
253 | |||
254 | p7bio=PKCS7_dataInit(p7,tmpin); | ||
232 | 255 | ||
233 | if(flags & PKCS7_TEXT) { | 256 | if(flags & PKCS7_TEXT) { |
234 | if(!(tmpout = BIO_new(BIO_s_mem()))) { | 257 | if(!(tmpout = BIO_new(BIO_s_mem()))) { |
@@ -270,9 +293,15 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | |||
270 | ret = 1; | 293 | ret = 1; |
271 | 294 | ||
272 | err: | 295 | err: |
296 | |||
297 | if (tmpin == indata) | ||
298 | { | ||
299 | if(indata) BIO_pop(p7bio); | ||
300 | BIO_free_all(p7bio); | ||
301 | } | ||
302 | else | ||
303 | BIO_free_all(tmpin); | ||
273 | 304 | ||
274 | if(indata) BIO_pop(p7bio); | ||
275 | BIO_free_all(p7bio); | ||
276 | sk_X509_free(signers); | 305 | sk_X509_free(signers); |
277 | 306 | ||
278 | return ret; | 307 | return ret; |
@@ -296,10 +325,6 @@ STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) | |||
296 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_WRONG_CONTENT_TYPE); | 325 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_WRONG_CONTENT_TYPE); |
297 | return NULL; | 326 | return NULL; |
298 | } | 327 | } |
299 | if(!(signers = sk_X509_new_null())) { | ||
300 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,ERR_R_MALLOC_FAILURE); | ||
301 | return NULL; | ||
302 | } | ||
303 | 328 | ||
304 | /* Collect all the signers together */ | 329 | /* Collect all the signers together */ |
305 | 330 | ||
@@ -310,6 +335,11 @@ STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) | |||
310 | return 0; | 335 | return 0; |
311 | } | 336 | } |
312 | 337 | ||
338 | if(!(signers = sk_X509_new_null())) { | ||
339 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,ERR_R_MALLOC_FAILURE); | ||
340 | return NULL; | ||
341 | } | ||
342 | |||
313 | for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++) | 343 | for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++) |
314 | { | 344 | { |
315 | si = sk_PKCS7_SIGNER_INFO_value(sinfos, i); | 345 | si = sk_PKCS7_SIGNER_INFO_value(sinfos, i); |
diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c index eeffc0df4c..c84968df88 100644 --- a/src/lib/libcrypto/rand/md_rand.c +++ b/src/lib/libcrypto/rand/md_rand.c | |||
@@ -126,6 +126,7 @@ | |||
126 | 126 | ||
127 | #include <openssl/crypto.h> | 127 | #include <openssl/crypto.h> |
128 | #include <openssl/err.h> | 128 | #include <openssl/err.h> |
129 | #include <openssl/fips.h> | ||
129 | 130 | ||
130 | #ifdef BN_DEBUG | 131 | #ifdef BN_DEBUG |
131 | # define PREDICT | 132 | # define PREDICT |
@@ -332,6 +333,14 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) | |||
332 | #endif | 333 | #endif |
333 | int do_stir_pool = 0; | 334 | int do_stir_pool = 0; |
334 | 335 | ||
336 | #ifdef OPENSSL_FIPS | ||
337 | if(FIPS_mode()) | ||
338 | { | ||
339 | FIPSerr(FIPS_F_SSLEAY_RAND_BYTES,FIPS_R_NON_FIPS_METHOD); | ||
340 | return 0; | ||
341 | } | ||
342 | #endif | ||
343 | |||
335 | #ifdef PREDICT | 344 | #ifdef PREDICT |
336 | if (rand_predictable) | 345 | if (rand_predictable) |
337 | { | 346 | { |
diff --git a/src/lib/libcrypto/rand/rand.h b/src/lib/libcrypto/rand/rand.h index 606382dd21..604df9be6c 100644 --- a/src/lib/libcrypto/rand/rand.h +++ b/src/lib/libcrypto/rand/rand.h | |||
@@ -71,6 +71,10 @@ | |||
71 | extern "C" { | 71 | extern "C" { |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | #if defined(OPENSSL_FIPS) | ||
75 | #define FIPS_RAND_SIZE_T int | ||
76 | #endif | ||
77 | |||
74 | typedef struct rand_meth_st | 78 | typedef struct rand_meth_st |
75 | { | 79 | { |
76 | void (*seed)(const void *buf, int num); | 80 | void (*seed)(const void *buf, int num); |
@@ -121,11 +125,17 @@ void ERR_load_RAND_strings(void); | |||
121 | /* Error codes for the RAND functions. */ | 125 | /* Error codes for the RAND functions. */ |
122 | 126 | ||
123 | /* Function codes. */ | 127 | /* Function codes. */ |
128 | #define RAND_F_FIPS_RAND_BYTES 102 | ||
124 | #define RAND_F_RAND_GET_RAND_METHOD 101 | 129 | #define RAND_F_RAND_GET_RAND_METHOD 101 |
125 | #define RAND_F_SSLEAY_RAND_BYTES 100 | 130 | #define RAND_F_SSLEAY_RAND_BYTES 100 |
126 | 131 | ||
127 | /* Reason codes. */ | 132 | /* Reason codes. */ |
133 | #define RAND_R_NON_FIPS_METHOD 101 | ||
134 | #define RAND_R_PRNG_ASKING_FOR_TOO_MUCH 105 | ||
135 | #define RAND_R_PRNG_NOT_REKEYED 103 | ||
136 | #define RAND_R_PRNG_NOT_RESEEDED 104 | ||
128 | #define RAND_R_PRNG_NOT_SEEDED 100 | 137 | #define RAND_R_PRNG_NOT_SEEDED 100 |
138 | #define RAND_R_PRNG_STUCK 102 | ||
129 | 139 | ||
130 | #ifdef __cplusplus | 140 | #ifdef __cplusplus |
131 | } | 141 | } |
diff --git a/src/lib/libcrypto/rand/rand_egd.c b/src/lib/libcrypto/rand/rand_egd.c index 6f742900a0..cd666abfcb 100644 --- a/src/lib/libcrypto/rand/rand_egd.c +++ b/src/lib/libcrypto/rand/rand_egd.c | |||
@@ -95,7 +95,7 @@ | |||
95 | * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. | 95 | * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. |
96 | */ | 96 | */ |
97 | 97 | ||
98 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) | 98 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_VOS) |
99 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | 99 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) |
100 | { | 100 | { |
101 | return(-1); | 101 | return(-1); |
@@ -216,7 +216,9 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | |||
216 | while (numbytes != 1) | 216 | while (numbytes != 1) |
217 | { | 217 | { |
218 | num = read(fd, egdbuf, 1); | 218 | num = read(fd, egdbuf, 1); |
219 | if (num >= 0) | 219 | if (num == 0) |
220 | goto err; /* descriptor closed */ | ||
221 | else if (num > 0) | ||
220 | numbytes += num; | 222 | numbytes += num; |
221 | else | 223 | else |
222 | { | 224 | { |
@@ -246,7 +248,9 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | |||
246 | while (numbytes != egdbuf[0]) | 248 | while (numbytes != egdbuf[0]) |
247 | { | 249 | { |
248 | num = read(fd, retrievebuf + numbytes, egdbuf[0] - numbytes); | 250 | num = read(fd, retrievebuf + numbytes, egdbuf[0] - numbytes); |
249 | if (num >= 0) | 251 | if (num == 0) |
252 | goto err; /* descriptor closed */ | ||
253 | else if (num > 0) | ||
250 | numbytes += num; | 254 | numbytes += num; |
251 | else | 255 | else |
252 | { | 256 | { |
diff --git a/src/lib/libcrypto/rand/rand_err.c b/src/lib/libcrypto/rand/rand_err.c index b77267e213..95574659ac 100644 --- a/src/lib/libcrypto/rand/rand_err.c +++ b/src/lib/libcrypto/rand/rand_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/rand/rand_err.c */ | 1 | /* crypto/rand/rand_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2003 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 |
@@ -66,6 +66,7 @@ | |||
66 | #ifndef OPENSSL_NO_ERR | 66 | #ifndef OPENSSL_NO_ERR |
67 | static ERR_STRING_DATA RAND_str_functs[]= | 67 | static ERR_STRING_DATA RAND_str_functs[]= |
68 | { | 68 | { |
69 | {ERR_PACK(0,RAND_F_FIPS_RAND_BYTES,0), "FIPS_RAND_BYTES"}, | ||
69 | {ERR_PACK(0,RAND_F_RAND_GET_RAND_METHOD,0), "RAND_get_rand_method"}, | 70 | {ERR_PACK(0,RAND_F_RAND_GET_RAND_METHOD,0), "RAND_get_rand_method"}, |
70 | {ERR_PACK(0,RAND_F_SSLEAY_RAND_BYTES,0), "SSLEAY_RAND_BYTES"}, | 71 | {ERR_PACK(0,RAND_F_SSLEAY_RAND_BYTES,0), "SSLEAY_RAND_BYTES"}, |
71 | {0,NULL} | 72 | {0,NULL} |
@@ -73,7 +74,12 @@ static ERR_STRING_DATA RAND_str_functs[]= | |||
73 | 74 | ||
74 | static ERR_STRING_DATA RAND_str_reasons[]= | 75 | static ERR_STRING_DATA RAND_str_reasons[]= |
75 | { | 76 | { |
77 | {RAND_R_NON_FIPS_METHOD ,"non fips method"}, | ||
78 | {RAND_R_PRNG_ASKING_FOR_TOO_MUCH ,"prng asking for too much"}, | ||
79 | {RAND_R_PRNG_NOT_REKEYED ,"prng not rekeyed"}, | ||
80 | {RAND_R_PRNG_NOT_RESEEDED ,"prng not reseeded"}, | ||
76 | {RAND_R_PRNG_NOT_SEEDED ,"PRNG not seeded"}, | 81 | {RAND_R_PRNG_NOT_SEEDED ,"PRNG not seeded"}, |
82 | {RAND_R_PRNG_STUCK ,"prng stuck"}, | ||
77 | {0,NULL} | 83 | {0,NULL} |
78 | }; | 84 | }; |
79 | 85 | ||
diff --git a/src/lib/libcrypto/rand/rand_lib.c b/src/lib/libcrypto/rand/rand_lib.c index 513e338985..88f1b56d91 100644 --- a/src/lib/libcrypto/rand/rand_lib.c +++ b/src/lib/libcrypto/rand/rand_lib.c | |||
@@ -63,6 +63,8 @@ | |||
63 | #ifndef OPENSSL_NO_ENGINE | 63 | #ifndef OPENSSL_NO_ENGINE |
64 | #include <openssl/engine.h> | 64 | #include <openssl/engine.h> |
65 | #endif | 65 | #endif |
66 | #include <openssl/fips.h> | ||
67 | #include <openssl/fips_rand.h> | ||
66 | 68 | ||
67 | #ifndef OPENSSL_NO_ENGINE | 69 | #ifndef OPENSSL_NO_ENGINE |
68 | /* non-NULL if default_RAND_meth is ENGINE-provided */ | 70 | /* non-NULL if default_RAND_meth is ENGINE-provided */ |
@@ -85,6 +87,16 @@ int RAND_set_rand_method(const RAND_METHOD *meth) | |||
85 | 87 | ||
86 | const RAND_METHOD *RAND_get_rand_method(void) | 88 | const RAND_METHOD *RAND_get_rand_method(void) |
87 | { | 89 | { |
90 | #ifdef OPENSSL_FIPS | ||
91 | if(FIPS_mode() | ||
92 | && default_RAND_meth != FIPS_rand_check()) | ||
93 | { | ||
94 | RANDerr(RAND_F_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD); | ||
95 | return 0; | ||
96 | } | ||
97 | #endif | ||
98 | |||
99 | |||
88 | if (!default_RAND_meth) | 100 | if (!default_RAND_meth) |
89 | { | 101 | { |
90 | #ifndef OPENSSL_NO_ENGINE | 102 | #ifndef OPENSSL_NO_ENGINE |
diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c index 0599719dd1..9376554fae 100644 --- a/src/lib/libcrypto/rand/rand_unix.c +++ b/src/lib/libcrypto/rand/rand_unix.c | |||
@@ -120,6 +120,7 @@ | |||
120 | #include <sys/types.h> | 120 | #include <sys/types.h> |
121 | #include <sys/time.h> | 121 | #include <sys/time.h> |
122 | #include <sys/times.h> | 122 | #include <sys/times.h> |
123 | #include <sys/stat.h> | ||
123 | #include <fcntl.h> | 124 | #include <fcntl.h> |
124 | #include <unistd.h> | 125 | #include <unistd.h> |
125 | #include <time.h> | 126 | #include <time.h> |
@@ -151,9 +152,9 @@ int RAND_poll(void) | |||
151 | int n = 0; | 152 | int n = 0; |
152 | #endif | 153 | #endif |
153 | #ifdef DEVRANDOM | 154 | #ifdef DEVRANDOM |
154 | static const char *randomfiles[] = { DEVRANDOM, NULL }; | 155 | static const char *randomfiles[] = { DEVRANDOM }; |
155 | const char **randomfile = NULL; | 156 | struct stat randomstats[sizeof(randomfiles)/sizeof(randomfiles[0])]; |
156 | int fd; | 157 | int fd,i; |
157 | #endif | 158 | #endif |
158 | #ifdef DEVRANDOM_EGD | 159 | #ifdef DEVRANDOM_EGD |
159 | static const char *egdsockets[] = { DEVRANDOM_EGD, NULL }; | 160 | static const char *egdsockets[] = { DEVRANDOM_EGD, NULL }; |
@@ -161,26 +162,42 @@ int RAND_poll(void) | |||
161 | #endif | 162 | #endif |
162 | 163 | ||
163 | #ifdef DEVRANDOM | 164 | #ifdef DEVRANDOM |
165 | memset(randomstats,0,sizeof(randomstats)); | ||
164 | /* Use a random entropy pool device. Linux, FreeBSD and OpenBSD | 166 | /* Use a random entropy pool device. Linux, FreeBSD and OpenBSD |
165 | * have this. Use /dev/urandom if you can as /dev/random may block | 167 | * have this. Use /dev/urandom if you can as /dev/random may block |
166 | * if it runs out of random entries. */ | 168 | * if it runs out of random entries. */ |
167 | 169 | ||
168 | for (randomfile = randomfiles; *randomfile && n < ENTROPY_NEEDED; randomfile++) | 170 | for (i=0; i<sizeof(randomfiles)/sizeof(randomfiles[0]) && n < ENTROPY_NEEDED; i++) |
169 | { | 171 | { |
170 | if ((fd = open(*randomfile, O_RDONLY|O_NONBLOCK | 172 | if ((fd = open(randomfiles[i], O_RDONLY |
173 | #ifdef O_NONBLOCK | ||
174 | |O_NONBLOCK | ||
175 | #endif | ||
176 | #ifdef O_BINARY | ||
177 | |O_BINARY | ||
178 | #endif | ||
171 | #ifdef O_NOCTTY /* If it happens to be a TTY (god forbid), do not make it | 179 | #ifdef O_NOCTTY /* If it happens to be a TTY (god forbid), do not make it |
172 | our controlling tty */ | 180 | our controlling tty */ |
173 | |O_NOCTTY | 181 | |O_NOCTTY |
174 | #endif | 182 | #endif |
175 | #ifdef O_NOFOLLOW /* Fail if the file is a symbolic link */ | ||
176 | |O_NOFOLLOW | ||
177 | #endif | ||
178 | )) >= 0) | 183 | )) >= 0) |
179 | { | 184 | { |
180 | struct timeval t = { 0, 10*1000 }; /* Spend 10ms on | 185 | struct timeval t = { 0, 10*1000 }; /* Spend 10ms on |
181 | each file. */ | 186 | each file. */ |
182 | int r; | 187 | int r,j; |
183 | fd_set fset; | 188 | fd_set fset; |
189 | struct stat *st=&randomstats[i]; | ||
190 | |||
191 | /* Avoid using same input... Used to be O_NOFOLLOW | ||
192 | * above, but it's not universally appropriate... */ | ||
193 | if (fstat(fd,st) != 0) { close(fd); continue; } | ||
194 | for (j=0;j<i;j++) | ||
195 | { | ||
196 | if (randomstats[j].st_ino==st->st_ino && | ||
197 | randomstats[j].st_dev==st->st_dev) | ||
198 | break; | ||
199 | } | ||
200 | if (j<i) { close(fd); continue; } | ||
184 | 201 | ||
185 | do | 202 | do |
186 | { | 203 | { |
diff --git a/src/lib/libcrypto/rand/rand_vms.c b/src/lib/libcrypto/rand/rand_vms.c index 29b2d7af0b..1267a3acae 100644 --- a/src/lib/libcrypto/rand/rand_vms.c +++ b/src/lib/libcrypto/rand/rand_vms.c | |||
@@ -101,11 +101,12 @@ int RAND_poll(void) | |||
101 | pitem = item; | 101 | pitem = item; |
102 | 102 | ||
103 | /* Setup */ | 103 | /* Setup */ |
104 | while (pitems_data->length) | 104 | while (pitems_data->length |
105 | && (total_length + pitems_data->length <= 256)) | ||
105 | { | 106 | { |
106 | pitem->length = pitems_data->length; | 107 | pitem->length = pitems_data->length; |
107 | pitem->code = pitems_data->code; | 108 | pitem->code = pitems_data->code; |
108 | pitem->buffer = (long *)data_buffer[total_length]; | 109 | pitem->buffer = (long *)&data_buffer[total_length]; |
109 | pitem->retlen = 0; | 110 | pitem->retlen = 0; |
110 | total_length += pitems_data->length; | 111 | total_length += pitems_data->length; |
111 | pitems_data++; | 112 | pitems_data++; |
diff --git a/src/lib/libcrypto/rand/rand_win.c b/src/lib/libcrypto/rand/rand_win.c index 3584842224..30c69161ef 100644 --- a/src/lib/libcrypto/rand/rand_win.c +++ b/src/lib/libcrypto/rand/rand_win.c | |||
@@ -125,7 +125,7 @@ | |||
125 | * http://developer.intel.com/design/security/rng/redist_license.htm | 125 | * http://developer.intel.com/design/security/rng/redist_license.htm |
126 | */ | 126 | */ |
127 | #define PROV_INTEL_SEC 22 | 127 | #define PROV_INTEL_SEC 22 |
128 | #define INTEL_DEF_PROV TEXT("Intel Hardware Cryptographic Service Provider") | 128 | #define INTEL_DEF_PROV L"Intel Hardware Cryptographic Service Provider" |
129 | 129 | ||
130 | static void readtimer(void); | 130 | static void readtimer(void); |
131 | static void readscreen(void); | 131 | static void readscreen(void); |
@@ -152,7 +152,7 @@ typedef struct tagCURSORINFO | |||
152 | #define CURSOR_SHOWING 0x00000001 | 152 | #define CURSOR_SHOWING 0x00000001 |
153 | #endif /* CURSOR_SHOWING */ | 153 | #endif /* CURSOR_SHOWING */ |
154 | 154 | ||
155 | typedef BOOL (WINAPI *CRYPTACQUIRECONTEXT)(HCRYPTPROV *, LPCTSTR, LPCTSTR, | 155 | typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTW)(HCRYPTPROV *, LPCWSTR, LPCWSTR, |
156 | DWORD, DWORD); | 156 | DWORD, DWORD); |
157 | typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *); | 157 | typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *); |
158 | typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV, DWORD); | 158 | typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV, DWORD); |
@@ -194,7 +194,7 @@ int RAND_poll(void) | |||
194 | HWND h; | 194 | HWND h; |
195 | 195 | ||
196 | HMODULE advapi, kernel, user, netapi; | 196 | HMODULE advapi, kernel, user, netapi; |
197 | CRYPTACQUIRECONTEXT acquire = 0; | 197 | CRYPTACQUIRECONTEXTW acquire = 0; |
198 | CRYPTGENRANDOM gen = 0; | 198 | CRYPTGENRANDOM gen = 0; |
199 | CRYPTRELEASECONTEXT release = 0; | 199 | CRYPTRELEASECONTEXT release = 0; |
200 | #if 1 /* There was previously a problem with NETSTATGET. Currently, this | 200 | #if 1 /* There was previously a problem with NETSTATGET. Currently, this |
@@ -213,6 +213,9 @@ int RAND_poll(void) | |||
213 | GetVersionEx( &osverinfo ) ; | 213 | GetVersionEx( &osverinfo ) ; |
214 | 214 | ||
215 | #if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO | 215 | #if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO |
216 | #ifndef CryptAcquireContext | ||
217 | #define CryptAcquireContext CryptAcquireContextW | ||
218 | #endif | ||
216 | /* poll the CryptoAPI PRNG */ | 219 | /* poll the CryptoAPI PRNG */ |
217 | /* The CryptoAPI returns sizeof(buf) bytes of randomness */ | 220 | /* The CryptoAPI returns sizeof(buf) bytes of randomness */ |
218 | if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) | 221 | if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) |
@@ -223,21 +226,35 @@ int RAND_poll(void) | |||
223 | } | 226 | } |
224 | #endif | 227 | #endif |
225 | 228 | ||
229 | #ifndef OPENSSL_SYS_WINCE | ||
230 | /* | ||
231 | * None of below libraries are present on Windows CE, which is | ||
232 | * why we #ifndef the whole section. This also excuses us from | ||
233 | * handling the GetProcAddress issue. The trouble is that in | ||
234 | * real Win32 API GetProcAddress is available in ANSI flavor | ||
235 | * only. In WinCE on the other hand GetProcAddress is a macro | ||
236 | * most commonly defined as GetProcAddressW, which accepts | ||
237 | * Unicode argument. If we were to call GetProcAddress under | ||
238 | * WinCE, I'd recommend to either redefine GetProcAddress as | ||
239 | * GetProcAddressA (there seem to be one in common CE spec) or | ||
240 | * implement own shim routine, which would accept ANSI argument | ||
241 | * and expand it to Unicode. | ||
242 | */ | ||
243 | |||
226 | /* load functions dynamically - not available on all systems */ | 244 | /* load functions dynamically - not available on all systems */ |
227 | advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); | 245 | advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); |
228 | kernel = LoadLibrary(TEXT("KERNEL32.DLL")); | 246 | kernel = LoadLibrary(TEXT("KERNEL32.DLL")); |
229 | user = LoadLibrary(TEXT("USER32.DLL")); | 247 | user = LoadLibrary(TEXT("USER32.DLL")); |
230 | netapi = LoadLibrary(TEXT("NETAPI32.DLL")); | 248 | netapi = LoadLibrary(TEXT("NETAPI32.DLL")); |
231 | 249 | ||
232 | #ifndef OPENSSL_SYS_WINCE | ||
233 | #if 1 /* There was previously a problem with NETSTATGET. Currently, this | 250 | #if 1 /* There was previously a problem with NETSTATGET. Currently, this |
234 | * section is still experimental, but if all goes well, this conditional | 251 | * section is still experimental, but if all goes well, this conditional |
235 | * will be removed | 252 | * will be removed |
236 | */ | 253 | */ |
237 | if (netapi) | 254 | if (netapi) |
238 | { | 255 | { |
239 | netstatget = (NETSTATGET) GetProcAddress(netapi,TEXT("NetStatisticsGet")); | 256 | netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); |
240 | netfree = (NETFREE) GetProcAddress(netapi,TEXT("NetApiBufferFree")); | 257 | netfree = (NETFREE) GetProcAddress(netapi,"NetApiBufferFree"); |
241 | } | 258 | } |
242 | 259 | ||
243 | if (netstatget && netfree) | 260 | if (netstatget && netfree) |
@@ -264,9 +281,7 @@ int RAND_poll(void) | |||
264 | if (netapi) | 281 | if (netapi) |
265 | FreeLibrary(netapi); | 282 | FreeLibrary(netapi); |
266 | #endif /* 1 */ | 283 | #endif /* 1 */ |
267 | #endif /* !OPENSSL_SYS_WINCE */ | 284 | |
268 | |||
269 | #ifndef OPENSSL_SYS_WINCE | ||
270 | /* It appears like this can cause an exception deep within ADVAPI32.DLL | 285 | /* It appears like this can cause an exception deep within ADVAPI32.DLL |
271 | * at random times on Windows 2000. Reported by Jeffrey Altman. | 286 | * at random times on Windows 2000. Reported by Jeffrey Altman. |
272 | * Only use it on NT. | 287 | * Only use it on NT. |
@@ -321,16 +336,20 @@ int RAND_poll(void) | |||
321 | free(buf); | 336 | free(buf); |
322 | } | 337 | } |
323 | #endif | 338 | #endif |
324 | #endif /* !OPENSSL_SYS_WINCE */ | ||
325 | 339 | ||
326 | if (advapi) | 340 | if (advapi) |
327 | { | 341 | { |
328 | acquire = (CRYPTACQUIRECONTEXT) GetProcAddress(advapi, | 342 | /* |
329 | TEXT("CryptAcquireContextA")); | 343 | * If it's available, then it's available in both ANSI |
344 | * and UNICODE flavors even in Win9x, documentation says. | ||
345 | * We favor Unicode... | ||
346 | */ | ||
347 | acquire = (CRYPTACQUIRECONTEXTW) GetProcAddress(advapi, | ||
348 | "CryptAcquireContextW"); | ||
330 | gen = (CRYPTGENRANDOM) GetProcAddress(advapi, | 349 | gen = (CRYPTGENRANDOM) GetProcAddress(advapi, |
331 | TEXT("CryptGenRandom")); | 350 | "CryptGenRandom"); |
332 | release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi, | 351 | release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi, |
333 | TEXT("CryptReleaseContext")); | 352 | "CryptReleaseContext"); |
334 | } | 353 | } |
335 | 354 | ||
336 | if (acquire && gen && release) | 355 | if (acquire && gen && release) |
@@ -367,26 +386,15 @@ int RAND_poll(void) | |||
367 | if (advapi) | 386 | if (advapi) |
368 | FreeLibrary(advapi); | 387 | FreeLibrary(advapi); |
369 | 388 | ||
370 | /* timer data */ | ||
371 | readtimer(); | ||
372 | |||
373 | /* memory usage statistics */ | ||
374 | GlobalMemoryStatus(&m); | ||
375 | RAND_add(&m, sizeof(m), 1); | ||
376 | |||
377 | /* process ID */ | ||
378 | w = GetCurrentProcessId(); | ||
379 | RAND_add(&w, sizeof(w), 1); | ||
380 | |||
381 | if (user) | 389 | if (user) |
382 | { | 390 | { |
383 | GETCURSORINFO cursor; | 391 | GETCURSORINFO cursor; |
384 | GETFOREGROUNDWINDOW win; | 392 | GETFOREGROUNDWINDOW win; |
385 | GETQUEUESTATUS queue; | 393 | GETQUEUESTATUS queue; |
386 | 394 | ||
387 | win = (GETFOREGROUNDWINDOW) GetProcAddress(user, TEXT("GetForegroundWindow")); | 395 | win = (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow"); |
388 | cursor = (GETCURSORINFO) GetProcAddress(user, TEXT("GetCursorInfo")); | 396 | cursor = (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo"); |
389 | queue = (GETQUEUESTATUS) GetProcAddress(user, TEXT("GetQueueStatus")); | 397 | queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus"); |
390 | 398 | ||
391 | if (win) | 399 | if (win) |
392 | { | 400 | { |
@@ -458,19 +466,19 @@ int RAND_poll(void) | |||
458 | MODULEENTRY32 m; | 466 | MODULEENTRY32 m; |
459 | 467 | ||
460 | snap = (CREATETOOLHELP32SNAPSHOT) | 468 | snap = (CREATETOOLHELP32SNAPSHOT) |
461 | GetProcAddress(kernel, TEXT("CreateToolhelp32Snapshot")); | 469 | GetProcAddress(kernel, "CreateToolhelp32Snapshot"); |
462 | close_snap = (CLOSETOOLHELP32SNAPSHOT) | 470 | close_snap = (CLOSETOOLHELP32SNAPSHOT) |
463 | GetProcAddress(kernel, TEXT("CloseToolhelp32Snapshot")); | 471 | GetProcAddress(kernel, "CloseToolhelp32Snapshot"); |
464 | heap_first = (HEAP32FIRST) GetProcAddress(kernel, TEXT("Heap32First")); | 472 | heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First"); |
465 | heap_next = (HEAP32NEXT) GetProcAddress(kernel, TEXT("Heap32Next")); | 473 | heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next"); |
466 | heaplist_first = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListFirst")); | 474 | heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst"); |
467 | heaplist_next = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListNext")); | 475 | heaplist_next = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListNext"); |
468 | process_first = (PROCESS32) GetProcAddress(kernel, TEXT("Process32First")); | 476 | process_first = (PROCESS32) GetProcAddress(kernel, "Process32First"); |
469 | process_next = (PROCESS32) GetProcAddress(kernel, TEXT("Process32Next")); | 477 | process_next = (PROCESS32) GetProcAddress(kernel, "Process32Next"); |
470 | thread_first = (THREAD32) GetProcAddress(kernel, TEXT("Thread32First")); | 478 | thread_first = (THREAD32) GetProcAddress(kernel, "Thread32First"); |
471 | thread_next = (THREAD32) GetProcAddress(kernel, TEXT("Thread32Next")); | 479 | thread_next = (THREAD32) GetProcAddress(kernel, "Thread32Next"); |
472 | module_first = (MODULE32) GetProcAddress(kernel, TEXT("Module32First")); | 480 | module_first = (MODULE32) GetProcAddress(kernel, "Module32First"); |
473 | module_next = (MODULE32) GetProcAddress(kernel, TEXT("Module32Next")); | 481 | module_next = (MODULE32) GetProcAddress(kernel, "Module32Next"); |
474 | 482 | ||
475 | if (snap && heap_first && heap_next && heaplist_first && | 483 | if (snap && heap_first && heap_next && heaplist_first && |
476 | heaplist_next && process_first && process_next && | 484 | heaplist_next && process_first && process_next && |
@@ -546,6 +554,18 @@ int RAND_poll(void) | |||
546 | 554 | ||
547 | FreeLibrary(kernel); | 555 | FreeLibrary(kernel); |
548 | } | 556 | } |
557 | #endif /* !OPENSSL_SYS_WINCE */ | ||
558 | |||
559 | /* timer data */ | ||
560 | readtimer(); | ||
561 | |||
562 | /* memory usage statistics */ | ||
563 | GlobalMemoryStatus(&m); | ||
564 | RAND_add(&m, sizeof(m), 1); | ||
565 | |||
566 | /* process ID */ | ||
567 | w = GetCurrentProcessId(); | ||
568 | RAND_add(&w, sizeof(w), 1); | ||
549 | 569 | ||
550 | #if 0 | 570 | #if 0 |
551 | printf("Exiting RAND_poll\n"); | 571 | printf("Exiting RAND_poll\n"); |
@@ -607,7 +627,7 @@ static void readtimer(void) | |||
607 | DWORD w; | 627 | DWORD w; |
608 | LARGE_INTEGER l; | 628 | LARGE_INTEGER l; |
609 | static int have_perfc = 1; | 629 | static int have_perfc = 1; |
610 | #if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE) | 630 | #if defined(_MSC_VER) && defined(_M_X86) |
611 | static int have_tsc = 1; | 631 | static int have_tsc = 1; |
612 | DWORD cyclecount; | 632 | DWORD cyclecount; |
613 | 633 | ||
@@ -660,7 +680,7 @@ static void readtimer(void) | |||
660 | 680 | ||
661 | static void readscreen(void) | 681 | static void readscreen(void) |
662 | { | 682 | { |
663 | #ifndef OPENSSL_SYS_WINCE | 683 | #if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) |
664 | HDC hScrDC; /* screen DC */ | 684 | HDC hScrDC; /* screen DC */ |
665 | HDC hMemDC; /* memory DC */ | 685 | HDC hMemDC; /* memory DC */ |
666 | HBITMAP hBitmap; /* handle for our bitmap */ | 686 | HBITMAP hBitmap; /* handle for our bitmap */ |
diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c index d88ee0d780..9bd89ba495 100644 --- a/src/lib/libcrypto/rand/randfile.c +++ b/src/lib/libcrypto/rand/randfile.c | |||
@@ -166,6 +166,7 @@ int RAND_write_file(const char *file) | |||
166 | } | 166 | } |
167 | 167 | ||
168 | #if defined(O_CREAT) && !defined(OPENSSL_SYS_WIN32) | 168 | #if defined(O_CREAT) && !defined(OPENSSL_SYS_WIN32) |
169 | { | ||
169 | /* For some reason Win32 can't write to files created this way */ | 170 | /* For some reason Win32 can't write to files created this way */ |
170 | 171 | ||
171 | /* chmod(..., 0600) is too late to protect the file, | 172 | /* chmod(..., 0600) is too late to protect the file, |
@@ -173,6 +174,7 @@ int RAND_write_file(const char *file) | |||
173 | int fd = open(file, O_CREAT, 0600); | 174 | int fd = open(file, O_CREAT, 0600); |
174 | if (fd != -1) | 175 | if (fd != -1) |
175 | out = fdopen(fd, "wb"); | 176 | out = fdopen(fd, "wb"); |
177 | } | ||
176 | #endif | 178 | #endif |
177 | if (out == NULL) | 179 | if (out == NULL) |
178 | out = fopen(file,"wb"); | 180 | out = fopen(file,"wb"); |
diff --git a/src/lib/libcrypto/rc2/rc2.h b/src/lib/libcrypto/rc2/rc2.h index 7816b454dc..71788158d8 100644 --- a/src/lib/libcrypto/rc2/rc2.h +++ b/src/lib/libcrypto/rc2/rc2.h | |||
@@ -79,7 +79,10 @@ typedef struct rc2_key_st | |||
79 | RC2_INT data[64]; | 79 | RC2_INT data[64]; |
80 | } RC2_KEY; | 80 | } RC2_KEY; |
81 | 81 | ||
82 | 82 | #ifdef OPENSSL_FIPS | |
83 | void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, | ||
84 | int bits); | ||
85 | #endif | ||
83 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); | 86 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); |
84 | void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, | 87 | void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, |
85 | int enc); | 88 | int enc); |
diff --git a/src/lib/libcrypto/rc2/rc2_skey.c b/src/lib/libcrypto/rc2/rc2_skey.c index cab3080c73..22f372f85c 100644 --- a/src/lib/libcrypto/rc2/rc2_skey.c +++ b/src/lib/libcrypto/rc2/rc2_skey.c | |||
@@ -57,6 +57,7 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/rc2.h> | 59 | #include <openssl/rc2.h> |
60 | #include <openssl/crypto.h> | ||
60 | #include "rc2_locl.h" | 61 | #include "rc2_locl.h" |
61 | 62 | ||
62 | static unsigned char key_table[256]={ | 63 | static unsigned char key_table[256]={ |
@@ -90,7 +91,19 @@ static unsigned char key_table[256]={ | |||
90 | * BSAFE uses the 'retarded' version. What I previously shipped is | 91 | * BSAFE uses the 'retarded' version. What I previously shipped is |
91 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses | 92 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses |
92 | * a version where the bits parameter is the same as len*8 */ | 93 | * a version where the bits parameter is the same as len*8 */ |
94 | |||
95 | #ifdef OPENSSL_FIPS | ||
96 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) | ||
97 | { | ||
98 | if (FIPS_mode()) | ||
99 | FIPS_BAD_ABORT(RC2) | ||
100 | private_RC2_set_key(key, len, data, bits); | ||
101 | } | ||
102 | void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, | ||
103 | int bits) | ||
104 | #else | ||
93 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) | 105 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) |
106 | #endif | ||
94 | { | 107 | { |
95 | int i,j; | 108 | int i,j; |
96 | unsigned char *k; | 109 | unsigned char *k; |
diff --git a/src/lib/libcrypto/rc4/asm/rc4-586.pl b/src/lib/libcrypto/rc4/asm/rc4-586.pl index 7ef889e5a1..d6e98f0811 100644 --- a/src/lib/libcrypto/rc4/asm/rc4-586.pl +++ b/src/lib/libcrypto/rc4/asm/rc4-586.pl | |||
@@ -1,16 +1,37 @@ | |||
1 | #!/usr/local/bin/perl | 1 | #!/usr/local/bin/perl |
2 | 2 | ||
3 | # define for pentium pro friendly version | 3 | # At some point it became apparent that the original SSLeay RC4 |
4 | # assembler implementation performs suboptimaly on latest IA-32 | ||
5 | # microarchitectures. After re-tuning performance has changed as | ||
6 | # following: | ||
7 | # | ||
8 | # Pentium +0% | ||
9 | # Pentium III +17% | ||
10 | # AMD +52%(*) | ||
11 | # P4 +180%(**) | ||
12 | # | ||
13 | # (*) This number is actually a trade-off:-) It's possible to | ||
14 | # achieve +72%, but at the cost of -48% off PIII performance. | ||
15 | # In other words code performing further 13% faster on AMD | ||
16 | # would perform almost 2 times slower on Intel PIII... | ||
17 | # For reference! This code delivers ~80% of rc4-amd64.pl | ||
18 | # performance on the same Opteron machine. | ||
19 | # (**) This number requires compressed key schedule set up by | ||
20 | # RC4_set_key and therefore doesn't apply to 0.9.7 [option for | ||
21 | # compressed key schedule is implemented in 0.9.8 and later, | ||
22 | # see commentary section in rc4_skey.c for further details]. | ||
23 | # | ||
24 | # <appro@fy.chalmers.se> | ||
4 | 25 | ||
5 | push(@INC,"perlasm","../../perlasm"); | 26 | push(@INC,"perlasm","../../perlasm"); |
6 | require "x86asm.pl"; | 27 | require "x86asm.pl"; |
7 | 28 | ||
8 | &asm_init($ARGV[0],"rc4-586.pl"); | 29 | &asm_init($ARGV[0],"rc4-586.pl"); |
9 | 30 | ||
10 | $tx="eax"; | 31 | $x="eax"; |
11 | $ty="ebx"; | 32 | $y="ebx"; |
12 | $x="ecx"; | 33 | $tx="ecx"; |
13 | $y="edx"; | 34 | $ty="edx"; |
14 | $in="esi"; | 35 | $in="esi"; |
15 | $out="edi"; | 36 | $out="edi"; |
16 | $d="ebp"; | 37 | $d="ebp"; |
@@ -31,7 +52,7 @@ sub RC4_loop | |||
31 | { | 52 | { |
32 | &mov($ty, &swtmp(2)); | 53 | &mov($ty, &swtmp(2)); |
33 | &cmp($ty, $in); | 54 | &cmp($ty, $in); |
34 | &jle(&label("finished")); | 55 | &jbe(&label("finished")); |
35 | &inc($in); | 56 | &inc($in); |
36 | } | 57 | } |
37 | else | 58 | else |
@@ -39,27 +60,23 @@ sub RC4_loop | |||
39 | &add($ty, 8); | 60 | &add($ty, 8); |
40 | &inc($in); | 61 | &inc($in); |
41 | &cmp($ty, $in); | 62 | &cmp($ty, $in); |
42 | &jl(&label("finished")); | 63 | &jb(&label("finished")); |
43 | &mov(&swtmp(2), $ty); | 64 | &mov(&swtmp(2), $ty); |
44 | } | 65 | } |
45 | } | 66 | } |
46 | # Moved out | 67 | # Moved out |
47 | # &mov( $tx, &DWP(0,$d,$x,4)) if $p < 0; | 68 | # &mov( $tx, &DWP(0,$d,$x,4)) if $p < 0; |
48 | 69 | ||
49 | &add( $y, $tx); | 70 | &add( &LB($y), &LB($tx)); |
50 | &and( $y, 0xff); | ||
51 | &inc( $x); # NEXT ROUND | ||
52 | &mov( $ty, &DWP(0,$d,$y,4)); | 71 | &mov( $ty, &DWP(0,$d,$y,4)); |
53 | # XXX | 72 | # XXX |
54 | &mov( &DWP(-4,$d,$x,4),$ty); # AGI | 73 | &mov( &DWP(0,$d,$x,4),$ty); |
55 | &add( $ty, $tx); | 74 | &add( $ty, $tx); |
56 | &and( $x, 0xff); # NEXT ROUND | ||
57 | &and( $ty, 0xff); | ||
58 | &mov( &DWP(0,$d,$y,4),$tx); | 75 | &mov( &DWP(0,$d,$y,4),$tx); |
59 | &nop(); | 76 | &and( $ty, 0xff); |
60 | &mov( $ty, &DWP(0,$d,$ty,4)); | 77 | &inc( &LB($x)); # NEXT ROUND |
61 | &mov( $tx, &DWP(0,$d,$x,4)) if $p < 1; # NEXT ROUND | 78 | &mov( $tx, &DWP(0,$d,$x,4)) if $p < 1; # NEXT ROUND |
62 | # XXX | 79 | &mov( $ty, &DWP(0,$d,$ty,4)); |
63 | 80 | ||
64 | if (!$char) | 81 | if (!$char) |
65 | { | 82 | { |
@@ -88,35 +105,47 @@ sub RC4 | |||
88 | 105 | ||
89 | &function_begin_B($name,""); | 106 | &function_begin_B($name,""); |
90 | 107 | ||
108 | &mov($ty,&wparam(1)); # len | ||
109 | &cmp($ty,0); | ||
110 | &jne(&label("proceed")); | ||
111 | &ret(); | ||
112 | &set_label("proceed"); | ||
113 | |||
91 | &comment(""); | 114 | &comment(""); |
92 | 115 | ||
93 | &push("ebp"); | 116 | &push("ebp"); |
94 | &push("ebx"); | 117 | &push("ebx"); |
95 | &mov( $d, &wparam(0)); # key | ||
96 | &mov( $ty, &wparam(1)); # num | ||
97 | &push("esi"); | 118 | &push("esi"); |
98 | &push("edi"); | 119 | &xor( $x, $x); # avoid partial register stalls |
120 | &push("edi"); | ||
121 | &xor( $y, $y); # avoid partial register stalls | ||
122 | &mov( $d, &wparam(0)); # key | ||
123 | &mov( $in, &wparam(2)); | ||
99 | 124 | ||
100 | &mov( $x, &DWP(0,$d,"",1)); | 125 | &movb( &LB($x), &BP(0,$d,"",1)); |
101 | &mov( $y, &DWP(4,$d,"",1)); | 126 | &movb( &LB($y), &BP(4,$d,"",1)); |
102 | 127 | ||
103 | &mov( $in, &wparam(2)); | 128 | &mov( $out, &wparam(3)); |
104 | &inc( $x); | 129 | &inc( &LB($x)); |
105 | 130 | ||
106 | &stack_push(3); # 3 temp variables | 131 | &stack_push(3); # 3 temp variables |
107 | &add( $d, 8); | 132 | &add( $d, 8); |
108 | &and( $x, 0xff); | 133 | |
134 | # detect compressed schedule, see commentary section in rc4_skey.c... | ||
135 | # in 0.9.7 context ~50 bytes below RC4_CHAR label remain redundant, | ||
136 | # as compressed key schedule is set up in 0.9.8 and later. | ||
137 | &cmp(&DWP(256,$d),-1); | ||
138 | &je(&label("RC4_CHAR")); | ||
109 | 139 | ||
110 | &lea( $ty, &DWP(-8,$ty,$in)); | 140 | &lea( $ty, &DWP(-8,$ty,$in)); |
111 | 141 | ||
112 | # check for 0 length input | 142 | # check for 0 length input |
113 | 143 | ||
114 | &mov( $out, &wparam(3)); | ||
115 | &mov( &swtmp(2), $ty); # this is now address to exit at | 144 | &mov( &swtmp(2), $ty); # this is now address to exit at |
116 | &mov( $tx, &DWP(0,$d,$x,4)); | 145 | &mov( $tx, &DWP(0,$d,$x,4)); |
117 | 146 | ||
118 | &cmp( $ty, $in); | 147 | &cmp( $ty, $in); |
119 | &jl( &label("end")); # less than 8 bytes | 148 | &jb( &label("end")); # less than 8 bytes |
120 | 149 | ||
121 | &set_label("start"); | 150 | &set_label("start"); |
122 | 151 | ||
@@ -148,7 +177,7 @@ sub RC4 | |||
148 | &mov( &DWP(-4,$out,"",0), $tx); | 177 | &mov( &DWP(-4,$out,"",0), $tx); |
149 | &mov( $tx, &DWP(0,$d,$x,4)); | 178 | &mov( $tx, &DWP(0,$d,$x,4)); |
150 | &cmp($in, $ty); | 179 | &cmp($in, $ty); |
151 | &jle(&label("start")); | 180 | &jbe(&label("start")); |
152 | 181 | ||
153 | &set_label("end"); | 182 | &set_label("end"); |
154 | 183 | ||
@@ -162,10 +191,37 @@ sub RC4 | |||
162 | &RC4_loop(5,0,1); | 191 | &RC4_loop(5,0,1); |
163 | &RC4_loop(6,1,1); | 192 | &RC4_loop(6,1,1); |
164 | 193 | ||
194 | &jmp(&label("finished")); | ||
195 | |||
196 | &align(16); | ||
197 | # this is essentially Intel P4 specific codepath, see rc4_skey.c, | ||
198 | # and is engaged in 0.9.8 and later context... | ||
199 | &set_label("RC4_CHAR"); | ||
200 | |||
201 | &lea ($ty,&DWP(0,$in,$ty)); | ||
202 | &mov (&swtmp(2),$ty); | ||
203 | |||
204 | # strangely enough unrolled loop performs over 20% slower... | ||
205 | &set_label("RC4_CHAR_loop"); | ||
206 | &movz ($tx,&BP(0,$d,$x)); | ||
207 | &add (&LB($y),&LB($tx)); | ||
208 | &movz ($ty,&BP(0,$d,$y)); | ||
209 | &movb (&BP(0,$d,$y),&LB($tx)); | ||
210 | &movb (&BP(0,$d,$x),&LB($ty)); | ||
211 | &add (&LB($ty),&LB($tx)); | ||
212 | &movz ($ty,&BP(0,$d,$ty)); | ||
213 | &xorb (&LB($ty),&BP(0,$in)); | ||
214 | &movb (&BP(0,$out),&LB($ty)); | ||
215 | &inc (&LB($x)); | ||
216 | &inc ($in); | ||
217 | &inc ($out); | ||
218 | &cmp ($in,&swtmp(2)); | ||
219 | &jb (&label("RC4_CHAR_loop")); | ||
220 | |||
165 | &set_label("finished"); | 221 | &set_label("finished"); |
166 | &dec( $x); | 222 | &dec( $x); |
167 | &stack_pop(3); | 223 | &stack_pop(3); |
168 | &mov( &DWP(-4,$d,"",0),$y); | 224 | &movb( &BP(-4,$d,"",0),&LB($y)); |
169 | &movb( &BP(-8,$d,"",0),&LB($x)); | 225 | &movb( &BP(-8,$d,"",0),&LB($x)); |
170 | 226 | ||
171 | &function_end($name); | 227 | &function_end($name); |
diff --git a/src/lib/libcrypto/rc4/rc4.h b/src/lib/libcrypto/rc4/rc4.h index 8722091f2e..dd90d9fde0 100644 --- a/src/lib/libcrypto/rc4/rc4.h +++ b/src/lib/libcrypto/rc4/rc4.h | |||
@@ -73,10 +73,17 @@ typedef struct rc4_key_st | |||
73 | { | 73 | { |
74 | RC4_INT x,y; | 74 | RC4_INT x,y; |
75 | RC4_INT data[256]; | 75 | RC4_INT data[256]; |
76 | #if defined(__ia64) || defined(__ia64__) || defined(_M_IA64) | ||
77 | /* see crypto/rc4/asm/rc4-ia64.S for further details... */ | ||
78 | RC4_INT pad[512-256-2]; | ||
79 | #endif | ||
76 | } RC4_KEY; | 80 | } RC4_KEY; |
77 | 81 | ||
78 | 82 | ||
79 | const char *RC4_options(void); | 83 | const char *RC4_options(void); |
84 | #ifdef OPENSSL_FIPS | ||
85 | void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); | ||
86 | #endif | ||
80 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); | 87 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); |
81 | void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | 88 | void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, |
82 | unsigned char *outdata); | 89 | unsigned char *outdata); |
diff --git a/src/lib/libcrypto/rc4/rc4_enc.c b/src/lib/libcrypto/rc4/rc4_enc.c index d5f18a3a70..81a97ea3b7 100644 --- a/src/lib/libcrypto/rc4/rc4_enc.c +++ b/src/lib/libcrypto/rc4/rc4_enc.c | |||
@@ -77,6 +77,10 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | |||
77 | x=key->x; | 77 | x=key->x; |
78 | y=key->y; | 78 | y=key->y; |
79 | d=key->data; | 79 | d=key->data; |
80 | #if defined(__ia64) || defined(__ia64__) || defined(_M_IA64) | ||
81 | /* see crypto/rc4/asm/rc4-ia64.S for further details... */ | ||
82 | d=(RC4_INT *)(((size_t)(d+255))&~(sizeof(key->data)-1)); | ||
83 | #endif | ||
80 | 84 | ||
81 | #if defined(RC4_CHUNK) | 85 | #if defined(RC4_CHUNK) |
82 | /* | 86 | /* |
diff --git a/src/lib/libcrypto/rc4/rc4_locl.h b/src/lib/libcrypto/rc4/rc4_locl.h index 3bb80b6ce9..c712e1632e 100644 --- a/src/lib/libcrypto/rc4/rc4_locl.h +++ b/src/lib/libcrypto/rc4/rc4_locl.h | |||
@@ -1,4 +1,5 @@ | |||
1 | #ifndef HEADER_RC4_LOCL_H | 1 | #ifndef HEADER_RC4_LOCL_H |
2 | #define HEADER_RC4_LOCL_H | 2 | #define HEADER_RC4_LOCL_H |
3 | #include <openssl/opensslconf.h> | 3 | #include <openssl/opensslconf.h> |
4 | #include <cryptlib.h> | ||
4 | #endif | 5 | #endif |
diff --git a/src/lib/libcrypto/rc4/rc4_skey.c b/src/lib/libcrypto/rc4/rc4_skey.c index bb10c1ebe2..07234f061a 100644 --- a/src/lib/libcrypto/rc4/rc4_skey.c +++ b/src/lib/libcrypto/rc4/rc4_skey.c | |||
@@ -57,6 +57,7 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/rc4.h> | 59 | #include <openssl/rc4.h> |
60 | #include <openssl/crypto.h> | ||
60 | #include "rc4_locl.h" | 61 | #include "rc4_locl.h" |
61 | #include <openssl/opensslv.h> | 62 | #include <openssl/opensslv.h> |
62 | 63 | ||
@@ -85,7 +86,7 @@ const char *RC4_options(void) | |||
85 | * Date: Wed, 14 Sep 1994 06:35:31 GMT | 86 | * Date: Wed, 14 Sep 1994 06:35:31 GMT |
86 | */ | 87 | */ |
87 | 88 | ||
88 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) | 89 | FIPS_NON_FIPS_VCIPHER_Init(RC4) |
89 | { | 90 | { |
90 | register RC4_INT tmp; | 91 | register RC4_INT tmp; |
91 | register int id1,id2; | 92 | register int id1,id2; |
@@ -93,6 +94,11 @@ void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) | |||
93 | unsigned int i; | 94 | unsigned int i; |
94 | 95 | ||
95 | d= &(key->data[0]); | 96 | d= &(key->data[0]); |
97 | #if defined(__ia64) || defined(__ia64__) || defined(_M_IA64) | ||
98 | /* see crypto/rc4/asm/rc4-ia64.S for further details... */ | ||
99 | d=(RC4_INT *)(((size_t)(d+255))&~(sizeof(key->data)-1)); | ||
100 | #endif | ||
101 | |||
96 | for (i=0; i<256; i++) | 102 | for (i=0; i<256; i++) |
97 | d[i]=i; | 103 | d[i]=i; |
98 | key->x = 0; | 104 | key->x = 0; |
diff --git a/src/lib/libcrypto/rc5/rc5.h b/src/lib/libcrypto/rc5/rc5.h index 4adfd2db5a..aa3f26920b 100644 --- a/src/lib/libcrypto/rc5/rc5.h +++ b/src/lib/libcrypto/rc5/rc5.h | |||
@@ -92,7 +92,10 @@ typedef struct rc5_key_st | |||
92 | RC5_32_INT data[2*(RC5_16_ROUNDS+1)]; | 92 | RC5_32_INT data[2*(RC5_16_ROUNDS+1)]; |
93 | } RC5_32_KEY; | 93 | } RC5_32_KEY; |
94 | 94 | ||
95 | 95 | #ifdef OPENSSL_FIPS | |
96 | void private_RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, | ||
97 | int rounds); | ||
98 | #endif | ||
96 | void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, | 99 | void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, |
97 | int rounds); | 100 | int rounds); |
98 | void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key, | 101 | void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key, |
diff --git a/src/lib/libcrypto/ripemd/ripemd.h b/src/lib/libcrypto/ripemd/ripemd.h index 78d5f36560..7d0d998189 100644 --- a/src/lib/libcrypto/ripemd/ripemd.h +++ b/src/lib/libcrypto/ripemd/ripemd.h | |||
@@ -90,6 +90,9 @@ typedef struct RIPEMD160state_st | |||
90 | int num; | 90 | int num; |
91 | } RIPEMD160_CTX; | 91 | } RIPEMD160_CTX; |
92 | 92 | ||
93 | #ifdef OPENSSL_FIPS | ||
94 | int private_RIPEMD160_Init(RIPEMD160_CTX *c); | ||
95 | #endif | ||
93 | int RIPEMD160_Init(RIPEMD160_CTX *c); | 96 | int RIPEMD160_Init(RIPEMD160_CTX *c); |
94 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len); | 97 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len); |
95 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); | 98 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); |
diff --git a/src/lib/libcrypto/ripemd/rmd_dgst.c b/src/lib/libcrypto/ripemd/rmd_dgst.c index 28896512e7..58ff010d11 100644 --- a/src/lib/libcrypto/ripemd/rmd_dgst.c +++ b/src/lib/libcrypto/ripemd/rmd_dgst.c | |||
@@ -58,6 +58,7 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "rmd_locl.h" | 60 | #include "rmd_locl.h" |
61 | #include <openssl/fips.h> | ||
61 | #include <openssl/opensslv.h> | 62 | #include <openssl/opensslv.h> |
62 | 63 | ||
63 | const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT; | 64 | const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT; |
@@ -69,7 +70,7 @@ const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT; | |||
69 | void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,int num); | 70 | void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,int num); |
70 | # endif | 71 | # endif |
71 | 72 | ||
72 | int RIPEMD160_Init(RIPEMD160_CTX *c) | 73 | FIPS_NON_FIPS_MD_Init(RIPEMD160) |
73 | { | 74 | { |
74 | c->A=RIPEMD160_A; | 75 | c->A=RIPEMD160_A; |
75 | c->B=RIPEMD160_B; | 76 | c->B=RIPEMD160_B; |
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h index 62fa745f79..fc3bb5f86d 100644 --- a/src/lib/libcrypto/rsa/rsa.h +++ b/src/lib/libcrypto/rsa/rsa.h | |||
@@ -72,6 +72,10 @@ | |||
72 | #error RSA is disabled. | 72 | #error RSA is disabled. |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | #if defined(OPENSSL_FIPS) | ||
76 | #define FIPS_RSA_SIZE_T int | ||
77 | #endif | ||
78 | |||
75 | #ifdef __cplusplus | 79 | #ifdef __cplusplus |
76 | extern "C" { | 80 | extern "C" { |
77 | #endif | 81 | #endif |
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index e0d286266e..d4caab3f95 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <openssl/rsa.h> | 62 | #include <openssl/rsa.h> |
63 | #include <openssl/rand.h> | 63 | #include <openssl/rand.h> |
64 | 64 | ||
65 | #ifndef RSA_NULL | 65 | #if !defined(RSA_NULL) && !defined(OPENSSL_FIPS) |
66 | 66 | ||
67 | static int RSA_eay_public_encrypt(int flen, const unsigned char *from, | 67 | static int RSA_eay_public_encrypt(int flen, const unsigned char *from, |
68 | unsigned char *to, RSA *rsa,int padding); | 68 | unsigned char *to, RSA *rsa,int padding); |
diff --git a/src/lib/libcrypto/rsa/rsa_gen.c b/src/lib/libcrypto/rsa/rsa_gen.c index 00c25adbc5..adb5e34da5 100644 --- a/src/lib/libcrypto/rsa/rsa_gen.c +++ b/src/lib/libcrypto/rsa/rsa_gen.c | |||
@@ -62,6 +62,8 @@ | |||
62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
63 | #include <openssl/rsa.h> | 63 | #include <openssl/rsa.h> |
64 | 64 | ||
65 | #ifndef OPENSSL_FIPS | ||
66 | |||
65 | RSA *RSA_generate_key(int bits, unsigned long e_value, | 67 | RSA *RSA_generate_key(int bits, unsigned long e_value, |
66 | void (*callback)(int,int,void *), void *cb_arg) | 68 | void (*callback)(int,int,void *), void *cb_arg) |
67 | { | 69 | { |
@@ -195,3 +197,4 @@ err: | |||
195 | return(rsa); | 197 | return(rsa); |
196 | } | 198 | } |
197 | 199 | ||
200 | #endif | ||
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c index f462716a57..24fc94835e 100644 --- a/src/lib/libcrypto/rsa/rsa_saos.c +++ b/src/lib/libcrypto/rsa/rsa_saos.c | |||
@@ -139,8 +139,11 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype, | |||
139 | ret=1; | 139 | ret=1; |
140 | err: | 140 | err: |
141 | if (sig != NULL) M_ASN1_OCTET_STRING_free(sig); | 141 | if (sig != NULL) M_ASN1_OCTET_STRING_free(sig); |
142 | OPENSSL_cleanse(s,(unsigned int)siglen); | 142 | if (s != NULL) |
143 | OPENSSL_free(s); | 143 | { |
144 | OPENSSL_cleanse(s,(unsigned int)siglen); | ||
145 | OPENSSL_free(s); | ||
146 | } | ||
144 | return(ret); | 147 | return(ret); |
145 | } | 148 | } |
146 | 149 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c index 8a1e642183..cee09eccb1 100644 --- a/src/lib/libcrypto/rsa/rsa_sign.c +++ b/src/lib/libcrypto/rsa/rsa_sign.c | |||
@@ -169,7 +169,7 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
169 | } | 169 | } |
170 | if((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH) ) { | 170 | if((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH) ) { |
171 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH); | 171 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH); |
172 | return(0); | 172 | goto err; |
173 | } | 173 | } |
174 | i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING); | 174 | i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING); |
175 | 175 | ||
@@ -222,8 +222,11 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
222 | } | 222 | } |
223 | err: | 223 | err: |
224 | if (sig != NULL) X509_SIG_free(sig); | 224 | if (sig != NULL) X509_SIG_free(sig); |
225 | OPENSSL_cleanse(s,(unsigned int)siglen); | 225 | if (s != NULL) |
226 | OPENSSL_free(s); | 226 | { |
227 | OPENSSL_cleanse(s,(unsigned int)siglen); | ||
228 | OPENSSL_free(s); | ||
229 | } | ||
227 | return(ret); | 230 | return(ret); |
228 | } | 231 | } |
229 | 232 | ||
diff --git a/src/lib/libcrypto/sha/asm/sha1-586.pl b/src/lib/libcrypto/sha/asm/sha1-586.pl index e00f709553..041acc0348 100644 --- a/src/lib/libcrypto/sha/asm/sha1-586.pl +++ b/src/lib/libcrypto/sha/asm/sha1-586.pl | |||
@@ -405,7 +405,7 @@ sub sha1_block_data | |||
405 | &mov(&DWP(16,$tmp1,"",0),$E); | 405 | &mov(&DWP(16,$tmp1,"",0),$E); |
406 | &cmp("esi","eax"); | 406 | &cmp("esi","eax"); |
407 | &mov(&DWP( 4,$tmp1,"",0),$B); | 407 | &mov(&DWP( 4,$tmp1,"",0),$B); |
408 | &jl(&label("start")); | 408 | &jb(&label("start")); |
409 | 409 | ||
410 | &stack_pop(18+9); | 410 | &stack_pop(18+9); |
411 | &pop("edi"); | 411 | &pop("edi"); |
diff --git a/src/lib/libcrypto/sha/sha.h b/src/lib/libcrypto/sha/sha.h index 3fd54a10cc..79c07b0fd1 100644 --- a/src/lib/libcrypto/sha/sha.h +++ b/src/lib/libcrypto/sha/sha.h | |||
@@ -69,6 +69,10 @@ extern "C" { | |||
69 | #error SHA is disabled. | 69 | #error SHA is disabled. |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | #if defined(OPENSSL_FIPS) | ||
73 | #define FIPS_SHA_SIZE_T unsigned long | ||
74 | #endif | ||
75 | |||
72 | /* | 76 | /* |
73 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
74 | * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! | 78 | * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! |
@@ -101,6 +105,9 @@ typedef struct SHAstate_st | |||
101 | } SHA_CTX; | 105 | } SHA_CTX; |
102 | 106 | ||
103 | #ifndef OPENSSL_NO_SHA0 | 107 | #ifndef OPENSSL_NO_SHA0 |
108 | #ifdef OPENSSL_FIPS | ||
109 | int private_SHA_Init(SHA_CTX *c); | ||
110 | #endif | ||
104 | int SHA_Init(SHA_CTX *c); | 111 | int SHA_Init(SHA_CTX *c); |
105 | int SHA_Update(SHA_CTX *c, const void *data, unsigned long len); | 112 | int SHA_Update(SHA_CTX *c, const void *data, unsigned long len); |
106 | int SHA_Final(unsigned char *md, SHA_CTX *c); | 113 | int SHA_Final(unsigned char *md, SHA_CTX *c); |
diff --git a/src/lib/libcrypto/sha/sha1dgst.c b/src/lib/libcrypto/sha/sha1dgst.c index 182f65982a..1e2009b760 100644 --- a/src/lib/libcrypto/sha/sha1dgst.c +++ b/src/lib/libcrypto/sha/sha1dgst.c | |||
@@ -62,12 +62,20 @@ | |||
62 | #define SHA_1 | 62 | #define SHA_1 |
63 | 63 | ||
64 | #include <openssl/opensslv.h> | 64 | #include <openssl/opensslv.h> |
65 | #include <openssl/opensslconf.h> | ||
65 | 66 | ||
67 | #ifndef OPENSSL_FIPS | ||
66 | const char *SHA1_version="SHA1" OPENSSL_VERSION_PTEXT; | 68 | const char *SHA1_version="SHA1" OPENSSL_VERSION_PTEXT; |
67 | 69 | ||
68 | /* The implementation is in ../md32_common.h */ | 70 | /* The implementation is in ../md32_common.h */ |
69 | 71 | ||
70 | #include "sha_locl.h" | 72 | #include "sha_locl.h" |
71 | 73 | ||
74 | #else /* ndef OPENSSL_FIPS */ | ||
75 | |||
76 | static void *dummy=&dummy; | ||
77 | |||
78 | #endif /* ndef OPENSSL_FIPS */ | ||
79 | |||
72 | #endif | 80 | #endif |
73 | 81 | ||
diff --git a/src/lib/libcrypto/sha/sha_locl.h b/src/lib/libcrypto/sha/sha_locl.h index 2dd63a62a6..a3623f72da 100644 --- a/src/lib/libcrypto/sha/sha_locl.h +++ b/src/lib/libcrypto/sha/sha_locl.h | |||
@@ -121,6 +121,11 @@ | |||
121 | # define sha1_block_data_order sha1_block_asm_data_order | 121 | # define sha1_block_data_order sha1_block_asm_data_order |
122 | # define DONT_IMPLEMENT_BLOCK_DATA_ORDER | 122 | # define DONT_IMPLEMENT_BLOCK_DATA_ORDER |
123 | # define HASH_BLOCK_DATA_ORDER_ALIGNED sha1_block_asm_data_order | 123 | # define HASH_BLOCK_DATA_ORDER_ALIGNED sha1_block_asm_data_order |
124 | # elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) | ||
125 | # define sha1_block_host_order sha1_block_asm_host_order | ||
126 | # define DONT_IMPLEMENT_BLOCK_HOST_ORDER | ||
127 | # define sha1_block_data_order sha1_block_asm_data_order | ||
128 | # define DONT_IMPLEMENT_BLOCK_DATA_ORDER | ||
124 | # endif | 129 | # endif |
125 | # endif | 130 | # endif |
126 | void sha1_block_host_order (SHA_CTX *c, const void *p,int num); | 131 | void sha1_block_host_order (SHA_CTX *c, const void *p,int num); |
@@ -138,7 +143,11 @@ | |||
138 | #define INIT_DATA_h3 0x10325476UL | 143 | #define INIT_DATA_h3 0x10325476UL |
139 | #define INIT_DATA_h4 0xc3d2e1f0UL | 144 | #define INIT_DATA_h4 0xc3d2e1f0UL |
140 | 145 | ||
146 | #if defined(SHA_0) && defined(OPENSSL_FIPS) | ||
147 | FIPS_NON_FIPS_MD_Init(SHA) | ||
148 | #else | ||
141 | int HASH_INIT (SHA_CTX *c) | 149 | int HASH_INIT (SHA_CTX *c) |
150 | #endif | ||
142 | { | 151 | { |
143 | c->h0=INIT_DATA_h0; | 152 | c->h0=INIT_DATA_h0; |
144 | c->h1=INIT_DATA_h1; | 153 | c->h1=INIT_DATA_h1; |
diff --git a/src/lib/libcrypto/sha/shatest.c b/src/lib/libcrypto/sha/shatest.c index 5d2b1d3b1a..ff702aa53e 100644 --- a/src/lib/libcrypto/sha/shatest.c +++ b/src/lib/libcrypto/sha/shatest.c | |||
@@ -62,10 +62,10 @@ | |||
62 | 62 | ||
63 | #include "../e_os.h" | 63 | #include "../e_os.h" |
64 | 64 | ||
65 | #ifdef OPENSSL_NO_SHA | 65 | #if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA0) |
66 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
67 | { | 67 | { |
68 | printf("No SHA support\n"); | 68 | printf("No SHA0 support\n"); |
69 | return(0); | 69 | return(0); |
70 | } | 70 | } |
71 | #else | 71 | #else |
diff --git a/src/lib/libcrypto/stack/safestack.h b/src/lib/libcrypto/stack/safestack.h index ed9ed2c23a..bd1121c279 100644 --- a/src/lib/libcrypto/stack/safestack.h +++ b/src/lib/libcrypto/stack/safestack.h | |||
@@ -113,6 +113,8 @@ STACK_OF(type) \ | |||
113 | ((type * (*)(STACK_OF(type) *))sk_pop)(st) | 113 | ((type * (*)(STACK_OF(type) *))sk_pop)(st) |
114 | #define SKM_sk_sort(type, st) \ | 114 | #define SKM_sk_sort(type, st) \ |
115 | ((void (*)(STACK_OF(type) *))sk_sort)(st) | 115 | ((void (*)(STACK_OF(type) *))sk_sort)(st) |
116 | #define SKM_sk_is_sorted(type, st) \ | ||
117 | ((int (*)(const STACK_OF(type) *))sk_is_sorted)(st) | ||
116 | 118 | ||
117 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | 119 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ |
118 | ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \ | 120 | ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \ |
@@ -187,6 +189,8 @@ STACK_OF(type) \ | |||
187 | ((type *)sk_pop(st)) | 189 | ((type *)sk_pop(st)) |
188 | #define SKM_sk_sort(type, st) \ | 190 | #define SKM_sk_sort(type, st) \ |
189 | sk_sort(st) | 191 | sk_sort(st) |
192 | #define SKM_sk_is_sorted(type, st) \ | ||
193 | sk_is_sorted(st) | ||
190 | 194 | ||
191 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | 195 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ |
192 | d2i_ASN1_SET(st,pp,length, (char *(*)())d2i_func, (void (*)(void *))free_func, ex_tag,ex_class) | 196 | d2i_ASN1_SET(st,pp,length, (char *(*)())d2i_func, (void (*)(void *))free_func, ex_tag,ex_class) |
@@ -223,6 +227,7 @@ STACK_OF(type) \ | |||
223 | #define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st)) | 227 | #define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st)) |
224 | #define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st)) | 228 | #define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st)) |
225 | #define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) | 229 | #define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) |
230 | #define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st)) | ||
226 | 231 | ||
227 | #define sk_ASN1_GENERALSTRING_new(st) SKM_sk_new(ASN1_GENERALSTRING, (st)) | 232 | #define sk_ASN1_GENERALSTRING_new(st) SKM_sk_new(ASN1_GENERALSTRING, (st)) |
228 | #define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING) | 233 | #define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING) |
@@ -243,6 +248,7 @@ STACK_OF(type) \ | |||
243 | #define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st)) | 248 | #define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st)) |
244 | #define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st)) | 249 | #define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st)) |
245 | #define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st)) | 250 | #define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st)) |
251 | #define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st)) | ||
246 | 252 | ||
247 | #define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st)) | 253 | #define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st)) |
248 | #define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) | 254 | #define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) |
@@ -263,6 +269,7 @@ STACK_OF(type) \ | |||
263 | #define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st)) | 269 | #define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st)) |
264 | #define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st)) | 270 | #define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st)) |
265 | #define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) | 271 | #define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) |
272 | #define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st)) | ||
266 | 273 | ||
267 | #define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st)) | 274 | #define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st)) |
268 | #define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) | 275 | #define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) |
@@ -283,6 +290,7 @@ STACK_OF(type) \ | |||
283 | #define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st)) | 290 | #define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st)) |
284 | #define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st)) | 291 | #define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st)) |
285 | #define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) | 292 | #define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) |
293 | #define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st)) | ||
286 | 294 | ||
287 | #define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st)) | 295 | #define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st)) |
288 | #define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) | 296 | #define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) |
@@ -303,6 +311,7 @@ STACK_OF(type) \ | |||
303 | #define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st)) | 311 | #define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st)) |
304 | #define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st)) | 312 | #define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st)) |
305 | #define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) | 313 | #define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) |
314 | #define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st)) | ||
306 | 315 | ||
307 | #define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st)) | 316 | #define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st)) |
308 | #define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) | 317 | #define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) |
@@ -323,6 +332,7 @@ STACK_OF(type) \ | |||
323 | #define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st)) | 332 | #define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st)) |
324 | #define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st)) | 333 | #define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st)) |
325 | #define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) | 334 | #define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) |
335 | #define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st)) | ||
326 | 336 | ||
327 | #define sk_ASN1_VALUE_new(st) SKM_sk_new(ASN1_VALUE, (st)) | 337 | #define sk_ASN1_VALUE_new(st) SKM_sk_new(ASN1_VALUE, (st)) |
328 | #define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE) | 338 | #define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE) |
@@ -343,6 +353,7 @@ STACK_OF(type) \ | |||
343 | #define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st)) | 353 | #define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st)) |
344 | #define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st)) | 354 | #define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st)) |
345 | #define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st)) | 355 | #define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st)) |
356 | #define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st)) | ||
346 | 357 | ||
347 | #define sk_BIO_new(st) SKM_sk_new(BIO, (st)) | 358 | #define sk_BIO_new(st) SKM_sk_new(BIO, (st)) |
348 | #define sk_BIO_new_null() SKM_sk_new_null(BIO) | 359 | #define sk_BIO_new_null() SKM_sk_new_null(BIO) |
@@ -363,6 +374,7 @@ STACK_OF(type) \ | |||
363 | #define sk_BIO_shift(st) SKM_sk_shift(BIO, (st)) | 374 | #define sk_BIO_shift(st) SKM_sk_shift(BIO, (st)) |
364 | #define sk_BIO_pop(st) SKM_sk_pop(BIO, (st)) | 375 | #define sk_BIO_pop(st) SKM_sk_pop(BIO, (st)) |
365 | #define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) | 376 | #define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) |
377 | #define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st)) | ||
366 | 378 | ||
367 | #define sk_CONF_IMODULE_new(st) SKM_sk_new(CONF_IMODULE, (st)) | 379 | #define sk_CONF_IMODULE_new(st) SKM_sk_new(CONF_IMODULE, (st)) |
368 | #define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE) | 380 | #define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE) |
@@ -383,6 +395,7 @@ STACK_OF(type) \ | |||
383 | #define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st)) | 395 | #define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st)) |
384 | #define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st)) | 396 | #define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st)) |
385 | #define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st)) | 397 | #define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st)) |
398 | #define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st)) | ||
386 | 399 | ||
387 | #define sk_CONF_MODULE_new(st) SKM_sk_new(CONF_MODULE, (st)) | 400 | #define sk_CONF_MODULE_new(st) SKM_sk_new(CONF_MODULE, (st)) |
388 | #define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE) | 401 | #define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE) |
@@ -403,6 +416,7 @@ STACK_OF(type) \ | |||
403 | #define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st)) | 416 | #define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st)) |
404 | #define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st)) | 417 | #define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st)) |
405 | #define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st)) | 418 | #define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st)) |
419 | #define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st)) | ||
406 | 420 | ||
407 | #define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st)) | 421 | #define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st)) |
408 | #define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) | 422 | #define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) |
@@ -423,6 +437,7 @@ STACK_OF(type) \ | |||
423 | #define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st)) | 437 | #define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st)) |
424 | #define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st)) | 438 | #define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st)) |
425 | #define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) | 439 | #define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) |
440 | #define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st)) | ||
426 | 441 | ||
427 | #define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (st)) | 442 | #define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (st)) |
428 | #define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) | 443 | #define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) |
@@ -443,6 +458,7 @@ STACK_OF(type) \ | |||
443 | #define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st)) | 458 | #define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st)) |
444 | #define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st)) | 459 | #define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st)) |
445 | #define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) | 460 | #define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) |
461 | #define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st)) | ||
446 | 462 | ||
447 | #define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st)) | 463 | #define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st)) |
448 | #define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) | 464 | #define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) |
@@ -463,6 +479,7 @@ STACK_OF(type) \ | |||
463 | #define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st)) | 479 | #define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st)) |
464 | #define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st)) | 480 | #define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st)) |
465 | #define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) | 481 | #define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) |
482 | #define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st)) | ||
466 | 483 | ||
467 | #define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st)) | 484 | #define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st)) |
468 | #define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) | 485 | #define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) |
@@ -483,6 +500,7 @@ STACK_OF(type) \ | |||
483 | #define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st)) | 500 | #define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st)) |
484 | #define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st)) | 501 | #define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st)) |
485 | #define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) | 502 | #define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) |
503 | #define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st)) | ||
486 | 504 | ||
487 | #define sk_ENGINE_new(st) SKM_sk_new(ENGINE, (st)) | 505 | #define sk_ENGINE_new(st) SKM_sk_new(ENGINE, (st)) |
488 | #define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE) | 506 | #define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE) |
@@ -503,6 +521,7 @@ STACK_OF(type) \ | |||
503 | #define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st)) | 521 | #define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st)) |
504 | #define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st)) | 522 | #define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st)) |
505 | #define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st)) | 523 | #define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st)) |
524 | #define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st)) | ||
506 | 525 | ||
507 | #define sk_ENGINE_CLEANUP_ITEM_new(st) SKM_sk_new(ENGINE_CLEANUP_ITEM, (st)) | 526 | #define sk_ENGINE_CLEANUP_ITEM_new(st) SKM_sk_new(ENGINE_CLEANUP_ITEM, (st)) |
508 | #define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM) | 527 | #define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM) |
@@ -523,6 +542,7 @@ STACK_OF(type) \ | |||
523 | #define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st)) | 542 | #define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st)) |
524 | #define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st)) | 543 | #define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st)) |
525 | #define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st)) | 544 | #define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st)) |
545 | #define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st)) | ||
526 | 546 | ||
527 | #define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st)) | 547 | #define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st)) |
528 | #define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) | 548 | #define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) |
@@ -543,6 +563,7 @@ STACK_OF(type) \ | |||
543 | #define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st)) | 563 | #define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st)) |
544 | #define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st)) | 564 | #define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st)) |
545 | #define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) | 565 | #define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) |
566 | #define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st)) | ||
546 | 567 | ||
547 | #define sk_KRB5_APREQBODY_new(st) SKM_sk_new(KRB5_APREQBODY, (st)) | 568 | #define sk_KRB5_APREQBODY_new(st) SKM_sk_new(KRB5_APREQBODY, (st)) |
548 | #define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY) | 569 | #define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY) |
@@ -563,6 +584,7 @@ STACK_OF(type) \ | |||
563 | #define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st)) | 584 | #define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st)) |
564 | #define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st)) | 585 | #define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st)) |
565 | #define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st)) | 586 | #define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st)) |
587 | #define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st)) | ||
566 | 588 | ||
567 | #define sk_KRB5_AUTHDATA_new(st) SKM_sk_new(KRB5_AUTHDATA, (st)) | 589 | #define sk_KRB5_AUTHDATA_new(st) SKM_sk_new(KRB5_AUTHDATA, (st)) |
568 | #define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA) | 590 | #define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA) |
@@ -583,6 +605,7 @@ STACK_OF(type) \ | |||
583 | #define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st)) | 605 | #define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st)) |
584 | #define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st)) | 606 | #define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st)) |
585 | #define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st)) | 607 | #define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st)) |
608 | #define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st)) | ||
586 | 609 | ||
587 | #define sk_KRB5_AUTHENTBODY_new(st) SKM_sk_new(KRB5_AUTHENTBODY, (st)) | 610 | #define sk_KRB5_AUTHENTBODY_new(st) SKM_sk_new(KRB5_AUTHENTBODY, (st)) |
588 | #define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY) | 611 | #define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY) |
@@ -603,6 +626,7 @@ STACK_OF(type) \ | |||
603 | #define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st)) | 626 | #define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st)) |
604 | #define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st)) | 627 | #define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st)) |
605 | #define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st)) | 628 | #define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st)) |
629 | #define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st)) | ||
606 | 630 | ||
607 | #define sk_KRB5_CHECKSUM_new(st) SKM_sk_new(KRB5_CHECKSUM, (st)) | 631 | #define sk_KRB5_CHECKSUM_new(st) SKM_sk_new(KRB5_CHECKSUM, (st)) |
608 | #define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM) | 632 | #define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM) |
@@ -623,6 +647,7 @@ STACK_OF(type) \ | |||
623 | #define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st)) | 647 | #define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st)) |
624 | #define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st)) | 648 | #define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st)) |
625 | #define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st)) | 649 | #define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st)) |
650 | #define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st)) | ||
626 | 651 | ||
627 | #define sk_KRB5_ENCDATA_new(st) SKM_sk_new(KRB5_ENCDATA, (st)) | 652 | #define sk_KRB5_ENCDATA_new(st) SKM_sk_new(KRB5_ENCDATA, (st)) |
628 | #define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA) | 653 | #define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA) |
@@ -643,6 +668,7 @@ STACK_OF(type) \ | |||
643 | #define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st)) | 668 | #define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st)) |
644 | #define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st)) | 669 | #define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st)) |
645 | #define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st)) | 670 | #define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st)) |
671 | #define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st)) | ||
646 | 672 | ||
647 | #define sk_KRB5_ENCKEY_new(st) SKM_sk_new(KRB5_ENCKEY, (st)) | 673 | #define sk_KRB5_ENCKEY_new(st) SKM_sk_new(KRB5_ENCKEY, (st)) |
648 | #define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY) | 674 | #define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY) |
@@ -663,6 +689,7 @@ STACK_OF(type) \ | |||
663 | #define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st)) | 689 | #define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st)) |
664 | #define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st)) | 690 | #define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st)) |
665 | #define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st)) | 691 | #define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st)) |
692 | #define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st)) | ||
666 | 693 | ||
667 | #define sk_KRB5_PRINCNAME_new(st) SKM_sk_new(KRB5_PRINCNAME, (st)) | 694 | #define sk_KRB5_PRINCNAME_new(st) SKM_sk_new(KRB5_PRINCNAME, (st)) |
668 | #define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME) | 695 | #define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME) |
@@ -683,6 +710,7 @@ STACK_OF(type) \ | |||
683 | #define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st)) | 710 | #define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st)) |
684 | #define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st)) | 711 | #define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st)) |
685 | #define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st)) | 712 | #define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st)) |
713 | #define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st)) | ||
686 | 714 | ||
687 | #define sk_KRB5_TKTBODY_new(st) SKM_sk_new(KRB5_TKTBODY, (st)) | 715 | #define sk_KRB5_TKTBODY_new(st) SKM_sk_new(KRB5_TKTBODY, (st)) |
688 | #define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY) | 716 | #define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY) |
@@ -703,6 +731,7 @@ STACK_OF(type) \ | |||
703 | #define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st)) | 731 | #define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st)) |
704 | #define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st)) | 732 | #define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st)) |
705 | #define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st)) | 733 | #define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st)) |
734 | #define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st)) | ||
706 | 735 | ||
707 | #define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st)) | 736 | #define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st)) |
708 | #define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) | 737 | #define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) |
@@ -723,6 +752,7 @@ STACK_OF(type) \ | |||
723 | #define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) | 752 | #define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) |
724 | #define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) | 753 | #define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) |
725 | #define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) | 754 | #define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) |
755 | #define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st)) | ||
726 | 756 | ||
727 | #define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st)) | 757 | #define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st)) |
728 | #define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) | 758 | #define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) |
@@ -743,6 +773,7 @@ STACK_OF(type) \ | |||
743 | #define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) | 773 | #define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) |
744 | #define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) | 774 | #define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) |
745 | #define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) | 775 | #define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) |
776 | #define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st)) | ||
746 | 777 | ||
747 | #define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st)) | 778 | #define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st)) |
748 | #define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) | 779 | #define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) |
@@ -763,6 +794,7 @@ STACK_OF(type) \ | |||
763 | #define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st)) | 794 | #define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st)) |
764 | #define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st)) | 795 | #define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st)) |
765 | #define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) | 796 | #define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) |
797 | #define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st)) | ||
766 | 798 | ||
767 | #define sk_OCSP_CERTID_new(st) SKM_sk_new(OCSP_CERTID, (st)) | 799 | #define sk_OCSP_CERTID_new(st) SKM_sk_new(OCSP_CERTID, (st)) |
768 | #define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID) | 800 | #define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID) |
@@ -783,6 +815,7 @@ STACK_OF(type) \ | |||
783 | #define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st)) | 815 | #define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st)) |
784 | #define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st)) | 816 | #define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st)) |
785 | #define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st)) | 817 | #define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st)) |
818 | #define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st)) | ||
786 | 819 | ||
787 | #define sk_OCSP_ONEREQ_new(st) SKM_sk_new(OCSP_ONEREQ, (st)) | 820 | #define sk_OCSP_ONEREQ_new(st) SKM_sk_new(OCSP_ONEREQ, (st)) |
788 | #define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ) | 821 | #define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ) |
@@ -803,6 +836,7 @@ STACK_OF(type) \ | |||
803 | #define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st)) | 836 | #define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st)) |
804 | #define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st)) | 837 | #define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st)) |
805 | #define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st)) | 838 | #define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st)) |
839 | #define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st)) | ||
806 | 840 | ||
807 | #define sk_OCSP_SINGLERESP_new(st) SKM_sk_new(OCSP_SINGLERESP, (st)) | 841 | #define sk_OCSP_SINGLERESP_new(st) SKM_sk_new(OCSP_SINGLERESP, (st)) |
808 | #define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP) | 842 | #define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP) |
@@ -823,6 +857,7 @@ STACK_OF(type) \ | |||
823 | #define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st)) | 857 | #define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st)) |
824 | #define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st)) | 858 | #define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st)) |
825 | #define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st)) | 859 | #define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st)) |
860 | #define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st)) | ||
826 | 861 | ||
827 | #define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st)) | 862 | #define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st)) |
828 | #define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) | 863 | #define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) |
@@ -843,6 +878,7 @@ STACK_OF(type) \ | |||
843 | #define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st)) | 878 | #define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st)) |
844 | #define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st)) | 879 | #define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st)) |
845 | #define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) | 880 | #define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) |
881 | #define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st)) | ||
846 | 882 | ||
847 | #define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st)) | 883 | #define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st)) |
848 | #define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) | 884 | #define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) |
@@ -863,6 +899,7 @@ STACK_OF(type) \ | |||
863 | #define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st)) | 899 | #define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st)) |
864 | #define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st)) | 900 | #define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st)) |
865 | #define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) | 901 | #define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) |
902 | #define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st)) | ||
866 | 903 | ||
867 | #define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st)) | 904 | #define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st)) |
868 | #define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) | 905 | #define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) |
@@ -883,6 +920,7 @@ STACK_OF(type) \ | |||
883 | #define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st)) | 920 | #define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st)) |
884 | #define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st)) | 921 | #define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st)) |
885 | #define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) | 922 | #define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) |
923 | #define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st)) | ||
886 | 924 | ||
887 | #define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st)) | 925 | #define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st)) |
888 | #define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) | 926 | #define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) |
@@ -903,6 +941,7 @@ STACK_OF(type) \ | |||
903 | #define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st)) | 941 | #define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st)) |
904 | #define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st)) | 942 | #define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st)) |
905 | #define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) | 943 | #define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) |
944 | #define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st)) | ||
906 | 945 | ||
907 | #define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st)) | 946 | #define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st)) |
908 | #define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) | 947 | #define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) |
@@ -923,6 +962,7 @@ STACK_OF(type) \ | |||
923 | #define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st)) | 962 | #define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st)) |
924 | #define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st)) | 963 | #define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st)) |
925 | #define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) | 964 | #define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) |
965 | #define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st)) | ||
926 | 966 | ||
927 | #define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st)) | 967 | #define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st)) |
928 | #define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) | 968 | #define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) |
@@ -943,6 +983,7 @@ STACK_OF(type) \ | |||
943 | #define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st)) | 983 | #define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st)) |
944 | #define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st)) | 984 | #define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st)) |
945 | #define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) | 985 | #define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) |
986 | #define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st)) | ||
946 | 987 | ||
947 | #define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st)) | 988 | #define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st)) |
948 | #define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) | 989 | #define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) |
@@ -963,6 +1004,7 @@ STACK_OF(type) \ | |||
963 | #define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st)) | 1004 | #define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st)) |
964 | #define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st)) | 1005 | #define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st)) |
965 | #define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) | 1006 | #define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) |
1007 | #define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st)) | ||
966 | 1008 | ||
967 | #define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st)) | 1009 | #define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st)) |
968 | #define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) | 1010 | #define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) |
@@ -983,6 +1025,7 @@ STACK_OF(type) \ | |||
983 | #define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st)) | 1025 | #define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st)) |
984 | #define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st)) | 1026 | #define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st)) |
985 | #define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) | 1027 | #define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) |
1028 | #define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st)) | ||
986 | 1029 | ||
987 | #define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st)) | 1030 | #define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st)) |
988 | #define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) | 1031 | #define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) |
@@ -1003,6 +1046,7 @@ STACK_OF(type) \ | |||
1003 | #define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st)) | 1046 | #define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st)) |
1004 | #define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st)) | 1047 | #define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st)) |
1005 | #define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) | 1048 | #define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) |
1049 | #define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st)) | ||
1006 | 1050 | ||
1007 | #define sk_UI_STRING_new(st) SKM_sk_new(UI_STRING, (st)) | 1051 | #define sk_UI_STRING_new(st) SKM_sk_new(UI_STRING, (st)) |
1008 | #define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) | 1052 | #define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) |
@@ -1023,6 +1067,7 @@ STACK_OF(type) \ | |||
1023 | #define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st)) | 1067 | #define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st)) |
1024 | #define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st)) | 1068 | #define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st)) |
1025 | #define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st)) | 1069 | #define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st)) |
1070 | #define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st)) | ||
1026 | 1071 | ||
1027 | #define sk_X509_new(st) SKM_sk_new(X509, (st)) | 1072 | #define sk_X509_new(st) SKM_sk_new(X509, (st)) |
1028 | #define sk_X509_new_null() SKM_sk_new_null(X509) | 1073 | #define sk_X509_new_null() SKM_sk_new_null(X509) |
@@ -1043,6 +1088,7 @@ STACK_OF(type) \ | |||
1043 | #define sk_X509_shift(st) SKM_sk_shift(X509, (st)) | 1088 | #define sk_X509_shift(st) SKM_sk_shift(X509, (st)) |
1044 | #define sk_X509_pop(st) SKM_sk_pop(X509, (st)) | 1089 | #define sk_X509_pop(st) SKM_sk_pop(X509, (st)) |
1045 | #define sk_X509_sort(st) SKM_sk_sort(X509, (st)) | 1090 | #define sk_X509_sort(st) SKM_sk_sort(X509, (st)) |
1091 | #define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st)) | ||
1046 | 1092 | ||
1047 | #define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st)) | 1093 | #define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st)) |
1048 | #define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) | 1094 | #define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) |
@@ -1063,6 +1109,7 @@ STACK_OF(type) \ | |||
1063 | #define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st)) | 1109 | #define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st)) |
1064 | #define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st)) | 1110 | #define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st)) |
1065 | #define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) | 1111 | #define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) |
1112 | #define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st)) | ||
1066 | 1113 | ||
1067 | #define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st)) | 1114 | #define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st)) |
1068 | #define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) | 1115 | #define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) |
@@ -1083,6 +1130,7 @@ STACK_OF(type) \ | |||
1083 | #define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st)) | 1130 | #define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st)) |
1084 | #define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st)) | 1131 | #define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st)) |
1085 | #define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) | 1132 | #define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) |
1133 | #define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st)) | ||
1086 | 1134 | ||
1087 | #define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st)) | 1135 | #define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st)) |
1088 | #define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) | 1136 | #define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) |
@@ -1103,6 +1151,7 @@ STACK_OF(type) \ | |||
1103 | #define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st)) | 1151 | #define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st)) |
1104 | #define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st)) | 1152 | #define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st)) |
1105 | #define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) | 1153 | #define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) |
1154 | #define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st)) | ||
1106 | 1155 | ||
1107 | #define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st)) | 1156 | #define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st)) |
1108 | #define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) | 1157 | #define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) |
@@ -1123,6 +1172,7 @@ STACK_OF(type) \ | |||
1123 | #define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st)) | 1172 | #define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st)) |
1124 | #define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st)) | 1173 | #define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st)) |
1125 | #define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) | 1174 | #define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) |
1175 | #define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st)) | ||
1126 | 1176 | ||
1127 | #define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st)) | 1177 | #define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st)) |
1128 | #define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) | 1178 | #define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) |
@@ -1143,6 +1193,7 @@ STACK_OF(type) \ | |||
1143 | #define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st)) | 1193 | #define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st)) |
1144 | #define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st)) | 1194 | #define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st)) |
1145 | #define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) | 1195 | #define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) |
1196 | #define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st)) | ||
1146 | 1197 | ||
1147 | #define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st)) | 1198 | #define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st)) |
1148 | #define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) | 1199 | #define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) |
@@ -1163,6 +1214,7 @@ STACK_OF(type) \ | |||
1163 | #define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st)) | 1214 | #define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st)) |
1164 | #define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st)) | 1215 | #define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st)) |
1165 | #define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) | 1216 | #define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) |
1217 | #define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st)) | ||
1166 | 1218 | ||
1167 | #define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st)) | 1219 | #define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st)) |
1168 | #define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) | 1220 | #define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) |
@@ -1183,6 +1235,7 @@ STACK_OF(type) \ | |||
1183 | #define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st)) | 1235 | #define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st)) |
1184 | #define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st)) | 1236 | #define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st)) |
1185 | #define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) | 1237 | #define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) |
1238 | #define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st)) | ||
1186 | 1239 | ||
1187 | #define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st)) | 1240 | #define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st)) |
1188 | #define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) | 1241 | #define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) |
@@ -1203,6 +1256,7 @@ STACK_OF(type) \ | |||
1203 | #define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st)) | 1256 | #define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st)) |
1204 | #define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st)) | 1257 | #define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st)) |
1205 | #define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) | 1258 | #define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) |
1259 | #define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st)) | ||
1206 | 1260 | ||
1207 | #define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st)) | 1261 | #define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st)) |
1208 | #define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) | 1262 | #define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) |
@@ -1223,6 +1277,7 @@ STACK_OF(type) \ | |||
1223 | #define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st)) | 1277 | #define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st)) |
1224 | #define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st)) | 1278 | #define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st)) |
1225 | #define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) | 1279 | #define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) |
1280 | #define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st)) | ||
1226 | 1281 | ||
1227 | #define sk_X509_OBJECT_new(st) SKM_sk_new(X509_OBJECT, (st)) | 1282 | #define sk_X509_OBJECT_new(st) SKM_sk_new(X509_OBJECT, (st)) |
1228 | #define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT) | 1283 | #define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT) |
@@ -1243,6 +1298,7 @@ STACK_OF(type) \ | |||
1243 | #define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st)) | 1298 | #define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st)) |
1244 | #define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st)) | 1299 | #define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st)) |
1245 | #define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st)) | 1300 | #define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st)) |
1301 | #define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st)) | ||
1246 | 1302 | ||
1247 | #define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st)) | 1303 | #define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st)) |
1248 | #define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) | 1304 | #define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) |
@@ -1263,6 +1319,7 @@ STACK_OF(type) \ | |||
1263 | #define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st)) | 1319 | #define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st)) |
1264 | #define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st)) | 1320 | #define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st)) |
1265 | #define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) | 1321 | #define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) |
1322 | #define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st)) | ||
1266 | 1323 | ||
1267 | #define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st)) | 1324 | #define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st)) |
1268 | #define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) | 1325 | #define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) |
@@ -1283,6 +1340,7 @@ STACK_OF(type) \ | |||
1283 | #define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st)) | 1340 | #define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st)) |
1284 | #define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st)) | 1341 | #define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st)) |
1285 | #define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) | 1342 | #define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) |
1343 | #define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st)) | ||
1286 | 1344 | ||
1287 | #define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st)) | 1345 | #define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st)) |
1288 | #define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) | 1346 | #define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) |
@@ -1303,6 +1361,7 @@ STACK_OF(type) \ | |||
1303 | #define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st)) | 1361 | #define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st)) |
1304 | #define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st)) | 1362 | #define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st)) |
1305 | #define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) | 1363 | #define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) |
1364 | #define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st)) | ||
1306 | 1365 | ||
1307 | #define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | 1366 | #define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ |
1308 | SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) | 1367 | SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) |
diff --git a/src/lib/libcrypto/stack/stack.c b/src/lib/libcrypto/stack/stack.c index 2496f28a8c..c7173eb6ab 100644 --- a/src/lib/libcrypto/stack/stack.c +++ b/src/lib/libcrypto/stack/stack.c | |||
@@ -191,8 +191,7 @@ char *sk_delete(STACK *st, int loc) | |||
191 | char *ret; | 191 | char *ret; |
192 | int i,j; | 192 | int i,j; |
193 | 193 | ||
194 | if ((st == NULL) || (st->num == 0) || (loc < 0) | 194 | if(!st || (loc < 0) || (loc >= st->num)) return NULL; |
195 | || (loc >= st->num)) return(NULL); | ||
196 | 195 | ||
197 | ret=st->data[loc]; | 196 | ret=st->data[loc]; |
198 | if (loc != st->num-1) | 197 | if (loc != st->num-1) |
@@ -306,13 +305,13 @@ int sk_num(const STACK *st) | |||
306 | 305 | ||
307 | char *sk_value(const STACK *st, int i) | 306 | char *sk_value(const STACK *st, int i) |
308 | { | 307 | { |
309 | if(st == NULL) return NULL; | 308 | if(!st || (i < 0) || (i >= st->num)) return NULL; |
310 | return st->data[i]; | 309 | return st->data[i]; |
311 | } | 310 | } |
312 | 311 | ||
313 | char *sk_set(STACK *st, int i, char *value) | 312 | char *sk_set(STACK *st, int i, char *value) |
314 | { | 313 | { |
315 | if(st == NULL) return NULL; | 314 | if(!st || (i < 0) || (i >= st->num)) return NULL; |
316 | return (st->data[i] = value); | 315 | return (st->data[i] = value); |
317 | } | 316 | } |
318 | 317 | ||
@@ -332,3 +331,10 @@ void sk_sort(STACK *st) | |||
332 | st->sorted=1; | 331 | st->sorted=1; |
333 | } | 332 | } |
334 | } | 333 | } |
334 | |||
335 | int sk_is_sorted(const STACK *st) | ||
336 | { | ||
337 | if (!st) | ||
338 | return 1; | ||
339 | return st->sorted; | ||
340 | } | ||
diff --git a/src/lib/libcrypto/stack/stack.h b/src/lib/libcrypto/stack/stack.h index 8b436ca4b9..7570b85fe8 100644 --- a/src/lib/libcrypto/stack/stack.h +++ b/src/lib/libcrypto/stack/stack.h | |||
@@ -99,6 +99,7 @@ int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *, | |||
99 | (const char * const *, const char * const *); | 99 | (const char * const *, const char * const *); |
100 | STACK *sk_dup(STACK *st); | 100 | STACK *sk_dup(STACK *st); |
101 | void sk_sort(STACK *st); | 101 | void sk_sort(STACK *st); |
102 | int sk_is_sorted(const STACK *st); | ||
102 | 103 | ||
103 | #ifdef __cplusplus | 104 | #ifdef __cplusplus |
104 | } | 105 | } |
diff --git a/src/lib/libcrypto/util/cygwin.sh b/src/lib/libcrypto/util/cygwin.sh index 930f766b4f..7f791d47f4 100644 --- a/src/lib/libcrypto/util/cygwin.sh +++ b/src/lib/libcrypto/util/cygwin.sh | |||
@@ -21,11 +21,11 @@ function cleanup() | |||
21 | 21 | ||
22 | function get_openssl_version() | 22 | function get_openssl_version() |
23 | { | 23 | { |
24 | eval `grep '^VERSION=' Makefile.ssl` | 24 | eval `grep '^VERSION=' Makefile` |
25 | if [ -z "${VERSION}" ] | 25 | if [ -z "${VERSION}" ] |
26 | then | 26 | then |
27 | echo "Error: Couldn't retrieve OpenSSL version from Makefile.ssl." | 27 | echo "Error: Couldn't retrieve OpenSSL version from Makefile." |
28 | echo " Check value of variable VERSION in Makefile.ssl." | 28 | echo " Check value of variable VERSION in Makefile." |
29 | exit 1 | 29 | exit 1 |
30 | fi | 30 | fi |
31 | } | 31 | } |
@@ -39,7 +39,7 @@ function base_install() | |||
39 | 39 | ||
40 | function doc_install() | 40 | function doc_install() |
41 | { | 41 | { |
42 | DOC_DIR=${INSTALL_PREFIX}/usr/doc/openssl | 42 | DOC_DIR=${INSTALL_PREFIX}/usr/share/doc/openssl |
43 | 43 | ||
44 | mkdir -p ${DOC_DIR} | 44 | mkdir -p ${DOC_DIR} |
45 | cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR} | 45 | cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR} |
@@ -49,7 +49,7 @@ function doc_install() | |||
49 | 49 | ||
50 | function create_cygwin_readme() | 50 | function create_cygwin_readme() |
51 | { | 51 | { |
52 | README_DIR=${INSTALL_PREFIX}/usr/doc/Cygwin | 52 | README_DIR=${INSTALL_PREFIX}/usr/share/doc/Cygwin |
53 | README_FILE=${README_DIR}/openssl-${VERSION}.README | 53 | README_FILE=${README_DIR}/openssl-${VERSION}.README |
54 | 54 | ||
55 | mkdir -p ${README_DIR} | 55 | mkdir -p ${README_DIR} |
@@ -112,8 +112,8 @@ cd ${INSTALL_PREFIX} | |||
112 | strip usr/bin/*.exe usr/bin/*.dll | 112 | strip usr/bin/*.exe usr/bin/*.dll |
113 | 113 | ||
114 | # Runtime package | 114 | # Runtime package |
115 | find etc usr/bin usr/doc usr/ssl/certs usr/ssl/man/man[157] usr/ssl/misc \ | 115 | find etc usr/bin usr/share/doc usr/ssl/certs usr/ssl/man/man[157] \ |
116 | usr/ssl/openssl.cnf usr/ssl/private -empty -o \! -type d | | 116 | usr/ssl/misc usr/ssl/openssl.cnf usr/ssl/private -empty -o \! -type d | |
117 | tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 - | 117 | tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 - |
118 | # Development package | 118 | # Development package |
119 | find usr/include usr/lib usr/ssl/man/man3 -empty -o \! -type d | | 119 | find usr/include usr/lib usr/ssl/man/man3 -empty -o \! -type d | |
diff --git a/src/lib/libcrypto/util/domd b/src/lib/libcrypto/util/domd index 49310bbdd1..5610521f0b 100644 --- a/src/lib/libcrypto/util/domd +++ b/src/lib/libcrypto/util/domd | |||
@@ -11,7 +11,7 @@ if [ "$1" = "-MD" ]; then | |||
11 | fi | 11 | fi |
12 | if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi | 12 | if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi |
13 | 13 | ||
14 | cp Makefile.ssl Makefile.save | 14 | cp Makefile Makefile.save |
15 | # fake the presence of Kerberos | 15 | # fake the presence of Kerberos |
16 | touch $TOP/krb5.h | 16 | touch $TOP/krb5.h |
17 | if [ "$MAKEDEPEND" = "gcc" ]; then | 17 | if [ "$MAKEDEPEND" = "gcc" ]; then |
@@ -20,15 +20,15 @@ if [ "$MAKEDEPEND" = "gcc" ]; then | |||
20 | if [ "$1" != "--" ]; then args="$args $1"; fi | 20 | if [ "$1" != "--" ]; then args="$args $1"; fi |
21 | shift | 21 | shift |
22 | done | 22 | done |
23 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile.ssl > Makefile.tmp | 23 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp |
24 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp | 24 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp |
25 | gcc -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp | 25 | gcc -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp |
26 | ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new | 26 | ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new |
27 | rm -f Makefile.tmp | 27 | rm -f Makefile.tmp |
28 | else | 28 | else |
29 | ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND -f Makefile.ssl $@ | 29 | ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND -f Makefile $@ |
30 | ${PERL} $TOP/util/clean-depend.pl < Makefile.ssl > Makefile.new | 30 | ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new |
31 | fi | 31 | fi |
32 | mv Makefile.new Makefile.ssl | 32 | mv Makefile.new Makefile |
33 | # unfake the presence of Kerberos | 33 | # unfake the presence of Kerberos |
34 | rm $TOP/krb5.h | 34 | rm $TOP/krb5.h |
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num index 203c7713e7..56fb7446e0 100644 --- a/src/lib/libcrypto/util/libeay.num +++ b/src/lib/libcrypto/util/libeay.num | |||
@@ -284,20 +284,20 @@ EVP_add_alias 291 NOEXIST::FUNCTION: | |||
284 | EVP_add_cipher 292 EXIST::FUNCTION: | 284 | EVP_add_cipher 292 EXIST::FUNCTION: |
285 | EVP_add_digest 293 EXIST::FUNCTION: | 285 | EVP_add_digest 293 EXIST::FUNCTION: |
286 | EVP_bf_cbc 294 EXIST::FUNCTION:BF | 286 | EVP_bf_cbc 294 EXIST::FUNCTION:BF |
287 | EVP_bf_cfb 295 EXIST::FUNCTION:BF | 287 | EVP_bf_cfb64 295 EXIST::FUNCTION:BF |
288 | EVP_bf_ecb 296 EXIST::FUNCTION:BF | 288 | EVP_bf_ecb 296 EXIST::FUNCTION:BF |
289 | EVP_bf_ofb 297 EXIST::FUNCTION:BF | 289 | EVP_bf_ofb 297 EXIST::FUNCTION:BF |
290 | EVP_cleanup 298 EXIST::FUNCTION: | 290 | EVP_cleanup 298 EXIST::FUNCTION: |
291 | EVP_des_cbc 299 EXIST::FUNCTION:DES | 291 | EVP_des_cbc 299 EXIST::FUNCTION:DES |
292 | EVP_des_cfb 300 EXIST::FUNCTION:DES | 292 | EVP_des_cfb64 300 EXIST::FUNCTION:DES |
293 | EVP_des_ecb 301 EXIST::FUNCTION:DES | 293 | EVP_des_ecb 301 EXIST::FUNCTION:DES |
294 | EVP_des_ede 302 EXIST::FUNCTION:DES | 294 | EVP_des_ede 302 EXIST::FUNCTION:DES |
295 | EVP_des_ede3 303 EXIST::FUNCTION:DES | 295 | EVP_des_ede3 303 EXIST::FUNCTION:DES |
296 | EVP_des_ede3_cbc 304 EXIST::FUNCTION:DES | 296 | EVP_des_ede3_cbc 304 EXIST::FUNCTION:DES |
297 | EVP_des_ede3_cfb 305 EXIST::FUNCTION:DES | 297 | EVP_des_ede3_cfb64 305 EXIST::FUNCTION:DES |
298 | EVP_des_ede3_ofb 306 EXIST::FUNCTION:DES | 298 | EVP_des_ede3_ofb 306 EXIST::FUNCTION:DES |
299 | EVP_des_ede_cbc 307 EXIST::FUNCTION:DES | 299 | EVP_des_ede_cbc 307 EXIST::FUNCTION:DES |
300 | EVP_des_ede_cfb 308 EXIST::FUNCTION:DES | 300 | EVP_des_ede_cfb64 308 EXIST::FUNCTION:DES |
301 | EVP_des_ede_ofb 309 EXIST::FUNCTION:DES | 301 | EVP_des_ede_ofb 309 EXIST::FUNCTION:DES |
302 | EVP_des_ofb 310 EXIST::FUNCTION:DES | 302 | EVP_des_ofb 310 EXIST::FUNCTION:DES |
303 | EVP_desx_cbc 311 EXIST::FUNCTION:DES | 303 | EVP_desx_cbc 311 EXIST::FUNCTION:DES |
@@ -308,14 +308,14 @@ EVP_get_cipherbyname 315 EXIST::FUNCTION: | |||
308 | EVP_get_digestbyname 316 EXIST::FUNCTION: | 308 | EVP_get_digestbyname 316 EXIST::FUNCTION: |
309 | EVP_get_pw_prompt 317 EXIST::FUNCTION: | 309 | EVP_get_pw_prompt 317 EXIST::FUNCTION: |
310 | EVP_idea_cbc 318 EXIST::FUNCTION:IDEA | 310 | EVP_idea_cbc 318 EXIST::FUNCTION:IDEA |
311 | EVP_idea_cfb 319 EXIST::FUNCTION:IDEA | 311 | EVP_idea_cfb64 319 EXIST::FUNCTION:IDEA |
312 | EVP_idea_ecb 320 EXIST::FUNCTION:IDEA | 312 | EVP_idea_ecb 320 EXIST::FUNCTION:IDEA |
313 | EVP_idea_ofb 321 EXIST::FUNCTION:IDEA | 313 | EVP_idea_ofb 321 EXIST::FUNCTION:IDEA |
314 | EVP_md2 322 EXIST::FUNCTION:MD2 | 314 | EVP_md2 322 EXIST::FUNCTION:MD2 |
315 | EVP_md5 323 EXIST::FUNCTION:MD5 | 315 | EVP_md5 323 EXIST::FUNCTION:MD5 |
316 | EVP_md_null 324 EXIST::FUNCTION: | 316 | EVP_md_null 324 EXIST::FUNCTION: |
317 | EVP_rc2_cbc 325 EXIST::FUNCTION:RC2 | 317 | EVP_rc2_cbc 325 EXIST::FUNCTION:RC2 |
318 | EVP_rc2_cfb 326 EXIST::FUNCTION:RC2 | 318 | EVP_rc2_cfb64 326 EXIST::FUNCTION:RC2 |
319 | EVP_rc2_ecb 327 EXIST::FUNCTION:RC2 | 319 | EVP_rc2_ecb 327 EXIST::FUNCTION:RC2 |
320 | EVP_rc2_ofb 328 EXIST::FUNCTION:RC2 | 320 | EVP_rc2_ofb 328 EXIST::FUNCTION:RC2 |
321 | EVP_rc4 329 EXIST::FUNCTION:RC4 | 321 | EVP_rc4 329 EXIST::FUNCTION:RC4 |
@@ -962,7 +962,7 @@ i2t_ASN1_OBJECT 979 EXIST::FUNCTION: | |||
962 | BN_BLINDING_new 980 EXIST::FUNCTION: | 962 | BN_BLINDING_new 980 EXIST::FUNCTION: |
963 | BN_BLINDING_free 981 EXIST::FUNCTION: | 963 | BN_BLINDING_free 981 EXIST::FUNCTION: |
964 | EVP_cast5_cbc 983 EXIST::FUNCTION:CAST | 964 | EVP_cast5_cbc 983 EXIST::FUNCTION:CAST |
965 | EVP_cast5_cfb 984 EXIST::FUNCTION:CAST | 965 | EVP_cast5_cfb64 984 EXIST::FUNCTION:CAST |
966 | EVP_cast5_ecb 985 EXIST::FUNCTION:CAST | 966 | EVP_cast5_ecb 985 EXIST::FUNCTION:CAST |
967 | EVP_cast5_ofb 986 EXIST::FUNCTION:CAST | 967 | EVP_cast5_ofb 986 EXIST::FUNCTION:CAST |
968 | BF_decrypt 987 EXIST::FUNCTION:BF | 968 | BF_decrypt 987 EXIST::FUNCTION:BF |
@@ -1057,7 +1057,7 @@ EVP_CIPHER_param_to_asn1 1084 EXIST::FUNCTION: | |||
1057 | EVP_CIPHER_get_asn1_iv 1085 EXIST::FUNCTION: | 1057 | EVP_CIPHER_get_asn1_iv 1085 EXIST::FUNCTION: |
1058 | EVP_CIPHER_set_asn1_iv 1086 EXIST::FUNCTION: | 1058 | EVP_CIPHER_set_asn1_iv 1086 EXIST::FUNCTION: |
1059 | EVP_rc5_32_12_16_cbc 1087 EXIST::FUNCTION:RC5 | 1059 | EVP_rc5_32_12_16_cbc 1087 EXIST::FUNCTION:RC5 |
1060 | EVP_rc5_32_12_16_cfb 1088 EXIST::FUNCTION:RC5 | 1060 | EVP_rc5_32_12_16_cfb64 1088 EXIST::FUNCTION:RC5 |
1061 | EVP_rc5_32_12_16_ecb 1089 EXIST::FUNCTION:RC5 | 1061 | EVP_rc5_32_12_16_ecb 1089 EXIST::FUNCTION:RC5 |
1062 | EVP_rc5_32_12_16_ofb 1090 EXIST::FUNCTION:RC5 | 1062 | EVP_rc5_32_12_16_ofb 1090 EXIST::FUNCTION:RC5 |
1063 | asn1_add_error 1091 EXIST::FUNCTION: | 1063 | asn1_add_error 1091 EXIST::FUNCTION: |
@@ -2776,10 +2776,10 @@ ENGINE_load_4758cca 3218 EXIST::FUNCTION:ENGINE | |||
2776 | _ossl_096_des_random_seed 3219 EXIST::FUNCTION:DES | 2776 | _ossl_096_des_random_seed 3219 EXIST::FUNCTION:DES |
2777 | EVP_aes_256_ofb 3220 EXIST::FUNCTION:AES | 2777 | EVP_aes_256_ofb 3220 EXIST::FUNCTION:AES |
2778 | EVP_aes_192_ofb 3221 EXIST::FUNCTION:AES | 2778 | EVP_aes_192_ofb 3221 EXIST::FUNCTION:AES |
2779 | EVP_aes_128_cfb 3222 EXIST::FUNCTION:AES | 2779 | EVP_aes_128_cfb128 3222 EXIST::FUNCTION:AES |
2780 | EVP_aes_256_cfb 3223 EXIST::FUNCTION:AES | 2780 | EVP_aes_256_cfb128 3223 EXIST::FUNCTION:AES |
2781 | EVP_aes_128_ofb 3224 EXIST::FUNCTION:AES | 2781 | EVP_aes_128_ofb 3224 EXIST::FUNCTION:AES |
2782 | EVP_aes_192_cfb 3225 EXIST::FUNCTION:AES | 2782 | EVP_aes_192_cfb128 3225 EXIST::FUNCTION:AES |
2783 | CONF_modules_free 3226 EXIST::FUNCTION: | 2783 | CONF_modules_free 3226 EXIST::FUNCTION: |
2784 | NCONF_default 3227 EXIST::FUNCTION: | 2784 | NCONF_default 3227 EXIST::FUNCTION: |
2785 | OPENSSL_no_config 3228 EXIST::FUNCTION: | 2785 | OPENSSL_no_config 3228 EXIST::FUNCTION: |
@@ -2803,3 +2803,67 @@ OpenSSLDie 3244 EXIST::FUNCTION: | |||
2803 | OPENSSL_cleanse 3245 EXIST::FUNCTION: | 2803 | OPENSSL_cleanse 3245 EXIST::FUNCTION: |
2804 | ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE | 2804 | ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE |
2805 | ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH | 2805 | ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH |
2806 | EVP_aes_128_cfb8 3248 EXIST::FUNCTION:AES | ||
2807 | FIPS_corrupt_rsa 3249 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2808 | FIPS_selftest_des 3250 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2809 | EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES | ||
2810 | EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES | ||
2811 | FIPS_mode_set 3253 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2812 | FIPS_selftest_dsa 3254 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2813 | EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES | ||
2814 | FIPS_allow_md5 3256 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2815 | DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES | ||
2816 | EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES | ||
2817 | FIPS_rand_seeded 3259 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2818 | AES_cfbr_encrypt_block 3260 EXIST::FUNCTION:AES | ||
2819 | AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES | ||
2820 | FIPS_rand_seed 3262 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2821 | FIPS_corrupt_des 3263 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2822 | EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES | ||
2823 | FIPS_selftest_aes 3265 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2824 | FIPS_set_prng_key 3266 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2825 | EVP_des_cfb8 3267 EXIST::FUNCTION:DES | ||
2826 | FIPS_corrupt_dsa 3268 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2827 | FIPS_test_mode 3269 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2828 | FIPS_rand_method 3270 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2829 | EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES | ||
2830 | ERR_load_FIPS_strings 3272 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2831 | FIPS_corrupt_aes 3273 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2832 | FIPS_selftest_sha1 3274 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2833 | FIPS_selftest_rsa 3275 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2834 | FIPS_corrupt_sha1 3276 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2835 | EVP_des_cfb1 3277 EXIST::FUNCTION:DES | ||
2836 | FIPS_dsa_check 3278 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2837 | AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES | ||
2838 | EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES | ||
2839 | FIPS_rand_check 3281 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2840 | FIPS_md5_allowed 3282 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2841 | FIPS_mode 3283 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2842 | FIPS_selftest_failed 3284 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2843 | sk_is_sorted 3285 EXIST::FUNCTION: | ||
2844 | X509_check_ca 3286 EXIST::FUNCTION: | ||
2845 | private_idea_set_encrypt_key 3287 EXIST:OPENSSL_FIPS:FUNCTION:IDEA | ||
2846 | HMAC_CTX_set_flags 3288 EXIST::FUNCTION:HMAC | ||
2847 | private_SHA_Init 3289 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA0 | ||
2848 | private_CAST_set_key 3290 EXIST:OPENSSL_FIPS:FUNCTION:CAST | ||
2849 | private_RIPEMD160_Init 3291 EXIST:OPENSSL_FIPS:FUNCTION:RIPEMD | ||
2850 | private_RC5_32_set_key 3292 EXIST:OPENSSL_FIPS:FUNCTION:RC5 | ||
2851 | private_MD5_Init 3293 EXIST:OPENSSL_FIPS:FUNCTION:MD5 | ||
2852 | private_RC4_set_key 3294 EXIST:OPENSSL_FIPS:FUNCTION:RC4 | ||
2853 | private_MDC2_Init 3295 EXIST:OPENSSL_FIPS:FUNCTION:MDC2 | ||
2854 | private_RC2_set_key 3296 EXIST:OPENSSL_FIPS:FUNCTION:RC2 | ||
2855 | private_MD4_Init 3297 EXIST:OPENSSL_FIPS:FUNCTION:MD4 | ||
2856 | private_BF_set_key 3298 EXIST:OPENSSL_FIPS:FUNCTION:BF | ||
2857 | private_MD2_Init 3299 EXIST:OPENSSL_FIPS:FUNCTION:MD2 | ||
2858 | d2i_PROXY_CERT_INFO_EXTENSION 3300 EXIST::FUNCTION: | ||
2859 | PROXY_POLICY_it 3301 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
2860 | PROXY_POLICY_it 3301 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
2861 | i2d_PROXY_POLICY 3302 EXIST::FUNCTION: | ||
2862 | i2d_PROXY_CERT_INFO_EXTENSION 3303 EXIST::FUNCTION: | ||
2863 | d2i_PROXY_POLICY 3304 EXIST::FUNCTION: | ||
2864 | PROXY_CERT_INFO_EXTENSION_new 3305 EXIST::FUNCTION: | ||
2865 | PROXY_CERT_INFO_EXTENSION_free 3306 EXIST::FUNCTION: | ||
2866 | PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
2867 | PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
2868 | PROXY_POLICY_free 3308 EXIST::FUNCTION: | ||
2869 | PROXY_POLICY_new 3309 EXIST::FUNCTION: | ||
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index b4bc0457e5..957264c6b5 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
@@ -10,7 +10,7 @@ $OPTIONS=""; | |||
10 | $ssl_version=""; | 10 | $ssl_version=""; |
11 | $banner="\t\@echo Building OpenSSL"; | 11 | $banner="\t\@echo Building OpenSSL"; |
12 | 12 | ||
13 | open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n"; | 13 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; |
14 | while(<IN>) { | 14 | while(<IN>) { |
15 | $ssl_version=$1 if (/^VERSION=(.*)$/); | 15 | $ssl_version=$1 if (/^VERSION=(.*)$/); |
16 | $OPTIONS=$1 if (/^OPTIONS=(.*)$/); | 16 | $OPTIONS=$1 if (/^OPTIONS=(.*)$/); |
@@ -18,7 +18,7 @@ while(<IN>) { | |||
18 | } | 18 | } |
19 | close(IN); | 19 | close(IN); |
20 | 20 | ||
21 | die "Makefile.ssl is not the toplevel Makefile!\n" if $ssl_version eq ""; | 21 | die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; |
22 | 22 | ||
23 | $infile="MINFO"; | 23 | $infile="MINFO"; |
24 | 24 | ||
@@ -222,7 +222,7 @@ $cflags.=" -DOPENSSL_NO_SHA" if $no_sha; | |||
222 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; | 222 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; |
223 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; | 223 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; |
224 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; | 224 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; |
225 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; | 225 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; |
226 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; | 226 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; |
227 | $cflags.=" -DOPENSSL_NO_DES" if $no_des; | 227 | $cflags.=" -DOPENSSL_NO_DES" if $no_des; |
228 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; | 228 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; |
@@ -236,6 +236,7 @@ $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; | |||
236 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; | 236 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; |
237 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; | 237 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; |
238 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | 238 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; |
239 | $cflags.=" -DOPENSSL_FIPS" if $fips; | ||
239 | #$cflags.=" -DRSAref" if $rsaref ne ""; | 240 | #$cflags.=" -DRSAref" if $rsaref ne ""; |
240 | 241 | ||
241 | ## if ($unix) | 242 | ## if ($unix) |
@@ -631,15 +632,21 @@ foreach (split(/\s+/,$test)) | |||
631 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | 632 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); |
632 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); | 633 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); |
633 | 634 | ||
634 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | 635 | if ($fips) |
635 | 636 | { | |
637 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)","\$(BIN_D)$o.sha1","\$(BIN_D)$o\$(E_EXE)$exep"); | ||
638 | } | ||
639 | else | ||
640 | { | ||
641 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | ||
642 | } | ||
636 | print $defs; | 643 | print $defs; |
637 | 644 | ||
638 | if ($platform eq "linux-elf") { | 645 | if ($platform eq "linux-elf") { |
639 | print <<"EOF"; | 646 | print <<"EOF"; |
640 | # Generate perlasm output files | 647 | # Generate perlasm output files |
641 | %.cpp: | 648 | %.cpp: |
642 | (cd \$(\@D)/..; PERL=perl make -f Makefile.ssl asm/\$(\@F)) | 649 | (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F)) |
643 | EOF | 650 | EOF |
644 | } | 651 | } |
645 | print "###################################################################\n"; | 652 | print "###################################################################\n"; |
@@ -921,6 +928,7 @@ sub read_options | |||
921 | $no_aes=1; } | 928 | $no_aes=1; } |
922 | 929 | ||
923 | elsif (/^rsaref$/) { } | 930 | elsif (/^rsaref$/) { } |
931 | elsif (/^fips$/) { $fips=1; } | ||
924 | elsif (/^gcc$/) { $gcc=1; } | 932 | elsif (/^gcc$/) { $gcc=1; } |
925 | elsif (/^debug$/) { $debug=1; } | 933 | elsif (/^debug$/) { $debug=1; } |
926 | elsif (/^profile$/) { $profile=1; } | 934 | elsif (/^profile$/) { $profile=1; } |
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl index 01a1bfda19..9918c3d549 100644 --- a/src/lib/libcrypto/util/mkdef.pl +++ b/src/lib/libcrypto/util/mkdef.pl | |||
@@ -79,7 +79,7 @@ my $OS2=0; | |||
79 | my $safe_stack_def = 0; | 79 | my $safe_stack_def = 0; |
80 | 80 | ||
81 | my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", | 81 | my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", |
82 | "EXPORT_VAR_AS_FUNCTION" ); | 82 | "EXPORT_VAR_AS_FUNCTION", "OPENSSL_FIPS" ); |
83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); | 83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); |
84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | 84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", |
85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", | 85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", |
@@ -94,7 +94,7 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | |||
94 | "FP_API", "STDIO", "SOCK", "KRB5", "ENGINE", "HW" ); | 94 | "FP_API", "STDIO", "SOCK", "KRB5", "ENGINE", "HW" ); |
95 | 95 | ||
96 | my $options=""; | 96 | my $options=""; |
97 | open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n"; | 97 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; |
98 | while(<IN>) { | 98 | while(<IN>) { |
99 | $options=$1 if (/^OPTIONS=(.*)$/); | 99 | $options=$1 if (/^OPTIONS=(.*)$/); |
100 | } | 100 | } |
@@ -109,6 +109,7 @@ my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; | |||
109 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; | 109 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; |
110 | my $no_ec; my $no_engine; my $no_hw; | 110 | my $no_ec; my $no_engine; my $no_hw; |
111 | my $no_fp_api; | 111 | my $no_fp_api; |
112 | my $fips; | ||
112 | 113 | ||
113 | foreach (@ARGV, split(/ /, $options)) | 114 | foreach (@ARGV, split(/ /, $options)) |
114 | { | 115 | { |
@@ -129,6 +130,7 @@ foreach (@ARGV, split(/ /, $options)) | |||
129 | } | 130 | } |
130 | $VMS=1 if $_ eq "VMS"; | 131 | $VMS=1 if $_ eq "VMS"; |
131 | $OS2=1 if $_ eq "OS2"; | 132 | $OS2=1 if $_ eq "OS2"; |
133 | $fips=1 if $_ eq "fips"; | ||
132 | 134 | ||
133 | $do_ssl=1 if $_ eq "ssleay"; | 135 | $do_ssl=1 if $_ eq "ssleay"; |
134 | if ($_ eq "ssl") { | 136 | if ($_ eq "ssl") { |
@@ -265,6 +267,7 @@ $crypto.=" crypto/ocsp/ocsp.h"; | |||
265 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; | 267 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; |
266 | $crypto.=" crypto/krb5/krb5_asn.h"; | 268 | $crypto.=" crypto/krb5/krb5_asn.h"; |
267 | $crypto.=" crypto/tmdiff.h"; | 269 | $crypto.=" crypto/tmdiff.h"; |
270 | $crypto.=" fips/fips.h fips/rand/fips_rand.h"; | ||
268 | 271 | ||
269 | my $symhacks="crypto/symhacks.h"; | 272 | my $symhacks="crypto/symhacks.h"; |
270 | 273 | ||
@@ -469,7 +472,7 @@ sub do_defs | |||
469 | push(@tag,$1); | 472 | push(@tag,$1); |
470 | $tag{$1}=-1; | 473 | $tag{$1}=-1; |
471 | } | 474 | } |
472 | } elsif (/^\#\s*ifdef\s+(.*)/) { | 475 | } elsif (/^\#\s*ifdef\s+(\S*)/) { |
473 | push(@tag,"-"); | 476 | push(@tag,"-"); |
474 | push(@tag,$1); | 477 | push(@tag,$1); |
475 | $tag{$1}=1; | 478 | $tag{$1}=1; |
@@ -794,7 +797,7 @@ sub do_defs | |||
794 | } | 797 | } |
795 | close(IN); | 798 | close(IN); |
796 | 799 | ||
797 | my $algs; | 800 | my $algs = ''; |
798 | my $plays; | 801 | my $plays; |
799 | 802 | ||
800 | print STDERR "DEBUG: postprocessing ----------\n" if $debug; | 803 | print STDERR "DEBUG: postprocessing ----------\n" if $debug; |
@@ -864,6 +867,7 @@ sub do_defs | |||
864 | 867 | ||
865 | $platform{$s} = | 868 | $platform{$s} = |
866 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); | 869 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); |
870 | $algorithm{$s} = '' if !defined $algorithm{$s}; | ||
867 | $algorithm{$s} .= ','.$a; | 871 | $algorithm{$s} .= ','.$a; |
868 | 872 | ||
869 | if (defined($variant{$s})) { | 873 | if (defined($variant{$s})) { |
@@ -1028,6 +1032,9 @@ sub is_valid | |||
1028 | if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { | 1032 | if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { |
1029 | return 1; | 1033 | return 1; |
1030 | } | 1034 | } |
1035 | if ($keyword eq "OPENSSL_FIPS" && $fips) { | ||
1036 | return 1; | ||
1037 | } | ||
1031 | return 0; | 1038 | return 0; |
1032 | } else { | 1039 | } else { |
1033 | # algorithms | 1040 | # algorithms |
@@ -1119,7 +1126,7 @@ sub print_test_file | |||
1119 | sub get_version { | 1126 | sub get_version { |
1120 | local *MF; | 1127 | local *MF; |
1121 | my $v = '?'; | 1128 | my $v = '?'; |
1122 | open MF, 'Makefile.ssl' or return $v; | 1129 | open MF, 'Makefile' or return $v; |
1123 | while (<MF>) { | 1130 | while (<MF>) { |
1124 | $v = $1, last if /^VERSION=(.*?)\s*$/; | 1131 | $v = $1, last if /^VERSION=(.*?)\s*$/; |
1125 | } | 1132 | } |
diff --git a/src/lib/libcrypto/util/mkerr.pl b/src/lib/libcrypto/util/mkerr.pl index 1b2915c767..60e534807e 100644 --- a/src/lib/libcrypto/util/mkerr.pl +++ b/src/lib/libcrypto/util/mkerr.pl | |||
@@ -41,7 +41,8 @@ while (@ARGV) { | |||
41 | } | 41 | } |
42 | 42 | ||
43 | if($recurse) { | 43 | if($recurse) { |
44 | @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>); | 44 | @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <fips/*.c>, |
45 | <fips/*/*.c>); | ||
45 | } else { | 46 | } else { |
46 | @source = @ARGV; | 47 | @source = @ARGV; |
47 | } | 48 | } |
@@ -262,7 +263,7 @@ foreach $lib (keys %csrc) | |||
262 | } else { | 263 | } else { |
263 | push @out, | 264 | push @out, |
264 | "/* ====================================================================\n", | 265 | "/* ====================================================================\n", |
265 | " * Copyright (c) 2001-2003 The OpenSSL Project. All rights reserved.\n", | 266 | " * Copyright (c) 2001-2005 The OpenSSL Project. All rights reserved.\n", |
266 | " *\n", | 267 | " *\n", |
267 | " * Redistribution and use in source and binary forms, with or without\n", | 268 | " * Redistribution and use in source and binary forms, with or without\n", |
268 | " * modification, are permitted provided that the following conditions\n", | 269 | " * modification, are permitted provided that the following conditions\n", |
@@ -404,7 +405,7 @@ EOF | |||
404 | print OUT <<"EOF"; | 405 | print OUT <<"EOF"; |
405 | /* $cfile */ | 406 | /* $cfile */ |
406 | /* ==================================================================== | 407 | /* ==================================================================== |
407 | * Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved. | 408 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. |
408 | * | 409 | * |
409 | * Redistribution and use in source and binary forms, with or without | 410 | * Redistribution and use in source and binary forms, with or without |
410 | * modification, are permitted provided that the following conditions | 411 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/util/mkfiles.pl b/src/lib/libcrypto/util/mkfiles.pl index 29e1404c69..928a274303 100644 --- a/src/lib/libcrypto/util/mkfiles.pl +++ b/src/lib/libcrypto/util/mkfiles.pl | |||
@@ -51,6 +51,14 @@ my @dirs = ( | |||
51 | "crypto/ocsp", | 51 | "crypto/ocsp", |
52 | "crypto/ui", | 52 | "crypto/ui", |
53 | "crypto/krb5", | 53 | "crypto/krb5", |
54 | "fips", | ||
55 | "fips/aes", | ||
56 | "fips/des", | ||
57 | "fips/dsa", | ||
58 | "fips/dh", | ||
59 | "fips/rand", | ||
60 | "fips/rsa", | ||
61 | "fips/sha1", | ||
54 | "ssl", | 62 | "ssl", |
55 | "apps", | 63 | "apps", |
56 | "test", | 64 | "test", |
@@ -58,7 +66,7 @@ my @dirs = ( | |||
58 | ); | 66 | ); |
59 | 67 | ||
60 | foreach (@dirs) { | 68 | foreach (@dirs) { |
61 | &files_dir ($_, "Makefile.ssl"); | 69 | &files_dir ($_, "Makefile"); |
62 | } | 70 | } |
63 | 71 | ||
64 | exit(0); | 72 | exit(0); |
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl index 9386da7aa4..c8653cecc3 100644 --- a/src/lib/libcrypto/util/mklink.pl +++ b/src/lib/libcrypto/util/mklink.pl | |||
@@ -52,6 +52,7 @@ $symlink_exists=eval {symlink("",""); 1}; | |||
52 | foreach $file (@files) { | 52 | foreach $file (@files) { |
53 | my $err = ""; | 53 | my $err = ""; |
54 | if ($symlink_exists) { | 54 | if ($symlink_exists) { |
55 | unlink "$from/$file"; | ||
55 | symlink("$to/$file", "$from/$file") or $err = " [$!]"; | 56 | symlink("$to/$file", "$from/$file") or $err = " [$!]"; |
56 | } else { | 57 | } else { |
57 | unlink "$from/$file"; | 58 | unlink "$from/$file"; |
diff --git a/src/lib/libcrypto/util/mkstack.pl b/src/lib/libcrypto/util/mkstack.pl index 085c50f790..0ca9eb6a76 100644 --- a/src/lib/libcrypto/util/mkstack.pl +++ b/src/lib/libcrypto/util/mkstack.pl | |||
@@ -84,6 +84,7 @@ while(<IN>) { | |||
84 | #define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st)) | 84 | #define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st)) |
85 | #define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st)) | 85 | #define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st)) |
86 | #define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st)) | 86 | #define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st)) |
87 | #define sk_${type_thing}_is_sorted(st) SKM_sk_is_sorted($type_thing, (st)) | ||
87 | EOF | 88 | EOF |
88 | } | 89 | } |
89 | foreach $type_thing (sort @asn1setlst) { | 90 | foreach $type_thing (sort @asn1setlst) { |
diff --git a/src/lib/libcrypto/util/pl/BC-16.pl b/src/lib/libcrypto/util/pl/BC-16.pl index 2033f524ca..8030653daa 100644 --- a/src/lib/libcrypto/util/pl/BC-16.pl +++ b/src/lib/libcrypto/util/pl/BC-16.pl | |||
@@ -64,7 +64,7 @@ $lfile=''; | |||
64 | 64 | ||
65 | $asm='bcc -c -B -Tml'; | 65 | $asm='bcc -c -B -Tml'; |
66 | $afile='/o'; | 66 | $afile='/o'; |
67 | if ($no_asm) | 67 | if ($no_asm || $fips) |
68 | { | 68 | { |
69 | $bn_asm_obj=''; | 69 | $bn_asm_obj=''; |
70 | $bn_asm_src=''; | 70 | $bn_asm_src=''; |
@@ -119,11 +119,11 @@ sub do_lib_rule | |||
119 | 119 | ||
120 | sub do_link_rule | 120 | sub do_link_rule |
121 | { | 121 | { |
122 | local($target,$files,$dep_libs,$libs)=@_; | 122 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
123 | local($ret,$f,$_,@f); | 123 | local($ret,$f,$_,@f); |
124 | 124 | ||
125 | $file =~ s/\//$o/g if $o ne '/'; | 125 | $file =~ s/\//$o/g if $o ne '/'; |
126 | $n=&bname($targer); | 126 | $n=&bname($target); |
127 | $ret.="$target: $files $dep_libs\n"; | 127 | $ret.="$target: $files $dep_libs\n"; |
128 | $ret.=" \$(LINK) @&&|"; | 128 | $ret.=" \$(LINK) @&&|"; |
129 | 129 | ||
@@ -139,7 +139,12 @@ sub do_link_rule | |||
139 | } | 139 | } |
140 | else | 140 | else |
141 | { $ret.="\n $r \$(APP_EX_OBJ) $files\n"; } | 141 | { $ret.="\n $r \$(APP_EX_OBJ) $files\n"; } |
142 | $ret.=" $target\n\n $libs\n\n|\n\n"; | 142 | $ret.=" $target\n\n $libs\n\n|\n"; |
143 | if (defined $sha1file) | ||
144 | { | ||
145 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
146 | } | ||
147 | $ret.="\n"; | ||
143 | return($ret); | 148 | return($ret); |
144 | } | 149 | } |
145 | 150 | ||
diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl index e83b336190..897ae9d824 100644 --- a/src/lib/libcrypto/util/pl/BC-32.pl +++ b/src/lib/libcrypto/util/pl/BC-32.pl | |||
@@ -62,7 +62,7 @@ $des_enc_src=''; | |||
62 | $bf_enc_obj=''; | 62 | $bf_enc_obj=''; |
63 | $bf_enc_src=''; | 63 | $bf_enc_src=''; |
64 | 64 | ||
65 | if (!$no_asm) | 65 | if (!$no_asm && !$fips) |
66 | { | 66 | { |
67 | $bn_mulw_obj='crypto\bn\asm\bn_win32.obj'; | 67 | $bn_mulw_obj='crypto\bn\asm\bn_win32.obj'; |
68 | $bn_mulw_src='crypto\bn\asm\bn_win32.asm'; | 68 | $bn_mulw_src='crypto\bn\asm\bn_win32.asm'; |
@@ -122,13 +122,18 @@ sub do_lib_rule | |||
122 | 122 | ||
123 | sub do_link_rule | 123 | sub do_link_rule |
124 | { | 124 | { |
125 | local($target,$files,$dep_libs,$libs)=@_; | 125 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
126 | local($ret,$_); | 126 | local($ret,$_); |
127 | 127 | ||
128 | $file =~ s/\//$o/g if $o ne '/'; | 128 | $file =~ s/\//$o/g if $o ne '/'; |
129 | $n=&bname($targer); | 129 | $n=&bname($targer); |
130 | $ret.="$target: $files $dep_libs\n"; | 130 | $ret.="$target: $files $dep_libs\n"; |
131 | $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n"; | 131 | $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n"; |
132 | if (defined $sha1file) | ||
133 | { | ||
134 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
135 | } | ||
136 | $ret.="\n"; | ||
132 | return($ret); | 137 | return($ret); |
133 | } | 138 | } |
134 | 139 | ||
diff --git a/src/lib/libcrypto/util/pl/Mingw32.pl b/src/lib/libcrypto/util/pl/Mingw32.pl index 4bee638c4a..b9bb24d21d 100644 --- a/src/lib/libcrypto/util/pl/Mingw32.pl +++ b/src/lib/libcrypto/util/pl/Mingw32.pl | |||
@@ -21,7 +21,7 @@ if ($debug) | |||
21 | else | 21 | else |
22 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -mcpu=i486 -Wall"; } | 22 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -mcpu=i486 -Wall"; } |
23 | 23 | ||
24 | if ($gaswin and !$no_asm) | 24 | if ($gaswin and !$no_asm and !$fips) |
25 | { | 25 | { |
26 | $bn_asm_obj='$(OBJ_D)\bn-win32.o'; | 26 | $bn_asm_obj='$(OBJ_D)\bn-win32.o'; |
27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; | 27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; |
@@ -92,13 +92,18 @@ sub do_lib_rule | |||
92 | 92 | ||
93 | sub do_link_rule | 93 | sub do_link_rule |
94 | { | 94 | { |
95 | local($target,$files,$dep_libs,$libs)=@_; | 95 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
96 | local($ret,$_); | 96 | local($ret,$_); |
97 | 97 | ||
98 | $file =~ s/\//$o/g if $o ne '/'; | 98 | $file =~ s/\//$o/g if $o ne '/'; |
99 | $n=&bname($target); | 99 | $n=&bname($target); |
100 | $ret.="$target: $files $dep_libs\n"; | 100 | $ret.="$target: $files $dep_libs\n"; |
101 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | 101 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n"; |
102 | if (defined $sha1file) | ||
103 | { | ||
104 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
105 | } | ||
106 | $ret.="\n"; | ||
102 | return($ret); | 107 | return($ret); |
103 | } | 108 | } |
104 | 1; | 109 | 1; |
diff --git a/src/lib/libcrypto/util/pl/OS2-EMX.pl b/src/lib/libcrypto/util/pl/OS2-EMX.pl index ddb3524210..75d72ebbcb 100644 --- a/src/lib/libcrypto/util/pl/OS2-EMX.pl +++ b/src/lib/libcrypto/util/pl/OS2-EMX.pl | |||
@@ -48,7 +48,7 @@ $des_enc_src=""; | |||
48 | $bf_enc_obj=""; | 48 | $bf_enc_obj=""; |
49 | $bf_enc_src=""; | 49 | $bf_enc_src=""; |
50 | 50 | ||
51 | if (!$no_asm) | 51 | if (!$no_asm && !$fips) |
52 | { | 52 | { |
53 | $bn_asm_obj="crypto/bn/asm/bn-os2$obj crypto/bn/asm/co-os2$obj"; | 53 | $bn_asm_obj="crypto/bn/asm/bn-os2$obj crypto/bn/asm/co-os2$obj"; |
54 | $bn_asm_src="crypto/bn/asm/bn-os2.asm crypto/bn/asm/co-os2.asm"; | 54 | $bn_asm_src="crypto/bn/asm/bn-os2.asm crypto/bn/asm/co-os2.asm"; |
@@ -106,13 +106,18 @@ sub do_lib_rule | |||
106 | 106 | ||
107 | sub do_link_rule | 107 | sub do_link_rule |
108 | { | 108 | { |
109 | local($target,$files,$dep_libs,$libs)=@_; | 109 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
110 | local($ret,$_); | 110 | local($ret,$_); |
111 | 111 | ||
112 | $file =~ s/\//$o/g if $o ne '/'; | 112 | $file =~ s/\//$o/g if $o ne '/'; |
113 | $n=&bname($target); | 113 | $n=&bname($target); |
114 | $ret.="$target: $files $dep_libs\n"; | 114 | $ret.="$target: $files $dep_libs\n"; |
115 | $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n"; | 115 | $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n"; |
116 | if (defined $sha1file) | ||
117 | { | ||
118 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
119 | } | ||
120 | $ret.="\n"; | ||
116 | return($ret); | 121 | return($ret); |
117 | } | 122 | } |
118 | 123 | ||
diff --git a/src/lib/libcrypto/util/pl/VC-16.pl b/src/lib/libcrypto/util/pl/VC-16.pl index 7cda5e67a9..564ba3fd08 100644 --- a/src/lib/libcrypto/util/pl/VC-16.pl +++ b/src/lib/libcrypto/util/pl/VC-16.pl | |||
@@ -61,7 +61,7 @@ if ($shlib) | |||
61 | else | 61 | else |
62 | { $mlflags=''; } | 62 | { $mlflags=''; } |
63 | 63 | ||
64 | $app_ex_obj="setargv.obj"; | 64 | $app_ex_obj=""; |
65 | 65 | ||
66 | $obj='.obj'; | 66 | $obj='.obj'; |
67 | $ofile="/Fo"; | 67 | $ofile="/Fo"; |
@@ -90,7 +90,7 @@ $des_enc_src=''; | |||
90 | $bf_enc_obj=''; | 90 | $bf_enc_obj=''; |
91 | $bf_enc_src=''; | 91 | $bf_enc_src=''; |
92 | 92 | ||
93 | if (!$no_asm) | 93 | if (!$no_asm && !$fips) |
94 | { | 94 | { |
95 | if ($asmbits == 32) | 95 | if ($asmbits == 32) |
96 | { | 96 | { |
@@ -147,7 +147,7 @@ sub do_lib_rule | |||
147 | 147 | ||
148 | sub do_link_rule | 148 | sub do_link_rule |
149 | { | 149 | { |
150 | local($target,$files,$dep_libs,$libs)=@_; | 150 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
151 | local($ret,$f,$_,@f); | 151 | local($ret,$f,$_,@f); |
152 | 152 | ||
153 | $file =~ s/\//$o/g if $o ne '/'; | 153 | $file =~ s/\//$o/g if $o ne '/'; |
@@ -165,7 +165,12 @@ sub do_link_rule | |||
165 | } | 165 | } |
166 | else | 166 | else |
167 | { $ret.=" \$(APP_EX_OBJ) $files"; } | 167 | { $ret.=" \$(APP_EX_OBJ) $files"; } |
168 | $ret.="\n $target\n\n $libs\n\n<<\n\n"; | 168 | $ret.="\n $target\n\n $libs\n\n<<\n"; |
169 | if (defined $sha1file) | ||
170 | { | ||
171 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
172 | } | ||
173 | $ret.="\n"; | ||
169 | return($ret); | 174 | return($ret); |
170 | } | 175 | } |
171 | 176 | ||
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl index 285990c589..cf689b9feb 100644 --- a/src/lib/libcrypto/util/pl/VC-32.pl +++ b/src/lib/libcrypto/util/pl/VC-32.pl | |||
@@ -64,7 +64,7 @@ $des_enc_src=''; | |||
64 | $bf_enc_obj=''; | 64 | $bf_enc_obj=''; |
65 | $bf_enc_src=''; | 65 | $bf_enc_src=''; |
66 | 66 | ||
67 | if (!$no_asm) | 67 | if (!$no_asm && !$fips) |
68 | { | 68 | { |
69 | $bn_asm_obj='crypto\bn\asm\bn_win32.obj'; | 69 | $bn_asm_obj='crypto\bn\asm\bn_win32.obj'; |
70 | $bn_asm_src='crypto\bn\asm\bn_win32.asm'; | 70 | $bn_asm_src='crypto\bn\asm\bn_win32.asm'; |
@@ -126,14 +126,19 @@ sub do_lib_rule | |||
126 | 126 | ||
127 | sub do_link_rule | 127 | sub do_link_rule |
128 | { | 128 | { |
129 | local($target,$files,$dep_libs,$libs)=@_; | 129 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
130 | local($ret,$_); | 130 | local($ret,$_); |
131 | 131 | ||
132 | $file =~ s/\//$o/g if $o ne '/'; | 132 | $file =~ s/\//$o/g if $o ne '/'; |
133 | $n=&bname($targer); | 133 | $n=&bname($targer); |
134 | $ret.="$target: $files $dep_libs\n"; | 134 | $ret.="$target: $files $dep_libs\n"; |
135 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; | 135 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; |
136 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n\n"; | 136 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; |
137 | if (defined $sha1file) | ||
138 | { | ||
139 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
140 | } | ||
141 | $ret.="\n"; | ||
137 | return($ret); | 142 | return($ret); |
138 | } | 143 | } |
139 | 144 | ||
diff --git a/src/lib/libcrypto/util/pl/linux.pl b/src/lib/libcrypto/util/pl/linux.pl index 8924ed5480..df05c40526 100644 --- a/src/lib/libcrypto/util/pl/linux.pl +++ b/src/lib/libcrypto/util/pl/linux.pl | |||
@@ -72,13 +72,18 @@ sub do_shlib_rule | |||
72 | 72 | ||
73 | sub do_link_rule | 73 | sub do_link_rule |
74 | { | 74 | { |
75 | local($target,$files,$dep_libs,$libs)=@_; | 75 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
76 | local($ret,$_); | 76 | local($ret,$_); |
77 | 77 | ||
78 | $file =~ s/\//$o/g if $o ne '/'; | 78 | $file =~ s/\//$o/g if $o ne '/'; |
79 | $n=&bname($target); | 79 | $n=&bname($target); |
80 | $ret.="$target: $files $dep_libs\n"; | 80 | $ret.="$target: $files $dep_libs\n"; |
81 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | 81 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n"; |
82 | if (defined $sha1file) | ||
83 | { | ||
84 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
85 | } | ||
86 | $ret.="\n"; | ||
82 | return($ret); | 87 | return($ret); |
83 | } | 88 | } |
84 | 89 | ||
diff --git a/src/lib/libcrypto/util/pl/ultrix.pl b/src/lib/libcrypto/util/pl/ultrix.pl index ea370c71f9..447b854708 100644 --- a/src/lib/libcrypto/util/pl/ultrix.pl +++ b/src/lib/libcrypto/util/pl/ultrix.pl | |||
@@ -17,7 +17,7 @@ else | |||
17 | 17 | ||
18 | $cflags.=" -std1 -DL_ENDIAN"; | 18 | $cflags.=" -std1 -DL_ENDIAN"; |
19 | 19 | ||
20 | if (!$no_asm) | 20 | if (!$no_asm && !$fips) |
21 | { | 21 | { |
22 | $bn_asm_obj='$(OBJ_D)/mips1.o'; | 22 | $bn_asm_obj='$(OBJ_D)/mips1.o'; |
23 | $bn_asm_src='crypto/bn/asm/mips1.s'; | 23 | $bn_asm_src='crypto/bn/asm/mips1.s'; |
@@ -25,13 +25,18 @@ if (!$no_asm) | |||
25 | 25 | ||
26 | sub do_link_rule | 26 | sub do_link_rule |
27 | { | 27 | { |
28 | local($target,$files,$dep_libs,$libs)=@_; | 28 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
29 | local($ret,$_); | 29 | local($ret,$_); |
30 | 30 | ||
31 | $file =~ s/\//$o/g if $o ne '/'; | 31 | $file =~ s/\//$o/g if $o ne '/'; |
32 | $n=&bname($target); | 32 | $n=&bname($target); |
33 | $ret.="$target: $files $dep_libs\n"; | 33 | $ret.="$target: $files $dep_libs\n"; |
34 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | 34 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n"; |
35 | if (defined $sha1file) | ||
36 | { | ||
37 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
38 | } | ||
39 | $ret.="\n"; | ||
35 | return($ret); | 40 | return($ret); |
36 | } | 41 | } |
37 | 42 | ||
diff --git a/src/lib/libcrypto/util/pl/unix.pl b/src/lib/libcrypto/util/pl/unix.pl index 146611ad99..bbd1798a2e 100644 --- a/src/lib/libcrypto/util/pl/unix.pl +++ b/src/lib/libcrypto/util/pl/unix.pl | |||
@@ -70,13 +70,18 @@ sub do_lib_rule | |||
70 | 70 | ||
71 | sub do_link_rule | 71 | sub do_link_rule |
72 | { | 72 | { |
73 | local($target,$files,$dep_libs,$libs)=@_; | 73 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
74 | local($ret,$_); | 74 | local($ret,$_); |
75 | 75 | ||
76 | $file =~ s/\//$o/g if $o ne '/'; | 76 | $file =~ s/\//$o/g if $o ne '/'; |
77 | $n=&bname($target); | 77 | $n=&bname($target); |
78 | $ret.="$target: $files $dep_libs\n"; | 78 | $ret.="$target: $files $dep_libs\n"; |
79 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | 79 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n"; |
80 | if (defined $sha1file) | ||
81 | { | ||
82 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
83 | } | ||
84 | $ret.="\n"; | ||
80 | return($ret); | 85 | return($ret); |
81 | } | 86 | } |
82 | 87 | ||
diff --git a/src/lib/libcrypto/util/selftest.pl b/src/lib/libcrypto/util/selftest.pl index 276b81183d..e9d5aa8938 100644 --- a/src/lib/libcrypto/util/selftest.pl +++ b/src/lib/libcrypto/util/selftest.pl | |||
@@ -34,9 +34,9 @@ foreach $_ (split("\n",$c)) { | |||
34 | $platform0=$1 if (/Configuring for (.*)$/); | 34 | $platform0=$1 if (/Configuring for (.*)$/); |
35 | } | 35 | } |
36 | 36 | ||
37 | system "sh config" if (! -f "Makefile.ssl"); | 37 | system "sh config" if (! -f "Makefile"); |
38 | 38 | ||
39 | if (open(IN,"<Makefile.ssl")) { | 39 | if (open(IN,"<Makefile")) { |
40 | while (<IN>) { | 40 | while (<IN>) { |
41 | $version=$1 if (/^VERSION=(.*)$/); | 41 | $version=$1 if (/^VERSION=(.*)$/); |
42 | $platform=$1 if (/^PLATFORM=(.*)$/); | 42 | $platform=$1 if (/^PLATFORM=(.*)$/); |
diff --git a/src/lib/libcrypto/x509/by_file.c b/src/lib/libcrypto/x509/by_file.c index b4b04183d0..a5e0d4aefa 100644 --- a/src/lib/libcrypto/x509/by_file.c +++ b/src/lib/libcrypto/x509/by_file.c | |||
@@ -150,7 +150,7 @@ int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type) | |||
150 | x=PEM_read_bio_X509_AUX(in,NULL,NULL,NULL); | 150 | x=PEM_read_bio_X509_AUX(in,NULL,NULL,NULL); |
151 | if (x == NULL) | 151 | if (x == NULL) |
152 | { | 152 | { |
153 | if ((ERR_GET_REASON(ERR_peek_error()) == | 153 | if ((ERR_GET_REASON(ERR_peek_last_error()) == |
154 | PEM_R_NO_START_LINE) && (count > 0)) | 154 | PEM_R_NO_START_LINE) && (count > 0)) |
155 | { | 155 | { |
156 | ERR_clear_error(); | 156 | ERR_clear_error(); |
@@ -217,7 +217,7 @@ int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) | |||
217 | x=PEM_read_bio_X509_CRL(in,NULL,NULL,NULL); | 217 | x=PEM_read_bio_X509_CRL(in,NULL,NULL,NULL); |
218 | if (x == NULL) | 218 | if (x == NULL) |
219 | { | 219 | { |
220 | if ((ERR_GET_REASON(ERR_peek_error()) == | 220 | if ((ERR_GET_REASON(ERR_peek_last_error()) == |
221 | PEM_R_NO_START_LINE) && (count > 0)) | 221 | PEM_R_NO_START_LINE) && (count > 0)) |
222 | { | 222 | { |
223 | ERR_clear_error(); | 223 | ERR_clear_error(); |
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h index 8d0c7e2e17..e8c1a59cf2 100644 --- a/src/lib/libcrypto/x509/x509.h +++ b/src/lib/libcrypto/x509/x509.h | |||
@@ -410,6 +410,7 @@ typedef struct X509_crl_info_st | |||
410 | ASN1_TIME *nextUpdate; | 410 | ASN1_TIME *nextUpdate; |
411 | STACK_OF(X509_REVOKED) *revoked; | 411 | STACK_OF(X509_REVOKED) *revoked; |
412 | STACK_OF(X509_EXTENSION) /* [0] */ *extensions; | 412 | STACK_OF(X509_EXTENSION) /* [0] */ *extensions; |
413 | ASN1_ENCODING enc; | ||
413 | } X509_CRL_INFO; | 414 | } X509_CRL_INFO; |
414 | 415 | ||
415 | struct X509_crl_st | 416 | struct X509_crl_st |
@@ -1037,18 +1038,18 @@ int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, | |||
1037 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, | 1038 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, |
1038 | unsigned char *bytes, int len, int loc, int set); | 1039 | unsigned char *bytes, int len, int loc, int set); |
1039 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, | 1040 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, |
1040 | char *field, int type, unsigned char *bytes, int len); | 1041 | const char *field, int type, const unsigned char *bytes, int len); |
1041 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, | 1042 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, |
1042 | int type,unsigned char *bytes, int len); | 1043 | int type,unsigned char *bytes, int len); |
1043 | int X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type, | 1044 | int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, |
1044 | unsigned char *bytes, int len, int loc, int set); | 1045 | const unsigned char *bytes, int len, int loc, int set); |
1045 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, | 1046 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, |
1046 | ASN1_OBJECT *obj, int type,unsigned char *bytes, | 1047 | ASN1_OBJECT *obj, int type,const unsigned char *bytes, |
1047 | int len); | 1048 | int len); |
1048 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, | 1049 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, |
1049 | ASN1_OBJECT *obj); | 1050 | ASN1_OBJECT *obj); |
1050 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, | 1051 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, |
1051 | unsigned char *bytes, int len); | 1052 | const unsigned char *bytes, int len); |
1052 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); | 1053 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); |
1053 | ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); | 1054 | ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); |
1054 | 1055 | ||
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c index f460102f49..030d0966fc 100644 --- a/src/lib/libcrypto/x509/x509_cmp.c +++ b/src/lib/libcrypto/x509/x509_cmp.c | |||
@@ -254,33 +254,49 @@ static int nocase_spacenorm_cmp(const ASN1_STRING *a, const ASN1_STRING *b) | |||
254 | return 0; | 254 | return 0; |
255 | } | 255 | } |
256 | 256 | ||
257 | static int asn1_string_memcmp(ASN1_STRING *a, ASN1_STRING *b) | ||
258 | { | ||
259 | int j; | ||
260 | j = a->length - b->length; | ||
261 | if (j) | ||
262 | return j; | ||
263 | return memcmp(a->data, b->data, a->length); | ||
264 | } | ||
265 | |||
266 | #define STR_TYPE_CMP (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_UTF8STRING) | ||
267 | |||
257 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b) | 268 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b) |
258 | { | 269 | { |
259 | int i,j; | 270 | int i,j; |
260 | X509_NAME_ENTRY *na,*nb; | 271 | X509_NAME_ENTRY *na,*nb; |
261 | 272 | ||
262 | if (sk_X509_NAME_ENTRY_num(a->entries) | 273 | unsigned long nabit, nbbit; |
263 | != sk_X509_NAME_ENTRY_num(b->entries)) | 274 | |
264 | return sk_X509_NAME_ENTRY_num(a->entries) | 275 | j = sk_X509_NAME_ENTRY_num(a->entries) |
265 | -sk_X509_NAME_ENTRY_num(b->entries); | 276 | - sk_X509_NAME_ENTRY_num(b->entries); |
277 | if (j) | ||
278 | return j; | ||
266 | for (i=sk_X509_NAME_ENTRY_num(a->entries)-1; i>=0; i--) | 279 | for (i=sk_X509_NAME_ENTRY_num(a->entries)-1; i>=0; i--) |
267 | { | 280 | { |
268 | na=sk_X509_NAME_ENTRY_value(a->entries,i); | 281 | na=sk_X509_NAME_ENTRY_value(a->entries,i); |
269 | nb=sk_X509_NAME_ENTRY_value(b->entries,i); | 282 | nb=sk_X509_NAME_ENTRY_value(b->entries,i); |
270 | j=na->value->type-nb->value->type; | 283 | j=na->value->type-nb->value->type; |
271 | if (j) return(j); | 284 | if (j) |
272 | if (na->value->type == V_ASN1_PRINTABLESTRING) | 285 | { |
286 | nabit = ASN1_tag2bit(na->value->type); | ||
287 | nbbit = ASN1_tag2bit(nb->value->type); | ||
288 | if (!(nabit & STR_TYPE_CMP) || | ||
289 | !(nbbit & STR_TYPE_CMP)) | ||
290 | return j; | ||
291 | j = asn1_string_memcmp(na->value, nb->value); | ||
292 | } | ||
293 | else if (na->value->type == V_ASN1_PRINTABLESTRING) | ||
273 | j=nocase_spacenorm_cmp(na->value, nb->value); | 294 | j=nocase_spacenorm_cmp(na->value, nb->value); |
274 | else if (na->value->type == V_ASN1_IA5STRING | 295 | else if (na->value->type == V_ASN1_IA5STRING |
275 | && OBJ_obj2nid(na->object) == NID_pkcs9_emailAddress) | 296 | && OBJ_obj2nid(na->object) == NID_pkcs9_emailAddress) |
276 | j=nocase_cmp(na->value, nb->value); | 297 | j=nocase_cmp(na->value, nb->value); |
277 | else | 298 | else |
278 | { | 299 | j = asn1_string_memcmp(na->value, nb->value); |
279 | j=na->value->length-nb->value->length; | ||
280 | if (j) return(j); | ||
281 | j=memcmp(na->value->data,nb->value->data, | ||
282 | na->value->length); | ||
283 | } | ||
284 | if (j) return(j); | 300 | if (j) return(j); |
285 | j=na->set-nb->set; | 301 | j=na->set-nb->set; |
286 | if (j) return(j); | 302 | if (j) return(j); |
@@ -306,10 +322,16 @@ unsigned long X509_NAME_hash(X509_NAME *x) | |||
306 | { | 322 | { |
307 | unsigned long ret=0; | 323 | unsigned long ret=0; |
308 | unsigned char md[16]; | 324 | unsigned char md[16]; |
325 | EVP_MD_CTX md_ctx; | ||
309 | 326 | ||
310 | /* Make sure X509_NAME structure contains valid cached encoding */ | 327 | /* Make sure X509_NAME structure contains valid cached encoding */ |
311 | i2d_X509_NAME(x,NULL); | 328 | i2d_X509_NAME(x,NULL); |
312 | EVP_Digest(x->bytes->data, x->bytes->length, md, NULL, EVP_md5(), NULL); | 329 | EVP_MD_CTX_init(&md_ctx); |
330 | EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
331 | EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL); | ||
332 | EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length); | ||
333 | EVP_DigestFinal_ex(&md_ctx,md,NULL); | ||
334 | EVP_MD_CTX_cleanup(&md_ctx); | ||
313 | 335 | ||
314 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| | 336 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| |
315 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) | 337 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) |
diff --git a/src/lib/libcrypto/x509/x509_r2x.c b/src/lib/libcrypto/x509/x509_r2x.c index db051033d9..fb8a78dabe 100644 --- a/src/lib/libcrypto/x509/x509_r2x.c +++ b/src/lib/libcrypto/x509/x509_r2x.c | |||
@@ -92,8 +92,10 @@ X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey) | |||
92 | X509_set_subject_name(ret,X509_NAME_dup(xn)); | 92 | X509_set_subject_name(ret,X509_NAME_dup(xn)); |
93 | X509_set_issuer_name(ret,X509_NAME_dup(xn)); | 93 | X509_set_issuer_name(ret,X509_NAME_dup(xn)); |
94 | 94 | ||
95 | X509_gmtime_adj(xi->validity->notBefore,0); | 95 | if (X509_gmtime_adj(xi->validity->notBefore,0) == NULL) |
96 | X509_gmtime_adj(xi->validity->notAfter,(long)60*60*24*days); | 96 | goto err; |
97 | if (X509_gmtime_adj(xi->validity->notAfter,(long)60*60*24*days) == NULL) | ||
98 | goto err; | ||
97 | 99 | ||
98 | X509_set_pubkey(ret,X509_REQ_get_pubkey(r)); | 100 | X509_set_pubkey(ret,X509_REQ_get_pubkey(r)); |
99 | 101 | ||
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c index 0affa3bf30..59fc6ca548 100644 --- a/src/lib/libcrypto/x509/x509_req.c +++ b/src/lib/libcrypto/x509/x509_req.c | |||
@@ -118,7 +118,7 @@ EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req) | |||
118 | * used and there may be more: so the list is configurable. | 118 | * used and there may be more: so the list is configurable. |
119 | */ | 119 | */ |
120 | 120 | ||
121 | static int ext_nid_list[] = { NID_ms_ext_req, NID_ext_req, NID_undef}; | 121 | static int ext_nid_list[] = { NID_ext_req, NID_ms_ext_req, NID_undef}; |
122 | 122 | ||
123 | static int *ext_nids = ext_nid_list; | 123 | static int *ext_nids = ext_nid_list; |
124 | 124 | ||
@@ -143,32 +143,33 @@ void X509_REQ_set_extension_nids(int *nids) | |||
143 | } | 143 | } |
144 | 144 | ||
145 | STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req) | 145 | STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req) |
146 | { | 146 | { |
147 | X509_ATTRIBUTE *attr; | 147 | X509_ATTRIBUTE *attr; |
148 | STACK_OF(X509_ATTRIBUTE) *sk; | ||
149 | ASN1_TYPE *ext = NULL; | 148 | ASN1_TYPE *ext = NULL; |
150 | int i; | 149 | int idx, *pnid; |
151 | unsigned char *p; | 150 | unsigned char *p; |
152 | if ((req == NULL) || (req->req_info == NULL)) | 151 | |
152 | if ((req == NULL) || (req->req_info == NULL) || !ext_nids) | ||
153 | return(NULL); | 153 | return(NULL); |
154 | sk=req->req_info->attributes; | 154 | for (pnid = ext_nids; *pnid != NID_undef; pnid++) |
155 | if (!sk) return NULL; | 155 | { |
156 | for(i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) { | 156 | idx = X509_REQ_get_attr_by_NID(req, *pnid, -1); |
157 | attr = sk_X509_ATTRIBUTE_value(sk, i); | 157 | if (idx == -1) |
158 | if(X509_REQ_extension_nid(OBJ_obj2nid(attr->object))) { | 158 | continue; |
159 | if(attr->single) ext = attr->value.single; | 159 | attr = X509_REQ_get_attr(req, idx); |
160 | else if(sk_ASN1_TYPE_num(attr->value.set)) | 160 | if(attr->single) ext = attr->value.single; |
161 | ext = sk_ASN1_TYPE_value(attr->value.set, 0); | 161 | else if(sk_ASN1_TYPE_num(attr->value.set)) |
162 | break; | 162 | ext = sk_ASN1_TYPE_value(attr->value.set, 0); |
163 | break; | ||
163 | } | 164 | } |
164 | } | 165 | if(!ext || (ext->type != V_ASN1_SEQUENCE)) |
165 | if(!ext || (ext->type != V_ASN1_SEQUENCE)) return NULL; | 166 | return NULL; |
166 | p = ext->value.sequence->data; | 167 | p = ext->value.sequence->data; |
167 | return d2i_ASN1_SET_OF_X509_EXTENSION(NULL, &p, | 168 | return d2i_ASN1_SET_OF_X509_EXTENSION(NULL, &p, |
168 | ext->value.sequence->length, | 169 | ext->value.sequence->length, |
169 | d2i_X509_EXTENSION, X509_EXTENSION_free, | 170 | d2i_X509_EXTENSION, X509_EXTENSION_free, |
170 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); | 171 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); |
171 | } | 172 | } |
172 | 173 | ||
173 | /* Add a STACK_OF extensions to a certificate request: allow alternative OIDs | 174 | /* Add a STACK_OF extensions to a certificate request: allow alternative OIDs |
174 | * in case we want to create a non standard one. | 175 | * in case we want to create a non standard one. |
diff --git a/src/lib/libcrypto/x509/x509_txt.c b/src/lib/libcrypto/x509/x509_txt.c index e31ebc6741..f19e66a238 100644 --- a/src/lib/libcrypto/x509/x509_txt.c +++ b/src/lib/libcrypto/x509/x509_txt.c | |||
@@ -122,8 +122,14 @@ const char *X509_verify_cert_error_string(long n) | |||
122 | return("certificate revoked"); | 122 | return("certificate revoked"); |
123 | case X509_V_ERR_INVALID_CA: | 123 | case X509_V_ERR_INVALID_CA: |
124 | return ("invalid CA certificate"); | 124 | return ("invalid CA certificate"); |
125 | case X509_V_ERR_INVALID_NON_CA: | ||
126 | return ("invalid non-CA certificate (has CA markings)"); | ||
125 | case X509_V_ERR_PATH_LENGTH_EXCEEDED: | 127 | case X509_V_ERR_PATH_LENGTH_EXCEEDED: |
126 | return ("path length constraint exceeded"); | 128 | return ("path length constraint exceeded"); |
129 | case X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED: | ||
130 | return("proxy path length constraint exceeded"); | ||
131 | case X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED: | ||
132 | return("proxy cerificates not allowed, please set the appropriate flag"); | ||
127 | case X509_V_ERR_INVALID_PURPOSE: | 133 | case X509_V_ERR_INVALID_PURPOSE: |
128 | return ("unsupported certificate purpose"); | 134 | return ("unsupported certificate purpose"); |
129 | case X509_V_ERR_CERT_UNTRUSTED: | 135 | case X509_V_ERR_CERT_UNTRUSTED: |
@@ -140,19 +146,16 @@ const char *X509_verify_cert_error_string(long n) | |||
140 | return("authority and issuer serial number mismatch"); | 146 | return("authority and issuer serial number mismatch"); |
141 | case X509_V_ERR_KEYUSAGE_NO_CERTSIGN: | 147 | case X509_V_ERR_KEYUSAGE_NO_CERTSIGN: |
142 | return("key usage does not include certificate signing"); | 148 | return("key usage does not include certificate signing"); |
143 | |||
144 | case X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER: | 149 | case X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER: |
145 | return("unable to get CRL issuer certificate"); | 150 | return("unable to get CRL issuer certificate"); |
146 | |||
147 | case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION: | 151 | case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION: |
148 | return("unhandled critical extension"); | 152 | return("unhandled critical extension"); |
149 | |||
150 | case X509_V_ERR_KEYUSAGE_NO_CRL_SIGN: | 153 | case X509_V_ERR_KEYUSAGE_NO_CRL_SIGN: |
151 | return("key usage does not include CRL signing"); | 154 | return("key usage does not include CRL signing"); |
152 | 155 | case X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE: | |
156 | return("key usage does not include digital signature"); | ||
153 | case X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION: | 157 | case X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION: |
154 | return("unhandled critical CRL extension"); | 158 | return("unhandled critical CRL extension"); |
155 | |||
156 | default: | 159 | default: |
157 | BIO_snprintf(buf,sizeof buf,"error number %ld",n); | 160 | BIO_snprintf(buf,sizeof buf,"error number %ld",n); |
158 | return(buf); | 161 | return(buf); |
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index 2e4d0b823a..e43c861ee7 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
@@ -73,7 +73,7 @@ | |||
73 | static int null_callback(int ok,X509_STORE_CTX *e); | 73 | static int null_callback(int ok,X509_STORE_CTX *e); |
74 | static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); | 74 | static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); |
75 | static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x); | 75 | static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x); |
76 | static int check_chain_purpose(X509_STORE_CTX *ctx); | 76 | static int check_chain_extensions(X509_STORE_CTX *ctx); |
77 | static int check_trust(X509_STORE_CTX *ctx); | 77 | static int check_trust(X509_STORE_CTX *ctx); |
78 | static int check_revocation(X509_STORE_CTX *ctx); | 78 | static int check_revocation(X509_STORE_CTX *ctx); |
79 | static int check_cert(X509_STORE_CTX *ctx); | 79 | static int check_cert(X509_STORE_CTX *ctx); |
@@ -281,7 +281,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx) | |||
281 | } | 281 | } |
282 | 282 | ||
283 | /* We have the chain complete: now we need to check its purpose */ | 283 | /* We have the chain complete: now we need to check its purpose */ |
284 | if (ctx->purpose > 0) ok = check_chain_purpose(ctx); | 284 | ok = check_chain_extensions(ctx); |
285 | 285 | ||
286 | if (!ok) goto end; | 286 | if (!ok) goto end; |
287 | 287 | ||
@@ -365,21 +365,39 @@ static int get_issuer_sk(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) | |||
365 | else | 365 | else |
366 | return 0; | 366 | return 0; |
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | /* Check a certificate chains extensions for consistency | 370 | /* Check a certificate chains extensions for consistency |
371 | * with the supplied purpose | 371 | * with the supplied purpose |
372 | */ | 372 | */ |
373 | 373 | ||
374 | static int check_chain_purpose(X509_STORE_CTX *ctx) | 374 | static int check_chain_extensions(X509_STORE_CTX *ctx) |
375 | { | 375 | { |
376 | #ifdef OPENSSL_NO_CHAIN_VERIFY | 376 | #ifdef OPENSSL_NO_CHAIN_VERIFY |
377 | return 1; | 377 | return 1; |
378 | #else | 378 | #else |
379 | int i, ok=0; | 379 | int i, ok=0, must_be_ca; |
380 | X509 *x; | 380 | X509 *x; |
381 | int (*cb)(); | 381 | int (*cb)(); |
382 | int proxy_path_length = 0; | ||
383 | int allow_proxy_certs = !!(ctx->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); | ||
382 | cb=ctx->verify_cb; | 384 | cb=ctx->verify_cb; |
385 | |||
386 | /* must_be_ca can have 1 of 3 values: | ||
387 | -1: we accept both CA and non-CA certificates, to allow direct | ||
388 | use of self-signed certificates (which are marked as CA). | ||
389 | 0: we only accept non-CA certificates. This is currently not | ||
390 | used, but the possibility is present for future extensions. | ||
391 | 1: we only accept CA certificates. This is currently used for | ||
392 | all certificates in the chain except the leaf certificate. | ||
393 | */ | ||
394 | must_be_ca = -1; | ||
395 | |||
396 | /* A hack to keep people who don't want to modify their software | ||
397 | happy */ | ||
398 | if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) | ||
399 | allow_proxy_certs = 1; | ||
400 | |||
383 | /* Check all untrusted certificates */ | 401 | /* Check all untrusted certificates */ |
384 | for (i = 0; i < ctx->last_untrusted; i++) | 402 | for (i = 0; i < ctx->last_untrusted; i++) |
385 | { | 403 | { |
@@ -394,23 +412,73 @@ static int check_chain_purpose(X509_STORE_CTX *ctx) | |||
394 | ok=cb(0,ctx); | 412 | ok=cb(0,ctx); |
395 | if (!ok) goto end; | 413 | if (!ok) goto end; |
396 | } | 414 | } |
397 | ret = X509_check_purpose(x, ctx->purpose, i); | 415 | if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) |
398 | if ((ret == 0) | ||
399 | || ((ctx->flags & X509_V_FLAG_X509_STRICT) | ||
400 | && (ret != 1))) | ||
401 | { | 416 | { |
402 | if (i) | 417 | ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; |
418 | ctx->error_depth = i; | ||
419 | ctx->current_cert = x; | ||
420 | ok=cb(0,ctx); | ||
421 | if (!ok) goto end; | ||
422 | } | ||
423 | ret = X509_check_ca(x); | ||
424 | switch(must_be_ca) | ||
425 | { | ||
426 | case -1: | ||
427 | if ((ctx->flags & X509_V_FLAG_X509_STRICT) | ||
428 | && (ret != 1) && (ret != 0)) | ||
429 | { | ||
430 | ret = 0; | ||
403 | ctx->error = X509_V_ERR_INVALID_CA; | 431 | ctx->error = X509_V_ERR_INVALID_CA; |
432 | } | ||
404 | else | 433 | else |
405 | ctx->error = X509_V_ERR_INVALID_PURPOSE; | 434 | ret = 1; |
435 | break; | ||
436 | case 0: | ||
437 | if (ret != 0) | ||
438 | { | ||
439 | ret = 0; | ||
440 | ctx->error = X509_V_ERR_INVALID_NON_CA; | ||
441 | } | ||
442 | else | ||
443 | ret = 1; | ||
444 | break; | ||
445 | default: | ||
446 | if ((ret == 0) | ||
447 | || ((ctx->flags & X509_V_FLAG_X509_STRICT) | ||
448 | && (ret != 1))) | ||
449 | { | ||
450 | ret = 0; | ||
451 | ctx->error = X509_V_ERR_INVALID_CA; | ||
452 | } | ||
453 | else | ||
454 | ret = 1; | ||
455 | break; | ||
456 | } | ||
457 | if (ret == 0) | ||
458 | { | ||
406 | ctx->error_depth = i; | 459 | ctx->error_depth = i; |
407 | ctx->current_cert = x; | 460 | ctx->current_cert = x; |
408 | ok=cb(0,ctx); | 461 | ok=cb(0,ctx); |
409 | if (!ok) goto end; | 462 | if (!ok) goto end; |
410 | } | 463 | } |
464 | if (ctx->purpose > 0) | ||
465 | { | ||
466 | ret = X509_check_purpose(x, ctx->purpose, | ||
467 | must_be_ca > 0); | ||
468 | if ((ret == 0) | ||
469 | || ((ctx->flags & X509_V_FLAG_X509_STRICT) | ||
470 | && (ret != 1))) | ||
471 | { | ||
472 | ctx->error = X509_V_ERR_INVALID_PURPOSE; | ||
473 | ctx->error_depth = i; | ||
474 | ctx->current_cert = x; | ||
475 | ok=cb(0,ctx); | ||
476 | if (!ok) goto end; | ||
477 | } | ||
478 | } | ||
411 | /* Check pathlen */ | 479 | /* Check pathlen */ |
412 | if ((i > 1) && (x->ex_pathlen != -1) | 480 | if ((i > 1) && (x->ex_pathlen != -1) |
413 | && (i > (x->ex_pathlen + 1))) | 481 | && (i > (x->ex_pathlen + proxy_path_length + 1))) |
414 | { | 482 | { |
415 | ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; | 483 | ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; |
416 | ctx->error_depth = i; | 484 | ctx->error_depth = i; |
@@ -418,6 +486,32 @@ static int check_chain_purpose(X509_STORE_CTX *ctx) | |||
418 | ok=cb(0,ctx); | 486 | ok=cb(0,ctx); |
419 | if (!ok) goto end; | 487 | if (!ok) goto end; |
420 | } | 488 | } |
489 | /* If this certificate is a proxy certificate, the next | ||
490 | certificate must be another proxy certificate or a EE | ||
491 | certificate. If not, the next certificate must be a | ||
492 | CA certificate. */ | ||
493 | if (x->ex_flags & EXFLAG_PROXY) | ||
494 | { | ||
495 | PROXY_CERT_INFO_EXTENSION *pci = | ||
496 | X509_get_ext_d2i(x, NID_proxyCertInfo, | ||
497 | NULL, NULL); | ||
498 | if (pci->pcPathLengthConstraint && | ||
499 | ASN1_INTEGER_get(pci->pcPathLengthConstraint) | ||
500 | < i) | ||
501 | { | ||
502 | PROXY_CERT_INFO_EXTENSION_free(pci); | ||
503 | ctx->error = X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED; | ||
504 | ctx->error_depth = i; | ||
505 | ctx->current_cert = x; | ||
506 | ok=cb(0,ctx); | ||
507 | if (!ok) goto end; | ||
508 | } | ||
509 | PROXY_CERT_INFO_EXTENSION_free(pci); | ||
510 | proxy_path_length++; | ||
511 | must_be_ca = 0; | ||
512 | } | ||
513 | else | ||
514 | must_be_ca = 1; | ||
421 | } | 515 | } |
422 | ok = 1; | 516 | ok = 1; |
423 | end: | 517 | end: |
@@ -627,6 +721,15 @@ static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x) | |||
627 | X509_EXTENSION *ext; | 721 | X509_EXTENSION *ext; |
628 | /* Look for serial number of certificate in CRL */ | 722 | /* Look for serial number of certificate in CRL */ |
629 | rtmp.serialNumber = X509_get_serialNumber(x); | 723 | rtmp.serialNumber = X509_get_serialNumber(x); |
724 | /* Sort revoked into serial number order if not already sorted. | ||
725 | * Do this under a lock to avoid race condition. | ||
726 | */ | ||
727 | if (!sk_X509_REVOKED_is_sorted(crl->crl->revoked)) | ||
728 | { | ||
729 | CRYPTO_w_lock(CRYPTO_LOCK_X509_CRL); | ||
730 | sk_X509_REVOKED_sort(crl->crl->revoked); | ||
731 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_CRL); | ||
732 | } | ||
630 | idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp); | 733 | idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp); |
631 | /* If found assume revoked: want something cleverer than | 734 | /* If found assume revoked: want something cleverer than |
632 | * this to handle entry extensions in V2 CRLs. | 735 | * this to handle entry extensions in V2 CRLs. |
@@ -772,6 +875,7 @@ static int internal_verify(X509_STORE_CTX *ctx) | |||
772 | } | 875 | } |
773 | 876 | ||
774 | /* The last error (if any) is still in the error value */ | 877 | /* The last error (if any) is still in the error value */ |
878 | ctx->current_issuer=xi; | ||
775 | ctx->current_cert=xs; | 879 | ctx->current_cert=xs; |
776 | ok=(*cb)(1,ctx); | 880 | ok=(*cb)(1,ctx); |
777 | if (!ok) goto end; | 881 | if (!ok) goto end; |
@@ -851,7 +955,8 @@ int X509_cmp_time(ASN1_TIME *ctm, time_t *cmp_time) | |||
851 | atm.length=sizeof(buff2); | 955 | atm.length=sizeof(buff2); |
852 | atm.data=(unsigned char *)buff2; | 956 | atm.data=(unsigned char *)buff2; |
853 | 957 | ||
854 | X509_time_adj(&atm,-offset*60, cmp_time); | 958 | if (X509_time_adj(&atm,-offset*60, cmp_time) == NULL) |
959 | return 0; | ||
855 | 960 | ||
856 | if (ctm->type == V_ASN1_UTCTIME) | 961 | if (ctm->type == V_ASN1_UTCTIME) |
857 | { | 962 | { |
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h index 198495884c..7fd1f0bc4d 100644 --- a/src/lib/libcrypto/x509/x509_vfy.h +++ b/src/lib/libcrypto/x509/x509_vfy.h | |||
@@ -276,7 +276,7 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
276 | #define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 | 276 | #define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 |
277 | #define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 | 277 | #define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 |
278 | #define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 | 278 | #define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 |
279 | #define X509_V_ERR_CERT_NOT_YET_VALID 9 | 279 | #define X509_V_ERR_CERT_NOT_YET_VALID 9 |
280 | #define X509_V_ERR_CERT_HAS_EXPIRED 10 | 280 | #define X509_V_ERR_CERT_HAS_EXPIRED 10 |
281 | #define X509_V_ERR_CRL_NOT_YET_VALID 11 | 281 | #define X509_V_ERR_CRL_NOT_YET_VALID 11 |
282 | #define X509_V_ERR_CRL_HAS_EXPIRED 12 | 282 | #define X509_V_ERR_CRL_HAS_EXPIRED 12 |
@@ -306,6 +306,10 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
306 | #define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 | 306 | #define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 |
307 | #define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 | 307 | #define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 |
308 | #define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 | 308 | #define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 |
309 | #define X509_V_ERR_INVALID_NON_CA 37 | ||
310 | #define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 | ||
311 | #define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 | ||
312 | #define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 | ||
309 | 313 | ||
310 | /* The application is not happy */ | 314 | /* The application is not happy */ |
311 | #define X509_V_ERR_APPLICATION_VERIFICATION 50 | 315 | #define X509_V_ERR_APPLICATION_VERIFICATION 50 |
@@ -324,6 +328,8 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
324 | #define X509_V_FLAG_IGNORE_CRITICAL 0x10 | 328 | #define X509_V_FLAG_IGNORE_CRITICAL 0x10 |
325 | /* Disable workarounds for broken certificates */ | 329 | /* Disable workarounds for broken certificates */ |
326 | #define X509_V_FLAG_X509_STRICT 0x20 | 330 | #define X509_V_FLAG_X509_STRICT 0x20 |
331 | /* Enable proxy certificate validation */ | ||
332 | #define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 | ||
327 | 333 | ||
328 | int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, | 334 | int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, |
329 | X509_NAME *name); | 335 | X509_NAME *name); |
diff --git a/src/lib/libcrypto/x509/x509cset.c b/src/lib/libcrypto/x509/x509cset.c index 6cac440ea9..9d1646d5c8 100644 --- a/src/lib/libcrypto/x509/x509cset.c +++ b/src/lib/libcrypto/x509/x509cset.c | |||
@@ -129,6 +129,7 @@ int X509_CRL_sort(X509_CRL *c) | |||
129 | r=sk_X509_REVOKED_value(c->crl->revoked,i); | 129 | r=sk_X509_REVOKED_value(c->crl->revoked,i); |
130 | r->sequence=i; | 130 | r->sequence=i; |
131 | } | 131 | } |
132 | c->crl->enc.modified = 1; | ||
132 | return 1; | 133 | return 1; |
133 | } | 134 | } |
134 | 135 | ||
diff --git a/src/lib/libcrypto/x509/x509name.c b/src/lib/libcrypto/x509/x509name.c index 4c20e03ece..068abfe5f0 100644 --- a/src/lib/libcrypto/x509/x509name.c +++ b/src/lib/libcrypto/x509/x509name.c | |||
@@ -195,8 +195,8 @@ int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, | |||
195 | return ret; | 195 | return ret; |
196 | } | 196 | } |
197 | 197 | ||
198 | int X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type, | 198 | int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, |
199 | unsigned char *bytes, int len, int loc, int set) | 199 | const unsigned char *bytes, int len, int loc, int set) |
200 | { | 200 | { |
201 | X509_NAME_ENTRY *ne; | 201 | X509_NAME_ENTRY *ne; |
202 | int ret; | 202 | int ret; |
@@ -273,7 +273,7 @@ err: | |||
273 | } | 273 | } |
274 | 274 | ||
275 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, | 275 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, |
276 | char *field, int type, unsigned char *bytes, int len) | 276 | const char *field, int type, const unsigned char *bytes, int len) |
277 | { | 277 | { |
278 | ASN1_OBJECT *obj; | 278 | ASN1_OBJECT *obj; |
279 | X509_NAME_ENTRY *nentry; | 279 | X509_NAME_ENTRY *nentry; |
@@ -309,7 +309,7 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, | |||
309 | } | 309 | } |
310 | 310 | ||
311 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, | 311 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, |
312 | ASN1_OBJECT *obj, int type, unsigned char *bytes, int len) | 312 | ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len) |
313 | { | 313 | { |
314 | X509_NAME_ENTRY *ret; | 314 | X509_NAME_ENTRY *ret; |
315 | 315 | ||
@@ -347,7 +347,7 @@ int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj) | |||
347 | } | 347 | } |
348 | 348 | ||
349 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, | 349 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, |
350 | unsigned char *bytes, int len) | 350 | const unsigned char *bytes, int len) |
351 | { | 351 | { |
352 | int i; | 352 | int i; |
353 | 353 | ||
diff --git a/src/lib/libcrypto/x509/x_all.c b/src/lib/libcrypto/x509/x_all.c index fb5015cd4d..ac6dea493a 100644 --- a/src/lib/libcrypto/x509/x_all.c +++ b/src/lib/libcrypto/x509/x_all.c | |||
@@ -103,6 +103,7 @@ int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md) | |||
103 | 103 | ||
104 | int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md) | 104 | int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md) |
105 | { | 105 | { |
106 | x->crl->enc.modified = 1; | ||
106 | return(ASN1_item_sign(ASN1_ITEM_rptr(X509_CRL_INFO),x->crl->sig_alg, | 107 | return(ASN1_item_sign(ASN1_ITEM_rptr(X509_CRL_INFO),x->crl->sig_alg, |
107 | x->sig_alg, x->signature, x->crl,pkey,md)); | 108 | x->sig_alg, x->signature, x->crl,pkey,md)); |
108 | } | 109 | } |
diff --git a/src/lib/libcrypto/x509v3/ext_dat.h b/src/lib/libcrypto/x509v3/ext_dat.h index 5442480595..d8328ac468 100644 --- a/src/lib/libcrypto/x509v3/ext_dat.h +++ b/src/lib/libcrypto/x509v3/ext_dat.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -60,10 +60,11 @@ | |||
60 | extern X509V3_EXT_METHOD v3_bcons, v3_nscert, v3_key_usage, v3_ext_ku; | 60 | extern X509V3_EXT_METHOD v3_bcons, v3_nscert, v3_key_usage, v3_ext_ku; |
61 | extern X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo; | 61 | extern X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo; |
62 | extern X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_id; | 62 | extern X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_id; |
63 | extern X509V3_EXT_METHOD v3_crl_num, v3_crl_reason, v3_crl_invdate, v3_cpols, v3_crld; | 63 | extern X509V3_EXT_METHOD v3_crl_num, v3_crl_reason, v3_crl_invdate; |
64 | extern X509V3_EXT_METHOD v3_delta_crl, v3_cpols, v3_crld; | ||
64 | extern X509V3_EXT_METHOD v3_ocsp_nonce, v3_ocsp_accresp, v3_ocsp_acutoff; | 65 | extern X509V3_EXT_METHOD v3_ocsp_nonce, v3_ocsp_accresp, v3_ocsp_acutoff; |
65 | extern X509V3_EXT_METHOD v3_ocsp_crlid, v3_ocsp_nocheck, v3_ocsp_serviceloc; | 66 | extern X509V3_EXT_METHOD v3_ocsp_crlid, v3_ocsp_nocheck, v3_ocsp_serviceloc; |
66 | extern X509V3_EXT_METHOD v3_crl_hold; | 67 | extern X509V3_EXT_METHOD v3_crl_hold, v3_pci; |
67 | 68 | ||
68 | /* This table will be searched using OBJ_bsearch so it *must* kept in | 69 | /* This table will be searched using OBJ_bsearch so it *must* kept in |
69 | * order of the ext_nid values. | 70 | * order of the ext_nid values. |
@@ -89,6 +90,7 @@ static X509V3_EXT_METHOD *standard_exts[] = { | |||
89 | &v3_akey_id, | 90 | &v3_akey_id, |
90 | &v3_crld, | 91 | &v3_crld, |
91 | &v3_ext_ku, | 92 | &v3_ext_ku, |
93 | &v3_delta_crl, | ||
92 | &v3_crl_reason, | 94 | &v3_crl_reason, |
93 | #ifndef OPENSSL_NO_OCSP | 95 | #ifndef OPENSSL_NO_OCSP |
94 | &v3_crl_invdate, | 96 | &v3_crl_invdate, |
@@ -105,8 +107,9 @@ static X509V3_EXT_METHOD *standard_exts[] = { | |||
105 | #endif | 107 | #endif |
106 | &v3_sinfo, | 108 | &v3_sinfo, |
107 | #ifndef OPENSSL_NO_OCSP | 109 | #ifndef OPENSSL_NO_OCSP |
108 | &v3_crl_hold | 110 | &v3_crl_hold, |
109 | #endif | 111 | #endif |
112 | &v3_pci, | ||
110 | }; | 113 | }; |
111 | 114 | ||
112 | /* Number of standard extensions */ | 115 | /* Number of standard extensions */ |
diff --git a/src/lib/libcrypto/x509v3/v3_bitst.c b/src/lib/libcrypto/x509v3/v3_bitst.c index 16cf125562..274965306d 100644 --- a/src/lib/libcrypto/x509v3/v3_bitst.c +++ b/src/lib/libcrypto/x509v3/v3_bitst.c | |||
@@ -124,7 +124,12 @@ static ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, | |||
124 | for(bnam = method->usr_data; bnam->lname; bnam++) { | 124 | for(bnam = method->usr_data; bnam->lname; bnam++) { |
125 | if(!strcmp(bnam->sname, val->name) || | 125 | if(!strcmp(bnam->sname, val->name) || |
126 | !strcmp(bnam->lname, val->name) ) { | 126 | !strcmp(bnam->lname, val->name) ) { |
127 | ASN1_BIT_STRING_set_bit(bs, bnam->bitnum, 1); | 127 | if(!ASN1_BIT_STRING_set_bit(bs, bnam->bitnum, 1)) { |
128 | X509V3err(X509V3_F_V2I_ASN1_BIT_STRING, | ||
129 | ERR_R_MALLOC_FAILURE); | ||
130 | M_ASN1_BIT_STRING_free(bs); | ||
131 | return NULL; | ||
132 | } | ||
128 | break; | 133 | break; |
129 | } | 134 | } |
130 | } | 135 | } |
diff --git a/src/lib/libcrypto/x509v3/v3_ia5.c b/src/lib/libcrypto/x509v3/v3_ia5.c index f9414456de..9683afa47c 100644 --- a/src/lib/libcrypto/x509v3/v3_ia5.c +++ b/src/lib/libcrypto/x509v3/v3_ia5.c | |||
@@ -82,7 +82,10 @@ static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | |||
82 | { | 82 | { |
83 | char *tmp; | 83 | char *tmp; |
84 | if(!ia5 || !ia5->length) return NULL; | 84 | if(!ia5 || !ia5->length) return NULL; |
85 | if (!(tmp = OPENSSL_malloc(ia5->length + 1))) return NULL; | 85 | if(!(tmp = OPENSSL_malloc(ia5->length + 1))) { |
86 | X509V3err(X509V3_F_I2S_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); | ||
87 | return NULL; | ||
88 | } | ||
86 | memcpy(tmp, ia5->data, ia5->length); | 89 | memcpy(tmp, ia5->data, ia5->length); |
87 | tmp[ia5->length] = 0; | 90 | tmp[ia5->length] = 0; |
88 | return tmp; | 91 | return tmp; |
diff --git a/src/lib/libcrypto/x509v3/v3_int.c b/src/lib/libcrypto/x509v3/v3_int.c index f34cbfb731..7a43b4717b 100644 --- a/src/lib/libcrypto/x509v3/v3_int.c +++ b/src/lib/libcrypto/x509v3/v3_int.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -61,9 +61,16 @@ | |||
61 | #include <openssl/x509v3.h> | 61 | #include <openssl/x509v3.h> |
62 | 62 | ||
63 | X509V3_EXT_METHOD v3_crl_num = { | 63 | X509V3_EXT_METHOD v3_crl_num = { |
64 | NID_crl_number, 0, ASN1_ITEM_ref(ASN1_INTEGER), | 64 | NID_crl_number, 0, ASN1_ITEM_ref(ASN1_INTEGER), |
65 | 0,0,0,0, | 65 | 0,0,0,0, |
66 | (X509V3_EXT_I2S)i2s_ASN1_INTEGER, | 66 | (X509V3_EXT_I2S)i2s_ASN1_INTEGER, |
67 | 0, | 67 | 0, |
68 | 0,0,0,0, NULL}; | 68 | 0,0,0,0, NULL}; |
69 | |||
70 | X509V3_EXT_METHOD v3_delta_crl = { | ||
71 | NID_delta_crl, 0, ASN1_ITEM_ref(ASN1_INTEGER), | ||
72 | 0,0,0,0, | ||
73 | (X509V3_EXT_I2S)i2s_ASN1_INTEGER, | ||
74 | 0, | ||
75 | 0,0,0,0, NULL}; | ||
69 | 76 | ||
diff --git a/src/lib/libcrypto/x509v3/v3_purp.c b/src/lib/libcrypto/x509v3/v3_purp.c index b3d1ae5d1c..bbdf6da493 100644 --- a/src/lib/libcrypto/x509v3/v3_purp.c +++ b/src/lib/libcrypto/x509v3/v3_purp.c | |||
@@ -63,7 +63,6 @@ | |||
63 | 63 | ||
64 | static void x509v3_cache_extensions(X509 *x); | 64 | static void x509v3_cache_extensions(X509 *x); |
65 | 65 | ||
66 | static int ca_check(const X509 *x); | ||
67 | static int check_ssl_ca(const X509 *x); | 66 | static int check_ssl_ca(const X509 *x); |
68 | static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, int ca); | 67 | static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, int ca); |
69 | static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x, int ca); | 68 | static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x, int ca); |
@@ -286,7 +285,8 @@ int X509_supported_extension(X509_EXTENSION *ex) | |||
286 | NID_key_usage, /* 83 */ | 285 | NID_key_usage, /* 83 */ |
287 | NID_subject_alt_name, /* 85 */ | 286 | NID_subject_alt_name, /* 85 */ |
288 | NID_basic_constraints, /* 87 */ | 287 | NID_basic_constraints, /* 87 */ |
289 | NID_ext_key_usage /* 126 */ | 288 | NID_ext_key_usage, /* 126 */ |
289 | NID_proxyCertInfo /* 661 */ | ||
290 | }; | 290 | }; |
291 | 291 | ||
292 | int ex_nid; | 292 | int ex_nid; |
@@ -307,6 +307,7 @@ int X509_supported_extension(X509_EXTENSION *ex) | |||
307 | static void x509v3_cache_extensions(X509 *x) | 307 | static void x509v3_cache_extensions(X509 *x) |
308 | { | 308 | { |
309 | BASIC_CONSTRAINTS *bs; | 309 | BASIC_CONSTRAINTS *bs; |
310 | PROXY_CERT_INFO_EXTENSION *pci; | ||
310 | ASN1_BIT_STRING *usage; | 311 | ASN1_BIT_STRING *usage; |
311 | ASN1_BIT_STRING *ns; | 312 | ASN1_BIT_STRING *ns; |
312 | EXTENDED_KEY_USAGE *extusage; | 313 | EXTENDED_KEY_USAGE *extusage; |
@@ -335,6 +336,16 @@ static void x509v3_cache_extensions(X509 *x) | |||
335 | BASIC_CONSTRAINTS_free(bs); | 336 | BASIC_CONSTRAINTS_free(bs); |
336 | x->ex_flags |= EXFLAG_BCONS; | 337 | x->ex_flags |= EXFLAG_BCONS; |
337 | } | 338 | } |
339 | /* Handle proxy certificates */ | ||
340 | if((pci=X509_get_ext_d2i(x, NID_proxyCertInfo, NULL, NULL))) { | ||
341 | if (x->ex_flags & EXFLAG_CA | ||
342 | || X509_get_ext_by_NID(x, NID_subject_alt_name, 0) >= 0 | ||
343 | || X509_get_ext_by_NID(x, NID_issuer_alt_name, 0) >= 0) { | ||
344 | x->ex_flags |= EXFLAG_INVALID; | ||
345 | } | ||
346 | PROXY_CERT_INFO_EXTENSION_free(pci); | ||
347 | x->ex_flags |= EXFLAG_PROXY; | ||
348 | } | ||
338 | /* Handle key usage */ | 349 | /* Handle key usage */ |
339 | if((usage=X509_get_ext_d2i(x, NID_key_usage, NULL, NULL))) { | 350 | if((usage=X509_get_ext_d2i(x, NID_key_usage, NULL, NULL))) { |
340 | if(usage->length > 0) { | 351 | if(usage->length > 0) { |
@@ -426,7 +437,7 @@ static void x509v3_cache_extensions(X509 *x) | |||
426 | #define ns_reject(x, usage) \ | 437 | #define ns_reject(x, usage) \ |
427 | (((x)->ex_flags & EXFLAG_NSCERT) && !((x)->ex_nscert & (usage))) | 438 | (((x)->ex_flags & EXFLAG_NSCERT) && !((x)->ex_nscert & (usage))) |
428 | 439 | ||
429 | static int ca_check(const X509 *x) | 440 | static int check_ca(const X509 *x) |
430 | { | 441 | { |
431 | /* keyUsage if present should allow cert signing */ | 442 | /* keyUsage if present should allow cert signing */ |
432 | if(ku_reject(x, KU_KEY_CERT_SIGN)) return 0; | 443 | if(ku_reject(x, KU_KEY_CERT_SIGN)) return 0; |
@@ -435,25 +446,37 @@ static int ca_check(const X509 *x) | |||
435 | /* If basicConstraints says not a CA then say so */ | 446 | /* If basicConstraints says not a CA then say so */ |
436 | else return 0; | 447 | else return 0; |
437 | } else { | 448 | } else { |
449 | /* we support V1 roots for... uh, I don't really know why. */ | ||
438 | if((x->ex_flags & V1_ROOT) == V1_ROOT) return 3; | 450 | if((x->ex_flags & V1_ROOT) == V1_ROOT) return 3; |
439 | /* If key usage present it must have certSign so tolerate it */ | 451 | /* If key usage present it must have certSign so tolerate it */ |
440 | else if (x->ex_flags & EXFLAG_KUSAGE) return 4; | 452 | else if (x->ex_flags & EXFLAG_KUSAGE) return 4; |
441 | else return 2; | 453 | /* Older certificates could have Netscape-specific CA types */ |
454 | else if (x->ex_flags & EXFLAG_NSCERT | ||
455 | && x->ex_nscert & NS_ANY_CA) return 5; | ||
456 | /* can this still be regarded a CA certificate? I doubt it */ | ||
457 | return 0; | ||
442 | } | 458 | } |
443 | } | 459 | } |
444 | 460 | ||
461 | int X509_check_ca(X509 *x) | ||
462 | { | ||
463 | if(!(x->ex_flags & EXFLAG_SET)) { | ||
464 | CRYPTO_w_lock(CRYPTO_LOCK_X509); | ||
465 | x509v3_cache_extensions(x); | ||
466 | CRYPTO_w_unlock(CRYPTO_LOCK_X509); | ||
467 | } | ||
468 | |||
469 | return check_ca(x); | ||
470 | } | ||
471 | |||
445 | /* Check SSL CA: common checks for SSL client and server */ | 472 | /* Check SSL CA: common checks for SSL client and server */ |
446 | static int check_ssl_ca(const X509 *x) | 473 | static int check_ssl_ca(const X509 *x) |
447 | { | 474 | { |
448 | int ca_ret; | 475 | int ca_ret; |
449 | ca_ret = ca_check(x); | 476 | ca_ret = check_ca(x); |
450 | if(!ca_ret) return 0; | 477 | if(!ca_ret) return 0; |
451 | /* check nsCertType if present */ | 478 | /* check nsCertType if present */ |
452 | if(x->ex_flags & EXFLAG_NSCERT) { | 479 | if(ca_ret != 5 || x->ex_nscert & NS_SSL_CA) return ca_ret; |
453 | if(x->ex_nscert & NS_SSL_CA) return ca_ret; | ||
454 | return 0; | ||
455 | } | ||
456 | if(ca_ret != 2) return ca_ret; | ||
457 | else return 0; | 480 | else return 0; |
458 | } | 481 | } |
459 | 482 | ||
@@ -498,14 +521,10 @@ static int purpose_smime(const X509 *x, int ca) | |||
498 | if(xku_reject(x,XKU_SMIME)) return 0; | 521 | if(xku_reject(x,XKU_SMIME)) return 0; |
499 | if(ca) { | 522 | if(ca) { |
500 | int ca_ret; | 523 | int ca_ret; |
501 | ca_ret = ca_check(x); | 524 | ca_ret = check_ca(x); |
502 | if(!ca_ret) return 0; | 525 | if(!ca_ret) return 0; |
503 | /* check nsCertType if present */ | 526 | /* check nsCertType if present */ |
504 | if(x->ex_flags & EXFLAG_NSCERT) { | 527 | if(ca_ret != 5 || x->ex_nscert & NS_SMIME_CA) return ca_ret; |
505 | if(x->ex_nscert & NS_SMIME_CA) return ca_ret; | ||
506 | return 0; | ||
507 | } | ||
508 | if(ca_ret != 2) return ca_ret; | ||
509 | else return 0; | 528 | else return 0; |
510 | } | 529 | } |
511 | if(x->ex_flags & EXFLAG_NSCERT) { | 530 | if(x->ex_flags & EXFLAG_NSCERT) { |
@@ -539,7 +558,7 @@ static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, int ca) | |||
539 | { | 558 | { |
540 | if(ca) { | 559 | if(ca) { |
541 | int ca_ret; | 560 | int ca_ret; |
542 | if((ca_ret = ca_check(x)) != 2) return ca_ret; | 561 | if((ca_ret = check_ca(x)) != 2) return ca_ret; |
543 | else return 0; | 562 | else return 0; |
544 | } | 563 | } |
545 | if(ku_reject(x, KU_CRL_SIGN)) return 0; | 564 | if(ku_reject(x, KU_CRL_SIGN)) return 0; |
@@ -552,17 +571,9 @@ static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, int ca) | |||
552 | 571 | ||
553 | static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca) | 572 | static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca) |
554 | { | 573 | { |
555 | /* Must be a valid CA */ | 574 | /* Must be a valid CA. Should we really support the "I don't know" |
556 | if(ca) { | 575 | value (2)? */ |
557 | int ca_ret; | 576 | if(ca) return check_ca(x); |
558 | ca_ret = ca_check(x); | ||
559 | if(ca_ret != 2) return ca_ret; | ||
560 | if(x->ex_flags & EXFLAG_NSCERT) { | ||
561 | if(x->ex_nscert & NS_ANY_CA) return ca_ret; | ||
562 | return 0; | ||
563 | } | ||
564 | return 0; | ||
565 | } | ||
566 | /* leaf certificate is checked in OCSP_verify() */ | 577 | /* leaf certificate is checked in OCSP_verify() */ |
567 | return 1; | 578 | return 1; |
568 | } | 579 | } |
@@ -624,7 +635,13 @@ int X509_check_issued(X509 *issuer, X509 *subject) | |||
624 | return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH; | 635 | return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH; |
625 | } | 636 | } |
626 | } | 637 | } |
627 | if(ku_reject(issuer, KU_KEY_CERT_SIGN)) return X509_V_ERR_KEYUSAGE_NO_CERTSIGN; | 638 | if(subject->ex_flags & EXFLAG_PROXY) |
639 | { | ||
640 | if(ku_reject(issuer, KU_DIGITAL_SIGNATURE)) | ||
641 | return X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE; | ||
642 | } | ||
643 | else if(ku_reject(issuer, KU_KEY_CERT_SIGN)) | ||
644 | return X509_V_ERR_KEYUSAGE_NO_CERTSIGN; | ||
628 | return X509_V_OK; | 645 | return X509_V_OK; |
629 | } | 646 | } |
630 | 647 | ||
diff --git a/src/lib/libcrypto/x509v3/v3err.c b/src/lib/libcrypto/x509v3/v3err.c index 6458e95bb9..2df0c3ef01 100644 --- a/src/lib/libcrypto/x509v3/v3err.c +++ b/src/lib/libcrypto/x509v3/v3err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/x509v3/v3err.c */ | 1 | /* crypto/x509v3/v3err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2005 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 |
@@ -72,12 +72,14 @@ static ERR_STRING_DATA X509V3_str_functs[]= | |||
72 | {ERR_PACK(0,X509V3_F_DO_EXT_I2D,0), "DO_EXT_I2D"}, | 72 | {ERR_PACK(0,X509V3_F_DO_EXT_I2D,0), "DO_EXT_I2D"}, |
73 | {ERR_PACK(0,X509V3_F_HEX_TO_STRING,0), "hex_to_string"}, | 73 | {ERR_PACK(0,X509V3_F_HEX_TO_STRING,0), "hex_to_string"}, |
74 | {ERR_PACK(0,X509V3_F_I2S_ASN1_ENUMERATED,0), "i2s_ASN1_ENUMERATED"}, | 74 | {ERR_PACK(0,X509V3_F_I2S_ASN1_ENUMERATED,0), "i2s_ASN1_ENUMERATED"}, |
75 | {ERR_PACK(0,X509V3_F_I2S_ASN1_IA5STRING,0), "I2S_ASN1_IA5STRING"}, | ||
75 | {ERR_PACK(0,X509V3_F_I2S_ASN1_INTEGER,0), "i2s_ASN1_INTEGER"}, | 76 | {ERR_PACK(0,X509V3_F_I2S_ASN1_INTEGER,0), "i2s_ASN1_INTEGER"}, |
76 | {ERR_PACK(0,X509V3_F_I2V_AUTHORITY_INFO_ACCESS,0), "I2V_AUTHORITY_INFO_ACCESS"}, | 77 | {ERR_PACK(0,X509V3_F_I2V_AUTHORITY_INFO_ACCESS,0), "I2V_AUTHORITY_INFO_ACCESS"}, |
77 | {ERR_PACK(0,X509V3_F_NOTICE_SECTION,0), "NOTICE_SECTION"}, | 78 | {ERR_PACK(0,X509V3_F_NOTICE_SECTION,0), "NOTICE_SECTION"}, |
78 | {ERR_PACK(0,X509V3_F_NREF_NOS,0), "NREF_NOS"}, | 79 | {ERR_PACK(0,X509V3_F_NREF_NOS,0), "NREF_NOS"}, |
79 | {ERR_PACK(0,X509V3_F_POLICY_SECTION,0), "POLICY_SECTION"}, | 80 | {ERR_PACK(0,X509V3_F_POLICY_SECTION,0), "POLICY_SECTION"}, |
80 | {ERR_PACK(0,X509V3_F_R2I_CERTPOL,0), "R2I_CERTPOL"}, | 81 | {ERR_PACK(0,X509V3_F_R2I_CERTPOL,0), "R2I_CERTPOL"}, |
82 | {ERR_PACK(0,X509V3_F_R2I_PCI,0), "R2I_PCI"}, | ||
81 | {ERR_PACK(0,X509V3_F_S2I_ASN1_IA5STRING,0), "S2I_ASN1_IA5STRING"}, | 83 | {ERR_PACK(0,X509V3_F_S2I_ASN1_IA5STRING,0), "S2I_ASN1_IA5STRING"}, |
82 | {ERR_PACK(0,X509V3_F_S2I_ASN1_INTEGER,0), "s2i_ASN1_INTEGER"}, | 84 | {ERR_PACK(0,X509V3_F_S2I_ASN1_INTEGER,0), "s2i_ASN1_INTEGER"}, |
83 | {ERR_PACK(0,X509V3_F_S2I_ASN1_OCTET_STRING,0), "s2i_ASN1_OCTET_STRING"}, | 85 | {ERR_PACK(0,X509V3_F_S2I_ASN1_OCTET_STRING,0), "s2i_ASN1_OCTET_STRING"}, |
@@ -128,6 +130,7 @@ static ERR_STRING_DATA X509V3_str_reasons[]= | |||
128 | {X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED,"extension setting not supported"}, | 130 | {X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED,"extension setting not supported"}, |
129 | {X509V3_R_EXTENSION_VALUE_ERROR ,"extension value error"}, | 131 | {X509V3_R_EXTENSION_VALUE_ERROR ,"extension value error"}, |
130 | {X509V3_R_ILLEGAL_HEX_DIGIT ,"illegal hex digit"}, | 132 | {X509V3_R_ILLEGAL_HEX_DIGIT ,"illegal hex digit"}, |
133 | {X509V3_R_INCORRECT_POLICY_SYNTAX_TAG ,"incorrect policy syntax tag"}, | ||
131 | {X509V3_R_INVALID_BOOLEAN_STRING ,"invalid boolean string"}, | 134 | {X509V3_R_INVALID_BOOLEAN_STRING ,"invalid boolean string"}, |
132 | {X509V3_R_INVALID_EXTENSION_STRING ,"invalid extension string"}, | 135 | {X509V3_R_INVALID_EXTENSION_STRING ,"invalid extension string"}, |
133 | {X509V3_R_INVALID_NAME ,"invalid name"}, | 136 | {X509V3_R_INVALID_NAME ,"invalid name"}, |
@@ -139,6 +142,8 @@ static ERR_STRING_DATA X509V3_str_reasons[]= | |||
139 | {X509V3_R_INVALID_OBJECT_IDENTIFIER ,"invalid object identifier"}, | 142 | {X509V3_R_INVALID_OBJECT_IDENTIFIER ,"invalid object identifier"}, |
140 | {X509V3_R_INVALID_OPTION ,"invalid option"}, | 143 | {X509V3_R_INVALID_OPTION ,"invalid option"}, |
141 | {X509V3_R_INVALID_POLICY_IDENTIFIER ,"invalid policy identifier"}, | 144 | {X509V3_R_INVALID_POLICY_IDENTIFIER ,"invalid policy identifier"}, |
145 | {X509V3_R_INVALID_PROXY_POLICY_IDENTIFIER,"invalid proxy policy identifier"}, | ||
146 | {X509V3_R_INVALID_PROXY_POLICY_SETTING ,"invalid proxy policy setting"}, | ||
142 | {X509V3_R_INVALID_PURPOSE ,"invalid purpose"}, | 147 | {X509V3_R_INVALID_PURPOSE ,"invalid purpose"}, |
143 | {X509V3_R_INVALID_SECTION ,"invalid section"}, | 148 | {X509V3_R_INVALID_SECTION ,"invalid section"}, |
144 | {X509V3_R_INVALID_SYNTAX ,"invalid syntax"}, | 149 | {X509V3_R_INVALID_SYNTAX ,"invalid syntax"}, |
@@ -149,9 +154,16 @@ static ERR_STRING_DATA X509V3_str_reasons[]= | |||
149 | {X509V3_R_NO_ISSUER_CERTIFICATE ,"no issuer certificate"}, | 154 | {X509V3_R_NO_ISSUER_CERTIFICATE ,"no issuer certificate"}, |
150 | {X509V3_R_NO_ISSUER_DETAILS ,"no issuer details"}, | 155 | {X509V3_R_NO_ISSUER_DETAILS ,"no issuer details"}, |
151 | {X509V3_R_NO_POLICY_IDENTIFIER ,"no policy identifier"}, | 156 | {X509V3_R_NO_POLICY_IDENTIFIER ,"no policy identifier"}, |
157 | {X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED,"no proxy cert policy language defined"}, | ||
152 | {X509V3_R_NO_PUBLIC_KEY ,"no public key"}, | 158 | {X509V3_R_NO_PUBLIC_KEY ,"no public key"}, |
153 | {X509V3_R_NO_SUBJECT_DETAILS ,"no subject details"}, | 159 | {X509V3_R_NO_SUBJECT_DETAILS ,"no subject details"}, |
154 | {X509V3_R_ODD_NUMBER_OF_DIGITS ,"odd number of digits"}, | 160 | {X509V3_R_ODD_NUMBER_OF_DIGITS ,"odd number of digits"}, |
161 | {X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED,"policy language alreadty defined"}, | ||
162 | {X509V3_R_POLICY_PATH_LENGTH ,"policy path length"}, | ||
163 | {X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED,"policy path length alreadty defined"}, | ||
164 | {X509V3_R_POLICY_SYNTAX_NOT ,"policy syntax not"}, | ||
165 | {X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED,"policy syntax not currently supported"}, | ||
166 | {X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY,"policy when proxy language requires no policy"}, | ||
155 | {X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS ,"unable to get issuer details"}, | 167 | {X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS ,"unable to get issuer details"}, |
156 | {X509V3_R_UNABLE_TO_GET_ISSUER_KEYID ,"unable to get issuer keyid"}, | 168 | {X509V3_R_UNABLE_TO_GET_ISSUER_KEYID ,"unable to get issuer keyid"}, |
157 | {X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT ,"unknown bit string argument"}, | 169 | {X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT ,"unknown bit string argument"}, |
diff --git a/src/lib/libcrypto/x509v3/x509v3.h b/src/lib/libcrypto/x509v3/x509v3.h index fb07a19016..e6d91251c2 100644 --- a/src/lib/libcrypto/x509v3/x509v3.h +++ b/src/lib/libcrypto/x509v3/x509v3.h | |||
@@ -287,6 +287,23 @@ typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; | |||
287 | DECLARE_STACK_OF(POLICYINFO) | 287 | DECLARE_STACK_OF(POLICYINFO) |
288 | DECLARE_ASN1_SET_OF(POLICYINFO) | 288 | DECLARE_ASN1_SET_OF(POLICYINFO) |
289 | 289 | ||
290 | /* Proxy certificate structures, see RFC 3820 */ | ||
291 | typedef struct PROXY_POLICY_st | ||
292 | { | ||
293 | ASN1_OBJECT *policyLanguage; | ||
294 | ASN1_OCTET_STRING *policy; | ||
295 | } PROXY_POLICY; | ||
296 | |||
297 | typedef struct PROXY_CERT_INFO_EXTENSION_st | ||
298 | { | ||
299 | ASN1_INTEGER *pcPathLengthConstraint; | ||
300 | PROXY_POLICY *proxyPolicy; | ||
301 | } PROXY_CERT_INFO_EXTENSION; | ||
302 | |||
303 | DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) | ||
304 | DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) | ||
305 | |||
306 | |||
290 | #define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ | 307 | #define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ |
291 | ",name:", val->name, ",value:", val->value); | 308 | ",name:", val->name, ",value:", val->value); |
292 | 309 | ||
@@ -325,6 +342,7 @@ DECLARE_ASN1_SET_OF(POLICYINFO) | |||
325 | #define EXFLAG_INVALID 0x80 | 342 | #define EXFLAG_INVALID 0x80 |
326 | #define EXFLAG_SET 0x100 | 343 | #define EXFLAG_SET 0x100 |
327 | #define EXFLAG_CRITICAL 0x200 | 344 | #define EXFLAG_CRITICAL 0x200 |
345 | #define EXFLAG_PROXY 0x400 | ||
328 | 346 | ||
329 | #define KU_DIGITAL_SIGNATURE 0x0080 | 347 | #define KU_DIGITAL_SIGNATURE 0x0080 |
330 | #define KU_NON_REPUDIATION 0x0040 | 348 | #define KU_NON_REPUDIATION 0x0040 |
@@ -527,6 +545,7 @@ int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); | |||
527 | 545 | ||
528 | int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent); | 546 | int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent); |
529 | 547 | ||
548 | int X509_check_ca(X509 *x); | ||
530 | int X509_check_purpose(X509 *x, int id, int ca); | 549 | int X509_check_purpose(X509 *x, int id, int ca); |
531 | int X509_supported_extension(X509_EXTENSION *ex); | 550 | int X509_supported_extension(X509_EXTENSION *ex); |
532 | int X509_PURPOSE_set(int *p, int purpose); | 551 | int X509_PURPOSE_set(int *p, int purpose); |
@@ -564,12 +583,14 @@ void ERR_load_X509V3_strings(void); | |||
564 | #define X509V3_F_DO_EXT_I2D 135 | 583 | #define X509V3_F_DO_EXT_I2D 135 |
565 | #define X509V3_F_HEX_TO_STRING 111 | 584 | #define X509V3_F_HEX_TO_STRING 111 |
566 | #define X509V3_F_I2S_ASN1_ENUMERATED 121 | 585 | #define X509V3_F_I2S_ASN1_ENUMERATED 121 |
586 | #define X509V3_F_I2S_ASN1_IA5STRING 142 | ||
567 | #define X509V3_F_I2S_ASN1_INTEGER 120 | 587 | #define X509V3_F_I2S_ASN1_INTEGER 120 |
568 | #define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 | 588 | #define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 |
569 | #define X509V3_F_NOTICE_SECTION 132 | 589 | #define X509V3_F_NOTICE_SECTION 132 |
570 | #define X509V3_F_NREF_NOS 133 | 590 | #define X509V3_F_NREF_NOS 133 |
571 | #define X509V3_F_POLICY_SECTION 131 | 591 | #define X509V3_F_POLICY_SECTION 131 |
572 | #define X509V3_F_R2I_CERTPOL 130 | 592 | #define X509V3_F_R2I_CERTPOL 130 |
593 | #define X509V3_F_R2I_PCI 142 | ||
573 | #define X509V3_F_S2I_ASN1_IA5STRING 100 | 594 | #define X509V3_F_S2I_ASN1_IA5STRING 100 |
574 | #define X509V3_F_S2I_ASN1_INTEGER 108 | 595 | #define X509V3_F_S2I_ASN1_INTEGER 108 |
575 | #define X509V3_F_S2I_ASN1_OCTET_STRING 112 | 596 | #define X509V3_F_S2I_ASN1_OCTET_STRING 112 |
@@ -617,6 +638,7 @@ void ERR_load_X509V3_strings(void); | |||
617 | #define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 | 638 | #define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 |
618 | #define X509V3_R_EXTENSION_VALUE_ERROR 116 | 639 | #define X509V3_R_EXTENSION_VALUE_ERROR 116 |
619 | #define X509V3_R_ILLEGAL_HEX_DIGIT 113 | 640 | #define X509V3_R_ILLEGAL_HEX_DIGIT 113 |
641 | #define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 153 | ||
620 | #define X509V3_R_INVALID_BOOLEAN_STRING 104 | 642 | #define X509V3_R_INVALID_BOOLEAN_STRING 104 |
621 | #define X509V3_R_INVALID_EXTENSION_STRING 105 | 643 | #define X509V3_R_INVALID_EXTENSION_STRING 105 |
622 | #define X509V3_R_INVALID_NAME 106 | 644 | #define X509V3_R_INVALID_NAME 106 |
@@ -628,6 +650,8 @@ void ERR_load_X509V3_strings(void); | |||
628 | #define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 | 650 | #define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 |
629 | #define X509V3_R_INVALID_OPTION 138 | 651 | #define X509V3_R_INVALID_OPTION 138 |
630 | #define X509V3_R_INVALID_POLICY_IDENTIFIER 134 | 652 | #define X509V3_R_INVALID_POLICY_IDENTIFIER 134 |
653 | #define X509V3_R_INVALID_PROXY_POLICY_IDENTIFIER 147 | ||
654 | #define X509V3_R_INVALID_PROXY_POLICY_SETTING 151 | ||
631 | #define X509V3_R_INVALID_PURPOSE 146 | 655 | #define X509V3_R_INVALID_PURPOSE 146 |
632 | #define X509V3_R_INVALID_SECTION 135 | 656 | #define X509V3_R_INVALID_SECTION 135 |
633 | #define X509V3_R_INVALID_SYNTAX 143 | 657 | #define X509V3_R_INVALID_SYNTAX 143 |
@@ -638,9 +662,16 @@ void ERR_load_X509V3_strings(void); | |||
638 | #define X509V3_R_NO_ISSUER_CERTIFICATE 121 | 662 | #define X509V3_R_NO_ISSUER_CERTIFICATE 121 |
639 | #define X509V3_R_NO_ISSUER_DETAILS 127 | 663 | #define X509V3_R_NO_ISSUER_DETAILS 127 |
640 | #define X509V3_R_NO_POLICY_IDENTIFIER 139 | 664 | #define X509V3_R_NO_POLICY_IDENTIFIER 139 |
665 | #define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 148 | ||
641 | #define X509V3_R_NO_PUBLIC_KEY 114 | 666 | #define X509V3_R_NO_PUBLIC_KEY 114 |
642 | #define X509V3_R_NO_SUBJECT_DETAILS 125 | 667 | #define X509V3_R_NO_SUBJECT_DETAILS 125 |
643 | #define X509V3_R_ODD_NUMBER_OF_DIGITS 112 | 668 | #define X509V3_R_ODD_NUMBER_OF_DIGITS 112 |
669 | #define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED 149 | ||
670 | #define X509V3_R_POLICY_PATH_LENGTH 152 | ||
671 | #define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED 150 | ||
672 | #define X509V3_R_POLICY_SYNTAX_NOT 154 | ||
673 | #define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 155 | ||
674 | #define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 156 | ||
644 | #define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 | 675 | #define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 |
645 | #define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 | 676 | #define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 |
646 | #define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 | 677 | #define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 |
diff --git a/src/lib/libssl/doc/openssl.cnf b/src/lib/libssl/doc/openssl.cnf index 854d1f164e..4c1d595b0a 100644 --- a/src/lib/libssl/doc/openssl.cnf +++ b/src/lib/libssl/doc/openssl.cnf | |||
@@ -44,8 +44,8 @@ new_certs_dir = $dir/newcerts # default place for new certs. | |||
44 | 44 | ||
45 | certificate = $dir/cacert.pem # The CA certificate | 45 | certificate = $dir/cacert.pem # The CA certificate |
46 | serial = $dir/serial # The current serial number | 46 | serial = $dir/serial # The current serial number |
47 | #crlnumber = $dir/crlnumber # the current crl number | 47 | #crlnumber = $dir/crlnumber # the current crl number must be |
48 | # must be commented out to leave a V1 CRL | 48 | # commented out to leave a V1 CRL |
49 | crl = $dir/crl.pem # The current CRL | 49 | crl = $dir/crl.pem # The current CRL |
50 | private_key = $dir/private/cakey.pem# The private key | 50 | private_key = $dir/private/cakey.pem# The private key |
51 | RANDFILE = $dir/private/.rand # private random number file | 51 | RANDFILE = $dir/private/.rand # private random number file |
@@ -258,3 +258,56 @@ basicConstraints = CA:true | |||
258 | 258 | ||
259 | # issuerAltName=issuer:copy | 259 | # issuerAltName=issuer:copy |
260 | authorityKeyIdentifier=keyid:always,issuer:always | 260 | authorityKeyIdentifier=keyid:always,issuer:always |
261 | |||
262 | [ proxy_cert_ext ] | ||
263 | # These extensions should be added when creating a proxy certificate | ||
264 | |||
265 | # This goes against PKIX guidelines but some CAs do it and some software | ||
266 | # requires this to avoid interpreting an end user certificate as a CA. | ||
267 | |||
268 | basicConstraints=CA:FALSE | ||
269 | |||
270 | # Here are some examples of the usage of nsCertType. If it is omitted | ||
271 | # the certificate can be used for anything *except* object signing. | ||
272 | |||
273 | # This is OK for an SSL server. | ||
274 | # nsCertType = server | ||
275 | |||
276 | # For an object signing certificate this would be used. | ||
277 | # nsCertType = objsign | ||
278 | |||
279 | # For normal client use this is typical | ||
280 | # nsCertType = client, email | ||
281 | |||
282 | # and for everything including object signing: | ||
283 | # nsCertType = client, email, objsign | ||
284 | |||
285 | # This is typical in keyUsage for a client certificate. | ||
286 | # keyUsage = nonRepudiation, digitalSignature, keyEncipherment | ||
287 | |||
288 | # This will be displayed in Netscape's comment listbox. | ||
289 | nsComment = "OpenSSL Generated Certificate" | ||
290 | |||
291 | # PKIX recommendations harmless if included in all certificates. | ||
292 | subjectKeyIdentifier=hash | ||
293 | authorityKeyIdentifier=keyid,issuer:always | ||
294 | |||
295 | # This stuff is for subjectAltName and issuerAltname. | ||
296 | # Import the email address. | ||
297 | # subjectAltName=email:copy | ||
298 | # An alternative to produce certificates that aren't | ||
299 | # deprecated according to PKIX. | ||
300 | # subjectAltName=email:move | ||
301 | |||
302 | # Copy subject details | ||
303 | # issuerAltName=issuer:copy | ||
304 | |||
305 | #nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem | ||
306 | #nsBaseUrl | ||
307 | #nsRevocationUrl | ||
308 | #nsRenewalUrl | ||
309 | #nsCaPolicyUrl | ||
310 | #nsSslServerName | ||
311 | |||
312 | # This really needs to be in place for it to be a proxy certificate. | ||
313 | proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo | ||
diff --git a/src/lib/libssl/doc/standards.txt b/src/lib/libssl/doc/standards.txt index edbe2f3a57..f6675b574b 100644 --- a/src/lib/libssl/doc/standards.txt +++ b/src/lib/libssl/doc/standards.txt | |||
@@ -88,6 +88,10 @@ PKCS#12: Personal Information Exchange Syntax Standard, version 1.0. | |||
88 | (Format: TXT=143173 bytes) (Obsoletes RFC2437) (Status: | 88 | (Format: TXT=143173 bytes) (Obsoletes RFC2437) (Status: |
89 | INFORMATIONAL) | 89 | INFORMATIONAL) |
90 | 90 | ||
91 | 3820 Internet X.509 Public Key Infrastructure (PKI) Proxy Certificate | ||
92 | Profile. S. Tuecke, V. Welch, D. Engert, L. Pearlman, M. Thompson. | ||
93 | June 2004. (Format: TXT=86374 bytes) (Status: PROPOSED STANDARD) | ||
94 | |||
91 | 95 | ||
92 | Related: | 96 | Related: |
93 | -------- | 97 | -------- |
diff --git a/src/lib/libssl/s23_clnt.c b/src/lib/libssl/s23_clnt.c index 64ee4269ec..779e94a35c 100644 --- a/src/lib/libssl/s23_clnt.c +++ b/src/lib/libssl/s23_clnt.c | |||
@@ -235,7 +235,8 @@ static int ssl23_client_hello(SSL *s) | |||
235 | #endif | 235 | #endif |
236 | 236 | ||
237 | p=s->s3->client_random; | 237 | p=s->s3->client_random; |
238 | RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE); | 238 | if(RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE) <= 0) |
239 | return -1; | ||
239 | 240 | ||
240 | /* Do the message type and length last */ | 241 | /* Do the message type and length last */ |
241 | d= &(buf[2]); | 242 | d= &(buf[2]); |
@@ -248,6 +249,14 @@ static int ssl23_client_hello(SSL *s) | |||
248 | *(d++)=TLS1_VERSION_MINOR; | 249 | *(d++)=TLS1_VERSION_MINOR; |
249 | s->client_version=TLS1_VERSION; | 250 | s->client_version=TLS1_VERSION; |
250 | } | 251 | } |
252 | #ifdef OPENSSL_FIPS | ||
253 | else if(FIPS_mode()) | ||
254 | { | ||
255 | SSLerr(SSL_F_SSL23_CLIENT_HELLO, | ||
256 | SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); | ||
257 | return -1; | ||
258 | } | ||
259 | #endif | ||
251 | else if (!(s->options & SSL_OP_NO_SSLv3)) | 260 | else if (!(s->options & SSL_OP_NO_SSLv3)) |
252 | { | 261 | { |
253 | *(d++)=SSL3_VERSION_MAJOR; | 262 | *(d++)=SSL3_VERSION_MAJOR; |
@@ -296,7 +305,9 @@ static int ssl23_client_hello(SSL *s) | |||
296 | i=ch_len; | 305 | i=ch_len; |
297 | s2n(i,d); | 306 | s2n(i,d); |
298 | memset(&(s->s3->client_random[0]),0,SSL3_RANDOM_SIZE); | 307 | memset(&(s->s3->client_random[0]),0,SSL3_RANDOM_SIZE); |
299 | RAND_pseudo_bytes(&(s->s3->client_random[SSL3_RANDOM_SIZE-i]),i); | 308 | if(RAND_pseudo_bytes(&(s->s3->client_random[SSL3_RANDOM_SIZE-i]),i) <= 0) |
309 | return -1; | ||
310 | |||
300 | memcpy(p,&(s->s3->client_random[SSL3_RANDOM_SIZE-i]),i); | 311 | memcpy(p,&(s->s3->client_random[SSL3_RANDOM_SIZE-i]),i); |
301 | p+=i; | 312 | p+=i; |
302 | 313 | ||
@@ -426,6 +437,14 @@ static int ssl23_get_server_hello(SSL *s) | |||
426 | if ((p[2] == SSL3_VERSION_MINOR) && | 437 | if ((p[2] == SSL3_VERSION_MINOR) && |
427 | !(s->options & SSL_OP_NO_SSLv3)) | 438 | !(s->options & SSL_OP_NO_SSLv3)) |
428 | { | 439 | { |
440 | #ifdef OPENSSL_FIPS | ||
441 | if(FIPS_mode()) | ||
442 | { | ||
443 | SSLerr(SSL_F_SSL23_GET_SERVER_HELLO, | ||
444 | SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); | ||
445 | goto err; | ||
446 | } | ||
447 | #endif | ||
429 | s->version=SSL3_VERSION; | 448 | s->version=SSL3_VERSION; |
430 | s->method=SSLv3_client_method(); | 449 | s->method=SSLv3_client_method(); |
431 | } | 450 | } |
diff --git a/src/lib/libssl/s23_lib.c b/src/lib/libssl/s23_lib.c index b70002a647..8d7dbcf569 100644 --- a/src/lib/libssl/s23_lib.c +++ b/src/lib/libssl/s23_lib.c | |||
@@ -87,7 +87,7 @@ static SSL_METHOD SSLv23_data= { | |||
87 | ssl3_ctx_ctrl, | 87 | ssl3_ctx_ctrl, |
88 | ssl23_get_cipher_by_char, | 88 | ssl23_get_cipher_by_char, |
89 | ssl23_put_cipher_by_char, | 89 | ssl23_put_cipher_by_char, |
90 | ssl_undefined_function, | 90 | ssl_undefined_const_function, |
91 | ssl23_num_ciphers, | 91 | ssl23_num_ciphers, |
92 | ssl23_get_cipher, | 92 | ssl23_get_cipher, |
93 | ssl_bad_method, | 93 | ssl_bad_method, |
diff --git a/src/lib/libssl/s23_srvr.c b/src/lib/libssl/s23_srvr.c index c5404ca0bc..92f3391f60 100644 --- a/src/lib/libssl/s23_srvr.c +++ b/src/lib/libssl/s23_srvr.c | |||
@@ -407,6 +407,15 @@ int ssl23_get_client_hello(SSL *s) | |||
407 | } | 407 | } |
408 | } | 408 | } |
409 | 409 | ||
410 | #ifdef OPENSSL_FIPS | ||
411 | if (FIPS_mode() && (s->version < TLS1_VERSION)) | ||
412 | { | ||
413 | SSLerr(SSL_F_SSL23_GET_CLIENT_HELLO, | ||
414 | SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); | ||
415 | goto err; | ||
416 | } | ||
417 | #endif | ||
418 | |||
410 | if (s->state == SSL23_ST_SR_CLNT_HELLO_B) | 419 | if (s->state == SSL23_ST_SR_CLNT_HELLO_B) |
411 | { | 420 | { |
412 | /* we have SSLv3/TLSv1 in an SSLv2 header | 421 | /* we have SSLv3/TLSv1 in an SSLv2 header |
diff --git a/src/lib/libssl/s3_clnt.c b/src/lib/libssl/s3_clnt.c index 36f4a8b4c3..ebf83b0322 100644 --- a/src/lib/libssl/s3_clnt.c +++ b/src/lib/libssl/s3_clnt.c | |||
@@ -117,6 +117,7 @@ | |||
117 | #include <openssl/objects.h> | 117 | #include <openssl/objects.h> |
118 | #include <openssl/evp.h> | 118 | #include <openssl/evp.h> |
119 | #include <openssl/md5.h> | 119 | #include <openssl/md5.h> |
120 | #include <openssl/fips.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); |
@@ -534,7 +535,8 @@ static int ssl3_client_hello(SSL *s) | |||
534 | p=s->s3->client_random; | 535 | p=s->s3->client_random; |
535 | Time=time(NULL); /* Time */ | 536 | Time=time(NULL); /* Time */ |
536 | l2n(Time,p); | 537 | l2n(Time,p); |
537 | RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-sizeof(Time)); | 538 | if(RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0) |
539 | goto err; | ||
538 | 540 | ||
539 | /* Do the message type and length last */ | 541 | /* Do the message type and length last */ |
540 | d=p= &(buf[4]); | 542 | d=p= &(buf[4]); |
@@ -1160,11 +1162,14 @@ static int ssl3_get_key_exchange(SSL *s) | |||
1160 | q=md_buf; | 1162 | q=md_buf; |
1161 | for (num=2; num > 0; num--) | 1163 | for (num=2; num > 0; num--) |
1162 | { | 1164 | { |
1165 | EVP_MD_CTX_set_flags(&md_ctx, | ||
1166 | EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
1163 | EVP_DigestInit_ex(&md_ctx,(num == 2) | 1167 | EVP_DigestInit_ex(&md_ctx,(num == 2) |
1164 | ?s->ctx->md5:s->ctx->sha1, NULL); | 1168 | ?s->ctx->md5:s->ctx->sha1, NULL); |
1165 | EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); | 1169 | EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); |
1166 | EVP_DigestUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE); | 1170 | EVP_DigestUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE); |
1167 | EVP_DigestUpdate(&md_ctx,param,param_len); | 1171 | EVP_DigestUpdate(&md_ctx,param,param_len); |
1172 | |||
1168 | EVP_DigestFinal_ex(&md_ctx,q,(unsigned int *)&i); | 1173 | EVP_DigestFinal_ex(&md_ctx,q,(unsigned int *)&i); |
1169 | q+=i; | 1174 | q+=i; |
1170 | j+=i; | 1175 | j+=i; |
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c index d04096016c..9bf1dbec06 100644 --- a/src/lib/libssl/s3_lib.c +++ b/src/lib/libssl/s3_lib.c | |||
@@ -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|SSL_STRONG_NONE, | 145 | SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS, |
146 | 0, | 146 | 0, |
147 | 0, | 147 | 0, |
148 | 0, | 148 | 0, |
@@ -183,7 +183,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
183 | SSL3_TXT_ADH_DES_40_CBC_SHA, | 183 | SSL3_TXT_ADH_DES_40_CBC_SHA, |
184 | SSL3_CK_ADH_DES_40_CBC_SHA, | 184 | SSL3_CK_ADH_DES_40_CBC_SHA, |
185 | SSL_kEDH |SSL_aNULL|SSL_DES|SSL_SHA1|SSL_SSLV3, | 185 | SSL_kEDH |SSL_aNULL|SSL_DES|SSL_SHA1|SSL_SSLV3, |
186 | SSL_EXPORT|SSL_EXP40, | 186 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
187 | 0, | 187 | 0, |
188 | 40, | 188 | 40, |
189 | 128, | 189 | 128, |
@@ -196,7 +196,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
196 | SSL3_TXT_ADH_DES_64_CBC_SHA, | 196 | SSL3_TXT_ADH_DES_64_CBC_SHA, |
197 | SSL3_CK_ADH_DES_64_CBC_SHA, | 197 | SSL3_CK_ADH_DES_64_CBC_SHA, |
198 | SSL_kEDH |SSL_aNULL|SSL_DES |SSL_SHA1|SSL_SSLV3, | 198 | SSL_kEDH |SSL_aNULL|SSL_DES |SSL_SHA1|SSL_SSLV3, |
199 | SSL_NOT_EXP|SSL_LOW, | 199 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
200 | 0, | 200 | 0, |
201 | 56, | 201 | 56, |
202 | 56, | 202 | 56, |
@@ -209,7 +209,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
209 | SSL3_TXT_ADH_DES_192_CBC_SHA, | 209 | SSL3_TXT_ADH_DES_192_CBC_SHA, |
210 | SSL3_CK_ADH_DES_192_CBC_SHA, | 210 | SSL3_CK_ADH_DES_192_CBC_SHA, |
211 | SSL_kEDH |SSL_aNULL|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 211 | SSL_kEDH |SSL_aNULL|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
212 | SSL_NOT_EXP|SSL_HIGH, | 212 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
213 | 0, | 213 | 0, |
214 | 168, | 214 | 168, |
215 | 168, | 215 | 168, |
@@ -291,7 +291,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
291 | SSL3_TXT_RSA_DES_40_CBC_SHA, | 291 | SSL3_TXT_RSA_DES_40_CBC_SHA, |
292 | SSL3_CK_RSA_DES_40_CBC_SHA, | 292 | SSL3_CK_RSA_DES_40_CBC_SHA, |
293 | SSL_kRSA|SSL_aRSA|SSL_DES|SSL_SHA1|SSL_SSLV3, | 293 | SSL_kRSA|SSL_aRSA|SSL_DES|SSL_SHA1|SSL_SSLV3, |
294 | SSL_EXPORT|SSL_EXP40, | 294 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
295 | 0, | 295 | 0, |
296 | 40, | 296 | 40, |
297 | 56, | 297 | 56, |
@@ -304,7 +304,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
304 | SSL3_TXT_RSA_DES_64_CBC_SHA, | 304 | SSL3_TXT_RSA_DES_64_CBC_SHA, |
305 | SSL3_CK_RSA_DES_64_CBC_SHA, | 305 | SSL3_CK_RSA_DES_64_CBC_SHA, |
306 | SSL_kRSA|SSL_aRSA|SSL_DES |SSL_SHA1|SSL_SSLV3, | 306 | SSL_kRSA|SSL_aRSA|SSL_DES |SSL_SHA1|SSL_SSLV3, |
307 | SSL_NOT_EXP|SSL_LOW, | 307 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
308 | 0, | 308 | 0, |
309 | 56, | 309 | 56, |
310 | 56, | 310 | 56, |
@@ -317,7 +317,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
317 | SSL3_TXT_RSA_DES_192_CBC3_SHA, | 317 | SSL3_TXT_RSA_DES_192_CBC3_SHA, |
318 | SSL3_CK_RSA_DES_192_CBC3_SHA, | 318 | SSL3_CK_RSA_DES_192_CBC3_SHA, |
319 | SSL_kRSA|SSL_aRSA|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 319 | SSL_kRSA|SSL_aRSA|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
320 | SSL_NOT_EXP|SSL_HIGH, | 320 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
321 | 0, | 321 | 0, |
322 | 168, | 322 | 168, |
323 | 168, | 323 | 168, |
@@ -332,7 +332,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
332 | SSL3_TXT_DH_DSS_DES_40_CBC_SHA, | 332 | SSL3_TXT_DH_DSS_DES_40_CBC_SHA, |
333 | SSL3_CK_DH_DSS_DES_40_CBC_SHA, | 333 | SSL3_CK_DH_DSS_DES_40_CBC_SHA, |
334 | SSL_kDHd |SSL_aDH|SSL_DES|SSL_SHA1|SSL_SSLV3, | 334 | SSL_kDHd |SSL_aDH|SSL_DES|SSL_SHA1|SSL_SSLV3, |
335 | SSL_EXPORT|SSL_EXP40, | 335 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
336 | 0, | 336 | 0, |
337 | 40, | 337 | 40, |
338 | 56, | 338 | 56, |
@@ -345,7 +345,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
345 | SSL3_TXT_DH_DSS_DES_64_CBC_SHA, | 345 | SSL3_TXT_DH_DSS_DES_64_CBC_SHA, |
346 | SSL3_CK_DH_DSS_DES_64_CBC_SHA, | 346 | SSL3_CK_DH_DSS_DES_64_CBC_SHA, |
347 | SSL_kDHd |SSL_aDH|SSL_DES |SSL_SHA1|SSL_SSLV3, | 347 | SSL_kDHd |SSL_aDH|SSL_DES |SSL_SHA1|SSL_SSLV3, |
348 | SSL_NOT_EXP|SSL_LOW, | 348 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
349 | 0, | 349 | 0, |
350 | 56, | 350 | 56, |
351 | 56, | 351 | 56, |
@@ -358,7 +358,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
358 | SSL3_TXT_DH_DSS_DES_192_CBC3_SHA, | 358 | SSL3_TXT_DH_DSS_DES_192_CBC3_SHA, |
359 | SSL3_CK_DH_DSS_DES_192_CBC3_SHA, | 359 | SSL3_CK_DH_DSS_DES_192_CBC3_SHA, |
360 | SSL_kDHd |SSL_aDH|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 360 | SSL_kDHd |SSL_aDH|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
361 | SSL_NOT_EXP|SSL_HIGH, | 361 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
362 | 0, | 362 | 0, |
363 | 168, | 363 | 168, |
364 | 168, | 364 | 168, |
@@ -371,7 +371,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
371 | SSL3_TXT_DH_RSA_DES_40_CBC_SHA, | 371 | SSL3_TXT_DH_RSA_DES_40_CBC_SHA, |
372 | SSL3_CK_DH_RSA_DES_40_CBC_SHA, | 372 | SSL3_CK_DH_RSA_DES_40_CBC_SHA, |
373 | SSL_kDHr |SSL_aDH|SSL_DES|SSL_SHA1|SSL_SSLV3, | 373 | SSL_kDHr |SSL_aDH|SSL_DES|SSL_SHA1|SSL_SSLV3, |
374 | SSL_EXPORT|SSL_EXP40, | 374 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
375 | 0, | 375 | 0, |
376 | 40, | 376 | 40, |
377 | 56, | 377 | 56, |
@@ -384,7 +384,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
384 | SSL3_TXT_DH_RSA_DES_64_CBC_SHA, | 384 | SSL3_TXT_DH_RSA_DES_64_CBC_SHA, |
385 | SSL3_CK_DH_RSA_DES_64_CBC_SHA, | 385 | SSL3_CK_DH_RSA_DES_64_CBC_SHA, |
386 | SSL_kDHr |SSL_aDH|SSL_DES |SSL_SHA1|SSL_SSLV3, | 386 | SSL_kDHr |SSL_aDH|SSL_DES |SSL_SHA1|SSL_SSLV3, |
387 | SSL_NOT_EXP|SSL_LOW, | 387 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
388 | 0, | 388 | 0, |
389 | 56, | 389 | 56, |
390 | 56, | 390 | 56, |
@@ -397,7 +397,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
397 | SSL3_TXT_DH_RSA_DES_192_CBC3_SHA, | 397 | SSL3_TXT_DH_RSA_DES_192_CBC3_SHA, |
398 | SSL3_CK_DH_RSA_DES_192_CBC3_SHA, | 398 | SSL3_CK_DH_RSA_DES_192_CBC3_SHA, |
399 | SSL_kDHr |SSL_aDH|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 399 | SSL_kDHr |SSL_aDH|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
400 | SSL_NOT_EXP|SSL_HIGH, | 400 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
401 | 0, | 401 | 0, |
402 | 168, | 402 | 168, |
403 | 168, | 403 | 168, |
@@ -412,7 +412,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
412 | SSL3_TXT_EDH_DSS_DES_40_CBC_SHA, | 412 | SSL3_TXT_EDH_DSS_DES_40_CBC_SHA, |
413 | SSL3_CK_EDH_DSS_DES_40_CBC_SHA, | 413 | SSL3_CK_EDH_DSS_DES_40_CBC_SHA, |
414 | SSL_kEDH|SSL_aDSS|SSL_DES|SSL_SHA1|SSL_SSLV3, | 414 | SSL_kEDH|SSL_aDSS|SSL_DES|SSL_SHA1|SSL_SSLV3, |
415 | SSL_EXPORT|SSL_EXP40, | 415 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
416 | 0, | 416 | 0, |
417 | 40, | 417 | 40, |
418 | 56, | 418 | 56, |
@@ -425,7 +425,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
425 | SSL3_TXT_EDH_DSS_DES_64_CBC_SHA, | 425 | SSL3_TXT_EDH_DSS_DES_64_CBC_SHA, |
426 | SSL3_CK_EDH_DSS_DES_64_CBC_SHA, | 426 | SSL3_CK_EDH_DSS_DES_64_CBC_SHA, |
427 | SSL_kEDH|SSL_aDSS|SSL_DES |SSL_SHA1|SSL_SSLV3, | 427 | SSL_kEDH|SSL_aDSS|SSL_DES |SSL_SHA1|SSL_SSLV3, |
428 | SSL_NOT_EXP|SSL_LOW, | 428 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
429 | 0, | 429 | 0, |
430 | 56, | 430 | 56, |
431 | 56, | 431 | 56, |
@@ -438,7 +438,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
438 | SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA, | 438 | SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA, |
439 | SSL3_CK_EDH_DSS_DES_192_CBC3_SHA, | 439 | SSL3_CK_EDH_DSS_DES_192_CBC3_SHA, |
440 | SSL_kEDH|SSL_aDSS|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 440 | SSL_kEDH|SSL_aDSS|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
441 | SSL_NOT_EXP|SSL_HIGH, | 441 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
442 | 0, | 442 | 0, |
443 | 168, | 443 | 168, |
444 | 168, | 444 | 168, |
@@ -451,7 +451,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
451 | SSL3_TXT_EDH_RSA_DES_40_CBC_SHA, | 451 | SSL3_TXT_EDH_RSA_DES_40_CBC_SHA, |
452 | SSL3_CK_EDH_RSA_DES_40_CBC_SHA, | 452 | SSL3_CK_EDH_RSA_DES_40_CBC_SHA, |
453 | SSL_kEDH|SSL_aRSA|SSL_DES|SSL_SHA1|SSL_SSLV3, | 453 | SSL_kEDH|SSL_aRSA|SSL_DES|SSL_SHA1|SSL_SSLV3, |
454 | SSL_EXPORT|SSL_EXP40, | 454 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
455 | 0, | 455 | 0, |
456 | 40, | 456 | 40, |
457 | 56, | 457 | 56, |
@@ -464,7 +464,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
464 | SSL3_TXT_EDH_RSA_DES_64_CBC_SHA, | 464 | SSL3_TXT_EDH_RSA_DES_64_CBC_SHA, |
465 | SSL3_CK_EDH_RSA_DES_64_CBC_SHA, | 465 | SSL3_CK_EDH_RSA_DES_64_CBC_SHA, |
466 | SSL_kEDH|SSL_aRSA|SSL_DES |SSL_SHA1|SSL_SSLV3, | 466 | SSL_kEDH|SSL_aRSA|SSL_DES |SSL_SHA1|SSL_SSLV3, |
467 | SSL_NOT_EXP|SSL_LOW, | 467 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
468 | 0, | 468 | 0, |
469 | 56, | 469 | 56, |
470 | 56, | 470 | 56, |
@@ -477,7 +477,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
477 | SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA, | 477 | SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA, |
478 | SSL3_CK_EDH_RSA_DES_192_CBC3_SHA, | 478 | SSL3_CK_EDH_RSA_DES_192_CBC3_SHA, |
479 | SSL_kEDH|SSL_aRSA|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 479 | SSL_kEDH|SSL_aRSA|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
480 | SSL_NOT_EXP|SSL_HIGH, | 480 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
481 | 0, | 481 | 0, |
482 | 168, | 482 | 168, |
483 | 168, | 483 | 168, |
@@ -541,7 +541,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
541 | SSL3_TXT_KRB5_DES_64_CBC_SHA, | 541 | SSL3_TXT_KRB5_DES_64_CBC_SHA, |
542 | SSL3_CK_KRB5_DES_64_CBC_SHA, | 542 | SSL3_CK_KRB5_DES_64_CBC_SHA, |
543 | SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_SHA1 |SSL_SSLV3, | 543 | SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_SHA1 |SSL_SSLV3, |
544 | SSL_NOT_EXP|SSL_LOW, | 544 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
545 | 0, | 545 | 0, |
546 | 56, | 546 | 56, |
547 | 56, | 547 | 56, |
@@ -555,7 +555,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
555 | SSL3_TXT_KRB5_DES_192_CBC3_SHA, | 555 | SSL3_TXT_KRB5_DES_192_CBC3_SHA, |
556 | SSL3_CK_KRB5_DES_192_CBC3_SHA, | 556 | SSL3_CK_KRB5_DES_192_CBC3_SHA, |
557 | SSL_kKRB5|SSL_aKRB5| SSL_3DES|SSL_SHA1 |SSL_SSLV3, | 557 | SSL_kKRB5|SSL_aKRB5| SSL_3DES|SSL_SHA1 |SSL_SSLV3, |
558 | SSL_NOT_EXP|SSL_HIGH, | 558 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
559 | 0, | 559 | 0, |
560 | 112, | 560 | 112, |
561 | 168, | 561 | 168, |
@@ -653,7 +653,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
653 | SSL3_TXT_KRB5_DES_40_CBC_SHA, | 653 | SSL3_TXT_KRB5_DES_40_CBC_SHA, |
654 | SSL3_CK_KRB5_DES_40_CBC_SHA, | 654 | SSL3_CK_KRB5_DES_40_CBC_SHA, |
655 | SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_SHA1 |SSL_SSLV3, | 655 | SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_SHA1 |SSL_SSLV3, |
656 | SSL_EXPORT|SSL_EXP40, | 656 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
657 | 0, | 657 | 0, |
658 | 40, | 658 | 40, |
659 | 56, | 659 | 56, |
@@ -767,7 +767,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
767 | TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA, | 767 | TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA, |
768 | TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA, | 768 | TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA, |
769 | SSL_kRSA|SSL_aRSA|SSL_DES|SSL_SHA|SSL_TLSV1, | 769 | SSL_kRSA|SSL_aRSA|SSL_DES|SSL_SHA|SSL_TLSV1, |
770 | SSL_EXPORT|SSL_EXP56, | 770 | SSL_EXPORT|SSL_EXP56|SSL_FIPS, |
771 | 0, | 771 | 0, |
772 | 56, | 772 | 56, |
773 | 56, | 773 | 56, |
@@ -780,7 +780,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
780 | TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA, | 780 | TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA, |
781 | TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA, | 781 | TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA, |
782 | SSL_kEDH|SSL_aDSS|SSL_DES|SSL_SHA|SSL_TLSV1, | 782 | SSL_kEDH|SSL_aDSS|SSL_DES|SSL_SHA|SSL_TLSV1, |
783 | SSL_EXPORT|SSL_EXP56, | 783 | SSL_EXPORT|SSL_EXP56|SSL_FIPS, |
784 | 0, | 784 | 0, |
785 | 56, | 785 | 56, |
786 | 56, | 786 | 56, |
@@ -835,7 +835,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
835 | TLS1_TXT_RSA_WITH_AES_128_SHA, | 835 | TLS1_TXT_RSA_WITH_AES_128_SHA, |
836 | TLS1_CK_RSA_WITH_AES_128_SHA, | 836 | TLS1_CK_RSA_WITH_AES_128_SHA, |
837 | SSL_kRSA|SSL_aRSA|SSL_AES|SSL_SHA |SSL_TLSV1, | 837 | SSL_kRSA|SSL_aRSA|SSL_AES|SSL_SHA |SSL_TLSV1, |
838 | SSL_NOT_EXP|SSL_MEDIUM, | 838 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
839 | 0, | 839 | 0, |
840 | 128, | 840 | 128, |
841 | 128, | 841 | 128, |
@@ -848,7 +848,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
848 | TLS1_TXT_DH_DSS_WITH_AES_128_SHA, | 848 | TLS1_TXT_DH_DSS_WITH_AES_128_SHA, |
849 | TLS1_CK_DH_DSS_WITH_AES_128_SHA, | 849 | TLS1_CK_DH_DSS_WITH_AES_128_SHA, |
850 | SSL_kDHd|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, | 850 | SSL_kDHd|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, |
851 | SSL_NOT_EXP|SSL_MEDIUM, | 851 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
852 | 0, | 852 | 0, |
853 | 128, | 853 | 128, |
854 | 128, | 854 | 128, |
@@ -861,7 +861,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
861 | TLS1_TXT_DH_RSA_WITH_AES_128_SHA, | 861 | TLS1_TXT_DH_RSA_WITH_AES_128_SHA, |
862 | TLS1_CK_DH_RSA_WITH_AES_128_SHA, | 862 | TLS1_CK_DH_RSA_WITH_AES_128_SHA, |
863 | SSL_kDHr|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, | 863 | SSL_kDHr|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, |
864 | SSL_NOT_EXP|SSL_MEDIUM, | 864 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
865 | 0, | 865 | 0, |
866 | 128, | 866 | 128, |
867 | 128, | 867 | 128, |
@@ -874,7 +874,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
874 | TLS1_TXT_DHE_DSS_WITH_AES_128_SHA, | 874 | TLS1_TXT_DHE_DSS_WITH_AES_128_SHA, |
875 | TLS1_CK_DHE_DSS_WITH_AES_128_SHA, | 875 | TLS1_CK_DHE_DSS_WITH_AES_128_SHA, |
876 | SSL_kEDH|SSL_aDSS|SSL_AES|SSL_SHA|SSL_TLSV1, | 876 | SSL_kEDH|SSL_aDSS|SSL_AES|SSL_SHA|SSL_TLSV1, |
877 | SSL_NOT_EXP|SSL_MEDIUM, | 877 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
878 | 0, | 878 | 0, |
879 | 128, | 879 | 128, |
880 | 128, | 880 | 128, |
@@ -887,7 +887,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
887 | TLS1_TXT_DHE_RSA_WITH_AES_128_SHA, | 887 | TLS1_TXT_DHE_RSA_WITH_AES_128_SHA, |
888 | TLS1_CK_DHE_RSA_WITH_AES_128_SHA, | 888 | TLS1_CK_DHE_RSA_WITH_AES_128_SHA, |
889 | SSL_kEDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1, | 889 | SSL_kEDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1, |
890 | SSL_NOT_EXP|SSL_MEDIUM, | 890 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
891 | 0, | 891 | 0, |
892 | 128, | 892 | 128, |
893 | 128, | 893 | 128, |
@@ -900,7 +900,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
900 | TLS1_TXT_ADH_WITH_AES_128_SHA, | 900 | TLS1_TXT_ADH_WITH_AES_128_SHA, |
901 | TLS1_CK_ADH_WITH_AES_128_SHA, | 901 | TLS1_CK_ADH_WITH_AES_128_SHA, |
902 | SSL_kEDH|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1, | 902 | SSL_kEDH|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1, |
903 | SSL_NOT_EXP|SSL_MEDIUM, | 903 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
904 | 0, | 904 | 0, |
905 | 128, | 905 | 128, |
906 | 128, | 906 | 128, |
@@ -914,7 +914,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
914 | TLS1_TXT_RSA_WITH_AES_256_SHA, | 914 | TLS1_TXT_RSA_WITH_AES_256_SHA, |
915 | TLS1_CK_RSA_WITH_AES_256_SHA, | 915 | TLS1_CK_RSA_WITH_AES_256_SHA, |
916 | SSL_kRSA|SSL_aRSA|SSL_AES|SSL_SHA |SSL_TLSV1, | 916 | SSL_kRSA|SSL_aRSA|SSL_AES|SSL_SHA |SSL_TLSV1, |
917 | SSL_NOT_EXP|SSL_HIGH, | 917 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
918 | 0, | 918 | 0, |
919 | 256, | 919 | 256, |
920 | 256, | 920 | 256, |
@@ -927,7 +927,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
927 | TLS1_TXT_DH_DSS_WITH_AES_256_SHA, | 927 | TLS1_TXT_DH_DSS_WITH_AES_256_SHA, |
928 | TLS1_CK_DH_DSS_WITH_AES_256_SHA, | 928 | TLS1_CK_DH_DSS_WITH_AES_256_SHA, |
929 | SSL_kDHd|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, | 929 | SSL_kDHd|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, |
930 | SSL_NOT_EXP|SSL_HIGH, | 930 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
931 | 0, | 931 | 0, |
932 | 256, | 932 | 256, |
933 | 256, | 933 | 256, |
@@ -940,7 +940,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
940 | TLS1_TXT_DH_RSA_WITH_AES_256_SHA, | 940 | TLS1_TXT_DH_RSA_WITH_AES_256_SHA, |
941 | TLS1_CK_DH_RSA_WITH_AES_256_SHA, | 941 | TLS1_CK_DH_RSA_WITH_AES_256_SHA, |
942 | SSL_kDHr|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, | 942 | SSL_kDHr|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, |
943 | SSL_NOT_EXP|SSL_HIGH, | 943 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
944 | 0, | 944 | 0, |
945 | 256, | 945 | 256, |
946 | 256, | 946 | 256, |
@@ -953,7 +953,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
953 | TLS1_TXT_DHE_DSS_WITH_AES_256_SHA, | 953 | TLS1_TXT_DHE_DSS_WITH_AES_256_SHA, |
954 | TLS1_CK_DHE_DSS_WITH_AES_256_SHA, | 954 | TLS1_CK_DHE_DSS_WITH_AES_256_SHA, |
955 | SSL_kEDH|SSL_aDSS|SSL_AES|SSL_SHA|SSL_TLSV1, | 955 | SSL_kEDH|SSL_aDSS|SSL_AES|SSL_SHA|SSL_TLSV1, |
956 | SSL_NOT_EXP|SSL_HIGH, | 956 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
957 | 0, | 957 | 0, |
958 | 256, | 958 | 256, |
959 | 256, | 959 | 256, |
@@ -966,7 +966,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
966 | TLS1_TXT_DHE_RSA_WITH_AES_256_SHA, | 966 | TLS1_TXT_DHE_RSA_WITH_AES_256_SHA, |
967 | TLS1_CK_DHE_RSA_WITH_AES_256_SHA, | 967 | TLS1_CK_DHE_RSA_WITH_AES_256_SHA, |
968 | SSL_kEDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1, | 968 | SSL_kEDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1, |
969 | SSL_NOT_EXP|SSL_HIGH, | 969 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
970 | 0, | 970 | 0, |
971 | 256, | 971 | 256, |
972 | 256, | 972 | 256, |
@@ -979,7 +979,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
979 | TLS1_TXT_ADH_WITH_AES_256_SHA, | 979 | TLS1_TXT_ADH_WITH_AES_256_SHA, |
980 | TLS1_CK_ADH_WITH_AES_256_SHA, | 980 | TLS1_CK_ADH_WITH_AES_256_SHA, |
981 | SSL_kEDH|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1, | 981 | SSL_kEDH|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1, |
982 | SSL_NOT_EXP|SSL_HIGH, | 982 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
983 | 0, | 983 | 0, |
984 | 256, | 984 | 256, |
985 | 256, | 985 | 256, |
@@ -1057,7 +1057,7 @@ SSL_CIPHER *ssl3_get_cipher(unsigned int u) | |||
1057 | return(NULL); | 1057 | return(NULL); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | int ssl3_pending(SSL *s) | 1060 | int ssl3_pending(const SSL *s) |
1061 | { | 1061 | { |
1062 | if (s->rstate == SSL_ST_READ_BODY) | 1062 | if (s->rstate == SSL_ST_READ_BODY) |
1063 | return 0; | 1063 | return 0; |
diff --git a/src/lib/libssl/s3_pkt.c b/src/lib/libssl/s3_pkt.c index 9f3e5139ad..cb0b12b400 100644 --- a/src/lib/libssl/s3_pkt.c +++ b/src/lib/libssl/s3_pkt.c | |||
@@ -862,7 +862,7 @@ start: | |||
862 | { | 862 | { |
863 | al=SSL_AD_UNEXPECTED_MESSAGE; | 863 | al=SSL_AD_UNEXPECTED_MESSAGE; |
864 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); | 864 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); |
865 | goto err; | 865 | goto f_err; |
866 | } | 866 | } |
867 | 867 | ||
868 | /* If the other end has shut down, throw anything we read away | 868 | /* If the other end has shut down, throw anything we read away |
@@ -969,7 +969,7 @@ start: | |||
969 | { | 969 | { |
970 | al=SSL_AD_DECODE_ERROR; | 970 | al=SSL_AD_DECODE_ERROR; |
971 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST); | 971 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST); |
972 | goto err; | 972 | goto f_err; |
973 | } | 973 | } |
974 | 974 | ||
975 | if (s->msg_callback) | 975 | if (s->msg_callback) |
@@ -1080,17 +1080,17 @@ start: | |||
1080 | if ( (rr->length != 1) || (rr->off != 0) || | 1080 | if ( (rr->length != 1) || (rr->off != 0) || |
1081 | (rr->data[0] != SSL3_MT_CCS)) | 1081 | (rr->data[0] != SSL3_MT_CCS)) |
1082 | { | 1082 | { |
1083 | i=SSL_AD_ILLEGAL_PARAMETER; | 1083 | al=SSL_AD_ILLEGAL_PARAMETER; |
1084 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC); | 1084 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC); |
1085 | goto err; | 1085 | goto f_err; |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | /* Check we have a cipher to change to */ | 1088 | /* Check we have a cipher to change to */ |
1089 | if (s->s3->tmp.new_cipher == NULL) | 1089 | if (s->s3->tmp.new_cipher == NULL) |
1090 | { | 1090 | { |
1091 | i=SSL_AD_UNEXPECTED_MESSAGE; | 1091 | al=SSL_AD_UNEXPECTED_MESSAGE; |
1092 | SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); | 1092 | SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); |
1093 | goto err; | 1093 | goto f_err; |
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | rr->length=0; | 1096 | rr->length=0; |
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c index deb3cffabe..c4a1a71523 100644 --- a/src/lib/libssl/s3_srvr.c +++ b/src/lib/libssl/s3_srvr.c | |||
@@ -125,6 +125,7 @@ | |||
125 | #include <openssl/krb5_asn.h> | 125 | #include <openssl/krb5_asn.h> |
126 | #endif | 126 | #endif |
127 | #include <openssl/md5.h> | 127 | #include <openssl/md5.h> |
128 | #include <openssl/fips.h> | ||
128 | 129 | ||
129 | static SSL_METHOD *ssl3_get_server_method(int ver); | 130 | static SSL_METHOD *ssl3_get_server_method(int ver); |
130 | static int ssl3_get_client_hello(SSL *s); | 131 | static int ssl3_get_client_hello(SSL *s); |
@@ -955,7 +956,8 @@ static int ssl3_send_server_hello(SSL *s) | |||
955 | p=s->s3->server_random; | 956 | p=s->s3->server_random; |
956 | Time=time(NULL); /* Time */ | 957 | Time=time(NULL); /* Time */ |
957 | l2n(Time,p); | 958 | l2n(Time,p); |
958 | RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-sizeof(Time)); | 959 | if(RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0) |
960 | return -1; | ||
959 | /* Do the message type and length last */ | 961 | /* Do the message type and length last */ |
960 | d=p= &(buf[4]); | 962 | d=p= &(buf[4]); |
961 | 963 | ||
@@ -1211,6 +1213,8 @@ static int ssl3_send_server_key_exchange(SSL *s) | |||
1211 | j=0; | 1213 | j=0; |
1212 | for (num=2; num > 0; num--) | 1214 | for (num=2; num > 0; num--) |
1213 | { | 1215 | { |
1216 | EVP_MD_CTX_set_flags(&md_ctx, | ||
1217 | EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
1214 | EVP_DigestInit_ex(&md_ctx,(num == 2) | 1218 | EVP_DigestInit_ex(&md_ctx,(num == 2) |
1215 | ?s->ctx->md5:s->ctx->sha1, NULL); | 1219 | ?s->ctx->md5:s->ctx->sha1, NULL); |
1216 | EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); | 1220 | EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); |
@@ -1491,7 +1495,8 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1491 | i = SSL_MAX_MASTER_KEY_LENGTH; | 1495 | i = SSL_MAX_MASTER_KEY_LENGTH; |
1492 | p[0] = s->client_version >> 8; | 1496 | p[0] = s->client_version >> 8; |
1493 | p[1] = s->client_version & 0xff; | 1497 | p[1] = s->client_version & 0xff; |
1494 | RAND_pseudo_bytes(p+2, i-2); /* should be RAND_bytes, but we cannot work around a failure */ | 1498 | if(RAND_pseudo_bytes(p+2, i-2) <= 0) /* should be RAND_bytes, but we cannot work around a failure */ |
1499 | goto err; | ||
1495 | } | 1500 | } |
1496 | 1501 | ||
1497 | s->session->master_key_length= | 1502 | s->session->master_key_length= |
@@ -1589,7 +1594,7 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1589 | n2s(p,i); | 1594 | n2s(p,i); |
1590 | enc_ticket.length = i; | 1595 | enc_ticket.length = i; |
1591 | 1596 | ||
1592 | if (n < enc_ticket.length + 6) | 1597 | if (n < (long)enc_ticket.length + 6) |
1593 | { | 1598 | { |
1594 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 1599 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
1595 | SSL_R_DATA_LENGTH_TOO_LONG); | 1600 | SSL_R_DATA_LENGTH_TOO_LONG); |
@@ -1602,7 +1607,7 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1602 | n2s(p,i); | 1607 | n2s(p,i); |
1603 | authenticator.length = i; | 1608 | authenticator.length = i; |
1604 | 1609 | ||
1605 | if (n < enc_ticket.length + authenticator.length + 6) | 1610 | if (n < (long)(enc_ticket.length + authenticator.length + 6)) |
1606 | { | 1611 | { |
1607 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 1612 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
1608 | SSL_R_DATA_LENGTH_TOO_LONG); | 1613 | SSL_R_DATA_LENGTH_TOO_LONG); |
@@ -1627,8 +1632,8 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1627 | goto err; | 1632 | goto err; |
1628 | } | 1633 | } |
1629 | 1634 | ||
1630 | if (n != enc_ticket.length + authenticator.length + | 1635 | if (n != (long)(enc_ticket.length + authenticator.length + |
1631 | enc_pms.length + 6) | 1636 | enc_pms.length + 6)) |
1632 | { | 1637 | { |
1633 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 1638 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
1634 | SSL_R_DATA_LENGTH_TOO_LONG); | 1639 | SSL_R_DATA_LENGTH_TOO_LONG); |
diff --git a/src/lib/libssl/src/CHANGES b/src/lib/libssl/src/CHANGES index 4a0363a1c2..cccc4f812f 100644 --- a/src/lib/libssl/src/CHANGES +++ b/src/lib/libssl/src/CHANGES | |||
@@ -2,6 +2,112 @@ | |||
2 | OpenSSL CHANGES | 2 | OpenSSL CHANGES |
3 | _______________ | 3 | _______________ |
4 | 4 | ||
5 | Changes between 0.9.7f and 0.9.7g [11 Apr 2005] | ||
6 | |||
7 | *) Fixes for newer kerberos headers. NB: the casts are needed because | ||
8 | the 'length' field is signed on one version and unsigned on another | ||
9 | with no (?) obvious way to tell the difference, without these VC++ | ||
10 | complains. Also the "definition" of FAR (blank) is no longer included | ||
11 | nor is the error ENOMEM. KRB5_PRIVATE has to be set to 1 to pick up | ||
12 | some needed definitions. | ||
13 | [Steve Henson] | ||
14 | |||
15 | *) Undo Cygwin change. | ||
16 | [Ulf Möller] | ||
17 | |||
18 | *) Added support for proxy certificates according to RFC 3820. | ||
19 | Because they may be a security thread to unaware applications, | ||
20 | they must be explicitely allowed in run-time. See | ||
21 | docs/HOWTO/proxy_certificates.txt for further information. | ||
22 | [Richard Levitte] | ||
23 | |||
24 | Changes between 0.9.7e and 0.9.7f [22 Mar 2005] | ||
25 | |||
26 | *) Use (SSL_RANDOM_VALUE - 4) bytes of pseudo random data when generating | ||
27 | server and client random values. Previously | ||
28 | (SSL_RANDOM_VALUE - sizeof(time_t)) would be used which would result in | ||
29 | less random data when sizeof(time_t) > 4 (some 64 bit platforms). | ||
30 | |||
31 | This change has negligible security impact because: | ||
32 | |||
33 | 1. Server and client random values still have 24 bytes of pseudo random | ||
34 | data. | ||
35 | |||
36 | 2. Server and client random values are sent in the clear in the initial | ||
37 | handshake. | ||
38 | |||
39 | 3. The master secret is derived using the premaster secret (48 bytes in | ||
40 | size for static RSA ciphersuites) as well as client server and random | ||
41 | values. | ||
42 | |||
43 | The OpenSSL team would like to thank the UK NISCC for bringing this issue | ||
44 | to our attention. | ||
45 | |||
46 | [Stephen Henson, reported by UK NISCC] | ||
47 | |||
48 | *) Use Windows randomness collection on Cygwin. | ||
49 | [Ulf Möller] | ||
50 | |||
51 | *) Fix hang in EGD/PRNGD query when communication socket is closed | ||
52 | prematurely by EGD/PRNGD. | ||
53 | [Darren Tucker <dtucker@zip.com.au> via Lutz Jänicke, resolves #1014] | ||
54 | |||
55 | *) Prompt for pass phrases when appropriate for PKCS12 input format. | ||
56 | [Steve Henson] | ||
57 | |||
58 | *) Back-port of selected performance improvements from development | ||
59 | branch, as well as improved support for PowerPC platforms. | ||
60 | [Andy Polyakov] | ||
61 | |||
62 | *) Add lots of checks for memory allocation failure, error codes to indicate | ||
63 | failure and freeing up memory if a failure occurs. | ||
64 | [Nauticus Networks SSL Team <openssl@nauticusnet.com>, Steve Henson] | ||
65 | |||
66 | *) Add new -passin argument to dgst. | ||
67 | [Steve Henson] | ||
68 | |||
69 | *) Perform some character comparisons of different types in X509_NAME_cmp: | ||
70 | this is needed for some certificates that reencode DNs into UTF8Strings | ||
71 | (in violation of RFC3280) and can't or wont issue name rollover | ||
72 | certificates. | ||
73 | [Steve Henson] | ||
74 | |||
75 | *) Make an explicit check during certificate validation to see that | ||
76 | the CA setting in each certificate on the chain is correct. As a | ||
77 | side effect always do the following basic checks on extensions, | ||
78 | not just when there's an associated purpose to the check: | ||
79 | |||
80 | - if there is an unhandled critical extension (unless the user | ||
81 | has chosen to ignore this fault) | ||
82 | - if the path length has been exceeded (if one is set at all) | ||
83 | - that certain extensions fit the associated purpose (if one has | ||
84 | been given) | ||
85 | [Richard Levitte] | ||
86 | |||
87 | Changes between 0.9.7d and 0.9.7e [25 Oct 2004] | ||
88 | |||
89 | *) Avoid a race condition when CRLs are checked in a multi threaded | ||
90 | environment. This would happen due to the reordering of the revoked | ||
91 | entries during signature checking and serial number lookup. Now the | ||
92 | encoding is cached and the serial number sort performed under a lock. | ||
93 | Add new STACK function sk_is_sorted(). | ||
94 | [Steve Henson] | ||
95 | |||
96 | *) Add Delta CRL to the extension code. | ||
97 | [Steve Henson] | ||
98 | |||
99 | *) Various fixes to s3_pkt.c so alerts are sent properly. | ||
100 | [David Holmes <d.holmes@f5.com>] | ||
101 | |||
102 | *) Reduce the chances of duplicate issuer name and serial numbers (in | ||
103 | violation of RFC3280) using the OpenSSL certificate creation utilities. | ||
104 | This is done by creating a random 64 bit value for the initial serial | ||
105 | number when a serial number file is created or when a self signed | ||
106 | certificate is created using 'openssl req -x509'. The initial serial | ||
107 | number file is created using 'openssl x509 -next_serial' in CA.pl | ||
108 | rather than being initialized to 1. | ||
109 | [Steve Henson] | ||
110 | |||
5 | Changes between 0.9.7c and 0.9.7d [17 Mar 2004] | 111 | Changes between 0.9.7c and 0.9.7d [17 Mar 2004] |
6 | 112 | ||
7 | *) Fix null-pointer assignment in do_change_cipher_spec() revealed | 113 | *) Fix null-pointer assignment in do_change_cipher_spec() revealed |
@@ -2037,6 +2143,20 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k | |||
2037 | *) Clean old EAY MD5 hack from e_os.h. | 2143 | *) Clean old EAY MD5 hack from e_os.h. |
2038 | [Richard Levitte] | 2144 | [Richard Levitte] |
2039 | 2145 | ||
2146 | Changes between 0.9.6l and 0.9.6m [17 Mar 2004] | ||
2147 | |||
2148 | *) Fix null-pointer assignment in do_change_cipher_spec() revealed | ||
2149 | by using the Codenomicon TLS Test Tool (CAN-2004-0079) | ||
2150 | [Joe Orton, Steve Henson] | ||
2151 | |||
2152 | Changes between 0.9.6k and 0.9.6l [04 Nov 2003] | ||
2153 | |||
2154 | *) Fix additional bug revealed by the NISCC test suite: | ||
2155 | |||
2156 | Stop bug triggering large recursion when presented with | ||
2157 | certain ASN.1 tags (CAN-2003-0851) | ||
2158 | [Steve Henson] | ||
2159 | |||
2040 | Changes between 0.9.6j and 0.9.6k [30 Sep 2003] | 2160 | Changes between 0.9.6j and 0.9.6k [30 Sep 2003] |
2041 | 2161 | ||
2042 | *) Fix various bugs revealed by running the NISCC test suite: | 2162 | *) Fix various bugs revealed by running the NISCC test suite: |
diff --git a/src/lib/libssl/src/Configure b/src/lib/libssl/src/Configure index 4e7883c17a..e0e732c445 100644 --- a/src/lib/libssl/src/Configure +++ b/src/lib/libssl/src/Configure | |||
@@ -10,7 +10,7 @@ use strict; | |||
10 | 10 | ||
11 | # see INSTALL for instructions. | 11 | # see INSTALL for instructions. |
12 | 12 | ||
13 | my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-engine] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n"; | 13 | my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-engine] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [[no-]fips] [debug] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n"; |
14 | 14 | ||
15 | # Options: | 15 | # Options: |
16 | # | 16 | # |
@@ -135,15 +135,16 @@ my %table=( | |||
135 | # Our development configs | 135 | # Our development configs |
136 | "purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::", | 136 | "purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::", |
137 | "debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::", | 137 | "debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::", |
138 | "debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::asm/bn86-elf.o asm/co86-elf.o", | 138 | "debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -Wall -Wshadow -Werror -pipe::(unknown)::::asm/bn86-elf.o asm/co86-elf.o", |
139 | "debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", | 139 | "debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", |
140 | "debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", | 140 | "debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", |
141 | "debug-ben-debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::::", | 141 | "debug-ben-debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -Wall -Wshadow -Werror -pipe::(unknown)::::::", |
142 | "debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::", | 142 | "debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::", |
143 | "debug-ben-fips-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_FIPS -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::asm/bn86-elf.o asm/co86-elf.o", | ||
143 | "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", | 144 | "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", |
144 | "debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -m486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", | 145 | "debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -m486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", |
145 | "debug-ulf", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -m486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT:::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", | 146 | "debug-ulf", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -m486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT:::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", |
146 | "debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -mcpu=i486 -pedantic -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", | 147 | "debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -mcpu=i486 -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", |
147 | "debug-steve-linux-pseudo64", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT::dlfcn", | 148 | "debug-steve-linux-pseudo64", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT::dlfcn", |
148 | "debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wmissing-prototypes -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 149 | "debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wmissing-prototypes -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
149 | "debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wmissing-prototypes -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 150 | "debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wmissing-prototypes -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
@@ -155,6 +156,12 @@ my %table=( | |||
155 | "gcc", "gcc:-O3::(unknown):::BN_LLONG:::", | 156 | "gcc", "gcc:-O3::(unknown):::BN_LLONG:::", |
156 | "cc", "cc:-O::(unknown)::::::", | 157 | "cc", "cc:-O::(unknown)::::::", |
157 | 158 | ||
159 | ####VOS Configurations | ||
160 | "vos-gcc","gcc:-b hppa1.1-stratus-vos -O3 -Wall -Wuninitialized -D_POSIX_C_SOURCE=200112L -D_BSD::(unknown):VOS:-Wl,-map:BN_LLONG:::::::::::::.so:", | ||
161 | "debug-vos-gcc","gcc:-b hppa1.1-stratus-vos -O0 -g -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:::::::::::::.so:", | ||
162 | "vos-vcc","vcc:-b i386-stratus-vos -O3 -D_POSIX_C_SOURCE=200112L -D_BSD::(unknown):VOS:-Wl,-map::::::::::::::.so:", | ||
163 | "debug-vos-vcc","vcc:-b i386-stratus-vos -O0 -g -D_POSIX_C_SOURCE=200112L -D_BSD -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map::::::::::::::.so:", | ||
164 | |||
158 | #### Solaris x86 with GNU C setups | 165 | #### Solaris x86 with GNU C setups |
159 | # -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it | 166 | # -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it |
160 | # here because whenever GNU C instantiates an assembler template it | 167 | # here because whenever GNU C instantiates an assembler template it |
@@ -162,9 +169,19 @@ my %table=( | |||
162 | # 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic" | 169 | # 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic" |
163 | # error message. | 170 | # error message. |
164 | "solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 171 | "solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
172 | # -shared -static-libgcc might appear controversial, but modules taken | ||
173 | # from static libgcc do not have relocations and linking them into our | ||
174 | # shared objects doesn't have any negative side-effects. On the contrary, | ||
175 | # doing so makes it possible to use gcc shared build with Sun C. Given | ||
176 | # that gcc generates faster code [thanks to inline assembler], I would | ||
177 | # actually recommend to consider using gcc shared build even with vendor | ||
178 | # compiler:-) | ||
179 | # <appro@fy.chalmers.se> | ||
180 | "solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=int::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:asm/x86_64-gcc.o::::::asm/rc4-amd64.o:::dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | ||
165 | 181 | ||
166 | #### Solaris x86 with Sun C setups | 182 | #### Solaris x86 with Sun C setups |
167 | "solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 183 | "solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
184 | "solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL::::::::::dlfcn:solaris-shared:-KPIC:-xarch=amd64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | ||
168 | 185 | ||
169 | #### SPARC Solaris with GNU C setups | 186 | #### SPARC Solaris with GNU C setups |
170 | "solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 187 | "solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
@@ -263,10 +280,10 @@ my %table=( | |||
263 | "hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2W.o:::::::::dlfcn:hpux64-shared:-fpic::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 280 | "hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2W.o:::::::::dlfcn:hpux64-shared:-fpic::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
264 | 281 | ||
265 | # IA-64 targets | 282 | # IA-64 targets |
266 | "hpux-ia64-cc","cc:-Ae +DD32 +O3 +Olit=all -z -DB_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/ia64-cpp.o:::::::::dlfcn:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 283 | "hpux-ia64-cc","cc:-Ae +DD32 +O3 +Olit=all -z -DB_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:asm/ia64-cpp.o::::asm/sha1-ia64.o::asm/rc4-ia64.o:::dlfcn:hpux-shared:+Z::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
267 | # Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with | 284 | # Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with |
268 | # with debugging of the following config. | 285 | # with debugging of the following config. |
269 | "hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=all -z -DB_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/ia64-cpp.o:::::::::dlfcn:hpux64-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 286 | "hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=all -z -DB_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:asm/ia64-cpp.o::::asm/sha1-ia64.o::asm/rc4-ia64.o:::dlfcn:hpux64-shared:+Z::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
270 | 287 | ||
271 | # More attempts at unified 10.X and 11.X targets for HP C compiler. | 288 | # More attempts at unified 10.X and 11.X targets for HP C compiler. |
272 | # | 289 | # |
@@ -382,17 +399,20 @@ my %table=( | |||
382 | "debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", | 399 | "debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", |
383 | "debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", | 400 | "debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", |
384 | "debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 401 | "debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
385 | "debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", | 402 | "debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
386 | "linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}", | 403 | "linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}", |
387 | "linux-mipsel", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 404 | "linux-mipsel", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
388 | "linux-mips", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 405 | "linux-mips", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
389 | "linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 406 | "linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:asm/linux_ppc32.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
407 | # -bpowerpc64-linux is transient option, -m64 should be the one to use... | ||
408 | "linux-ppc64", "gcc:-bpowerpc64-linux -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:asm/linux_ppc64.o:::::::::dlfcn:linux-shared:-fPIC:-bpowerpc64-linux:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | ||
390 | "linux-m68k", "gcc:-DB_ENDIAN -DTERMIO -O2 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::", | 409 | "linux-m68k", "gcc:-DB_ENDIAN -DTERMIO -O2 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::", |
391 | "linux-s390", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 410 | "linux-s390", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
392 | "linux-s390x", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 411 | "linux-s390x", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
393 | "linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR:asm/ia64.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 412 | "linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/ia64.o::::asm/sha1-ia64.o::asm/rc4-ia64.o:::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
394 | "linux-ia64-ecc", "ecc:-DL_ENDIAN -DTERMIO -O2 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR:asm/ia64.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 413 | "linux-ia64-ecc", "ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/ia64.o::::asm/sha1-ia64.o::asm/rc4-ia64.o:::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
395 | "linux-x86_64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR BF_PTR2 DES_INT DES_UNROLL:asm/x86_64-gcc.o:::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 414 | "linux-x86_64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:asm/x86_64-gcc.o::::::asm/rc4-amd64.o:::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
415 | "linux-em64t", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR BF_PTR2 DES_INT DES_UNROLL:asm/x86_64-gcc.o:::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | ||
396 | "NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 416 | "NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
397 | "NetBSD-m68", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 417 | "NetBSD-m68", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
398 | "NetBSD-x86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 418 | "NetBSD-x86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
@@ -415,7 +435,9 @@ my %table=( | |||
415 | "qnx6", "cc:-DL_ENDIAN -DTERMIOS::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:", | 435 | "qnx6", "cc:-DL_ENDIAN -DTERMIOS::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:", |
416 | 436 | ||
417 | # Linux on ARM | 437 | # Linux on ARM |
418 | "linux-elf-arm","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 438 | # ARM comes in both little- and big-endian flavors. The following line is |
439 | # endian neutral, but ./config is free to throw in -D[BL]_ENDIAN... | ||
440 | "linux-elf-arm","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | ||
419 | 441 | ||
420 | # SCO/Caldera targets. | 442 | # SCO/Caldera targets. |
421 | # | 443 | # |
@@ -442,11 +464,10 @@ my %table=( | |||
442 | 464 | ||
443 | 465 | ||
444 | # IBM's AIX. | 466 | # IBM's AIX. |
445 | "aix-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::", | 467 | "aix3-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::", |
446 | "aix-gcc", "gcc:-O3 -DB_ENDIAN::(unknown):AIX::BN_LLONG RC4_CHAR:::", | 468 | "aix-gcc", "gcc:-O3 -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR:asm/aix_ppc32.o:::::::::dlfcn:", |
447 | "aix43-cc", "cc:-O -DAIX -DB_ENDIAN -qmaxmem=16384::(unknown):::BN_LLONG RC4_CHAR::::::::::dlfcn:aix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::", | 469 | "aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384::-qthreaded:AIX::BN_LLONG RC4_CHAR:asm/aix_ppc32.o:::::::::dlfcn:aix-shared::-q32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", |
448 | "aix43-gcc", "gcc:-O1 -DAIX -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR::::::::::dlfcn:", | 470 | "aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:asm/aix_ppc64.o:::::::::dlfcn:aix-shared::-q64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64", |
449 | "aix64-cc", "cc:-O -DAIX -DB_ENDIAN -qmaxmem=16384 -q64::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHAR::::::::::dlfcn:aix-shared::-q64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64", | ||
450 | 471 | ||
451 | # | 472 | # |
452 | # Cray T90 and similar (SDSC) | 473 | # Cray T90 and similar (SDSC) |
@@ -509,17 +530,17 @@ my %table=( | |||
509 | "BC-16","bcc:::(unknown):WIN16::BN_LLONG DES_PTR RC4_INDEX SIXTEEN_BIT:::", | 530 | "BC-16","bcc:::(unknown):WIN16::BN_LLONG DES_PTR RC4_INDEX SIXTEEN_BIT:::", |
510 | 531 | ||
511 | # MinGW | 532 | # MinGW |
512 | "mingw", "gcc:-DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -mno-cygwin -Wall:::MINGW32:-mno-cygwin -lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:win32::::.dll", | 533 | "mingw", "gcc:-DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -mno-cygwin -Wall:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll", |
513 | 534 | ||
514 | # UWIN | 535 | # UWIN |
515 | "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32", | 536 | "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32", |
516 | 537 | ||
517 | # Cygwin | 538 | # Cygwin |
518 | "Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32", | 539 | "Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32", |
519 | "Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:win32:cygwin-shared:::.dll", | 540 | "Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:cygwin-shared:-D_WINDLL::.dll", |
520 | 541 | ||
521 | # DJGPP | 542 | # DJGPP |
522 | "DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::", | 543 | "DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall -DDEVRANDOM=\"/dev/urandom\\x24\":::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::", |
523 | 544 | ||
524 | # Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at> | 545 | # Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at> |
525 | "ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::", | 546 | "ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::", |
@@ -542,7 +563,7 @@ my %table=( | |||
542 | 563 | ||
543 | ##### MacOS X (a.k.a. Rhapsody or Darwin) setup | 564 | ##### MacOS X (a.k.a. Rhapsody or Darwin) setup |
544 | "rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::", | 565 | "rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::", |
545 | "darwin-ppc-cc","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", | 566 | "darwin-ppc-cc","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/osx_ppc32.o::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", |
546 | "darwin-i386-cc","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", | 567 | "darwin-i386-cc","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", |
547 | 568 | ||
548 | ##### A/UX | 569 | ##### A/UX |
@@ -609,7 +630,7 @@ my $threads=0; | |||
609 | my $no_asm=0; | 630 | my $no_asm=0; |
610 | my $no_dso=0; | 631 | my $no_dso=0; |
611 | my @skip=(); | 632 | my @skip=(); |
612 | my $Makefile="Makefile.ssl"; | 633 | my $Makefile="Makefile"; |
613 | my $des_locl="crypto/des/des_locl.h"; | 634 | my $des_locl="crypto/des/des_locl.h"; |
614 | my $des ="crypto/des/des.h"; | 635 | my $des ="crypto/des/des.h"; |
615 | my $bn ="crypto/bn/bn.h"; | 636 | my $bn ="crypto/bn/bn.h"; |
@@ -621,6 +642,7 @@ my $rc2 ="crypto/rc2/rc2.h"; | |||
621 | my $bf ="crypto/bf/bf_locl.h"; | 642 | my $bf ="crypto/bf/bf_locl.h"; |
622 | my $bn_asm ="bn_asm.o"; | 643 | my $bn_asm ="bn_asm.o"; |
623 | my $des_enc="des_enc.o fcrypt_b.o"; | 644 | my $des_enc="des_enc.o fcrypt_b.o"; |
645 | my $fips_des_enc="fips_des_enc.o"; | ||
624 | my $bf_enc ="bf_enc.o"; | 646 | my $bf_enc ="bf_enc.o"; |
625 | my $cast_enc="c_enc.o"; | 647 | my $cast_enc="c_enc.o"; |
626 | my $rc4_enc="rc4_enc.o"; | 648 | my $rc4_enc="rc4_enc.o"; |
@@ -631,6 +653,8 @@ my $rmd160_obj=""; | |||
631 | my $processor=""; | 653 | my $processor=""; |
632 | my $default_ranlib; | 654 | my $default_ranlib; |
633 | my $perl; | 655 | my $perl; |
656 | my $fips=0; | ||
657 | my $debug=0; | ||
634 | 658 | ||
635 | my $no_ssl2=0; | 659 | my $no_ssl2=0; |
636 | my $no_ssl3=0; | 660 | my $no_ssl3=0; |
@@ -640,10 +664,6 @@ my $no_sha=0; | |||
640 | my $no_rsa=0; | 664 | my $no_rsa=0; |
641 | my $no_dh=0; | 665 | my $no_dh=0; |
642 | 666 | ||
643 | $default_ranlib= &which("ranlib") or $default_ranlib="true"; | ||
644 | $perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl") | ||
645 | or $perl="perl"; | ||
646 | |||
647 | &usage if ($#ARGV < 0); | 667 | &usage if ($#ARGV < 0); |
648 | 668 | ||
649 | my $flags; | 669 | my $flags; |
@@ -739,6 +759,8 @@ PROCESS_ARGS: | |||
739 | { $no_ssl3 = 1; } | 759 | { $no_ssl3 = 1; } |
740 | elsif (/^no-tls1?$/) | 760 | elsif (/^no-tls1?$/) |
741 | { $no_tls1 = 1; } | 761 | { $no_tls1 = 1; } |
762 | elsif (/^no-fips$/) | ||
763 | { $fips = 0; } | ||
742 | elsif (/^no-(.+)$/) | 764 | elsif (/^no-(.+)$/) |
743 | { | 765 | { |
744 | my $algo=$1; | 766 | my $algo=$1; |
@@ -804,6 +826,14 @@ PROCESS_ARGS: | |||
804 | } | 826 | } |
805 | elsif (/^386$/) | 827 | elsif (/^386$/) |
806 | { $processor=386; } | 828 | { $processor=386; } |
829 | elsif (/^fips$/) | ||
830 | { | ||
831 | $fips=1; | ||
832 | } | ||
833 | elsif (/^debug$/) | ||
834 | { | ||
835 | $debug=1; | ||
836 | } | ||
807 | elsif (/^rsaref$/) | 837 | elsif (/^rsaref$/) |
808 | { | 838 | { |
809 | # No RSAref support any more since it's not needed. | 839 | # No RSAref support any more since it's not needed. |
@@ -920,11 +950,15 @@ print "Configuring for $target\n"; | |||
920 | 950 | ||
921 | my $IsWindows=scalar grep /^$target$/,@WinTargets; | 951 | my $IsWindows=scalar grep /^$target$/,@WinTargets; |
922 | 952 | ||
923 | $exe_ext=".exe" if ($target eq "Cygwin"); | 953 | $exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw"); |
924 | $exe_ext=".exe" if ($target eq "DJGPP"); | 954 | $exe_ext=".pm" if ($target eq "vos-gcc" or $target eq "debug-vos-gcc" or $target eq "vos-vcc" or $target eq "debug-vos-vcc"); |
925 | $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq ""); | 955 | $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq ""); |
926 | $prefix=$openssldir if $prefix eq ""; | 956 | $prefix=$openssldir if $prefix eq ""; |
927 | 957 | ||
958 | $default_ranlib= &which("ranlib") or $default_ranlib="true"; | ||
959 | $perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl") | ||
960 | or $perl="perl"; | ||
961 | |||
928 | chop $openssldir if $openssldir =~ /\/$/; | 962 | chop $openssldir if $openssldir =~ /\/$/; |
929 | chop $prefix if $prefix =~ /\/$/; | 963 | chop $prefix if $prefix =~ /\/$/; |
930 | 964 | ||
@@ -1139,12 +1173,26 @@ if ($ranlib eq "") | |||
1139 | 1173 | ||
1140 | $bn_obj = $bn_asm unless $bn_obj ne ""; | 1174 | $bn_obj = $bn_asm unless $bn_obj ne ""; |
1141 | 1175 | ||
1176 | my $fips_des_obj; | ||
1177 | my $fips_sha1_obj; | ||
1178 | if ($fips) | ||
1179 | { | ||
1180 | if ($des_obj =~ /\-elf\.o$/ && $no_shared) # FIPS DES module is not PIC | ||
1181 | { | ||
1182 | $fips_des_obj='asm/fips-dx86-elf.o'; | ||
1183 | $openssl_other_defines.="#define OPENSSL_FIPS_DES_ASM\n"; | ||
1184 | } | ||
1185 | else { $fips_des_obj=$fips_des_enc; } | ||
1186 | $fips_sha1_obj='asm/sx86-elf.o' if ($sha1_obj =~ /\-elf\.o$/); | ||
1187 | $des_obj=$sha1_obj=""; | ||
1188 | $openssl_other_defines.="#define OPENSSL_FIPS\n"; | ||
1189 | } | ||
1142 | $des_obj=$des_enc unless ($des_obj =~ /\.o$/); | 1190 | $des_obj=$des_enc unless ($des_obj =~ /\.o$/); |
1143 | $bf_obj=$bf_enc unless ($bf_obj =~ /\.o$/); | 1191 | $bf_obj=$bf_enc unless ($bf_obj =~ /\.o$/); |
1144 | $cast_obj=$cast_enc unless ($cast_obj =~ /\.o$/); | 1192 | $cast_obj=$cast_enc unless ($cast_obj =~ /\.o$/); |
1145 | $rc4_obj=$rc4_enc unless ($rc4_obj =~ /\.o$/); | 1193 | $rc4_obj=$rc4_enc unless ($rc4_obj =~ /\.o$/); |
1146 | $rc5_obj=$rc5_enc unless ($rc5_obj =~ /\.o$/); | 1194 | $rc5_obj=$rc5_enc unless ($rc5_obj =~ /\.o$/); |
1147 | if ($sha1_obj =~ /\.o$/) | 1195 | if ($sha1_obj =~ /\.o$/ || $fips_sha1_obj =~ /\.o$/) |
1148 | { | 1196 | { |
1149 | # $sha1_obj=$sha1_enc; | 1197 | # $sha1_obj=$sha1_enc; |
1150 | $cflags.=" -DSHA1_ASM"; | 1198 | $cflags.=" -DSHA1_ASM"; |
@@ -1160,6 +1208,12 @@ if ($rmd160_obj =~ /\.o$/) | |||
1160 | $cflags.=" -DRMD160_ASM"; | 1208 | $cflags.=" -DRMD160_ASM"; |
1161 | } | 1209 | } |
1162 | 1210 | ||
1211 | if ($debug) | ||
1212 | { | ||
1213 | $cflags.=" -g"; | ||
1214 | $cflags=~s/-fomit-frame-pointer//; | ||
1215 | } | ||
1216 | |||
1163 | # "Stringify" the C flags string. This permits it to be made part of a string | 1217 | # "Stringify" the C flags string. This permits it to be made part of a string |
1164 | # and works as well on command lines. | 1218 | # and works as well on command lines. |
1165 | $cflags =~ s/([\\\"])/\\\1/g; | 1219 | $cflags =~ s/([\\\"])/\\\1/g; |
@@ -1232,12 +1286,14 @@ while (<IN>) | |||
1232 | s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/; | 1286 | s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/; |
1233 | s/^BN_ASM=.*$/BN_ASM= $bn_obj/; | 1287 | s/^BN_ASM=.*$/BN_ASM= $bn_obj/; |
1234 | s/^DES_ENC=.*$/DES_ENC= $des_obj/; | 1288 | s/^DES_ENC=.*$/DES_ENC= $des_obj/; |
1289 | s/^FIPS_DES_ENC=.*$/FIPS_DES_ENC= $fips_des_obj/; | ||
1235 | s/^BF_ENC=.*$/BF_ENC= $bf_obj/; | 1290 | s/^BF_ENC=.*$/BF_ENC= $bf_obj/; |
1236 | s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/; | 1291 | s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/; |
1237 | s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/; | 1292 | s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/; |
1238 | s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/; | 1293 | s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/; |
1239 | s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/; | 1294 | s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/; |
1240 | s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/; | 1295 | s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/; |
1296 | s/^FIPS_SHA1_ASM_OBJ=.*$/FIPS_SHA1_ASM_OBJ= $fips_sha1_obj/; | ||
1241 | s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/; | 1297 | s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/; |
1242 | s/^PROCESSOR=.*/PROCESSOR= $processor/; | 1298 | s/^PROCESSOR=.*/PROCESSOR= $processor/; |
1243 | s/^RANLIB=.*/RANLIB= $ranlib/; | 1299 | s/^RANLIB=.*/RANLIB= $ranlib/; |
@@ -1470,7 +1526,7 @@ if($IsWindows) { | |||
1470 | printf OUT <<EOF; | 1526 | printf OUT <<EOF; |
1471 | #ifndef MK1MF_BUILD | 1527 | #ifndef MK1MF_BUILD |
1472 | /* auto-generated by Configure for crypto/cversion.c: | 1528 | /* auto-generated by Configure for crypto/cversion.c: |
1473 | * for Unix builds, crypto/Makefile.ssl generates functional definitions; | 1529 | * for Unix builds, crypto/Makefile generates functional definitions; |
1474 | * Windows builds (and other mk1mf builds) compile cversion.c with | 1530 | * Windows builds (and other mk1mf builds) compile cversion.c with |
1475 | * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */ | 1531 | * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */ |
1476 | #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles" | 1532 | #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles" |
@@ -1478,7 +1534,7 @@ if($IsWindows) { | |||
1478 | EOF | 1534 | EOF |
1479 | close(OUT); | 1535 | close(OUT); |
1480 | } else { | 1536 | } else { |
1481 | my $make_command = "make -f Makefile.ssl PERL=\'$perl\'"; | 1537 | my $make_command = "make PERL=\'$perl\'"; |
1482 | my $make_targets = ""; | 1538 | my $make_targets = ""; |
1483 | $make_targets .= " links" if $symlink; | 1539 | $make_targets .= " links" if $symlink; |
1484 | $make_targets .= " depend" if $depflags ne "" && $make_depend; | 1540 | $make_targets .= " depend" if $depflags ne "" && $make_depend; |
@@ -1487,12 +1543,10 @@ EOF | |||
1487 | if $make_targets ne ""; | 1543 | if $make_targets ne ""; |
1488 | if ( $perl =~ m@^/@) { | 1544 | if ( $perl =~ m@^/@) { |
1489 | &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";'); | 1545 | &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";'); |
1490 | &dofile("apps/der_chop",$perl,'^#!/', '#!%s'); | ||
1491 | &dofile("apps/CA.pl",$perl,'^#!/', '#!%s'); | 1546 | &dofile("apps/CA.pl",$perl,'^#!/', '#!%s'); |
1492 | } else { | 1547 | } else { |
1493 | # No path for Perl known ... | 1548 | # No path for Perl known ... |
1494 | &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";'); | 1549 | &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";'); |
1495 | &dofile("apps/der_chop",'/usr/local/bin/perl','^#!/', '#!%s'); | ||
1496 | &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s'); | 1550 | &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s'); |
1497 | } | 1551 | } |
1498 | if ($depflags ne "" && !$make_depend) { | 1552 | if ($depflags ne "" && !$make_depend) { |
@@ -1569,10 +1623,10 @@ sub which | |||
1569 | my $path; | 1623 | my $path; |
1570 | foreach $path (split /:/, $ENV{PATH}) | 1624 | foreach $path (split /:/, $ENV{PATH}) |
1571 | { | 1625 | { |
1572 | if (-f "$path/$name" and -x _) | 1626 | if (-f "$path/$name$exe_ext" and -x _) |
1573 | { | 1627 | { |
1574 | return "$path/$name" unless ($name eq "perl" and | 1628 | return "$path/$name$exe_ext" unless ($name eq "perl" and |
1575 | system("$path/$name -e " . '\'exit($]<5.0);\'')); | 1629 | system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\'')); |
1576 | } | 1630 | } |
1577 | } | 1631 | } |
1578 | } | 1632 | } |
diff --git a/src/lib/libssl/src/FAQ b/src/lib/libssl/src/FAQ index 0b40039ef8..943fc9d4a3 100644 --- a/src/lib/libssl/src/FAQ +++ b/src/lib/libssl/src/FAQ | |||
@@ -52,6 +52,7 @@ OpenSSL - Frequently Asked Questions | |||
52 | * Is OpenSSL thread-safe? | 52 | * Is OpenSSL thread-safe? |
53 | * I've compiled a program under Windows and it crashes: why? | 53 | * I've compiled a program under Windows and it crashes: why? |
54 | * How do I read or write a DER encoded buffer using the ASN1 functions? | 54 | * How do I read or write a DER encoded buffer using the ASN1 functions? |
55 | * OpenSSL uses DER but I need BER format: does OpenSSL support BER? | ||
55 | * I've tried using <M_some_evil_pkcs12_macro> and I get errors why? | 56 | * I've tried using <M_some_evil_pkcs12_macro> and I get errors why? |
56 | * I've called <some function> and it fails, why? | 57 | * I've called <some function> and it fails, why? |
57 | * I just get a load of numbers for the error output, what do they mean? | 58 | * I just get a load of numbers for the error output, what do they mean? |
@@ -60,6 +61,7 @@ OpenSSL - Frequently Asked Questions | |||
60 | * Can I use OpenSSL's SSL library with non-blocking I/O? | 61 | * Can I use OpenSSL's SSL library with non-blocking I/O? |
61 | * Why doesn't my server application receive a client certificate? | 62 | * Why doesn't my server application receive a client certificate? |
62 | * Why does compilation fail due to an undefined symbol NID_uniqueIdentifier? | 63 | * Why does compilation fail due to an undefined symbol NID_uniqueIdentifier? |
64 | * I think I've detected a memory leak, is this a bug? | ||
63 | 65 | ||
64 | =============================================================================== | 66 | =============================================================================== |
65 | 67 | ||
@@ -68,7 +70,7 @@ OpenSSL - Frequently Asked Questions | |||
68 | * Which is the current version of OpenSSL? | 70 | * Which is the current version of OpenSSL? |
69 | 71 | ||
70 | The current version is available from <URL: http://www.openssl.org>. | 72 | The current version is available from <URL: http://www.openssl.org>. |
71 | OpenSSL 0.9.7d was released on March 17, 2004. | 73 | OpenSSL 0.9.7g was released on April 11, 2005. |
72 | 74 | ||
73 | In addition to the current stable release, you can also access daily | 75 | In addition to the current stable release, you can also access daily |
74 | snapshots of the OpenSSL development version at <URL: | 76 | snapshots of the OpenSSL development version at <URL: |
@@ -460,7 +462,7 @@ get the best result from OpenSSL. A bit more complicated solution is the | |||
460 | following: | 462 | following: |
461 | 463 | ||
462 | ----- snip:start ----- | 464 | ----- snip:start ----- |
463 | make DIRS=crypto SDIRS=sha "`grep '^CFLAG=' Makefile.ssl | \ | 465 | make DIRS=crypto SDIRS=sha "`grep '^CFLAG=' Makefile | \ |
464 | sed -e 's/ -O[0-9] / -O0 /'`" | 466 | sed -e 's/ -O[0-9] / -O0 /'`" |
465 | rm `ls crypto/*.o crypto/sha/*.o | grep -v 'sha_dgst\.o'` | 467 | rm `ls crypto/*.o crypto/sha/*.o | grep -v 'sha_dgst\.o'` |
466 | make | 468 | make |
@@ -470,6 +472,10 @@ This will only compile sha_dgst.c with -O0, the rest with the optimization | |||
470 | level chosen by the configuration process. When the above is done, do the | 472 | level chosen by the configuration process. When the above is done, do the |
471 | test and installation and you're set. | 473 | test and installation and you're set. |
472 | 474 | ||
475 | 3. Reconfigure the toolkit with no-sha0 option to leave out SHA0. It | ||
476 | should not be used and is not used in SSL/TLS nor any other recognized | ||
477 | protocol in either case. | ||
478 | |||
473 | 479 | ||
474 | * Why does the OpenSSL compilation fail with "ar: command not found"? | 480 | * Why does the OpenSSL compilation fail with "ar: command not found"? |
475 | 481 | ||
@@ -683,6 +689,20 @@ and attempts to free the buffer will have unpredictable results | |||
683 | because it no longer points to the same address. | 689 | because it no longer points to the same address. |
684 | 690 | ||
685 | 691 | ||
692 | * OpenSSL uses DER but I need BER format: does OpenSSL support BER? | ||
693 | |||
694 | The short answer is yes, because DER is a special case of BER and OpenSSL | ||
695 | ASN1 decoders can process BER. | ||
696 | |||
697 | The longer answer is that ASN1 structures can be encoded in a number of | ||
698 | different ways. One set of ways is the Basic Encoding Rules (BER) with various | ||
699 | permissible encodings. A restriction of BER is the Distinguished Encoding | ||
700 | Rules (DER): these uniquely specify how a given structure is encoded. | ||
701 | |||
702 | Therefore, because DER is a special case of BER, DER is an acceptable encoding | ||
703 | for BER. | ||
704 | |||
705 | |||
686 | * I've tried using <M_some_evil_pkcs12_macro> and I get errors why? | 706 | * I've tried using <M_some_evil_pkcs12_macro> and I get errors why? |
687 | 707 | ||
688 | This usually happens when you try compiling something using the PKCS#12 | 708 | This usually happens when you try compiling something using the PKCS#12 |
@@ -765,5 +785,28 @@ The correct name according to RFC2256 (LDAP) is x500UniqueIdentifier. | |||
765 | Change your code to use the new name when compiling against OpenSSL 0.9.7. | 785 | Change your code to use the new name when compiling against OpenSSL 0.9.7. |
766 | 786 | ||
767 | 787 | ||
788 | * I think I've detected a memory leak, is this a bug? | ||
789 | |||
790 | In most cases the cause of an apparent memory leak is an OpenSSL internal table | ||
791 | that is allocated when an application starts up. Since such tables do not grow | ||
792 | in size over time they are harmless. | ||
793 | |||
794 | These internal tables can be freed up when an application closes using various | ||
795 | functions. Currently these include following: | ||
796 | |||
797 | Thread-local cleanup functions: | ||
798 | |||
799 | ERR_remove_state() | ||
800 | |||
801 | Application-global cleanup functions that are aware of usage (and therefore | ||
802 | thread-safe): | ||
803 | |||
804 | ENGINE_cleanup() and CONF_modules_unload() | ||
805 | |||
806 | "Brutal" (thread-unsafe) Application-global cleanup functions: | ||
807 | |||
808 | ERR_free_strings(), EVP_cleanup() and CRYPTO_cleanup_all_ex_data(). | ||
809 | |||
810 | |||
768 | =============================================================================== | 811 | =============================================================================== |
769 | 812 | ||
diff --git a/src/lib/libssl/src/INSTALL b/src/lib/libssl/src/INSTALL index 1c3f3c3fe9..503474f2e4 100644 --- a/src/lib/libssl/src/INSTALL +++ b/src/lib/libssl/src/INSTALL | |||
@@ -123,7 +123,7 @@ | |||
123 | generic configurations "cc" or "gcc" should usually work on 32 bit | 123 | generic configurations "cc" or "gcc" should usually work on 32 bit |
124 | systems. | 124 | systems. |
125 | 125 | ||
126 | Configure creates the file Makefile.ssl from Makefile.org and | 126 | Configure creates the file Makefile from Makefile.org and |
127 | defines various macros in crypto/opensslconf.h (generated from | 127 | defines various macros in crypto/opensslconf.h (generated from |
128 | crypto/opensslconf.h.in). | 128 | crypto/opensslconf.h.in). |
129 | 129 | ||
@@ -159,7 +159,7 @@ | |||
159 | the failure that isn't a problem in OpenSSL itself (like a missing | 159 | the failure that isn't a problem in OpenSSL itself (like a missing |
160 | or malfunctioning bc). If it is a problem with OpenSSL itself, | 160 | or malfunctioning bc). If it is a problem with OpenSSL itself, |
161 | try removing any compiler optimization flags from the CFLAG line | 161 | try removing any compiler optimization flags from the CFLAG line |
162 | in Makefile.ssl and run "make clean; make". Please send a bug | 162 | in Makefile and run "make clean; make". Please send a bug |
163 | report to <openssl-bugs@openssl.org>, including the output of | 163 | report to <openssl-bugs@openssl.org>, including the output of |
164 | "make report" in order to be added to the request tracker at | 164 | "make report" in order to be added to the request tracker at |
165 | http://www.openssl.org/support/rt2.html. | 165 | http://www.openssl.org/support/rt2.html. |
diff --git a/src/lib/libssl/src/INSTALL.W32 b/src/lib/libssl/src/INSTALL.W32 index 0f6c302f0d..c277efa18b 100644 --- a/src/lib/libssl/src/INSTALL.W32 +++ b/src/lib/libssl/src/INSTALL.W32 | |||
@@ -46,12 +46,13 @@ | |||
46 | http://www.kernel.org/pub/software/devel/nasm/binaries/win32/ | 46 | http://www.kernel.org/pub/software/devel/nasm/binaries/win32/ |
47 | The NASM binary nasmw.exe needs to be installed anywhere on your PATH. | 47 | The NASM binary nasmw.exe needs to be installed anywhere on your PATH. |
48 | 48 | ||
49 | Firstly you should run Configure: | 49 | Firstly you should run Configure (to build a FIPS-certified variant of |
50 | OpenSSL, add the option "fips"): | ||
50 | 51 | ||
51 | > perl Configure VC-WIN32 | 52 | > perl Configure VC-WIN32 |
52 | 53 | ||
53 | Next you need to build the Makefiles and optionally the assembly language | 54 | Next you need to build the Makefiles and optionally the assembly language |
54 | files: | 55 | files (to build a FIPS-certified variant of OpenSSL, add the argument "fips"): |
55 | 56 | ||
56 | - If you are using MASM then run: | 57 | - If you are using MASM then run: |
57 | 58 | ||
@@ -100,10 +101,12 @@ | |||
100 | Borland C++ builder 5 | 101 | Borland C++ builder 5 |
101 | --------------------- | 102 | --------------------- |
102 | 103 | ||
103 | * Configure for building with Borland Builder: | 104 | * Configure for building with Borland Builder (to build a FIPS-certified |
105 | variant of OpenSSL, add the option "fips"): | ||
104 | > perl Configure BC-32 | 106 | > perl Configure BC-32 |
105 | 107 | ||
106 | * Create the appropriate makefile | 108 | * Create the appropriate makefile (to build a FIPS-certified variant of |
109 | OpenSSL, add the argument "fips") | ||
107 | > ms\do_nasm | 110 | > ms\do_nasm |
108 | 111 | ||
109 | * Build | 112 | * Build |
@@ -194,6 +197,8 @@ | |||
194 | occur, try | 197 | occur, try |
195 | > ms\mingw32 no-asm | 198 | > ms\mingw32 no-asm |
196 | instead. | 199 | instead. |
200 | If you want to build a FIPS-certified variant of OpenSSL, add the argument | ||
201 | "fips" | ||
197 | 202 | ||
198 | libcrypto.a and libssl.a are the static libraries. To use the DLLs, | 203 | libcrypto.a and libssl.a are the static libraries. To use the DLLs, |
199 | link with libeay32.a and libssl32.a instead. | 204 | link with libeay32.a and libssl32.a instead. |
diff --git a/src/lib/libssl/src/Makefile.org b/src/lib/libssl/src/Makefile.org index a987a0298b..cc4000b148 100644 --- a/src/lib/libssl/src/Makefile.org +++ b/src/lib/libssl/src/Makefile.org | |||
@@ -101,6 +101,7 @@ PROCESSOR= | |||
101 | 101 | ||
102 | # Set DES_ENC to des_enc.o if you want to use the C version | 102 | # Set DES_ENC to des_enc.o if you want to use the C version |
103 | #There are 4 x86 assember options. | 103 | #There are 4 x86 assember options. |
104 | FIPS_DES_ENC= des_enc.o fcrypt_b.o | ||
104 | DES_ENC= asm/dx86-out.o asm/yx86-out.o | 105 | DES_ENC= asm/dx86-out.o asm/yx86-out.o |
105 | #DES_ENC= des_enc.o fcrypt_b.o # C | 106 | #DES_ENC= des_enc.o fcrypt_b.o # C |
106 | #DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf | 107 | #DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf |
@@ -153,6 +154,7 @@ MD5_ASM_OBJ= asm/mx86-out.o | |||
153 | 154 | ||
154 | # Also need SHA1_ASM defined | 155 | # Also need SHA1_ASM defined |
155 | SHA1_ASM_OBJ= asm/sx86-out.o | 156 | SHA1_ASM_OBJ= asm/sx86-out.o |
157 | FIPS_SHA1_ASM_OBJ= asm/sx86-out.o | ||
156 | #SHA1_ASM_OBJ= asm/sx86-elf.o # elf | 158 | #SHA1_ASM_OBJ= asm/sx86-elf.o # elf |
157 | #SHA1_ASM_OBJ= asm/sx86-sol.o # solaris | 159 | #SHA1_ASM_OBJ= asm/sx86-sol.o # solaris |
158 | #SHA1_ASM_OBJ= asm/sx86-out.o # a.out, FreeBSD | 160 | #SHA1_ASM_OBJ= asm/sx86-out.o # a.out, FreeBSD |
@@ -173,23 +175,24 @@ LIBKRB5= | |||
173 | # we might set SHLIB_MARK to '$(SHARED_LIBS)'. | 175 | # we might set SHLIB_MARK to '$(SHARED_LIBS)'. |
174 | SHLIB_MARK= | 176 | SHLIB_MARK= |
175 | 177 | ||
176 | DIRS= crypto ssl $(SHLIB_MARK) apps test tools | 178 | DIRS= crypto fips ssl $(SHLIB_MARK) sigs apps test tools |
177 | SHLIBDIRS= crypto ssl | 179 | SHLIBDIRS= crypto ssl |
178 | 180 | ||
179 | # dirs in crypto to build | 181 | # dirs in crypto to build |
180 | SDIRS= \ | 182 | SDIRS= objects \ |
181 | md2 md4 md5 sha mdc2 hmac ripemd \ | 183 | md2 md4 md5 sha mdc2 hmac ripemd \ |
182 | des rc2 rc4 rc5 idea bf cast \ | 184 | des rc2 rc4 rc5 idea bf cast \ |
183 | bn ec rsa dsa dh dso engine aes \ | 185 | bn ec rsa dsa dh dso engine aes \ |
184 | buffer bio stack lhash rand err objects \ | 186 | buffer bio stack lhash rand err \ |
185 | evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 | 187 | evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 |
186 | 188 | ||
189 | FDIRS= sha1 rand des aes dsa rsa dh | ||
190 | |||
187 | # tests to perform. "alltests" is a special word indicating that all tests | 191 | # tests to perform. "alltests" is a special word indicating that all tests |
188 | # should be performed. | 192 | # should be performed. |
189 | TESTS = alltests | 193 | TESTS = alltests |
190 | 194 | ||
191 | MAKEFILE= Makefile.ssl | 195 | MAKEFILE= Makefile |
192 | MAKE= make -f Makefile.ssl | ||
193 | 196 | ||
194 | MANDIR=$(OPENSSLDIR)/man | 197 | MANDIR=$(OPENSSLDIR)/man |
195 | MAN1=1 | 198 | MAN1=1 |
@@ -202,6 +205,7 @@ ONEDIRS=out tmp | |||
202 | EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep VMS | 205 | EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep VMS |
203 | WDIRS= windows | 206 | WDIRS= windows |
204 | LIBS= libcrypto.a libssl.a | 207 | LIBS= libcrypto.a libssl.a |
208 | SIGS= libcrypto.a.sha1 | ||
205 | SHARED_CRYPTO=libcrypto$(SHLIB_EXT) | 209 | SHARED_CRYPTO=libcrypto$(SHLIB_EXT) |
206 | SHARED_SSL=libssl$(SHLIB_EXT) | 210 | SHARED_SSL=libssl$(SHLIB_EXT) |
207 | SHARED_LIBS= | 211 | SHARED_LIBS= |
@@ -219,14 +223,32 @@ HEADER= e_os.h | |||
219 | # When we're prepared to use shared libraries in the programs we link here | 223 | # When we're prepared to use shared libraries in the programs we link here |
220 | # we might remove 'clean-shared' from the targets to perform at this stage | 224 | # we might remove 'clean-shared' from the targets to perform at this stage |
221 | 225 | ||
222 | all: Makefile.ssl sub_all openssl.pc | 226 | all: Makefile sub_all openssl.pc |
227 | |||
228 | sigs: $(SIGS) | ||
229 | libcrypto.a.sha1: libcrypto.a | ||
230 | @if egrep 'define OPENSSL_FIPS' $(TOP)/include/openssl/opensslconf.h > /dev/null; then \ | ||
231 | $(RANLIB) libcrypto.a; \ | ||
232 | fips/sha1/fips_standalone_sha1 libcrypto.a > libcrypto.a.sha1; \ | ||
233 | fi | ||
223 | 234 | ||
224 | sub_all: | 235 | sub_all: |
225 | @for i in $(DIRS); \ | 236 | @for i in $(DIRS); \ |
226 | do \ | 237 | do \ |
227 | if [ -d "$$i" ]; then \ | 238 | if [ -d "$$i" ]; then \ |
228 | (cd $$i && echo "making all in $$i..." && \ | 239 | (cd $$i && echo "making all in $$i..." && \ |
229 | $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' AS='${AS}' ASFLAG='${ASFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' all ) || exit 1; \ | 240 | $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' AS='${AS}' ASFLAG='${ASFLAG}' SDIRS='$(SDIRS)' FDIRS='$(FDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' all ) || exit 1; \ |
241 | else \ | ||
242 | $(MAKE) $$i; \ | ||
243 | fi; \ | ||
244 | done; | ||
245 | |||
246 | sub_target: | ||
247 | @for i in $(DIRS); \ | ||
248 | do \ | ||
249 | if [ -d "$$i" ]; then \ | ||
250 | (cd $$i && echo "making $(TARGET) in $$i..." && \ | ||
251 | $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' AS='${AS}' ASFLAG='${ASFLAG}' SDIRS='$(SDIRS)' FDIRS='$(FDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TARGET='$(TARGET)' sub_target ) || exit 1; \ | ||
230 | else \ | 252 | else \ |
231 | $(MAKE) $$i; \ | 253 | $(MAKE) $$i; \ |
232 | fi; \ | 254 | fi; \ |
@@ -312,11 +334,18 @@ do_cygwin-shared: | |||
312 | if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \ | 334 | if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \ |
313 | libs="$(LIBKRB5) $$libs"; \ | 335 | libs="$(LIBKRB5) $$libs"; \ |
314 | fi; \ | 336 | fi; \ |
315 | ( set -x; ${CC} -shared -o cyg$$i-$(SHLIB_VERSION_NUMBER).dll \ | 337 | shlib=cyg$${i}-$(SHLIB_VERSION_NUMBER).dll; \ |
338 | [ "$(PLATFORM)" = "mingw" ] && shlib=$${i}eay32.dll; \ | ||
339 | [ -f apps/$$shlib ] && rm apps/$$shlib; \ | ||
340 | [ -f test/$$shlib ] && rm test/$$shlib; \ | ||
341 | base=; [ $$i = "crypto" ] && base=-Wl,--image-base,0xFE00000; \ | ||
342 | ( set -x; ${CC} ${SHARED_LDFLAGS} \ | ||
343 | -shared $$base -o $$shlib \ | ||
316 | -Wl,-Bsymbolic \ | 344 | -Wl,-Bsymbolic \ |
317 | -Wl,--whole-archive lib$$i.a \ | 345 | -Wl,--whole-archive lib$$i.a \ |
318 | -Wl,--out-implib,lib$$i.dll.a \ | 346 | -Wl,--out-implib,lib$$i.dll.a \ |
319 | -Wl,--no-whole-archive $$libs ) || exit 1; \ | 347 | -Wl,--no-whole-archive $$libs ${EX_LIBS} ) || exit 1; \ |
348 | cp -p $$shlib apps/; cp -p $$shlib test/; \ | ||
320 | libs="-l$$i $$libs"; \ | 349 | libs="-l$$i $$libs"; \ |
321 | done | 350 | done |
322 | 351 | ||
@@ -392,6 +421,7 @@ do_solaris-shared: | |||
392 | set -x; ${CC} ${SHARED_LDFLAGS} -G -dy -z text \ | 421 | set -x; ${CC} ${SHARED_LDFLAGS} -G -dy -z text \ |
393 | -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ | 422 | -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ |
394 | -h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ | 423 | -h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ |
424 | -Wl,-Bsymbolic \ | ||
395 | $${MINUSZ}allextract lib$$i.a $${MINUSZ}defaultextract \ | 425 | $${MINUSZ}allextract lib$$i.a $${MINUSZ}defaultextract \ |
396 | $$libs ${EX_LIBS} -lc ) || exit 1; \ | 426 | $$libs ${EX_LIBS} -lc ) || exit 1; \ |
397 | libs="-l$$i $$libs"; \ | 427 | libs="-l$$i $$libs"; \ |
@@ -456,8 +486,8 @@ do_irix-shared: | |||
456 | if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \ | 486 | if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \ |
457 | libs="$(LIBKRB5) $$libs"; \ | 487 | libs="$(LIBKRB5) $$libs"; \ |
458 | fi; \ | 488 | fi; \ |
459 | ( WHOLELIB="-all lib$$i.a -notall"; \ | 489 | ( WHOLELIB="-all lib$$i.a -none"; \ |
460 | (${CC} -v 2>&1 | grep gcc) > /dev/null && WHOLELIB="-Wl,-all,lib$$i.a,-notall"; \ | 490 | (${CC} -v 2>&1 | grep gcc) > /dev/null && WHOLELIB="-Wl,-all,lib$$i.a,-none"; \ |
461 | set -x; ${CC} ${SHARED_LDFLAGS} \ | 491 | set -x; ${CC} ${SHARED_LDFLAGS} \ |
462 | -shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ | 492 | -shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ |
463 | -Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ | 493 | -Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ |
@@ -482,13 +512,18 @@ do_hpux-shared: | |||
482 | if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \ | 512 | if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \ |
483 | libs="$(LIBKRB5) $$libs"; \ | 513 | libs="$(LIBKRB5) $$libs"; \ |
484 | fi; \ | 514 | fi; \ |
515 | if expr $(PLATFORM) : '.*ia64' > /dev/null; then \ | ||
516 | shlib=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}; \ | ||
517 | else \ | ||
518 | shlib=lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}; \ | ||
519 | fi; \ | ||
520 | [ -f $$shlib ] && rm -f $$shlib; \ | ||
485 | ( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \ | 521 | ( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \ |
486 | +vnocompatwarnings \ | 522 | +vnocompatwarnings \ |
487 | -b -z +s \ | 523 | -b -z +s \ |
488 | -o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \ | 524 | -o $$shlib +h $$shlib \ |
489 | +h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \ | ||
490 | -Fl lib$$i.a -ldld -lc ) || exit 1; \ | 525 | -Fl lib$$i.a -ldld -lc ) || exit 1; \ |
491 | chmod a=rx lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}; \ | 526 | chmod a=rx $$shlib; \ |
492 | done | 527 | done |
493 | 528 | ||
494 | # This assumes that GNU utilities are *not* used | 529 | # This assumes that GNU utilities are *not* used |
@@ -505,12 +540,17 @@ do_hpux64-shared: | |||
505 | if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \ | 540 | if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \ |
506 | libs="$(LIBKRB5) $$libs"; \ | 541 | libs="$(LIBKRB5) $$libs"; \ |
507 | fi; \ | 542 | fi; \ |
543 | if expr $(PLATFORM) : '.*ia64' > /dev/null; then \ | ||
544 | shlib=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}; \ | ||
545 | else \ | ||
546 | shlib=lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}; \ | ||
547 | fi; \ | ||
548 | [ -f $$shlib ] && rm -f $$shlib; \ | ||
508 | ( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \ | 549 | ( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \ |
509 | -b -z \ | 550 | -b -z \ |
510 | -o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \ | 551 | -o $$shlib +h $$shlib \ |
511 | +h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \ | ||
512 | +forceload lib$$i.a -ldl -lc ) || exit 1; \ | 552 | +forceload lib$$i.a -ldl -lc ) || exit 1; \ |
513 | chmod a=rx lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}; \ | 553 | chmod a=rx $$shlib; \ |
514 | done | 554 | done |
515 | 555 | ||
516 | # The following method is said to work on all platforms. Tests will | 556 | # The following method is said to work on all platforms. Tests will |
@@ -551,6 +591,8 @@ do_aix-shared: | |||
551 | libs="$(LIBKRB5) $$libs"; \ | 591 | libs="$(LIBKRB5) $$libs"; \ |
552 | fi; \ | 592 | fi; \ |
553 | ( set -x; \ | 593 | ( set -x; \ |
594 | OBJECT_MODE=`expr x${SHARED_LDFLAGS} : 'x\-[a-z]\([0-9]*\)'`; \ | ||
595 | OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \ | ||
554 | ld -r -o lib$$i.o $(ALLSYMSFLAG) lib$$i.a && \ | 596 | ld -r -o lib$$i.o $(ALLSYMSFLAG) lib$$i.a && \ |
555 | ( nm -Pg lib$$i.o | grep ' [BD] ' | cut -f1 -d' ' > lib$$i.exp; \ | 597 | ( nm -Pg lib$$i.o | grep ' [BD] ' | cut -f1 -d' ' > lib$$i.exp; \ |
556 | $(SHAREDCMD) $(SHAREDFLAGS) \ | 598 | $(SHAREDCMD) $(SHAREDFLAGS) \ |
@@ -577,7 +619,7 @@ do_reliantunix-shared: | |||
577 | libs="-l$$i $$libs"; \ | 619 | libs="-l$$i $$libs"; \ |
578 | done | 620 | done |
579 | 621 | ||
580 | openssl.pc: Makefile.ssl | 622 | openssl.pc: Makefile |
581 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | 623 | @ ( echo 'prefix=$(INSTALLTOP)'; \ |
582 | echo 'exec_prefix=$${prefix}'; \ | 624 | echo 'exec_prefix=$${prefix}'; \ |
583 | echo 'libdir=$${exec_prefix}/lib'; \ | 625 | echo 'libdir=$${exec_prefix}/lib'; \ |
@@ -590,8 +632,8 @@ openssl.pc: Makefile.ssl | |||
590 | echo 'Libs: -L$${libdir} -lssl -lcrypto $(LIBKRB5) $(EX_LIBS)'; \ | 632 | echo 'Libs: -L$${libdir} -lssl -lcrypto $(LIBKRB5) $(EX_LIBS)'; \ |
591 | echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc | 633 | echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc |
592 | 634 | ||
593 | Makefile.ssl: Makefile.org | 635 | Makefile: Makefile.org |
594 | @echo "Makefile.ssl is older than Makefile.org." | 636 | @echo "Makefile is older than Makefile.org." |
595 | @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please." | 637 | @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please." |
596 | @false | 638 | @false |
597 | 639 | ||
@@ -604,7 +646,7 @@ clean: libclean | |||
604 | do \ | 646 | do \ |
605 | if [ -d "$$i" ]; then \ | 647 | if [ -d "$$i" ]; then \ |
606 | (cd $$i && echo "making clean in $$i..." && \ | 648 | (cd $$i && echo "making clean in $$i..." && \ |
607 | $(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \ | 649 | $(MAKE) EXE_EXT='${EXE_EXT}' SDIRS='${SDIRS}' clean ) || exit 1; \ |
608 | rm -f $(LIBS); \ | 650 | rm -f $(LIBS); \ |
609 | fi; \ | 651 | fi; \ |
610 | done; | 652 | done; |
@@ -621,7 +663,7 @@ makefile.one: files | |||
621 | sh util/do_ms.sh | 663 | sh util/do_ms.sh |
622 | 664 | ||
623 | files: | 665 | files: |
624 | $(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO | 666 | $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO |
625 | @for i in $(DIRS) ;\ | 667 | @for i in $(DIRS) ;\ |
626 | do \ | 668 | do \ |
627 | if [ -d "$$i" ]; then \ | 669 | if [ -d "$$i" ]; then \ |
@@ -631,19 +673,18 @@ files: | |||
631 | done; | 673 | done; |
632 | 674 | ||
633 | links: | 675 | links: |
634 | @$(TOP)/util/point.sh Makefile.ssl Makefile | ||
635 | @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl | 676 | @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl |
636 | @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER) | 677 | @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER) |
637 | @for i in $(DIRS); do \ | 678 | @for i in $(DIRS); do \ |
638 | if [ -d "$$i" ]; then \ | 679 | if [ -d "$$i" ]; then \ |
639 | (cd $$i && echo "making links in $$i..." && \ | 680 | (cd $$i && echo "making links in $$i..." && \ |
640 | $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PERL='${PERL}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' links ) || exit 1; \ | 681 | $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PERL='${PERL}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' links ) || exit 1; \ |
641 | fi; \ | 682 | fi; \ |
642 | done; | 683 | done; |
643 | 684 | ||
644 | gentests: | 685 | gentests: |
645 | @(cd test && echo "generating dummy tests (if needed)..." && \ | 686 | @(cd test && echo "generating dummy tests (if needed)..." && \ |
646 | $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate ); | 687 | $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate ); |
647 | 688 | ||
648 | dclean: | 689 | dclean: |
649 | rm -f *.bak | 690 | rm -f *.bak |
@@ -657,29 +698,18 @@ dclean: | |||
657 | 698 | ||
658 | rehash: rehash.time | 699 | rehash: rehash.time |
659 | rehash.time: certs | 700 | rehash.time: certs |
660 | @(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; \ | 701 | @(OPENSSL="`pwd`/util/opensslwrap.sh"; \ |
661 | export OPENSSL OPENSSL_DEBUG_MEMORY; \ | 702 | OPENSSL_DEBUG_MEMORY=on; \ |
662 | LD_LIBRARY_PATH="`pwd`:$$LD_LIBRARY_PATH"; \ | 703 | export OPENSSL OPENSSL_DEBUG_MEMORY; \ |
663 | DYLD_LIBRARY_PATH="`pwd`:$$DYLD_LIBRARY_PATH"; \ | 704 | $(PERL) tools/c_rehash certs) |
664 | SHLIB_PATH="`pwd`:$$SHLIB_PATH"; \ | ||
665 | LIBPATH="`pwd`:$$LIBPATH"; \ | ||
666 | if [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \ | ||
667 | export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \ | ||
668 | $(PERL) tools/c_rehash certs) | ||
669 | touch rehash.time | 705 | touch rehash.time |
670 | 706 | ||
671 | test: tests | 707 | test: tests |
672 | 708 | ||
673 | tests: rehash | 709 | tests: rehash |
674 | @(cd test && echo "testing..." && \ | 710 | @(cd test && echo "testing..." && \ |
675 | $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests ); | 711 | $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests ); |
676 | @LD_LIBRARY_PATH="`pwd`:$$LD_LIBRARY_PATH"; \ | 712 | util/shlib_wrap.sh apps/openssl version -a |
677 | DYLD_LIBRARY_PATH="`pwd`:$$DYLD_LIBRARY_PATH"; \ | ||
678 | SHLIB_PATH="`pwd`:$$SHLIB_PATH"; \ | ||
679 | LIBPATH="`pwd`:$$LIBPATH"; \ | ||
680 | if [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \ | ||
681 | export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \ | ||
682 | apps/openssl version -a | ||
683 | 713 | ||
684 | report: | 714 | report: |
685 | @$(PERL) util/selftest.pl | 715 | @$(PERL) util/selftest.pl |
@@ -703,13 +733,8 @@ lint: | |||
703 | done; | 733 | done; |
704 | 734 | ||
705 | tags: | 735 | tags: |
706 | @for i in $(DIRS) ;\ | 736 | rm -f TAGS |
707 | do \ | 737 | find . -name '[^.]*.[ch]' | xargs etags -a |
708 | if [ -d "$$i" ]; then \ | ||
709 | (cd $$i && echo "making tags $$i..." && \ | ||
710 | $(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \ | ||
711 | fi; \ | ||
712 | done; | ||
713 | 738 | ||
714 | errors: | 739 | errors: |
715 | $(PERL) util/mkerr.pl -recurse -write | 740 | $(PERL) util/mkerr.pl -recurse -write |
@@ -729,11 +754,14 @@ crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h | |||
729 | crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num | 754 | crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num |
730 | $(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h | 755 | $(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h |
731 | 756 | ||
757 | apps/openssl-vms.cnf: apps/openssl.cnf | ||
758 | $(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf | ||
759 | |||
732 | TABLE: Configure | 760 | TABLE: Configure |
733 | (echo 'Output of `Configure TABLE'"':"; \ | 761 | (echo 'Output of `Configure TABLE'"':"; \ |
734 | $(PERL) Configure TABLE) > TABLE | 762 | $(PERL) Configure TABLE) > TABLE |
735 | 763 | ||
736 | update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE | 764 | update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h apps/openssl-vms.cnf TABLE |
737 | 765 | ||
738 | # Build distribution tar-file. As the list of files returned by "find" is | 766 | # Build distribution tar-file. As the list of files returned by "find" is |
739 | # pretty long, on several platforms a "too many arguments" error or similar | 767 | # pretty long, on several platforms a "too many arguments" error or similar |
@@ -770,16 +798,17 @@ dist: | |||
770 | dist_pem_h: | 798 | dist_pem_h: |
771 | (cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean) | 799 | (cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean) |
772 | 800 | ||
773 | install: all install_docs | 801 | install: all install_docs install_sw |
802 | |||
803 | install_sw: | ||
774 | @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \ | 804 | @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \ |
775 | $(INSTALL_PREFIX)$(INSTALLTOP)/lib \ | 805 | $(INSTALL_PREFIX)$(INSTALLTOP)/lib \ |
776 | $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig \ | 806 | $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig \ |
777 | $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \ | 807 | $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \ |
778 | $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \ | 808 | $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \ |
779 | $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \ | 809 | $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \ |
780 | $(INSTALL_PREFIX)$(OPENSSLDIR)/private \ | 810 | $(INSTALL_PREFIX)$(OPENSSLDIR)/private |
781 | $(INSTALL_PREFIX)$(OPENSSLDIR)/lib | 811 | @headerlist="$(EXHEADER)"; for i in $$headerlist ;\ |
782 | @for i in $(EXHEADER) ;\ | ||
783 | do \ | 812 | do \ |
784 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | 813 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ |
785 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | 814 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ |
@@ -796,7 +825,11 @@ install: all install_docs | |||
796 | if [ -f "$$i" ]; then \ | 825 | if [ -f "$$i" ]; then \ |
797 | ( echo installing $$i; \ | 826 | ( echo installing $$i; \ |
798 | cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \ | 827 | cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \ |
799 | $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \ | 828 | if egrep 'define OPENSSL_FIPS' $(TOP)/include/openssl/opensslconf.h > /dev/null; then \ |
829 | : ; \ | ||
830 | else \ | ||
831 | $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \ | ||
832 | fi; \ | ||
800 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \ | 833 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \ |
801 | mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \ | 834 | mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \ |
802 | fi; \ | 835 | fi; \ |
@@ -833,6 +866,15 @@ install: all install_docs | |||
833 | sed -e '1,/^$$/d' doc/openssl-shared.txt; \ | 866 | sed -e '1,/^$$/d' doc/openssl-shared.txt; \ |
834 | fi; \ | 867 | fi; \ |
835 | fi | 868 | fi |
869 | @for i in $(SIGS) ;\ | ||
870 | do \ | ||
871 | if [ -f "$$i" ]; then \ | ||
872 | ( echo installing $$i; \ | ||
873 | cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \ | ||
874 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \ | ||
875 | mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \ | ||
876 | fi; \ | ||
877 | done; | ||
836 | cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig | 878 | cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig |
837 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/openssl.pc | 879 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/openssl.pc |
838 | 880 | ||
@@ -845,7 +887,7 @@ install_docs: | |||
845 | @pod2man="`cd util; ./pod2mantest $(PERL)`"; \ | 887 | @pod2man="`cd util; ./pod2mantest $(PERL)`"; \ |
846 | here="`pwd`"; \ | 888 | here="`pwd`"; \ |
847 | filecase=; \ | 889 | filecase=; \ |
848 | if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" ]; then \ | 890 | if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \ |
849 | filecase=-i; \ | 891 | filecase=-i; \ |
850 | fi; \ | 892 | fi; \ |
851 | for i in doc/apps/*.pod; do \ | 893 | for i in doc/apps/*.pod; do \ |
diff --git a/src/lib/libssl/src/NEWS b/src/lib/libssl/src/NEWS index 4c1ba0a241..8e1ce65a5f 100644 --- a/src/lib/libssl/src/NEWS +++ b/src/lib/libssl/src/NEWS | |||
@@ -5,12 +5,34 @@ | |||
5 | This file gives a brief overview of the major changes between each OpenSSL | 5 | This file gives a brief overview of the major changes between each OpenSSL |
6 | release. For more details please read the CHANGES file. | 6 | release. For more details please read the CHANGES file. |
7 | 7 | ||
8 | Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g: | ||
9 | |||
10 | o More compilation issues fixed. | ||
11 | o Adaptation to more modern Kerberos API. | ||
12 | o Enhanced or corrected configuration for Solaris64, Mingw and Cygwin. | ||
13 | o Enhanced x86_64 assembler BIGNUM module. | ||
14 | o More constification. | ||
15 | o Added processing of proxy certificates (RFC 3820). | ||
16 | |||
17 | Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f: | ||
18 | |||
19 | o Several compilation issues fixed. | ||
20 | o Many memory allocation failure checks added. | ||
21 | o Improved comparison of X509 Name type. | ||
22 | o Mandatory basic checks on certificates. | ||
23 | o Performance improvements. | ||
24 | |||
25 | Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e: | ||
26 | |||
27 | o Fix race condition in CRL checking code. | ||
28 | o Fixes to PKCS#7 (S/MIME) code. | ||
29 | |||
8 | Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d: | 30 | Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d: |
9 | 31 | ||
10 | o Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug | 32 | o Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug |
11 | o Security: Fix null-pointer assignment in do_change_cipher_spec() | 33 | o Security: Fix null-pointer assignment in do_change_cipher_spec() |
12 | o Allow multiple active certificates with same subject in CA index | 34 | o Allow multiple active certificates with same subject in CA index |
13 | o Multiple X590 verification fixes | 35 | o Multiple X509 verification fixes |
14 | o Speed up HMAC and other operations | 36 | o Speed up HMAC and other operations |
15 | 37 | ||
16 | Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c: | 38 | Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c: |
diff --git a/src/lib/libssl/src/README b/src/lib/libssl/src/README index f72a21036f..c52c2d94bd 100644 --- a/src/lib/libssl/src/README +++ b/src/lib/libssl/src/README | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | OpenSSL 0.9.7d 17 Mar 2004 | 2 | OpenSSL 0.9.7g 11 April 2005 |
3 | 3 | ||
4 | Copyright (c) 1998-2004 The OpenSSL Project | 4 | Copyright (c) 1998-2005 The OpenSSL Project |
5 | Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson | 5 | Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson |
6 | All rights reserved. | 6 | All rights reserved. |
7 | 7 | ||
@@ -173,11 +173,17 @@ | |||
173 | textual explanation of what your patch does. | 173 | textual explanation of what your patch does. |
174 | 174 | ||
175 | Note: For legal reasons, contributions from the US can be accepted only | 175 | Note: For legal reasons, contributions from the US can be accepted only |
176 | if a TSA notification and a copy of the patch is sent to crypt@bis.doc.gov; | 176 | if a TSU notification and a copy of the patch are sent to crypt@bis.doc.gov |
177 | see http://www.bis.doc.gov/Encryption/PubAvailEncSourceCodeNofify.html [sic] | 177 | (formerly BXA) with a copy to the ENC Encryption Request Coordinator; |
178 | and http://w3.access.gpo.gov/bis/ear/pdf/740.pdf (EAR Section 740.13(e)). | 178 | please take some time to look at |
179 | 179 | http://www.bis.doc.gov/Encryption/PubAvailEncSourceCodeNofify.html [sic] | |
180 | The preferred format for changes is "diff -u" output. You might | 180 | and |
181 | http://w3.access.gpo.gov/bis/ear/pdf/740.pdf (EAR Section 740.13(e)) | ||
182 | for the details. If "your encryption source code is too large to serve as | ||
183 | an email attachment", they are glad to receive it by fax instead; hope you | ||
184 | have a cheap long-distance plan. | ||
185 | |||
186 | Our preferred format for changes is "diff -u" output. You might | ||
181 | generate it like this: | 187 | generate it like this: |
182 | 188 | ||
183 | # cd openssl-work | 189 | # cd openssl-work |
diff --git a/src/lib/libssl/src/VMS/mkshared.com b/src/lib/libssl/src/VMS/mkshared.com index afdc85bbe0..19f3821bc6 100644 --- a/src/lib/libssl/src/VMS/mkshared.com +++ b/src/lib/libssl/src/VMS/mkshared.com | |||
@@ -266,6 +266,14 @@ $ falsesum = falsesum + 1 | |||
266 | $ endif | 266 | $ endif |
267 | $ if plat_entry .eqs. "VMS" then truesum = truesum + 1 | 267 | $ if plat_entry .eqs. "VMS" then truesum = truesum + 1 |
268 | $ if plat_entry .eqs. "!VMS" then falsesum = falsesum + 1 | 268 | $ if plat_entry .eqs. "!VMS" then falsesum = falsesum + 1 |
269 | $ if f$trnlnm("OPENSSL_FIPS") .nes. "" | ||
270 | $ then | ||
271 | $ if plat_entry .eqs. "OPENSSL_FIPS" then truesum = truesum + 1 | ||
272 | $ if plat_entry .eqs. "!OPENSSL_FIPS" then falsesum = falsesum + 1 | ||
273 | $ else | ||
274 | $ if plat_entry .eqs. "OPENSSL_FIPS" then falsesum = falsesum + 1 | ||
275 | $ if plat_entry .eqs. "!OPENSSL_FIPS" then truesum = truesum + 1 | ||
276 | $ endif | ||
269 | $ goto loop1 | 277 | $ goto loop1 |
270 | $ endif | 278 | $ endif |
271 | $ endloop1: | 279 | $ endloop1: |
diff --git a/src/lib/libssl/src/apps/CA.pl.in b/src/lib/libssl/src/apps/CA.pl.in index 8b2ce7ea42..39f267d313 100644 --- a/src/lib/libssl/src/apps/CA.pl.in +++ b/src/lib/libssl/src/apps/CA.pl.in | |||
@@ -36,13 +36,21 @@ | |||
36 | # default openssl.cnf file has setup as per the following | 36 | # default openssl.cnf file has setup as per the following |
37 | # demoCA ... where everything is stored | 37 | # demoCA ... where everything is stored |
38 | 38 | ||
39 | my $openssl; | ||
40 | if(defined $ENV{OPENSSL}) { | ||
41 | $openssl = $ENV{OPENSSL}; | ||
42 | } else { | ||
43 | $openssl = "openssl"; | ||
44 | $ENV{OPENSSL} = $openssl; | ||
45 | } | ||
46 | |||
39 | $SSLEAY_CONFIG=$ENV{"SSLEAY_CONFIG"}; | 47 | $SSLEAY_CONFIG=$ENV{"SSLEAY_CONFIG"}; |
40 | $DAYS="-days 365"; | 48 | $DAYS="-days 365"; |
41 | $REQ="openssl req $SSLEAY_CONFIG"; | 49 | $REQ="$openssl req $SSLEAY_CONFIG"; |
42 | $CA="openssl ca $SSLEAY_CONFIG"; | 50 | $CA="$openssl ca $SSLEAY_CONFIG"; |
43 | $VERIFY="openssl verify"; | 51 | $VERIFY="$openssl verify"; |
44 | $X509="openssl x509"; | 52 | $X509="$openssl x509"; |
45 | $PKCS12="openssl pkcs12"; | 53 | $PKCS12="$openssl pkcs12"; |
46 | 54 | ||
47 | $CATOP="./demoCA"; | 55 | $CATOP="./demoCA"; |
48 | $CAKEY="cakey.pem"; | 56 | $CAKEY="cakey.pem"; |
@@ -82,9 +90,6 @@ foreach (@ARGV) { | |||
82 | mkdir "${CATOP}/crl", $DIRMODE ; | 90 | mkdir "${CATOP}/crl", $DIRMODE ; |
83 | mkdir "${CATOP}/newcerts", $DIRMODE; | 91 | mkdir "${CATOP}/newcerts", $DIRMODE; |
84 | mkdir "${CATOP}/private", $DIRMODE; | 92 | mkdir "${CATOP}/private", $DIRMODE; |
85 | open OUT, ">${CATOP}/serial"; | ||
86 | print OUT "01\n"; | ||
87 | close OUT; | ||
88 | open OUT, ">${CATOP}/index.txt"; | 93 | open OUT, ">${CATOP}/index.txt"; |
89 | close OUT; | 94 | close OUT; |
90 | } | 95 | } |
@@ -106,6 +111,10 @@ foreach (@ARGV) { | |||
106 | $RET=$?; | 111 | $RET=$?; |
107 | } | 112 | } |
108 | } | 113 | } |
114 | if (! -f "${CATOP}/serial" ) { | ||
115 | system ("$X509 -in ${CATOP}/$CACERT -noout " | ||
116 | . "-next_serial -out ${CATOP}/serial"); | ||
117 | } | ||
109 | } elsif (/^-pkcs12$/) { | 118 | } elsif (/^-pkcs12$/) { |
110 | my $cname = $ARGV[1]; | 119 | my $cname = $ARGV[1]; |
111 | $cname = "My Certificate" unless defined $cname; | 120 | $cname = "My Certificate" unless defined $cname; |
diff --git a/src/lib/libssl/src/apps/CA.sh b/src/lib/libssl/src/apps/CA.sh index d9f3069fb2..030a11fc25 100644 --- a/src/lib/libssl/src/apps/CA.sh +++ b/src/lib/libssl/src/apps/CA.sh | |||
@@ -30,11 +30,13 @@ | |||
30 | # default openssl.cnf file has setup as per the following | 30 | # default openssl.cnf file has setup as per the following |
31 | # demoCA ... where everything is stored | 31 | # demoCA ... where everything is stored |
32 | 32 | ||
33 | if [ -z "$OPENSSL" ]; then OPENSSL=openssl; fi | ||
34 | |||
33 | DAYS="-days 365" | 35 | DAYS="-days 365" |
34 | REQ="openssl req $SSLEAY_CONFIG" | 36 | REQ="$OPENSSL req $SSLEAY_CONFIG" |
35 | CA="openssl ca $SSLEAY_CONFIG" | 37 | CA="$OPENSSL ca $SSLEAY_CONFIG" |
36 | VERIFY="openssl verify" | 38 | VERIFY="$OPENSSL verify" |
37 | X509="openssl x509" | 39 | X509="$OPENSSL x509" |
38 | 40 | ||
39 | CATOP=./demoCA | 41 | CATOP=./demoCA |
40 | CAKEY=./cakey.pem | 42 | CAKEY=./cakey.pem |
diff --git a/src/lib/libssl/src/apps/apps.c b/src/lib/libssl/src/apps/apps.c index 1d37c4defb..9157cdfcdc 100644 --- a/src/lib/libssl/src/apps/apps.c +++ b/src/lib/libssl/src/apps/apps.c | |||
@@ -126,16 +126,6 @@ | |||
126 | #include <openssl/engine.h> | 126 | #include <openssl/engine.h> |
127 | #endif | 127 | #endif |
128 | 128 | ||
129 | #ifdef OPENSSL_SYS_WINDOWS | ||
130 | #define strcasecmp _stricmp | ||
131 | #else | ||
132 | # ifdef NO_STRINGS_H | ||
133 | int strcasecmp(); | ||
134 | # else | ||
135 | # include <strings.h> | ||
136 | # endif /* NO_STRINGS_H */ | ||
137 | #endif | ||
138 | |||
139 | #define NON_MAIN | 129 | #define NON_MAIN |
140 | #include "apps.h" | 130 | #include "apps.h" |
141 | #undef NON_MAIN | 131 | #undef NON_MAIN |
@@ -340,60 +330,6 @@ void program_name(char *in, char *out, int size) | |||
340 | #endif | 330 | #endif |
341 | #endif | 331 | #endif |
342 | 332 | ||
343 | #ifdef OPENSSL_SYS_WIN32 | ||
344 | int WIN32_rename(char *from, char *to) | ||
345 | { | ||
346 | #ifndef OPENSSL_SYS_WINCE | ||
347 | /* Windows rename gives an error if 'to' exists, so delete it | ||
348 | * first and ignore file not found errror | ||
349 | */ | ||
350 | if((remove(to) != 0) && (errno != ENOENT)) | ||
351 | return -1; | ||
352 | #undef rename | ||
353 | return rename(from, to); | ||
354 | #else | ||
355 | /* convert strings to UNICODE */ | ||
356 | { | ||
357 | BOOL result = FALSE; | ||
358 | WCHAR* wfrom; | ||
359 | WCHAR* wto; | ||
360 | int i; | ||
361 | wfrom = malloc((strlen(from)+1)*2); | ||
362 | wto = malloc((strlen(to)+1)*2); | ||
363 | if (wfrom != NULL && wto != NULL) | ||
364 | { | ||
365 | for (i=0; i<(int)strlen(from)+1; i++) | ||
366 | wfrom[i] = (short)from[i]; | ||
367 | for (i=0; i<(int)strlen(to)+1; i++) | ||
368 | wto[i] = (short)to[i]; | ||
369 | result = MoveFile(wfrom, wto); | ||
370 | } | ||
371 | if (wfrom != NULL) | ||
372 | free(wfrom); | ||
373 | if (wto != NULL) | ||
374 | free(wto); | ||
375 | return result; | ||
376 | } | ||
377 | #endif | ||
378 | } | ||
379 | #endif | ||
380 | |||
381 | #ifdef OPENSSL_SYS_VMS | ||
382 | int VMS_strcasecmp(const char *str1, const char *str2) | ||
383 | { | ||
384 | while (*str1 && *str2) | ||
385 | { | ||
386 | int res = toupper(*str1) - toupper(*str2); | ||
387 | if (res) return res < 0 ? -1 : 1; | ||
388 | } | ||
389 | if (*str1) | ||
390 | return 1; | ||
391 | if (*str2) | ||
392 | return -1; | ||
393 | return 0; | ||
394 | } | ||
395 | #endif | ||
396 | |||
397 | int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) | 333 | int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) |
398 | { | 334 | { |
399 | int num,len,i; | 335 | int num,len,i; |
@@ -590,7 +526,7 @@ int password_callback(char *buf, int bufsiz, int verify, | |||
590 | char *prompt = NULL; | 526 | char *prompt = NULL; |
591 | 527 | ||
592 | prompt = UI_construct_prompt(ui, "pass phrase", | 528 | prompt = UI_construct_prompt(ui, "pass phrase", |
593 | cb_data->prompt_info); | 529 | prompt_info); |
594 | 530 | ||
595 | ui_flags |= UI_INPUT_FLAG_DEFAULT_PWD; | 531 | ui_flags |= UI_INPUT_FLAG_DEFAULT_PWD; |
596 | UI_ctrl(ui, UI_CTRL_PRINT_ERRORS, 1, 0, 0); | 532 | UI_ctrl(ui, UI_CTRL_PRINT_ERRORS, 1, 0, 0); |
@@ -739,6 +675,51 @@ int add_oid_section(BIO *err, CONF *conf) | |||
739 | return 1; | 675 | return 1; |
740 | } | 676 | } |
741 | 677 | ||
678 | static int load_pkcs12(BIO *err, BIO *in, const char *desc, | ||
679 | pem_password_cb *pem_cb, void *cb_data, | ||
680 | EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca) | ||
681 | { | ||
682 | const char *pass; | ||
683 | char tpass[PEM_BUFSIZE]; | ||
684 | int len, ret = 0; | ||
685 | PKCS12 *p12; | ||
686 | p12 = d2i_PKCS12_bio(in, NULL); | ||
687 | if (p12 == NULL) | ||
688 | { | ||
689 | BIO_printf(err, "Error loading PKCS12 file for %s\n", desc); | ||
690 | goto die; | ||
691 | } | ||
692 | /* See if an empty password will do */ | ||
693 | if (PKCS12_verify_mac(p12, "", 0) || PKCS12_verify_mac(p12, NULL, 0)) | ||
694 | pass = ""; | ||
695 | else | ||
696 | { | ||
697 | if (!pem_cb) | ||
698 | pem_cb = (pem_password_cb *)password_callback; | ||
699 | len = pem_cb(tpass, PEM_BUFSIZE, 0, cb_data); | ||
700 | if (len < 0) | ||
701 | { | ||
702 | BIO_printf(err, "Passpharse callback error for %s\n", | ||
703 | desc); | ||
704 | goto die; | ||
705 | } | ||
706 | if (len < PEM_BUFSIZE) | ||
707 | tpass[len] = 0; | ||
708 | if (!PKCS12_verify_mac(p12, tpass, len)) | ||
709 | { | ||
710 | BIO_printf(err, | ||
711 | "Mac verify error (wrong password?) in PKCS12 file for %s\n", desc); | ||
712 | goto die; | ||
713 | } | ||
714 | pass = tpass; | ||
715 | } | ||
716 | ret = PKCS12_parse(p12, pass, pkey, cert, ca); | ||
717 | die: | ||
718 | if (p12) | ||
719 | PKCS12_free(p12); | ||
720 | return ret; | ||
721 | } | ||
722 | |||
742 | X509 *load_cert(BIO *err, const char *file, int format, | 723 | X509 *load_cert(BIO *err, const char *file, int format, |
743 | const char *pass, ENGINE *e, const char *cert_descrip) | 724 | const char *pass, ENGINE *e, const char *cert_descrip) |
744 | { | 725 | { |
@@ -819,11 +800,9 @@ X509 *load_cert(BIO *err, const char *file, int format, | |||
819 | (pem_password_cb *)password_callback, NULL); | 800 | (pem_password_cb *)password_callback, NULL); |
820 | else if (format == FORMAT_PKCS12) | 801 | else if (format == FORMAT_PKCS12) |
821 | { | 802 | { |
822 | PKCS12 *p12 = d2i_PKCS12_bio(cert, NULL); | 803 | if (!load_pkcs12(err, cert,cert_descrip, NULL, NULL, |
823 | 804 | NULL, &x, NULL)) | |
824 | PKCS12_parse(p12, NULL, NULL, &x, NULL); | 805 | goto end; |
825 | PKCS12_free(p12); | ||
826 | p12 = NULL; | ||
827 | } | 806 | } |
828 | else { | 807 | else { |
829 | BIO_printf(err,"bad input format specified for %s\n", | 808 | BIO_printf(err,"bad input format specified for %s\n", |
@@ -902,11 +881,10 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin, | |||
902 | #endif | 881 | #endif |
903 | else if (format == FORMAT_PKCS12) | 882 | else if (format == FORMAT_PKCS12) |
904 | { | 883 | { |
905 | PKCS12 *p12 = d2i_PKCS12_bio(key, NULL); | 884 | if (!load_pkcs12(err, key, key_descrip, |
906 | 885 | (pem_password_cb *)password_callback, &cb_data, | |
907 | PKCS12_parse(p12, pass, &pkey, NULL, NULL); | 886 | &pkey, NULL, NULL)) |
908 | PKCS12_free(p12); | 887 | goto end; |
909 | p12 = NULL; | ||
910 | } | 888 | } |
911 | else | 889 | else |
912 | { | 890 | { |
@@ -1486,12 +1464,9 @@ BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai) | |||
1486 | } | 1464 | } |
1487 | else | 1465 | else |
1488 | { | 1466 | { |
1489 | ASN1_INTEGER_set(ai,1); | ||
1490 | ret=BN_new(); | 1467 | ret=BN_new(); |
1491 | if (ret == NULL) | 1468 | if (ret == NULL || !rand_serial(ret, ai)) |
1492 | BIO_printf(bio_err, "Out of memory\n"); | 1469 | BIO_printf(bio_err, "Out of memory\n"); |
1493 | else | ||
1494 | BN_one(ret); | ||
1495 | } | 1470 | } |
1496 | } | 1471 | } |
1497 | else | 1472 | else |
@@ -1653,6 +1628,33 @@ int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix) | |||
1653 | return 0; | 1628 | return 0; |
1654 | } | 1629 | } |
1655 | 1630 | ||
1631 | int rand_serial(BIGNUM *b, ASN1_INTEGER *ai) | ||
1632 | { | ||
1633 | BIGNUM *btmp; | ||
1634 | int ret = 0; | ||
1635 | if (b) | ||
1636 | btmp = b; | ||
1637 | else | ||
1638 | btmp = BN_new(); | ||
1639 | |||
1640 | if (!btmp) | ||
1641 | return 0; | ||
1642 | |||
1643 | if (!BN_pseudo_rand(btmp, SERIAL_RAND_BITS, 0, 0)) | ||
1644 | goto error; | ||
1645 | if (ai && !BN_to_ASN1_INTEGER(btmp, ai)) | ||
1646 | goto error; | ||
1647 | |||
1648 | ret = 1; | ||
1649 | |||
1650 | error: | ||
1651 | |||
1652 | if (!b) | ||
1653 | BN_free(btmp); | ||
1654 | |||
1655 | return ret; | ||
1656 | } | ||
1657 | |||
1656 | CA_DB *load_index(char *dbfile, DB_ATTR *db_attr) | 1658 | CA_DB *load_index(char *dbfile, DB_ATTR *db_attr) |
1657 | { | 1659 | { |
1658 | CA_DB *retdb = NULL; | 1660 | CA_DB *retdb = NULL; |
@@ -1970,9 +1972,48 @@ int rotate_index(char *dbfile, char *new_suffix, char *old_suffix) | |||
1970 | 1972 | ||
1971 | void free_index(CA_DB *db) | 1973 | void free_index(CA_DB *db) |
1972 | { | 1974 | { |
1973 | if (db != NULL) | 1975 | if (db) |
1974 | { | 1976 | { |
1975 | TXT_DB_free(db->db); | 1977 | if (db->db) TXT_DB_free(db->db); |
1976 | OPENSSL_free(db); | 1978 | OPENSSL_free(db); |
1977 | } | 1979 | } |
1978 | } | 1980 | } |
1981 | |||
1982 | /* This code MUST COME AFTER anything that uses rename() */ | ||
1983 | #ifdef OPENSSL_SYS_WIN32 | ||
1984 | int WIN32_rename(char *from, char *to) | ||
1985 | { | ||
1986 | #ifndef OPENSSL_SYS_WINCE | ||
1987 | /* Windows rename gives an error if 'to' exists, so delete it | ||
1988 | * first and ignore file not found errror | ||
1989 | */ | ||
1990 | if((remove(to) != 0) && (errno != ENOENT)) | ||
1991 | return -1; | ||
1992 | #undef rename | ||
1993 | return rename(from, to); | ||
1994 | #else | ||
1995 | /* convert strings to UNICODE */ | ||
1996 | { | ||
1997 | BOOL result = FALSE; | ||
1998 | WCHAR* wfrom; | ||
1999 | WCHAR* wto; | ||
2000 | int i; | ||
2001 | wfrom = malloc((strlen(from)+1)*2); | ||
2002 | wto = malloc((strlen(to)+1)*2); | ||
2003 | if (wfrom != NULL && wto != NULL) | ||
2004 | { | ||
2005 | for (i=0; i<(int)strlen(from)+1; i++) | ||
2006 | wfrom[i] = (short)from[i]; | ||
2007 | for (i=0; i<(int)strlen(to)+1; i++) | ||
2008 | wto[i] = (short)to[i]; | ||
2009 | result = MoveFile(wfrom, wto); | ||
2010 | } | ||
2011 | if (wfrom != NULL) | ||
2012 | free(wfrom); | ||
2013 | if (wto != NULL) | ||
2014 | free(wto); | ||
2015 | return result; | ||
2016 | } | ||
2017 | #endif | ||
2018 | } | ||
2019 | #endif | ||
diff --git a/src/lib/libssl/src/apps/apps.h b/src/lib/libssl/src/apps/apps.h index 8a9c4ab0a0..4320410dad 100644 --- a/src/lib/libssl/src/apps/apps.h +++ b/src/lib/libssl/src/apps/apps.h | |||
@@ -141,12 +141,6 @@ long app_RAND_load_files(char *file); /* `file' is a list of files to read, | |||
141 | int WIN32_rename(char *oldname,char *newname); | 141 | int WIN32_rename(char *oldname,char *newname); |
142 | #endif | 142 | #endif |
143 | 143 | ||
144 | /* VMS below version 7.0 doesn't have strcasecmp() */ | ||
145 | #ifdef OPENSSL_SYS_VMS | ||
146 | #define strcasecmp(str1,str2) VMS_strcasecmp((str1),(str2)) | ||
147 | int VMS_strcasecmp(const char *str1, const char *str2); | ||
148 | #endif | ||
149 | |||
150 | #ifndef MONOLITH | 144 | #ifndef MONOLITH |
151 | 145 | ||
152 | #define MAIN(a,v) main(a,v) | 146 | #define MAIN(a,v) main(a,v) |
@@ -154,9 +148,11 @@ int VMS_strcasecmp(const char *str1, const char *str2); | |||
154 | #ifndef NON_MAIN | 148 | #ifndef NON_MAIN |
155 | CONF *config=NULL; | 149 | CONF *config=NULL; |
156 | BIO *bio_err=NULL; | 150 | BIO *bio_err=NULL; |
151 | int in_FIPS_mode=0; | ||
157 | #else | 152 | #else |
158 | extern CONF *config; | 153 | extern CONF *config; |
159 | extern BIO *bio_err; | 154 | extern BIO *bio_err; |
155 | extern int in_FIPS_mode; | ||
160 | #endif | 156 | #endif |
161 | 157 | ||
162 | #else | 158 | #else |
@@ -165,6 +161,7 @@ extern BIO *bio_err; | |||
165 | extern CONF *config; | 161 | extern CONF *config; |
166 | extern char *default_config_file; | 162 | extern char *default_config_file; |
167 | extern BIO *bio_err; | 163 | extern BIO *bio_err; |
164 | extern int in_FIPS_mode; | ||
168 | 165 | ||
169 | #endif | 166 | #endif |
170 | 167 | ||
@@ -313,6 +310,7 @@ typedef struct ca_db_st | |||
313 | BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai); | 310 | BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai); |
314 | int save_serial(char *serialfile, char *suffix, BIGNUM *serial, ASN1_INTEGER **retai); | 311 | int save_serial(char *serialfile, char *suffix, BIGNUM *serial, ASN1_INTEGER **retai); |
315 | int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix); | 312 | int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix); |
313 | int rand_serial(BIGNUM *b, ASN1_INTEGER *ai); | ||
316 | CA_DB *load_index(char *dbfile, DB_ATTR *dbattr); | 314 | CA_DB *load_index(char *dbfile, DB_ATTR *dbattr); |
317 | int index_index(CA_DB *db); | 315 | int index_index(CA_DB *db); |
318 | int save_index(char *dbfile, char *suffix, CA_DB *db); | 316 | int save_index(char *dbfile, char *suffix, CA_DB *db); |
@@ -341,4 +339,6 @@ X509_NAME *do_subject(char *str, long chtype); | |||
341 | 339 | ||
342 | #define APP_PASS_LEN 1024 | 340 | #define APP_PASS_LEN 1024 |
343 | 341 | ||
342 | #define SERIAL_RAND_BITS 64 | ||
343 | |||
344 | #endif | 344 | #endif |
diff --git a/src/lib/libssl/src/apps/asn1pars.c b/src/lib/libssl/src/apps/asn1pars.c index 7db40adf04..c89b358b23 100644 --- a/src/lib/libssl/src/apps/asn1pars.c +++ b/src/lib/libssl/src/apps/asn1pars.c | |||
@@ -278,6 +278,7 @@ bad: | |||
278 | tmplen=num; | 278 | tmplen=num; |
279 | for (i=0; i<sk_num(osk); i++) | 279 | for (i=0; i<sk_num(osk); i++) |
280 | { | 280 | { |
281 | int typ; | ||
281 | ASN1_TYPE *atmp; | 282 | ASN1_TYPE *atmp; |
282 | j=atoi(sk_value(osk,i)); | 283 | j=atoi(sk_value(osk,i)); |
283 | if (j == 0) | 284 | if (j == 0) |
@@ -296,6 +297,15 @@ bad: | |||
296 | ERR_print_errors(bio_err); | 297 | ERR_print_errors(bio_err); |
297 | goto end; | 298 | goto end; |
298 | } | 299 | } |
300 | typ = ASN1_TYPE_get(at); | ||
301 | if ((typ == V_ASN1_OBJECT) | ||
302 | || (typ == V_ASN1_NULL)) | ||
303 | { | ||
304 | BIO_printf(bio_err, "Can't parse %s type\n", | ||
305 | typ == V_ASN1_NULL ? "NULL" : "OBJECT"); | ||
306 | ERR_print_errors(bio_err); | ||
307 | goto end; | ||
308 | } | ||
299 | /* hmm... this is a little evil but it works */ | 309 | /* hmm... this is a little evil but it works */ |
300 | tmpbuf=at->value.asn1_string->data; | 310 | tmpbuf=at->value.asn1_string->data; |
301 | tmplen=at->value.asn1_string->length; | 311 | tmplen=at->value.asn1_string->length; |
diff --git a/src/lib/libssl/src/apps/ca.c b/src/lib/libssl/src/apps/ca.c index 33362389cc..b934b52cc5 100644 --- a/src/lib/libssl/src/apps/ca.c +++ b/src/lib/libssl/src/apps/ca.c | |||
@@ -76,16 +76,6 @@ | |||
76 | #include <openssl/ocsp.h> | 76 | #include <openssl/ocsp.h> |
77 | #include <openssl/pem.h> | 77 | #include <openssl/pem.h> |
78 | 78 | ||
79 | #ifdef OPENSSL_SYS_WINDOWS | ||
80 | #define strcasecmp _stricmp | ||
81 | #else | ||
82 | # ifdef NO_STRINGS_H | ||
83 | int strcasecmp(); | ||
84 | # else | ||
85 | # include <strings.h> | ||
86 | # endif /* NO_STRINGS_H */ | ||
87 | #endif | ||
88 | |||
89 | #ifndef W_OK | 79 | #ifndef W_OK |
90 | # ifdef OPENSSL_SYS_VMS | 80 | # ifdef OPENSSL_SYS_VMS |
91 | # if defined(__DECC) | 81 | # if defined(__DECC) |
@@ -248,6 +238,7 @@ int MAIN(int argc, char **argv) | |||
248 | { | 238 | { |
249 | ENGINE *e = NULL; | 239 | ENGINE *e = NULL; |
250 | char *key=NULL,*passargin=NULL; | 240 | char *key=NULL,*passargin=NULL; |
241 | int create_ser = 0; | ||
251 | int free_key = 0; | 242 | int free_key = 0; |
252 | int total=0; | 243 | int total=0; |
253 | int total_done=0; | 244 | int total_done=0; |
@@ -547,10 +538,6 @@ bad: | |||
547 | 538 | ||
548 | ERR_load_crypto_strings(); | 539 | ERR_load_crypto_strings(); |
549 | 540 | ||
550 | #ifndef OPENSSL_NO_ENGINE | ||
551 | e = setup_engine(bio_err, engine, 0); | ||
552 | #endif | ||
553 | |||
554 | /*****************************************************************/ | 541 | /*****************************************************************/ |
555 | tofree=NULL; | 542 | tofree=NULL; |
556 | if (configfile == NULL) configfile = getenv("OPENSSL_CONF"); | 543 | if (configfile == NULL) configfile = getenv("OPENSSL_CONF"); |
@@ -595,6 +582,10 @@ bad: | |||
595 | if (!load_config(bio_err, conf)) | 582 | if (!load_config(bio_err, conf)) |
596 | goto err; | 583 | goto err; |
597 | 584 | ||
585 | #ifndef OPENSSL_NO_ENGINE | ||
586 | e = setup_engine(bio_err, engine, 0); | ||
587 | #endif | ||
588 | |||
598 | /* Lets get the config section we are using */ | 589 | /* Lets get the config section we are using */ |
599 | if (section == NULL) | 590 | if (section == NULL) |
600 | { | 591 | { |
@@ -666,8 +657,10 @@ bad: | |||
666 | break; | 657 | break; |
667 | } | 658 | } |
668 | } | 659 | } |
669 | #ifdef RL_DEBUG | ||
670 | else | 660 | else |
661 | ERR_clear_error(); | ||
662 | #ifdef RL_DEBUG | ||
663 | if (!p) | ||
671 | BIO_printf(bio_err, "DEBUG: unique_subject undefined\n", p); | 664 | BIO_printf(bio_err, "DEBUG: unique_subject undefined\n", p); |
672 | #endif | 665 | #endif |
673 | #ifdef RL_DEBUG | 666 | #ifdef RL_DEBUG |
@@ -1001,25 +994,27 @@ bad: | |||
1001 | } | 994 | } |
1002 | } | 995 | } |
1003 | 996 | ||
997 | if ((md == NULL) && ((md=NCONF_get_string(conf, | ||
998 | section,ENV_DEFAULT_MD)) == NULL)) | ||
999 | { | ||
1000 | lookup_fail(section,ENV_DEFAULT_MD); | ||
1001 | goto err; | ||
1002 | } | ||
1003 | |||
1004 | if ((dgst=EVP_get_digestbyname(md)) == NULL) | ||
1005 | { | ||
1006 | BIO_printf(bio_err,"%s is an unsupported message digest type\n",md); | ||
1007 | goto err; | ||
1008 | } | ||
1009 | |||
1004 | if (req) | 1010 | if (req) |
1005 | { | 1011 | { |
1006 | if ((md == NULL) && ((md=NCONF_get_string(conf, | ||
1007 | section,ENV_DEFAULT_MD)) == NULL)) | ||
1008 | { | ||
1009 | lookup_fail(section,ENV_DEFAULT_MD); | ||
1010 | goto err; | ||
1011 | } | ||
1012 | if ((email_dn == 1) && ((tmp_email_dn=NCONF_get_string(conf, | 1012 | if ((email_dn == 1) && ((tmp_email_dn=NCONF_get_string(conf, |
1013 | section,ENV_DEFAULT_EMAIL_DN)) != NULL )) | 1013 | section,ENV_DEFAULT_EMAIL_DN)) != NULL )) |
1014 | { | 1014 | { |
1015 | if(strcmp(tmp_email_dn,"no") == 0) | 1015 | if(strcmp(tmp_email_dn,"no") == 0) |
1016 | email_dn=0; | 1016 | email_dn=0; |
1017 | } | 1017 | } |
1018 | if ((dgst=EVP_get_digestbyname(md)) == NULL) | ||
1019 | { | ||
1020 | BIO_printf(bio_err,"%s is an unsupported message digest type\n",md); | ||
1021 | goto err; | ||
1022 | } | ||
1023 | if (verbose) | 1018 | if (verbose) |
1024 | BIO_printf(bio_err,"message digest is %s\n", | 1019 | BIO_printf(bio_err,"message digest is %s\n", |
1025 | OBJ_nid2ln(dgst->type)); | 1020 | OBJ_nid2ln(dgst->type)); |
@@ -1106,7 +1101,7 @@ bad: | |||
1106 | goto err; | 1101 | goto err; |
1107 | } | 1102 | } |
1108 | 1103 | ||
1109 | if ((serial=load_serial(serialfile, 0, NULL)) == NULL) | 1104 | if ((serial=load_serial(serialfile, create_ser, NULL)) == NULL) |
1110 | { | 1105 | { |
1111 | BIO_printf(bio_err,"error while loading serial number\n"); | 1106 | BIO_printf(bio_err,"error while loading serial number\n"); |
1112 | goto err; | 1107 | goto err; |
@@ -1402,23 +1397,10 @@ bad: | |||
1402 | 1397 | ||
1403 | /* we now have a CRL */ | 1398 | /* we now have a CRL */ |
1404 | if (verbose) BIO_printf(bio_err,"signing CRL\n"); | 1399 | if (verbose) BIO_printf(bio_err,"signing CRL\n"); |
1405 | if (md != NULL) | ||
1406 | { | ||
1407 | if ((dgst=EVP_get_digestbyname(md)) == NULL) | ||
1408 | { | ||
1409 | BIO_printf(bio_err,"%s is an unsupported message digest type\n",md); | ||
1410 | goto err; | ||
1411 | } | ||
1412 | } | ||
1413 | else | ||
1414 | { | ||
1415 | #ifndef OPENSSL_NO_DSA | 1400 | #ifndef OPENSSL_NO_DSA |
1416 | if (pkey->type == EVP_PKEY_DSA) | 1401 | if (pkey->type == EVP_PKEY_DSA) |
1417 | dgst=EVP_dss1(); | 1402 | dgst=EVP_dss1(); |
1418 | else | ||
1419 | #endif | 1403 | #endif |
1420 | dgst=EVP_md5(); | ||
1421 | } | ||
1422 | 1404 | ||
1423 | /* Add any extensions asked for */ | 1405 | /* Add any extensions asked for */ |
1424 | 1406 | ||
diff --git a/src/lib/libssl/src/apps/crl.c b/src/lib/libssl/src/apps/crl.c index 81d66587c1..878f65468e 100644 --- a/src/lib/libssl/src/apps/crl.c +++ b/src/lib/libssl/src/apps/crl.c | |||
@@ -355,7 +355,11 @@ bad: | |||
355 | 355 | ||
356 | if (text) X509_CRL_print(out, x); | 356 | if (text) X509_CRL_print(out, x); |
357 | 357 | ||
358 | if (noout) goto end; | 358 | if (noout) |
359 | { | ||
360 | ret = 0; | ||
361 | goto end; | ||
362 | } | ||
359 | 363 | ||
360 | if (outformat == FORMAT_ASN1) | 364 | if (outformat == FORMAT_ASN1) |
361 | i=(int)i2d_X509_CRL_bio(out,x); | 365 | i=(int)i2d_X509_CRL_bio(out,x); |
diff --git a/src/lib/libssl/src/apps/dgst.c b/src/lib/libssl/src/apps/dgst.c index be25dafef7..17fb87b77c 100644 --- a/src/lib/libssl/src/apps/dgst.c +++ b/src/lib/libssl/src/apps/dgst.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
67 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
68 | #include <openssl/pem.h> | 68 | #include <openssl/pem.h> |
69 | #include <openssl/hmac.h> | ||
69 | 70 | ||
70 | #undef BUFSIZE | 71 | #undef BUFSIZE |
71 | #define BUFSIZE 1024*8 | 72 | #define BUFSIZE 1024*8 |
@@ -73,9 +74,11 @@ | |||
73 | #undef PROG | 74 | #undef PROG |
74 | #define PROG dgst_main | 75 | #define PROG dgst_main |
75 | 76 | ||
77 | static HMAC_CTX hmac_ctx; | ||
78 | |||
76 | int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, | 79 | int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, |
77 | EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title, | 80 | EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title, |
78 | const char *file); | 81 | const char *file,BIO *bmd,const char *hmac_key, int non_fips_allow); |
79 | 82 | ||
80 | int MAIN(int, char **); | 83 | int MAIN(int, char **); |
81 | 84 | ||
@@ -100,9 +103,12 @@ int MAIN(int argc, char **argv) | |||
100 | EVP_PKEY *sigkey = NULL; | 103 | EVP_PKEY *sigkey = NULL; |
101 | unsigned char *sigbuf = NULL; | 104 | unsigned char *sigbuf = NULL; |
102 | int siglen = 0; | 105 | int siglen = 0; |
106 | char *passargin = NULL, *passin = NULL; | ||
103 | #ifndef OPENSSL_NO_ENGINE | 107 | #ifndef OPENSSL_NO_ENGINE |
104 | char *engine=NULL; | 108 | char *engine=NULL; |
105 | #endif | 109 | #endif |
110 | char *hmac_key=NULL; | ||
111 | int non_fips_allow = 0; | ||
106 | 112 | ||
107 | apps_startup(); | 113 | apps_startup(); |
108 | 114 | ||
@@ -145,6 +151,12 @@ int MAIN(int argc, char **argv) | |||
145 | if (--argc < 1) break; | 151 | if (--argc < 1) break; |
146 | keyfile=*(++argv); | 152 | keyfile=*(++argv); |
147 | } | 153 | } |
154 | else if (!strcmp(*argv,"-passin")) | ||
155 | { | ||
156 | if (--argc < 1) | ||
157 | break; | ||
158 | passargin=*++argv; | ||
159 | } | ||
148 | else if (strcmp(*argv,"-verify") == 0) | 160 | else if (strcmp(*argv,"-verify") == 0) |
149 | { | 161 | { |
150 | if (--argc < 1) break; | 162 | if (--argc < 1) break; |
@@ -181,6 +193,14 @@ int MAIN(int argc, char **argv) | |||
181 | out_bin = 1; | 193 | out_bin = 1; |
182 | else if (strcmp(*argv,"-d") == 0) | 194 | else if (strcmp(*argv,"-d") == 0) |
183 | debug=1; | 195 | debug=1; |
196 | else if (strcmp(*argv,"-non-fips-allow") == 0) | ||
197 | non_fips_allow=1; | ||
198 | else if (!strcmp(*argv,"-hmac")) | ||
199 | { | ||
200 | if (--argc < 1) | ||
201 | break; | ||
202 | hmac_key=*++argv; | ||
203 | } | ||
184 | else if ((m=EVP_get_digestbyname(&((*argv)[1]))) != NULL) | 204 | else if ((m=EVP_get_digestbyname(&((*argv)[1]))) != NULL) |
185 | md=m; | 205 | md=m; |
186 | else | 206 | else |
@@ -235,7 +255,7 @@ int MAIN(int argc, char **argv) | |||
235 | } | 255 | } |
236 | 256 | ||
237 | #ifndef OPENSSL_NO_ENGINE | 257 | #ifndef OPENSSL_NO_ENGINE |
238 | e = setup_engine(bio_err, engine, 0); | 258 | e = setup_engine(bio_err, engine, 0); |
239 | #endif | 259 | #endif |
240 | 260 | ||
241 | in=BIO_new(BIO_s_file()); | 261 | in=BIO_new(BIO_s_file()); |
@@ -247,6 +267,12 @@ int MAIN(int argc, char **argv) | |||
247 | BIO_set_callback_arg(in,bio_err); | 267 | BIO_set_callback_arg(in,bio_err); |
248 | } | 268 | } |
249 | 269 | ||
270 | if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) | ||
271 | { | ||
272 | BIO_printf(bio_err, "Error getting password\n"); | ||
273 | goto end; | ||
274 | } | ||
275 | |||
250 | if ((in == NULL) || (bmd == NULL)) | 276 | if ((in == NULL) || (bmd == NULL)) |
251 | { | 277 | { |
252 | ERR_print_errors(bio_err); | 278 | ERR_print_errors(bio_err); |
@@ -288,7 +314,7 @@ int MAIN(int argc, char **argv) | |||
288 | sigkey = load_pubkey(bio_err, keyfile, keyform, 0, NULL, | 314 | sigkey = load_pubkey(bio_err, keyfile, keyform, 0, NULL, |
289 | e, "key file"); | 315 | e, "key file"); |
290 | else | 316 | else |
291 | sigkey = load_key(bio_err, keyfile, keyform, 0, NULL, | 317 | sigkey = load_key(bio_err, keyfile, keyform, 0, passin, |
292 | e, "key file"); | 318 | e, "key file"); |
293 | if (!sigkey) | 319 | if (!sigkey) |
294 | { | 320 | { |
@@ -318,18 +344,30 @@ int MAIN(int argc, char **argv) | |||
318 | goto end; | 344 | goto end; |
319 | } | 345 | } |
320 | } | 346 | } |
321 | |||
322 | 347 | ||
348 | if (non_fips_allow) | ||
349 | { | ||
350 | EVP_MD_CTX *md_ctx; | ||
351 | BIO_get_md_ctx(bmd,&md_ctx); | ||
352 | EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
353 | } | ||
323 | 354 | ||
324 | /* we use md as a filter, reading from 'in' */ | 355 | /* we use md as a filter, reading from 'in' */ |
325 | BIO_set_md(bmd,md); | 356 | if (!BIO_set_md(bmd,md)) |
357 | { | ||
358 | BIO_printf(bio_err, "Error setting digest %s\n", | ||
359 | EVP_MD_name(md)); | ||
360 | ERR_print_errors(bio_err); | ||
361 | goto end; | ||
362 | } | ||
363 | |||
326 | inp=BIO_push(bmd,in); | 364 | inp=BIO_push(bmd,in); |
327 | 365 | ||
328 | if (argc == 0) | 366 | if (argc == 0) |
329 | { | 367 | { |
330 | BIO_set_fp(in,stdin,BIO_NOCLOSE); | 368 | BIO_set_fp(in,stdin,BIO_NOCLOSE); |
331 | err=do_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf, | 369 | err=do_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf, |
332 | siglen,"","(stdin)"); | 370 | siglen,"","(stdin)",bmd,hmac_key, non_fips_allow); |
333 | } | 371 | } |
334 | else | 372 | else |
335 | { | 373 | { |
@@ -347,14 +385,15 @@ int MAIN(int argc, char **argv) | |||
347 | } | 385 | } |
348 | if(!out_bin) | 386 | if(!out_bin) |
349 | { | 387 | { |
350 | size_t len = strlen(name)+strlen(argv[i])+5; | 388 | size_t len = strlen(name)+strlen(argv[i])+(hmac_key ? 5 : 0)+5; |
351 | tmp=tofree=OPENSSL_malloc(len); | 389 | tmp=tofree=OPENSSL_malloc(len); |
352 | BIO_snprintf(tmp,len,"%s(%s)= ",name,argv[i]); | 390 | BIO_snprintf(tmp,len,"%s%s(%s)= ", |
391 | hmac_key ? "HMAC-" : "",name,argv[i]); | ||
353 | } | 392 | } |
354 | else | 393 | else |
355 | tmp=""; | 394 | tmp=""; |
356 | r=do_fp(out,buf,inp,separator,out_bin,sigkey,sigbuf, | 395 | r=do_fp(out,buf,inp,separator,out_bin,sigkey,sigbuf, |
357 | siglen,tmp,argv[i]); | 396 | siglen,tmp,argv[i],bmd,hmac_key,non_fips_allow); |
358 | if(r) | 397 | if(r) |
359 | err=r; | 398 | err=r; |
360 | if(tofree) | 399 | if(tofree) |
@@ -369,6 +408,8 @@ end: | |||
369 | OPENSSL_free(buf); | 408 | OPENSSL_free(buf); |
370 | } | 409 | } |
371 | if (in != NULL) BIO_free(in); | 410 | if (in != NULL) BIO_free(in); |
411 | if (passin) | ||
412 | OPENSSL_free(passin); | ||
372 | BIO_free_all(out); | 413 | BIO_free_all(out); |
373 | EVP_PKEY_free(sigkey); | 414 | EVP_PKEY_free(sigkey); |
374 | if(sigbuf) OPENSSL_free(sigbuf); | 415 | if(sigbuf) OPENSSL_free(sigbuf); |
@@ -379,11 +420,25 @@ end: | |||
379 | 420 | ||
380 | int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, | 421 | int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, |
381 | EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title, | 422 | EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title, |
382 | const char *file) | 423 | const char *file,BIO *bmd,const char *hmac_key, int non_fips_allow) |
383 | { | 424 | { |
384 | int len; | 425 | unsigned int len; |
385 | int i; | 426 | int i; |
427 | EVP_MD_CTX *md_ctx; | ||
386 | 428 | ||
429 | if (hmac_key) | ||
430 | { | ||
431 | EVP_MD *md; | ||
432 | |||
433 | BIO_get_md(bmd,&md); | ||
434 | HMAC_CTX_init(&hmac_ctx); | ||
435 | if (non_fips_allow) | ||
436 | HMAC_CTX_set_flags(&hmac_ctx, | ||
437 | EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
438 | HMAC_Init_ex(&hmac_ctx,hmac_key,strlen(hmac_key),md, NULL); | ||
439 | BIO_get_md_ctx(bmd,&md_ctx); | ||
440 | BIO_set_md_ctx(bmd,&hmac_ctx.md_ctx); | ||
441 | } | ||
387 | for (;;) | 442 | for (;;) |
388 | { | 443 | { |
389 | i=BIO_read(bp,(char *)buf,BUFSIZE); | 444 | i=BIO_read(bp,(char *)buf,BUFSIZE); |
@@ -426,6 +481,11 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, | |||
426 | return 1; | 481 | return 1; |
427 | } | 482 | } |
428 | } | 483 | } |
484 | else if(hmac_key) | ||
485 | { | ||
486 | HMAC_Final(&hmac_ctx,buf,&len); | ||
487 | HMAC_CTX_cleanup(&hmac_ctx); | ||
488 | } | ||
429 | else | 489 | else |
430 | len=BIO_gets(bp,(char *)buf,BUFSIZE); | 490 | len=BIO_gets(bp,(char *)buf,BUFSIZE); |
431 | 491 | ||
@@ -433,7 +493,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, | |||
433 | else | 493 | else |
434 | { | 494 | { |
435 | BIO_write(out,title,strlen(title)); | 495 | BIO_write(out,title,strlen(title)); |
436 | for (i=0; i<len; i++) | 496 | for (i=0; (unsigned int)i<len; i++) |
437 | { | 497 | { |
438 | if (sep && (i != 0)) | 498 | if (sep && (i != 0)) |
439 | BIO_printf(out, ":"); | 499 | BIO_printf(out, ":"); |
@@ -441,6 +501,10 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, | |||
441 | } | 501 | } |
442 | BIO_printf(out, "\n"); | 502 | BIO_printf(out, "\n"); |
443 | } | 503 | } |
504 | if (hmac_key) | ||
505 | { | ||
506 | BIO_set_md_ctx(bmd,md_ctx); | ||
507 | } | ||
444 | return 0; | 508 | return 0; |
445 | } | 509 | } |
446 | 510 | ||
diff --git a/src/lib/libssl/src/apps/enc.c b/src/lib/libssl/src/apps/enc.c index 30378a9542..6f3161395e 100644 --- a/src/lib/libssl/src/apps/enc.c +++ b/src/lib/libssl/src/apps/enc.c | |||
@@ -114,9 +114,11 @@ int MAIN(int argc, char **argv) | |||
114 | unsigned char salt[PKCS5_SALT_LEN]; | 114 | unsigned char salt[PKCS5_SALT_LEN]; |
115 | char *str=NULL, *passarg = NULL, *pass = NULL; | 115 | char *str=NULL, *passarg = NULL, *pass = NULL; |
116 | char *hkey=NULL,*hiv=NULL,*hsalt = NULL; | 116 | char *hkey=NULL,*hiv=NULL,*hsalt = NULL; |
117 | char *md=NULL; | ||
117 | int enc=1,printkey=0,i,base64=0; | 118 | int enc=1,printkey=0,i,base64=0; |
118 | int debug=0,olb64=0,nosalt=0; | 119 | int debug=0,olb64=0,nosalt=0; |
119 | const EVP_CIPHER *cipher=NULL,*c; | 120 | const EVP_CIPHER *cipher=NULL,*c; |
121 | EVP_CIPHER_CTX *ctx = NULL; | ||
120 | char *inf=NULL,*outf=NULL; | 122 | char *inf=NULL,*outf=NULL; |
121 | BIO *in=NULL,*out=NULL,*b64=NULL,*benc=NULL,*rbio=NULL,*wbio=NULL; | 123 | BIO *in=NULL,*out=NULL,*b64=NULL,*benc=NULL,*rbio=NULL,*wbio=NULL; |
122 | #define PROG_NAME_SIZE 39 | 124 | #define PROG_NAME_SIZE 39 |
@@ -124,6 +126,8 @@ int MAIN(int argc, char **argv) | |||
124 | #ifndef OPENSSL_NO_ENGINE | 126 | #ifndef OPENSSL_NO_ENGINE |
125 | char *engine = NULL; | 127 | char *engine = NULL; |
126 | #endif | 128 | #endif |
129 | const EVP_MD *dgst=NULL; | ||
130 | int non_fips_allow = 0; | ||
127 | 131 | ||
128 | apps_startup(); | 132 | apps_startup(); |
129 | 133 | ||
@@ -253,6 +257,13 @@ int MAIN(int argc, char **argv) | |||
253 | if (--argc < 1) goto bad; | 257 | if (--argc < 1) goto bad; |
254 | hiv= *(++argv); | 258 | hiv= *(++argv); |
255 | } | 259 | } |
260 | else if (strcmp(*argv,"-md") == 0) | ||
261 | { | ||
262 | if (--argc < 1) goto bad; | ||
263 | md= *(++argv); | ||
264 | } | ||
265 | else if (strcmp(*argv,"-non-fips-allow") == 0) | ||
266 | non_fips_allow = 1; | ||
256 | else if ((argv[0][0] == '-') && | 267 | else if ((argv[0][0] == '-') && |
257 | ((c=EVP_get_cipherbyname(&(argv[0][1]))) != NULL)) | 268 | ((c=EVP_get_cipherbyname(&(argv[0][1]))) != NULL)) |
258 | { | 269 | { |
@@ -271,8 +282,10 @@ bad: | |||
271 | BIO_printf(bio_err,"%-14s encrypt\n","-e"); | 282 | BIO_printf(bio_err,"%-14s encrypt\n","-e"); |
272 | BIO_printf(bio_err,"%-14s decrypt\n","-d"); | 283 | BIO_printf(bio_err,"%-14s decrypt\n","-d"); |
273 | BIO_printf(bio_err,"%-14s base64 encode/decode, depending on encryption flag\n","-a/-base64"); | 284 | BIO_printf(bio_err,"%-14s base64 encode/decode, depending on encryption flag\n","-a/-base64"); |
274 | BIO_printf(bio_err,"%-14s key is the next argument\n","-k"); | 285 | BIO_printf(bio_err,"%-14s passphrase is the next argument\n","-k"); |
275 | BIO_printf(bio_err,"%-14s key is the first line of the file argument\n","-kfile"); | 286 | BIO_printf(bio_err,"%-14s passphrase is the first line of the file argument\n","-kfile"); |
287 | BIO_printf(bio_err,"%-14s the next argument is the md to use to create a key\n","-md"); | ||
288 | BIO_printf(bio_err,"%-14s from a passphrase. One of md2, md5, sha or sha1\n",""); | ||
276 | BIO_printf(bio_err,"%-14s key/iv in hex is the next argument\n","-K/-iv"); | 289 | BIO_printf(bio_err,"%-14s key/iv in hex is the next argument\n","-K/-iv"); |
277 | BIO_printf(bio_err,"%-14s print the iv/key (then exit if -P)\n","-[pP]"); | 290 | BIO_printf(bio_err,"%-14s print the iv/key (then exit if -P)\n","-[pP]"); |
278 | BIO_printf(bio_err,"%-14s buffer size\n","-bufsize <n>"); | 291 | BIO_printf(bio_err,"%-14s buffer size\n","-bufsize <n>"); |
@@ -296,6 +309,20 @@ bad: | |||
296 | e = setup_engine(bio_err, engine, 0); | 309 | e = setup_engine(bio_err, engine, 0); |
297 | #endif | 310 | #endif |
298 | 311 | ||
312 | if (md && (dgst=EVP_get_digestbyname(md)) == NULL) | ||
313 | { | ||
314 | BIO_printf(bio_err,"%s is an unsupported message digest type\n",md); | ||
315 | goto end; | ||
316 | } | ||
317 | |||
318 | if (dgst == NULL) | ||
319 | { | ||
320 | if (in_FIPS_mode) | ||
321 | dgst = EVP_sha1(); | ||
322 | else | ||
323 | dgst = EVP_md5(); | ||
324 | } | ||
325 | |||
299 | if (bufsize != NULL) | 326 | if (bufsize != NULL) |
300 | { | 327 | { |
301 | unsigned long n; | 328 | unsigned long n; |
@@ -483,7 +510,7 @@ bad: | |||
483 | sptr = salt; | 510 | sptr = salt; |
484 | } | 511 | } |
485 | 512 | ||
486 | EVP_BytesToKey(cipher,EVP_md5(),sptr, | 513 | EVP_BytesToKey(cipher,dgst,sptr, |
487 | (unsigned char *)str, | 514 | (unsigned char *)str, |
488 | strlen(str),1,key,iv); | 515 | strlen(str),1,key,iv); |
489 | /* zero the complete buffer or the string | 516 | /* zero the complete buffer or the string |
@@ -516,13 +543,43 @@ bad: | |||
516 | 543 | ||
517 | if ((benc=BIO_new(BIO_f_cipher())) == NULL) | 544 | if ((benc=BIO_new(BIO_f_cipher())) == NULL) |
518 | goto end; | 545 | goto end; |
519 | BIO_set_cipher(benc,cipher,key,iv,enc); | 546 | |
520 | if (nopad) | 547 | /* Since we may be changing parameters work on the encryption |
548 | * context rather than calling BIO_set_cipher(). | ||
549 | */ | ||
550 | |||
551 | BIO_get_cipher_ctx(benc, &ctx); | ||
552 | if (!EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, enc)) | ||
521 | { | 553 | { |
522 | EVP_CIPHER_CTX *ctx; | 554 | BIO_printf(bio_err, "Error setting cipher %s\n", |
523 | BIO_get_cipher_ctx(benc, &ctx); | 555 | EVP_CIPHER_name(cipher)); |
556 | ERR_print_errors(bio_err); | ||
557 | goto end; | ||
558 | } | ||
559 | |||
560 | if (non_fips_allow) | ||
561 | EVP_CIPHER_CTX_set_flags(ctx, | ||
562 | EVP_CIPH_FLAG_NON_FIPS_ALLOW); | ||
563 | |||
564 | if (!EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, enc)) | ||
565 | { | ||
566 | BIO_printf(bio_err, "Error setting cipher %s\n", | ||
567 | EVP_CIPHER_name(cipher)); | ||
568 | ERR_print_errors(bio_err); | ||
569 | goto end; | ||
570 | } | ||
571 | |||
572 | if (nopad) | ||
524 | EVP_CIPHER_CTX_set_padding(ctx, 0); | 573 | EVP_CIPHER_CTX_set_padding(ctx, 0); |
574 | |||
575 | if (!EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, enc)) | ||
576 | { | ||
577 | BIO_printf(bio_err, "Error setting cipher %s\n", | ||
578 | EVP_CIPHER_name(cipher)); | ||
579 | ERR_print_errors(bio_err); | ||
580 | goto end; | ||
525 | } | 581 | } |
582 | |||
526 | if (debug) | 583 | if (debug) |
527 | { | 584 | { |
528 | BIO_set_callback(benc,BIO_debug_callback); | 585 | BIO_set_callback(benc,BIO_debug_callback); |
diff --git a/src/lib/libssl/src/apps/makeapps.com b/src/lib/libssl/src/apps/makeapps.com index 0197c8a171..2f1af9ec94 100644 --- a/src/lib/libssl/src/apps/makeapps.com +++ b/src/lib/libssl/src/apps/makeapps.com | |||
@@ -142,13 +142,13 @@ $ LIB_FILES = "VERIFY;ASN1PARS;REQ;DGST;DH;DHPARAM;ENC;PASSWD;GENDH;ERRSTR;"+- | |||
142 | "RSA;RSAUTL;DSA;DSAPARAM;"+- | 142 | "RSA;RSAUTL;DSA;DSAPARAM;"+- |
143 | "X509;GENRSA;GENDSA;S_SERVER;S_CLIENT;SPEED;"+- | 143 | "X509;GENRSA;GENDSA;S_SERVER;S_CLIENT;SPEED;"+- |
144 | "S_TIME;APPS;S_CB;S_SOCKET;APP_RAND;VERSION;SESS_ID;"+- | 144 | "S_TIME;APPS;S_CB;S_SOCKET;APP_RAND;VERSION;SESS_ID;"+- |
145 | "CIPHERS;NSEQ;PKCS12;PKCS8;SPKAC;SMIME;RAND;ENGINE;OCSP" | 145 | "CIPHERS;NSEQ;PKCS12;PKCS8;SPKAC;SMIME;RAND;ENGINE;OCSP;PRIME" |
146 | $ APP_FILES := OPENSSL,'OBJ_DIR'VERIFY.OBJ,ASN1PARS.OBJ,REQ.OBJ,DGST.OBJ,DH.OBJ,DHPARAM.OBJ,ENC.OBJ,PASSWD.OBJ,GENDH.OBJ,ERRSTR.OBJ,- | 146 | $ APP_FILES := OPENSSL,'OBJ_DIR'VERIFY.OBJ,ASN1PARS.OBJ,REQ.OBJ,DGST.OBJ,DH.OBJ,DHPARAM.OBJ,ENC.OBJ,PASSWD.OBJ,GENDH.OBJ,ERRSTR.OBJ,- |
147 | CA.OBJ,PKCS7.OBJ,CRL2P7.OBJ,CRL.OBJ,- | 147 | CA.OBJ,PKCS7.OBJ,CRL2P7.OBJ,CRL.OBJ,- |
148 | RSA.OBJ,RSAUTL.OBJ,DSA.OBJ,DSAPARAM.OBJ,- | 148 | RSA.OBJ,RSAUTL.OBJ,DSA.OBJ,DSAPARAM.OBJ,- |
149 | X509.OBJ,GENRSA.OBJ,GENDSA.OBJ,S_SERVER.OBJ,S_CLIENT.OBJ,SPEED.OBJ,- | 149 | X509.OBJ,GENRSA.OBJ,GENDSA.OBJ,S_SERVER.OBJ,S_CLIENT.OBJ,SPEED.OBJ,- |
150 | S_TIME.OBJ,APPS.OBJ,S_CB.OBJ,S_SOCKET.OBJ,APP_RAND.OBJ,VERSION.OBJ,SESS_ID.OBJ,- | 150 | S_TIME.OBJ,APPS.OBJ,S_CB.OBJ,S_SOCKET.OBJ,APP_RAND.OBJ,VERSION.OBJ,SESS_ID.OBJ,- |
151 | CIPHERS.OBJ,NSEQ.OBJ,PKCS12.OBJ,PKCS8.OBJ,SPKAC.OBJ,SMIME.OBJ,RAND.OBJ,ENGINE.OBJ,OCSP.OBJ | 151 | CIPHERS.OBJ,NSEQ.OBJ,PKCS12.OBJ,PKCS8.OBJ,SPKAC.OBJ,SMIME.OBJ,RAND.OBJ,ENGINE.OBJ,OCSP.OBJ,PRIME.OBJ |
152 | $ TCPIP_PROGRAMS = ",," | 152 | $ TCPIP_PROGRAMS = ",," |
153 | $ IF COMPILER .EQS. "VAXC" THEN - | 153 | $ IF COMPILER .EQS. "VAXC" THEN - |
154 | TCPIP_PROGRAMS = ",OPENSSL," | 154 | TCPIP_PROGRAMS = ",OPENSSL," |
@@ -679,7 +679,7 @@ $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - | |||
679 | THEN CC = "CC/DECC" | 679 | THEN CC = "CC/DECC" |
680 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - | 680 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - |
681 | "/NOLIST/PREFIX=ALL" + - | 681 | "/NOLIST/PREFIX=ALL" + - |
682 | "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS | 682 | "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS |
683 | $! | 683 | $! |
684 | $! Define The Linker Options File Name. | 684 | $! Define The Linker Options File Name. |
685 | $! | 685 | $! |
@@ -711,7 +711,7 @@ $ EXIT | |||
711 | $ ENDIF | 711 | $ ENDIF |
712 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" | 712 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" |
713 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | 713 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - |
714 | "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS | 714 | "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS |
715 | $ CCDEFS = CCDEFS + ",""VAXC""" | 715 | $ CCDEFS = CCDEFS + ",""VAXC""" |
716 | $! | 716 | $! |
717 | $! Define <sys> As SYS$COMMON:[SYSLIB] | 717 | $! Define <sys> As SYS$COMMON:[SYSLIB] |
@@ -743,7 +743,7 @@ $! Use GNU C... | |||
743 | $! | 743 | $! |
744 | $ IF F$TYPE(GCC) .EQS. "" THEN GCC := GCC | 744 | $ IF F$TYPE(GCC) .EQS. "" THEN GCC := GCC |
745 | $ CC = GCC+"/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | 745 | $ CC = GCC+"/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - |
746 | "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS | 746 | "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS |
747 | $! | 747 | $! |
748 | $! Define The Linker Options File Name. | 748 | $! Define The Linker Options File Name. |
749 | $! | 749 | $! |
diff --git a/src/lib/libssl/src/apps/openssl-vms.cnf b/src/lib/libssl/src/apps/openssl-vms.cnf index d4498713fa..878467ce98 100644 --- a/src/lib/libssl/src/apps/openssl-vms.cnf +++ b/src/lib/libssl/src/apps/openssl-vms.cnf | |||
@@ -3,8 +3,13 @@ | |||
3 | # This is mostly being used for generation of certificate requests. | 3 | # This is mostly being used for generation of certificate requests. |
4 | # | 4 | # |
5 | 5 | ||
6 | # This definition stops the following lines choking if HOME isn't | ||
7 | # defined. | ||
8 | HOME = . | ||
6 | RANDFILE = $ENV::HOME/.rnd | 9 | RANDFILE = $ENV::HOME/.rnd |
7 | oid_file = $ENV::HOME/.oid | 10 | |
11 | # Extra OBJECT IDENTIFIER info: | ||
12 | #oid_file = $ENV::HOME/.oid | ||
8 | oid_section = new_oids | 13 | oid_section = new_oids |
9 | 14 | ||
10 | # To use this configuration file with the "-extfile" option of the | 15 | # To use this configuration file with the "-extfile" option of the |
@@ -29,22 +34,35 @@ default_ca = CA_default # The default ca section | |||
29 | #################################################################### | 34 | #################################################################### |
30 | [ CA_default ] | 35 | [ CA_default ] |
31 | 36 | ||
32 | dir = sys\$disk:[.demoCA # Where everything is kept | 37 | dir = sys\$disk:[.demoCA # Where everything is kept |
33 | certs = $dir.certs] # Where the issued certs are kept | 38 | certs = $dir.certs] # Where the issued certs are kept |
34 | crl_dir = $dir.crl] # Where the issued crl are kept | 39 | crl_dir = $dir.crl] # Where the issued crl are kept |
35 | database = $dir]index.txt # database index file. | 40 | database = $dir]index.txt # database index file. |
36 | new_certs_dir = $dir.newcerts] # default place for new certs. | 41 | #unique_subject = no # Set to 'no' to allow creation of |
42 | # several ctificates with same subject. | ||
43 | new_certs_dir = $dir.newcerts] # default place for new certs. | ||
37 | 44 | ||
38 | certificate = $dir]cacert.pem # The CA certificate | 45 | certificate = $dir]cacert.pem # The CA certificate |
39 | serial = $dir]serial. # The current serial number | 46 | serial = $dir]serial. # The current serial number |
47 | #crlnumber = $dir]crlnumber. # the current crl number must be | ||
48 | # commented out to leave a V1 CRL | ||
40 | crl = $dir]crl.pem # The current CRL | 49 | crl = $dir]crl.pem # The current CRL |
41 | private_key = $dir.private]cakey.pem# The private key | 50 | private_key = $dir.private]cakey.pem# The private key |
42 | RANDFILE = $dir.private].rand # private random number file | 51 | RANDFILE = $dir.private].rand # private random number file |
43 | 52 | ||
44 | x509_extensions = usr_cert # The extentions to add to the cert | 53 | x509_extensions = usr_cert # The extentions to add to the cert |
45 | 54 | ||
55 | # Comment out the following two lines for the "traditional" | ||
56 | # (and highly broken) format. | ||
57 | name_opt = ca_default # Subject Name options | ||
58 | cert_opt = ca_default # Certificate field options | ||
59 | |||
60 | # Extension copying option: use with caution. | ||
61 | # copy_extensions = copy | ||
62 | |||
46 | # Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs | 63 | # Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs |
47 | # so this is commented out by default to leave a V1 CRL. | 64 | # so this is commented out by default to leave a V1 CRL. |
65 | # crlnumber must also be commented out to leave a V1 CRL. | ||
48 | # crl_extensions = crl_ext | 66 | # crl_extensions = crl_ext |
49 | 67 | ||
50 | default_days = 365 # how long to certify for | 68 | default_days = 365 # how long to certify for |
@@ -86,16 +104,19 @@ distinguished_name = req_distinguished_name | |||
86 | attributes = req_attributes | 104 | attributes = req_attributes |
87 | x509_extensions = v3_ca # The extentions to add to the self signed cert | 105 | x509_extensions = v3_ca # The extentions to add to the self signed cert |
88 | 106 | ||
89 | # This sets the permitted types in a DirectoryString. There are several | 107 | # Passwords for private keys if not present they will be prompted for |
90 | # options. | 108 | # input_password = secret |
109 | # output_password = secret | ||
110 | |||
111 | # This sets a mask for permitted string types. There are several options. | ||
91 | # default: PrintableString, T61String, BMPString. | 112 | # default: PrintableString, T61String, BMPString. |
92 | # pkix : PrintableString, BMPString. | 113 | # pkix : PrintableString, BMPString. |
93 | # utf8only: only UTF8Strings. | 114 | # utf8only: only UTF8Strings. |
94 | # nobmp : PrintableString, T61String (no BMPStrings). | 115 | # nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings). |
95 | # MASK:XXXX a literal mask value. | 116 | # MASK:XXXX a literal mask value. |
96 | # WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings | 117 | # WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings |
97 | # so use this option with caution! | 118 | # so use this option with caution! |
98 | dirstring_type = nobmp | 119 | string_mask = nombstr |
99 | 120 | ||
100 | # req_extensions = v3_req # The extensions to add to a certificate request | 121 | # req_extensions = v3_req # The extensions to add to a certificate request |
101 | 122 | ||
@@ -124,7 +145,7 @@ commonName = Common Name (eg, YOUR name) | |||
124 | commonName_max = 64 | 145 | commonName_max = 64 |
125 | 146 | ||
126 | emailAddress = Email Address | 147 | emailAddress = Email Address |
127 | emailAddress_max = 40 | 148 | emailAddress_max = 64 |
128 | 149 | ||
129 | # SET-ex3 = SET extension number 3 | 150 | # SET-ex3 = SET extension number 3 |
130 | 151 | ||
@@ -172,6 +193,9 @@ authorityKeyIdentifier=keyid,issuer:always | |||
172 | # This stuff is for subjectAltName and issuerAltname. | 193 | # This stuff is for subjectAltName and issuerAltname. |
173 | # Import the email address. | 194 | # Import the email address. |
174 | # subjectAltName=email:copy | 195 | # subjectAltName=email:copy |
196 | # An alternative to produce certificates that aren't | ||
197 | # deprecated according to PKIX. | ||
198 | # subjectAltName=email:move | ||
175 | 199 | ||
176 | # Copy subject details | 200 | # Copy subject details |
177 | # issuerAltName=issuer:copy | 201 | # issuerAltName=issuer:copy |
@@ -234,3 +258,56 @@ basicConstraints = CA:true | |||
234 | 258 | ||
235 | # issuerAltName=issuer:copy | 259 | # issuerAltName=issuer:copy |
236 | authorityKeyIdentifier=keyid:always,issuer:always | 260 | authorityKeyIdentifier=keyid:always,issuer:always |
261 | |||
262 | [ proxy_cert_ext ] | ||
263 | # These extensions should be added when creating a proxy certificate | ||
264 | |||
265 | # This goes against PKIX guidelines but some CAs do it and some software | ||
266 | # requires this to avoid interpreting an end user certificate as a CA. | ||
267 | |||
268 | basicConstraints=CA:FALSE | ||
269 | |||
270 | # Here are some examples of the usage of nsCertType. If it is omitted | ||
271 | # the certificate can be used for anything *except* object signing. | ||
272 | |||
273 | # This is OK for an SSL server. | ||
274 | # nsCertType = server | ||
275 | |||
276 | # For an object signing certificate this would be used. | ||
277 | # nsCertType = objsign | ||
278 | |||
279 | # For normal client use this is typical | ||
280 | # nsCertType = client, email | ||
281 | |||
282 | # and for everything including object signing: | ||
283 | # nsCertType = client, email, objsign | ||
284 | |||
285 | # This is typical in keyUsage for a client certificate. | ||
286 | # keyUsage = nonRepudiation, digitalSignature, keyEncipherment | ||
287 | |||
288 | # This will be displayed in Netscape's comment listbox. | ||
289 | nsComment = "OpenSSL Generated Certificate" | ||
290 | |||
291 | # PKIX recommendations harmless if included in all certificates. | ||
292 | subjectKeyIdentifier=hash | ||
293 | authorityKeyIdentifier=keyid,issuer:always | ||
294 | |||
295 | # This stuff is for subjectAltName and issuerAltname. | ||
296 | # Import the email address. | ||
297 | # subjectAltName=email:copy | ||
298 | # An alternative to produce certificates that aren't | ||
299 | # deprecated according to PKIX. | ||
300 | # subjectAltName=email:move | ||
301 | |||
302 | # Copy subject details | ||
303 | # issuerAltName=issuer:copy | ||
304 | |||
305 | #nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem | ||
306 | #nsBaseUrl | ||
307 | #nsRevocationUrl | ||
308 | #nsRenewalUrl | ||
309 | #nsCaPolicyUrl | ||
310 | #nsSslServerName | ||
311 | |||
312 | # This really needs to be in place for it to be a proxy certificate. | ||
313 | proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo | ||
diff --git a/src/lib/libssl/src/apps/openssl.c b/src/lib/libssl/src/apps/openssl.c index e0d89d4ab4..65a9ee8a66 100644 --- a/src/lib/libssl/src/apps/openssl.c +++ b/src/lib/libssl/src/apps/openssl.c | |||
@@ -129,6 +129,7 @@ | |||
129 | #include "progs.h" | 129 | #include "progs.h" |
130 | #include "s_apps.h" | 130 | #include "s_apps.h" |
131 | #include <openssl/err.h> | 131 | #include <openssl/err.h> |
132 | #include <openssl/fips.h> | ||
132 | 133 | ||
133 | /* The LHASH callbacks ("hash" & "cmp") have been replaced by functions with the | 134 | /* The LHASH callbacks ("hash" & "cmp") have been replaced by functions with the |
134 | * base prototypes (we cast each variable inside the function to the required | 135 | * base prototypes (we cast each variable inside the function to the required |
@@ -147,6 +148,7 @@ char *default_config_file=NULL; | |||
147 | #ifdef MONOLITH | 148 | #ifdef MONOLITH |
148 | CONF *config=NULL; | 149 | CONF *config=NULL; |
149 | BIO *bio_err=NULL; | 150 | BIO *bio_err=NULL; |
151 | int in_FIPS_mode=0; | ||
150 | #endif | 152 | #endif |
151 | 153 | ||
152 | 154 | ||
@@ -227,10 +229,31 @@ int main(int Argc, char *Argv[]) | |||
227 | char **argv,*p; | 229 | char **argv,*p; |
228 | LHASH *prog=NULL; | 230 | LHASH *prog=NULL; |
229 | long errline; | 231 | long errline; |
230 | 232 | ||
231 | arg.data=NULL; | 233 | arg.data=NULL; |
232 | arg.count=0; | 234 | arg.count=0; |
233 | 235 | ||
236 | in_FIPS_mode = 0; | ||
237 | |||
238 | #ifdef OPENSSL_FIPS | ||
239 | if(getenv("OPENSSL_FIPS")) { | ||
240 | #if defined(_WIN32) | ||
241 | char filename[MAX_PATH] = ""; | ||
242 | GetModuleFileNameA( NULL, filename, MAX_PATH) ; | ||
243 | p = filename; | ||
244 | #else | ||
245 | p = Argv[0]; | ||
246 | #endif | ||
247 | if (!FIPS_mode_set(1,p)) { | ||
248 | ERR_load_crypto_strings(); | ||
249 | ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE)); | ||
250 | EXIT(1); | ||
251 | } | ||
252 | in_FIPS_mode = 1; | ||
253 | if (getenv("OPENSSL_FIPS_MD5")) | ||
254 | FIPS_allow_md5(1); | ||
255 | } | ||
256 | #endif | ||
234 | if (bio_err == NULL) | 257 | if (bio_err == NULL) |
235 | if ((bio_err=BIO_new(BIO_s_file())) != NULL) | 258 | if ((bio_err=BIO_new(BIO_s_file())) != NULL) |
236 | BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); | 259 | BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); |
diff --git a/src/lib/libssl/src/apps/openssl.cnf b/src/lib/libssl/src/apps/openssl.cnf index 854d1f164e..4c1d595b0a 100644 --- a/src/lib/libssl/src/apps/openssl.cnf +++ b/src/lib/libssl/src/apps/openssl.cnf | |||
@@ -44,8 +44,8 @@ new_certs_dir = $dir/newcerts # default place for new certs. | |||
44 | 44 | ||
45 | certificate = $dir/cacert.pem # The CA certificate | 45 | certificate = $dir/cacert.pem # The CA certificate |
46 | serial = $dir/serial # The current serial number | 46 | serial = $dir/serial # The current serial number |
47 | #crlnumber = $dir/crlnumber # the current crl number | 47 | #crlnumber = $dir/crlnumber # the current crl number must be |
48 | # must be commented out to leave a V1 CRL | 48 | # commented out to leave a V1 CRL |
49 | crl = $dir/crl.pem # The current CRL | 49 | crl = $dir/crl.pem # The current CRL |
50 | private_key = $dir/private/cakey.pem# The private key | 50 | private_key = $dir/private/cakey.pem# The private key |
51 | RANDFILE = $dir/private/.rand # private random number file | 51 | RANDFILE = $dir/private/.rand # private random number file |
@@ -258,3 +258,56 @@ basicConstraints = CA:true | |||
258 | 258 | ||
259 | # issuerAltName=issuer:copy | 259 | # issuerAltName=issuer:copy |
260 | authorityKeyIdentifier=keyid:always,issuer:always | 260 | authorityKeyIdentifier=keyid:always,issuer:always |
261 | |||
262 | [ proxy_cert_ext ] | ||
263 | # These extensions should be added when creating a proxy certificate | ||
264 | |||
265 | # This goes against PKIX guidelines but some CAs do it and some software | ||
266 | # requires this to avoid interpreting an end user certificate as a CA. | ||
267 | |||
268 | basicConstraints=CA:FALSE | ||
269 | |||
270 | # Here are some examples of the usage of nsCertType. If it is omitted | ||
271 | # the certificate can be used for anything *except* object signing. | ||
272 | |||
273 | # This is OK for an SSL server. | ||
274 | # nsCertType = server | ||
275 | |||
276 | # For an object signing certificate this would be used. | ||
277 | # nsCertType = objsign | ||
278 | |||
279 | # For normal client use this is typical | ||
280 | # nsCertType = client, email | ||
281 | |||
282 | # and for everything including object signing: | ||
283 | # nsCertType = client, email, objsign | ||
284 | |||
285 | # This is typical in keyUsage for a client certificate. | ||
286 | # keyUsage = nonRepudiation, digitalSignature, keyEncipherment | ||
287 | |||
288 | # This will be displayed in Netscape's comment listbox. | ||
289 | nsComment = "OpenSSL Generated Certificate" | ||
290 | |||
291 | # PKIX recommendations harmless if included in all certificates. | ||
292 | subjectKeyIdentifier=hash | ||
293 | authorityKeyIdentifier=keyid,issuer:always | ||
294 | |||
295 | # This stuff is for subjectAltName and issuerAltname. | ||
296 | # Import the email address. | ||
297 | # subjectAltName=email:copy | ||
298 | # An alternative to produce certificates that aren't | ||
299 | # deprecated according to PKIX. | ||
300 | # subjectAltName=email:move | ||
301 | |||
302 | # Copy subject details | ||
303 | # issuerAltName=issuer:copy | ||
304 | |||
305 | #nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem | ||
306 | #nsBaseUrl | ||
307 | #nsRevocationUrl | ||
308 | #nsRenewalUrl | ||
309 | #nsCaPolicyUrl | ||
310 | #nsSslServerName | ||
311 | |||
312 | # This really needs to be in place for it to be a proxy certificate. | ||
313 | proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo | ||
diff --git a/src/lib/libssl/src/apps/pkcs12.c b/src/lib/libssl/src/apps/pkcs12.c index 71192bdf74..c961e6b57b 100644 --- a/src/lib/libssl/src/apps/pkcs12.c +++ b/src/lib/libssl/src/apps/pkcs12.c | |||
@@ -109,7 +109,7 @@ int MAIN(int argc, char **argv) | |||
109 | int maciter = PKCS12_DEFAULT_ITER; | 109 | int maciter = PKCS12_DEFAULT_ITER; |
110 | int twopass = 0; | 110 | int twopass = 0; |
111 | int keytype = 0; | 111 | int keytype = 0; |
112 | int cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC; | 112 | int cert_pbe; |
113 | int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | 113 | int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; |
114 | int ret = 1; | 114 | int ret = 1; |
115 | int macver = 1; | 115 | int macver = 1; |
@@ -126,6 +126,13 @@ int MAIN(int argc, char **argv) | |||
126 | 126 | ||
127 | apps_startup(); | 127 | apps_startup(); |
128 | 128 | ||
129 | #ifdef OPENSSL_FIPS | ||
130 | if (FIPS_mode()) | ||
131 | cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | ||
132 | else | ||
133 | #endif | ||
134 | cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC; | ||
135 | |||
129 | enc = EVP_des_ede3_cbc(); | 136 | enc = EVP_des_ede3_cbc(); |
130 | if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); | 137 | if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); |
131 | 138 | ||
@@ -666,7 +673,7 @@ int MAIN(int argc, char **argv) | |||
666 | CRYPTO_push_info("verify MAC"); | 673 | CRYPTO_push_info("verify MAC"); |
667 | #endif | 674 | #endif |
668 | /* If we enter empty password try no password first */ | 675 | /* If we enter empty password try no password first */ |
669 | if(!macpass[0] && PKCS12_verify_mac(p12, NULL, 0)) { | 676 | if(!mpass[0] && PKCS12_verify_mac(p12, NULL, 0)) { |
670 | /* If mac and crypto pass the same set it to NULL too */ | 677 | /* If mac and crypto pass the same set it to NULL too */ |
671 | if(!twopass) cpass = NULL; | 678 | if(!twopass) cpass = NULL; |
672 | } else if (!PKCS12_verify_mac(p12, mpass, -1)) { | 679 | } else if (!PKCS12_verify_mac(p12, mpass, -1)) { |
@@ -710,9 +717,10 @@ int MAIN(int argc, char **argv) | |||
710 | int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass, | 717 | int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass, |
711 | int passlen, int options, char *pempass) | 718 | int passlen, int options, char *pempass) |
712 | { | 719 | { |
713 | STACK_OF(PKCS7) *asafes; | 720 | STACK_OF(PKCS7) *asafes = NULL; |
714 | STACK_OF(PKCS12_SAFEBAG) *bags; | 721 | STACK_OF(PKCS12_SAFEBAG) *bags; |
715 | int i, bagnid; | 722 | int i, bagnid; |
723 | int ret = 0; | ||
716 | PKCS7 *p7; | 724 | PKCS7 *p7; |
717 | 725 | ||
718 | if (!( asafes = PKCS12_unpack_authsafes(p12))) return 0; | 726 | if (!( asafes = PKCS12_unpack_authsafes(p12))) return 0; |
@@ -730,16 +738,22 @@ int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass, | |||
730 | } | 738 | } |
731 | bags = PKCS12_unpack_p7encdata(p7, pass, passlen); | 739 | bags = PKCS12_unpack_p7encdata(p7, pass, passlen); |
732 | } else continue; | 740 | } else continue; |
733 | if (!bags) return 0; | 741 | if (!bags) goto err; |
734 | if (!dump_certs_pkeys_bags (out, bags, pass, passlen, | 742 | if (!dump_certs_pkeys_bags (out, bags, pass, passlen, |
735 | options, pempass)) { | 743 | options, pempass)) { |
736 | sk_PKCS12_SAFEBAG_pop_free (bags, PKCS12_SAFEBAG_free); | 744 | sk_PKCS12_SAFEBAG_pop_free (bags, PKCS12_SAFEBAG_free); |
737 | return 0; | 745 | goto err; |
738 | } | 746 | } |
739 | sk_PKCS12_SAFEBAG_pop_free (bags, PKCS12_SAFEBAG_free); | 747 | sk_PKCS12_SAFEBAG_pop_free (bags, PKCS12_SAFEBAG_free); |
748 | bags = NULL; | ||
740 | } | 749 | } |
741 | sk_PKCS7_pop_free (asafes, PKCS7_free); | 750 | ret = 1; |
742 | return 1; | 751 | |
752 | err: | ||
753 | |||
754 | if (asafes) | ||
755 | sk_PKCS7_pop_free (asafes, PKCS7_free); | ||
756 | return ret; | ||
743 | } | 757 | } |
744 | 758 | ||
745 | int dump_certs_pkeys_bags (BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, | 759 | int dump_certs_pkeys_bags (BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, |
diff --git a/src/lib/libssl/src/apps/pkcs8.c b/src/lib/libssl/src/apps/pkcs8.c index ee8cf02813..d5085444e2 100644 --- a/src/lib/libssl/src/apps/pkcs8.c +++ b/src/lib/libssl/src/apps/pkcs8.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* pkcs8.c */ | 1 | /* pkcs8.c */ |
2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999-2004. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
@@ -68,7 +68,7 @@ | |||
68 | int MAIN(int, char **); | 68 | int MAIN(int, char **); |
69 | 69 | ||
70 | int MAIN(int argc, char **argv) | 70 | int MAIN(int argc, char **argv) |
71 | { | 71 | { |
72 | ENGINE *e = NULL; | 72 | ENGINE *e = NULL; |
73 | char **args, *infile = NULL, *outfile = NULL; | 73 | char **args, *infile = NULL, *outfile = NULL; |
74 | char *passargin = NULL, *passargout = NULL; | 74 | char *passargin = NULL, *passargout = NULL; |
@@ -100,43 +100,70 @@ int MAIN(int argc, char **argv) | |||
100 | ERR_load_crypto_strings(); | 100 | ERR_load_crypto_strings(); |
101 | OpenSSL_add_all_algorithms(); | 101 | OpenSSL_add_all_algorithms(); |
102 | args = argv + 1; | 102 | args = argv + 1; |
103 | while (!badarg && *args && *args[0] == '-') { | 103 | while (!badarg && *args && *args[0] == '-') |
104 | if (!strcmp(*args,"-v2")) { | 104 | { |
105 | if (args[1]) { | 105 | if (!strcmp(*args,"-v2")) |
106 | { | ||
107 | if (args[1]) | ||
108 | { | ||
106 | args++; | 109 | args++; |
107 | cipher=EVP_get_cipherbyname(*args); | 110 | cipher=EVP_get_cipherbyname(*args); |
108 | if(!cipher) { | 111 | if (!cipher) |
112 | { | ||
109 | BIO_printf(bio_err, | 113 | BIO_printf(bio_err, |
110 | "Unknown cipher %s\n", *args); | 114 | "Unknown cipher %s\n", *args); |
111 | badarg = 1; | 115 | badarg = 1; |
116 | } | ||
112 | } | 117 | } |
113 | } else badarg = 1; | 118 | else |
114 | } else if (!strcmp(*args,"-v1")) { | 119 | badarg = 1; |
115 | if (args[1]) { | 120 | } |
121 | else if (!strcmp(*args,"-v1")) | ||
122 | { | ||
123 | if (args[1]) | ||
124 | { | ||
116 | args++; | 125 | args++; |
117 | pbe_nid=OBJ_txt2nid(*args); | 126 | pbe_nid=OBJ_txt2nid(*args); |
118 | if(pbe_nid == NID_undef) { | 127 | if (pbe_nid == NID_undef) |
128 | { | ||
119 | BIO_printf(bio_err, | 129 | BIO_printf(bio_err, |
120 | "Unknown PBE algorithm %s\n", *args); | 130 | "Unknown PBE algorithm %s\n", *args); |
121 | badarg = 1; | 131 | badarg = 1; |
132 | } | ||
122 | } | 133 | } |
123 | } else badarg = 1; | 134 | else |
124 | } else if (!strcmp(*args,"-inform")) { | 135 | badarg = 1; |
125 | if (args[1]) { | 136 | } |
137 | else if (!strcmp(*args,"-inform")) | ||
138 | { | ||
139 | if (args[1]) | ||
140 | { | ||
126 | args++; | 141 | args++; |
127 | informat=str2fmt(*args); | 142 | informat=str2fmt(*args); |
128 | } else badarg = 1; | 143 | } |
129 | } else if (!strcmp(*args,"-outform")) { | 144 | else badarg = 1; |
130 | if (args[1]) { | 145 | } |
146 | else if (!strcmp(*args,"-outform")) | ||
147 | { | ||
148 | if (args[1]) | ||
149 | { | ||
131 | args++; | 150 | args++; |
132 | outformat=str2fmt(*args); | 151 | outformat=str2fmt(*args); |
133 | } else badarg = 1; | 152 | } |
134 | } else if (!strcmp (*args, "-topk8")) topk8 = 1; | 153 | else badarg = 1; |
135 | else if (!strcmp (*args, "-noiter")) iter = 1; | 154 | } |
136 | else if (!strcmp (*args, "-nocrypt")) nocrypt = 1; | 155 | else if (!strcmp (*args, "-topk8")) |
137 | else if (!strcmp (*args, "-nooct")) p8_broken = PKCS8_NO_OCTET; | 156 | topk8 = 1; |
138 | else if (!strcmp (*args, "-nsdb")) p8_broken = PKCS8_NS_DB; | 157 | else if (!strcmp (*args, "-noiter")) |
139 | else if (!strcmp (*args, "-embed")) p8_broken = PKCS8_EMBEDDED_PARAM; | 158 | iter = 1; |
159 | else if (!strcmp (*args, "-nocrypt")) | ||
160 | nocrypt = 1; | ||
161 | else if (!strcmp (*args, "-nooct")) | ||
162 | p8_broken = PKCS8_NO_OCTET; | ||
163 | else if (!strcmp (*args, "-nsdb")) | ||
164 | p8_broken = PKCS8_NS_DB; | ||
165 | else if (!strcmp (*args, "-embed")) | ||
166 | p8_broken = PKCS8_EMBEDDED_PARAM; | ||
140 | else if (!strcmp(*args,"-passin")) | 167 | else if (!strcmp(*args,"-passin")) |
141 | { | 168 | { |
142 | if (!args[1]) goto bad; | 169 | if (!args[1]) goto bad; |
@@ -154,21 +181,30 @@ int MAIN(int argc, char **argv) | |||
154 | engine= *(++args); | 181 | engine= *(++args); |
155 | } | 182 | } |
156 | #endif | 183 | #endif |
157 | else if (!strcmp (*args, "-in")) { | 184 | else if (!strcmp (*args, "-in")) |
158 | if (args[1]) { | 185 | { |
186 | if (args[1]) | ||
187 | { | ||
159 | args++; | 188 | args++; |
160 | infile = *args; | 189 | infile = *args; |
161 | } else badarg = 1; | 190 | } |
162 | } else if (!strcmp (*args, "-out")) { | 191 | else badarg = 1; |
163 | if (args[1]) { | 192 | } |
193 | else if (!strcmp (*args, "-out")) | ||
194 | { | ||
195 | if (args[1]) | ||
196 | { | ||
164 | args++; | 197 | args++; |
165 | outfile = *args; | 198 | outfile = *args; |
166 | } else badarg = 1; | 199 | } |
167 | } else badarg = 1; | 200 | else badarg = 1; |
201 | } | ||
202 | else badarg = 1; | ||
168 | args++; | 203 | args++; |
169 | } | 204 | } |
170 | 205 | ||
171 | if (badarg) { | 206 | if (badarg) |
207 | { | ||
172 | bad: | 208 | bad: |
173 | BIO_printf(bio_err, "Usage pkcs8 [options]\n"); | 209 | BIO_printf(bio_err, "Usage pkcs8 [options]\n"); |
174 | BIO_printf(bio_err, "where options are\n"); | 210 | BIO_printf(bio_err, "where options are\n"); |
@@ -189,147 +225,199 @@ int MAIN(int argc, char **argv) | |||
189 | #ifndef OPENSSL_NO_ENGINE | 225 | #ifndef OPENSSL_NO_ENGINE |
190 | BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); | 226 | BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); |
191 | #endif | 227 | #endif |
192 | return (1); | 228 | return 1; |
193 | } | 229 | } |
194 | 230 | ||
195 | #ifndef OPENSSL_NO_ENGINE | 231 | #ifndef OPENSSL_NO_ENGINE |
196 | e = setup_engine(bio_err, engine, 0); | 232 | e = setup_engine(bio_err, engine, 0); |
197 | #endif | 233 | #endif |
198 | 234 | ||
199 | if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { | 235 | if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) |
236 | { | ||
200 | BIO_printf(bio_err, "Error getting passwords\n"); | 237 | BIO_printf(bio_err, "Error getting passwords\n"); |
201 | return (1); | 238 | return 1; |
202 | } | 239 | } |
203 | 240 | ||
204 | if ((pbe_nid == -1) && !cipher) pbe_nid = NID_pbeWithMD5AndDES_CBC; | 241 | if ((pbe_nid == -1) && !cipher) |
242 | pbe_nid = NID_pbeWithMD5AndDES_CBC; | ||
205 | 243 | ||
206 | if (infile) { | 244 | if (infile) |
207 | if (!(in = BIO_new_file(infile, "rb"))) { | 245 | { |
246 | if (!(in = BIO_new_file(infile, "rb"))) | ||
247 | { | ||
208 | BIO_printf(bio_err, | 248 | BIO_printf(bio_err, |
209 | "Can't open input file %s\n", infile); | 249 | "Can't open input file %s\n", infile); |
210 | return (1); | 250 | return (1); |
251 | } | ||
211 | } | 252 | } |
212 | } else in = BIO_new_fp (stdin, BIO_NOCLOSE); | 253 | else |
254 | in = BIO_new_fp (stdin, BIO_NOCLOSE); | ||
213 | 255 | ||
214 | if (outfile) { | 256 | if (outfile) |
215 | if (!(out = BIO_new_file (outfile, "wb"))) { | 257 | { |
258 | if (!(out = BIO_new_file (outfile, "wb"))) | ||
259 | { | ||
216 | BIO_printf(bio_err, | 260 | BIO_printf(bio_err, |
217 | "Can't open output file %s\n", outfile); | 261 | "Can't open output file %s\n", outfile); |
218 | return (1); | 262 | return (1); |
263 | } | ||
219 | } | 264 | } |
220 | } else { | 265 | else |
266 | { | ||
221 | out = BIO_new_fp (stdout, BIO_NOCLOSE); | 267 | out = BIO_new_fp (stdout, BIO_NOCLOSE); |
222 | #ifdef OPENSSL_SYS_VMS | 268 | #ifdef OPENSSL_SYS_VMS |
223 | { | 269 | { |
224 | BIO *tmpbio = BIO_new(BIO_f_linebuffer()); | 270 | BIO *tmpbio = BIO_new(BIO_f_linebuffer()); |
225 | out = BIO_push(tmpbio, out); | 271 | out = BIO_push(tmpbio, out); |
226 | } | 272 | } |
227 | #endif | 273 | #endif |
228 | } | 274 | } |
229 | if (topk8) | 275 | if (topk8) |
230 | { | 276 | { |
231 | BIO_free(in); /* Not needed in this section */ | 277 | BIO_free(in); /* Not needed in this section */ |
232 | pkey = load_key(bio_err, infile, informat, 1, | 278 | pkey = load_key(bio_err, infile, informat, 1, |
233 | passin, e, "key"); | 279 | passin, e, "key"); |
234 | if (!pkey) { | 280 | if (!pkey) |
235 | return (1); | 281 | { |
236 | } | 282 | BIO_free_all(out); |
237 | if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) { | 283 | return 1; |
284 | } | ||
285 | if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) | ||
286 | { | ||
238 | BIO_printf(bio_err, "Error converting key\n"); | 287 | BIO_printf(bio_err, "Error converting key\n"); |
239 | ERR_print_errors(bio_err); | 288 | ERR_print_errors(bio_err); |
240 | return (1); | 289 | EVP_PKEY_free(pkey); |
241 | } | 290 | BIO_free_all(out); |
242 | if(nocrypt) { | 291 | return 1; |
243 | if(outformat == FORMAT_PEM) | 292 | } |
293 | if (nocrypt) | ||
294 | { | ||
295 | if (outformat == FORMAT_PEM) | ||
244 | PEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8inf); | 296 | PEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8inf); |
245 | else if(outformat == FORMAT_ASN1) | 297 | else if (outformat == FORMAT_ASN1) |
246 | i2d_PKCS8_PRIV_KEY_INFO_bio(out, p8inf); | 298 | i2d_PKCS8_PRIV_KEY_INFO_bio(out, p8inf); |
247 | else { | 299 | else |
300 | { | ||
248 | BIO_printf(bio_err, "Bad format specified for key\n"); | 301 | BIO_printf(bio_err, "Bad format specified for key\n"); |
302 | PKCS8_PRIV_KEY_INFO_free(p8inf); | ||
303 | EVP_PKEY_free(pkey); | ||
304 | BIO_free_all(out); | ||
249 | return (1); | 305 | return (1); |
306 | } | ||
250 | } | 307 | } |
251 | } else { | 308 | else |
252 | if(passout) p8pass = passout; | 309 | { |
253 | else { | 310 | if (passout) |
311 | p8pass = passout; | ||
312 | else | ||
313 | { | ||
254 | p8pass = pass; | 314 | p8pass = pass; |
255 | if (EVP_read_pw_string(pass, sizeof pass, "Enter Encryption Password:", 1)) | 315 | if (EVP_read_pw_string(pass, sizeof pass, "Enter Encryption Password:", 1)) |
316 | { | ||
317 | PKCS8_PRIV_KEY_INFO_free(p8inf); | ||
318 | EVP_PKEY_free(pkey); | ||
319 | BIO_free_all(out); | ||
256 | return (1); | 320 | return (1); |
257 | } | 321 | } |
322 | } | ||
258 | app_RAND_load_file(NULL, bio_err, 0); | 323 | app_RAND_load_file(NULL, bio_err, 0); |
259 | if (!(p8 = PKCS8_encrypt(pbe_nid, cipher, | 324 | if (!(p8 = PKCS8_encrypt(pbe_nid, cipher, |
260 | p8pass, strlen(p8pass), | 325 | p8pass, strlen(p8pass), |
261 | NULL, 0, iter, p8inf))) { | 326 | NULL, 0, iter, p8inf))) |
327 | { | ||
262 | BIO_printf(bio_err, "Error encrypting key\n"); | 328 | BIO_printf(bio_err, "Error encrypting key\n"); |
263 | ERR_print_errors(bio_err); | 329 | ERR_print_errors(bio_err); |
330 | PKCS8_PRIV_KEY_INFO_free(p8inf); | ||
331 | EVP_PKEY_free(pkey); | ||
332 | BIO_free_all(out); | ||
264 | return (1); | 333 | return (1); |
265 | } | 334 | } |
266 | app_RAND_write_file(NULL, bio_err); | 335 | app_RAND_write_file(NULL, bio_err); |
267 | if(outformat == FORMAT_PEM) | 336 | if (outformat == FORMAT_PEM) |
268 | PEM_write_bio_PKCS8(out, p8); | 337 | PEM_write_bio_PKCS8(out, p8); |
269 | else if(outformat == FORMAT_ASN1) | 338 | else if (outformat == FORMAT_ASN1) |
270 | i2d_PKCS8_bio(out, p8); | 339 | i2d_PKCS8_bio(out, p8); |
271 | else { | 340 | else |
341 | { | ||
272 | BIO_printf(bio_err, "Bad format specified for key\n"); | 342 | BIO_printf(bio_err, "Bad format specified for key\n"); |
343 | PKCS8_PRIV_KEY_INFO_free(p8inf); | ||
344 | EVP_PKEY_free(pkey); | ||
345 | BIO_free_all(out); | ||
273 | return (1); | 346 | return (1); |
274 | } | 347 | } |
275 | X509_SIG_free(p8); | 348 | X509_SIG_free(p8); |
276 | } | 349 | } |
350 | |||
277 | PKCS8_PRIV_KEY_INFO_free (p8inf); | 351 | PKCS8_PRIV_KEY_INFO_free (p8inf); |
278 | EVP_PKEY_free(pkey); | 352 | EVP_PKEY_free(pkey); |
279 | BIO_free_all(out); | 353 | BIO_free_all(out); |
280 | if(passin) OPENSSL_free(passin); | 354 | if (passin) |
281 | if(passout) OPENSSL_free(passout); | 355 | OPENSSL_free(passin); |
356 | if (passout) | ||
357 | OPENSSL_free(passout); | ||
282 | return (0); | 358 | return (0); |
283 | } | 359 | } |
284 | 360 | ||
285 | if(nocrypt) { | 361 | if (nocrypt) |
286 | if(informat == FORMAT_PEM) | 362 | { |
363 | if (informat == FORMAT_PEM) | ||
287 | p8inf = PEM_read_bio_PKCS8_PRIV_KEY_INFO(in,NULL,NULL, NULL); | 364 | p8inf = PEM_read_bio_PKCS8_PRIV_KEY_INFO(in,NULL,NULL, NULL); |
288 | else if(informat == FORMAT_ASN1) | 365 | else if (informat == FORMAT_ASN1) |
289 | p8inf = d2i_PKCS8_PRIV_KEY_INFO_bio(in, NULL); | 366 | p8inf = d2i_PKCS8_PRIV_KEY_INFO_bio(in, NULL); |
290 | else { | 367 | else |
368 | { | ||
291 | BIO_printf(bio_err, "Bad format specified for key\n"); | 369 | BIO_printf(bio_err, "Bad format specified for key\n"); |
292 | return (1); | 370 | return (1); |
371 | } | ||
293 | } | 372 | } |
294 | } else { | 373 | else |
295 | if(informat == FORMAT_PEM) | 374 | { |
375 | if (informat == FORMAT_PEM) | ||
296 | p8 = PEM_read_bio_PKCS8(in, NULL, NULL, NULL); | 376 | p8 = PEM_read_bio_PKCS8(in, NULL, NULL, NULL); |
297 | else if(informat == FORMAT_ASN1) | 377 | else if (informat == FORMAT_ASN1) |
298 | p8 = d2i_PKCS8_bio(in, NULL); | 378 | p8 = d2i_PKCS8_bio(in, NULL); |
299 | else { | 379 | else |
380 | { | ||
300 | BIO_printf(bio_err, "Bad format specified for key\n"); | 381 | BIO_printf(bio_err, "Bad format specified for key\n"); |
301 | return (1); | 382 | return (1); |
302 | } | 383 | } |
303 | 384 | ||
304 | if (!p8) { | 385 | if (!p8) |
386 | { | ||
305 | BIO_printf (bio_err, "Error reading key\n"); | 387 | BIO_printf (bio_err, "Error reading key\n"); |
306 | ERR_print_errors(bio_err); | 388 | ERR_print_errors(bio_err); |
307 | return (1); | 389 | return (1); |
308 | } | 390 | } |
309 | if(passin) p8pass = passin; | 391 | if (passin) |
310 | else { | 392 | p8pass = passin; |
393 | else | ||
394 | { | ||
311 | p8pass = pass; | 395 | p8pass = pass; |
312 | EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0); | 396 | EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0); |
313 | } | 397 | } |
314 | p8inf = PKCS8_decrypt(p8, p8pass, strlen(p8pass)); | 398 | p8inf = PKCS8_decrypt(p8, p8pass, strlen(p8pass)); |
315 | X509_SIG_free(p8); | 399 | X509_SIG_free(p8); |
316 | } | 400 | } |
317 | 401 | ||
318 | if (!p8inf) { | 402 | if (!p8inf) |
403 | { | ||
319 | BIO_printf(bio_err, "Error decrypting key\n"); | 404 | BIO_printf(bio_err, "Error decrypting key\n"); |
320 | ERR_print_errors(bio_err); | 405 | ERR_print_errors(bio_err); |
321 | return (1); | 406 | return (1); |
322 | } | 407 | } |
323 | 408 | ||
324 | if (!(pkey = EVP_PKCS82PKEY(p8inf))) { | 409 | if (!(pkey = EVP_PKCS82PKEY(p8inf))) |
410 | { | ||
325 | BIO_printf(bio_err, "Error converting key\n"); | 411 | BIO_printf(bio_err, "Error converting key\n"); |
326 | ERR_print_errors(bio_err); | 412 | ERR_print_errors(bio_err); |
327 | return (1); | 413 | return (1); |
328 | } | 414 | } |
329 | 415 | ||
330 | if (p8inf->broken) { | 416 | if (p8inf->broken) |
417 | { | ||
331 | BIO_printf(bio_err, "Warning: broken key encoding: "); | 418 | BIO_printf(bio_err, "Warning: broken key encoding: "); |
332 | switch (p8inf->broken) { | 419 | switch (p8inf->broken) |
420 | { | ||
333 | case PKCS8_NO_OCTET: | 421 | case PKCS8_NO_OCTET: |
334 | BIO_printf(bio_err, "No Octet String in PrivateKey\n"); | 422 | BIO_printf(bio_err, "No Octet String in PrivateKey\n"); |
335 | break; | 423 | break; |
@@ -349,21 +437,24 @@ int MAIN(int argc, char **argv) | |||
349 | } | 437 | } |
350 | 438 | ||
351 | PKCS8_PRIV_KEY_INFO_free(p8inf); | 439 | PKCS8_PRIV_KEY_INFO_free(p8inf); |
352 | if(outformat == FORMAT_PEM) | 440 | if (outformat == FORMAT_PEM) |
353 | PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout); | 441 | PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout); |
354 | else if(outformat == FORMAT_ASN1) | 442 | else if (outformat == FORMAT_ASN1) |
355 | i2d_PrivateKey_bio(out, pkey); | 443 | i2d_PrivateKey_bio(out, pkey); |
356 | else { | 444 | else |
445 | { | ||
357 | BIO_printf(bio_err, "Bad format specified for key\n"); | 446 | BIO_printf(bio_err, "Bad format specified for key\n"); |
358 | return (1); | 447 | return (1); |
359 | } | 448 | } |
360 | 449 | ||
361 | end: | 450 | end: |
362 | EVP_PKEY_free(pkey); | 451 | EVP_PKEY_free(pkey); |
363 | BIO_free_all(out); | 452 | BIO_free_all(out); |
364 | BIO_free(in); | 453 | BIO_free(in); |
365 | if(passin) OPENSSL_free(passin); | 454 | if (passin) |
366 | if(passout) OPENSSL_free(passout); | 455 | OPENSSL_free(passin); |
456 | if (passout) | ||
457 | OPENSSL_free(passout); | ||
367 | 458 | ||
368 | return (0); | 459 | return (0); |
369 | } | 460 | } |
diff --git a/src/lib/libssl/src/apps/progs.h b/src/lib/libssl/src/apps/progs.h index 70e4dbac07..0493257bde 100644 --- a/src/lib/libssl/src/apps/progs.h +++ b/src/lib/libssl/src/apps/progs.h | |||
@@ -35,6 +35,7 @@ extern int pkcs8_main(int argc,char *argv[]); | |||
35 | extern int spkac_main(int argc,char *argv[]); | 35 | extern int spkac_main(int argc,char *argv[]); |
36 | extern int smime_main(int argc,char *argv[]); | 36 | extern int smime_main(int argc,char *argv[]); |
37 | extern int rand_main(int argc,char *argv[]); | 37 | extern int rand_main(int argc,char *argv[]); |
38 | extern int prime_main(int argc,char *argv[]); | ||
38 | #ifndef OPENSSL_NO_ENGINE | 39 | #ifndef OPENSSL_NO_ENGINE |
39 | extern int engine_main(int argc,char *argv[]); | 40 | extern int engine_main(int argc,char *argv[]); |
40 | #endif | 41 | #endif |
@@ -115,6 +116,7 @@ FUNCTION functions[] = { | |||
115 | {FUNC_TYPE_GENERAL,"spkac",spkac_main}, | 116 | {FUNC_TYPE_GENERAL,"spkac",spkac_main}, |
116 | {FUNC_TYPE_GENERAL,"smime",smime_main}, | 117 | {FUNC_TYPE_GENERAL,"smime",smime_main}, |
117 | {FUNC_TYPE_GENERAL,"rand",rand_main}, | 118 | {FUNC_TYPE_GENERAL,"rand",rand_main}, |
119 | {FUNC_TYPE_GENERAL,"prime",prime_main}, | ||
118 | #ifndef OPENSSL_NO_ENGINE | 120 | #ifndef OPENSSL_NO_ENGINE |
119 | {FUNC_TYPE_GENERAL,"engine",engine_main}, | 121 | {FUNC_TYPE_GENERAL,"engine",engine_main}, |
120 | #endif | 122 | #endif |
diff --git a/src/lib/libssl/src/apps/req.c b/src/lib/libssl/src/apps/req.c index 1a3d1d0dfa..eebe71b15e 100644 --- a/src/lib/libssl/src/apps/req.c +++ b/src/lib/libssl/src/apps/req.c | |||
@@ -175,7 +175,7 @@ int MAIN(int argc, char **argv) | |||
175 | char *passin = NULL, *passout = NULL; | 175 | char *passin = NULL, *passout = NULL; |
176 | char *p; | 176 | char *p; |
177 | char *subj = NULL; | 177 | char *subj = NULL; |
178 | const EVP_MD *md_alg=NULL,*digest=EVP_md5(); | 178 | const EVP_MD *md_alg=NULL,*digest; |
179 | unsigned long chtype = MBSTRING_ASC; | 179 | unsigned long chtype = MBSTRING_ASC; |
180 | #ifndef MONOLITH | 180 | #ifndef MONOLITH |
181 | char *to_free; | 181 | char *to_free; |
@@ -197,6 +197,13 @@ int MAIN(int argc, char **argv) | |||
197 | informat=FORMAT_PEM; | 197 | informat=FORMAT_PEM; |
198 | outformat=FORMAT_PEM; | 198 | outformat=FORMAT_PEM; |
199 | 199 | ||
200 | #ifdef OPENSSL_FIPS | ||
201 | if (FIPS_mode()) | ||
202 | digest = EVP_sha1(); | ||
203 | else | ||
204 | #endif | ||
205 | digest = EVP_md5(); | ||
206 | |||
200 | prog=argv[0]; | 207 | prog=argv[0]; |
201 | argc--; | 208 | argc--; |
202 | argv++; | 209 | argv++; |
@@ -499,13 +506,16 @@ bad: | |||
499 | else | 506 | else |
500 | { | 507 | { |
501 | req_conf=config; | 508 | req_conf=config; |
502 | if( verbose ) | 509 | |
503 | BIO_printf(bio_err,"Using configuration from %s\n", | ||
504 | default_config_file); | ||
505 | if (req_conf == NULL) | 510 | if (req_conf == NULL) |
506 | { | 511 | { |
507 | BIO_printf(bio_err,"Unable to load config info\n"); | 512 | BIO_printf(bio_err,"Unable to load config info from %s\n", default_config_file); |
513 | if (newreq) | ||
514 | goto end; | ||
508 | } | 515 | } |
516 | else if( verbose ) | ||
517 | BIO_printf(bio_err,"Using configuration from %s\n", | ||
518 | default_config_file); | ||
509 | } | 519 | } |
510 | 520 | ||
511 | if (req_conf != NULL) | 521 | if (req_conf != NULL) |
@@ -831,7 +841,9 @@ loop: | |||
831 | } | 841 | } |
832 | else | 842 | else |
833 | { | 843 | { |
834 | if (!ASN1_INTEGER_set(X509_get_serialNumber(x509ss),0L)) goto end; | 844 | if (!rand_serial(NULL, |
845 | X509_get_serialNumber(x509ss))) | ||
846 | goto end; | ||
835 | } | 847 | } |
836 | 848 | ||
837 | if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto end; | 849 | if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto end; |
diff --git a/src/lib/libssl/src/apps/s_client.c b/src/lib/libssl/src/apps/s_client.c index ae7c9f9ede..a70735b9dc 100644 --- a/src/lib/libssl/src/apps/s_client.c +++ b/src/lib/libssl/src/apps/s_client.c | |||
@@ -201,6 +201,9 @@ static void sc_usage(void) | |||
201 | BIO_printf(bio_err," -pause - sleep(1) after each read(2) and write(2) system call\n"); | 201 | BIO_printf(bio_err," -pause - sleep(1) after each read(2) and write(2) system call\n"); |
202 | BIO_printf(bio_err," -showcerts - show all certificates in the chain\n"); | 202 | BIO_printf(bio_err," -showcerts - show all certificates in the chain\n"); |
203 | BIO_printf(bio_err," -debug - extra output\n"); | 203 | BIO_printf(bio_err," -debug - extra output\n"); |
204 | #ifdef WATT32 | ||
205 | BIO_printf(bio_err," -wdebug - WATT-32 tcp debugging\n"); | ||
206 | #endif | ||
204 | BIO_printf(bio_err," -msg - Show protocol messages\n"); | 207 | BIO_printf(bio_err," -msg - Show protocol messages\n"); |
205 | BIO_printf(bio_err," -nbio_test - more ssl protocol testing\n"); | 208 | BIO_printf(bio_err," -nbio_test - more ssl protocol testing\n"); |
206 | BIO_printf(bio_err," -state - print the 'ssl' states\n"); | 209 | BIO_printf(bio_err," -state - print the 'ssl' states\n"); |
@@ -352,6 +355,10 @@ int MAIN(int argc, char **argv) | |||
352 | c_Pause=1; | 355 | c_Pause=1; |
353 | else if (strcmp(*argv,"-debug") == 0) | 356 | else if (strcmp(*argv,"-debug") == 0) |
354 | c_debug=1; | 357 | c_debug=1; |
358 | #ifdef WATT32 | ||
359 | else if (strcmp(*argv,"-wdebug") == 0) | ||
360 | dbug_init(); | ||
361 | #endif | ||
355 | else if (strcmp(*argv,"-msg") == 0) | 362 | else if (strcmp(*argv,"-msg") == 0) |
356 | c_msg=1; | 363 | c_msg=1; |
357 | else if (strcmp(*argv,"-showcerts") == 0) | 364 | else if (strcmp(*argv,"-showcerts") == 0) |
@@ -594,6 +601,8 @@ re_start: | |||
594 | if (starttls_proto == 1) | 601 | if (starttls_proto == 1) |
595 | { | 602 | { |
596 | BIO_read(sbio,mbuf,BUFSIZZ); | 603 | BIO_read(sbio,mbuf,BUFSIZZ); |
604 | BIO_printf(sbio,"EHLO some.host.name\r\n"); | ||
605 | BIO_read(sbio,mbuf,BUFSIZZ); | ||
597 | BIO_printf(sbio,"STARTTLS\r\n"); | 606 | BIO_printf(sbio,"STARTTLS\r\n"); |
598 | BIO_read(sbio,sbuf,BUFSIZZ); | 607 | BIO_read(sbio,sbuf,BUFSIZZ); |
599 | } | 608 | } |
diff --git a/src/lib/libssl/src/apps/s_socket.c b/src/lib/libssl/src/apps/s_socket.c index 9f92bcb3ae..2cb5fce192 100644 --- a/src/lib/libssl/src/apps/s_socket.c +++ b/src/lib/libssl/src/apps/s_socket.c | |||
@@ -151,7 +151,6 @@ static int ssl_sock_init(void) | |||
151 | #ifdef WATT32 | 151 | #ifdef WATT32 |
152 | extern int _watt_do_exit; | 152 | extern int _watt_do_exit; |
153 | _watt_do_exit = 0; | 153 | _watt_do_exit = 0; |
154 | dbug_init(); | ||
155 | if (sock_init()) | 154 | if (sock_init()) |
156 | return (0); | 155 | return (0); |
157 | #elif defined(OPENSSL_SYS_WINDOWS) | 156 | #elif defined(OPENSSL_SYS_WINDOWS) |
diff --git a/src/lib/libssl/src/apps/speed.c b/src/lib/libssl/src/apps/speed.c index 2412200009..5ed510ced6 100644 --- a/src/lib/libssl/src/apps/speed.c +++ b/src/lib/libssl/src/apps/speed.c | |||
@@ -1395,6 +1395,7 @@ int MAIN(int argc, char **argv) | |||
1395 | EVP_DecryptInit_ex(&ctx,evp_cipher,NULL,key16,iv); | 1395 | EVP_DecryptInit_ex(&ctx,evp_cipher,NULL,key16,iv); |
1396 | else | 1396 | else |
1397 | EVP_EncryptInit_ex(&ctx,evp_cipher,NULL,key16,iv); | 1397 | EVP_EncryptInit_ex(&ctx,evp_cipher,NULL,key16,iv); |
1398 | EVP_CIPHER_CTX_set_padding(&ctx, 0); | ||
1398 | 1399 | ||
1399 | Time_F(START); | 1400 | Time_F(START); |
1400 | if(decrypt) | 1401 | if(decrypt) |
diff --git a/src/lib/libssl/src/apps/verify.c b/src/lib/libssl/src/apps/verify.c index 6a93c018b8..d73280cdd0 100644 --- a/src/lib/libssl/src/apps/verify.c +++ b/src/lib/libssl/src/apps/verify.c | |||
@@ -354,6 +354,7 @@ static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx) | |||
354 | if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1; | 354 | if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1; |
355 | /* Continue after extension errors too */ | 355 | /* Continue after extension errors too */ |
356 | if (ctx->error == X509_V_ERR_INVALID_CA) ok=1; | 356 | if (ctx->error == X509_V_ERR_INVALID_CA) ok=1; |
357 | if (ctx->error == X509_V_ERR_INVALID_NON_CA) ok=1; | ||
357 | if (ctx->error == X509_V_ERR_PATH_LENGTH_EXCEEDED) ok=1; | 358 | if (ctx->error == X509_V_ERR_PATH_LENGTH_EXCEEDED) ok=1; |
358 | if (ctx->error == X509_V_ERR_INVALID_PURPOSE) ok=1; | 359 | if (ctx->error == X509_V_ERR_INVALID_PURPOSE) ok=1; |
359 | if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1; | 360 | if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1; |
diff --git a/src/lib/libssl/src/apps/x509.c b/src/lib/libssl/src/apps/x509.c index 9b95f7bd3f..e7115cac67 100644 --- a/src/lib/libssl/src/apps/x509.c +++ b/src/lib/libssl/src/apps/x509.c | |||
@@ -168,7 +168,7 @@ int MAIN(int argc, char **argv) | |||
168 | char *CAkeyfile=NULL,*CAserial=NULL; | 168 | char *CAkeyfile=NULL,*CAserial=NULL; |
169 | char *alias=NULL; | 169 | char *alias=NULL; |
170 | int text=0,serial=0,hash=0,subject=0,issuer=0,startdate=0,enddate=0; | 170 | int text=0,serial=0,hash=0,subject=0,issuer=0,startdate=0,enddate=0; |
171 | int ocspid=0; | 171 | int next_serial=0,ocspid=0; |
172 | int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; | 172 | int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; |
173 | int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; | 173 | int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; |
174 | int C=0; | 174 | int C=0; |
@@ -179,7 +179,7 @@ int MAIN(int argc, char **argv) | |||
179 | X509_REQ *rq=NULL; | 179 | X509_REQ *rq=NULL; |
180 | int fingerprint=0; | 180 | int fingerprint=0; |
181 | char buf[256]; | 181 | char buf[256]; |
182 | const EVP_MD *md_alg,*digest=EVP_md5(); | 182 | const EVP_MD *md_alg,*digest; |
183 | CONF *extconf = NULL; | 183 | CONF *extconf = NULL; |
184 | char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; | 184 | char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; |
185 | int need_rand = 0; | 185 | int need_rand = 0; |
@@ -216,6 +216,13 @@ int MAIN(int argc, char **argv) | |||
216 | if (ctx == NULL) goto end; | 216 | if (ctx == NULL) goto end; |
217 | X509_STORE_set_verify_cb_func(ctx,callb); | 217 | X509_STORE_set_verify_cb_func(ctx,callb); |
218 | 218 | ||
219 | #ifdef OPENSSL_FIPS | ||
220 | if (FIPS_mode()) | ||
221 | digest = EVP_sha1(); | ||
222 | else | ||
223 | #endif | ||
224 | digest = EVP_md5(); | ||
225 | |||
219 | argc--; | 226 | argc--; |
220 | argv++; | 227 | argv++; |
221 | num=0; | 228 | num=0; |
@@ -371,6 +378,8 @@ int MAIN(int argc, char **argv) | |||
371 | email= ++num; | 378 | email= ++num; |
372 | else if (strcmp(*argv,"-serial") == 0) | 379 | else if (strcmp(*argv,"-serial") == 0) |
373 | serial= ++num; | 380 | serial= ++num; |
381 | else if (strcmp(*argv,"-next_serial") == 0) | ||
382 | next_serial= ++num; | ||
374 | else if (strcmp(*argv,"-modulus") == 0) | 383 | else if (strcmp(*argv,"-modulus") == 0) |
375 | modulus= ++num; | 384 | modulus= ++num; |
376 | else if (strcmp(*argv,"-pubkey") == 0) | 385 | else if (strcmp(*argv,"-pubkey") == 0) |
@@ -591,12 +600,19 @@ bad: | |||
591 | if ((x=X509_new()) == NULL) goto end; | 600 | if ((x=X509_new()) == NULL) goto end; |
592 | ci=x->cert_info; | 601 | ci=x->cert_info; |
593 | 602 | ||
594 | if (sno) | 603 | if (sno == NULL) |
595 | { | 604 | { |
596 | if (!X509_set_serialNumber(x, sno)) | 605 | sno = ASN1_INTEGER_new(); |
606 | if (!sno || !rand_serial(NULL, sno)) | ||
607 | goto end; | ||
608 | if (!X509_set_serialNumber(x, sno)) | ||
597 | goto end; | 609 | goto end; |
610 | ASN1_INTEGER_free(sno); | ||
611 | sno = NULL; | ||
598 | } | 612 | } |
599 | else if (!ASN1_INTEGER_set(X509_get_serialNumber(x),0)) goto end; | 613 | else if (!X509_set_serialNumber(x, sno)) |
614 | goto end; | ||
615 | |||
600 | if (!X509_set_issuer_name(x,req->req_info->subject)) goto end; | 616 | if (!X509_set_issuer_name(x,req->req_info->subject)) goto end; |
601 | if (!X509_set_subject_name(x,req->req_info->subject)) goto end; | 617 | if (!X509_set_subject_name(x,req->req_info->subject)) goto end; |
602 | 618 | ||
@@ -617,7 +633,7 @@ bad: | |||
617 | if (xca == NULL) goto end; | 633 | if (xca == NULL) goto end; |
618 | } | 634 | } |
619 | 635 | ||
620 | if (!noout || text) | 636 | if (!noout || text || next_serial) |
621 | { | 637 | { |
622 | OBJ_create("2.99999.3", | 638 | OBJ_create("2.99999.3", |
623 | "SET.ex3","SET x509v3 extension 3"); | 639 | "SET.ex3","SET x509v3 extension 3"); |
@@ -691,6 +707,24 @@ bad: | |||
691 | i2a_ASN1_INTEGER(STDout,x->cert_info->serialNumber); | 707 | i2a_ASN1_INTEGER(STDout,x->cert_info->serialNumber); |
692 | BIO_printf(STDout,"\n"); | 708 | BIO_printf(STDout,"\n"); |
693 | } | 709 | } |
710 | else if (next_serial == i) | ||
711 | { | ||
712 | BIGNUM *bnser; | ||
713 | ASN1_INTEGER *ser; | ||
714 | ser = X509_get_serialNumber(x); | ||
715 | bnser = ASN1_INTEGER_to_BN(ser, NULL); | ||
716 | if (!bnser) | ||
717 | goto end; | ||
718 | if (!BN_add_word(bnser, 1)) | ||
719 | goto end; | ||
720 | ser = BN_to_ASN1_INTEGER(bnser, NULL); | ||
721 | if (!ser) | ||
722 | goto end; | ||
723 | BN_free(bnser); | ||
724 | i2a_ASN1_INTEGER(out, ser); | ||
725 | ASN1_INTEGER_free(ser); | ||
726 | BIO_puts(out, "\n"); | ||
727 | } | ||
694 | else if (email == i) | 728 | else if (email == i) |
695 | { | 729 | { |
696 | int j; | 730 | int j; |
@@ -947,9 +981,9 @@ bad: | |||
947 | 981 | ||
948 | if (checkend) | 982 | if (checkend) |
949 | { | 983 | { |
950 | time_t tnow=time(NULL); | 984 | time_t tcheck=time(NULL) + checkoffset; |
951 | 985 | ||
952 | if (ASN1_UTCTIME_cmp_time_t(X509_get_notAfter(x), tnow+checkoffset) == -1) | 986 | if (X509_cmp_time(X509_get_notAfter(x), &tcheck) < 0) |
953 | { | 987 | { |
954 | BIO_printf(out,"Certificate will expire\n"); | 988 | BIO_printf(out,"Certificate will expire\n"); |
955 | ret=1; | 989 | ret=1; |
@@ -1047,13 +1081,6 @@ static ASN1_INTEGER *x509_load_serial(char *CAfile, char *serialfile, int create | |||
1047 | } | 1081 | } |
1048 | else | 1082 | else |
1049 | BUF_strlcpy(buf,serialfile,len); | 1083 | BUF_strlcpy(buf,serialfile,len); |
1050 | serial=BN_new(); | ||
1051 | bs=ASN1_INTEGER_new(); | ||
1052 | if ((serial == NULL) || (bs == NULL)) | ||
1053 | { | ||
1054 | ERR_print_errors(bio_err); | ||
1055 | goto end; | ||
1056 | } | ||
1057 | 1084 | ||
1058 | serial = load_serial(buf, create, NULL); | 1085 | serial = load_serial(buf, create, NULL); |
1059 | if (serial == NULL) goto end; | 1086 | if (serial == NULL) goto end; |
diff --git a/src/lib/libssl/src/config b/src/lib/libssl/src/config index 25a3703c1f..0715d378d9 100644 --- a/src/lib/libssl/src/config +++ b/src/lib/libssl/src/config | |||
@@ -23,6 +23,7 @@ | |||
23 | PREFIX="" | 23 | PREFIX="" |
24 | SUFFIX="" | 24 | SUFFIX="" |
25 | TEST="false" | 25 | TEST="false" |
26 | EXE="" | ||
26 | 27 | ||
27 | # pick up any command line args to config | 28 | # pick up any command line args to config |
28 | for i | 29 | for i |
@@ -110,16 +111,16 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in | |||
110 | echo "m68k-apple-aux3"; exit 0 | 111 | echo "m68k-apple-aux3"; exit 0 |
111 | ;; | 112 | ;; |
112 | 113 | ||
113 | AIX:[3456789]:4:*) | 114 | AIX:[3-9]:4:*) |
114 | echo "${MACHINE}-ibm-aix43"; exit 0 | 115 | echo "${MACHINE}-ibm-aix"; exit 0 |
115 | ;; | 116 | ;; |
116 | 117 | ||
117 | AIX:*:[56789]:*) | 118 | AIX:*:[5-9]:*) |
118 | echo "${MACHINE}-ibm-aix43"; exit 0 | 119 | echo "${MACHINE}-ibm-aix"; exit 0 |
119 | ;; | 120 | ;; |
120 | 121 | ||
121 | AIX:*) | 122 | AIX:*) |
122 | echo "${MACHINE}-ibm-aix"; exit 0 | 123 | echo "${MACHINE}-ibm-aix3"; exit 0 |
123 | ;; | 124 | ;; |
124 | 125 | ||
125 | dgux:*) | 126 | dgux:*) |
@@ -288,6 +289,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in | |||
288 | echo "${MACHINE}-whatever-sysv4"; exit 0 | 289 | echo "${MACHINE}-whatever-sysv4"; exit 0 |
289 | ;; | 290 | ;; |
290 | 291 | ||
292 | VOS:*:*:i786) | ||
293 | echo "i386-stratus-vos"; exit 0 | ||
294 | ;; | ||
295 | |||
296 | VOS:*:*:*) | ||
297 | echo "hppa1.1-stratus-vos"; exit 0 | ||
298 | ;; | ||
299 | |||
291 | *:4*:R4*:m88k) | 300 | *:4*:R4*:m88k) |
292 | echo "${MACHINE}-whatever-sysv4"; exit 0 | 301 | echo "${MACHINE}-whatever-sysv4"; exit 0 |
293 | ;; | 302 | ;; |
@@ -328,6 +337,9 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in | |||
328 | echo "mips-sony-newsos4"; exit 0; | 337 | echo "mips-sony-newsos4"; exit 0; |
329 | ;; | 338 | ;; |
330 | 339 | ||
340 | MINGW*) | ||
341 | echo "${MACHINE}-whatever-mingw"; echo 0; | ||
342 | ;; | ||
331 | CYGWIN*) | 343 | CYGWIN*) |
332 | case "$RELEASE" in | 344 | case "$RELEASE" in |
333 | [bB]*|1.0|1.[12].*) | 345 | [bB]*|1.0|1.[12].*) |
@@ -433,7 +445,7 @@ if [ "$SYSTEM" = "SunOS" ]; then | |||
433 | egrep -e '^cc: .* C [0-9]\.[0-9]' | \ | 445 | egrep -e '^cc: .* C [0-9]\.[0-9]' | \ |
434 | sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'` | 446 | sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'` |
435 | CCVER=${CCVER:-0} | 447 | CCVER=${CCVER:-0} |
436 | if [ $CCVER -gt 40 ]; then | 448 | if [ $MACHINE != i86pc -a $CCVER -gt 40 ]; then |
437 | CC=cc # overrides gcc!!! | 449 | CC=cc # overrides gcc!!! |
438 | if [ $CCVER -eq 50 ]; then | 450 | if [ $CCVER -eq 50 ]; then |
439 | echo "WARNING! Detected WorkShop C 5.0. Do make sure you have" | 451 | echo "WARNING! Detected WorkShop C 5.0. Do make sure you have" |
@@ -482,29 +494,29 @@ case "$GUESSOS" in | |||
482 | OUT="irix-$CC" | 494 | OUT="irix-$CC" |
483 | ;; | 495 | ;; |
484 | mips3-sgi-irix) | 496 | mips3-sgi-irix) |
485 | CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` | 497 | #CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` |
486 | CPU=${CPU:-0} | 498 | #CPU=${CPU:-0} |
487 | if [ $CPU -ge 5000 ]; then | 499 | #if [ $CPU -ge 5000 ]; then |
488 | options="$options -mips4" | 500 | # options="$options -mips4" |
489 | else | 501 | #else |
490 | options="$options -mips3" | 502 | # options="$options -mips3" |
491 | fi | 503 | #fi |
492 | OUT="irix-mips3-$CC" | 504 | OUT="irix-mips3-$CC" |
493 | ;; | 505 | ;; |
494 | mips4-sgi-irix64) | 506 | mips4-sgi-irix64) |
495 | echo "WARNING! If you wish to build 64-bit library, then you have to" | 507 | echo "WARNING! If you wish to build 64-bit library, then you have to" |
496 | echo " invoke './Configure irix64-mips4-$CC' *manually*." | 508 | echo " invoke './Configure irix64-mips4-$CC' *manually*." |
497 | if [ "$TEST" = "false" ]; then | 509 | if [ "$TEST" = "false" -a -t 1 ]; then |
498 | echo " You have about 5 seconds to press Ctrl-C to abort." | 510 | echo " You have about 5 seconds to press Ctrl-C to abort." |
499 | (stty -icanon min 0 time 50; read waste) < /dev/tty | 511 | (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 |
500 | fi | 512 | fi |
501 | CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` | 513 | #CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'` |
502 | CPU=${CPU:-0} | 514 | #CPU=${CPU:-0} |
503 | if [ $CPU -ge 5000 ]; then | 515 | #if [ $CPU -ge 5000 ]; then |
504 | options="$options -mips4" | 516 | # options="$options -mips4" |
505 | else | 517 | #else |
506 | options="$options -mips3" | 518 | # options="$options -mips3" |
507 | fi | 519 | #fi |
508 | OUT="irix-mips3-$CC" | 520 | OUT="irix-mips3-$CC" |
509 | ;; | 521 | ;; |
510 | alpha-*-linux2) | 522 | alpha-*-linux2) |
@@ -538,9 +550,14 @@ EOF | |||
538 | rm dummy dummy.c | 550 | rm dummy dummy.c |
539 | ;; | 551 | ;; |
540 | ppc64-*-linux2) | 552 | ppc64-*-linux2) |
541 | #Use the standard target for PPC architecture until we create a | 553 | echo "WARNING! If you wish to build 64-bit library, then you have to" |
542 | #special one for the 64bit architecture. | 554 | echo " invoke './Configure linux-ppc64' *manually*." |
543 | OUT="linux-ppc" ;; | 555 | if [ "$TEST" = "false" -a -t 1 ]; then |
556 | echo " You have about 5 seconds to press Ctrl-C to abort." | ||
557 | (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 | ||
558 | fi | ||
559 | OUT="linux-ppc" | ||
560 | ;; | ||
544 | ppc-*-linux2) OUT="linux-ppc" ;; | 561 | ppc-*-linux2) OUT="linux-ppc" ;; |
545 | m68k-*-linux*) OUT="linux-m68k" ;; | 562 | m68k-*-linux*) OUT="linux-m68k" ;; |
546 | ia64-*-linux?) OUT="linux-ia64" ;; | 563 | ia64-*-linux?) OUT="linux-ia64" ;; |
@@ -551,9 +568,9 @@ EOF | |||
551 | echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI" | 568 | echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI" |
552 | echo " and wish to build 64-bit library, then you have to" | 569 | echo " and wish to build 64-bit library, then you have to" |
553 | echo " invoke './Configure linux64-sparcv9' *manually*." | 570 | echo " invoke './Configure linux64-sparcv9' *manually*." |
554 | if [ "$TEST" = "false" ]; then | 571 | if [ "$TEST" = "false" -a -t 1 ]; then |
555 | echo " You have about 5 seconds to press Ctrl-C to abort." | 572 | echo " You have about 5 seconds to press Ctrl-C to abort." |
556 | (stty -icanon min 0 time 50; read waste) < /dev/tty | 573 | (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 |
557 | fi | 574 | fi |
558 | OUT="linux-sparcv9" ;; | 575 | OUT="linux-sparcv9" ;; |
559 | sparc-*-linux2) | 576 | sparc-*-linux2) |
@@ -584,7 +601,9 @@ EOF | |||
584 | 601 | ||
585 | options="$options -mschedule=$CPUSCHEDULE -march=$CPUARCH" | 602 | options="$options -mschedule=$CPUSCHEDULE -march=$CPUARCH" |
586 | OUT="linux-parisc" ;; | 603 | OUT="linux-parisc" ;; |
587 | arm*-*-linux2) OUT="linux-elf-arm" ;; | 604 | arm*b-*-linux2) OUT="linux-elf-arm"; options="$options -DB_ENDIAN" ;; |
605 | arm*l-*-linux2) OUT="linux-elf-arm"; options="$options -DL_ENDIAN" ;; | ||
606 | arm*-*-linux2) OUT="linux-elf-arm" ;; | ||
588 | s390-*-linux2) OUT="linux-s390" ;; | 607 | s390-*-linux2) OUT="linux-s390" ;; |
589 | s390x-*-linux?) OUT="linux-s390x" ;; | 608 | s390x-*-linux?) OUT="linux-s390x" ;; |
590 | x86_64-*-linux?) OUT="linux-x86_64" ;; | 609 | x86_64-*-linux?) OUT="linux-x86_64" ;; |
@@ -608,9 +627,9 @@ EOF | |||
608 | if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then | 627 | if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then |
609 | echo "WARNING! If you wish to build 64-bit library, then you have to" | 628 | echo "WARNING! If you wish to build 64-bit library, then you have to" |
610 | echo " invoke './Configure solaris64-sparcv9-cc' *manually*." | 629 | echo " invoke './Configure solaris64-sparcv9-cc' *manually*." |
611 | if [ "$TEST" = "false" ]; then | 630 | if [ "$TEST" = "false" -a -t 1 ]; then |
612 | echo " You have about 5 seconds to press Ctrl-C to abort." | 631 | echo " You have about 5 seconds to press Ctrl-C to abort." |
613 | (stty -icanon min 0 time 50; read waste) < /dev/tty | 632 | (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 |
614 | fi | 633 | fi |
615 | elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then | 634 | elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then |
616 | # $GCC_ARCH denotes default ABI chosen by compiler driver | 635 | # $GCC_ARCH denotes default ABI chosen by compiler driver |
@@ -620,17 +639,17 @@ EOF | |||
620 | OUT="solaris64-sparcv9-gcc" | 639 | OUT="solaris64-sparcv9-gcc" |
621 | echo "WARNING! If you wish to build 32-bit library, then you have to" | 640 | echo "WARNING! If you wish to build 32-bit library, then you have to" |
622 | echo " invoke './Configure solaris-sparcv9-gcc' *manually*." | 641 | echo " invoke './Configure solaris-sparcv9-gcc' *manually*." |
623 | if [ "$TEST" = "false" ]; then | 642 | if [ "$TEST" = "false" -a -t 1 ]; then |
624 | echo " You have about 5 seconds to press Ctrl-C to abort." | 643 | echo " You have about 5 seconds to press Ctrl-C to abort." |
625 | (stty -icanon min 0 time 50; read waste) < /dev/tty | 644 | (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 |
626 | fi | 645 | fi |
627 | elif [ "$GCC_ARCH" = "-m32" ]; then | 646 | elif [ "$GCC_ARCH" = "-m32" ]; then |
628 | echo "NOTICE! If you *know* that your GNU C supports 64-bit/V9 ABI" | 647 | echo "NOTICE! If you *know* that your GNU C supports 64-bit/V9 ABI" |
629 | echo " and wish to build 64-bit library, then you have to" | 648 | echo " and wish to build 64-bit library, then you have to" |
630 | echo " invoke './Configure solaris64-sparcv9-gcc' *manually*." | 649 | echo " invoke './Configure solaris64-sparcv9-gcc' *manually*." |
631 | if [ "$TEST" = "false" ]; then | 650 | if [ "$TEST" = "false" -a -t 1 ]; then |
632 | echo " You have about 5 seconds to press Ctrl-C to abort." | 651 | echo " You have about 5 seconds to press Ctrl-C to abort." |
633 | (stty -icanon min 0 time 50; read waste) < /dev/tty | 652 | (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 |
634 | fi | 653 | fi |
635 | fi | 654 | fi |
636 | fi | 655 | fi |
@@ -638,7 +657,14 @@ EOF | |||
638 | sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;; | 657 | sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;; |
639 | sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;; | 658 | sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;; |
640 | sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;; | 659 | sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;; |
641 | *86*-*-solaris2) OUT="solaris-x86-$CC" ;; | 660 | *86*-*-solaris2) |
661 | ISA64=`(isalist) 2>/dev/null | grep amd64` | ||
662 | if [ "$ISA64" != "" ]; then | ||
663 | OUT="solaris64-x86_64-$CC" | ||
664 | else | ||
665 | OUT="solaris-x86-$CC" | ||
666 | fi | ||
667 | ;; | ||
642 | *-*-sunos4) OUT="sunos-$CC" ;; | 668 | *-*-sunos4) OUT="sunos-$CC" ;; |
643 | alpha*-*-freebsd*) OUT="FreeBSD-alpha" ;; | 669 | alpha*-*-freebsd*) OUT="FreeBSD-alpha" ;; |
644 | sparc64-*-freebsd*) OUT="FreeBSD-sparc64" ;; | 670 | sparc64-*-freebsd*) OUT="FreeBSD-sparc64" ;; |
@@ -679,6 +705,10 @@ EOF | |||
679 | *-*-UnixWare21*) OUT="unixware-2.1" ;; | 705 | *-*-UnixWare21*) OUT="unixware-2.1" ;; |
680 | *-*-Unixware20*) OUT="unixware-2.0" ;; | 706 | *-*-Unixware20*) OUT="unixware-2.0" ;; |
681 | *-*-Unixware21*) OUT="unixware-2.1" ;; | 707 | *-*-Unixware21*) OUT="unixware-2.1" ;; |
708 | *-*-vos) | ||
709 | options="$options no-threads no-shared no-asm no-dso" | ||
710 | EXE=".pm" | ||
711 | OUT="vos-$CC" ;; | ||
682 | BS2000-siemens-sysv4) OUT="BS2000-OSD" ;; | 712 | BS2000-siemens-sysv4) OUT="BS2000-OSD" ;; |
683 | RM*-siemens-sysv4) OUT="ReliantUNIX" ;; | 713 | RM*-siemens-sysv4) OUT="ReliantUNIX" ;; |
684 | *-siemens-sysv4) OUT="SINIX" ;; | 714 | *-siemens-sysv4) OUT="SINIX" ;; |
@@ -702,9 +732,9 @@ EOF | |||
702 | echo "WARNING! 64-bit ABI is the default configured ABI on HP-UXi." | 732 | echo "WARNING! 64-bit ABI is the default configured ABI on HP-UXi." |
703 | echo " If you wish to build 32-bit library, the you have to" | 733 | echo " If you wish to build 32-bit library, the you have to" |
704 | echo " invoke './Configure hpux-ia64-cc' *manually*." | 734 | echo " invoke './Configure hpux-ia64-cc' *manually*." |
705 | if [ "$TEST" = "false" ]; then | 735 | if [ "$TEST" = "false" -a -t 1 ]; then |
706 | echo " You have about 5 seconds to press Ctrl-C to abort." | 736 | echo " You have about 5 seconds to press Ctrl-C to abort." |
707 | (stty -icanon min 0 time 50; read waste) < /dev/tty | 737 | (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 |
708 | fi | 738 | fi |
709 | OUT="hpux64-ia64-cc" | 739 | OUT="hpux64-ia64-cc" |
710 | elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU | 740 | elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU |
@@ -714,9 +744,9 @@ EOF | |||
714 | if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then | 744 | if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then |
715 | echo "WARNING! If you wish to build 64-bit library then you have to" | 745 | echo "WARNING! If you wish to build 64-bit library then you have to" |
716 | echo " invoke './Configure hpux64-parisc2-cc' *manually*." | 746 | echo " invoke './Configure hpux64-parisc2-cc' *manually*." |
717 | if [ "$TEST" = "false" ]; then | 747 | if [ "$TEST" = "false" -a -t 1 ]; then |
718 | echo " You have about 5 seconds to press Ctrl-C to abort." | 748 | echo " You have about 5 seconds to press Ctrl-C to abort." |
719 | (stty -icanon min 0 time 50; read waste) < /dev/tty | 749 | (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 |
720 | fi | 750 | fi |
721 | fi | 751 | fi |
722 | elif [ $CPU_VERSION -ge 528 ]; then # PA-RISC 1.1+ CPU | 752 | elif [ $CPU_VERSION -ge 528 ]; then # PA-RISC 1.1+ CPU |
@@ -728,8 +758,28 @@ EOF | |||
728 | fi | 758 | fi |
729 | options="$options -D_REENTRANT" ;; | 759 | options="$options -D_REENTRANT" ;; |
730 | *-hpux) OUT="hpux-parisc-$CC" ;; | 760 | *-hpux) OUT="hpux-parisc-$CC" ;; |
761 | *-aix) | ||
762 | KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null` | ||
763 | KERNEL_BITS=${KERNEL_BITS:-32} | ||
764 | OBJECT_MODE=${OBJECT_MODE:-32} | ||
765 | if [ "$CC" = "gcc" ]; then | ||
766 | OUT="aix-gcc" | ||
767 | elif [ $OBJECT_MODE -eq 64 ]; then | ||
768 | echo 'Your $OBJECT_MODE was found to be set to 64' | ||
769 | OUT="aix64-cc" | ||
770 | else | ||
771 | OUT="aix-cc" | ||
772 | if [ $KERNEL_BITS -eq 64 ]; then | ||
773 | echo "WARNING! If you wish to build 64-bit kit, then you have to" | ||
774 | echo " invoke './Configure aix64-cc' *manually*." | ||
775 | if [ "$TEST" = "false" -a -t 1 ]; then | ||
776 | echo " You have ~5 seconds to press Ctrl-C to abort." | ||
777 | (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 | ||
778 | fi | ||
779 | fi | ||
780 | fi | ||
781 | ;; | ||
731 | # these are all covered by the catchall below | 782 | # these are all covered by the catchall below |
732 | # *-aix) OUT="aix-$CC" ;; | ||
733 | # *-dgux) OUT="dgux" ;; | 783 | # *-dgux) OUT="dgux" ;; |
734 | mips-sony-newsos4) OUT="newsos4-gcc" ;; | 784 | mips-sony-newsos4) OUT="newsos4-gcc" ;; |
735 | *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;; | 785 | *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;; |
@@ -806,8 +856,8 @@ fi | |||
806 | 856 | ||
807 | if [ ".$PERL" = . ] ; then | 857 | if [ ".$PERL" = . ] ; then |
808 | for i in . `echo $PATH | sed 's/:/ /g'`; do | 858 | for i in . `echo $PATH | sed 's/:/ /g'`; do |
809 | if [ -f "$i/perl5" ] ; then | 859 | if [ -f "$i/perl5$EXE" ] ; then |
810 | PERL="$i/perl5" | 860 | PERL="$i/perl5$EXE" |
811 | break; | 861 | break; |
812 | fi; | 862 | fi; |
813 | done | 863 | done |
@@ -815,9 +865,9 @@ fi | |||
815 | 865 | ||
816 | if [ ".$PERL" = . ] ; then | 866 | if [ ".$PERL" = . ] ; then |
817 | for i in . `echo $PATH | sed 's/:/ /g'`; do | 867 | for i in . `echo $PATH | sed 's/:/ /g'`; do |
818 | if [ -f "$i/perl" ] ; then | 868 | if [ -f "$i/perl$EXE" ] ; then |
819 | if "$i/perl" -e 'exit($]<5.0)'; then | 869 | if "$i/perl$EXE" -e 'exit($]<5.0)'; then |
820 | PERL="$i/perl" | 870 | PERL="$i/perl$EXE" |
821 | break; | 871 | break; |
822 | fi; | 872 | fi; |
823 | fi; | 873 | fi; |
diff --git a/src/lib/libssl/src/crypto/aes/aes.h b/src/lib/libssl/src/crypto/aes/aes.h index da067f4a8f..8a3ea0b883 100644 --- a/src/lib/libssl/src/crypto/aes/aes.h +++ b/src/lib/libssl/src/crypto/aes/aes.h | |||
@@ -52,6 +52,8 @@ | |||
52 | #ifndef HEADER_AES_H | 52 | #ifndef HEADER_AES_H |
53 | #define HEADER_AES_H | 53 | #define HEADER_AES_H |
54 | 54 | ||
55 | #include <openssl/e_os2.h> | ||
56 | |||
55 | #ifdef OPENSSL_NO_AES | 57 | #ifdef OPENSSL_NO_AES |
56 | #error AES is disabled. | 58 | #error AES is disabled. |
57 | #endif | 59 | #endif |
@@ -64,6 +66,10 @@ | |||
64 | #define AES_MAXNR 14 | 66 | #define AES_MAXNR 14 |
65 | #define AES_BLOCK_SIZE 16 | 67 | #define AES_BLOCK_SIZE 16 |
66 | 68 | ||
69 | #if defined(OPENSSL_FIPS) | ||
70 | #define FIPS_AES_SIZE_T int | ||
71 | #endif | ||
72 | |||
67 | #ifdef __cplusplus | 73 | #ifdef __cplusplus |
68 | extern "C" { | 74 | extern "C" { |
69 | #endif | 75 | #endif |
@@ -95,6 +101,15 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | |||
95 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, | 101 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, |
96 | const unsigned long length, const AES_KEY *key, | 102 | const unsigned long length, const AES_KEY *key, |
97 | unsigned char *ivec, int *num, const int enc); | 103 | unsigned char *ivec, int *num, const int enc); |
104 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, | ||
105 | const unsigned long length, const AES_KEY *key, | ||
106 | unsigned char *ivec, int *num, const int enc); | ||
107 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, | ||
108 | const unsigned long length, const AES_KEY *key, | ||
109 | unsigned char *ivec, int *num, const int enc); | ||
110 | void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out, | ||
111 | const int nbits,const AES_KEY *key, | ||
112 | unsigned char *ivec,const int enc); | ||
98 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, | 113 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, |
99 | const unsigned long length, const AES_KEY *key, | 114 | const unsigned long length, const AES_KEY *key, |
100 | unsigned char *ivec, int *num); | 115 | unsigned char *ivec, int *num); |
diff --git a/src/lib/libssl/src/crypto/aes/aes_cbc.c b/src/lib/libssl/src/crypto/aes/aes_cbc.c index 1222a21002..d2ba6bcdb4 100644 --- a/src/lib/libssl/src/crypto/aes/aes_cbc.c +++ b/src/lib/libssl/src/crypto/aes/aes_cbc.c | |||
@@ -66,6 +66,7 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | |||
66 | unsigned long n; | 66 | unsigned long n; |
67 | unsigned long len = length; | 67 | unsigned long len = length; |
68 | unsigned char tmp[AES_BLOCK_SIZE]; | 68 | unsigned char tmp[AES_BLOCK_SIZE]; |
69 | const unsigned char *iv = ivec; | ||
69 | 70 | ||
70 | assert(in && out && key && ivec); | 71 | assert(in && out && key && ivec); |
71 | assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc)); | 72 | assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc)); |
@@ -73,22 +74,39 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | |||
73 | if (AES_ENCRYPT == enc) { | 74 | if (AES_ENCRYPT == enc) { |
74 | while (len >= AES_BLOCK_SIZE) { | 75 | while (len >= AES_BLOCK_SIZE) { |
75 | for(n=0; n < AES_BLOCK_SIZE; ++n) | 76 | for(n=0; n < AES_BLOCK_SIZE; ++n) |
76 | tmp[n] = in[n] ^ ivec[n]; | 77 | out[n] = in[n] ^ iv[n]; |
77 | AES_encrypt(tmp, out, key); | 78 | AES_encrypt(out, out, key); |
78 | memcpy(ivec, out, AES_BLOCK_SIZE); | 79 | iv = out; |
79 | len -= AES_BLOCK_SIZE; | 80 | len -= AES_BLOCK_SIZE; |
80 | in += AES_BLOCK_SIZE; | 81 | in += AES_BLOCK_SIZE; |
81 | out += AES_BLOCK_SIZE; | 82 | out += AES_BLOCK_SIZE; |
82 | } | 83 | } |
83 | if (len) { | 84 | if (len) { |
84 | for(n=0; n < len; ++n) | 85 | for(n=0; n < len; ++n) |
85 | tmp[n] = in[n] ^ ivec[n]; | 86 | out[n] = in[n] ^ iv[n]; |
86 | for(n=len; n < AES_BLOCK_SIZE; ++n) | 87 | for(n=len; n < AES_BLOCK_SIZE; ++n) |
87 | tmp[n] = ivec[n]; | 88 | out[n] = iv[n]; |
88 | AES_encrypt(tmp, tmp, key); | 89 | AES_encrypt(out, out, key); |
89 | memcpy(out, tmp, AES_BLOCK_SIZE); | 90 | iv = out; |
90 | memcpy(ivec, tmp, AES_BLOCK_SIZE); | 91 | } |
91 | } | 92 | memcpy(ivec,iv,AES_BLOCK_SIZE); |
93 | } else if (in != out) { | ||
94 | while (len >= AES_BLOCK_SIZE) { | ||
95 | AES_decrypt(in, out, key); | ||
96 | for(n=0; n < AES_BLOCK_SIZE; ++n) | ||
97 | out[n] ^= iv[n]; | ||
98 | iv = in; | ||
99 | len -= AES_BLOCK_SIZE; | ||
100 | in += AES_BLOCK_SIZE; | ||
101 | out += AES_BLOCK_SIZE; | ||
102 | } | ||
103 | if (len) { | ||
104 | AES_decrypt(in,tmp,key); | ||
105 | for(n=0; n < len; ++n) | ||
106 | out[n] = tmp[n] ^ iv[n]; | ||
107 | iv = in; | ||
108 | } | ||
109 | memcpy(ivec,iv,AES_BLOCK_SIZE); | ||
92 | } else { | 110 | } else { |
93 | while (len >= AES_BLOCK_SIZE) { | 111 | while (len >= AES_BLOCK_SIZE) { |
94 | memcpy(tmp, in, AES_BLOCK_SIZE); | 112 | memcpy(tmp, in, AES_BLOCK_SIZE); |
@@ -102,10 +120,12 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | |||
102 | } | 120 | } |
103 | if (len) { | 121 | if (len) { |
104 | memcpy(tmp, in, AES_BLOCK_SIZE); | 122 | memcpy(tmp, in, AES_BLOCK_SIZE); |
105 | AES_decrypt(tmp, tmp, key); | 123 | AES_decrypt(tmp, out, key); |
106 | for(n=0; n < len; ++n) | 124 | for(n=0; n < len; ++n) |
107 | out[n] = tmp[n] ^ ivec[n]; | 125 | out[n] ^= ivec[n]; |
126 | for(n=len; n < AES_BLOCK_SIZE; ++n) | ||
127 | out[n] = tmp[n]; | ||
108 | memcpy(ivec, tmp, AES_BLOCK_SIZE); | 128 | memcpy(ivec, tmp, AES_BLOCK_SIZE); |
109 | } | 129 | } |
110 | } | 130 | } |
111 | } | 131 | } |
diff --git a/src/lib/libssl/src/crypto/aes/aes_cfb.c b/src/lib/libssl/src/crypto/aes/aes_cfb.c index 9b569dda90..49f0411010 100644 --- a/src/lib/libssl/src/crypto/aes/aes_cfb.c +++ b/src/lib/libssl/src/crypto/aes/aes_cfb.c | |||
@@ -114,6 +114,7 @@ | |||
114 | 114 | ||
115 | #include <openssl/aes.h> | 115 | #include <openssl/aes.h> |
116 | #include "aes_locl.h" | 116 | #include "aes_locl.h" |
117 | #include "e_os.h" | ||
117 | 118 | ||
118 | /* The input and output encrypted as though 128bit cfb mode is being | 119 | /* The input and output encrypted as though 128bit cfb mode is being |
119 | * used. The extra state information to record how much of the | 120 | * used. The extra state information to record how much of the |
@@ -155,3 +156,70 @@ void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, | |||
155 | *num=n; | 156 | *num=n; |
156 | } | 157 | } |
157 | 158 | ||
159 | /* This expects a single block of size nbits for both in and out. Note that | ||
160 | it corrupts any extra bits in the last byte of out */ | ||
161 | void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out, | ||
162 | const int nbits,const AES_KEY *key, | ||
163 | unsigned char *ivec,const int enc) | ||
164 | { | ||
165 | int n,rem,num; | ||
166 | unsigned char ovec[AES_BLOCK_SIZE*2]; | ||
167 | |||
168 | if (nbits<=0 || nbits>128) return; | ||
169 | |||
170 | /* fill in the first half of the new IV with the current IV */ | ||
171 | memcpy(ovec,ivec,AES_BLOCK_SIZE); | ||
172 | /* construct the new IV */ | ||
173 | AES_encrypt(ivec,ivec,key); | ||
174 | num = (nbits+7)/8; | ||
175 | if (enc) /* encrypt the input */ | ||
176 | for(n=0 ; n < num ; ++n) | ||
177 | out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n] ^ ivec[n]); | ||
178 | else /* decrypt the input */ | ||
179 | for(n=0 ; n < num ; ++n) | ||
180 | out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n]) ^ ivec[n]; | ||
181 | /* shift ovec left... */ | ||
182 | rem = nbits%8; | ||
183 | num = nbits/8; | ||
184 | if(rem==0) | ||
185 | memcpy(ivec,ovec+num,AES_BLOCK_SIZE); | ||
186 | else | ||
187 | for(n=0 ; n < AES_BLOCK_SIZE ; ++n) | ||
188 | ivec[n] = ovec[n+num]<<rem | ovec[n+num+1]>>(8-rem); | ||
189 | |||
190 | /* it is not necessary to cleanse ovec, since the IV is not secret */ | ||
191 | } | ||
192 | |||
193 | /* N.B. This expects the input to be packed, MS bit first */ | ||
194 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, | ||
195 | const unsigned long length, const AES_KEY *key, | ||
196 | unsigned char *ivec, int *num, const int enc) | ||
197 | { | ||
198 | unsigned int n; | ||
199 | unsigned char c[1],d[1]; | ||
200 | |||
201 | assert(in && out && key && ivec && num); | ||
202 | assert(*num == 0); | ||
203 | |||
204 | memset(out,0,(length+7)/8); | ||
205 | for(n=0 ; n < length ; ++n) | ||
206 | { | ||
207 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | ||
208 | AES_cfbr_encrypt_block(c,d,1,key,ivec,enc); | ||
209 | out[n/8]=(out[n/8]&~(1 << (7-n%8)))|((d[0]&0x80) >> (n%8)); | ||
210 | } | ||
211 | } | ||
212 | |||
213 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, | ||
214 | const unsigned long length, const AES_KEY *key, | ||
215 | unsigned char *ivec, int *num, const int enc) | ||
216 | { | ||
217 | unsigned int n; | ||
218 | |||
219 | assert(in && out && key && ivec && num); | ||
220 | assert(*num == 0); | ||
221 | |||
222 | for(n=0 ; n < length ; ++n) | ||
223 | AES_cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc); | ||
224 | } | ||
225 | |||
diff --git a/src/lib/libssl/src/crypto/aes/aes_core.c b/src/lib/libssl/src/crypto/aes/aes_core.c index 2f41a825f8..ed566a8123 100644 --- a/src/lib/libssl/src/crypto/aes/aes_core.c +++ b/src/lib/libssl/src/crypto/aes/aes_core.c | |||
@@ -37,8 +37,11 @@ | |||
37 | 37 | ||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <openssl/aes.h> | 39 | #include <openssl/aes.h> |
40 | #include <openssl/fips.h> | ||
40 | #include "aes_locl.h" | 41 | #include "aes_locl.h" |
41 | 42 | ||
43 | #ifndef OPENSSL_FIPS | ||
44 | |||
42 | /* | 45 | /* |
43 | Te0[x] = S [x].[02, 01, 01, 03]; | 46 | Te0[x] = S [x].[02, 01, 01, 03]; |
44 | Te1[x] = S [x].[03, 02, 01, 01]; | 47 | Te1[x] = S [x].[03, 02, 01, 01]; |
@@ -1255,3 +1258,4 @@ void AES_decrypt(const unsigned char *in, unsigned char *out, | |||
1255 | PUTU32(out + 12, s3); | 1258 | PUTU32(out + 12, s3); |
1256 | } | 1259 | } |
1257 | 1260 | ||
1261 | #endif /* ndef OPENSSL_FIPS */ | ||
diff --git a/src/lib/libssl/src/crypto/aes/aes_ctr.c b/src/lib/libssl/src/crypto/aes/aes_ctr.c index 79e1c18f19..f36982be1e 100644 --- a/src/lib/libssl/src/crypto/aes/aes_ctr.c +++ b/src/lib/libssl/src/crypto/aes/aes_ctr.c | |||
@@ -59,7 +59,7 @@ | |||
59 | #include <openssl/aes.h> | 59 | #include <openssl/aes.h> |
60 | #include "aes_locl.h" | 60 | #include "aes_locl.h" |
61 | 61 | ||
62 | /* NOTE: CTR mode is big-endian. The rest of the AES code | 62 | /* NOTE: the IV/counter CTR mode is big-endian. The rest of the AES code |
63 | * is endian-neutral. */ | 63 | * is endian-neutral. */ |
64 | 64 | ||
65 | /* increment counter (128-bit int) by 1 */ | 65 | /* increment counter (128-bit int) by 1 */ |
@@ -67,61 +67,36 @@ static void AES_ctr128_inc(unsigned char *counter) { | |||
67 | unsigned long c; | 67 | unsigned long c; |
68 | 68 | ||
69 | /* Grab bottom dword of counter and increment */ | 69 | /* Grab bottom dword of counter and increment */ |
70 | #ifdef L_ENDIAN | ||
71 | c = GETU32(counter + 0); | ||
72 | c++; | ||
73 | PUTU32(counter + 0, c); | ||
74 | #else | ||
75 | c = GETU32(counter + 12); | 70 | c = GETU32(counter + 12); |
76 | c++; | 71 | c++; c &= 0xFFFFFFFF; |
77 | PUTU32(counter + 12, c); | 72 | PUTU32(counter + 12, c); |
78 | #endif | ||
79 | 73 | ||
80 | /* if no overflow, we're done */ | 74 | /* if no overflow, we're done */ |
81 | if (c) | 75 | if (c) |
82 | return; | 76 | return; |
83 | 77 | ||
84 | /* Grab 1st dword of counter and increment */ | 78 | /* Grab 1st dword of counter and increment */ |
85 | #ifdef L_ENDIAN | ||
86 | c = GETU32(counter + 4); | ||
87 | c++; | ||
88 | PUTU32(counter + 4, c); | ||
89 | #else | ||
90 | c = GETU32(counter + 8); | 79 | c = GETU32(counter + 8); |
91 | c++; | 80 | c++; c &= 0xFFFFFFFF; |
92 | PUTU32(counter + 8, c); | 81 | PUTU32(counter + 8, c); |
93 | #endif | ||
94 | 82 | ||
95 | /* if no overflow, we're done */ | 83 | /* if no overflow, we're done */ |
96 | if (c) | 84 | if (c) |
97 | return; | 85 | return; |
98 | 86 | ||
99 | /* Grab 2nd dword of counter and increment */ | 87 | /* Grab 2nd dword of counter and increment */ |
100 | #ifdef L_ENDIAN | ||
101 | c = GETU32(counter + 8); | ||
102 | c++; | ||
103 | PUTU32(counter + 8, c); | ||
104 | #else | ||
105 | c = GETU32(counter + 4); | 88 | c = GETU32(counter + 4); |
106 | c++; | 89 | c++; c &= 0xFFFFFFFF; |
107 | PUTU32(counter + 4, c); | 90 | PUTU32(counter + 4, c); |
108 | #endif | ||
109 | 91 | ||
110 | /* if no overflow, we're done */ | 92 | /* if no overflow, we're done */ |
111 | if (c) | 93 | if (c) |
112 | return; | 94 | return; |
113 | 95 | ||
114 | /* Grab top dword of counter and increment */ | 96 | /* Grab top dword of counter and increment */ |
115 | #ifdef L_ENDIAN | ||
116 | c = GETU32(counter + 12); | ||
117 | c++; | ||
118 | PUTU32(counter + 12, c); | ||
119 | #else | ||
120 | c = GETU32(counter + 0); | 97 | c = GETU32(counter + 0); |
121 | c++; | 98 | c++; c &= 0xFFFFFFFF; |
122 | PUTU32(counter + 0, c); | 99 | PUTU32(counter + 0, c); |
123 | #endif | ||
124 | |||
125 | } | 100 | } |
126 | 101 | ||
127 | /* The input encrypted as though 128bit counter mode is being | 102 | /* The input encrypted as though 128bit counter mode is being |
diff --git a/src/lib/libssl/src/crypto/aes/aes_locl.h b/src/lib/libssl/src/crypto/aes/aes_locl.h index f290946058..4184729e34 100644 --- a/src/lib/libssl/src/crypto/aes/aes_locl.h +++ b/src/lib/libssl/src/crypto/aes/aes_locl.h | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <stdlib.h> | 62 | #include <stdlib.h> |
63 | #include <string.h> | 63 | #include <string.h> |
64 | 64 | ||
65 | #if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE) | 65 | #if defined(_MSC_VER) && !defined(_M_IA64) && !defined(OPENSSL_SYS_WINCE) |
66 | # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) | 66 | # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) |
67 | # define GETU32(p) SWAP(*((u32 *)(p))) | 67 | # define GETU32(p) SWAP(*((u32 *)(p))) |
68 | # define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } | 68 | # define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } |
diff --git a/src/lib/libssl/src/crypto/asn1/a_bitstr.c b/src/lib/libssl/src/crypto/asn1/a_bitstr.c index f4ea96cd54..b81bf4fc81 100644 --- a/src/lib/libssl/src/crypto/asn1/a_bitstr.c +++ b/src/lib/libssl/src/crypto/asn1/a_bitstr.c | |||
@@ -194,8 +194,12 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) | |||
194 | c=(unsigned char *)OPENSSL_realloc_clean(a->data, | 194 | c=(unsigned char *)OPENSSL_realloc_clean(a->data, |
195 | a->length, | 195 | a->length, |
196 | w+1); | 196 | w+1); |
197 | if (c == NULL) return(0); | 197 | if (c == NULL) |
198 | if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length); | 198 | { |
199 | ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT,ERR_R_MALLOC_FAILURE); | ||
200 | return 0; | ||
201 | } | ||
202 | if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length); | ||
199 | a->data=c; | 203 | a->data=c; |
200 | a->length=w+1; | 204 | a->length=w+1; |
201 | } | 205 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/a_digest.c b/src/lib/libssl/src/crypto/asn1/a_digest.c index 4931e222a0..7182e9fa5d 100644 --- a/src/lib/libssl/src/crypto/asn1/a_digest.c +++ b/src/lib/libssl/src/crypto/asn1/a_digest.c | |||
@@ -65,6 +65,7 @@ | |||
65 | # include <sys/types.h> | 65 | # include <sys/types.h> |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #include <openssl/err.h> | ||
68 | #include <openssl/evp.h> | 69 | #include <openssl/evp.h> |
69 | #include <openssl/buffer.h> | 70 | #include <openssl/buffer.h> |
70 | #include <openssl/x509.h> | 71 | #include <openssl/x509.h> |
@@ -78,7 +79,11 @@ int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data, | |||
78 | unsigned char *str,*p; | 79 | unsigned char *str,*p; |
79 | 80 | ||
80 | i=i2d(data,NULL); | 81 | i=i2d(data,NULL); |
81 | if ((str=(unsigned char *)OPENSSL_malloc(i)) == NULL) return(0); | 82 | if ((str=(unsigned char *)OPENSSL_malloc(i)) == NULL) |
83 | { | ||
84 | ASN1err(ASN1_F_ASN1_DIGEST,ERR_R_MALLOC_FAILURE); | ||
85 | return(0); | ||
86 | } | ||
82 | p=str; | 87 | p=str; |
83 | i2d(data,&p); | 88 | i2d(data,&p); |
84 | 89 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/a_enum.c b/src/lib/libssl/src/crypto/asn1/a_enum.c index ad8f0ffd1a..03ede68d1c 100644 --- a/src/lib/libssl/src/crypto/asn1/a_enum.c +++ b/src/lib/libssl/src/crypto/asn1/a_enum.c | |||
@@ -156,7 +156,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai) | |||
156 | unsigned char *new_data=OPENSSL_realloc(ret->data, len+4); | 156 | unsigned char *new_data=OPENSSL_realloc(ret->data, len+4); |
157 | if (!new_data) | 157 | if (!new_data) |
158 | { | 158 | { |
159 | ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); | 159 | ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); |
160 | goto err; | 160 | goto err; |
161 | } | 161 | } |
162 | ret->data=new_data; | 162 | ret->data=new_data; |
diff --git a/src/lib/libssl/src/crypto/asn1/a_gentm.c b/src/lib/libssl/src/crypto/asn1/a_gentm.c index 8581007868..0dfd576211 100644 --- a/src/lib/libssl/src/crypto/asn1/a_gentm.c +++ b/src/lib/libssl/src/crypto/asn1/a_gentm.c | |||
@@ -192,8 +192,9 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str) | |||
192 | { | 192 | { |
193 | if (s != NULL) | 193 | if (s != NULL) |
194 | { | 194 | { |
195 | ASN1_STRING_set((ASN1_STRING *)s, | 195 | if (!ASN1_STRING_set((ASN1_STRING *)s, |
196 | (unsigned char *)str,t.length); | 196 | (unsigned char *)str,t.length)) |
197 | return 0; | ||
197 | s->type=V_ASN1_GENERALIZEDTIME; | 198 | s->type=V_ASN1_GENERALIZEDTIME; |
198 | } | 199 | } |
199 | return(1); | 200 | return(1); |
@@ -223,7 +224,12 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, | |||
223 | if ((p == NULL) || ((size_t)s->length < len)) | 224 | if ((p == NULL) || ((size_t)s->length < len)) |
224 | { | 225 | { |
225 | p=OPENSSL_malloc(len); | 226 | p=OPENSSL_malloc(len); |
226 | if (p == NULL) return(NULL); | 227 | if (p == NULL) |
228 | { | ||
229 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_SET, | ||
230 | ERR_R_MALLOC_FAILURE); | ||
231 | return(NULL); | ||
232 | } | ||
227 | if (s->data != NULL) | 233 | if (s->data != NULL) |
228 | OPENSSL_free(s->data); | 234 | OPENSSL_free(s->data); |
229 | s->data=(unsigned char *)p; | 235 | s->data=(unsigned char *)p; |
diff --git a/src/lib/libssl/src/crypto/asn1/a_int.c b/src/lib/libssl/src/crypto/asn1/a_int.c index edb243c021..21cc64bb23 100644 --- a/src/lib/libssl/src/crypto/asn1/a_int.c +++ b/src/lib/libssl/src/crypto/asn1/a_int.c | |||
@@ -64,7 +64,26 @@ ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x) | |||
64 | { return M_ASN1_INTEGER_dup(x);} | 64 | { return M_ASN1_INTEGER_dup(x);} |
65 | 65 | ||
66 | int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y) | 66 | int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y) |
67 | { return M_ASN1_INTEGER_cmp(x,y);} | 67 | { |
68 | int neg, ret; | ||
69 | /* Compare signs */ | ||
70 | neg = x->type & V_ASN1_NEG; | ||
71 | if (neg != (y->type & V_ASN1_NEG)) | ||
72 | { | ||
73 | if (neg) | ||
74 | return -1; | ||
75 | else | ||
76 | return 1; | ||
77 | } | ||
78 | |||
79 | ret = ASN1_STRING_cmp(x, y); | ||
80 | |||
81 | if (neg) | ||
82 | return -ret; | ||
83 | else | ||
84 | return ret; | ||
85 | } | ||
86 | |||
68 | 87 | ||
69 | /* | 88 | /* |
70 | * This converts an ASN1 INTEGER into its content encoding. | 89 | * This converts an ASN1 INTEGER into its content encoding. |
diff --git a/src/lib/libssl/src/crypto/asn1/a_print.c b/src/lib/libssl/src/crypto/asn1/a_print.c index 8035513f04..d18e772320 100644 --- a/src/lib/libssl/src/crypto/asn1/a_print.c +++ b/src/lib/libssl/src/crypto/asn1/a_print.c | |||
@@ -60,7 +60,7 @@ | |||
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
62 | 62 | ||
63 | int ASN1_PRINTABLE_type(unsigned char *s, int len) | 63 | int ASN1_PRINTABLE_type(const unsigned char *s, int len) |
64 | { | 64 | { |
65 | int c; | 65 | int c; |
66 | int ia5=0; | 66 | int ia5=0; |
diff --git a/src/lib/libssl/src/crypto/asn1/a_set.c b/src/lib/libssl/src/crypto/asn1/a_set.c index 0f839822ff..e24061c545 100644 --- a/src/lib/libssl/src/crypto/asn1/a_set.c +++ b/src/lib/libssl/src/crypto/asn1/a_set.c | |||
@@ -118,8 +118,13 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag, | |||
118 | } | 118 | } |
119 | 119 | ||
120 | pStart = p; /* Catch the beg of Setblobs*/ | 120 | pStart = p; /* Catch the beg of Setblobs*/ |
121 | if (!(rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)))) return 0; /* In this array | 121 | /* In this array we will store the SET blobs */ |
122 | we will store the SET blobs */ | 122 | rgSetBlob = (MYBLOB *)OPENSSL_malloc(sk_num(a) * sizeof(MYBLOB)); |
123 | if (rgSetBlob == NULL) | ||
124 | { | ||
125 | ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE); | ||
126 | return(0); | ||
127 | } | ||
123 | 128 | ||
124 | for (i=0; i<sk_num(a); i++) | 129 | for (i=0; i<sk_num(a); i++) |
125 | { | 130 | { |
@@ -135,7 +140,11 @@ SetBlob | |||
135 | /* Now we have to sort the blobs. I am using a simple algo. | 140 | /* Now we have to sort the blobs. I am using a simple algo. |
136 | *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ | 141 | *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ |
137 | qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); | 142 | qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); |
138 | if (!(pTempMem = OPENSSL_malloc(totSize))) return 0; | 143 | if (!(pTempMem = OPENSSL_malloc(totSize))) |
144 | { | ||
145 | ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE); | ||
146 | return(0); | ||
147 | } | ||
139 | 148 | ||
140 | /* Copy to temp mem */ | 149 | /* Copy to temp mem */ |
141 | p = pTempMem; | 150 | p = pTempMem; |
@@ -160,7 +169,13 @@ STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length, | |||
160 | STACK *ret=NULL; | 169 | STACK *ret=NULL; |
161 | 170 | ||
162 | if ((a == NULL) || ((*a) == NULL)) | 171 | if ((a == NULL) || ((*a) == NULL)) |
163 | { if ((ret=sk_new_null()) == NULL) goto err; } | 172 | { |
173 | if ((ret=sk_new_null()) == NULL) | ||
174 | { | ||
175 | ASN1err(ASN1_F_D2I_ASN1_SET,ERR_R_MALLOC_FAILURE); | ||
176 | goto err; | ||
177 | } | ||
178 | } | ||
164 | else | 179 | else |
165 | ret=(*a); | 180 | ret=(*a); |
166 | 181 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/a_strex.c b/src/lib/libssl/src/crypto/asn1/a_strex.c index bde666a6ff..a07122ba47 100644 --- a/src/lib/libssl/src/crypto/asn1/a_strex.c +++ b/src/lib/libssl/src/crypto/asn1/a_strex.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2000-2004 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -553,7 +553,12 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in) | |||
553 | if((type < 0) || (type > 30)) return -1; | 553 | if((type < 0) || (type > 30)) return -1; |
554 | mbflag = tag2nbyte[type]; | 554 | mbflag = tag2nbyte[type]; |
555 | if(mbflag == -1) return -1; | 555 | if(mbflag == -1) return -1; |
556 | mbflag |= MBSTRING_FLAG; | 556 | if (mbflag == 0) |
557 | mbflag = MBSTRING_UTF8; | ||
558 | else if (mbflag == 4) | ||
559 | mbflag = MBSTRING_UNIV; | ||
560 | else | ||
561 | mbflag |= MBSTRING_FLAG; | ||
557 | stmp.data = NULL; | 562 | stmp.data = NULL; |
558 | ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); | 563 | ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); |
559 | if(ret < 0) return ret; | 564 | if(ret < 0) return ret; |
diff --git a/src/lib/libssl/src/crypto/asn1/a_type.c b/src/lib/libssl/src/crypto/asn1/a_type.c index fe3fcd40b0..2292d49b93 100644 --- a/src/lib/libssl/src/crypto/asn1/a_type.c +++ b/src/lib/libssl/src/crypto/asn1/a_type.c | |||
@@ -71,7 +71,10 @@ int ASN1_TYPE_get(ASN1_TYPE *a) | |||
71 | void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) | 71 | void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) |
72 | { | 72 | { |
73 | if (a->value.ptr != NULL) | 73 | if (a->value.ptr != NULL) |
74 | ASN1_primitive_free((ASN1_VALUE **)&a, NULL); | 74 | { |
75 | ASN1_TYPE **tmp_a = &a; | ||
76 | ASN1_primitive_free((ASN1_VALUE **)tmp_a, NULL); | ||
77 | } | ||
75 | a->type=type; | 78 | a->type=type; |
76 | a->value.ptr=value; | 79 | a->value.ptr=value; |
77 | } | 80 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/a_utctm.c b/src/lib/libssl/src/crypto/asn1/a_utctm.c index 999852dae5..7b25fed331 100644 --- a/src/lib/libssl/src/crypto/asn1/a_utctm.c +++ b/src/lib/libssl/src/crypto/asn1/a_utctm.c | |||
@@ -173,8 +173,9 @@ int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str) | |||
173 | { | 173 | { |
174 | if (s != NULL) | 174 | if (s != NULL) |
175 | { | 175 | { |
176 | ASN1_STRING_set((ASN1_STRING *)s, | 176 | if (!ASN1_STRING_set((ASN1_STRING *)s, |
177 | (unsigned char *)str,t.length); | 177 | (unsigned char *)str,t.length)) |
178 | return 0; | ||
178 | s->type = V_ASN1_UTCTIME; | 179 | s->type = V_ASN1_UTCTIME; |
179 | } | 180 | } |
180 | return(1); | 181 | return(1); |
@@ -203,7 +204,11 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) | |||
203 | if ((p == NULL) || ((size_t)s->length < len)) | 204 | if ((p == NULL) || ((size_t)s->length < len)) |
204 | { | 205 | { |
205 | p=OPENSSL_malloc(len); | 206 | p=OPENSSL_malloc(len); |
206 | if (p == NULL) return(NULL); | 207 | if (p == NULL) |
208 | { | ||
209 | ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE); | ||
210 | return(NULL); | ||
211 | } | ||
207 | if (s->data != NULL) | 212 | if (s->data != NULL) |
208 | OPENSSL_free(s->data); | 213 | OPENSSL_free(s->data); |
209 | s->data=(unsigned char *)p; | 214 | s->data=(unsigned char *)p; |
diff --git a/src/lib/libssl/src/crypto/asn1/a_verify.c b/src/lib/libssl/src/crypto/asn1/a_verify.c index da2a0a6d69..18ef0acf00 100644 --- a/src/lib/libssl/src/crypto/asn1/a_verify.c +++ b/src/lib/libssl/src/crypto/asn1/a_verify.c | |||
@@ -142,6 +142,13 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat | |||
142 | goto err; | 142 | goto err; |
143 | } | 143 | } |
144 | 144 | ||
145 | if (!EVP_VerifyInit_ex(&ctx,type, NULL)) | ||
146 | { | ||
147 | ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB); | ||
148 | ret=0; | ||
149 | goto err; | ||
150 | } | ||
151 | |||
145 | inl = ASN1_item_i2d(asn, &buf_in, it); | 152 | inl = ASN1_item_i2d(asn, &buf_in, it); |
146 | 153 | ||
147 | if (buf_in == NULL) | 154 | if (buf_in == NULL) |
@@ -150,7 +157,6 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat | |||
150 | goto err; | 157 | goto err; |
151 | } | 158 | } |
152 | 159 | ||
153 | EVP_VerifyInit_ex(&ctx,type, NULL); | ||
154 | EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl); | 160 | EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl); |
155 | 161 | ||
156 | OPENSSL_cleanse(buf_in,(unsigned int)inl); | 162 | OPENSSL_cleanse(buf_in,(unsigned int)inl); |
diff --git a/src/lib/libssl/src/crypto/asn1/asn1.h b/src/lib/libssl/src/crypto/asn1/asn1.h index 3414509f1b..ceaeb4cbe3 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1.h +++ b/src/lib/libssl/src/crypto/asn1/asn1.h | |||
@@ -829,7 +829,7 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); | |||
829 | 829 | ||
830 | /* General */ | 830 | /* General */ |
831 | /* given a string, return the correct type, max is the maximum length */ | 831 | /* given a string, return the correct type, max is the maximum length */ |
832 | int ASN1_PRINTABLE_type(unsigned char *s, int max); | 832 | int ASN1_PRINTABLE_type(const unsigned char *s, int max); |
833 | 833 | ||
834 | int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); | 834 | int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); |
835 | ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, | 835 | ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, |
@@ -950,16 +950,19 @@ void ERR_load_ASN1_strings(void); | |||
950 | #define ASN1_F_A2I_ASN1_ENUMERATED 101 | 950 | #define ASN1_F_A2I_ASN1_ENUMERATED 101 |
951 | #define ASN1_F_A2I_ASN1_INTEGER 102 | 951 | #define ASN1_F_A2I_ASN1_INTEGER 102 |
952 | #define ASN1_F_A2I_ASN1_STRING 103 | 952 | #define ASN1_F_A2I_ASN1_STRING 103 |
953 | #define ASN1_F_ASN1_BIT_STRING_SET_BIT 176 | ||
953 | #define ASN1_F_ASN1_CHECK_TLEN 104 | 954 | #define ASN1_F_ASN1_CHECK_TLEN 104 |
954 | #define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 | 955 | #define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 |
955 | #define ASN1_F_ASN1_COLLECT 106 | 956 | #define ASN1_F_ASN1_COLLECT 106 |
956 | #define ASN1_F_ASN1_D2I_BIO 107 | 957 | #define ASN1_F_ASN1_D2I_BIO 107 |
957 | #define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 | 958 | #define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 |
958 | #define ASN1_F_ASN1_D2I_FP 109 | 959 | #define ASN1_F_ASN1_D2I_FP 109 |
960 | #define ASN1_F_ASN1_DIGEST 177 | ||
959 | #define ASN1_F_ASN1_DO_ADB 110 | 961 | #define ASN1_F_ASN1_DO_ADB 110 |
960 | #define ASN1_F_ASN1_DUP 111 | 962 | #define ASN1_F_ASN1_DUP 111 |
961 | #define ASN1_F_ASN1_ENUMERATED_SET 112 | 963 | #define ASN1_F_ASN1_ENUMERATED_SET 112 |
962 | #define ASN1_F_ASN1_ENUMERATED_TO_BN 113 | 964 | #define ASN1_F_ASN1_ENUMERATED_TO_BN 113 |
965 | #define ASN1_F_ASN1_GENERALIZEDTIME_SET 178 | ||
963 | #define ASN1_F_ASN1_GET_OBJECT 114 | 966 | #define ASN1_F_ASN1_GET_OBJECT 114 |
964 | #define ASN1_F_ASN1_HEADER_NEW 115 | 967 | #define ASN1_F_ASN1_HEADER_NEW 115 |
965 | #define ASN1_F_ASN1_I2D_BIO 116 | 968 | #define ASN1_F_ASN1_I2D_BIO 116 |
@@ -975,6 +978,7 @@ void ERR_load_ASN1_strings(void); | |||
975 | #define ASN1_F_ASN1_SEQ_PACK 126 | 978 | #define ASN1_F_ASN1_SEQ_PACK 126 |
976 | #define ASN1_F_ASN1_SEQ_UNPACK 127 | 979 | #define ASN1_F_ASN1_SEQ_UNPACK 127 |
977 | #define ASN1_F_ASN1_SIGN 128 | 980 | #define ASN1_F_ASN1_SIGN 128 |
981 | #define ASN1_F_ASN1_STRING_SET 179 | ||
978 | #define ASN1_F_ASN1_STRING_TABLE_ADD 129 | 982 | #define ASN1_F_ASN1_STRING_TABLE_ADD 129 |
979 | #define ASN1_F_ASN1_STRING_TYPE_NEW 130 | 983 | #define ASN1_F_ASN1_STRING_TYPE_NEW 130 |
980 | #define ASN1_F_ASN1_TEMPLATE_D2I 131 | 984 | #define ASN1_F_ASN1_TEMPLATE_D2I 131 |
@@ -984,6 +988,7 @@ void ERR_load_ASN1_strings(void); | |||
984 | #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 | 988 | #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 |
985 | #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 | 989 | #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 |
986 | #define ASN1_F_ASN1_UNPACK_STRING 136 | 990 | #define ASN1_F_ASN1_UNPACK_STRING 136 |
991 | #define ASN1_F_ASN1_UTCTIME_SET 180 | ||
987 | #define ASN1_F_ASN1_VERIFY 137 | 992 | #define ASN1_F_ASN1_VERIFY 137 |
988 | #define ASN1_F_BN_TO_ASN1_ENUMERATED 138 | 993 | #define ASN1_F_BN_TO_ASN1_ENUMERATED 138 |
989 | #define ASN1_F_BN_TO_ASN1_INTEGER 139 | 994 | #define ASN1_F_BN_TO_ASN1_INTEGER 139 |
@@ -1007,6 +1012,7 @@ void ERR_load_ASN1_strings(void); | |||
1007 | #define ASN1_F_D2I_X509_CINF 157 | 1012 | #define ASN1_F_D2I_X509_CINF 157 |
1008 | #define ASN1_F_D2I_X509_NAME 158 | 1013 | #define ASN1_F_D2I_X509_NAME 158 |
1009 | #define ASN1_F_D2I_X509_PKEY 159 | 1014 | #define ASN1_F_D2I_X509_PKEY 159 |
1015 | #define ASN1_F_I2D_ASN1_SET 181 | ||
1010 | #define ASN1_F_I2D_ASN1_TIME 160 | 1016 | #define ASN1_F_I2D_ASN1_TIME 160 |
1011 | #define ASN1_F_I2D_DSA_PUBKEY 161 | 1017 | #define ASN1_F_I2D_DSA_PUBKEY 161 |
1012 | #define ASN1_F_I2D_NETSCAPE_RSA 162 | 1018 | #define ASN1_F_I2D_NETSCAPE_RSA 162 |
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_err.c b/src/lib/libssl/src/crypto/asn1/asn1_err.c index 094ec06fda..3b57c8fbae 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1_err.c +++ b/src/lib/libssl/src/crypto/asn1/asn1_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/asn1/asn1_err.c */ | 1 | /* crypto/asn1/asn1_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2004 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 |
@@ -70,16 +70,19 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
70 | {ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"}, | 70 | {ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"}, |
71 | {ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"}, | 71 | {ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"}, |
72 | {ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"}, | 72 | {ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"}, |
73 | {ERR_PACK(0,ASN1_F_ASN1_BIT_STRING_SET_BIT,0), "ASN1_BIT_STRING_set_bit"}, | ||
73 | {ERR_PACK(0,ASN1_F_ASN1_CHECK_TLEN,0), "ASN1_CHECK_TLEN"}, | 74 | {ERR_PACK(0,ASN1_F_ASN1_CHECK_TLEN,0), "ASN1_CHECK_TLEN"}, |
74 | {ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"}, | 75 | {ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"}, |
75 | {ERR_PACK(0,ASN1_F_ASN1_COLLECT,0), "ASN1_COLLECT"}, | 76 | {ERR_PACK(0,ASN1_F_ASN1_COLLECT,0), "ASN1_COLLECT"}, |
76 | {ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"}, | 77 | {ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"}, |
77 | {ERR_PACK(0,ASN1_F_ASN1_D2I_EX_PRIMITIVE,0), "ASN1_D2I_EX_PRIMITIVE"}, | 78 | {ERR_PACK(0,ASN1_F_ASN1_D2I_EX_PRIMITIVE,0), "ASN1_D2I_EX_PRIMITIVE"}, |
78 | {ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"}, | 79 | {ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"}, |
80 | {ERR_PACK(0,ASN1_F_ASN1_DIGEST,0), "ASN1_digest"}, | ||
79 | {ERR_PACK(0,ASN1_F_ASN1_DO_ADB,0), "ASN1_DO_ADB"}, | 81 | {ERR_PACK(0,ASN1_F_ASN1_DO_ADB,0), "ASN1_DO_ADB"}, |
80 | {ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"}, | 82 | {ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"}, |
81 | {ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"}, | 83 | {ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"}, |
82 | {ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"}, | 84 | {ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"}, |
85 | {ERR_PACK(0,ASN1_F_ASN1_GENERALIZEDTIME_SET,0), "ASN1_GENERALIZEDTIME_set"}, | ||
83 | {ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"}, | 86 | {ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"}, |
84 | {ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"}, | 87 | {ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"}, |
85 | {ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"}, | 88 | {ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"}, |
@@ -95,6 +98,7 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
95 | {ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"}, | 98 | {ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"}, |
96 | {ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"}, | 99 | {ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"}, |
97 | {ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"}, | 100 | {ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"}, |
101 | {ERR_PACK(0,ASN1_F_ASN1_STRING_SET,0), "ASN1_STRING_set"}, | ||
98 | {ERR_PACK(0,ASN1_F_ASN1_STRING_TABLE_ADD,0), "ASN1_STRING_TABLE_add"}, | 102 | {ERR_PACK(0,ASN1_F_ASN1_STRING_TABLE_ADD,0), "ASN1_STRING_TABLE_add"}, |
99 | {ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"}, | 103 | {ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"}, |
100 | {ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_D2I,0), "ASN1_TEMPLATE_D2I"}, | 104 | {ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_D2I,0), "ASN1_TEMPLATE_D2I"}, |
@@ -104,6 +108,7 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
104 | {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"}, | 108 | {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"}, |
105 | {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"}, | 109 | {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"}, |
106 | {ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"}, | 110 | {ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"}, |
111 | {ERR_PACK(0,ASN1_F_ASN1_UTCTIME_SET,0), "ASN1_UTCTIME_set"}, | ||
107 | {ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"}, | 112 | {ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"}, |
108 | {ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"}, | 113 | {ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"}, |
109 | {ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"}, | 114 | {ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"}, |
@@ -127,6 +132,7 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
127 | {ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "D2I_X509_CINF"}, | 132 | {ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "D2I_X509_CINF"}, |
128 | {ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "D2I_X509_NAME"}, | 133 | {ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "D2I_X509_NAME"}, |
129 | {ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"}, | 134 | {ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"}, |
135 | {ERR_PACK(0,ASN1_F_I2D_ASN1_SET,0), "i2d_ASN1_SET"}, | ||
130 | {ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "I2D_ASN1_TIME"}, | 136 | {ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "I2D_ASN1_TIME"}, |
131 | {ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"}, | 137 | {ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"}, |
132 | {ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"}, | 138 | {ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"}, |
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_lib.c b/src/lib/libssl/src/crypto/asn1/asn1_lib.c index a74f1368d3..97b9b35f4b 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1_lib.c +++ b/src/lib/libssl/src/crypto/asn1/asn1_lib.c | |||
@@ -349,6 +349,7 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | |||
349 | 349 | ||
350 | if (str->data == NULL) | 350 | if (str->data == NULL) |
351 | { | 351 | { |
352 | ASN1err(ASN1_F_ASN1_STRING_SET,ERR_R_MALLOC_FAILURE); | ||
352 | str->data=c; | 353 | str->data=c; |
353 | return(0); | 354 | return(0); |
354 | } | 355 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/evp_asn1.c b/src/lib/libssl/src/crypto/asn1/evp_asn1.c index 3506005a71..f92ce6cb5d 100644 --- a/src/lib/libssl/src/crypto/asn1/evp_asn1.c +++ b/src/lib/libssl/src/crypto/asn1/evp_asn1.c | |||
@@ -115,7 +115,11 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, | |||
115 | 115 | ||
116 | if ((osp=ASN1_STRING_new()) == NULL) return(0); | 116 | if ((osp=ASN1_STRING_new()) == NULL) return(0); |
117 | /* Grow the 'string' */ | 117 | /* Grow the 'string' */ |
118 | ASN1_STRING_set(osp,NULL,size); | 118 | if (!ASN1_STRING_set(osp,NULL,size)) |
119 | { | ||
120 | ASN1_STRING_free(osp); | ||
121 | return(0); | ||
122 | } | ||
119 | 123 | ||
120 | M_ASN1_STRING_length_set(osp, size); | 124 | M_ASN1_STRING_length_set(osp, size); |
121 | p=M_ASN1_STRING_data(osp); | 125 | p=M_ASN1_STRING_data(osp); |
diff --git a/src/lib/libssl/src/crypto/asn1/p5_pbe.c b/src/lib/libssl/src/crypto/asn1/p5_pbe.c index 891150638e..ec788267e0 100644 --- a/src/lib/libssl/src/crypto/asn1/p5_pbe.c +++ b/src/lib/libssl/src/crypto/asn1/p5_pbe.c | |||
@@ -76,47 +76,55 @@ IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM) | |||
76 | X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, | 76 | X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, |
77 | int saltlen) | 77 | int saltlen) |
78 | { | 78 | { |
79 | PBEPARAM *pbe; | 79 | PBEPARAM *pbe=NULL; |
80 | ASN1_OBJECT *al; | 80 | ASN1_OBJECT *al; |
81 | X509_ALGOR *algor; | 81 | X509_ALGOR *algor; |
82 | ASN1_TYPE *astype; | 82 | ASN1_TYPE *astype=NULL; |
83 | 83 | ||
84 | if (!(pbe = PBEPARAM_new ())) { | 84 | if (!(pbe = PBEPARAM_new ())) { |
85 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | 85 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); |
86 | return NULL; | 86 | goto err; |
87 | } | 87 | } |
88 | if(iter <= 0) iter = PKCS5_DEFAULT_ITER; | 88 | if(iter <= 0) iter = PKCS5_DEFAULT_ITER; |
89 | ASN1_INTEGER_set (pbe->iter, iter); | 89 | if (!ASN1_INTEGER_set(pbe->iter, iter)) { |
90 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | ||
91 | goto err; | ||
92 | } | ||
90 | if (!saltlen) saltlen = PKCS5_SALT_LEN; | 93 | if (!saltlen) saltlen = PKCS5_SALT_LEN; |
91 | if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) { | 94 | if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) { |
92 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | 95 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); |
93 | return NULL; | 96 | goto err; |
94 | } | 97 | } |
95 | pbe->salt->length = saltlen; | 98 | pbe->salt->length = saltlen; |
96 | if (salt) memcpy (pbe->salt->data, salt, saltlen); | 99 | if (salt) memcpy (pbe->salt->data, salt, saltlen); |
97 | else if (RAND_pseudo_bytes (pbe->salt->data, saltlen) < 0) | 100 | else if (RAND_pseudo_bytes (pbe->salt->data, saltlen) < 0) |
98 | return NULL; | 101 | goto err; |
99 | 102 | ||
100 | if (!(astype = ASN1_TYPE_new())) { | 103 | if (!(astype = ASN1_TYPE_new())) { |
101 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | 104 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); |
102 | return NULL; | 105 | goto err; |
103 | } | 106 | } |
104 | 107 | ||
105 | astype->type = V_ASN1_SEQUENCE; | 108 | astype->type = V_ASN1_SEQUENCE; |
106 | if(!ASN1_pack_string(pbe, i2d_PBEPARAM, &astype->value.sequence)) { | 109 | if(!ASN1_pack_string(pbe, i2d_PBEPARAM, &astype->value.sequence)) { |
107 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | 110 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); |
108 | return NULL; | 111 | goto err; |
109 | } | 112 | } |
110 | PBEPARAM_free (pbe); | 113 | PBEPARAM_free (pbe); |
114 | pbe = NULL; | ||
111 | 115 | ||
112 | al = OBJ_nid2obj(alg); /* never need to free al */ | 116 | al = OBJ_nid2obj(alg); /* never need to free al */ |
113 | if (!(algor = X509_ALGOR_new())) { | 117 | if (!(algor = X509_ALGOR_new())) { |
114 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); | 118 | ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); |
115 | return NULL; | 119 | goto err; |
116 | } | 120 | } |
117 | ASN1_OBJECT_free(algor->algorithm); | 121 | ASN1_OBJECT_free(algor->algorithm); |
118 | algor->algorithm = al; | 122 | algor->algorithm = al; |
119 | algor->parameter = astype; | 123 | algor->parameter = astype; |
120 | 124 | ||
121 | return (algor); | 125 | return (algor); |
126 | err: | ||
127 | if (pbe != NULL) PBEPARAM_free(pbe); | ||
128 | if (astype != NULL) ASN1_TYPE_free(astype); | ||
129 | return NULL; | ||
122 | } | 130 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/p5_pbev2.c b/src/lib/libssl/src/crypto/asn1/p5_pbev2.c index 91e1c8987d..e0dc0ec4ee 100644 --- a/src/lib/libssl/src/crypto/asn1/p5_pbev2.c +++ b/src/lib/libssl/src/crypto/asn1/p5_pbev2.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* p5_pbev2.c */ | 1 | /* p5_pbev2.c */ |
2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999-2004. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
@@ -113,7 +113,8 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
113 | if(!(scheme->parameter = ASN1_TYPE_new())) goto merr; | 113 | if(!(scheme->parameter = ASN1_TYPE_new())) goto merr; |
114 | 114 | ||
115 | /* Create random IV */ | 115 | /* Create random IV */ |
116 | if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) | 116 | if (EVP_CIPHER_iv_length(cipher) && |
117 | RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) | ||
117 | goto err; | 118 | goto err; |
118 | 119 | ||
119 | EVP_CIPHER_CTX_init(&ctx); | 120 | EVP_CIPHER_CTX_init(&ctx); |
@@ -123,6 +124,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
123 | if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { | 124 | if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { |
124 | ASN1err(ASN1_F_PKCS5_PBE2_SET, | 125 | ASN1err(ASN1_F_PKCS5_PBE2_SET, |
125 | ASN1_R_ERROR_SETTING_CIPHER_PARAMS); | 126 | ASN1_R_ERROR_SETTING_CIPHER_PARAMS); |
127 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
126 | goto err; | 128 | goto err; |
127 | } | 129 | } |
128 | EVP_CIPHER_CTX_cleanup(&ctx); | 130 | EVP_CIPHER_CTX_cleanup(&ctx); |
diff --git a/src/lib/libssl/src/crypto/asn1/t_bitst.c b/src/lib/libssl/src/crypto/asn1/t_bitst.c index 8ee789f082..397332d9b8 100644 --- a/src/lib/libssl/src/crypto/asn1/t_bitst.c +++ b/src/lib/libssl/src/crypto/asn1/t_bitst.c | |||
@@ -84,7 +84,10 @@ int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, | |||
84 | int bitnum; | 84 | int bitnum; |
85 | bitnum = ASN1_BIT_STRING_num_asc(name, tbl); | 85 | bitnum = ASN1_BIT_STRING_num_asc(name, tbl); |
86 | if(bitnum < 0) return 0; | 86 | if(bitnum < 0) return 0; |
87 | if(bs) ASN1_BIT_STRING_set_bit(bs, bitnum, value); | 87 | if(bs) { |
88 | if(!ASN1_BIT_STRING_set_bit(bs, bitnum, value)) | ||
89 | return 0; | ||
90 | } | ||
88 | return 1; | 91 | return 1; |
89 | } | 92 | } |
90 | 93 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/x_crl.c b/src/lib/libssl/src/crypto/asn1/x_crl.c index 11fce96825..b99f8fc522 100644 --- a/src/lib/libssl/src/crypto/asn1/x_crl.c +++ b/src/lib/libssl/src/crypto/asn1/x_crl.c | |||
@@ -63,8 +63,6 @@ | |||
63 | 63 | ||
64 | static int X509_REVOKED_cmp(const X509_REVOKED * const *a, | 64 | static int X509_REVOKED_cmp(const X509_REVOKED * const *a, |
65 | const X509_REVOKED * const *b); | 65 | const X509_REVOKED * const *b); |
66 | static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a, | ||
67 | const X509_REVOKED * const *b); | ||
68 | 66 | ||
69 | ASN1_SEQUENCE(X509_REVOKED) = { | 67 | ASN1_SEQUENCE(X509_REVOKED) = { |
70 | ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER), | 68 | ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER), |
@@ -72,43 +70,28 @@ ASN1_SEQUENCE(X509_REVOKED) = { | |||
72 | ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION) | 70 | ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION) |
73 | } ASN1_SEQUENCE_END(X509_REVOKED) | 71 | } ASN1_SEQUENCE_END(X509_REVOKED) |
74 | 72 | ||
75 | /* The X509_CRL_INFO structure needs a bit of customisation. This is actually | 73 | /* The X509_CRL_INFO structure needs a bit of customisation. |
76 | * mirroring the old behaviour: its purpose is to allow the use of | 74 | * Since we cache the original encoding the signature wont be affected by |
77 | * sk_X509_REVOKED_find to lookup revoked certificates. Unfortunately | 75 | * reordering of the revoked field. |
78 | * this will zap the original order and the signature so we keep a copy | ||
79 | * of the original positions and reorder appropriately before encoding. | ||
80 | * | ||
81 | * Might want to see if there's a better way of doing this later... | ||
82 | */ | 76 | */ |
83 | static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 77 | static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) |
84 | { | 78 | { |
85 | X509_CRL_INFO *a = (X509_CRL_INFO *)*pval; | 79 | X509_CRL_INFO *a = (X509_CRL_INFO *)*pval; |
86 | int i; | ||
87 | int (*old_cmp)(const X509_REVOKED * const *, | ||
88 | const X509_REVOKED * const *); | ||
89 | 80 | ||
90 | if(!a || !a->revoked) return 1; | 81 | if(!a || !a->revoked) return 1; |
91 | switch(operation) { | 82 | switch(operation) { |
92 | 83 | /* Just set cmp function here. We don't sort because that | |
93 | /* Save original order */ | 84 | * would affect the output of X509_CRL_print(). |
85 | */ | ||
94 | case ASN1_OP_D2I_POST: | 86 | case ASN1_OP_D2I_POST: |
95 | for (i=0; i<sk_X509_REVOKED_num(a->revoked); i++) | ||
96 | sk_X509_REVOKED_value(a->revoked,i)->sequence=i; | ||
97 | sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp); | 87 | sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp); |
98 | break; | 88 | break; |
99 | |||
100 | /* Restore original order */ | ||
101 | case ASN1_OP_I2D_PRE: | ||
102 | old_cmp=sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_seq_cmp); | ||
103 | sk_X509_REVOKED_sort(a->revoked); | ||
104 | sk_X509_REVOKED_set_cmp_func(a->revoked,old_cmp); | ||
105 | break; | ||
106 | } | 89 | } |
107 | return 1; | 90 | return 1; |
108 | } | 91 | } |
109 | 92 | ||
110 | 93 | ||
111 | ASN1_SEQUENCE_cb(X509_CRL_INFO, crl_inf_cb) = { | 94 | ASN1_SEQUENCE_enc(X509_CRL_INFO, enc, crl_inf_cb) = { |
112 | ASN1_OPT(X509_CRL_INFO, version, ASN1_INTEGER), | 95 | ASN1_OPT(X509_CRL_INFO, version, ASN1_INTEGER), |
113 | ASN1_SIMPLE(X509_CRL_INFO, sig_alg, X509_ALGOR), | 96 | ASN1_SIMPLE(X509_CRL_INFO, sig_alg, X509_ALGOR), |
114 | ASN1_SIMPLE(X509_CRL_INFO, issuer, X509_NAME), | 97 | ASN1_SIMPLE(X509_CRL_INFO, issuer, X509_NAME), |
@@ -116,7 +99,7 @@ ASN1_SEQUENCE_cb(X509_CRL_INFO, crl_inf_cb) = { | |||
116 | ASN1_OPT(X509_CRL_INFO, nextUpdate, ASN1_TIME), | 99 | ASN1_OPT(X509_CRL_INFO, nextUpdate, ASN1_TIME), |
117 | ASN1_SEQUENCE_OF_OPT(X509_CRL_INFO, revoked, X509_REVOKED), | 100 | ASN1_SEQUENCE_OF_OPT(X509_CRL_INFO, revoked, X509_REVOKED), |
118 | ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0) | 101 | ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0) |
119 | } ASN1_SEQUENCE_END_cb(X509_CRL_INFO, X509_CRL_INFO) | 102 | } ASN1_SEQUENCE_END_enc(X509_CRL_INFO, X509_CRL_INFO) |
120 | 103 | ||
121 | ASN1_SEQUENCE_ref(X509_CRL, 0, CRYPTO_LOCK_X509_CRL) = { | 104 | ASN1_SEQUENCE_ref(X509_CRL, 0, CRYPTO_LOCK_X509_CRL) = { |
122 | ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO), | 105 | ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO), |
@@ -137,12 +120,6 @@ static int X509_REVOKED_cmp(const X509_REVOKED * const *a, | |||
137 | (ASN1_STRING *)(*b)->serialNumber)); | 120 | (ASN1_STRING *)(*b)->serialNumber)); |
138 | } | 121 | } |
139 | 122 | ||
140 | static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a, | ||
141 | const X509_REVOKED * const *b) | ||
142 | { | ||
143 | return((*a)->sequence-(*b)->sequence); | ||
144 | } | ||
145 | |||
146 | int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) | 123 | int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) |
147 | { | 124 | { |
148 | X509_CRL_INFO *inf; | 125 | X509_CRL_INFO *inf; |
@@ -153,6 +130,7 @@ int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) | |||
153 | ASN1err(ASN1_F_X509_CRL_ADD0_REVOKED, ERR_R_MALLOC_FAILURE); | 130 | ASN1err(ASN1_F_X509_CRL_ADD0_REVOKED, ERR_R_MALLOC_FAILURE); |
154 | return 0; | 131 | return 0; |
155 | } | 132 | } |
133 | inf->enc.modified = 1; | ||
156 | return 1; | 134 | return 1; |
157 | } | 135 | } |
158 | 136 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/x_name.c b/src/lib/libssl/src/crypto/asn1/x_name.c index caece0f158..31f3377b64 100644 --- a/src/lib/libssl/src/crypto/asn1/x_name.c +++ b/src/lib/libssl/src/crypto/asn1/x_name.c | |||
@@ -160,21 +160,22 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, unsigned char **in, long len, cons | |||
160 | int tag, int aclass, char opt, ASN1_TLC *ctx) | 160 | int tag, int aclass, char opt, ASN1_TLC *ctx) |
161 | { | 161 | { |
162 | unsigned char *p = *in, *q; | 162 | unsigned char *p = *in, *q; |
163 | STACK *intname = NULL; | 163 | STACK *intname = NULL, **intname_pp = &intname; |
164 | int i, j, ret; | 164 | int i, j, ret; |
165 | X509_NAME *nm = NULL; | 165 | X509_NAME *nm = NULL, **nm_pp = &nm; |
166 | STACK_OF(X509_NAME_ENTRY) *entries; | 166 | STACK_OF(X509_NAME_ENTRY) *entries; |
167 | X509_NAME_ENTRY *entry; | 167 | X509_NAME_ENTRY *entry; |
168 | q = p; | 168 | q = p; |
169 | 169 | ||
170 | /* Get internal representation of Name */ | 170 | /* Get internal representation of Name */ |
171 | ret = ASN1_item_ex_d2i((ASN1_VALUE **)&intname, &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL), | 171 | ret = ASN1_item_ex_d2i((ASN1_VALUE **)intname_pp, |
172 | tag, aclass, opt, ctx); | 172 | &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL), |
173 | tag, aclass, opt, ctx); | ||
173 | 174 | ||
174 | if(ret <= 0) return ret; | 175 | if(ret <= 0) return ret; |
175 | 176 | ||
176 | if(*val) x509_name_ex_free(val, NULL); | 177 | if(*val) x509_name_ex_free(val, NULL); |
177 | if(!x509_name_ex_new((ASN1_VALUE **)&nm, NULL)) goto err; | 178 | if(!x509_name_ex_new((ASN1_VALUE **)nm_pp, NULL)) goto err; |
178 | /* We've decoded it: now cache encoding */ | 179 | /* We've decoded it: now cache encoding */ |
179 | if(!BUF_MEM_grow(nm->bytes, p - q)) goto err; | 180 | if(!BUF_MEM_grow(nm->bytes, p - q)) goto err; |
180 | memcpy(nm->bytes->data, q, p - q); | 181 | memcpy(nm->bytes->data, q, p - q); |
@@ -218,7 +219,7 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_IT | |||
218 | 219 | ||
219 | static int x509_name_encode(X509_NAME *a) | 220 | static int x509_name_encode(X509_NAME *a) |
220 | { | 221 | { |
221 | STACK *intname = NULL; | 222 | STACK *intname = NULL, **intname_pp = &intname; |
222 | int len; | 223 | int len; |
223 | unsigned char *p; | 224 | unsigned char *p; |
224 | STACK_OF(X509_NAME_ENTRY) *entries = NULL; | 225 | STACK_OF(X509_NAME_ENTRY) *entries = NULL; |
@@ -236,10 +237,12 @@ static int x509_name_encode(X509_NAME *a) | |||
236 | } | 237 | } |
237 | if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr; | 238 | if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr; |
238 | } | 239 | } |
239 | len = ASN1_item_ex_i2d((ASN1_VALUE **)&intname, NULL, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | 240 | len = ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp, NULL, |
241 | ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | ||
240 | if (!BUF_MEM_grow(a->bytes,len)) goto memerr; | 242 | if (!BUF_MEM_grow(a->bytes,len)) goto memerr; |
241 | p=(unsigned char *)a->bytes->data; | 243 | p=(unsigned char *)a->bytes->data; |
242 | ASN1_item_ex_i2d((ASN1_VALUE **)&intname, &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | 244 | ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp, |
245 | &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | ||
243 | sk_pop_free(intname, sk_internal_free); | 246 | sk_pop_free(intname, sk_internal_free); |
244 | a->modified = 0; | 247 | a->modified = 0; |
245 | return len; | 248 | return len; |
diff --git a/src/lib/libssl/src/crypto/asn1/x_pubkey.c b/src/lib/libssl/src/crypto/asn1/x_pubkey.c index d958540120..7d6d71af88 100644 --- a/src/lib/libssl/src/crypto/asn1/x_pubkey.c +++ b/src/lib/libssl/src/crypto/asn1/x_pubkey.c | |||
@@ -80,8 +80,7 @@ IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) | |||
80 | 80 | ||
81 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | 81 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) |
82 | { | 82 | { |
83 | int ok=0; | 83 | X509_PUBKEY *pk=NULL; |
84 | X509_PUBKEY *pk; | ||
85 | X509_ALGOR *a; | 84 | X509_ALGOR *a; |
86 | ASN1_OBJECT *o; | 85 | ASN1_OBJECT *o; |
87 | unsigned char *s,*p = NULL; | 86 | unsigned char *s,*p = NULL; |
@@ -104,7 +103,11 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
104 | (a->parameter->type != V_ASN1_NULL)) | 103 | (a->parameter->type != V_ASN1_NULL)) |
105 | { | 104 | { |
106 | ASN1_TYPE_free(a->parameter); | 105 | ASN1_TYPE_free(a->parameter); |
107 | a->parameter=ASN1_TYPE_new(); | 106 | if (!(a->parameter=ASN1_TYPE_new())) |
107 | { | ||
108 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
109 | goto err; | ||
110 | } | ||
108 | a->parameter->type=V_ASN1_NULL; | 111 | a->parameter->type=V_ASN1_NULL; |
109 | } | 112 | } |
110 | } | 113 | } |
@@ -118,14 +121,34 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
118 | dsa=pkey->pkey.dsa; | 121 | dsa=pkey->pkey.dsa; |
119 | dsa->write_params=0; | 122 | dsa->write_params=0; |
120 | ASN1_TYPE_free(a->parameter); | 123 | ASN1_TYPE_free(a->parameter); |
121 | i=i2d_DSAparams(dsa,NULL); | 124 | if ((i=i2d_DSAparams(dsa,NULL)) <= 0) |
122 | if ((p=(unsigned char *)OPENSSL_malloc(i)) == NULL) goto err; | 125 | goto err; |
126 | if (!(p=(unsigned char *)OPENSSL_malloc(i))) | ||
127 | { | ||
128 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
129 | goto err; | ||
130 | } | ||
123 | pp=p; | 131 | pp=p; |
124 | i2d_DSAparams(dsa,&pp); | 132 | i2d_DSAparams(dsa,&pp); |
125 | a->parameter=ASN1_TYPE_new(); | 133 | if (!(a->parameter=ASN1_TYPE_new())) |
134 | { | ||
135 | OPENSSL_free(p); | ||
136 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
137 | goto err; | ||
138 | } | ||
126 | a->parameter->type=V_ASN1_SEQUENCE; | 139 | a->parameter->type=V_ASN1_SEQUENCE; |
127 | a->parameter->value.sequence=ASN1_STRING_new(); | 140 | if (!(a->parameter->value.sequence=ASN1_STRING_new())) |
128 | ASN1_STRING_set(a->parameter->value.sequence,p,i); | 141 | { |
142 | OPENSSL_free(p); | ||
143 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
144 | goto err; | ||
145 | } | ||
146 | if (!ASN1_STRING_set(a->parameter->value.sequence,p,i)) | ||
147 | { | ||
148 | OPENSSL_free(p); | ||
149 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
150 | goto err; | ||
151 | } | ||
129 | OPENSSL_free(p); | 152 | OPENSSL_free(p); |
130 | } | 153 | } |
131 | else | 154 | else |
@@ -143,7 +166,11 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
143 | } | 166 | } |
144 | p=s; | 167 | p=s; |
145 | i2d_PublicKey(pkey,&p); | 168 | i2d_PublicKey(pkey,&p); |
146 | if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err; | 169 | if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) |
170 | { | ||
171 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
172 | goto err; | ||
173 | } | ||
147 | /* Set number of unused bits to zero */ | 174 | /* Set number of unused bits to zero */ |
148 | pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); | 175 | pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); |
149 | pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT; | 176 | pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT; |
@@ -159,12 +186,11 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | |||
159 | X509_PUBKEY_free(*x); | 186 | X509_PUBKEY_free(*x); |
160 | 187 | ||
161 | *x=pk; | 188 | *x=pk; |
162 | pk=NULL; | ||
163 | 189 | ||
164 | ok=1; | 190 | return 1; |
165 | err: | 191 | err: |
166 | if (pk != NULL) X509_PUBKEY_free(pk); | 192 | if (pk != NULL) X509_PUBKEY_free(pk); |
167 | return(ok); | 193 | return 0; |
168 | } | 194 | } |
169 | 195 | ||
170 | EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) | 196 | EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) |
diff --git a/src/lib/libssl/src/crypto/bf/bf_skey.c b/src/lib/libssl/src/crypto/bf/bf_skey.c index 3673cdee6e..fc5bebefce 100644 --- a/src/lib/libssl/src/crypto/bf/bf_skey.c +++ b/src/lib/libssl/src/crypto/bf/bf_skey.c | |||
@@ -58,11 +58,12 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <openssl/crypto.h> | ||
61 | #include <openssl/blowfish.h> | 62 | #include <openssl/blowfish.h> |
62 | #include "bf_locl.h" | 63 | #include "bf_locl.h" |
63 | #include "bf_pi.h" | 64 | #include "bf_pi.h" |
64 | 65 | ||
65 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data) | 66 | FIPS_NON_FIPS_VCIPHER_Init(BF) |
66 | { | 67 | { |
67 | int i; | 68 | int i; |
68 | BF_LONG *p,ri,in[2]; | 69 | BF_LONG *p,ri,in[2]; |
diff --git a/src/lib/libssl/src/crypto/bf/blowfish.h b/src/lib/libssl/src/crypto/bf/blowfish.h index cd49e85ab2..b4d8774961 100644 --- a/src/lib/libssl/src/crypto/bf/blowfish.h +++ b/src/lib/libssl/src/crypto/bf/blowfish.h | |||
@@ -104,7 +104,10 @@ typedef struct bf_key_st | |||
104 | BF_LONG S[4*256]; | 104 | BF_LONG S[4*256]; |
105 | } BF_KEY; | 105 | } BF_KEY; |
106 | 106 | ||
107 | 107 | ||
108 | #ifdef OPENSSL_FIPS | ||
109 | void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data); | ||
110 | #endif | ||
108 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); | 111 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); |
109 | 112 | ||
110 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); | 113 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); |
diff --git a/src/lib/libssl/src/crypto/bio/b_print.c b/src/lib/libssl/src/crypto/bio/b_print.c index 880dc69303..8b753e7ca0 100644 --- a/src/lib/libssl/src/crypto/bio/b_print.c +++ b/src/lib/libssl/src/crypto/bio/b_print.c | |||
@@ -641,7 +641,7 @@ fmtfp( | |||
641 | multiplying by a factor of 10 */ | 641 | multiplying by a factor of 10 */ |
642 | fracpart = roundv((pow10(max)) * (ufvalue - intpart)); | 642 | fracpart = roundv((pow10(max)) * (ufvalue - intpart)); |
643 | 643 | ||
644 | if (fracpart >= pow10(max)) { | 644 | if (fracpart >= (long)pow10(max)) { |
645 | intpart++; | 645 | intpart++; |
646 | fracpart -= (long)pow10(max); | 646 | fracpart -= (long)pow10(max); |
647 | } | 647 | } |
diff --git a/src/lib/libssl/src/crypto/bio/bio.h b/src/lib/libssl/src/crypto/bio/bio.h index fbbc16d00c..2eb703830f 100644 --- a/src/lib/libssl/src/crypto/bio/bio.h +++ b/src/lib/libssl/src/crypto/bio/bio.h | |||
@@ -347,6 +347,7 @@ typedef struct bio_f_buffer_ctx_struct | |||
347 | #define BIO_C_NWRITE0 145 | 347 | #define BIO_C_NWRITE0 145 |
348 | #define BIO_C_NWRITE 146 | 348 | #define BIO_C_NWRITE 146 |
349 | #define BIO_C_RESET_READ_REQUEST 147 | 349 | #define BIO_C_RESET_READ_REQUEST 147 |
350 | #define BIO_C_SET_MD_CTX 148 | ||
350 | 351 | ||
351 | 352 | ||
352 | #define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) | 353 | #define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) |
diff --git a/src/lib/libssl/src/crypto/bio/bss_file.c b/src/lib/libssl/src/crypto/bio/bss_file.c index 9cdf159f82..8034ac93f9 100644 --- a/src/lib/libssl/src/crypto/bio/bss_file.c +++ b/src/lib/libssl/src/crypto/bio/bss_file.c | |||
@@ -213,13 +213,14 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
213 | b->shutdown=(int)num&BIO_CLOSE; | 213 | b->shutdown=(int)num&BIO_CLOSE; |
214 | b->ptr=(char *)ptr; | 214 | b->ptr=(char *)ptr; |
215 | b->init=1; | 215 | b->init=1; |
216 | { | ||
216 | #if defined(OPENSSL_SYS_WINDOWS) | 217 | #if defined(OPENSSL_SYS_WINDOWS) |
218 | int fd = fileno((FILE*)ptr); | ||
217 | if (num & BIO_FP_TEXT) | 219 | if (num & BIO_FP_TEXT) |
218 | _setmode(fileno((FILE *)ptr),_O_TEXT); | 220 | _setmode(fd,_O_TEXT); |
219 | else | 221 | else |
220 | _setmode(fileno((FILE *)ptr),_O_BINARY); | 222 | _setmode(fd,_O_BINARY); |
221 | #elif defined(OPENSSL_SYS_MSDOS) | 223 | #elif defined(OPENSSL_SYS_MSDOS) |
222 | { | ||
223 | int fd = fileno((FILE*)ptr); | 224 | int fd = fileno((FILE*)ptr); |
224 | /* Set correct text/binary mode */ | 225 | /* Set correct text/binary mode */ |
225 | if (num & BIO_FP_TEXT) | 226 | if (num & BIO_FP_TEXT) |
@@ -235,13 +236,14 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
235 | else | 236 | else |
236 | _setmode(fd,_O_BINARY); | 237 | _setmode(fd,_O_BINARY); |
237 | } | 238 | } |
238 | } | ||
239 | #elif defined(OPENSSL_SYS_OS2) | 239 | #elif defined(OPENSSL_SYS_OS2) |
240 | int fd = fileno((FILE*)ptr); | ||
240 | if (num & BIO_FP_TEXT) | 241 | if (num & BIO_FP_TEXT) |
241 | setmode(fileno((FILE *)ptr), O_TEXT); | 242 | setmode(fd, O_TEXT); |
242 | else | 243 | else |
243 | setmode(fileno((FILE *)ptr), O_BINARY); | 244 | setmode(fd, O_BINARY); |
244 | #endif | 245 | #endif |
246 | } | ||
245 | break; | 247 | break; |
246 | case BIO_C_SET_FILENAME: | 248 | case BIO_C_SET_FILENAME: |
247 | file_free(b); | 249 | file_free(b); |
@@ -264,7 +266,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
264 | ret=0; | 266 | ret=0; |
265 | break; | 267 | break; |
266 | } | 268 | } |
267 | #if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) | 269 | #if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) |
268 | if (!(num & BIO_FP_TEXT)) | 270 | if (!(num & BIO_FP_TEXT)) |
269 | strcat(p,"b"); | 271 | strcat(p,"b"); |
270 | else | 272 | else |
diff --git a/src/lib/libssl/src/crypto/bn/asm/ia64.S b/src/lib/libssl/src/crypto/bn/asm/ia64.S index 7dfda85566..7b82b820e6 100644 --- a/src/lib/libssl/src/crypto/bn/asm/ia64.S +++ b/src/lib/libssl/src/crypto/bn/asm/ia64.S | |||
@@ -1,6 +1,6 @@ | |||
1 | .explicit | 1 | .explicit |
2 | .text | 2 | .text |
3 | .ident "ia64.S, Version 2.0" | 3 | .ident "ia64.S, Version 2.1" |
4 | .ident "IA-64 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>" | 4 | .ident "IA-64 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>" |
5 | 5 | ||
6 | // | 6 | // |
@@ -35,7 +35,7 @@ | |||
35 | // What does it mean? You might ratiocinate that the original code | 35 | // What does it mean? You might ratiocinate that the original code |
36 | // should run just faster... Because sum of latencies is smaller... | 36 | // should run just faster... Because sum of latencies is smaller... |
37 | // Wrong! Note that getf latency increased. This means that if a loop is | 37 | // Wrong! Note that getf latency increased. This means that if a loop is |
38 | // scheduled for lower latency (and they are), then it will suffer from | 38 | // scheduled for lower latency (as they were), then it will suffer from |
39 | // stall condition and the code will therefore turn anti-scalable, e.g. | 39 | // stall condition and the code will therefore turn anti-scalable, e.g. |
40 | // original bn_mul_words spun at 5*n or 2.5 times slower than expected | 40 | // original bn_mul_words spun at 5*n or 2.5 times slower than expected |
41 | // on Itanium2! What to do? Reschedule loops for Itanium2? But then | 41 | // on Itanium2! What to do? Reschedule loops for Itanium2? But then |
@@ -145,6 +145,12 @@ | |||
145 | // -Drum=nop.m in command line. | 145 | // -Drum=nop.m in command line. |
146 | // | 146 | // |
147 | 147 | ||
148 | #if defined(_HPUX_SOURCE) && !defined(_LP64) | ||
149 | #define ADDP addp4 | ||
150 | #else | ||
151 | #define ADDP add | ||
152 | #endif | ||
153 | |||
148 | #if 1 | 154 | #if 1 |
149 | // | 155 | // |
150 | // bn_[add|sub]_words routines. | 156 | // bn_[add|sub]_words routines. |
@@ -178,27 +184,12 @@ bn_add_words: | |||
178 | brp.loop.imp .L_bn_add_words_ctop,.L_bn_add_words_cend-16 | 184 | brp.loop.imp .L_bn_add_words_ctop,.L_bn_add_words_cend-16 |
179 | } | 185 | } |
180 | .body | 186 | .body |
181 | { .mib; | 187 | { .mib; ADDP r14=0,r32 // rp |
182 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
183 | addp4 r14=0,r32 // rp | ||
184 | #else | ||
185 | mov r14=r32 // rp | ||
186 | #endif | ||
187 | mov r9=pr };; | 188 | mov r9=pr };; |
188 | { .mii; | 189 | { .mii; ADDP r15=0,r33 // ap |
189 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
190 | addp4 r15=0,r33 // ap | ||
191 | #else | ||
192 | mov r15=r33 // ap | ||
193 | #endif | ||
194 | mov ar.lc=r10 | 190 | mov ar.lc=r10 |
195 | mov ar.ec=6 } | 191 | mov ar.ec=6 } |
196 | { .mib; | 192 | { .mib; ADDP r16=0,r34 // bp |
197 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
198 | addp4 r16=0,r34 // bp | ||
199 | #else | ||
200 | mov r16=r34 // bp | ||
201 | #endif | ||
202 | mov pr.rot=1<<16 };; | 193 | mov pr.rot=1<<16 };; |
203 | 194 | ||
204 | .L_bn_add_words_ctop: | 195 | .L_bn_add_words_ctop: |
@@ -246,27 +237,12 @@ bn_sub_words: | |||
246 | brp.loop.imp .L_bn_sub_words_ctop,.L_bn_sub_words_cend-16 | 237 | brp.loop.imp .L_bn_sub_words_ctop,.L_bn_sub_words_cend-16 |
247 | } | 238 | } |
248 | .body | 239 | .body |
249 | { .mib; | 240 | { .mib; ADDP r14=0,r32 // rp |
250 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
251 | addp4 r14=0,r32 // rp | ||
252 | #else | ||
253 | mov r14=r32 // rp | ||
254 | #endif | ||
255 | mov r9=pr };; | 241 | mov r9=pr };; |
256 | { .mii; | 242 | { .mii; ADDP r15=0,r33 // ap |
257 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
258 | addp4 r15=0,r33 // ap | ||
259 | #else | ||
260 | mov r15=r33 // ap | ||
261 | #endif | ||
262 | mov ar.lc=r10 | 243 | mov ar.lc=r10 |
263 | mov ar.ec=6 } | 244 | mov ar.ec=6 } |
264 | { .mib; | 245 | { .mib; ADDP r16=0,r34 // bp |
265 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | ||
266 | addp4 r16=0,r34 // bp | ||
267 | #else | ||
268 | mov r16=r34 // bp | ||
269 | #endif | ||
270 | mov pr.rot=1<<16 };; | 246 | mov pr.rot=1<<16 };; |
271 | 247 | ||
272 | .L_bn_sub_words_ctop: | 248 | .L_bn_sub_words_ctop: |
@@ -332,16 +308,10 @@ bn_mul_words: | |||
332 | 308 | ||
333 | #ifndef XMA_TEMPTATION | 309 | #ifndef XMA_TEMPTATION |
334 | 310 | ||
335 | { .mii; | 311 | { .mmi; ADDP r14=0,r32 // rp |
336 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 312 | ADDP r15=0,r33 // ap |
337 | addp4 r14=0,r32 // rp | ||
338 | addp4 r15=0,r33 // ap | ||
339 | #else | ||
340 | mov r14=r32 // rp | ||
341 | mov r15=r33 // ap | ||
342 | #endif | ||
343 | mov ar.lc=r10 } | 313 | mov ar.lc=r10 } |
344 | { .mii; mov r40=0 // serves as r35 at first (p27) | 314 | { .mmi; mov r40=0 // serves as r35 at first (p27) |
345 | mov ar.ec=13 };; | 315 | mov ar.ec=13 };; |
346 | 316 | ||
347 | // This loop spins in 2*(n+12) ticks. It's scheduled for data in Itanium | 317 | // This loop spins in 2*(n+12) ticks. It's scheduled for data in Itanium |
@@ -424,89 +394,64 @@ bn_mul_words: | |||
424 | .global bn_mul_add_words# | 394 | .global bn_mul_add_words# |
425 | .proc bn_mul_add_words# | 395 | .proc bn_mul_add_words# |
426 | .align 64 | 396 | .align 64 |
427 | //.skip 0 // makes the loop split at 64-byte boundary | 397 | .skip 48 // makes the loop body aligned at 64-byte boundary |
428 | bn_mul_add_words: | 398 | bn_mul_add_words: |
429 | .prologue | 399 | .prologue |
430 | .fframe 0 | 400 | .fframe 0 |
431 | .save ar.pfs,r2 | 401 | .save ar.pfs,r2 |
432 | { .mii; alloc r2=ar.pfs,4,12,0,16 | ||
433 | cmp4.le p6,p0=r34,r0 };; | ||
434 | { .mfb; mov r8=r0 // return value | ||
435 | (p6) br.ret.spnt.many b0 };; | ||
436 | |||
437 | .save ar.lc,r3 | 402 | .save ar.lc,r3 |
438 | { .mii; sub r10=r34,r0,1 | 403 | .save pr,r9 |
439 | mov r3=ar.lc | 404 | { .mmi; alloc r2=ar.pfs,4,4,0,8 |
440 | mov r9=pr };; | 405 | cmp4.le p6,p0=r34,r0 |
406 | mov r3=ar.lc };; | ||
407 | { .mib; mov r8=r0 // return value | ||
408 | sub r10=r34,r0,1 | ||
409 | (p6) br.ret.spnt.many b0 };; | ||
441 | 410 | ||
442 | .body | 411 | .body |
443 | { .mib; setf.sig f8=r35 // w | 412 | { .mib; setf.sig f8=r35 // w |
444 | mov pr.rot=0x800001<<16 | 413 | mov r9=pr |
445 | // ------^----- serves as (p50) at first (p27) | ||
446 | brp.loop.imp .L_bn_mul_add_words_ctop,.L_bn_mul_add_words_cend-16 | 414 | brp.loop.imp .L_bn_mul_add_words_ctop,.L_bn_mul_add_words_cend-16 |
447 | } | 415 | } |
448 | { .mii; | 416 | { .mmi; ADDP r14=0,r32 // rp |
449 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 417 | ADDP r15=0,r33 // ap |
450 | addp4 r14=0,r32 // rp | ||
451 | addp4 r15=0,r33 // ap | ||
452 | #else | ||
453 | mov r14=r32 // rp | ||
454 | mov r15=r33 // ap | ||
455 | #endif | ||
456 | mov ar.lc=r10 } | 418 | mov ar.lc=r10 } |
457 | { .mii; mov r40=0 // serves as r35 at first (p27) | 419 | { .mii; ADDP r16=0,r32 // rp copy |
458 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 420 | mov pr.rot=0x2001<<16 |
459 | addp4 r18=0,r32 // rp copy | 421 | // ------^----- serves as (p40) at first (p27) |
460 | #else | 422 | mov ar.ec=11 };; |
461 | mov r18=r32 // rp copy | 423 | |
462 | #endif | 424 | // This loop spins in 3*(n+10) ticks on Itanium and in 2*(n+10) on |
463 | mov ar.ec=15 };; | 425 | // Itanium 2. Yes, unlike previous versions it scales:-) Previous |
464 | 426 | // version was peforming *all* additions in IALU and was starving | |
465 | // This loop spins in 3*(n+14) ticks on Itanium and should spin in | 427 | // for those even on Itanium 2. In this version one addition is |
466 | // 2*(n+14) on "wider" IA-64 implementations (to be verified with new | 428 | // moved to FPU and is folded with multiplication. This is at cost |
467 | // µ-architecture manuals as they become available). As usual it's | 429 | // of propogating the result from previous call to this subroutine |
468 | // possible to compress the epilogue, down to 10 in this case, at the | 430 | // to L2 cache... In other words negligible even for shorter keys. |
469 | // cost of scalability. Compressed (and therefore non-scalable) loop | 431 | // *Overall* performance improvement [over previous version] varies |
470 | // running at 3*(n+11) would buy you ~10% on Itanium but take ~35% | 432 | // from 11 to 22 percent depending on key length. |
471 | // from "wider" IA-64 so let it be scalable! Special attention was | ||
472 | // paid for having the loop body split at 64-byte boundary. ld8 is | ||
473 | // scheduled for L1 cache as the data is more than likely there. | ||
474 | // Indeed, bn_mul_words has put it there a moment ago:-) | ||
475 | .L_bn_mul_add_words_ctop: | 433 | .L_bn_mul_add_words_ctop: |
476 | { .mfi; (p25) getf.sig r36=f52 // low | 434 | .pred.rel "mutex",p40,p42 |
477 | (p21) xmpy.lu f48=f37,f8 | 435 | { .mfi; (p23) getf.sig r36=f45 // low |
478 | (p28) cmp.ltu p54,p50=r41,r39 } | 436 | (p20) xma.lu f42=f36,f8,f50 // low |
479 | { .mfi; (p16) ldf8 f32=[r15],8 | 437 | (p40) add r39=r39,r35 } // (p27) |
480 | (p21) xmpy.hu f40=f37,f8 | 438 | { .mfi; (p16) ldf8 f32=[r15],8 // *(ap++) |
481 | (p28) add r45=r45,r41 };; | 439 | (p20) xma.hu f36=f36,f8,f50 // high |
482 | { .mii; (p25) getf.sig r32=f44 // high | 440 | (p42) add r39=r39,r35,1 };; // (p27) |
483 | .pred.rel "mutex",p50,p54 | 441 | { .mmi; (p24) getf.sig r32=f40 // high |
484 | (p50) add r40=r38,r35 // (p27) | 442 | (p16) ldf8 f46=[r16],8 // *(rp1++) |
485 | (p54) add r40=r38,r35,1 } // (p27) | 443 | (p40) cmp.ltu p41,p39=r39,r35 } // (p27) |
486 | { .mfb; (p28) cmp.ltu.unc p60,p0=r45,r41 | 444 | { .mib; (p26) st8 [r14]=r39,8 // *(rp2++) |
487 | (p0) nop.f 0x0 | 445 | (p42) cmp.leu p41,p39=r39,r35 // (p27) |
488 | (p0) nop.b 0x0 } | ||
489 | { .mii; (p27) ld8 r44=[r18],8 | ||
490 | (p62) cmp.eq.or p61,p0=-1,r46 | ||
491 | (p62) add r46=1,r46 } | ||
492 | { .mfb; (p30) st8 [r14]=r47,8 | ||
493 | (p0) nop.f 0x0 | ||
494 | br.ctop.sptk .L_bn_mul_add_words_ctop};; | 446 | br.ctop.sptk .L_bn_mul_add_words_ctop};; |
495 | .L_bn_mul_add_words_cend: | 447 | .L_bn_mul_add_words_cend: |
496 | 448 | ||
497 | { .mii; nop.m 0x0 | 449 | { .mmi; .pred.rel "mutex",p40,p42 |
498 | .pred.rel "mutex",p53,p57 | 450 | (p40) add r8=r35,r0 |
499 | (p53) add r8=r38,r0 | 451 | (p42) add r8=r35,r0,1 |
500 | (p57) add r8=r38,r0,1 } | 452 | mov pr=r9,0x1ffff } |
501 | { .mfb; nop.m 0x0 | 453 | { .mib; rum 1<<5 // clear um.mfh |
502 | nop.f 0x0 | 454 | mov ar.lc=r3 |
503 | nop.b 0x0 };; | ||
504 | { .mii; | ||
505 | (p63) add r8=1,r8 | ||
506 | mov pr=r9,0x1ffff | ||
507 | mov ar.lc=r3 } | ||
508 | { .mfb; rum 1<<5 // clear um.mfh | ||
509 | nop.f 0x0 | ||
510 | br.ret.sptk.many b0 };; | 455 | br.ret.sptk.many b0 };; |
511 | .endp bn_mul_add_words# | 456 | .endp bn_mul_add_words# |
512 | #endif | 457 | #endif |
@@ -527,7 +472,8 @@ bn_sqr_words: | |||
527 | sxt4 r34=r34 };; | 472 | sxt4 r34=r34 };; |
528 | { .mii; cmp.le p6,p0=r34,r0 | 473 | { .mii; cmp.le p6,p0=r34,r0 |
529 | mov r8=r0 } // return value | 474 | mov r8=r0 } // return value |
530 | { .mfb; nop.f 0x0 | 475 | { .mfb; ADDP r32=0,r32 |
476 | nop.f 0x0 | ||
531 | (p6) br.ret.spnt.many b0 };; | 477 | (p6) br.ret.spnt.many b0 };; |
532 | 478 | ||
533 | .save ar.lc,r3 | 479 | .save ar.lc,r3 |
@@ -536,11 +482,7 @@ bn_sqr_words: | |||
536 | mov r9=pr };; | 482 | mov r9=pr };; |
537 | 483 | ||
538 | .body | 484 | .body |
539 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 485 | { .mib; ADDP r33=0,r33 |
540 | { .mii; addp4 r32=0,r32 | ||
541 | addp4 r33=0,r33 };; | ||
542 | #endif | ||
543 | { .mib; | ||
544 | mov pr.rot=1<<16 | 486 | mov pr.rot=1<<16 |
545 | brp.loop.imp .L_bn_sqr_words_ctop,.L_bn_sqr_words_cend-16 | 487 | brp.loop.imp .L_bn_sqr_words_ctop,.L_bn_sqr_words_cend-16 |
546 | } | 488 | } |
@@ -605,7 +547,7 @@ bn_sqr_comba8: | |||
605 | .prologue | 547 | .prologue |
606 | .fframe 0 | 548 | .fframe 0 |
607 | .save ar.pfs,r2 | 549 | .save ar.pfs,r2 |
608 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 550 | #if defined(_HPUX_SOURCE) && !defined(_LP64) |
609 | { .mii; alloc r2=ar.pfs,2,1,0,0 | 551 | { .mii; alloc r2=ar.pfs,2,1,0,0 |
610 | addp4 r33=0,r33 | 552 | addp4 r33=0,r33 |
611 | addp4 r32=0,r32 };; | 553 | addp4 r32=0,r32 };; |
@@ -631,6 +573,10 @@ bn_sqr_comba8: | |||
631 | // clause in Itanium µ-architecture manual? Comments are welcomed and | 573 | // clause in Itanium µ-architecture manual? Comments are welcomed and |
632 | // highly appreciated. | 574 | // highly appreciated. |
633 | // | 575 | // |
576 | // On Itanium 2 it takes ~190 ticks. This is because of stalls on | ||
577 | // result from getf.sig. I do nothing about it at this point for | ||
578 | // reasons depicted below. | ||
579 | // | ||
634 | // However! It should be noted that even 160 ticks is darn good result | 580 | // However! It should be noted that even 160 ticks is darn good result |
635 | // as it's over 10 (yes, ten, spelled as t-e-n) times faster than the | 581 | // as it's over 10 (yes, ten, spelled as t-e-n) times faster than the |
636 | // C version (compiled with gcc with inline assembler). I really | 582 | // C version (compiled with gcc with inline assembler). I really |
@@ -673,7 +619,7 @@ bn_mul_comba8: | |||
673 | .prologue | 619 | .prologue |
674 | .fframe 0 | 620 | .fframe 0 |
675 | .save ar.pfs,r2 | 621 | .save ar.pfs,r2 |
676 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 622 | #if defined(_HPUX_SOURCE) && !defined(_LP64) |
677 | { .mii; alloc r2=ar.pfs,3,0,0,0 | 623 | { .mii; alloc r2=ar.pfs,3,0,0,0 |
678 | addp4 r33=0,r33 | 624 | addp4 r33=0,r33 |
679 | addp4 r34=0,r34 };; | 625 | addp4 r34=0,r34 };; |
@@ -1231,7 +1177,7 @@ bn_sqr_comba4: | |||
1231 | .prologue | 1177 | .prologue |
1232 | .fframe 0 | 1178 | .fframe 0 |
1233 | .save ar.pfs,r2 | 1179 | .save ar.pfs,r2 |
1234 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 1180 | #if defined(_HPUX_SOURCE) && !defined(_LP64) |
1235 | { .mii; alloc r2=ar.pfs,2,1,0,0 | 1181 | { .mii; alloc r2=ar.pfs,2,1,0,0 |
1236 | addp4 r32=0,r32 | 1182 | addp4 r32=0,r32 |
1237 | addp4 r33=0,r33 };; | 1183 | addp4 r33=0,r33 };; |
@@ -1264,7 +1210,7 @@ bn_mul_comba4: | |||
1264 | .prologue | 1210 | .prologue |
1265 | .fframe 0 | 1211 | .fframe 0 |
1266 | .save ar.pfs,r2 | 1212 | .save ar.pfs,r2 |
1267 | #if defined(_HPUX_SOURCE) && defined(_ILP32) | 1213 | #if defined(_HPUX_SOURCE) && !defined(_LP64) |
1268 | { .mii; alloc r2=ar.pfs,3,0,0,0 | 1214 | { .mii; alloc r2=ar.pfs,3,0,0,0 |
1269 | addp4 r33=0,r33 | 1215 | addp4 r33=0,r33 |
1270 | addp4 r34=0,r34 };; | 1216 | addp4 r34=0,r34 };; |
@@ -1448,8 +1394,8 @@ bn_mul_comba4: | |||
1448 | #define I r21 | 1394 | #define I r21 |
1449 | 1395 | ||
1450 | #if 0 | 1396 | #if 0 |
1451 | // Some preprocessors (most notably HP-UX) apper to be allergic to | 1397 | // Some preprocessors (most notably HP-UX) appear to be allergic to |
1452 | // macros enclosed to parenthesis as these three will be. | 1398 | // macros enclosed to parenthesis [as these three were]. |
1453 | #define cont p16 | 1399 | #define cont p16 |
1454 | #define break p0 // p20 | 1400 | #define break p0 // p20 |
1455 | #define equ p24 | 1401 | #define equ p24 |
@@ -1581,9 +1527,18 @@ bn_div_words: | |||
1581 | // output: f8 = (int)(a/b) | 1527 | // output: f8 = (int)(a/b) |
1582 | // clobbered: f8,f9,f10,f11,pred | 1528 | // clobbered: f8,f9,f10,f11,pred |
1583 | pred=p15 | 1529 | pred=p15 |
1584 | // This procedure is essentially Intel code and therefore is | 1530 | // One can argue that this snippet is copyrighted to Intel |
1585 | // copyrighted to Intel Corporation (I suppose...). It's sligtly | 1531 | // Corporation, as it's essentially identical to one of those |
1586 | // modified for specific needs. | 1532 | // found in "Divide, Square Root and Remainder" section at |
1533 | // http://www.intel.com/software/products/opensource/libraries/num.htm. | ||
1534 | // Yes, I admit that the referred code was used as template, | ||
1535 | // but after I realized that there hardly is any other instruction | ||
1536 | // sequence which would perform this operation. I mean I figure that | ||
1537 | // any independent attempt to implement high-performance division | ||
1538 | // will result in code virtually identical to the Intel code. It | ||
1539 | // should be noted though that below division kernel is 1 cycle | ||
1540 | // faster than Intel one (note commented splits:-), not to mention | ||
1541 | // original prologue (rather lack of one) and epilogue. | ||
1587 | .align 32 | 1542 | .align 32 |
1588 | .skip 16 | 1543 | .skip 16 |
1589 | .L_udiv64_32_b6: | 1544 | .L_udiv64_32_b6: |
diff --git a/src/lib/libssl/src/crypto/bn/bn_mont.c b/src/lib/libssl/src/crypto/bn/bn_mont.c index c9ebdbaabe..b79b1b60da 100644 --- a/src/lib/libssl/src/crypto/bn/bn_mont.c +++ b/src/lib/libssl/src/crypto/bn/bn_mont.c | |||
@@ -273,7 +273,7 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
273 | 273 | ||
274 | BN_init(&Ri); | 274 | BN_init(&Ri); |
275 | R= &(mont->RR); /* grab RR as a temp */ | 275 | R= &(mont->RR); /* grab RR as a temp */ |
276 | BN_copy(&(mont->N),mod); /* Set N */ | 276 | if (!BN_copy(&(mont->N),mod)) goto err; /* Set N */ |
277 | mont->N.neg = 0; | 277 | mont->N.neg = 0; |
278 | 278 | ||
279 | #ifdef MONT_WORD | 279 | #ifdef MONT_WORD |
diff --git a/src/lib/libssl/src/crypto/bn/bntest.c b/src/lib/libssl/src/crypto/bn/bntest.c index 8ef733013d..79d813d85e 100644 --- a/src/lib/libssl/src/crypto/bn/bntest.c +++ b/src/lib/libssl/src/crypto/bn/bntest.c | |||
@@ -232,7 +232,7 @@ int main(int argc, char *argv[]) | |||
232 | EXIT(0); | 232 | EXIT(0); |
233 | err: | 233 | err: |
234 | BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices | 234 | BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices |
235 | * the failure, see test_bn in test/Makefile.ssl*/ | 235 | * the failure, see test_bn in test/Makefile */ |
236 | BIO_flush(out); | 236 | BIO_flush(out); |
237 | ERR_load_crypto_strings(); | 237 | ERR_load_crypto_strings(); |
238 | ERR_print_errors_fp(stderr); | 238 | ERR_print_errors_fp(stderr); |
diff --git a/src/lib/libssl/src/crypto/cast/c_skey.c b/src/lib/libssl/src/crypto/cast/c_skey.c index 76e40005c9..dc4791a8cf 100644 --- a/src/lib/libssl/src/crypto/cast/c_skey.c +++ b/src/lib/libssl/src/crypto/cast/c_skey.c | |||
@@ -56,7 +56,9 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/crypto.h> | ||
59 | #include <openssl/cast.h> | 60 | #include <openssl/cast.h> |
61 | |||
60 | #include "cast_lcl.h" | 62 | #include "cast_lcl.h" |
61 | #include "cast_s.h" | 63 | #include "cast_s.h" |
62 | 64 | ||
@@ -72,7 +74,7 @@ | |||
72 | #define S6 CAST_S_table6 | 74 | #define S6 CAST_S_table6 |
73 | #define S7 CAST_S_table7 | 75 | #define S7 CAST_S_table7 |
74 | 76 | ||
75 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data) | 77 | FIPS_NON_FIPS_VCIPHER_Init(CAST) |
76 | { | 78 | { |
77 | CAST_LONG x[16]; | 79 | CAST_LONG x[16]; |
78 | CAST_LONG z[16]; | 80 | CAST_LONG z[16]; |
diff --git a/src/lib/libssl/src/crypto/cast/cast.h b/src/lib/libssl/src/crypto/cast/cast.h index b28e4e4f3b..9e300178d9 100644 --- a/src/lib/libssl/src/crypto/cast/cast.h +++ b/src/lib/libssl/src/crypto/cast/cast.h | |||
@@ -81,7 +81,10 @@ typedef struct cast_key_st | |||
81 | int short_key; /* Use reduced rounds for short key */ | 81 | int short_key; /* Use reduced rounds for short key */ |
82 | } CAST_KEY; | 82 | } CAST_KEY; |
83 | 83 | ||
84 | 84 | ||
85 | #ifdef OPENSSL_FIPS | ||
86 | void private_CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); | ||
87 | #endif | ||
85 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); | 88 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); |
86 | void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out,CAST_KEY *key, | 89 | void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out,CAST_KEY *key, |
87 | int enc); | 90 | int enc); |
diff --git a/src/lib/libssl/src/crypto/comp/c_zlib.c b/src/lib/libssl/src/crypto/comp/c_zlib.c index 8c0876151a..1bd2850d15 100644 --- a/src/lib/libssl/src/crypto/comp/c_zlib.c +++ b/src/lib/libssl/src/crypto/comp/c_zlib.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include <openssl/objects.h> | 4 | #include <openssl/objects.h> |
5 | #include <openssl/comp.h> | 5 | #include <openssl/comp.h> |
6 | #include <openssl/err.h> | ||
6 | 7 | ||
7 | COMP_METHOD *COMP_zlib(void ); | 8 | COMP_METHOD *COMP_zlib(void ); |
8 | 9 | ||
@@ -189,7 +190,17 @@ COMP_METHOD *COMP_zlib(void) | |||
189 | if (!zlib_loaded) | 190 | if (!zlib_loaded) |
190 | { | 191 | { |
191 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | 192 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) |
192 | zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0); | 193 | zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0); |
194 | if (!zlib_dso) | ||
195 | { | ||
196 | zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0); | ||
197 | if (zlib_dso) | ||
198 | { | ||
199 | /* Clear the errors from the first failed | ||
200 | DSO_load() */ | ||
201 | ERR_clear_error(); | ||
202 | } | ||
203 | } | ||
193 | #else | 204 | #else |
194 | zlib_dso = DSO_load(NULL, "z", NULL, 0); | 205 | zlib_dso = DSO_load(NULL, "z", NULL, 0); |
195 | #endif | 206 | #endif |
diff --git a/src/lib/libssl/src/crypto/conf/conf_def.c b/src/lib/libssl/src/crypto/conf/conf_def.c index 2e9f52f1fd..b5a876ae68 100644 --- a/src/lib/libssl/src/crypto/conf/conf_def.c +++ b/src/lib/libssl/src/crypto/conf/conf_def.c | |||
@@ -632,6 +632,11 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from) | |||
632 | BUF_MEM_grow_clean(buf,(strlen(p)+len-(e-from))); | 632 | BUF_MEM_grow_clean(buf,(strlen(p)+len-(e-from))); |
633 | while (*p) | 633 | while (*p) |
634 | buf->data[to++]= *(p++); | 634 | buf->data[to++]= *(p++); |
635 | |||
636 | /* Since we change the pointer 'from', we also have | ||
637 | to change the perceived length of the string it | ||
638 | points at. /RL */ | ||
639 | len -= e-from; | ||
635 | from=e; | 640 | from=e; |
636 | } | 641 | } |
637 | else | 642 | else |
diff --git a/src/lib/libssl/src/crypto/cryptlib.c b/src/lib/libssl/src/crypto/cryptlib.c index 2924def2bb..fef0afb29f 100644 --- a/src/lib/libssl/src/crypto/cryptlib.c +++ b/src/lib/libssl/src/crypto/cryptlib.c | |||
@@ -105,7 +105,9 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] = | |||
105 | "engine", | 105 | "engine", |
106 | "ui", | 106 | "ui", |
107 | "hwcrhk", /* This is a HACK which will disappear in 0.9.8 */ | 107 | "hwcrhk", /* This is a HACK which will disappear in 0.9.8 */ |
108 | #if CRYPTO_NUM_LOCKS != 33 | 108 | "fips", |
109 | "fips2", | ||
110 | #if CRYPTO_NUM_LOCKS != 35 | ||
109 | # error "Inconsistency between crypto.h and cryptlib.c" | 111 | # error "Inconsistency between crypto.h and cryptlib.c" |
110 | #endif | 112 | #endif |
111 | }; | 113 | }; |
@@ -478,13 +480,12 @@ const char *CRYPTO_get_lock_name(int type) | |||
478 | return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS)); | 480 | return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS)); |
479 | } | 481 | } |
480 | 482 | ||
481 | #ifdef _DLL | 483 | #if defined(_WIN32) && defined(_WINDLL) |
482 | #ifdef OPENSSL_SYS_WIN32 | ||
483 | 484 | ||
484 | /* All we really need to do is remove the 'error' state when a thread | 485 | /* All we really need to do is remove the 'error' state when a thread |
485 | * detaches */ | 486 | * detaches */ |
486 | 487 | ||
487 | BOOL WINAPI DLLEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, | 488 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, |
488 | LPVOID lpvReserved) | 489 | LPVOID lpvReserved) |
489 | { | 490 | { |
490 | switch(fdwReason) | 491 | switch(fdwReason) |
@@ -503,8 +504,6 @@ BOOL WINAPI DLLEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, | |||
503 | } | 504 | } |
504 | #endif | 505 | #endif |
505 | 506 | ||
506 | #endif | ||
507 | |||
508 | void OpenSSLDie(const char *file,int line,const char *assertion) | 507 | void OpenSSLDie(const char *file,int line,const char *assertion) |
509 | { | 508 | { |
510 | fprintf(stderr, | 509 | fprintf(stderr, |
@@ -512,3 +511,122 @@ void OpenSSLDie(const char *file,int line,const char *assertion) | |||
512 | file,line,assertion); | 511 | file,line,assertion); |
513 | abort(); | 512 | abort(); |
514 | } | 513 | } |
514 | |||
515 | #ifdef OPENSSL_FIPS | ||
516 | static int fips_started = 0; | ||
517 | static int fips_mode = 0; | ||
518 | static void *fips_rand_check = 0; | ||
519 | static unsigned long fips_thread = 0; | ||
520 | |||
521 | void fips_set_started(void) | ||
522 | { | ||
523 | fips_started = 1; | ||
524 | } | ||
525 | |||
526 | int fips_is_started(void) | ||
527 | { | ||
528 | return fips_started; | ||
529 | } | ||
530 | |||
531 | int fips_is_owning_thread(void) | ||
532 | { | ||
533 | int ret = 0; | ||
534 | |||
535 | if (fips_is_started()) | ||
536 | { | ||
537 | CRYPTO_r_lock(CRYPTO_LOCK_FIPS2); | ||
538 | if (fips_thread != 0 && fips_thread == CRYPTO_thread_id()) | ||
539 | ret = 1; | ||
540 | CRYPTO_r_unlock(CRYPTO_LOCK_FIPS2); | ||
541 | } | ||
542 | return ret; | ||
543 | } | ||
544 | |||
545 | int fips_set_owning_thread(void) | ||
546 | { | ||
547 | int ret = 0; | ||
548 | |||
549 | if (fips_is_started()) | ||
550 | { | ||
551 | CRYPTO_w_lock(CRYPTO_LOCK_FIPS2); | ||
552 | if (fips_thread == 0) | ||
553 | { | ||
554 | fips_thread = CRYPTO_thread_id(); | ||
555 | ret = 1; | ||
556 | } | ||
557 | CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2); | ||
558 | } | ||
559 | return ret; | ||
560 | } | ||
561 | |||
562 | int fips_clear_owning_thread(void) | ||
563 | { | ||
564 | int ret = 0; | ||
565 | |||
566 | if (fips_is_started()) | ||
567 | { | ||
568 | CRYPTO_w_lock(CRYPTO_LOCK_FIPS2); | ||
569 | if (fips_thread == CRYPTO_thread_id()) | ||
570 | { | ||
571 | fips_thread = 0; | ||
572 | ret = 1; | ||
573 | } | ||
574 | CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2); | ||
575 | } | ||
576 | return ret; | ||
577 | } | ||
578 | |||
579 | void fips_set_mode(int onoff) | ||
580 | { | ||
581 | int owning_thread = fips_is_owning_thread(); | ||
582 | |||
583 | if (fips_is_started()) | ||
584 | { | ||
585 | if (!owning_thread) CRYPTO_w_lock(CRYPTO_LOCK_FIPS); | ||
586 | fips_mode = onoff; | ||
587 | if (!owning_thread) CRYPTO_w_unlock(CRYPTO_LOCK_FIPS); | ||
588 | } | ||
589 | } | ||
590 | |||
591 | void fips_set_rand_check(void *rand_check) | ||
592 | { | ||
593 | int owning_thread = fips_is_owning_thread(); | ||
594 | |||
595 | if (fips_is_started()) | ||
596 | { | ||
597 | if (!owning_thread) CRYPTO_w_lock(CRYPTO_LOCK_FIPS); | ||
598 | fips_rand_check = rand_check; | ||
599 | if (!owning_thread) CRYPTO_w_unlock(CRYPTO_LOCK_FIPS); | ||
600 | } | ||
601 | } | ||
602 | |||
603 | int FIPS_mode(void) | ||
604 | { | ||
605 | int ret = 0; | ||
606 | int owning_thread = fips_is_owning_thread(); | ||
607 | |||
608 | if (fips_is_started()) | ||
609 | { | ||
610 | if (!owning_thread) CRYPTO_r_lock(CRYPTO_LOCK_FIPS); | ||
611 | ret = fips_mode; | ||
612 | if (!owning_thread) CRYPTO_r_unlock(CRYPTO_LOCK_FIPS); | ||
613 | } | ||
614 | return ret; | ||
615 | } | ||
616 | |||
617 | void *FIPS_rand_check(void) | ||
618 | { | ||
619 | void *ret = 0; | ||
620 | int owning_thread = fips_is_owning_thread(); | ||
621 | |||
622 | if (fips_is_started()) | ||
623 | { | ||
624 | if (!owning_thread) CRYPTO_r_lock(CRYPTO_LOCK_FIPS); | ||
625 | ret = fips_rand_check; | ||
626 | if (!owning_thread) CRYPTO_r_unlock(CRYPTO_LOCK_FIPS); | ||
627 | } | ||
628 | return ret; | ||
629 | } | ||
630 | |||
631 | #endif /* OPENSSL_FIPS */ | ||
632 | |||
diff --git a/src/lib/libssl/src/crypto/crypto-lib.com b/src/lib/libssl/src/crypto/crypto-lib.com index 39e78c69e5..c044ce0099 100644 --- a/src/lib/libssl/src/crypto/crypto-lib.com +++ b/src/lib/libssl/src/crypto/crypto-lib.com | |||
@@ -158,7 +158,7 @@ $! | |||
158 | $ APPS_DES = "DES/DES,CBC3_ENC" | 158 | $ APPS_DES = "DES/DES,CBC3_ENC" |
159 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" | 159 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" |
160 | $ | 160 | $ |
161 | $ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time" | 161 | $ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time,o_str" |
162 | $ LIB_MD2 = "md2_dgst,md2_one" | 162 | $ LIB_MD2 = "md2_dgst,md2_one" |
163 | $ LIB_MD4 = "md4_dgst,md4_one" | 163 | $ LIB_MD4 = "md4_dgst,md4_one" |
164 | $ LIB_MD5 = "md5_dgst,md5_one" | 164 | $ LIB_MD5 = "md5_dgst,md5_one" |
@@ -247,7 +247,7 @@ $ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ - | |||
247 | $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ - | 247 | $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ - |
248 | "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ - | 248 | "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ - |
249 | "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ - | 249 | "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ - |
250 | "v3_ocsp,v3_akeya" | 250 | "v3_ocsp,v3_akeya,v3_pcia,v3_pci" |
251 | $ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap" | 251 | $ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap" |
252 | $ LIB_TXT_DB = "txt_db" | 252 | $ LIB_TXT_DB = "txt_db" |
253 | $ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ - | 253 | $ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ - |
@@ -752,8 +752,8 @@ $ WRITE SYS$OUTPUT "" | |||
752 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" | 752 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" |
753 | $ WRITE SYS$OUTPUT "" | 753 | $ WRITE SYS$OUTPUT "" |
754 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything." | 754 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything." |
755 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.SSL]LIBCRYPTO.OLB Library." | 755 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library." |
756 | $ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.SSL]*.EXE Programs." | 756 | $ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.CRYPTO]*.EXE Programs." |
757 | $ WRITE SYS$OUTPUT "" | 757 | $ WRITE SYS$OUTPUT "" |
758 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:" | 758 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:" |
759 | $ WRITE SYS$OUTPUT "" | 759 | $ WRITE SYS$OUTPUT "" |
diff --git a/src/lib/libssl/src/crypto/crypto.h b/src/lib/libssl/src/crypto/crypto.h index 273bc5e3f8..4d1dfac7f1 100644 --- a/src/lib/libssl/src/crypto/crypto.h +++ b/src/lib/libssl/src/crypto/crypto.h | |||
@@ -128,7 +128,9 @@ extern "C" { | |||
128 | #define CRYPTO_LOCK_ENGINE 30 | 128 | #define CRYPTO_LOCK_ENGINE 30 |
129 | #define CRYPTO_LOCK_UI 31 | 129 | #define CRYPTO_LOCK_UI 31 |
130 | #define CRYPTO_LOCK_HWCRHK 32 /* This is a HACK which will disappear in 0.9.8 */ | 130 | #define CRYPTO_LOCK_HWCRHK 32 /* This is a HACK which will disappear in 0.9.8 */ |
131 | #define CRYPTO_NUM_LOCKS 33 | 131 | #define CRYPTO_LOCK_FIPS 33 |
132 | #define CRYPTO_LOCK_FIPS2 34 | ||
133 | #define CRYPTO_NUM_LOCKS 35 | ||
132 | 134 | ||
133 | #define CRYPTO_LOCK 1 | 135 | #define CRYPTO_LOCK 1 |
134 | #define CRYPTO_UNLOCK 2 | 136 | #define CRYPTO_UNLOCK 2 |
@@ -434,6 +436,63 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); | |||
434 | void OpenSSLDie(const char *file,int line,const char *assertion); | 436 | void OpenSSLDie(const char *file,int line,const char *assertion); |
435 | #define OPENSSL_assert(e) ((e) ? (void)0 : OpenSSLDie(__FILE__, __LINE__, #e)) | 437 | #define OPENSSL_assert(e) ((e) ? (void)0 : OpenSSLDie(__FILE__, __LINE__, #e)) |
436 | 438 | ||
439 | #ifdef OPENSSL_FIPS | ||
440 | int FIPS_mode(void); | ||
441 | void *FIPS_rand_check(void); | ||
442 | |||
443 | #define FIPS_ERROR_IGNORED(alg) OpenSSLDie(__FILE__, __LINE__, \ | ||
444 | alg " previous FIPS forbidden algorithm error ignored"); | ||
445 | |||
446 | #define FIPS_BAD_ABORT(alg) OpenSSLDie(__FILE__, __LINE__, \ | ||
447 | #alg " Algorithm forbidden in FIPS mode"); | ||
448 | |||
449 | #ifdef OPENSSL_FIPS_STRICT | ||
450 | #define FIPS_BAD_ALGORITHM(alg) FIPS_BAD_ABORT(alg) | ||
451 | #else | ||
452 | #define FIPS_BAD_ALGORITHM(alg) \ | ||
453 | { \ | ||
454 | FIPSerr(FIPS_F_HASH_FINAL,FIPS_R_NON_FIPS_METHOD); \ | ||
455 | ERR_add_error_data(2, "Algorithm=", #alg); \ | ||
456 | return 0; \ | ||
457 | } | ||
458 | #endif | ||
459 | |||
460 | /* Low level digest API blocking macro */ | ||
461 | |||
462 | #define FIPS_NON_FIPS_MD_Init(alg) \ | ||
463 | int alg##_Init(alg##_CTX *c) \ | ||
464 | { \ | ||
465 | if (FIPS_mode()) \ | ||
466 | FIPS_BAD_ALGORITHM(alg) \ | ||
467 | return private_##alg##_Init(c); \ | ||
468 | } \ | ||
469 | int private_##alg##_Init(alg##_CTX *c) | ||
470 | |||
471 | /* For ciphers the API often varies from cipher to cipher and each needs to | ||
472 | * be treated as a special case. Variable key length ciphers (Blowfish, RC4, | ||
473 | * CAST) however are very similar and can use a blocking macro. | ||
474 | */ | ||
475 | |||
476 | #define FIPS_NON_FIPS_VCIPHER_Init(alg) \ | ||
477 | void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) \ | ||
478 | { \ | ||
479 | if (FIPS_mode()) \ | ||
480 | FIPS_BAD_ABORT(alg) \ | ||
481 | private_##alg##_set_key(key, len, data); \ | ||
482 | } \ | ||
483 | void private_##alg##_set_key(alg##_KEY *key, int len, \ | ||
484 | const unsigned char *data) | ||
485 | |||
486 | #else | ||
487 | |||
488 | #define FIPS_NON_FIPS_VCIPHER_Init(alg) \ | ||
489 | void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) | ||
490 | |||
491 | #define FIPS_NON_FIPS_MD_Init(alg) \ | ||
492 | int alg##_Init(alg##_CTX *c) | ||
493 | |||
494 | #endif /* def OPENSSL_FIPS */ | ||
495 | |||
437 | /* BEGIN ERROR CODES */ | 496 | /* BEGIN ERROR CODES */ |
438 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 497 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
439 | * made after this point may be overwritten when the script is next run. | 498 | * made after this point may be overwritten when the script is next run. |
diff --git a/src/lib/libssl/src/crypto/des/cfb64ede.c b/src/lib/libssl/src/crypto/des/cfb64ede.c index 60c1aa08db..f3c6018528 100644 --- a/src/lib/libssl/src/crypto/des/cfb64ede.c +++ b/src/lib/libssl/src/crypto/des/cfb64ede.c | |||
@@ -57,6 +57,7 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | #include "e_os.h" | ||
60 | 61 | ||
61 | /* The input and output encrypted as though 64bit cfb mode is being | 62 | /* The input and output encrypted as though 64bit cfb mode is being |
62 | * used. The extra state information to record how much of the | 63 | * used. The extra state information to record how much of the |
@@ -140,3 +141,114 @@ void DES_ede2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | |||
140 | DES_ede3_cfb64_encrypt(in,out,length,ks1,ks2,ks1,ivec,num,enc); | 141 | DES_ede3_cfb64_encrypt(in,out,length,ks1,ks2,ks1,ivec,num,enc); |
141 | } | 142 | } |
142 | #endif | 143 | #endif |
144 | |||
145 | /* This is compatible with the single key CFB-r for DES, even thought that's | ||
146 | * not what EVP needs. | ||
147 | */ | ||
148 | |||
149 | void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out, | ||
150 | int numbits,long length,DES_key_schedule *ks1, | ||
151 | DES_key_schedule *ks2,DES_key_schedule *ks3, | ||
152 | DES_cblock *ivec,int enc) | ||
153 | { | ||
154 | register DES_LONG d0,d1,v0,v1; | ||
155 | register long l=length; | ||
156 | register int num=numbits,n=(numbits+7)/8,i; | ||
157 | DES_LONG ti[2]; | ||
158 | unsigned char *iv; | ||
159 | unsigned char ovec[16]; | ||
160 | |||
161 | if (num > 64) return; | ||
162 | iv = &(*ivec)[0]; | ||
163 | c2l(iv,v0); | ||
164 | c2l(iv,v1); | ||
165 | if (enc) | ||
166 | { | ||
167 | while (l >= n) | ||
168 | { | ||
169 | l-=n; | ||
170 | ti[0]=v0; | ||
171 | ti[1]=v1; | ||
172 | DES_encrypt3(ti,ks1,ks2,ks3); | ||
173 | c2ln(in,d0,d1,n); | ||
174 | in+=n; | ||
175 | d0^=ti[0]; | ||
176 | d1^=ti[1]; | ||
177 | l2cn(d0,d1,out,n); | ||
178 | out+=n; | ||
179 | /* 30-08-94 - eay - changed because l>>32 and | ||
180 | * l<<32 are bad under gcc :-( */ | ||
181 | if (num == 32) | ||
182 | { v0=v1; v1=d0; } | ||
183 | else if (num == 64) | ||
184 | { v0=d0; v1=d1; } | ||
185 | else | ||
186 | { | ||
187 | iv=&ovec[0]; | ||
188 | l2c(v0,iv); | ||
189 | l2c(v1,iv); | ||
190 | l2c(d0,iv); | ||
191 | l2c(d1,iv); | ||
192 | /* shift ovec left most of the bits... */ | ||
193 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); | ||
194 | /* now the remaining bits */ | ||
195 | if(num%8 != 0) | ||
196 | for(i=0 ; i < 8 ; ++i) | ||
197 | { | ||
198 | ovec[i]<<=num%8; | ||
199 | ovec[i]|=ovec[i+1]>>(8-num%8); | ||
200 | } | ||
201 | iv=&ovec[0]; | ||
202 | c2l(iv,v0); | ||
203 | c2l(iv,v1); | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | while (l >= n) | ||
210 | { | ||
211 | l-=n; | ||
212 | ti[0]=v0; | ||
213 | ti[1]=v1; | ||
214 | DES_encrypt3(ti,ks1,ks2,ks3); | ||
215 | c2ln(in,d0,d1,n); | ||
216 | in+=n; | ||
217 | /* 30-08-94 - eay - changed because l>>32 and | ||
218 | * l<<32 are bad under gcc :-( */ | ||
219 | if (num == 32) | ||
220 | { v0=v1; v1=d0; } | ||
221 | else if (num == 64) | ||
222 | { v0=d0; v1=d1; } | ||
223 | else | ||
224 | { | ||
225 | iv=&ovec[0]; | ||
226 | l2c(v0,iv); | ||
227 | l2c(v1,iv); | ||
228 | l2c(d0,iv); | ||
229 | l2c(d1,iv); | ||
230 | /* shift ovec left most of the bits... */ | ||
231 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); | ||
232 | /* now the remaining bits */ | ||
233 | if(num%8 != 0) | ||
234 | for(i=0 ; i < 8 ; ++i) | ||
235 | { | ||
236 | ovec[i]<<=num%8; | ||
237 | ovec[i]|=ovec[i+1]>>(8-num%8); | ||
238 | } | ||
239 | iv=&ovec[0]; | ||
240 | c2l(iv,v0); | ||
241 | c2l(iv,v1); | ||
242 | } | ||
243 | d0^=ti[0]; | ||
244 | d1^=ti[1]; | ||
245 | l2cn(d0,d1,out,n); | ||
246 | out+=n; | ||
247 | } | ||
248 | } | ||
249 | iv = &(*ivec)[0]; | ||
250 | l2c(v0,iv); | ||
251 | l2c(v1,iv); | ||
252 | v0=v1=d0=d1=ti[0]=ti[1]=0; | ||
253 | } | ||
254 | |||
diff --git a/src/lib/libssl/src/crypto/des/des.h b/src/lib/libssl/src/crypto/des/des.h index dfe5ff64e4..81bd874edd 100644 --- a/src/lib/libssl/src/crypto/des/des.h +++ b/src/lib/libssl/src/crypto/des/des.h | |||
@@ -130,7 +130,7 @@ OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode); /* defaults to DES_PCBC_MODE */ | |||
130 | #define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode) | 130 | #define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode) |
131 | 131 | ||
132 | const char *DES_options(void); | 132 | const char *DES_options(void); |
133 | void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, | 133 | void DES_ecb3_encrypt(const unsigned char *input, unsigned char *output, |
134 | DES_key_schedule *ks1,DES_key_schedule *ks2, | 134 | DES_key_schedule *ks1,DES_key_schedule *ks2, |
135 | DES_key_schedule *ks3, int enc); | 135 | DES_key_schedule *ks3, int enc); |
136 | DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output, | 136 | DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output, |
@@ -189,6 +189,10 @@ void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out, | |||
189 | long length,DES_key_schedule *ks1, | 189 | long length,DES_key_schedule *ks1, |
190 | DES_key_schedule *ks2,DES_key_schedule *ks3, | 190 | DES_key_schedule *ks2,DES_key_schedule *ks3, |
191 | DES_cblock *ivec,int *num,int enc); | 191 | DES_cblock *ivec,int *num,int enc); |
192 | void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out, | ||
193 | int numbits,long length,DES_key_schedule *ks1, | ||
194 | DES_key_schedule *ks2,DES_key_schedule *ks3, | ||
195 | DES_cblock *ivec,int enc); | ||
192 | void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out, | 196 | void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out, |
193 | long length,DES_key_schedule *ks1, | 197 | long length,DES_key_schedule *ks1, |
194 | DES_key_schedule *ks2,DES_key_schedule *ks3, | 198 | DES_key_schedule *ks2,DES_key_schedule *ks3, |
diff --git a/src/lib/libssl/src/crypto/des/des_enc.c b/src/lib/libssl/src/crypto/des/des_enc.c index 4f09804c44..6a49ec4a55 100644 --- a/src/lib/libssl/src/crypto/des/des_enc.c +++ b/src/lib/libssl/src/crypto/des/des_enc.c | |||
@@ -58,7 +58,9 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | #ifndef OPENSSL_FIPS | ||
61 | #ifndef OPENBSD_DES_ASM | 62 | #ifndef OPENBSD_DES_ASM |
63 | |||
62 | void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) | 64 | void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) |
63 | { | 65 | { |
64 | register DES_LONG l,r,t,u; | 66 | register DES_LONG l,r,t,u; |
@@ -289,8 +291,12 @@ void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, | |||
289 | data[1]=r; | 291 | data[1]=r; |
290 | } | 292 | } |
291 | 293 | ||
294 | #endif /* ndef OPENSSL_FIPS */ | ||
295 | |||
292 | #ifndef DES_DEFAULT_OPTIONS | 296 | #ifndef DES_DEFAULT_OPTIONS |
293 | 297 | ||
298 | #if !defined(OPENSSL_FIPS_DES_ASM) | ||
299 | |||
294 | #undef CBC_ENC_C__DONT_UPDATE_IV | 300 | #undef CBC_ENC_C__DONT_UPDATE_IV |
295 | #include "ncbc_enc.c" /* DES_ncbc_encrypt */ | 301 | #include "ncbc_enc.c" /* DES_ncbc_encrypt */ |
296 | 302 | ||
@@ -406,4 +412,6 @@ void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, | |||
406 | tin[0]=tin[1]=0; | 412 | tin[0]=tin[1]=0; |
407 | } | 413 | } |
408 | 414 | ||
415 | #endif /* !defined(OPENSSL_FIPS_DES_ASM) */ | ||
416 | |||
409 | #endif /* DES_DEFAULT_OPTIONS */ | 417 | #endif /* DES_DEFAULT_OPTIONS */ |
diff --git a/src/lib/libssl/src/crypto/des/des_old.c b/src/lib/libssl/src/crypto/des/des_old.c index 7e4cd7180d..88e9802aad 100644 --- a/src/lib/libssl/src/crypto/des/des_old.c +++ b/src/lib/libssl/src/crypto/des/des_old.c | |||
@@ -84,7 +84,7 @@ void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock | |||
84 | des_key_schedule ks1,des_key_schedule ks2, | 84 | des_key_schedule ks1,des_key_schedule ks2, |
85 | des_key_schedule ks3, int enc) | 85 | des_key_schedule ks3, int enc) |
86 | { | 86 | { |
87 | DES_ecb3_encrypt((const_DES_cblock *)input, output, | 87 | DES_ecb3_encrypt((const unsigned char *)input, (unsigned char *)output, |
88 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | 88 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, |
89 | (DES_key_schedule *)ks3, enc); | 89 | (DES_key_schedule *)ks3, enc); |
90 | } | 90 | } |
diff --git a/src/lib/libssl/src/crypto/des/destest.c b/src/lib/libssl/src/crypto/des/destest.c index 3983ac8e5f..e3e9d77f14 100644 --- a/src/lib/libssl/src/crypto/des/destest.c +++ b/src/lib/libssl/src/crypto/des/destest.c | |||
@@ -439,8 +439,8 @@ int main(int argc, char *argv[]) | |||
439 | memcpy(in,plain_data[i],8); | 439 | memcpy(in,plain_data[i],8); |
440 | memset(out,0,8); | 440 | memset(out,0,8); |
441 | memset(outin,0,8); | 441 | memset(outin,0,8); |
442 | des_ecb2_encrypt(&in,&out,ks,ks2,DES_ENCRYPT); | 442 | des_ecb2_encrypt(in,out,ks,ks2,DES_ENCRYPT); |
443 | des_ecb2_encrypt(&out,&outin,ks,ks2,DES_DECRYPT); | 443 | des_ecb2_encrypt(out,outin,ks,ks2,DES_DECRYPT); |
444 | 444 | ||
445 | if (memcmp(out,cipher_ecb2[i],8) != 0) | 445 | if (memcmp(out,cipher_ecb2[i],8) != 0) |
446 | { | 446 | { |
diff --git a/src/lib/libssl/src/crypto/des/ecb3_enc.c b/src/lib/libssl/src/crypto/des/ecb3_enc.c index c3437bc606..fa0c9c4d4f 100644 --- a/src/lib/libssl/src/crypto/des/ecb3_enc.c +++ b/src/lib/libssl/src/crypto/des/ecb3_enc.c | |||
@@ -58,15 +58,13 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, | 61 | void DES_ecb3_encrypt(const unsigned char *in, unsigned char *out, |
62 | DES_key_schedule *ks1, DES_key_schedule *ks2, | 62 | DES_key_schedule *ks1, DES_key_schedule *ks2, |
63 | DES_key_schedule *ks3, | 63 | DES_key_schedule *ks3, |
64 | int enc) | 64 | int enc) |
65 | { | 65 | { |
66 | register DES_LONG l0,l1; | 66 | register DES_LONG l0,l1; |
67 | DES_LONG ll[2]; | 67 | DES_LONG ll[2]; |
68 | const unsigned char *in = &(*input)[0]; | ||
69 | unsigned char *out = &(*output)[0]; | ||
70 | 68 | ||
71 | c2l(in,l0); | 69 | c2l(in,l0); |
72 | c2l(in,l1); | 70 | c2l(in,l1); |
diff --git a/src/lib/libssl/src/crypto/des/set_key.c b/src/lib/libssl/src/crypto/des/set_key.c index 143008ed9c..8881d46a7a 100644 --- a/src/lib/libssl/src/crypto/des/set_key.c +++ b/src/lib/libssl/src/crypto/des/set_key.c | |||
@@ -65,6 +65,8 @@ | |||
65 | */ | 65 | */ |
66 | #include "des_locl.h" | 66 | #include "des_locl.h" |
67 | 67 | ||
68 | #ifndef OPENSSL_FIPS | ||
69 | |||
68 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key); /* defaults to false */ | 70 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key); /* defaults to false */ |
69 | 71 | ||
70 | static const unsigned char odd_parity[256]={ | 72 | static const unsigned char odd_parity[256]={ |
@@ -405,3 +407,5 @@ void des_fixup_key_parity(des_cblock *key) | |||
405 | des_set_odd_parity(key); | 407 | des_set_odd_parity(key); |
406 | } | 408 | } |
407 | */ | 409 | */ |
410 | |||
411 | #endif /* ndef OPENSSL_FIPS */ | ||
diff --git a/src/lib/libssl/src/crypto/dh/dh_check.c b/src/lib/libssl/src/crypto/dh/dh_check.c index f0373f7d68..a7e9920efb 100644 --- a/src/lib/libssl/src/crypto/dh/dh_check.c +++ b/src/lib/libssl/src/crypto/dh/dh_check.c | |||
@@ -70,6 +70,8 @@ | |||
70 | * should hold. | 70 | * should hold. |
71 | */ | 71 | */ |
72 | 72 | ||
73 | #ifndef OPENSSL_FIPS | ||
74 | |||
73 | int DH_check(const DH *dh, int *ret) | 75 | int DH_check(const DH *dh, int *ret) |
74 | { | 76 | { |
75 | int ok=0; | 77 | int ok=0; |
@@ -118,3 +120,5 @@ err: | |||
118 | if (q != NULL) BN_free(q); | 120 | if (q != NULL) BN_free(q); |
119 | return(ok); | 121 | return(ok); |
120 | } | 122 | } |
123 | |||
124 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/dh/dh_err.c b/src/lib/libssl/src/crypto/dh/dh_err.c index d837950aec..c2715044c9 100644 --- a/src/lib/libssl/src/crypto/dh/dh_err.c +++ b/src/lib/libssl/src/crypto/dh/dh_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/dh/dh_err.c */ | 1 | /* crypto/dh/dh_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2003 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 |
diff --git a/src/lib/libssl/src/crypto/dh/dh_gen.c b/src/lib/libssl/src/crypto/dh/dh_gen.c index 06f78b35ab..23777f5a16 100644 --- a/src/lib/libssl/src/crypto/dh/dh_gen.c +++ b/src/lib/libssl/src/crypto/dh/dh_gen.c | |||
@@ -86,6 +86,9 @@ | |||
86 | * It's just as OK (and in some sense better) to use a generator of the | 86 | * It's just as OK (and in some sense better) to use a generator of the |
87 | * order-q subgroup. | 87 | * order-q subgroup. |
88 | */ | 88 | */ |
89 | |||
90 | #ifndef OPENSSL_FIPS | ||
91 | |||
89 | DH *DH_generate_parameters(int prime_len, int generator, | 92 | DH *DH_generate_parameters(int prime_len, int generator, |
90 | void (*callback)(int,int,void *), void *cb_arg) | 93 | void (*callback)(int,int,void *), void *cb_arg) |
91 | { | 94 | { |
@@ -146,6 +149,7 @@ DH *DH_generate_parameters(int prime_len, int generator, | |||
146 | if (callback != NULL) callback(3,0,cb_arg); | 149 | if (callback != NULL) callback(3,0,cb_arg); |
147 | ret->p=p; | 150 | ret->p=p; |
148 | ret->g=BN_new(); | 151 | ret->g=BN_new(); |
152 | if (ret->g == NULL) goto err; | ||
149 | if (!BN_set_word(ret->g,g)) goto err; | 153 | if (!BN_set_word(ret->g,g)) goto err; |
150 | ok=1; | 154 | ok=1; |
151 | err: | 155 | err: |
@@ -167,3 +171,5 @@ err: | |||
167 | } | 171 | } |
168 | return(ret); | 172 | return(ret); |
169 | } | 173 | } |
174 | |||
175 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/dh/dh_key.c b/src/lib/libssl/src/crypto/dh/dh_key.c index 77f2f50b51..ff125c2296 100644 --- a/src/lib/libssl/src/crypto/dh/dh_key.c +++ b/src/lib/libssl/src/crypto/dh/dh_key.c | |||
@@ -62,6 +62,8 @@ | |||
62 | #include <openssl/rand.h> | 62 | #include <openssl/rand.h> |
63 | #include <openssl/dh.h> | 63 | #include <openssl/dh.h> |
64 | 64 | ||
65 | #ifndef OPENSSL_FIPS | ||
66 | |||
65 | static int generate_key(DH *dh); | 67 | static int generate_key(DH *dh); |
66 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); | 68 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); |
67 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, | 69 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, |
@@ -220,3 +222,5 @@ static int dh_finish(DH *dh) | |||
220 | BN_MONT_CTX_free((BN_MONT_CTX *)dh->method_mont_p); | 222 | BN_MONT_CTX_free((BN_MONT_CTX *)dh->method_mont_p); |
221 | return(1); | 223 | return(1); |
222 | } | 224 | } |
225 | |||
226 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/dsa/dsa.h b/src/lib/libssl/src/crypto/dsa/dsa.h index 9b3baadf2c..225ff391f9 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa.h +++ b/src/lib/libssl/src/crypto/dsa/dsa.h | |||
@@ -81,6 +81,10 @@ | |||
81 | 81 | ||
82 | #define DSA_FLAG_CACHE_MONT_P 0x01 | 82 | #define DSA_FLAG_CACHE_MONT_P 0x01 |
83 | 83 | ||
84 | #if defined(OPENSSL_FIPS) | ||
85 | #define FIPS_DSA_SIZE_T int | ||
86 | #endif | ||
87 | |||
84 | #ifdef __cplusplus | 88 | #ifdef __cplusplus |
85 | extern "C" { | 89 | extern "C" { |
86 | #endif | 90 | #endif |
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_gen.c b/src/lib/libssl/src/crypto/dsa/dsa_gen.c index dc9c249310..e40afeea51 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_gen.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_gen.c | |||
@@ -80,6 +80,7 @@ | |||
80 | #include <openssl/rand.h> | 80 | #include <openssl/rand.h> |
81 | #include <openssl/sha.h> | 81 | #include <openssl/sha.h> |
82 | 82 | ||
83 | #ifndef OPENSSL_FIPS | ||
83 | DSA *DSA_generate_parameters(int bits, | 84 | DSA *DSA_generate_parameters(int bits, |
84 | unsigned char *seed_in, int seed_len, | 85 | unsigned char *seed_in, int seed_len, |
85 | int *counter_ret, unsigned long *h_ret, | 86 | int *counter_ret, unsigned long *h_ret, |
@@ -127,8 +128,9 @@ DSA *DSA_generate_parameters(int bits, | |||
127 | c = BN_CTX_get(ctx2); | 128 | c = BN_CTX_get(ctx2); |
128 | p = BN_CTX_get(ctx2); | 129 | p = BN_CTX_get(ctx2); |
129 | test = BN_CTX_get(ctx2); | 130 | test = BN_CTX_get(ctx2); |
131 | if (test == NULL) goto err; | ||
130 | 132 | ||
131 | BN_lshift(test,BN_value_one(),bits-1); | 133 | if (!BN_lshift(test,BN_value_one(),bits-1)) goto err; |
132 | 134 | ||
133 | for (;;) | 135 | for (;;) |
134 | { | 136 | { |
@@ -196,7 +198,7 @@ DSA *DSA_generate_parameters(int bits, | |||
196 | callback(0,counter,cb_arg); | 198 | callback(0,counter,cb_arg); |
197 | 199 | ||
198 | /* step 7 */ | 200 | /* step 7 */ |
199 | BN_zero(W); | 201 | if (!BN_zero(W)) goto err; |
200 | /* now 'buf' contains "SEED + offset - 1" */ | 202 | /* now 'buf' contains "SEED + offset - 1" */ |
201 | for (k=0; k<=n; k++) | 203 | for (k=0; k<=n; k++) |
202 | { | 204 | { |
@@ -212,20 +214,20 @@ DSA *DSA_generate_parameters(int bits, | |||
212 | /* step 8 */ | 214 | /* step 8 */ |
213 | if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,r0)) | 215 | if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,r0)) |
214 | goto err; | 216 | goto err; |
215 | BN_lshift(r0,r0,160*k); | 217 | if (!BN_lshift(r0,r0,160*k)) goto err; |
216 | BN_add(W,W,r0); | 218 | if (!BN_add(W,W,r0)) goto err; |
217 | } | 219 | } |
218 | 220 | ||
219 | /* more of step 8 */ | 221 | /* more of step 8 */ |
220 | BN_mask_bits(W,bits-1); | 222 | if (!BN_mask_bits(W,bits-1)) goto err; |
221 | BN_copy(X,W); /* this should be ok */ | 223 | if (!BN_copy(X,W)) goto err; |
222 | BN_add(X,X,test); /* this should be ok */ | 224 | if (!BN_add(X,X,test)) goto err; |
223 | 225 | ||
224 | /* step 9 */ | 226 | /* step 9 */ |
225 | BN_lshift1(r0,q); | 227 | if (!BN_lshift1(r0,q)) goto err; |
226 | BN_mod(c,X,r0,ctx); | 228 | if (!BN_mod(c,X,r0,ctx)) goto err; |
227 | BN_sub(r0,c,BN_value_one()); | 229 | if (!BN_sub(r0,c,BN_value_one())) goto err; |
228 | BN_sub(p,X,r0); | 230 | if (!BN_sub(p,X,r0)) goto err; |
229 | 231 | ||
230 | /* step 10 */ | 232 | /* step 10 */ |
231 | if (BN_cmp(p,test) >= 0) | 233 | if (BN_cmp(p,test) >= 0) |
@@ -251,18 +253,18 @@ end: | |||
251 | 253 | ||
252 | /* We now need to generate g */ | 254 | /* We now need to generate g */ |
253 | /* Set r0=(p-1)/q */ | 255 | /* Set r0=(p-1)/q */ |
254 | BN_sub(test,p,BN_value_one()); | 256 | if (!BN_sub(test,p,BN_value_one())) goto err; |
255 | BN_div(r0,NULL,test,q,ctx); | 257 | if (!BN_div(r0,NULL,test,q,ctx)) goto err; |
256 | 258 | ||
257 | BN_set_word(test,h); | 259 | if (!BN_set_word(test,h)) goto err; |
258 | BN_MONT_CTX_set(mont,p,ctx); | 260 | if (!BN_MONT_CTX_set(mont,p,ctx)) goto err; |
259 | 261 | ||
260 | for (;;) | 262 | for (;;) |
261 | { | 263 | { |
262 | /* g=test^r0%p */ | 264 | /* g=test^r0%p */ |
263 | BN_mod_exp_mont(g,test,r0,p,ctx,mont); | 265 | if (!BN_mod_exp_mont(g,test,r0,p,ctx,mont)) goto err; |
264 | if (!BN_is_one(g)) break; | 266 | if (!BN_is_one(g)) break; |
265 | BN_add(test,test,BN_value_one()); | 267 | if (!BN_add(test,test,BN_value_one())) goto err; |
266 | h++; | 268 | h++; |
267 | } | 269 | } |
268 | 270 | ||
@@ -279,6 +281,11 @@ err: | |||
279 | ret->p=BN_dup(p); | 281 | ret->p=BN_dup(p); |
280 | ret->q=BN_dup(q); | 282 | ret->q=BN_dup(q); |
281 | ret->g=BN_dup(g); | 283 | ret->g=BN_dup(g); |
284 | if (ret->p == NULL || ret->q == NULL || ret->g == NULL) | ||
285 | { | ||
286 | ok=0; | ||
287 | goto err; | ||
288 | } | ||
282 | if ((m > 1) && (seed_in != NULL)) memcpy(seed_in,seed,20); | 289 | if ((m > 1) && (seed_in != NULL)) memcpy(seed_in,seed,20); |
283 | if (counter_ret != NULL) *counter_ret=counter; | 290 | if (counter_ret != NULL) *counter_ret=counter; |
284 | if (h_ret != NULL) *h_ret=h; | 291 | if (h_ret != NULL) *h_ret=h; |
@@ -293,4 +300,6 @@ err: | |||
293 | if (mont != NULL) BN_MONT_CTX_free(mont); | 300 | if (mont != NULL) BN_MONT_CTX_free(mont); |
294 | return(ok?ret:NULL); | 301 | return(ok?ret:NULL); |
295 | } | 302 | } |
296 | #endif | 303 | #endif /* ndef OPENSSL_FIPS */ |
304 | #endif /* ndef OPENSSL_NO_SHA */ | ||
305 | |||
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_key.c b/src/lib/libssl/src/crypto/dsa/dsa_key.c index ef87c3e637..30607ca579 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_key.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_key.c | |||
@@ -64,6 +64,7 @@ | |||
64 | #include <openssl/dsa.h> | 64 | #include <openssl/dsa.h> |
65 | #include <openssl/rand.h> | 65 | #include <openssl/rand.h> |
66 | 66 | ||
67 | #ifndef OPENSSL_FIPS | ||
67 | int DSA_generate_key(DSA *dsa) | 68 | int DSA_generate_key(DSA *dsa) |
68 | { | 69 | { |
69 | int ok=0; | 70 | int ok=0; |
@@ -103,3 +104,4 @@ err: | |||
103 | return(ok); | 104 | return(ok); |
104 | } | 105 | } |
105 | #endif | 106 | #endif |
107 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_ossl.c b/src/lib/libssl/src/crypto/dsa/dsa_ossl.c index b9e7f3ea5c..f1a85afcde 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_ossl.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_ossl.c | |||
@@ -65,6 +65,7 @@ | |||
65 | #include <openssl/rand.h> | 65 | #include <openssl/rand.h> |
66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
67 | 67 | ||
68 | #ifndef OPENSSL_FIPS | ||
68 | static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); | 69 | static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); |
69 | static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp); | 70 | static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp); |
70 | static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | 71 | static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, |
@@ -346,3 +347,4 @@ static int dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, | |||
346 | { | 347 | { |
347 | return BN_mod_exp_mont(r, a, p, m, ctx, m_ctx); | 348 | return BN_mod_exp_mont(r, a, p, m, ctx, m_ctx); |
348 | } | 349 | } |
350 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_sign.c b/src/lib/libssl/src/crypto/dsa/dsa_sign.c index 89205026f0..3c9753bac3 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_sign.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_sign.c | |||
@@ -64,9 +64,17 @@ | |||
64 | #include <openssl/dsa.h> | 64 | #include <openssl/dsa.h> |
65 | #include <openssl/rand.h> | 65 | #include <openssl/rand.h> |
66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
67 | #ifndef OPENSSL_NO_ENGINE | ||
68 | #include <openssl/engine.h> | ||
69 | #endif | ||
70 | #include <openssl/fips.h> | ||
67 | 71 | ||
68 | DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | 72 | DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) |
69 | { | 73 | { |
74 | #ifdef OPENSSL_FIPS | ||
75 | if(FIPS_mode() && !FIPS_dsa_check(dsa)) | ||
76 | return NULL; | ||
77 | #endif | ||
70 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); | 78 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); |
71 | } | 79 | } |
72 | 80 | ||
@@ -87,6 +95,10 @@ int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, | |||
87 | 95 | ||
88 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | 96 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) |
89 | { | 97 | { |
98 | #ifdef OPENSSL_FIPS | ||
99 | if(FIPS_mode() && !FIPS_dsa_check(dsa)) | ||
100 | return 0; | ||
101 | #endif | ||
90 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); | 102 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); |
91 | } | 103 | } |
92 | 104 | ||
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_vrf.c b/src/lib/libssl/src/crypto/dsa/dsa_vrf.c index c4aeddd056..8ef0c45025 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_vrf.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_vrf.c | |||
@@ -65,10 +65,18 @@ | |||
65 | #include <openssl/rand.h> | 65 | #include <openssl/rand.h> |
66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
67 | #include <openssl/asn1_mac.h> | 67 | #include <openssl/asn1_mac.h> |
68 | #ifndef OPENSSL_NO_ENGINE | ||
69 | #include <openssl/engine.h> | ||
70 | #endif | ||
71 | #include <openssl/fips.h> | ||
68 | 72 | ||
69 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | 73 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, |
70 | DSA *dsa) | 74 | DSA *dsa) |
71 | { | 75 | { |
76 | #ifdef OPENSSL_FIPS | ||
77 | if(FIPS_mode() && !FIPS_dsa_check(dsa)) | ||
78 | return -1; | ||
79 | #endif | ||
72 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); | 80 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); |
73 | } | 81 | } |
74 | 82 | ||
diff --git a/src/lib/libssl/src/crypto/dso/dso_win32.c b/src/lib/libssl/src/crypto/dso/dso_win32.c index 6c30deb250..3fa90eb27c 100644 --- a/src/lib/libssl/src/crypto/dso/dso_win32.c +++ b/src/lib/libssl/src/crypto/dso/dso_win32.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/dso.h> | 62 | #include <openssl/dso.h> |
63 | 63 | ||
64 | #if !defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE) | 64 | #if !defined(DSO_WIN32) |
65 | DSO_METHOD *DSO_METHOD_win32(void) | 65 | DSO_METHOD *DSO_METHOD_win32(void) |
66 | { | 66 | { |
67 | return NULL; | 67 | return NULL; |
diff --git a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c index 0ca442af8a..41184b6786 100644 --- a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c +++ b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c | |||
@@ -93,7 +93,7 @@ static int open_dev_crypto(void); | |||
93 | static int get_dev_crypto(void); | 93 | static int get_dev_crypto(void); |
94 | static struct dev_crypto_cipher *cipher_nid_to_cryptodev(int nid); | 94 | static struct dev_crypto_cipher *cipher_nid_to_cryptodev(int nid); |
95 | static int get_cryptodev_ciphers(const int **cnids); | 95 | static int get_cryptodev_ciphers(const int **cnids); |
96 | static int get_cryptodev_digests(const int **cnids); | 96 | /*static int get_cryptodev_digests(const int **cnids);*/ |
97 | static int cryptodev_usable_ciphers(const int **nids); | 97 | static int cryptodev_usable_ciphers(const int **nids); |
98 | static int cryptodev_usable_digests(const int **nids); | 98 | static int cryptodev_usable_digests(const int **nids); |
99 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 99 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
@@ -150,6 +150,7 @@ static struct dev_crypto_cipher ciphers[] = { | |||
150 | { 0, NID_undef, 0, 0, }, | 150 | { 0, NID_undef, 0, 0, }, |
151 | }; | 151 | }; |
152 | 152 | ||
153 | #if 0 /* UNUSED */ | ||
153 | static struct { | 154 | static struct { |
154 | int id; | 155 | int id; |
155 | int nid; | 156 | int nid; |
@@ -162,6 +163,7 @@ static struct { | |||
162 | { CRYPTO_SHA1, NID_undef, }, | 163 | { CRYPTO_SHA1, NID_undef, }, |
163 | { 0, NID_undef, }, | 164 | { 0, NID_undef, }, |
164 | }; | 165 | }; |
166 | #endif | ||
165 | 167 | ||
166 | /* | 168 | /* |
167 | * Return a fd if /dev/crypto seems usable, -1 otherwise. | 169 | * Return a fd if /dev/crypto seems usable, -1 otherwise. |
@@ -297,6 +299,7 @@ get_cryptodev_ciphers(const int **cnids) | |||
297 | * returning them here is harmless, as long as we return NULL | 299 | * returning them here is harmless, as long as we return NULL |
298 | * when asked for a handler in the cryptodev_engine_digests routine | 300 | * when asked for a handler in the cryptodev_engine_digests routine |
299 | */ | 301 | */ |
302 | #if 0 /* UNUSED */ | ||
300 | static int | 303 | static int |
301 | get_cryptodev_digests(const int **cnids) | 304 | get_cryptodev_digests(const int **cnids) |
302 | { | 305 | { |
@@ -326,6 +329,7 @@ get_cryptodev_digests(const int **cnids) | |||
326 | *cnids = NULL; | 329 | *cnids = NULL; |
327 | return (count); | 330 | return (count); |
328 | } | 331 | } |
332 | #endif | ||
329 | 333 | ||
330 | /* | 334 | /* |
331 | * Find the useable ciphers|digests from dev/crypto - this is the first | 335 | * Find the useable ciphers|digests from dev/crypto - this is the first |
@@ -832,7 +836,7 @@ static int | |||
832 | bn2crparam(const BIGNUM *a, struct crparam *crp) | 836 | bn2crparam(const BIGNUM *a, struct crparam *crp) |
833 | { | 837 | { |
834 | int i, j, k; | 838 | int i, j, k; |
835 | ssize_t words, bytes, bits; | 839 | ssize_t bytes, bits; |
836 | u_char *b; | 840 | u_char *b; |
837 | 841 | ||
838 | crp->crp_p = NULL; | 842 | crp->crp_p = NULL; |
diff --git a/src/lib/libssl/src/crypto/err/err.c b/src/lib/libssl/src/crypto/err/err.c index 792f329600..c78790a54c 100644 --- a/src/lib/libssl/src/crypto/err/err.c +++ b/src/lib/libssl/src/crypto/err/err.c | |||
@@ -149,6 +149,7 @@ static ERR_STRING_DATA ERR_str_libraries[]= | |||
149 | {ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"}, | 149 | {ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"}, |
150 | {ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"}, | 150 | {ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"}, |
151 | {ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"}, | 151 | {ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"}, |
152 | {ERR_PACK(ERR_LIB_FIPS,0,0) ,"FIPS routines"}, | ||
152 | {0,NULL}, | 153 | {0,NULL}, |
153 | }; | 154 | }; |
154 | 155 | ||
@@ -167,6 +168,7 @@ static ERR_STRING_DATA ERR_str_functs[]= | |||
167 | #endif | 168 | #endif |
168 | {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"}, | 169 | {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"}, |
169 | {ERR_PACK(0,SYS_F_FREAD,0), "fread"}, | 170 | {ERR_PACK(0,SYS_F_FREAD,0), "fread"}, |
171 | {ERR_PACK(0,SYS_F_GETADDRINFO,0), "getaddrinfo"}, | ||
170 | {0,NULL}, | 172 | {0,NULL}, |
171 | }; | 173 | }; |
172 | 174 | ||
diff --git a/src/lib/libssl/src/crypto/err/err.h b/src/lib/libssl/src/crypto/err/err.h index 8faa3a7b4f..2efa18866a 100644 --- a/src/lib/libssl/src/crypto/err/err.h +++ b/src/lib/libssl/src/crypto/err/err.h | |||
@@ -131,6 +131,7 @@ typedef struct err_state_st | |||
131 | #define ERR_LIB_OCSP 39 | 131 | #define ERR_LIB_OCSP 39 |
132 | #define ERR_LIB_UI 40 | 132 | #define ERR_LIB_UI 40 |
133 | #define ERR_LIB_COMP 41 | 133 | #define ERR_LIB_COMP 41 |
134 | #define ERR_LIB_FIPS 42 | ||
134 | 135 | ||
135 | #define ERR_LIB_USER 128 | 136 | #define ERR_LIB_USER 128 |
136 | 137 | ||
@@ -159,6 +160,7 @@ typedef struct err_state_st | |||
159 | #define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__) | 160 | #define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__) |
160 | #define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__) | 161 | #define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__) |
161 | #define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__) | 162 | #define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__) |
163 | #define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__) | ||
162 | 164 | ||
163 | /* Borland C seems too stupid to be able to shift and do longs in | 165 | /* Borland C seems too stupid to be able to shift and do longs in |
164 | * the pre-processor :-( */ | 166 | * the pre-processor :-( */ |
@@ -183,6 +185,7 @@ typedef struct err_state_st | |||
183 | #define SYS_F_WSASTARTUP 9 /* Winsock stuff */ | 185 | #define SYS_F_WSASTARTUP 9 /* Winsock stuff */ |
184 | #define SYS_F_OPENDIR 10 | 186 | #define SYS_F_OPENDIR 10 |
185 | #define SYS_F_FREAD 11 | 187 | #define SYS_F_FREAD 11 |
188 | #define SYS_F_GETADDRINFO 12 | ||
186 | 189 | ||
187 | 190 | ||
188 | /* reasons */ | 191 | /* reasons */ |
diff --git a/src/lib/libssl/src/crypto/err/err_all.c b/src/lib/libssl/src/crypto/err/err_all.c index dc505d9d9d..4dc9300892 100644 --- a/src/lib/libssl/src/crypto/err/err_all.c +++ b/src/lib/libssl/src/crypto/err/err_all.c | |||
@@ -87,6 +87,7 @@ | |||
87 | #endif | 87 | #endif |
88 | #include <openssl/ocsp.h> | 88 | #include <openssl/ocsp.h> |
89 | #include <openssl/err.h> | 89 | #include <openssl/err.h> |
90 | #include <openssl/fips.h> | ||
90 | 91 | ||
91 | void ERR_load_crypto_strings(void) | 92 | void ERR_load_crypto_strings(void) |
92 | { | 93 | { |
@@ -130,4 +131,7 @@ void ERR_load_crypto_strings(void) | |||
130 | ERR_load_OCSP_strings(); | 131 | ERR_load_OCSP_strings(); |
131 | ERR_load_UI_strings(); | 132 | ERR_load_UI_strings(); |
132 | #endif | 133 | #endif |
134 | #ifdef OPENSSL_FIPS | ||
135 | ERR_load_FIPS_strings(); | ||
136 | #endif | ||
133 | } | 137 | } |
diff --git a/src/lib/libssl/src/crypto/err/openssl.ec b/src/lib/libssl/src/crypto/err/openssl.ec index 29a69dfdd4..447a7f87ed 100644 --- a/src/lib/libssl/src/crypto/err/openssl.ec +++ b/src/lib/libssl/src/crypto/err/openssl.ec | |||
@@ -27,6 +27,7 @@ L DSO crypto/dso/dso.h crypto/dso/dso_err.c | |||
27 | L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c | 27 | L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c |
28 | L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c | 28 | L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c |
29 | L UI crypto/ui/ui.h crypto/ui/ui_err.c | 29 | L UI crypto/ui/ui.h crypto/ui/ui_err.c |
30 | L FIPS fips/fips.h fips/fips_err.h | ||
30 | 31 | ||
31 | # additional header files to be scanned for function names | 32 | # additional header files to be scanned for function names |
32 | L NONE crypto/x509/x509_vfy.h NONE | 33 | L NONE crypto/x509/x509_vfy.h NONE |
diff --git a/src/lib/libssl/src/crypto/evp/bio_md.c b/src/lib/libssl/src/crypto/evp/bio_md.c index c632dfb202..f4aa41ac4b 100644 --- a/src/lib/libssl/src/crypto/evp/bio_md.c +++ b/src/lib/libssl/src/crypto/evp/bio_md.c | |||
@@ -176,10 +176,11 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
176 | { | 176 | { |
177 | case BIO_CTRL_RESET: | 177 | case BIO_CTRL_RESET: |
178 | if (b->init) | 178 | if (b->init) |
179 | EVP_DigestInit_ex(ctx,ctx->digest, NULL); | 179 | ret = EVP_DigestInit_ex(ctx,ctx->digest, NULL); |
180 | else | 180 | else |
181 | ret=0; | 181 | ret=0; |
182 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 182 | if (ret > 0) |
183 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
183 | break; | 184 | break; |
184 | case BIO_C_GET_MD: | 185 | case BIO_C_GET_MD: |
185 | if (b->init) | 186 | if (b->init) |
@@ -191,11 +192,12 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
191 | ret=0; | 192 | ret=0; |
192 | break; | 193 | break; |
193 | case BIO_C_GET_MD_CTX: | 194 | case BIO_C_GET_MD_CTX: |
195 | pctx=ptr; | ||
196 | *pctx=ctx; | ||
197 | break; | ||
198 | case BIO_C_SET_MD_CTX: | ||
194 | if (b->init) | 199 | if (b->init) |
195 | { | 200 | b->ptr=ptr; |
196 | pctx=ptr; | ||
197 | *pctx=ctx; | ||
198 | } | ||
199 | else | 201 | else |
200 | ret=0; | 202 | ret=0; |
201 | break; | 203 | break; |
@@ -207,8 +209,9 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
207 | 209 | ||
208 | case BIO_C_SET_MD: | 210 | case BIO_C_SET_MD: |
209 | md=ptr; | 211 | md=ptr; |
210 | EVP_DigestInit_ex(ctx,md, NULL); | 212 | ret = EVP_DigestInit_ex(ctx,md, NULL); |
211 | b->init=1; | 213 | if (ret > 0) |
214 | b->init=1; | ||
212 | break; | 215 | break; |
213 | case BIO_CTRL_DUP: | 216 | case BIO_CTRL_DUP: |
214 | dbio=ptr; | 217 | dbio=ptr; |
diff --git a/src/lib/libssl/src/crypto/evp/c_allc.c b/src/lib/libssl/src/crypto/evp/c_allc.c index 341a958fd4..fc96812365 100644 --- a/src/lib/libssl/src/crypto/evp/c_allc.c +++ b/src/lib/libssl/src/crypto/evp/c_allc.c | |||
@@ -67,6 +67,8 @@ void OpenSSL_add_all_ciphers(void) | |||
67 | 67 | ||
68 | #ifndef OPENSSL_NO_DES | 68 | #ifndef OPENSSL_NO_DES |
69 | EVP_add_cipher(EVP_des_cfb()); | 69 | EVP_add_cipher(EVP_des_cfb()); |
70 | EVP_add_cipher(EVP_des_cfb1()); | ||
71 | EVP_add_cipher(EVP_des_cfb8()); | ||
70 | EVP_add_cipher(EVP_des_ede_cfb()); | 72 | EVP_add_cipher(EVP_des_ede_cfb()); |
71 | EVP_add_cipher(EVP_des_ede3_cfb()); | 73 | EVP_add_cipher(EVP_des_ede3_cfb()); |
72 | 74 | ||
@@ -150,6 +152,8 @@ void OpenSSL_add_all_ciphers(void) | |||
150 | EVP_add_cipher(EVP_aes_128_ecb()); | 152 | EVP_add_cipher(EVP_aes_128_ecb()); |
151 | EVP_add_cipher(EVP_aes_128_cbc()); | 153 | EVP_add_cipher(EVP_aes_128_cbc()); |
152 | EVP_add_cipher(EVP_aes_128_cfb()); | 154 | EVP_add_cipher(EVP_aes_128_cfb()); |
155 | EVP_add_cipher(EVP_aes_128_cfb1()); | ||
156 | EVP_add_cipher(EVP_aes_128_cfb8()); | ||
153 | EVP_add_cipher(EVP_aes_128_ofb()); | 157 | EVP_add_cipher(EVP_aes_128_ofb()); |
154 | #if 0 | 158 | #if 0 |
155 | EVP_add_cipher(EVP_aes_128_ctr()); | 159 | EVP_add_cipher(EVP_aes_128_ctr()); |
@@ -159,6 +163,8 @@ void OpenSSL_add_all_ciphers(void) | |||
159 | EVP_add_cipher(EVP_aes_192_ecb()); | 163 | EVP_add_cipher(EVP_aes_192_ecb()); |
160 | EVP_add_cipher(EVP_aes_192_cbc()); | 164 | EVP_add_cipher(EVP_aes_192_cbc()); |
161 | EVP_add_cipher(EVP_aes_192_cfb()); | 165 | EVP_add_cipher(EVP_aes_192_cfb()); |
166 | EVP_add_cipher(EVP_aes_192_cfb1()); | ||
167 | EVP_add_cipher(EVP_aes_192_cfb8()); | ||
162 | EVP_add_cipher(EVP_aes_192_ofb()); | 168 | EVP_add_cipher(EVP_aes_192_ofb()); |
163 | #if 0 | 169 | #if 0 |
164 | EVP_add_cipher(EVP_aes_192_ctr()); | 170 | EVP_add_cipher(EVP_aes_192_ctr()); |
@@ -168,6 +174,8 @@ void OpenSSL_add_all_ciphers(void) | |||
168 | EVP_add_cipher(EVP_aes_256_ecb()); | 174 | EVP_add_cipher(EVP_aes_256_ecb()); |
169 | EVP_add_cipher(EVP_aes_256_cbc()); | 175 | EVP_add_cipher(EVP_aes_256_cbc()); |
170 | EVP_add_cipher(EVP_aes_256_cfb()); | 176 | EVP_add_cipher(EVP_aes_256_cfb()); |
177 | EVP_add_cipher(EVP_aes_256_cfb1()); | ||
178 | EVP_add_cipher(EVP_aes_256_cfb8()); | ||
171 | EVP_add_cipher(EVP_aes_256_ofb()); | 179 | EVP_add_cipher(EVP_aes_256_ofb()); |
172 | #if 0 | 180 | #if 0 |
173 | EVP_add_cipher(EVP_aes_256_ctr()); | 181 | EVP_add_cipher(EVP_aes_256_ctr()); |
diff --git a/src/lib/libssl/src/crypto/evp/c_alld.c b/src/lib/libssl/src/crypto/evp/c_alld.c index be91cdb037..aae7bf7482 100644 --- a/src/lib/libssl/src/crypto/evp/c_alld.c +++ b/src/lib/libssl/src/crypto/evp/c_alld.c | |||
@@ -75,7 +75,7 @@ void OpenSSL_add_all_digests(void) | |||
75 | EVP_add_digest_alias(SN_md5,"ssl2-md5"); | 75 | EVP_add_digest_alias(SN_md5,"ssl2-md5"); |
76 | EVP_add_digest_alias(SN_md5,"ssl3-md5"); | 76 | EVP_add_digest_alias(SN_md5,"ssl3-md5"); |
77 | #endif | 77 | #endif |
78 | #ifndef OPENSSL_NO_SHA | 78 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) |
79 | EVP_add_digest(EVP_sha()); | 79 | EVP_add_digest(EVP_sha()); |
80 | #ifndef OPENSSL_NO_DSA | 80 | #ifndef OPENSSL_NO_DSA |
81 | EVP_add_digest(EVP_dss()); | 81 | EVP_add_digest(EVP_dss()); |
diff --git a/src/lib/libssl/src/crypto/evp/digest.c b/src/lib/libssl/src/crypto/evp/digest.c index 0623ddf1f0..f21c63842c 100644 --- a/src/lib/libssl/src/crypto/evp/digest.c +++ b/src/lib/libssl/src/crypto/evp/digest.c | |||
@@ -137,6 +137,39 @@ int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) | |||
137 | return EVP_DigestInit_ex(ctx, type, NULL); | 137 | return EVP_DigestInit_ex(ctx, type, NULL); |
138 | } | 138 | } |
139 | 139 | ||
140 | #ifdef OPENSSL_FIPS | ||
141 | |||
142 | /* The purpose of these is to trap programs that attempt to use non FIPS | ||
143 | * algorithms in FIPS mode and ignore the errors. | ||
144 | */ | ||
145 | |||
146 | static int bad_init(EVP_MD_CTX *ctx) | ||
147 | { FIPS_ERROR_IGNORED("Digest init"); return 0;} | ||
148 | |||
149 | static int bad_update(EVP_MD_CTX *ctx,const void *data,unsigned long count) | ||
150 | { FIPS_ERROR_IGNORED("Digest update"); return 0;} | ||
151 | |||
152 | static int bad_final(EVP_MD_CTX *ctx,unsigned char *md) | ||
153 | { FIPS_ERROR_IGNORED("Digest Final"); return 0;} | ||
154 | |||
155 | static const EVP_MD bad_md = | ||
156 | { | ||
157 | 0, | ||
158 | 0, | ||
159 | 0, | ||
160 | 0, | ||
161 | bad_init, | ||
162 | bad_update, | ||
163 | bad_final, | ||
164 | NULL, | ||
165 | NULL, | ||
166 | NULL, | ||
167 | 0, | ||
168 | {0,0,0,0}, | ||
169 | }; | ||
170 | |||
171 | #endif | ||
172 | |||
140 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | 173 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) |
141 | { | 174 | { |
142 | EVP_MD_CTX_clear_flags(ctx,EVP_MD_CTX_FLAG_CLEANED); | 175 | EVP_MD_CTX_clear_flags(ctx,EVP_MD_CTX_FLAG_CLEANED); |
@@ -195,6 +228,18 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | |||
195 | #endif | 228 | #endif |
196 | if (ctx->digest != type) | 229 | if (ctx->digest != type) |
197 | { | 230 | { |
231 | #ifdef OPENSSL_FIPS | ||
232 | if (FIPS_mode()) | ||
233 | { | ||
234 | if (!(type->flags & EVP_MD_FLAG_FIPS) | ||
235 | && !(ctx->flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)) | ||
236 | { | ||
237 | EVPerr(EVP_F_EVP_DIGESTINIT, EVP_R_DISABLED_FOR_FIPS); | ||
238 | ctx->digest = &bad_md; | ||
239 | return 0; | ||
240 | } | ||
241 | } | ||
242 | #endif | ||
198 | if (ctx->digest && ctx->digest->ctx_size) | 243 | if (ctx->digest && ctx->digest->ctx_size) |
199 | OPENSSL_free(ctx->md_data); | 244 | OPENSSL_free(ctx->md_data); |
200 | ctx->digest=type; | 245 | ctx->digest=type; |
diff --git a/src/lib/libssl/src/crypto/evp/e_aes.c b/src/lib/libssl/src/crypto/evp/e_aes.c index fe8bcda631..f35036c9d7 100644 --- a/src/lib/libssl/src/crypto/evp/e_aes.c +++ b/src/lib/libssl/src/crypto/evp/e_aes.c | |||
@@ -67,34 +67,52 @@ typedef struct | |||
67 | 67 | ||
68 | IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY, | 68 | IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY, |
69 | NID_aes_128, 16, 16, 16, 128, | 69 | NID_aes_128, 16, 16, 16, 128, |
70 | 0, aes_init_key, NULL, | 70 | EVP_CIPH_FLAG_FIPS, aes_init_key, NULL, |
71 | EVP_CIPHER_set_asn1_iv, | 71 | EVP_CIPHER_set_asn1_iv, |
72 | EVP_CIPHER_get_asn1_iv, | 72 | EVP_CIPHER_get_asn1_iv, |
73 | NULL) | 73 | NULL) |
74 | IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY, | 74 | IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY, |
75 | NID_aes_192, 16, 24, 16, 128, | 75 | NID_aes_192, 16, 24, 16, 128, |
76 | 0, aes_init_key, NULL, | 76 | EVP_CIPH_FLAG_FIPS, aes_init_key, NULL, |
77 | EVP_CIPHER_set_asn1_iv, | 77 | EVP_CIPHER_set_asn1_iv, |
78 | EVP_CIPHER_get_asn1_iv, | 78 | EVP_CIPHER_get_asn1_iv, |
79 | NULL) | 79 | NULL) |
80 | IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY, | 80 | IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY, |
81 | NID_aes_256, 16, 32, 16, 128, | 81 | NID_aes_256, 16, 32, 16, 128, |
82 | 0, aes_init_key, NULL, | 82 | EVP_CIPH_FLAG_FIPS, aes_init_key, NULL, |
83 | EVP_CIPHER_set_asn1_iv, | 83 | EVP_CIPHER_set_asn1_iv, |
84 | EVP_CIPHER_get_asn1_iv, | 84 | EVP_CIPHER_get_asn1_iv, |
85 | NULL) | 85 | NULL) |
86 | 86 | ||
87 | #define IMPLEMENT_AES_CFBR(ksize,cbits,flags) IMPLEMENT_CFBR(aes,AES,EVP_AES_KEY,ks,ksize,cbits,16,flags) | ||
88 | |||
89 | IMPLEMENT_AES_CFBR(128,1,0) | ||
90 | IMPLEMENT_AES_CFBR(192,1,0) | ||
91 | IMPLEMENT_AES_CFBR(256,1,0) | ||
92 | |||
93 | IMPLEMENT_AES_CFBR(128,8,EVP_CIPH_FLAG_FIPS) | ||
94 | IMPLEMENT_AES_CFBR(192,8,EVP_CIPH_FLAG_FIPS) | ||
95 | IMPLEMENT_AES_CFBR(256,8,EVP_CIPH_FLAG_FIPS) | ||
96 | |||
87 | static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 97 | static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
88 | const unsigned char *iv, int enc) { | 98 | const unsigned char *iv, int enc) |
99 | { | ||
100 | int ret; | ||
89 | 101 | ||
90 | if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE | 102 | if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE |
91 | || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE | 103 | || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE |
92 | || enc) | 104 | || enc) |
93 | AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data); | 105 | ret=AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data); |
94 | else | 106 | else |
95 | AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data); | 107 | ret=AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data); |
108 | |||
109 | if(ret < 0) | ||
110 | { | ||
111 | EVPerr(EVP_F_AES_INIT_KEY,EVP_R_AES_KEY_SETUP_FAILED); | ||
112 | return 0; | ||
113 | } | ||
96 | 114 | ||
97 | return 1; | 115 | return 1; |
98 | } | 116 | } |
99 | 117 | ||
100 | #endif | 118 | #endif |
diff --git a/src/lib/libssl/src/crypto/evp/e_des.c b/src/lib/libssl/src/crypto/evp/e_des.c index 105266a4b3..46e2899825 100644 --- a/src/lib/libssl/src/crypto/evp/e_des.c +++ b/src/lib/libssl/src/crypto/evp/e_des.c | |||
@@ -56,9 +56,9 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_DES | ||
60 | #include <stdio.h> | 59 | #include <stdio.h> |
61 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #ifndef OPENSSL_NO_DES | ||
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
64 | #include "evp_locl.h" | 64 | #include "evp_locl.h" |
@@ -92,20 +92,55 @@ static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
92 | return 1; | 92 | return 1; |
93 | } | 93 | } |
94 | 94 | ||
95 | static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 95 | static int des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
96 | const unsigned char *in, unsigned int inl) | 96 | const unsigned char *in, unsigned int inl) |
97 | { | 97 | { |
98 | DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data, | 98 | DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data, |
99 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); | 99 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); |
100 | return 1; | 100 | return 1; |
101 | } | 101 | } |
102 | 102 | ||
103 | /* Although we have a CFB-r implementation for DES, it doesn't pack the right | ||
104 | way, so wrap it here */ | ||
105 | static int des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
106 | const unsigned char *in, unsigned int inl) | ||
107 | { | ||
108 | unsigned int n; | ||
109 | unsigned char c[1],d[1]; | ||
110 | |||
111 | for(n=0 ; n < inl ; ++n) | ||
112 | { | ||
113 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | ||
114 | DES_cfb_encrypt(c,d,1,1,ctx->cipher_data,(DES_cblock *)ctx->iv, | ||
115 | ctx->encrypt); | ||
116 | out[n/8]=(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8)); | ||
117 | } | ||
118 | return 1; | ||
119 | } | ||
120 | |||
121 | static int des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
122 | const unsigned char *in, unsigned int inl) | ||
123 | { | ||
124 | DES_cfb_encrypt(in,out,8,inl,ctx->cipher_data,(DES_cblock *)ctx->iv, | ||
125 | ctx->encrypt); | ||
126 | return 1; | ||
127 | } | ||
128 | |||
103 | BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64, | 129 | BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64, |
104 | 0, des_init_key, NULL, | 130 | EVP_CIPH_FLAG_FIPS, des_init_key, NULL, |
105 | EVP_CIPHER_set_asn1_iv, | 131 | EVP_CIPHER_set_asn1_iv, |
106 | EVP_CIPHER_get_asn1_iv, | 132 | EVP_CIPHER_get_asn1_iv, |
107 | NULL) | 133 | NULL) |
108 | 134 | ||
135 | BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,1, | ||
136 | EVP_CIPH_FLAG_FIPS,des_init_key,NULL, | ||
137 | EVP_CIPHER_set_asn1_iv, | ||
138 | EVP_CIPHER_get_asn1_iv,NULL) | ||
139 | |||
140 | BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,8, | ||
141 | EVP_CIPH_FLAG_FIPS,des_init_key,NULL, | ||
142 | EVP_CIPHER_set_asn1_iv, | ||
143 | EVP_CIPHER_get_asn1_iv,NULL) | ||
109 | 144 | ||
110 | static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 145 | static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
111 | const unsigned char *iv, int enc) | 146 | const unsigned char *iv, int enc) |
diff --git a/src/lib/libssl/src/crypto/evp/e_des3.c b/src/lib/libssl/src/crypto/evp/e_des3.c index 077860e7b6..677322bf02 100644 --- a/src/lib/libssl/src/crypto/evp/e_des3.c +++ b/src/lib/libssl/src/crypto/evp/e_des3.c | |||
@@ -56,9 +56,9 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_DES | ||
60 | #include <stdio.h> | 59 | #include <stdio.h> |
61 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #ifndef OPENSSL_NO_DES | ||
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
64 | #include "evp_locl.h" | 64 | #include "evp_locl.h" |
@@ -85,7 +85,7 @@ static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
85 | const unsigned char *in, unsigned int inl) | 85 | const unsigned char *in, unsigned int inl) |
86 | { | 86 | { |
87 | BLOCK_CIPHER_ecb_loop() | 87 | BLOCK_CIPHER_ecb_loop() |
88 | DES_ecb3_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i), | 88 | DES_ecb3_encrypt(in + i,out + i, |
89 | &data(ctx)->ks1, &data(ctx)->ks2, | 89 | &data(ctx)->ks1, &data(ctx)->ks2, |
90 | &data(ctx)->ks3, | 90 | &data(ctx)->ks3, |
91 | ctx->encrypt); | 91 | ctx->encrypt); |
@@ -121,7 +121,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
121 | return 1; | 121 | return 1; |
122 | } | 122 | } |
123 | 123 | ||
124 | static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 124 | static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
125 | const unsigned char *in, unsigned int inl) | 125 | const unsigned char *in, unsigned int inl) |
126 | { | 126 | { |
127 | DES_ede3_cfb64_encrypt(in, out, (long)inl, | 127 | DES_ede3_cfb64_encrypt(in, out, (long)inl, |
@@ -130,23 +130,62 @@ static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
130 | return 1; | 130 | return 1; |
131 | } | 131 | } |
132 | 132 | ||
133 | /* Although we have a CFB-r implementation for 3-DES, it doesn't pack the right | ||
134 | way, so wrap it here */ | ||
135 | static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
136 | const unsigned char *in, unsigned int inl) | ||
137 | { | ||
138 | unsigned int n; | ||
139 | unsigned char c[1],d[1]; | ||
140 | |||
141 | for(n=0 ; n < inl ; ++n) | ||
142 | { | ||
143 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | ||
144 | DES_ede3_cfb_encrypt(c,d,1,1, | ||
145 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, | ||
146 | (DES_cblock *)ctx->iv,ctx->encrypt); | ||
147 | out[n/8]=(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8)); | ||
148 | } | ||
149 | |||
150 | return 1; | ||
151 | } | ||
152 | |||
153 | static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
154 | const unsigned char *in, unsigned int inl) | ||
155 | { | ||
156 | DES_ede3_cfb_encrypt(in,out,8,inl, | ||
157 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, | ||
158 | (DES_cblock *)ctx->iv,ctx->encrypt); | ||
159 | return 1; | ||
160 | } | ||
161 | |||
133 | BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64, | 162 | BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64, |
134 | 0, des_ede_init_key, NULL, | 163 | EVP_CIPH_FLAG_FIPS, des_ede_init_key, NULL, |
135 | EVP_CIPHER_set_asn1_iv, | 164 | EVP_CIPHER_set_asn1_iv, |
136 | EVP_CIPHER_get_asn1_iv, | 165 | EVP_CIPHER_get_asn1_iv, |
137 | NULL) | 166 | NULL) |
138 | 167 | ||
139 | #define des_ede3_cfb_cipher des_ede_cfb_cipher | 168 | #define des_ede3_cfb64_cipher des_ede_cfb64_cipher |
140 | #define des_ede3_ofb_cipher des_ede_ofb_cipher | 169 | #define des_ede3_ofb_cipher des_ede_ofb_cipher |
141 | #define des_ede3_cbc_cipher des_ede_cbc_cipher | 170 | #define des_ede3_cbc_cipher des_ede_cbc_cipher |
142 | #define des_ede3_ecb_cipher des_ede_ecb_cipher | 171 | #define des_ede3_ecb_cipher des_ede_ecb_cipher |
143 | 172 | ||
144 | BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64, | 173 | BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64, |
145 | 0, des_ede3_init_key, NULL, | 174 | EVP_CIPH_FLAG_FIPS, des_ede3_init_key, NULL, |
146 | EVP_CIPHER_set_asn1_iv, | 175 | EVP_CIPHER_set_asn1_iv, |
147 | EVP_CIPHER_get_asn1_iv, | 176 | EVP_CIPHER_get_asn1_iv, |
148 | NULL) | 177 | NULL) |
149 | 178 | ||
179 | BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,1, | ||
180 | EVP_CIPH_FLAG_FIPS, des_ede3_init_key,NULL, | ||
181 | EVP_CIPHER_set_asn1_iv, | ||
182 | EVP_CIPHER_get_asn1_iv,NULL) | ||
183 | |||
184 | BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,8, | ||
185 | EVP_CIPH_FLAG_FIPS, des_ede3_init_key,NULL, | ||
186 | EVP_CIPHER_set_asn1_iv, | ||
187 | EVP_CIPHER_get_asn1_iv,NULL) | ||
188 | |||
150 | static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 189 | static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
151 | const unsigned char *iv, int enc) | 190 | const unsigned char *iv, int enc) |
152 | { | 191 | { |
diff --git a/src/lib/libssl/src/crypto/evp/e_null.c b/src/lib/libssl/src/crypto/evp/e_null.c index 2420d7e5af..a84b0f14b1 100644 --- a/src/lib/libssl/src/crypto/evp/e_null.c +++ b/src/lib/libssl/src/crypto/evp/e_null.c | |||
@@ -69,7 +69,7 @@ static const EVP_CIPHER n_cipher= | |||
69 | { | 69 | { |
70 | NID_undef, | 70 | NID_undef, |
71 | 1,0,0, | 71 | 1,0,0, |
72 | 0, | 72 | EVP_CIPH_FLAG_FIPS, |
73 | null_init_key, | 73 | null_init_key, |
74 | null_cipher, | 74 | null_cipher, |
75 | NULL, | 75 | NULL, |
diff --git a/src/lib/libssl/src/crypto/evp/e_rc4.c b/src/lib/libssl/src/crypto/evp/e_rc4.c index d58f507837..8aa70585b9 100644 --- a/src/lib/libssl/src/crypto/evp/e_rc4.c +++ b/src/lib/libssl/src/crypto/evp/e_rc4.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
63 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
64 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
65 | #include "evp_locl.h" | ||
65 | #include <openssl/rc4.h> | 66 | #include <openssl/rc4.h> |
66 | 67 | ||
67 | /* FIXME: surely this is available elsewhere? */ | 68 | /* FIXME: surely this is available elsewhere? */ |
diff --git a/src/lib/libssl/src/crypto/evp/evp.h b/src/lib/libssl/src/crypto/evp/evp.h index f9b48792ce..62d95354ef 100644 --- a/src/lib/libssl/src/crypto/evp/evp.h +++ b/src/lib/libssl/src/crypto/evp/evp.h | |||
@@ -75,6 +75,10 @@ | |||
75 | #include <openssl/bio.h> | 75 | #include <openssl/bio.h> |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | #ifdef OPENSSL_FIPS | ||
79 | #include <openssl/fips.h> | ||
80 | #endif | ||
81 | |||
78 | /* | 82 | /* |
79 | #define EVP_RC2_KEY_SIZE 16 | 83 | #define EVP_RC2_KEY_SIZE 16 |
80 | #define EVP_RC4_KEY_SIZE 16 | 84 | #define EVP_RC4_KEY_SIZE 16 |
@@ -236,6 +240,7 @@ struct env_md_st | |||
236 | 240 | ||
237 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single | 241 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single |
238 | * block */ | 242 | * block */ |
243 | #define EVP_MD_FLAG_FIPS 0x0400 /* Note if suitable for use in FIPS mode */ | ||
239 | 244 | ||
240 | #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} | 245 | #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} |
241 | 246 | ||
@@ -278,6 +283,9 @@ struct env_md_ctx_st | |||
278 | #define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data | 283 | #define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data |
279 | * in EVP_MD_CTX_cleanup */ | 284 | * in EVP_MD_CTX_cleanup */ |
280 | 285 | ||
286 | #define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008 /* Allow use of non FIPS digest | ||
287 | * in FIPS mode */ | ||
288 | |||
281 | struct evp_cipher_st | 289 | struct evp_cipher_st |
282 | { | 290 | { |
283 | int nid; | 291 | int nid; |
@@ -319,6 +327,10 @@ struct evp_cipher_st | |||
319 | #define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 | 327 | #define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 |
320 | /* Don't use standard block padding */ | 328 | /* Don't use standard block padding */ |
321 | #define EVP_CIPH_NO_PADDING 0x100 | 329 | #define EVP_CIPH_NO_PADDING 0x100 |
330 | /* Note if suitable for use in FIPS mode */ | ||
331 | #define EVP_CIPH_FLAG_FIPS 0x400 | ||
332 | /* Allow non FIPS cipher in FIPS mode */ | ||
333 | #define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x800 | ||
322 | 334 | ||
323 | /* ctrl() values */ | 335 | /* ctrl() values */ |
324 | 336 | ||
@@ -425,6 +437,9 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
425 | #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) | 437 | #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) |
426 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) | 438 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) |
427 | #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) | 439 | #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) |
440 | #define EVP_CIPHER_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs)) | ||
441 | #define EVP_CIPHER_CTX_clear_flags(ctx,flgs) ((ctx)->flags&=~(flgs)) | ||
442 | #define EVP_CIPHER_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs)) | ||
428 | #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) | 443 | #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) |
429 | 444 | ||
430 | #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) | 445 | #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) |
@@ -446,6 +461,7 @@ void BIO_set_md(BIO *,const EVP_MD *md); | |||
446 | #endif | 461 | #endif |
447 | #define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) | 462 | #define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) |
448 | #define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) | 463 | #define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) |
464 | #define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp) | ||
449 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) | 465 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) |
450 | #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) | 466 | #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) |
451 | 467 | ||
@@ -587,9 +603,20 @@ const EVP_CIPHER *EVP_des_ede(void); | |||
587 | const EVP_CIPHER *EVP_des_ede3(void); | 603 | const EVP_CIPHER *EVP_des_ede3(void); |
588 | const EVP_CIPHER *EVP_des_ede_ecb(void); | 604 | const EVP_CIPHER *EVP_des_ede_ecb(void); |
589 | const EVP_CIPHER *EVP_des_ede3_ecb(void); | 605 | const EVP_CIPHER *EVP_des_ede3_ecb(void); |
590 | const EVP_CIPHER *EVP_des_cfb(void); | 606 | const EVP_CIPHER *EVP_des_cfb64(void); |
591 | const EVP_CIPHER *EVP_des_ede_cfb(void); | 607 | # define EVP_des_cfb EVP_des_cfb64 |
592 | const EVP_CIPHER *EVP_des_ede3_cfb(void); | 608 | const EVP_CIPHER *EVP_des_cfb1(void); |
609 | const EVP_CIPHER *EVP_des_cfb8(void); | ||
610 | const EVP_CIPHER *EVP_des_ede_cfb64(void); | ||
611 | # define EVP_des_ede_cfb EVP_des_ede_cfb64 | ||
612 | #if 0 | ||
613 | const EVP_CIPHER *EVP_des_ede_cfb1(void); | ||
614 | const EVP_CIPHER *EVP_des_ede_cfb8(void); | ||
615 | #endif | ||
616 | const EVP_CIPHER *EVP_des_ede3_cfb64(void); | ||
617 | # define EVP_des_ede3_cfb EVP_des_ede3_cfb64 | ||
618 | const EVP_CIPHER *EVP_des_ede3_cfb1(void); | ||
619 | const EVP_CIPHER *EVP_des_ede3_cfb8(void); | ||
593 | const EVP_CIPHER *EVP_des_ofb(void); | 620 | const EVP_CIPHER *EVP_des_ofb(void); |
594 | const EVP_CIPHER *EVP_des_ede_ofb(void); | 621 | const EVP_CIPHER *EVP_des_ede_ofb(void); |
595 | const EVP_CIPHER *EVP_des_ede3_ofb(void); | 622 | const EVP_CIPHER *EVP_des_ede3_ofb(void); |
@@ -613,7 +640,8 @@ const EVP_CIPHER *EVP_rc4_40(void); | |||
613 | #endif | 640 | #endif |
614 | #ifndef OPENSSL_NO_IDEA | 641 | #ifndef OPENSSL_NO_IDEA |
615 | const EVP_CIPHER *EVP_idea_ecb(void); | 642 | const EVP_CIPHER *EVP_idea_ecb(void); |
616 | const EVP_CIPHER *EVP_idea_cfb(void); | 643 | const EVP_CIPHER *EVP_idea_cfb64(void); |
644 | # define EVP_idea_cfb EVP_idea_cfb64 | ||
617 | const EVP_CIPHER *EVP_idea_ofb(void); | 645 | const EVP_CIPHER *EVP_idea_ofb(void); |
618 | const EVP_CIPHER *EVP_idea_cbc(void); | 646 | const EVP_CIPHER *EVP_idea_cbc(void); |
619 | #endif | 647 | #endif |
@@ -622,45 +650,58 @@ const EVP_CIPHER *EVP_rc2_ecb(void); | |||
622 | const EVP_CIPHER *EVP_rc2_cbc(void); | 650 | const EVP_CIPHER *EVP_rc2_cbc(void); |
623 | const EVP_CIPHER *EVP_rc2_40_cbc(void); | 651 | const EVP_CIPHER *EVP_rc2_40_cbc(void); |
624 | const EVP_CIPHER *EVP_rc2_64_cbc(void); | 652 | const EVP_CIPHER *EVP_rc2_64_cbc(void); |
625 | const EVP_CIPHER *EVP_rc2_cfb(void); | 653 | const EVP_CIPHER *EVP_rc2_cfb64(void); |
654 | # define EVP_rc2_cfb EVP_rc2_cfb64 | ||
626 | const EVP_CIPHER *EVP_rc2_ofb(void); | 655 | const EVP_CIPHER *EVP_rc2_ofb(void); |
627 | #endif | 656 | #endif |
628 | #ifndef OPENSSL_NO_BF | 657 | #ifndef OPENSSL_NO_BF |
629 | const EVP_CIPHER *EVP_bf_ecb(void); | 658 | const EVP_CIPHER *EVP_bf_ecb(void); |
630 | const EVP_CIPHER *EVP_bf_cbc(void); | 659 | const EVP_CIPHER *EVP_bf_cbc(void); |
631 | const EVP_CIPHER *EVP_bf_cfb(void); | 660 | const EVP_CIPHER *EVP_bf_cfb64(void); |
661 | # define EVP_bf_cfb EVP_bf_cfb64 | ||
632 | const EVP_CIPHER *EVP_bf_ofb(void); | 662 | const EVP_CIPHER *EVP_bf_ofb(void); |
633 | #endif | 663 | #endif |
634 | #ifndef OPENSSL_NO_CAST | 664 | #ifndef OPENSSL_NO_CAST |
635 | const EVP_CIPHER *EVP_cast5_ecb(void); | 665 | const EVP_CIPHER *EVP_cast5_ecb(void); |
636 | const EVP_CIPHER *EVP_cast5_cbc(void); | 666 | const EVP_CIPHER *EVP_cast5_cbc(void); |
637 | const EVP_CIPHER *EVP_cast5_cfb(void); | 667 | const EVP_CIPHER *EVP_cast5_cfb64(void); |
668 | # define EVP_cast5_cfb EVP_cast5_cfb64 | ||
638 | const EVP_CIPHER *EVP_cast5_ofb(void); | 669 | const EVP_CIPHER *EVP_cast5_ofb(void); |
639 | #endif | 670 | #endif |
640 | #ifndef OPENSSL_NO_RC5 | 671 | #ifndef OPENSSL_NO_RC5 |
641 | const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); | 672 | const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); |
642 | const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); | 673 | const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); |
643 | const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void); | 674 | const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); |
675 | # define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 | ||
644 | const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); | 676 | const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); |
645 | #endif | 677 | #endif |
646 | #ifndef OPENSSL_NO_AES | 678 | #ifndef OPENSSL_NO_AES |
647 | const EVP_CIPHER *EVP_aes_128_ecb(void); | 679 | const EVP_CIPHER *EVP_aes_128_ecb(void); |
648 | const EVP_CIPHER *EVP_aes_128_cbc(void); | 680 | const EVP_CIPHER *EVP_aes_128_cbc(void); |
649 | const EVP_CIPHER *EVP_aes_128_cfb(void); | 681 | const EVP_CIPHER *EVP_aes_128_cfb1(void); |
682 | const EVP_CIPHER *EVP_aes_128_cfb8(void); | ||
683 | const EVP_CIPHER *EVP_aes_128_cfb128(void); | ||
684 | # define EVP_aes_128_cfb EVP_aes_128_cfb128 | ||
650 | const EVP_CIPHER *EVP_aes_128_ofb(void); | 685 | const EVP_CIPHER *EVP_aes_128_ofb(void); |
651 | #if 0 | 686 | #if 0 |
652 | const EVP_CIPHER *EVP_aes_128_ctr(void); | 687 | const EVP_CIPHER *EVP_aes_128_ctr(void); |
653 | #endif | 688 | #endif |
654 | const EVP_CIPHER *EVP_aes_192_ecb(void); | 689 | const EVP_CIPHER *EVP_aes_192_ecb(void); |
655 | const EVP_CIPHER *EVP_aes_192_cbc(void); | 690 | const EVP_CIPHER *EVP_aes_192_cbc(void); |
656 | const EVP_CIPHER *EVP_aes_192_cfb(void); | 691 | const EVP_CIPHER *EVP_aes_192_cfb1(void); |
692 | const EVP_CIPHER *EVP_aes_192_cfb8(void); | ||
693 | const EVP_CIPHER *EVP_aes_192_cfb128(void); | ||
694 | # define EVP_aes_192_cfb EVP_aes_192_cfb128 | ||
657 | const EVP_CIPHER *EVP_aes_192_ofb(void); | 695 | const EVP_CIPHER *EVP_aes_192_ofb(void); |
658 | #if 0 | 696 | #if 0 |
659 | const EVP_CIPHER *EVP_aes_192_ctr(void); | 697 | const EVP_CIPHER *EVP_aes_192_ctr(void); |
660 | #endif | 698 | #endif |
661 | const EVP_CIPHER *EVP_aes_256_ecb(void); | 699 | const EVP_CIPHER *EVP_aes_256_ecb(void); |
662 | const EVP_CIPHER *EVP_aes_256_cbc(void); | 700 | const EVP_CIPHER *EVP_aes_256_cbc(void); |
663 | const EVP_CIPHER *EVP_aes_256_cfb(void); | 701 | const EVP_CIPHER *EVP_aes_256_cfb1(void); |
702 | const EVP_CIPHER *EVP_aes_256_cfb8(void); | ||
703 | const EVP_CIPHER *EVP_aes_256_cfb128(void); | ||
704 | # define EVP_aes_256_cfb EVP_aes_256_cfb128 | ||
664 | const EVP_CIPHER *EVP_aes_256_ofb(void); | 705 | const EVP_CIPHER *EVP_aes_256_ofb(void); |
665 | #if 0 | 706 | #if 0 |
666 | const EVP_CIPHER *EVP_aes_256_ctr(void); | 707 | const EVP_CIPHER *EVP_aes_256_ctr(void); |
@@ -775,13 +816,18 @@ void ERR_load_EVP_strings(void); | |||
775 | /* Error codes for the EVP functions. */ | 816 | /* Error codes for the EVP functions. */ |
776 | 817 | ||
777 | /* Function codes. */ | 818 | /* Function codes. */ |
819 | #define EVP_F_AES_INIT_KEY 129 | ||
778 | #define EVP_F_D2I_PKEY 100 | 820 | #define EVP_F_D2I_PKEY 100 |
821 | #define EVP_F_EVP_ADD_CIPHER 130 | ||
822 | #define EVP_F_EVP_ADD_DIGEST 131 | ||
779 | #define EVP_F_EVP_CIPHERINIT 123 | 823 | #define EVP_F_EVP_CIPHERINIT 123 |
780 | #define EVP_F_EVP_CIPHER_CTX_CTRL 124 | 824 | #define EVP_F_EVP_CIPHER_CTX_CTRL 124 |
781 | #define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 | 825 | #define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 |
782 | #define EVP_F_EVP_DECRYPTFINAL 101 | 826 | #define EVP_F_EVP_DECRYPTFINAL 101 |
783 | #define EVP_F_EVP_DIGESTINIT 128 | 827 | #define EVP_F_EVP_DIGESTINIT 128 |
784 | #define EVP_F_EVP_ENCRYPTFINAL 127 | 828 | #define EVP_F_EVP_ENCRYPTFINAL 127 |
829 | #define EVP_F_EVP_GET_CIPHERBYNAME 132 | ||
830 | #define EVP_F_EVP_GET_DIGESTBYNAME 133 | ||
785 | #define EVP_F_EVP_MD_CTX_COPY 110 | 831 | #define EVP_F_EVP_MD_CTX_COPY 110 |
786 | #define EVP_F_EVP_OPENINIT 102 | 832 | #define EVP_F_EVP_OPENINIT 102 |
787 | #define EVP_F_EVP_PBE_ALG_ADD 115 | 833 | #define EVP_F_EVP_PBE_ALG_ADD 115 |
@@ -805,6 +851,7 @@ void ERR_load_EVP_strings(void); | |||
805 | #define EVP_F_RC5_CTRL 125 | 851 | #define EVP_F_RC5_CTRL 125 |
806 | 852 | ||
807 | /* Reason codes. */ | 853 | /* Reason codes. */ |
854 | #define EVP_R_AES_KEY_SETUP_FAILED 140 | ||
808 | #define EVP_R_BAD_BLOCK_LENGTH 136 | 855 | #define EVP_R_BAD_BLOCK_LENGTH 136 |
809 | #define EVP_R_BAD_DECRYPT 100 | 856 | #define EVP_R_BAD_DECRYPT 100 |
810 | #define EVP_R_BAD_KEY_LENGTH 137 | 857 | #define EVP_R_BAD_KEY_LENGTH 137 |
@@ -816,6 +863,7 @@ void ERR_load_EVP_strings(void); | |||
816 | #define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 | 863 | #define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 |
817 | #define EVP_R_DECODE_ERROR 114 | 864 | #define EVP_R_DECODE_ERROR 114 |
818 | #define EVP_R_DIFFERENT_KEY_TYPES 101 | 865 | #define EVP_R_DIFFERENT_KEY_TYPES 101 |
866 | #define EVP_R_DISABLED_FOR_FIPS 141 | ||
819 | #define EVP_R_ENCODE_ERROR 115 | 867 | #define EVP_R_ENCODE_ERROR 115 |
820 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 | 868 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 |
821 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 | 869 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 |
diff --git a/src/lib/libssl/src/crypto/evp/evp_enc.c b/src/lib/libssl/src/crypto/evp/evp_enc.c index 8ea5aa935d..f549eeb437 100644 --- a/src/lib/libssl/src/crypto/evp/evp_enc.c +++ b/src/lib/libssl/src/crypto/evp/evp_enc.c | |||
@@ -82,6 +82,48 @@ int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | |||
82 | return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc); | 82 | return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc); |
83 | } | 83 | } |
84 | 84 | ||
85 | #ifdef OPENSSL_FIPS | ||
86 | |||
87 | /* The purpose of these is to trap programs that attempt to use non FIPS | ||
88 | * algorithms in FIPS mode and ignore the errors. | ||
89 | */ | ||
90 | |||
91 | int bad_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
92 | const unsigned char *iv, int enc) | ||
93 | { FIPS_ERROR_IGNORED("Cipher init"); return 0;} | ||
94 | |||
95 | int bad_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
96 | const unsigned char *in, unsigned int inl) | ||
97 | { FIPS_ERROR_IGNORED("Cipher update"); return 0;} | ||
98 | |||
99 | /* NB: no cleanup because it is allowed after failed init */ | ||
100 | |||
101 | int bad_set_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *typ) | ||
102 | { FIPS_ERROR_IGNORED("Cipher set_asn1"); return 0;} | ||
103 | int bad_get_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *typ) | ||
104 | { FIPS_ERROR_IGNORED("Cipher get_asn1"); return 0;} | ||
105 | int bad_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
106 | { FIPS_ERROR_IGNORED("Cipher ctrl"); return 0;} | ||
107 | |||
108 | static const EVP_CIPHER bad_cipher = | ||
109 | { | ||
110 | 0, | ||
111 | 0, | ||
112 | 0, | ||
113 | 0, | ||
114 | 0, | ||
115 | bad_init, | ||
116 | bad_do_cipher, | ||
117 | NULL, | ||
118 | 0, | ||
119 | bad_set_asn1, | ||
120 | bad_get_asn1, | ||
121 | bad_ctrl, | ||
122 | NULL | ||
123 | }; | ||
124 | |||
125 | #endif | ||
126 | |||
85 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | 127 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, |
86 | const unsigned char *key, const unsigned char *iv, int enc) | 128 | const unsigned char *key, const unsigned char *iv, int enc) |
87 | { | 129 | { |
@@ -146,7 +188,6 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp | |||
146 | else | 188 | else |
147 | ctx->engine = NULL; | 189 | ctx->engine = NULL; |
148 | #endif | 190 | #endif |
149 | |||
150 | ctx->cipher=cipher; | 191 | ctx->cipher=cipher; |
151 | if (ctx->cipher->ctx_size) | 192 | if (ctx->cipher->ctx_size) |
152 | { | 193 | { |
@@ -210,6 +251,24 @@ skip_to_init: | |||
210 | } | 251 | } |
211 | } | 252 | } |
212 | 253 | ||
254 | #ifdef OPENSSL_FIPS | ||
255 | /* After 'key' is set no further parameters changes are permissible. | ||
256 | * So only check for non FIPS enabling at this point. | ||
257 | */ | ||
258 | if (key && FIPS_mode()) | ||
259 | { | ||
260 | if (!(ctx->cipher->flags & EVP_CIPH_FLAG_FIPS) | ||
261 | & !(ctx->flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW)) | ||
262 | { | ||
263 | EVPerr(EVP_F_EVP_CIPHERINIT, EVP_R_DISABLED_FOR_FIPS); | ||
264 | ERR_add_error_data(2, "cipher=", | ||
265 | EVP_CIPHER_name(ctx->cipher)); | ||
266 | ctx->cipher = &bad_cipher; | ||
267 | return 0; | ||
268 | } | ||
269 | } | ||
270 | #endif | ||
271 | |||
213 | if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { | 272 | if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { |
214 | if(!ctx->cipher->init(ctx,key,iv,enc)) return 0; | 273 | if(!ctx->cipher->init(ctx,key,iv,enc)) return 0; |
215 | } | 274 | } |
diff --git a/src/lib/libssl/src/crypto/evp/evp_err.c b/src/lib/libssl/src/crypto/evp/evp_err.c index 3a23d21c21..40135d0729 100644 --- a/src/lib/libssl/src/crypto/evp/evp_err.c +++ b/src/lib/libssl/src/crypto/evp/evp_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/evp/evp_err.c */ | 1 | /* crypto/evp/evp_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2005 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 |
@@ -66,13 +66,18 @@ | |||
66 | #ifndef OPENSSL_NO_ERR | 66 | #ifndef OPENSSL_NO_ERR |
67 | static ERR_STRING_DATA EVP_str_functs[]= | 67 | static ERR_STRING_DATA EVP_str_functs[]= |
68 | { | 68 | { |
69 | {ERR_PACK(0,EVP_F_AES_INIT_KEY,0), "AES_INIT_KEY"}, | ||
69 | {ERR_PACK(0,EVP_F_D2I_PKEY,0), "D2I_PKEY"}, | 70 | {ERR_PACK(0,EVP_F_D2I_PKEY,0), "D2I_PKEY"}, |
71 | {ERR_PACK(0,EVP_F_EVP_ADD_CIPHER,0), "EVP_add_cipher"}, | ||
72 | {ERR_PACK(0,EVP_F_EVP_ADD_DIGEST,0), "EVP_add_digest"}, | ||
70 | {ERR_PACK(0,EVP_F_EVP_CIPHERINIT,0), "EVP_CipherInit"}, | 73 | {ERR_PACK(0,EVP_F_EVP_CIPHERINIT,0), "EVP_CipherInit"}, |
71 | {ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_CTRL,0), "EVP_CIPHER_CTX_ctrl"}, | 74 | {ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_CTRL,0), "EVP_CIPHER_CTX_ctrl"}, |
72 | {ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH,0), "EVP_CIPHER_CTX_set_key_length"}, | 75 | {ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH,0), "EVP_CIPHER_CTX_set_key_length"}, |
73 | {ERR_PACK(0,EVP_F_EVP_DECRYPTFINAL,0), "EVP_DecryptFinal"}, | 76 | {ERR_PACK(0,EVP_F_EVP_DECRYPTFINAL,0), "EVP_DecryptFinal"}, |
74 | {ERR_PACK(0,EVP_F_EVP_DIGESTINIT,0), "EVP_DigestInit"}, | 77 | {ERR_PACK(0,EVP_F_EVP_DIGESTINIT,0), "EVP_DigestInit"}, |
75 | {ERR_PACK(0,EVP_F_EVP_ENCRYPTFINAL,0), "EVP_EncryptFinal"}, | 78 | {ERR_PACK(0,EVP_F_EVP_ENCRYPTFINAL,0), "EVP_EncryptFinal"}, |
79 | {ERR_PACK(0,EVP_F_EVP_GET_CIPHERBYNAME,0), "EVP_get_cipherbyname"}, | ||
80 | {ERR_PACK(0,EVP_F_EVP_GET_DIGESTBYNAME,0), "EVP_get_digestbyname"}, | ||
76 | {ERR_PACK(0,EVP_F_EVP_MD_CTX_COPY,0), "EVP_MD_CTX_copy"}, | 81 | {ERR_PACK(0,EVP_F_EVP_MD_CTX_COPY,0), "EVP_MD_CTX_copy"}, |
77 | {ERR_PACK(0,EVP_F_EVP_OPENINIT,0), "EVP_OpenInit"}, | 82 | {ERR_PACK(0,EVP_F_EVP_OPENINIT,0), "EVP_OpenInit"}, |
78 | {ERR_PACK(0,EVP_F_EVP_PBE_ALG_ADD,0), "EVP_PBE_alg_add"}, | 83 | {ERR_PACK(0,EVP_F_EVP_PBE_ALG_ADD,0), "EVP_PBE_alg_add"}, |
@@ -99,6 +104,7 @@ static ERR_STRING_DATA EVP_str_functs[]= | |||
99 | 104 | ||
100 | static ERR_STRING_DATA EVP_str_reasons[]= | 105 | static ERR_STRING_DATA EVP_str_reasons[]= |
101 | { | 106 | { |
107 | {EVP_R_AES_KEY_SETUP_FAILED ,"aes key setup failed"}, | ||
102 | {EVP_R_BAD_BLOCK_LENGTH ,"bad block length"}, | 108 | {EVP_R_BAD_BLOCK_LENGTH ,"bad block length"}, |
103 | {EVP_R_BAD_DECRYPT ,"bad decrypt"}, | 109 | {EVP_R_BAD_DECRYPT ,"bad decrypt"}, |
104 | {EVP_R_BAD_KEY_LENGTH ,"bad key length"}, | 110 | {EVP_R_BAD_KEY_LENGTH ,"bad key length"}, |
@@ -110,6 +116,7 @@ static ERR_STRING_DATA EVP_str_reasons[]= | |||
110 | {EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH ,"data not multiple of block length"}, | 116 | {EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH ,"data not multiple of block length"}, |
111 | {EVP_R_DECODE_ERROR ,"decode error"}, | 117 | {EVP_R_DECODE_ERROR ,"decode error"}, |
112 | {EVP_R_DIFFERENT_KEY_TYPES ,"different key types"}, | 118 | {EVP_R_DIFFERENT_KEY_TYPES ,"different key types"}, |
119 | {EVP_R_DISABLED_FOR_FIPS ,"disabled for fips"}, | ||
113 | {EVP_R_ENCODE_ERROR ,"encode error"}, | 120 | {EVP_R_ENCODE_ERROR ,"encode error"}, |
114 | {EVP_R_EVP_PBE_CIPHERINIT_ERROR ,"evp pbe cipherinit error"}, | 121 | {EVP_R_EVP_PBE_CIPHERINIT_ERROR ,"evp pbe cipherinit error"}, |
115 | {EVP_R_EXPECTING_AN_RSA_KEY ,"expecting an rsa key"}, | 122 | {EVP_R_EXPECTING_AN_RSA_KEY ,"expecting an rsa key"}, |
diff --git a/src/lib/libssl/src/crypto/evp/evp_lib.c b/src/lib/libssl/src/crypto/evp/evp_lib.c index 52a3b287be..a63ba19317 100644 --- a/src/lib/libssl/src/crypto/evp/evp_lib.c +++ b/src/lib/libssl/src/crypto/evp/evp_lib.c | |||
@@ -68,7 +68,7 @@ int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | |||
68 | if (c->cipher->set_asn1_parameters != NULL) | 68 | if (c->cipher->set_asn1_parameters != NULL) |
69 | ret=c->cipher->set_asn1_parameters(c,type); | 69 | ret=c->cipher->set_asn1_parameters(c,type); |
70 | else | 70 | else |
71 | ret=1; | 71 | return -1; |
72 | return(ret); | 72 | return(ret); |
73 | } | 73 | } |
74 | 74 | ||
@@ -79,7 +79,7 @@ int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | |||
79 | if (c->cipher->get_asn1_parameters != NULL) | 79 | if (c->cipher->get_asn1_parameters != NULL) |
80 | ret=c->cipher->get_asn1_parameters(c,type); | 80 | ret=c->cipher->get_asn1_parameters(c,type); |
81 | else | 81 | else |
82 | ret=1; | 82 | return -1; |
83 | return(ret); | 83 | return(ret); |
84 | } | 84 | } |
85 | 85 | ||
@@ -133,6 +133,30 @@ int EVP_CIPHER_type(const EVP_CIPHER *ctx) | |||
133 | 133 | ||
134 | return NID_rc4; | 134 | return NID_rc4; |
135 | 135 | ||
136 | case NID_aes_128_cfb128: | ||
137 | case NID_aes_128_cfb8: | ||
138 | case NID_aes_128_cfb1: | ||
139 | |||
140 | return NID_aes_128_cfb128; | ||
141 | |||
142 | case NID_aes_192_cfb128: | ||
143 | case NID_aes_192_cfb8: | ||
144 | case NID_aes_192_cfb1: | ||
145 | |||
146 | return NID_aes_192_cfb128; | ||
147 | |||
148 | case NID_aes_256_cfb128: | ||
149 | case NID_aes_256_cfb8: | ||
150 | case NID_aes_256_cfb1: | ||
151 | |||
152 | return NID_aes_256_cfb128; | ||
153 | |||
154 | case NID_des_cfb64: | ||
155 | case NID_des_cfb8: | ||
156 | case NID_des_cfb1: | ||
157 | |||
158 | return NID_des_cfb64; | ||
159 | |||
136 | default: | 160 | default: |
137 | /* Check it has an OID and it is valid */ | 161 | /* Check it has an OID and it is valid */ |
138 | otmp = OBJ_nid2obj(nid); | 162 | otmp = OBJ_nid2obj(nid); |
diff --git a/src/lib/libssl/src/crypto/evp/evp_locl.h b/src/lib/libssl/src/crypto/evp/evp_locl.h index 4d81a3bf4c..f8c5343620 100644 --- a/src/lib/libssl/src/crypto/evp/evp_locl.h +++ b/src/lib/libssl/src/crypto/evp/evp_locl.h | |||
@@ -90,7 +90,7 @@ static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const uns | |||
90 | } | 90 | } |
91 | 91 | ||
92 | #define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \ | 92 | #define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \ |
93 | static int cname##_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ | 93 | static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ |
94 | {\ | 94 | {\ |
95 | cprefix##_cfb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\ | 95 | cprefix##_cfb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\ |
96 | return 1;\ | 96 | return 1;\ |
@@ -127,7 +127,7 @@ BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \ | |||
127 | #define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \ | 127 | #define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \ |
128 | iv_len, cbits, flags, init_key, cleanup, \ | 128 | iv_len, cbits, flags, init_key, cleanup, \ |
129 | set_asn1, get_asn1, ctrl) \ | 129 | set_asn1, get_asn1, ctrl) \ |
130 | BLOCK_CIPHER_def1(cname, cfb##cbits, cfb, CFB, kstruct, nid, 1, \ | 130 | BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, \ |
131 | key_len, iv_len, flags, init_key, cleanup, set_asn1, \ | 131 | key_len, iv_len, flags, init_key, cleanup, set_asn1, \ |
132 | get_asn1, ctrl) | 132 | get_asn1, ctrl) |
133 | 133 | ||
@@ -225,3 +225,28 @@ const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; } | |||
225 | get_asn1, ctrl) | 225 | get_asn1, ctrl) |
226 | 226 | ||
227 | #define EVP_C_DATA(kstruct, ctx) ((kstruct *)(ctx)->cipher_data) | 227 | #define EVP_C_DATA(kstruct, ctx) ((kstruct *)(ctx)->cipher_data) |
228 | |||
229 | #define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len,flags) \ | ||
230 | BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \ | ||
231 | BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \ | ||
232 | NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \ | ||
233 | flags, cipher##_init_key, NULL, \ | ||
234 | EVP_CIPHER_set_asn1_iv, \ | ||
235 | EVP_CIPHER_get_asn1_iv, \ | ||
236 | NULL) | ||
237 | |||
238 | #ifdef OPENSSL_FIPS | ||
239 | #define RC2_set_key private_RC2_set_key | ||
240 | #define RC4_set_key private_RC4_set_key | ||
241 | #define CAST_set_key private_CAST_set_key | ||
242 | #define RC5_32_set_key private_RC5_32_set_key | ||
243 | #define BF_set_key private_BF_set_key | ||
244 | #define idea_set_encrypt_key private_idea_set_encrypt_key | ||
245 | |||
246 | #define MD5_Init private_MD5_Init | ||
247 | #define MD4_Init private_MD4_Init | ||
248 | #define MD2_Init private_MD2_Init | ||
249 | #define MDC2_Init private_MDC2_Init | ||
250 | #define SHA_Init private_SHA_Init | ||
251 | |||
252 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/evp/evp_pkey.c b/src/lib/libssl/src/crypto/evp/evp_pkey.c index eb481ec661..47a69932a5 100644 --- a/src/lib/libssl/src/crypto/evp/evp_pkey.c +++ b/src/lib/libssl/src/crypto/evp/evp_pkey.c | |||
@@ -235,7 +235,11 @@ PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken) | |||
235 | return NULL; | 235 | return NULL; |
236 | } | 236 | } |
237 | p8->broken = broken; | 237 | p8->broken = broken; |
238 | ASN1_INTEGER_set (p8->version, 0); | 238 | if (!ASN1_INTEGER_set(p8->version, 0)) { |
239 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
240 | PKCS8_PRIV_KEY_INFO_free (p8); | ||
241 | return NULL; | ||
242 | } | ||
239 | if (!(p8->pkeyalg->parameter = ASN1_TYPE_new ())) { | 243 | if (!(p8->pkeyalg->parameter = ASN1_TYPE_new ())) { |
240 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | 244 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
241 | PKCS8_PRIV_KEY_INFO_free (p8); | 245 | PKCS8_PRIV_KEY_INFO_free (p8); |
@@ -303,29 +307,35 @@ PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken) | |||
303 | #ifndef OPENSSL_NO_DSA | 307 | #ifndef OPENSSL_NO_DSA |
304 | static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | 308 | static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) |
305 | { | 309 | { |
306 | ASN1_STRING *params; | 310 | ASN1_STRING *params = NULL; |
307 | ASN1_INTEGER *prkey; | 311 | ASN1_INTEGER *prkey = NULL; |
308 | ASN1_TYPE *ttmp; | 312 | ASN1_TYPE *ttmp = NULL; |
309 | STACK_OF(ASN1_TYPE) *ndsa; | 313 | STACK_OF(ASN1_TYPE) *ndsa = NULL; |
310 | unsigned char *p, *q; | 314 | unsigned char *p = NULL, *q; |
311 | int len; | 315 | int len; |
312 | 316 | ||
313 | p8->pkeyalg->algorithm = OBJ_nid2obj(NID_dsa); | 317 | p8->pkeyalg->algorithm = OBJ_nid2obj(NID_dsa); |
314 | len = i2d_DSAparams (pkey->pkey.dsa, NULL); | 318 | len = i2d_DSAparams (pkey->pkey.dsa, NULL); |
315 | if (!(p = OPENSSL_malloc(len))) { | 319 | if (!(p = OPENSSL_malloc(len))) { |
316 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | 320 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
317 | PKCS8_PRIV_KEY_INFO_free (p8); | 321 | goto err; |
318 | return 0; | ||
319 | } | 322 | } |
320 | q = p; | 323 | q = p; |
321 | i2d_DSAparams (pkey->pkey.dsa, &q); | 324 | i2d_DSAparams (pkey->pkey.dsa, &q); |
322 | params = ASN1_STRING_new(); | 325 | if (!(params = ASN1_STRING_new())) { |
323 | ASN1_STRING_set(params, p, len); | 326 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
327 | goto err; | ||
328 | } | ||
329 | if (!ASN1_STRING_set(params, p, len)) { | ||
330 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
331 | goto err; | ||
332 | } | ||
324 | OPENSSL_free(p); | 333 | OPENSSL_free(p); |
334 | p = NULL; | ||
325 | /* Get private key into integer */ | 335 | /* Get private key into integer */ |
326 | if (!(prkey = BN_to_ASN1_INTEGER (pkey->pkey.dsa->priv_key, NULL))) { | 336 | if (!(prkey = BN_to_ASN1_INTEGER (pkey->pkey.dsa->priv_key, NULL))) { |
327 | EVPerr(EVP_F_EVP_PKEY2PKCS8,EVP_R_ENCODE_ERROR); | 337 | EVPerr(EVP_F_EVP_PKEY2PKCS8,EVP_R_ENCODE_ERROR); |
328 | return 0; | 338 | goto err; |
329 | } | 339 | } |
330 | 340 | ||
331 | switch(p8->broken) { | 341 | switch(p8->broken) { |
@@ -336,12 +346,13 @@ static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | |||
336 | if (!ASN1_pack_string((char *)prkey, i2d_ASN1_INTEGER, | 346 | if (!ASN1_pack_string((char *)prkey, i2d_ASN1_INTEGER, |
337 | &p8->pkey->value.octet_string)) { | 347 | &p8->pkey->value.octet_string)) { |
338 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | 348 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
339 | M_ASN1_INTEGER_free (prkey); | 349 | goto err; |
340 | return 0; | ||
341 | } | 350 | } |
342 | 351 | ||
343 | M_ASN1_INTEGER_free (prkey); | 352 | M_ASN1_INTEGER_free (prkey); |
353 | prkey = NULL; | ||
344 | p8->pkeyalg->parameter->value.sequence = params; | 354 | p8->pkeyalg->parameter->value.sequence = params; |
355 | params = NULL; | ||
345 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; | 356 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; |
346 | 357 | ||
347 | break; | 358 | break; |
@@ -349,32 +360,51 @@ static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | |||
349 | case PKCS8_NS_DB: | 360 | case PKCS8_NS_DB: |
350 | 361 | ||
351 | p8->pkeyalg->parameter->value.sequence = params; | 362 | p8->pkeyalg->parameter->value.sequence = params; |
363 | params = NULL; | ||
352 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; | 364 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; |
353 | ndsa = sk_ASN1_TYPE_new_null(); | 365 | if (!(ndsa = sk_ASN1_TYPE_new_null())) { |
354 | ttmp = ASN1_TYPE_new(); | 366 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
355 | if (!(ttmp->value.integer = BN_to_ASN1_INTEGER (pkey->pkey.dsa->pub_key, NULL))) { | 367 | goto err; |
368 | } | ||
369 | if (!(ttmp = ASN1_TYPE_new())) { | ||
370 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
371 | goto err; | ||
372 | } | ||
373 | if (!(ttmp->value.integer = | ||
374 | BN_to_ASN1_INTEGER(pkey->pkey.dsa->pub_key, NULL))) { | ||
356 | EVPerr(EVP_F_EVP_PKEY2PKCS8,EVP_R_ENCODE_ERROR); | 375 | EVPerr(EVP_F_EVP_PKEY2PKCS8,EVP_R_ENCODE_ERROR); |
357 | PKCS8_PRIV_KEY_INFO_free(p8); | 376 | goto err; |
358 | return 0; | ||
359 | } | 377 | } |
360 | ttmp->type = V_ASN1_INTEGER; | 378 | ttmp->type = V_ASN1_INTEGER; |
361 | sk_ASN1_TYPE_push(ndsa, ttmp); | 379 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { |
380 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
381 | goto err; | ||
382 | } | ||
362 | 383 | ||
363 | ttmp = ASN1_TYPE_new(); | 384 | if (!(ttmp = ASN1_TYPE_new())) { |
385 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
386 | goto err; | ||
387 | } | ||
364 | ttmp->value.integer = prkey; | 388 | ttmp->value.integer = prkey; |
389 | prkey = NULL; | ||
365 | ttmp->type = V_ASN1_INTEGER; | 390 | ttmp->type = V_ASN1_INTEGER; |
366 | sk_ASN1_TYPE_push(ndsa, ttmp); | 391 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { |
392 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
393 | goto err; | ||
394 | } | ||
395 | ttmp = NULL; | ||
367 | 396 | ||
368 | p8->pkey->value.octet_string = ASN1_OCTET_STRING_new(); | 397 | if (!(p8->pkey->value.octet_string = ASN1_OCTET_STRING_new())) { |
398 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
399 | goto err; | ||
400 | } | ||
369 | 401 | ||
370 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, | 402 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, |
371 | &p8->pkey->value.octet_string->data, | 403 | &p8->pkey->value.octet_string->data, |
372 | &p8->pkey->value.octet_string->length)) { | 404 | &p8->pkey->value.octet_string->length)) { |
373 | 405 | ||
374 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | 406 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
375 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | 407 | goto err; |
376 | M_ASN1_INTEGER_free(prkey); | ||
377 | return 0; | ||
378 | } | 408 | } |
379 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | 409 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); |
380 | break; | 410 | break; |
@@ -382,31 +412,57 @@ static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | |||
382 | case PKCS8_EMBEDDED_PARAM: | 412 | case PKCS8_EMBEDDED_PARAM: |
383 | 413 | ||
384 | p8->pkeyalg->parameter->type = V_ASN1_NULL; | 414 | p8->pkeyalg->parameter->type = V_ASN1_NULL; |
385 | ndsa = sk_ASN1_TYPE_new_null(); | 415 | if (!(ndsa = sk_ASN1_TYPE_new_null())) { |
386 | ttmp = ASN1_TYPE_new(); | 416 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
417 | goto err; | ||
418 | } | ||
419 | if (!(ttmp = ASN1_TYPE_new())) { | ||
420 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
421 | goto err; | ||
422 | } | ||
387 | ttmp->value.sequence = params; | 423 | ttmp->value.sequence = params; |
424 | params = NULL; | ||
388 | ttmp->type = V_ASN1_SEQUENCE; | 425 | ttmp->type = V_ASN1_SEQUENCE; |
389 | sk_ASN1_TYPE_push(ndsa, ttmp); | 426 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { |
427 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
428 | goto err; | ||
429 | } | ||
390 | 430 | ||
391 | ttmp = ASN1_TYPE_new(); | 431 | if (!(ttmp = ASN1_TYPE_new())) { |
432 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
433 | goto err; | ||
434 | } | ||
392 | ttmp->value.integer = prkey; | 435 | ttmp->value.integer = prkey; |
436 | prkey = NULL; | ||
393 | ttmp->type = V_ASN1_INTEGER; | 437 | ttmp->type = V_ASN1_INTEGER; |
394 | sk_ASN1_TYPE_push(ndsa, ttmp); | 438 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { |
439 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
440 | goto err; | ||
441 | } | ||
442 | ttmp = NULL; | ||
395 | 443 | ||
396 | p8->pkey->value.octet_string = ASN1_OCTET_STRING_new(); | 444 | if (!(p8->pkey->value.octet_string = ASN1_OCTET_STRING_new())) { |
445 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
446 | goto err; | ||
447 | } | ||
397 | 448 | ||
398 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, | 449 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, |
399 | &p8->pkey->value.octet_string->data, | 450 | &p8->pkey->value.octet_string->data, |
400 | &p8->pkey->value.octet_string->length)) { | 451 | &p8->pkey->value.octet_string->length)) { |
401 | 452 | ||
402 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | 453 | EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); |
403 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | 454 | goto err; |
404 | M_ASN1_INTEGER_free (prkey); | ||
405 | return 0; | ||
406 | } | 455 | } |
407 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | 456 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); |
408 | break; | 457 | break; |
409 | } | 458 | } |
410 | return 1; | 459 | return 1; |
460 | err: | ||
461 | if (p != NULL) OPENSSL_free(p); | ||
462 | if (params != NULL) ASN1_STRING_free(params); | ||
463 | if (prkey != NULL) M_ASN1_INTEGER_free(prkey); | ||
464 | if (ttmp != NULL) ASN1_TYPE_free(ttmp); | ||
465 | if (ndsa != NULL) sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
466 | return 0; | ||
411 | } | 467 | } |
412 | #endif | 468 | #endif |
diff --git a/src/lib/libssl/src/crypto/evp/evp_test.c b/src/lib/libssl/src/crypto/evp/evp_test.c index 28460173f7..a624cfd248 100644 --- a/src/lib/libssl/src/crypto/evp/evp_test.c +++ b/src/lib/libssl/src/crypto/evp/evp_test.c | |||
@@ -136,7 +136,7 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
136 | const unsigned char *iv,int in, | 136 | const unsigned char *iv,int in, |
137 | const unsigned char *plaintext,int pn, | 137 | const unsigned char *plaintext,int pn, |
138 | const unsigned char *ciphertext,int cn, | 138 | const unsigned char *ciphertext,int cn, |
139 | int encdec) | 139 | int encdec,int multiplier) |
140 | { | 140 | { |
141 | EVP_CIPHER_CTX ctx; | 141 | EVP_CIPHER_CTX ctx; |
142 | unsigned char out[4096]; | 142 | unsigned char out[4096]; |
@@ -162,22 +162,25 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
162 | if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv)) | 162 | if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv)) |
163 | { | 163 | { |
164 | fprintf(stderr,"EncryptInit failed\n"); | 164 | fprintf(stderr,"EncryptInit failed\n"); |
165 | ERR_print_errors_fp(stderr); | ||
165 | test1_exit(10); | 166 | test1_exit(10); |
166 | } | 167 | } |
167 | EVP_CIPHER_CTX_set_padding(&ctx,0); | 168 | EVP_CIPHER_CTX_set_padding(&ctx,0); |
168 | 169 | ||
169 | if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn)) | 170 | if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn*multiplier)) |
170 | { | 171 | { |
171 | fprintf(stderr,"Encrypt failed\n"); | 172 | fprintf(stderr,"Encrypt failed\n"); |
173 | ERR_print_errors_fp(stderr); | ||
172 | test1_exit(6); | 174 | test1_exit(6); |
173 | } | 175 | } |
174 | if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2)) | 176 | if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2)) |
175 | { | 177 | { |
176 | fprintf(stderr,"EncryptFinal failed\n"); | 178 | fprintf(stderr,"EncryptFinal failed\n"); |
179 | ERR_print_errors_fp(stderr); | ||
177 | test1_exit(7); | 180 | test1_exit(7); |
178 | } | 181 | } |
179 | 182 | ||
180 | if(outl+outl2 != cn) | 183 | if(outl+outl2 != cn*multiplier) |
181 | { | 184 | { |
182 | fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n", | 185 | fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n", |
183 | outl+outl2,cn); | 186 | outl+outl2,cn); |
@@ -198,22 +201,25 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
198 | if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv)) | 201 | if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv)) |
199 | { | 202 | { |
200 | fprintf(stderr,"DecryptInit failed\n"); | 203 | fprintf(stderr,"DecryptInit failed\n"); |
204 | ERR_print_errors_fp(stderr); | ||
201 | test1_exit(11); | 205 | test1_exit(11); |
202 | } | 206 | } |
203 | EVP_CIPHER_CTX_set_padding(&ctx,0); | 207 | EVP_CIPHER_CTX_set_padding(&ctx,0); |
204 | 208 | ||
205 | if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn)) | 209 | if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn*multiplier)) |
206 | { | 210 | { |
207 | fprintf(stderr,"Decrypt failed\n"); | 211 | fprintf(stderr,"Decrypt failed\n"); |
212 | ERR_print_errors_fp(stderr); | ||
208 | test1_exit(6); | 213 | test1_exit(6); |
209 | } | 214 | } |
210 | if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2)) | 215 | if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2)) |
211 | { | 216 | { |
212 | fprintf(stderr,"DecryptFinal failed\n"); | 217 | fprintf(stderr,"DecryptFinal failed\n"); |
218 | ERR_print_errors_fp(stderr); | ||
213 | test1_exit(7); | 219 | test1_exit(7); |
214 | } | 220 | } |
215 | 221 | ||
216 | if(outl+outl2 != cn) | 222 | if(outl+outl2 != cn*multiplier) |
217 | { | 223 | { |
218 | fprintf(stderr,"Plaintext length mismatch got %d expected %d\n", | 224 | fprintf(stderr,"Plaintext length mismatch got %d expected %d\n", |
219 | outl+outl2,cn); | 225 | outl+outl2,cn); |
@@ -238,7 +244,7 @@ static int test_cipher(const char *cipher,const unsigned char *key,int kn, | |||
238 | const unsigned char *iv,int in, | 244 | const unsigned char *iv,int in, |
239 | const unsigned char *plaintext,int pn, | 245 | const unsigned char *plaintext,int pn, |
240 | const unsigned char *ciphertext,int cn, | 246 | const unsigned char *ciphertext,int cn, |
241 | int encdec) | 247 | int encdec,int multiplier) |
242 | { | 248 | { |
243 | const EVP_CIPHER *c; | 249 | const EVP_CIPHER *c; |
244 | 250 | ||
@@ -246,7 +252,7 @@ static int test_cipher(const char *cipher,const unsigned char *key,int kn, | |||
246 | if(!c) | 252 | if(!c) |
247 | return 0; | 253 | return 0; |
248 | 254 | ||
249 | test1(c,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec); | 255 | test1(c,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec,multiplier); |
250 | 256 | ||
251 | return 1; | 257 | return 1; |
252 | } | 258 | } |
@@ -272,16 +278,19 @@ static int test_digest(const char *digest, | |||
272 | if(!EVP_DigestInit_ex(&ctx,d, NULL)) | 278 | if(!EVP_DigestInit_ex(&ctx,d, NULL)) |
273 | { | 279 | { |
274 | fprintf(stderr,"DigestInit failed\n"); | 280 | fprintf(stderr,"DigestInit failed\n"); |
281 | ERR_print_errors_fp(stderr); | ||
275 | EXIT(100); | 282 | EXIT(100); |
276 | } | 283 | } |
277 | if(!EVP_DigestUpdate(&ctx,plaintext,pn)) | 284 | if(!EVP_DigestUpdate(&ctx,plaintext,pn)) |
278 | { | 285 | { |
279 | fprintf(stderr,"DigestUpdate failed\n"); | 286 | fprintf(stderr,"DigestUpdate failed\n"); |
287 | ERR_print_errors_fp(stderr); | ||
280 | EXIT(101); | 288 | EXIT(101); |
281 | } | 289 | } |
282 | if(!EVP_DigestFinal_ex(&ctx,md,&mdn)) | 290 | if(!EVP_DigestFinal_ex(&ctx,md,&mdn)) |
283 | { | 291 | { |
284 | fprintf(stderr,"DigestFinal failed\n"); | 292 | fprintf(stderr,"DigestFinal failed\n"); |
293 | ERR_print_errors_fp(stderr); | ||
285 | EXIT(101); | 294 | EXIT(101); |
286 | } | 295 | } |
287 | EVP_MD_CTX_cleanup(&ctx); | 296 | EVP_MD_CTX_cleanup(&ctx); |
@@ -359,6 +368,7 @@ int main(int argc,char **argv) | |||
359 | unsigned char *iv,*key,*plaintext,*ciphertext; | 368 | unsigned char *iv,*key,*plaintext,*ciphertext; |
360 | int encdec; | 369 | int encdec; |
361 | int kn,in,pn,cn; | 370 | int kn,in,pn,cn; |
371 | int multiplier=1; | ||
362 | 372 | ||
363 | if(!fgets((char *)line,sizeof line,f)) | 373 | if(!fgets((char *)line,sizeof line,f)) |
364 | break; | 374 | break; |
@@ -383,7 +393,15 @@ int main(int argc,char **argv) | |||
383 | pn=convert(plaintext); | 393 | pn=convert(plaintext); |
384 | cn=convert(ciphertext); | 394 | cn=convert(ciphertext); |
385 | 395 | ||
386 | if(!test_cipher(cipher,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec) | 396 | if(strchr(cipher,'*')) |
397 | { | ||
398 | p=cipher; | ||
399 | sstrsep(&p,"*"); | ||
400 | multiplier=atoi(sstrsep(&p,"*")); | ||
401 | } | ||
402 | |||
403 | if(!test_cipher(cipher,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec, | ||
404 | multiplier) | ||
387 | && !test_digest(cipher,plaintext,pn,ciphertext,cn)) | 405 | && !test_digest(cipher,plaintext,pn,ciphertext,cn)) |
388 | { | 406 | { |
389 | fprintf(stderr,"Can't find %s\n",cipher); | 407 | fprintf(stderr,"Can't find %s\n",cipher); |
diff --git a/src/lib/libssl/src/crypto/evp/evptests.txt b/src/lib/libssl/src/crypto/evp/evptests.txt index 80bd9c7765..dfe91a5bc0 100644 --- a/src/lib/libssl/src/crypto/evp/evptests.txt +++ b/src/lib/libssl/src/crypto/evp/evptests.txt | |||
@@ -92,7 +92,102 @@ AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000 | |||
92 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:F58C4C04D6E5F1BA779EABFB5F7BFBD6:AE2D8A571E03AC9C9EB76FAC45AF8E51:9CFC4E967EDB808D679F777BC6702C7D | 92 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:F58C4C04D6E5F1BA779EABFB5F7BFBD6:AE2D8A571E03AC9C9EB76FAC45AF8E51:9CFC4E967EDB808D679F777BC6702C7D |
93 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:9CFC4E967EDB808D679F777BC6702C7D:30C81C46A35CE411E5FBC1191A0A52EF:39F23369A9D9BACFA530E26304231461 | 93 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:9CFC4E967EDB808D679F777BC6702C7D:30C81C46A35CE411E5FBC1191A0A52EF:39F23369A9D9BACFA530E26304231461 |
94 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39F23369A9D9BACFA530E26304231461:F69F2445DF4F9B17AD2B417BE66C3710:B2EB05E2C39BE9FCDA6C19078C6A9D1B | 94 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39F23369A9D9BACFA530E26304231461:F69F2445DF4F9B17AD2B417BE66C3710:B2EB05E2C39BE9FCDA6C19078C6A9D1B |
95 | # We don't support CFB{1,8}-AESxxx.{En,De}crypt | 95 | |
96 | # CFB1-AES128.Encrypt | ||
97 | |||
98 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:00:00:1 | ||
99 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00020406080a0c0e10121416181a1c1e:80:80:1 | ||
100 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0004080c1014181c2024282c3034383d:80:80:1 | ||
101 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0008101820283038404850586068707b:00:00:1 | ||
102 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00102030405060708090a0b0c0d0e0f6:80:80:1 | ||
103 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0020406080a0c0e10121416181a1c1ed:00:00:1 | ||
104 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:004080c1014181c2024282c3034383da:80:00:1 | ||
105 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:008101820283038404850586068707b4:80:00:1 | ||
106 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f68:80:80:1 | ||
107 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:020406080a0c0e10121416181a1c1ed1:80:00:1 | ||
108 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:04080c1014181c2024282c3034383da2:00:80:1 | ||
109 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:08101820283038404850586068707b45:00:80:1 | ||
110 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:102030405060708090a0b0c0d0e0f68b:00:00:1 | ||
111 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:20406080a0c0e10121416181a1c1ed16:00:00:1 | ||
112 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:4080c1014181c2024282c3034383da2c:00:80:1 | ||
113 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:8101820283038404850586068707b459:80:80:1 | ||
114 | # all of the above packed into one... | ||
115 | # in: 0110 1011 1100 0001 = 6bc1 | ||
116 | # out: 0110 1000 1011 0011 = 68b3 | ||
117 | AES-128-CFB1*8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1:68b3:1 | ||
118 | |||
119 | # CFB1-AES128.Decrypt | ||
120 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:00:00:0 | ||
121 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00020406080a0c0e10121416181a1c1e:80:80:0 | ||
122 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0004080c1014181c2024282c3034383d:80:80:0 | ||
123 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0008101820283038404850586068707b:00:00:0 | ||
124 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00102030405060708090a0b0c0d0e0f6:80:80:0 | ||
125 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0020406080a0c0e10121416181a1c1ed:00:00:0 | ||
126 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:004080c1014181c2024282c3034383da:80:00:0 | ||
127 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:008101820283038404850586068707b4:80:00:0 | ||
128 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f68:80:80:0 | ||
129 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:020406080a0c0e10121416181a1c1ed1:80:00:0 | ||
130 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:04080c1014181c2024282c3034383da2:00:80:0 | ||
131 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:08101820283038404850586068707b45:00:80:0 | ||
132 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:102030405060708090a0b0c0d0e0f68b:00:00:0 | ||
133 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:20406080a0c0e10121416181a1c1ed16:00:00:0 | ||
134 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:4080c1014181c2024282c3034383da2c:00:80:0 | ||
135 | AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:8101820283038404850586068707b459:80:80:0 | ||
136 | # all of the above packed into one... | ||
137 | # in: 0110 1000 1011 0011 = 68b3 | ||
138 | # out: 0110 1011 1100 0001 = 6bc1 | ||
139 | AES-128-CFB1*8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1:68b3:0 | ||
140 | |||
141 | # TODO: CFB1-AES192 and 256 | ||
142 | |||
143 | # CFB8-AES128.Encrypt | ||
144 | |||
145 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6b:3b:1 | ||
146 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f3b:c1:79:1 | ||
147 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:02030405060708090a0b0c0d0e0f3b79:be:42:1 | ||
148 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:030405060708090a0b0c0d0e0f3b7942:e2:4c:1 | ||
149 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0405060708090a0b0c0d0e0f3b79424c:2e:9c:1 | ||
150 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:05060708090a0b0c0d0e0f3b79424c9c:40:0d:1 | ||
151 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:060708090a0b0c0d0e0f3b79424c9c0d:9f:d4:1 | ||
152 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0708090a0b0c0d0e0f3b79424c9c0dd4:96:36:1 | ||
153 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:08090a0b0c0d0e0f3b79424c9c0dd436:e9:ba:1 | ||
154 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:090a0b0c0d0e0f3b79424c9c0dd436ba:3d:ce:1 | ||
155 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0a0b0c0d0e0f3b79424c9c0dd436bace:7e:9e:1 | ||
156 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0b0c0d0e0f3b79424c9c0dd436bace9e:11:0e:1 | ||
157 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0c0d0e0f3b79424c9c0dd436bace9e0e:73:d4:1 | ||
158 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0d0e0f3b79424c9c0dd436bace9e0ed4:93:58:1 | ||
159 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0e0f3b79424c9c0dd436bace9e0ed458:17:6a:1 | ||
160 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0f3b79424c9c0dd436bace9e0ed4586a:2a:4f:1 | ||
161 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:3b79424c9c0dd436bace9e0ed4586a4f:ae:32:1 | ||
162 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:79424c9c0dd436bace9e0ed4586a4f32:2d:b9:1 | ||
163 | # all of the above packed into one | ||
164 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1bee22e409f96e93d7e117393172aae2d:3b79424c9c0dd436bace9e0ed4586a4f32b9:1 | ||
165 | |||
166 | # CFB8-AES128.Decrypt | ||
167 | |||
168 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6b:3b:0 | ||
169 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f3b:c1:79:0 | ||
170 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:02030405060708090a0b0c0d0e0f3b79:be:42:0 | ||
171 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:030405060708090a0b0c0d0e0f3b7942:e2:4c:0 | ||
172 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0405060708090a0b0c0d0e0f3b79424c:2e:9c:0 | ||
173 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:05060708090a0b0c0d0e0f3b79424c9c:40:0d:0 | ||
174 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:060708090a0b0c0d0e0f3b79424c9c0d:9f:d4:0 | ||
175 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0708090a0b0c0d0e0f3b79424c9c0dd4:96:36:0 | ||
176 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:08090a0b0c0d0e0f3b79424c9c0dd436:e9:ba:0 | ||
177 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:090a0b0c0d0e0f3b79424c9c0dd436ba:3d:ce:0 | ||
178 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0a0b0c0d0e0f3b79424c9c0dd436bace:7e:9e:0 | ||
179 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0b0c0d0e0f3b79424c9c0dd436bace9e:11:0e:0 | ||
180 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0c0d0e0f3b79424c9c0dd436bace9e0e:73:d4:0 | ||
181 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0d0e0f3b79424c9c0dd436bace9e0ed4:93:58:0 | ||
182 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0e0f3b79424c9c0dd436bace9e0ed458:17:6a:0 | ||
183 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0f3b79424c9c0dd436bace9e0ed4586a:2a:4f:0 | ||
184 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:3b79424c9c0dd436bace9e0ed4586a4f:ae:32:0 | ||
185 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:79424c9c0dd436bace9e0ed4586a4f32:2d:b9:0 | ||
186 | # all of the above packed into one | ||
187 | AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1bee22e409f96e93d7e117393172aae2d:3b79424c9c0dd436bace9e0ed4586a4f32b9:0 | ||
188 | |||
189 | # TODO: 192 and 256 bit keys | ||
190 | |||
96 | # For all CFB128 encrypts and decrypts, the transformed sequence is | 191 | # For all CFB128 encrypts and decrypts, the transformed sequence is |
97 | # AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec | 192 | # AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec |
98 | # CFB128-AES128.Encrypt | 193 | # CFB128-AES128.Encrypt |
@@ -174,6 +269,16 @@ DESX-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363 | |||
174 | # DES EDE3 CBC tests (from destest) | 269 | # DES EDE3 CBC tests (from destest) |
175 | DES-EDE3-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D41C673812CFDE9675 | 270 | DES-EDE3-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D41C673812CFDE9675 |
176 | 271 | ||
272 | # DES CFB1 from FIPS 81 | ||
273 | # plaintext: 0100 1110 0110 1111 0111 0111 = 4e6f77 | ||
274 | # ciphertext: 1100 1101 0001 1110 1100 1001 = cd1ec9 | ||
275 | |||
276 | DES-CFB1*8:0123456789abcdef:1234567890abcdef:4e6f77:cd1ec9 | ||
277 | |||
278 | # DES CFB8 from FIPS 81 | ||
279 | |||
280 | DES-CFB8:0123456789abcdef:1234567890abcdef:4e6f7720697320746865:f31fda07011462ee187f | ||
281 | |||
177 | # RC4 tests (from rc4test) | 282 | # RC4 tests (from rc4test) |
178 | RC4:0123456789abcdef0123456789abcdef::0123456789abcdef:75b7878099e0c596 | 283 | RC4:0123456789abcdef0123456789abcdef::0123456789abcdef:75b7878099e0c596 |
179 | RC4:0123456789abcdef0123456789abcdef::0000000000000000:7494c2e7104b0879 | 284 | RC4:0123456789abcdef0123456789abcdef::0000000000000000:7494c2e7104b0879 |
diff --git a/src/lib/libssl/src/crypto/evp/m_dss.c b/src/lib/libssl/src/crypto/evp/m_dss.c index beb8d7fc5c..d393eb3400 100644 --- a/src/lib/libssl/src/crypto/evp/m_dss.c +++ b/src/lib/libssl/src/crypto/evp/m_dss.c | |||
@@ -77,7 +77,7 @@ static const EVP_MD dsa_md= | |||
77 | NID_dsaWithSHA, | 77 | NID_dsaWithSHA, |
78 | NID_dsaWithSHA, | 78 | NID_dsaWithSHA, |
79 | SHA_DIGEST_LENGTH, | 79 | SHA_DIGEST_LENGTH, |
80 | 0, | 80 | EVP_MD_FLAG_FIPS, |
81 | init, | 81 | init, |
82 | update, | 82 | update, |
83 | final, | 83 | final, |
diff --git a/src/lib/libssl/src/crypto/evp/m_md2.c b/src/lib/libssl/src/crypto/evp/m_md2.c index 50914c83b3..0df48e5199 100644 --- a/src/lib/libssl/src/crypto/evp/m_md2.c +++ b/src/lib/libssl/src/crypto/evp/m_md2.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include "evp_locl.h" | ||
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | #include <openssl/md2.h> | 66 | #include <openssl/md2.h> |
diff --git a/src/lib/libssl/src/crypto/evp/m_md4.c b/src/lib/libssl/src/crypto/evp/m_md4.c index e19b663754..0605e4b707 100644 --- a/src/lib/libssl/src/crypto/evp/m_md4.c +++ b/src/lib/libssl/src/crypto/evp/m_md4.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include "evp_locl.h" | ||
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | #include <openssl/md4.h> | 66 | #include <openssl/md4.h> |
diff --git a/src/lib/libssl/src/crypto/evp/m_md5.c b/src/lib/libssl/src/crypto/evp/m_md5.c index b00a03e048..752615d473 100644 --- a/src/lib/libssl/src/crypto/evp/m_md5.c +++ b/src/lib/libssl/src/crypto/evp/m_md5.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include "evp_locl.h" | ||
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | #include <openssl/md5.h> | 66 | #include <openssl/md5.h> |
diff --git a/src/lib/libssl/src/crypto/evp/m_mdc2.c b/src/lib/libssl/src/crypto/evp/m_mdc2.c index 9f6467c931..62de1336b8 100644 --- a/src/lib/libssl/src/crypto/evp/m_mdc2.c +++ b/src/lib/libssl/src/crypto/evp/m_mdc2.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include "evp_locl.h" | ||
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | #include <openssl/mdc2.h> | 66 | #include <openssl/mdc2.h> |
diff --git a/src/lib/libssl/src/crypto/evp/m_sha.c b/src/lib/libssl/src/crypto/evp/m_sha.c index 10697c7ed3..d1785e5f74 100644 --- a/src/lib/libssl/src/crypto/evp/m_sha.c +++ b/src/lib/libssl/src/crypto/evp/m_sha.c | |||
@@ -56,10 +56,11 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_SHA | 59 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) |
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include "evp_locl.h" | ||
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | 66 | ||
diff --git a/src/lib/libssl/src/crypto/evp/m_sha1.c b/src/lib/libssl/src/crypto/evp/m_sha1.c index d6be3502f0..fe4402389a 100644 --- a/src/lib/libssl/src/crypto/evp/m_sha1.c +++ b/src/lib/libssl/src/crypto/evp/m_sha1.c | |||
@@ -77,7 +77,7 @@ static const EVP_MD sha1_md= | |||
77 | NID_sha1, | 77 | NID_sha1, |
78 | NID_sha1WithRSAEncryption, | 78 | NID_sha1WithRSAEncryption, |
79 | SHA_DIGEST_LENGTH, | 79 | SHA_DIGEST_LENGTH, |
80 | 0, | 80 | EVP_MD_FLAG_FIPS, |
81 | init, | 81 | init, |
82 | update, | 82 | update, |
83 | final, | 83 | final, |
diff --git a/src/lib/libssl/src/crypto/evp/names.c b/src/lib/libssl/src/crypto/evp/names.c index eb9f4329cd..7712453046 100644 --- a/src/lib/libssl/src/crypto/evp/names.c +++ b/src/lib/libssl/src/crypto/evp/names.c | |||
@@ -61,6 +61,9 @@ | |||
61 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
62 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
63 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
64 | #ifdef OPENSSL_FIPS | ||
65 | #include <openssl/fips.h> | ||
66 | #endif | ||
64 | 67 | ||
65 | int EVP_add_cipher(const EVP_CIPHER *c) | 68 | int EVP_add_cipher(const EVP_CIPHER *c) |
66 | { | 69 | { |
diff --git a/src/lib/libssl/src/crypto/hmac/hmac.c b/src/lib/libssl/src/crypto/hmac/hmac.c index 4c91f919d5..06ee80761f 100644 --- a/src/lib/libssl/src/crypto/hmac/hmac.c +++ b/src/lib/libssl/src/crypto/hmac/hmac.c | |||
@@ -77,6 +77,15 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
77 | 77 | ||
78 | if (key != NULL) | 78 | if (key != NULL) |
79 | { | 79 | { |
80 | #ifdef OPENSSL_FIPS | ||
81 | if (FIPS_mode() && !(md->flags & EVP_MD_FLAG_FIPS) | ||
82 | && (!(ctx->md_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW) | ||
83 | || !(ctx->i_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW) | ||
84 | || !(ctx->o_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW))) | ||
85 | OpenSSLDie(__FILE__,__LINE__, | ||
86 | "HMAC: digest not allowed in FIPS mode"); | ||
87 | #endif | ||
88 | |||
80 | reset=1; | 89 | reset=1; |
81 | j=EVP_MD_block_size(md); | 90 | j=EVP_MD_block_size(md); |
82 | OPENSSL_assert(j <= sizeof ctx->key); | 91 | OPENSSL_assert(j <= sizeof ctx->key); |
@@ -171,3 +180,10 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | |||
171 | return(md); | 180 | return(md); |
172 | } | 181 | } |
173 | 182 | ||
183 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags) | ||
184 | { | ||
185 | EVP_MD_CTX_set_flags(&ctx->i_ctx, flags); | ||
186 | EVP_MD_CTX_set_flags(&ctx->o_ctx, flags); | ||
187 | EVP_MD_CTX_set_flags(&ctx->md_ctx, flags); | ||
188 | } | ||
189 | |||
diff --git a/src/lib/libssl/src/crypto/hmac/hmac.h b/src/lib/libssl/src/crypto/hmac/hmac.h index 0364a1fcbd..294ab3b36a 100644 --- a/src/lib/libssl/src/crypto/hmac/hmac.h +++ b/src/lib/libssl/src/crypto/hmac/hmac.h | |||
@@ -98,6 +98,7 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | |||
98 | const unsigned char *d, int n, unsigned char *md, | 98 | const unsigned char *d, int n, unsigned char *md, |
99 | unsigned int *md_len); | 99 | unsigned int *md_len); |
100 | 100 | ||
101 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); | ||
101 | 102 | ||
102 | #ifdef __cplusplus | 103 | #ifdef __cplusplus |
103 | } | 104 | } |
diff --git a/src/lib/libssl/src/crypto/idea/idea.h b/src/lib/libssl/src/crypto/idea/idea.h index 67132414ee..bf41844fd7 100644 --- a/src/lib/libssl/src/crypto/idea/idea.h +++ b/src/lib/libssl/src/crypto/idea/idea.h | |||
@@ -82,6 +82,10 @@ typedef struct idea_key_st | |||
82 | const char *idea_options(void); | 82 | const char *idea_options(void); |
83 | void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, | 83 | void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, |
84 | IDEA_KEY_SCHEDULE *ks); | 84 | IDEA_KEY_SCHEDULE *ks); |
85 | #ifdef OPENSSL_FIPS | ||
86 | void private_idea_set_encrypt_key(const unsigned char *key, | ||
87 | IDEA_KEY_SCHEDULE *ks); | ||
88 | #endif | ||
85 | void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); | 89 | void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); |
86 | void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); | 90 | void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); |
87 | void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, | 91 | void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, |
diff --git a/src/lib/libssl/src/crypto/md2/md2.h b/src/lib/libssl/src/crypto/md2/md2.h index ad9241455c..d0ef9da08e 100644 --- a/src/lib/libssl/src/crypto/md2/md2.h +++ b/src/lib/libssl/src/crypto/md2/md2.h | |||
@@ -80,6 +80,9 @@ typedef struct MD2state_st | |||
80 | } MD2_CTX; | 80 | } MD2_CTX; |
81 | 81 | ||
82 | const char *MD2_options(void); | 82 | const char *MD2_options(void); |
83 | #ifdef OPENSSL_FIPS | ||
84 | int private_MD2_Init(MD2_CTX *c); | ||
85 | #endif | ||
83 | int MD2_Init(MD2_CTX *c); | 86 | int MD2_Init(MD2_CTX *c); |
84 | int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len); | 87 | int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len); |
85 | int MD2_Final(unsigned char *md, MD2_CTX *c); | 88 | int MD2_Final(unsigned char *md, MD2_CTX *c); |
diff --git a/src/lib/libssl/src/crypto/md2/md2_dgst.c b/src/lib/libssl/src/crypto/md2/md2_dgst.c index ecb64f0ec4..8124acd687 100644 --- a/src/lib/libssl/src/crypto/md2/md2_dgst.c +++ b/src/lib/libssl/src/crypto/md2/md2_dgst.c | |||
@@ -62,6 +62,8 @@ | |||
62 | #include <openssl/md2.h> | 62 | #include <openssl/md2.h> |
63 | #include <openssl/opensslv.h> | 63 | #include <openssl/opensslv.h> |
64 | #include <openssl/crypto.h> | 64 | #include <openssl/crypto.h> |
65 | #include <openssl/fips.h> | ||
66 | #include <openssl/err.h> | ||
65 | 67 | ||
66 | const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT; | 68 | const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT; |
67 | 69 | ||
@@ -116,7 +118,7 @@ const char *MD2_options(void) | |||
116 | return("md2(int)"); | 118 | return("md2(int)"); |
117 | } | 119 | } |
118 | 120 | ||
119 | int MD2_Init(MD2_CTX *c) | 121 | FIPS_NON_FIPS_MD_Init(MD2) |
120 | { | 122 | { |
121 | c->num=0; | 123 | c->num=0; |
122 | memset(c->state,0,sizeof c->state); | 124 | memset(c->state,0,sizeof c->state); |
diff --git a/src/lib/libssl/src/crypto/md32_common.h b/src/lib/libssl/src/crypto/md32_common.h index 573850b122..733da6acaf 100644 --- a/src/lib/libssl/src/crypto/md32_common.h +++ b/src/lib/libssl/src/crypto/md32_common.h | |||
@@ -128,6 +128,10 @@ | |||
128 | * <appro@fy.chalmers.se> | 128 | * <appro@fy.chalmers.se> |
129 | */ | 129 | */ |
130 | 130 | ||
131 | #include <openssl/crypto.h> | ||
132 | #include <openssl/fips.h> | ||
133 | #include <openssl/err.h> | ||
134 | |||
131 | #if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN) | 135 | #if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN) |
132 | #error "DATA_ORDER must be defined!" | 136 | #error "DATA_ORDER must be defined!" |
133 | #endif | 137 | #endif |
@@ -207,7 +211,7 @@ | |||
207 | : "cc"); \ | 211 | : "cc"); \ |
208 | ret; \ | 212 | ret; \ |
209 | }) | 213 | }) |
210 | # elif defined(__powerpc) || defined(__ppc) | 214 | # elif defined(__powerpc) || defined(__ppc__) || defined(__powerpc64__) |
211 | # define ROTATE(a,n) ({ register unsigned int ret; \ | 215 | # define ROTATE(a,n) ({ register unsigned int ret; \ |
212 | asm ( \ | 216 | asm ( \ |
213 | "rlwinm %0,%1,%2,0,31" \ | 217 | "rlwinm %0,%1,%2,0,31" \ |
@@ -555,6 +559,14 @@ int HASH_FINAL (unsigned char *md, HASH_CTX *c) | |||
555 | static const unsigned char end[4]={0x80,0x00,0x00,0x00}; | 559 | static const unsigned char end[4]={0x80,0x00,0x00,0x00}; |
556 | const unsigned char *cp=end; | 560 | const unsigned char *cp=end; |
557 | 561 | ||
562 | #if 0 | ||
563 | if(FIPS_mode() && !FIPS_md5_allowed()) | ||
564 | { | ||
565 | FIPSerr(FIPS_F_HASH_FINAL,FIPS_R_NON_FIPS_METHOD); | ||
566 | return 0; | ||
567 | } | ||
568 | #endif | ||
569 | |||
558 | /* c->num should definitly have room for at least one more byte. */ | 570 | /* c->num should definitly have room for at least one more byte. */ |
559 | p=c->data; | 571 | p=c->data; |
560 | i=c->num>>2; | 572 | i=c->num>>2; |
diff --git a/src/lib/libssl/src/crypto/md4/md4.h b/src/lib/libssl/src/crypto/md4/md4.h index 7a7b23682f..7e761efb62 100644 --- a/src/lib/libssl/src/crypto/md4/md4.h +++ b/src/lib/libssl/src/crypto/md4/md4.h | |||
@@ -104,6 +104,9 @@ typedef struct MD4state_st | |||
104 | int num; | 104 | int num; |
105 | } MD4_CTX; | 105 | } MD4_CTX; |
106 | 106 | ||
107 | #ifdef OPENSSL_FIPS | ||
108 | int private_MD4_Init(MD4_CTX *c); | ||
109 | #endif | ||
107 | int MD4_Init(MD4_CTX *c); | 110 | int MD4_Init(MD4_CTX *c); |
108 | int MD4_Update(MD4_CTX *c, const void *data, unsigned long len); | 111 | int MD4_Update(MD4_CTX *c, const void *data, unsigned long len); |
109 | int MD4_Final(unsigned char *md, MD4_CTX *c); | 112 | int MD4_Final(unsigned char *md, MD4_CTX *c); |
diff --git a/src/lib/libssl/src/crypto/md4/md4_dgst.c b/src/lib/libssl/src/crypto/md4/md4_dgst.c index 7afb7185b6..ee7cc72262 100644 --- a/src/lib/libssl/src/crypto/md4/md4_dgst.c +++ b/src/lib/libssl/src/crypto/md4/md4_dgst.c | |||
@@ -70,7 +70,7 @@ const char *MD4_version="MD4" OPENSSL_VERSION_PTEXT; | |||
70 | #define INIT_DATA_C (unsigned long)0x98badcfeL | 70 | #define INIT_DATA_C (unsigned long)0x98badcfeL |
71 | #define INIT_DATA_D (unsigned long)0x10325476L | 71 | #define INIT_DATA_D (unsigned long)0x10325476L |
72 | 72 | ||
73 | int MD4_Init(MD4_CTX *c) | 73 | FIPS_NON_FIPS_MD_Init(MD4) |
74 | { | 74 | { |
75 | c->A=INIT_DATA_A; | 75 | c->A=INIT_DATA_A; |
76 | c->B=INIT_DATA_B; | 76 | c->B=INIT_DATA_B; |
diff --git a/src/lib/libssl/src/crypto/md5/md5.h b/src/lib/libssl/src/crypto/md5/md5.h index a252e02115..c663dd1816 100644 --- a/src/lib/libssl/src/crypto/md5/md5.h +++ b/src/lib/libssl/src/crypto/md5/md5.h | |||
@@ -104,6 +104,9 @@ typedef struct MD5state_st | |||
104 | int num; | 104 | int num; |
105 | } MD5_CTX; | 105 | } MD5_CTX; |
106 | 106 | ||
107 | #ifdef OPENSSL_FIPS | ||
108 | int private_MD5_Init(MD5_CTX *c); | ||
109 | #endif | ||
107 | int MD5_Init(MD5_CTX *c); | 110 | int MD5_Init(MD5_CTX *c); |
108 | int MD5_Update(MD5_CTX *c, const void *data, unsigned long len); | 111 | int MD5_Update(MD5_CTX *c, const void *data, unsigned long len); |
109 | int MD5_Final(unsigned char *md, MD5_CTX *c); | 112 | int MD5_Final(unsigned char *md, MD5_CTX *c); |
diff --git a/src/lib/libssl/src/crypto/md5/md5_dgst.c b/src/lib/libssl/src/crypto/md5/md5_dgst.c index 9c7abc3697..54b33c6509 100644 --- a/src/lib/libssl/src/crypto/md5/md5_dgst.c +++ b/src/lib/libssl/src/crypto/md5/md5_dgst.c | |||
@@ -70,7 +70,7 @@ const char *MD5_version="MD5" OPENSSL_VERSION_PTEXT; | |||
70 | #define INIT_DATA_C (unsigned long)0x98badcfeL | 70 | #define INIT_DATA_C (unsigned long)0x98badcfeL |
71 | #define INIT_DATA_D (unsigned long)0x10325476L | 71 | #define INIT_DATA_D (unsigned long)0x10325476L |
72 | 72 | ||
73 | int MD5_Init(MD5_CTX *c) | 73 | FIPS_NON_FIPS_MD_Init(MD5) |
74 | { | 74 | { |
75 | c->A=INIT_DATA_A; | 75 | c->A=INIT_DATA_A; |
76 | c->B=INIT_DATA_B; | 76 | c->B=INIT_DATA_B; |
diff --git a/src/lib/libssl/src/crypto/mdc2/Makefile b/src/lib/libssl/src/crypto/mdc2/Makefile new file mode 100644 index 0000000000..38c785bf95 --- /dev/null +++ b/src/lib/libssl/src/crypto/mdc2/Makefile | |||
@@ -0,0 +1,98 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/mdc2/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= mdc2 | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= | ||
9 | CFLAG=-g | ||
10 | INSTALL_PREFIX= | ||
11 | OPENSSLDIR= /usr/local/ssl | ||
12 | INSTALLTOP=/usr/local/ssl | ||
13 | MAKEDEPPROG= makedepend | ||
14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
15 | MAKEFILE= Makefile | ||
16 | AR= ar r | ||
17 | |||
18 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
19 | |||
20 | GENERAL=Makefile | ||
21 | TEST= mdc2test.c | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC=mdc2dgst.c mdc2_one.c | ||
26 | LIBOBJ=mdc2dgst.o mdc2_one.o | ||
27 | |||
28 | SRC= $(LIBSRC) | ||
29 | |||
30 | EXHEADER= mdc2.h | ||
31 | HEADER= $(EXHEADER) | ||
32 | |||
33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
34 | |||
35 | top: | ||
36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
37 | |||
38 | all: lib | ||
39 | |||
40 | lib: $(LIBOBJ) | ||
41 | $(AR) $(LIB) $(LIBOBJ) | ||
42 | $(RANLIB) $(LIB) || echo Never mind. | ||
43 | @touch lib | ||
44 | |||
45 | files: | ||
46 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
47 | |||
48 | links: | ||
49 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
50 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
51 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
52 | |||
53 | install: | ||
54 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
55 | do \ | ||
56 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
57 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
58 | done; | ||
59 | |||
60 | tags: | ||
61 | ctags $(SRC) | ||
62 | |||
63 | tests: | ||
64 | |||
65 | lint: | ||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
67 | |||
68 | depend: | ||
69 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
70 | |||
71 | dclean: | ||
72 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
73 | mv -f Makefile.new $(MAKEFILE) | ||
74 | |||
75 | clean: | ||
76 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
77 | |||
78 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
79 | |||
80 | mdc2_one.o: ../../e_os.h ../../include/openssl/bio.h | ||
81 | mdc2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
82 | mdc2_one.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
83 | mdc2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
84 | mdc2_one.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h | ||
85 | mdc2_one.o: ../../include/openssl/opensslconf.h | ||
86 | mdc2_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
87 | mdc2_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
88 | mdc2_one.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
89 | mdc2_one.o: ../cryptlib.h mdc2_one.c | ||
90 | mdc2dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
91 | mdc2dgst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
92 | mdc2dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
93 | mdc2dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
94 | mdc2dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/opensslconf.h | ||
95 | mdc2dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
96 | mdc2dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
97 | mdc2dgst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
98 | mdc2dgst.o: mdc2dgst.c | ||
diff --git a/src/lib/libssl/src/crypto/mdc2/mdc2.h b/src/lib/libssl/src/crypto/mdc2/mdc2.h index 793a8a0f13..4cba101f37 100644 --- a/src/lib/libssl/src/crypto/mdc2/mdc2.h +++ b/src/lib/libssl/src/crypto/mdc2/mdc2.h | |||
@@ -80,7 +80,9 @@ typedef struct mdc2_ctx_st | |||
80 | int pad_type; /* either 1 or 2, default 1 */ | 80 | int pad_type; /* either 1 or 2, default 1 */ |
81 | } MDC2_CTX; | 81 | } MDC2_CTX; |
82 | 82 | ||
83 | 83 | #ifdef OPENSSL_FIPS | |
84 | int private_MDC2_Init(MDC2_CTX *c); | ||
85 | #endif | ||
84 | int MDC2_Init(MDC2_CTX *c); | 86 | int MDC2_Init(MDC2_CTX *c); |
85 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len); | 87 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len); |
86 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); | 88 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); |
diff --git a/src/lib/libssl/src/crypto/o_time.c b/src/lib/libssl/src/crypto/o_time.c index 785468131e..e29091d650 100644 --- a/src/lib/libssl/src/crypto/o_time.c +++ b/src/lib/libssl/src/crypto/o_time.c | |||
@@ -114,16 +114,28 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | |||
114 | return NULL; | 114 | return NULL; |
115 | logvalue[reslen] = '\0'; | 115 | logvalue[reslen] = '\0'; |
116 | 116 | ||
117 | t = *timer; | ||
118 | |||
119 | /* The following is extracted from the DEC C header time.h */ | ||
120 | /* | ||
121 | ** Beginning in OpenVMS Version 7.0 mktime, time, ctime, strftime | ||
122 | ** have two implementations. One implementation is provided | ||
123 | ** for compatibility and deals with time in terms of local time, | ||
124 | ** the other __utc_* deals with time in terms of UTC. | ||
125 | */ | ||
126 | /* We use the same conditions as in said time.h to check if we should | ||
127 | assume that t contains local time (and should therefore be adjusted) | ||
128 | or UTC (and should therefore be left untouched). */ | ||
129 | #if __CRTL_VER < 70000000 || defined _VMS_V6_SOURCE | ||
117 | /* Get the numerical value of the equivalence string */ | 130 | /* Get the numerical value of the equivalence string */ |
118 | status = atoi(logvalue); | 131 | status = atoi(logvalue); |
119 | 132 | ||
120 | /* and use it to move time to GMT */ | 133 | /* and use it to move time to GMT */ |
121 | t = *timer - status; | 134 | t -= status; |
135 | #endif | ||
122 | 136 | ||
123 | /* then convert the result to the time structure */ | 137 | /* then convert the result to the time structure */ |
124 | #ifndef OPENSSL_THREADS | 138 | |
125 | ts=(struct tm *)localtime(&t); | ||
126 | #else | ||
127 | /* Since there was no gmtime_r() to do this stuff for us, | 139 | /* Since there was no gmtime_r() to do this stuff for us, |
128 | we have to do it the hard way. */ | 140 | we have to do it the hard way. */ |
129 | { | 141 | { |
@@ -198,7 +210,6 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | |||
198 | result->tm_isdst = 0; /* There's no way to know... */ | 210 | result->tm_isdst = 0; /* There's no way to know... */ |
199 | 211 | ||
200 | ts = result; | 212 | ts = result; |
201 | #endif | ||
202 | } | 213 | } |
203 | } | 214 | } |
204 | #endif | 215 | #endif |
diff --git a/src/lib/libssl/src/crypto/objects/o_names.c b/src/lib/libssl/src/crypto/objects/o_names.c index b4453b4a98..28c9370ca3 100644 --- a/src/lib/libssl/src/crypto/objects/o_names.c +++ b/src/lib/libssl/src/crypto/objects/o_names.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <string.h> | 3 | #include <string.h> |
4 | 4 | ||
5 | #include <openssl/err.h> | ||
5 | #include <openssl/lhash.h> | 6 | #include <openssl/lhash.h> |
6 | #include <openssl/objects.h> | 7 | #include <openssl/objects.h> |
7 | #include <openssl/safestack.h> | 8 | #include <openssl/safestack.h> |
@@ -80,7 +81,11 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), | |||
80 | MemCheck_off(); | 81 | MemCheck_off(); |
81 | name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS)); | 82 | name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS)); |
82 | MemCheck_on(); | 83 | MemCheck_on(); |
83 | if (!name_funcs) return(0); | 84 | if (!name_funcs) |
85 | { | ||
86 | OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX,ERR_R_MALLOC_FAILURE); | ||
87 | return(0); | ||
88 | } | ||
84 | name_funcs->hash_func = lh_strhash; | 89 | name_funcs->hash_func = lh_strhash; |
85 | name_funcs->cmp_func = OPENSSL_strcmp; | 90 | name_funcs->cmp_func = OPENSSL_strcmp; |
86 | name_funcs->free_func = 0; /* NULL is often declared to | 91 | name_funcs->free_func = 0; /* NULL is often declared to |
diff --git a/src/lib/libssl/src/crypto/objects/obj_dat.c b/src/lib/libssl/src/crypto/objects/obj_dat.c index 4534dc0985..f549d078ef 100644 --- a/src/lib/libssl/src/crypto/objects/obj_dat.c +++ b/src/lib/libssl/src/crypto/objects/obj_dat.c | |||
@@ -236,13 +236,13 @@ int OBJ_add_object(const ASN1_OBJECT *obj) | |||
236 | if (added == NULL) | 236 | if (added == NULL) |
237 | if (!init_added()) return(0); | 237 | if (!init_added()) return(0); |
238 | if ((o=OBJ_dup(obj)) == NULL) goto err; | 238 | if ((o=OBJ_dup(obj)) == NULL) goto err; |
239 | if (!(ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err; | 239 | if (!(ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; |
240 | if ((o->length != 0) && (obj->data != NULL)) | 240 | if ((o->length != 0) && (obj->data != NULL)) |
241 | ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)); | 241 | if (!(ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; |
242 | if (o->sn != NULL) | 242 | if (o->sn != NULL) |
243 | ao[ADDED_SNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)); | 243 | if (!(ao[ADDED_SNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; |
244 | if (o->ln != NULL) | 244 | if (o->ln != NULL) |
245 | ao[ADDED_LNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)); | 245 | if (!(ao[ADDED_LNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; |
246 | 246 | ||
247 | for (i=ADDED_DATA; i<=ADDED_NID; i++) | 247 | for (i=ADDED_DATA; i<=ADDED_NID; i++) |
248 | { | 248 | { |
@@ -260,6 +260,8 @@ int OBJ_add_object(const ASN1_OBJECT *obj) | |||
260 | ASN1_OBJECT_FLAG_DYNAMIC_DATA); | 260 | ASN1_OBJECT_FLAG_DYNAMIC_DATA); |
261 | 261 | ||
262 | return(o->nid); | 262 | return(o->nid); |
263 | err2: | ||
264 | OBJerr(OBJ_F_OBJ_ADD_OBJECT,ERR_R_MALLOC_FAILURE); | ||
263 | err: | 265 | err: |
264 | for (i=ADDED_DATA; i<=ADDED_NID; i++) | 266 | for (i=ADDED_DATA; i<=ADDED_NID; i++) |
265 | if (ao[i] != NULL) OPENSSL_free(ao[i]); | 267 | if (ao[i] != NULL) OPENSSL_free(ao[i]); |
@@ -648,7 +650,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) | |||
648 | 650 | ||
649 | if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL) | 651 | if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL) |
650 | { | 652 | { |
651 | OBJerr(OBJ_F_OBJ_CREATE,OBJ_R_MALLOC_FAILURE); | 653 | OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE); |
652 | return(0); | 654 | return(0); |
653 | } | 655 | } |
654 | i=a2d_ASN1_OBJECT(buf,i,oid,-1); | 656 | i=a2d_ASN1_OBJECT(buf,i,oid,-1); |
diff --git a/src/lib/libssl/src/crypto/objects/obj_err.c b/src/lib/libssl/src/crypto/objects/obj_err.c index 80ab6855af..2b5f43e3cc 100644 --- a/src/lib/libssl/src/crypto/objects/obj_err.c +++ b/src/lib/libssl/src/crypto/objects/obj_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/objects/obj_err.c */ | 1 | /* crypto/objects/obj_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2004 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 |
@@ -66,8 +66,10 @@ | |||
66 | #ifndef OPENSSL_NO_ERR | 66 | #ifndef OPENSSL_NO_ERR |
67 | static ERR_STRING_DATA OBJ_str_functs[]= | 67 | static ERR_STRING_DATA OBJ_str_functs[]= |
68 | { | 68 | { |
69 | {ERR_PACK(0,OBJ_F_OBJ_ADD_OBJECT,0), "OBJ_add_object"}, | ||
69 | {ERR_PACK(0,OBJ_F_OBJ_CREATE,0), "OBJ_create"}, | 70 | {ERR_PACK(0,OBJ_F_OBJ_CREATE,0), "OBJ_create"}, |
70 | {ERR_PACK(0,OBJ_F_OBJ_DUP,0), "OBJ_dup"}, | 71 | {ERR_PACK(0,OBJ_F_OBJ_DUP,0), "OBJ_dup"}, |
72 | {ERR_PACK(0,OBJ_F_OBJ_NAME_NEW_INDEX,0), "OBJ_NAME_new_index"}, | ||
71 | {ERR_PACK(0,OBJ_F_OBJ_NID2LN,0), "OBJ_nid2ln"}, | 73 | {ERR_PACK(0,OBJ_F_OBJ_NID2LN,0), "OBJ_nid2ln"}, |
72 | {ERR_PACK(0,OBJ_F_OBJ_NID2OBJ,0), "OBJ_nid2obj"}, | 74 | {ERR_PACK(0,OBJ_F_OBJ_NID2OBJ,0), "OBJ_nid2obj"}, |
73 | {ERR_PACK(0,OBJ_F_OBJ_NID2SN,0), "OBJ_nid2sn"}, | 75 | {ERR_PACK(0,OBJ_F_OBJ_NID2SN,0), "OBJ_nid2sn"}, |
diff --git a/src/lib/libssl/src/crypto/objects/obj_mac.num b/src/lib/libssl/src/crypto/objects/obj_mac.num index 9838072b65..0e64a929ba 100644 --- a/src/lib/libssl/src/crypto/objects/obj_mac.num +++ b/src/lib/libssl/src/crypto/objects/obj_mac.num | |||
@@ -647,3 +647,21 @@ joint_iso_itu_t 646 | |||
647 | international_organizations 647 | 647 | international_organizations 647 |
648 | ms_smartcard_login 648 | 648 | ms_smartcard_login 648 |
649 | ms_upn 649 | 649 | ms_upn 649 |
650 | aes_128_cfb1 650 | ||
651 | aes_192_cfb1 651 | ||
652 | aes_256_cfb1 652 | ||
653 | aes_128_cfb8 653 | ||
654 | aes_192_cfb8 654 | ||
655 | aes_256_cfb8 655 | ||
656 | des_cfb1 656 | ||
657 | des_cfb8 657 | ||
658 | des_ede3_cfb1 658 | ||
659 | des_ede3_cfb8 659 | ||
660 | streetAddress 660 | ||
661 | postalCode 661 | ||
662 | id_ppl 662 | ||
663 | proxyCertInfo 663 | ||
664 | id_ppl_anyLanguage 664 | ||
665 | id_ppl_inheritAll 665 | ||
666 | id_ppl_independent 666 | ||
667 | Independent 667 | ||
diff --git a/src/lib/libssl/src/crypto/objects/objects.h b/src/lib/libssl/src/crypto/objects/objects.h index de10532813..f859d859b8 100644 --- a/src/lib/libssl/src/crypto/objects/objects.h +++ b/src/lib/libssl/src/crypto/objects/objects.h | |||
@@ -1026,8 +1026,10 @@ void ERR_load_OBJ_strings(void); | |||
1026 | /* Error codes for the OBJ functions. */ | 1026 | /* Error codes for the OBJ functions. */ |
1027 | 1027 | ||
1028 | /* Function codes. */ | 1028 | /* Function codes. */ |
1029 | #define OBJ_F_OBJ_ADD_OBJECT 105 | ||
1029 | #define OBJ_F_OBJ_CREATE 100 | 1030 | #define OBJ_F_OBJ_CREATE 100 |
1030 | #define OBJ_F_OBJ_DUP 101 | 1031 | #define OBJ_F_OBJ_DUP 101 |
1032 | #define OBJ_F_OBJ_NAME_NEW_INDEX 106 | ||
1031 | #define OBJ_F_OBJ_NID2LN 102 | 1033 | #define OBJ_F_OBJ_NID2LN 102 |
1032 | #define OBJ_F_OBJ_NID2OBJ 103 | 1034 | #define OBJ_F_OBJ_NID2OBJ 103 |
1033 | #define OBJ_F_OBJ_NID2SN 104 | 1035 | #define OBJ_F_OBJ_NID2SN 104 |
diff --git a/src/lib/libssl/src/crypto/objects/objects.txt b/src/lib/libssl/src/crypto/objects/objects.txt index 3ba11f65cc..50e9031e61 100644 --- a/src/lib/libssl/src/crypto/objects/objects.txt +++ b/src/lib/libssl/src/crypto/objects/objects.txt | |||
@@ -312,6 +312,7 @@ id-pkix 9 : id-pda | |||
312 | id-pkix 10 : id-aca | 312 | id-pkix 10 : id-aca |
313 | id-pkix 11 : id-qcs | 313 | id-pkix 11 : id-qcs |
314 | id-pkix 12 : id-cct | 314 | id-pkix 12 : id-cct |
315 | id-pkix 21 : id-ppl | ||
315 | id-pkix 48 : id-ad | 316 | id-pkix 48 : id-ad |
316 | 317 | ||
317 | # PKIX Modules | 318 | # PKIX Modules |
@@ -346,6 +347,7 @@ id-pe 9 : sbqp-routerIdentifier | |||
346 | id-pe 10 : ac-proxying | 347 | id-pe 10 : ac-proxying |
347 | !Cname sinfo-access | 348 | !Cname sinfo-access |
348 | id-pe 11 : subjectInfoAccess : Subject Information Access | 349 | id-pe 11 : subjectInfoAccess : Subject Information Access |
350 | id-pe 14 : proxyCertInfo : Proxy Certificate Information | ||
349 | 351 | ||
350 | # PKIX policyQualifiers for Internet policy qualifiers | 352 | # PKIX policyQualifiers for Internet policy qualifiers |
351 | id-qt 1 : id-qt-cps : Policy Qualifier CPS | 353 | id-qt 1 : id-qt-cps : Policy Qualifier CPS |
@@ -461,6 +463,11 @@ id-cct 1 : id-cct-crs | |||
461 | id-cct 2 : id-cct-PKIData | 463 | id-cct 2 : id-cct-PKIData |
462 | id-cct 3 : id-cct-PKIResponse | 464 | id-cct 3 : id-cct-PKIResponse |
463 | 465 | ||
466 | # Predefined Proxy Certificate policy languages | ||
467 | id-ppl 0 : id-ppl-anyLanguage : Any language | ||
468 | id-ppl 1 : id-ppl-inheritAll : Inherit all | ||
469 | id-ppl 2 : id-ppl-independent : Independent | ||
470 | |||
464 | # access descriptors for authority info access extension | 471 | # access descriptors for authority info access extension |
465 | !Cname ad-OCSP | 472 | !Cname ad-OCSP |
466 | id-ad 1 : OCSP : OCSP | 473 | id-ad 1 : OCSP : OCSP |
@@ -536,10 +543,12 @@ X509 5 : : serialNumber | |||
536 | X509 6 : C : countryName | 543 | X509 6 : C : countryName |
537 | X509 7 : L : localityName | 544 | X509 7 : L : localityName |
538 | X509 8 : ST : stateOrProvinceName | 545 | X509 8 : ST : stateOrProvinceName |
546 | X509 9 : : streetAddress | ||
539 | X509 10 : O : organizationName | 547 | X509 10 : O : organizationName |
540 | X509 11 : OU : organizationalUnitName | 548 | X509 11 : OU : organizationalUnitName |
541 | X509 12 : : title | 549 | X509 12 : : title |
542 | X509 13 : : description | 550 | X509 13 : : description |
551 | X509 17 : : postalCode | ||
543 | X509 41 : name : name | 552 | X509 41 : name : name |
544 | X509 42 : GN : givenName | 553 | X509 42 : GN : givenName |
545 | X509 43 : : initials | 554 | X509 43 : : initials |
@@ -681,6 +690,19 @@ aes 43 : AES-256-OFB : aes-256-ofb | |||
681 | !Cname aes-256-cfb128 | 690 | !Cname aes-256-cfb128 |
682 | aes 44 : AES-256-CFB : aes-256-cfb | 691 | aes 44 : AES-256-CFB : aes-256-cfb |
683 | 692 | ||
693 | # There are no OIDs for these modes... | ||
694 | |||
695 | : AES-128-CFB1 : aes-128-cfb1 | ||
696 | : AES-192-CFB1 : aes-192-cfb1 | ||
697 | : AES-256-CFB1 : aes-256-cfb1 | ||
698 | : AES-128-CFB8 : aes-128-cfb8 | ||
699 | : AES-192-CFB8 : aes-192-cfb8 | ||
700 | : AES-256-CFB8 : aes-256-cfb8 | ||
701 | : DES-CFB1 : des-cfb1 | ||
702 | : DES-CFB8 : des-cfb8 | ||
703 | : DES-EDE3-CFB1 : des-ede3-cfb1 | ||
704 | : DES-EDE3-CFB8 : des-ede3-cfb8 | ||
705 | |||
684 | # Hold instruction CRL entry extension | 706 | # Hold instruction CRL entry extension |
685 | !Cname hold-instruction-code | 707 | !Cname hold-instruction-code |
686 | id-ce 23 : holdInstructionCode : Hold Instruction Code | 708 | id-ce 23 : holdInstructionCode : Hold Instruction Code |
diff --git a/src/lib/libssl/src/crypto/opensslv.h b/src/lib/libssl/src/crypto/opensslv.h index 02f1710fb3..5d5f688edd 100644 --- a/src/lib/libssl/src/crypto/opensslv.h +++ b/src/lib/libssl/src/crypto/opensslv.h | |||
@@ -25,8 +25,12 @@ | |||
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 0x0090704fL | 28 | #define OPENSSL_VERSION_NUMBER 0x0090707fL |
29 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7d 17 Mar 2004" | 29 | #ifdef OPENSSL_FIPS |
30 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7g-fips 11 Apr 2005" | ||
31 | #else | ||
32 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7g 11 Apr 2005" | ||
33 | #endif | ||
30 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT | 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT |
31 | 35 | ||
32 | 36 | ||
diff --git a/src/lib/libssl/src/crypto/pem/pem_all.c b/src/lib/libssl/src/crypto/pem/pem_all.c index e72b7134ce..07963314c9 100644 --- a/src/lib/libssl/src/crypto/pem/pem_all.c +++ b/src/lib/libssl/src/crypto/pem/pem_all.c | |||
@@ -64,6 +64,7 @@ | |||
64 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
65 | #include <openssl/pkcs7.h> | 65 | #include <openssl/pkcs7.h> |
66 | #include <openssl/pem.h> | 66 | #include <openssl/pem.h> |
67 | #include <openssl/fips.h> | ||
67 | 68 | ||
68 | #ifndef OPENSSL_NO_RSA | 69 | #ifndef OPENSSL_NO_RSA |
69 | static RSA *pkey_get_rsa(EVP_PKEY *key, RSA **rsa); | 70 | static RSA *pkey_get_rsa(EVP_PKEY *key, RSA **rsa); |
@@ -128,7 +129,49 @@ RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb, | |||
128 | 129 | ||
129 | #endif | 130 | #endif |
130 | 131 | ||
132 | #ifdef OPENSSL_FIPS | ||
133 | |||
134 | int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, | ||
135 | unsigned char *kstr, int klen, | ||
136 | pem_password_cb *cb, void *u) | ||
137 | { | ||
138 | EVP_PKEY *k; | ||
139 | int ret; | ||
140 | k = EVP_PKEY_new(); | ||
141 | if (!k) | ||
142 | return 0; | ||
143 | EVP_PKEY_set1_RSA(k, x); | ||
144 | |||
145 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
146 | EVP_PKEY_free(k); | ||
147 | return ret; | ||
148 | } | ||
149 | |||
150 | #ifndef OPENSSL_NO_FP_API | ||
151 | int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, | ||
152 | unsigned char *kstr, int klen, | ||
153 | pem_password_cb *cb, void *u) | ||
154 | { | ||
155 | EVP_PKEY *k; | ||
156 | int ret; | ||
157 | k = EVP_PKEY_new(); | ||
158 | if (!k) | ||
159 | return 0; | ||
160 | |||
161 | EVP_PKEY_set1_RSA(k, x); | ||
162 | |||
163 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
164 | EVP_PKEY_free(k); | ||
165 | return ret; | ||
166 | } | ||
167 | #endif | ||
168 | |||
169 | #else | ||
170 | |||
131 | IMPLEMENT_PEM_write_cb(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) | 171 | IMPLEMENT_PEM_write_cb(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) |
172 | |||
173 | #endif | ||
174 | |||
132 | IMPLEMENT_PEM_rw(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) | 175 | IMPLEMENT_PEM_rw(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) |
133 | IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) | 176 | IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) |
134 | 177 | ||
@@ -158,7 +201,48 @@ DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb, | |||
158 | return pkey_get_dsa(pktmp, dsa); | 201 | return pkey_get_dsa(pktmp, dsa); |
159 | } | 202 | } |
160 | 203 | ||
204 | |||
205 | #ifdef OPENSSL_FIPS | ||
206 | |||
207 | int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, | ||
208 | unsigned char *kstr, int klen, | ||
209 | pem_password_cb *cb, void *u) | ||
210 | { | ||
211 | EVP_PKEY *k; | ||
212 | int ret; | ||
213 | k = EVP_PKEY_new(); | ||
214 | if (!k) | ||
215 | return 0; | ||
216 | EVP_PKEY_set1_DSA(k, x); | ||
217 | |||
218 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
219 | EVP_PKEY_free(k); | ||
220 | return ret; | ||
221 | } | ||
222 | |||
223 | #ifndef OPENSSL_NO_FP_API | ||
224 | int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, | ||
225 | unsigned char *kstr, int klen, | ||
226 | pem_password_cb *cb, void *u) | ||
227 | { | ||
228 | EVP_PKEY *k; | ||
229 | int ret; | ||
230 | k = EVP_PKEY_new(); | ||
231 | if (!k) | ||
232 | return 0; | ||
233 | EVP_PKEY_set1_DSA(k, x); | ||
234 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
235 | EVP_PKEY_free(k); | ||
236 | return ret; | ||
237 | } | ||
238 | #endif | ||
239 | |||
240 | #else | ||
241 | |||
161 | IMPLEMENT_PEM_write_cb(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) | 242 | IMPLEMENT_PEM_write_cb(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) |
243 | |||
244 | #endif | ||
245 | |||
162 | IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) | 246 | IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) |
163 | 247 | ||
164 | #ifndef OPENSSL_NO_FP_API | 248 | #ifndef OPENSSL_NO_FP_API |
@@ -190,7 +274,42 @@ IMPLEMENT_PEM_rw(DHparams, DH, PEM_STRING_DHPARAMS, DHparams) | |||
190 | * (When reading, parameter PEM_STRING_EVP_PKEY is a wildcard for anything | 274 | * (When reading, parameter PEM_STRING_EVP_PKEY is a wildcard for anything |
191 | * appropriate.) | 275 | * appropriate.) |
192 | */ | 276 | */ |
277 | |||
278 | #ifdef OPENSSL_FIPS | ||
279 | |||
280 | int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
281 | unsigned char *kstr, int klen, | ||
282 | pem_password_cb *cb, void *u) | ||
283 | { | ||
284 | if (FIPS_mode()) | ||
285 | return PEM_write_bio_PKCS8PrivateKey(bp, x, enc, | ||
286 | (char *)kstr, klen, cb, u); | ||
287 | else | ||
288 | return PEM_ASN1_write_bio((int (*)())i2d_PrivateKey, | ||
289 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), | ||
290 | bp,(char *)x,enc,kstr,klen,cb,u); | ||
291 | } | ||
292 | |||
293 | #ifndef OPENSSL_NO_FP_API | ||
294 | int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
295 | unsigned char *kstr, int klen, | ||
296 | pem_password_cb *cb, void *u) | ||
297 | { | ||
298 | if (FIPS_mode()) | ||
299 | return PEM_write_PKCS8PrivateKey(fp, x, enc, | ||
300 | (char *)kstr, klen, cb, u); | ||
301 | else | ||
302 | return PEM_ASN1_write((int (*)())i2d_PrivateKey, | ||
303 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), | ||
304 | fp,(char *)x,enc,kstr,klen,cb,u); | ||
305 | } | ||
306 | #endif | ||
307 | |||
308 | #else | ||
309 | |||
193 | IMPLEMENT_PEM_write_cb(PrivateKey, EVP_PKEY, ((x->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), PrivateKey) | 310 | IMPLEMENT_PEM_write_cb(PrivateKey, EVP_PKEY, ((x->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), PrivateKey) |
194 | 311 | ||
312 | #endif | ||
313 | |||
195 | IMPLEMENT_PEM_rw(PUBKEY, EVP_PKEY, PEM_STRING_PUBLIC, PUBKEY) | 314 | IMPLEMENT_PEM_rw(PUBKEY, EVP_PKEY, PEM_STRING_PUBLIC, PUBKEY) |
196 | 315 | ||
diff --git a/src/lib/libssl/src/crypto/pem/pem_lib.c b/src/lib/libssl/src/crypto/pem/pem_lib.c index 7785039b99..82815067b3 100644 --- a/src/lib/libssl/src/crypto/pem/pem_lib.c +++ b/src/lib/libssl/src/crypto/pem/pem_lib.c | |||
@@ -73,7 +73,7 @@ const char *PEM_version="PEM" OPENSSL_VERSION_PTEXT; | |||
73 | 73 | ||
74 | #define MIN_LENGTH 4 | 74 | #define MIN_LENGTH 4 |
75 | 75 | ||
76 | static int load_iv(unsigned char **fromp,unsigned char *to, int num); | 76 | static int load_iv(char **fromp,unsigned char *to, int num); |
77 | static int check_pem(const char *nm, const char *name); | 77 | static int check_pem(const char *nm, const char *name); |
78 | 78 | ||
79 | int PEM_def_callback(char *buf, int num, int w, void *key) | 79 | int PEM_def_callback(char *buf, int num, int w, void *key) |
@@ -301,7 +301,7 @@ int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x, | |||
301 | 301 | ||
302 | if ((dsize=i2d(x,NULL)) < 0) | 302 | if ((dsize=i2d(x,NULL)) < 0) |
303 | { | 303 | { |
304 | PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE); | 304 | PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_ASN1_LIB); |
305 | dsize=0; | 305 | dsize=0; |
306 | goto err; | 306 | goto err; |
307 | } | 307 | } |
@@ -432,6 +432,7 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) | |||
432 | int o; | 432 | int o; |
433 | const EVP_CIPHER *enc=NULL; | 433 | const EVP_CIPHER *enc=NULL; |
434 | char *p,c; | 434 | char *p,c; |
435 | char **header_pp = &header; | ||
435 | 436 | ||
436 | cipher->cipher=NULL; | 437 | cipher->cipher=NULL; |
437 | if ((header == NULL) || (*header == '\0') || (*header == '\n')) | 438 | if ((header == NULL) || (*header == '\0') || (*header == '\n')) |
@@ -478,15 +479,16 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) | |||
478 | PEMerr(PEM_F_PEM_GET_EVP_CIPHER_INFO,PEM_R_UNSUPPORTED_ENCRYPTION); | 479 | PEMerr(PEM_F_PEM_GET_EVP_CIPHER_INFO,PEM_R_UNSUPPORTED_ENCRYPTION); |
479 | return(0); | 480 | return(0); |
480 | } | 481 | } |
481 | if (!load_iv((unsigned char **)&header,&(cipher->iv[0]),enc->iv_len)) return(0); | 482 | if (!load_iv(header_pp,&(cipher->iv[0]),enc->iv_len)) |
483 | return(0); | ||
482 | 484 | ||
483 | return(1); | 485 | return(1); |
484 | } | 486 | } |
485 | 487 | ||
486 | static int load_iv(unsigned char **fromp, unsigned char *to, int num) | 488 | static int load_iv(char **fromp, unsigned char *to, int num) |
487 | { | 489 | { |
488 | int v,i; | 490 | int v,i; |
489 | unsigned char *from; | 491 | char *from; |
490 | 492 | ||
491 | from= *fromp; | 493 | from= *fromp; |
492 | for (i=0; i<num; i++) to[i]=0; | 494 | for (i=0; i<num; i++) to[i]=0; |
@@ -623,6 +625,9 @@ int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, | |||
623 | dataB=BUF_MEM_new(); | 625 | dataB=BUF_MEM_new(); |
624 | if ((nameB == NULL) || (headerB == NULL) || (dataB == NULL)) | 626 | if ((nameB == NULL) || (headerB == NULL) || (dataB == NULL)) |
625 | { | 627 | { |
628 | BUF_MEM_free(nameB); | ||
629 | BUF_MEM_free(headerB); | ||
630 | BUF_MEM_free(dataB); | ||
626 | PEMerr(PEM_F_PEM_READ_BIO,ERR_R_MALLOC_FAILURE); | 631 | PEMerr(PEM_F_PEM_READ_BIO,ERR_R_MALLOC_FAILURE); |
627 | return(0); | 632 | return(0); |
628 | } | 633 | } |
diff --git a/src/lib/libssl/src/crypto/pem/pem_pkey.c b/src/lib/libssl/src/crypto/pem/pem_pkey.c index f77c949e87..9ecdbd5419 100644 --- a/src/lib/libssl/src/crypto/pem/pem_pkey.c +++ b/src/lib/libssl/src/crypto/pem/pem_pkey.c | |||
@@ -104,6 +104,7 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, vo | |||
104 | if (klen <= 0) { | 104 | if (klen <= 0) { |
105 | PEMerr(PEM_F_PEM_ASN1_READ_BIO, | 105 | PEMerr(PEM_F_PEM_ASN1_READ_BIO, |
106 | PEM_R_BAD_PASSWORD_READ); | 106 | PEM_R_BAD_PASSWORD_READ); |
107 | X509_SIG_free(p8); | ||
107 | goto err; | 108 | goto err; |
108 | } | 109 | } |
109 | p8inf = PKCS8_decrypt(p8, psbuf, klen); | 110 | p8inf = PKCS8_decrypt(p8, psbuf, klen); |
diff --git a/src/lib/libssl/src/crypto/perlasm/x86asm.pl b/src/lib/libssl/src/crypto/perlasm/x86asm.pl index 7c675e3ced..60233f80e8 100644 --- a/src/lib/libssl/src/crypto/perlasm/x86asm.pl +++ b/src/lib/libssl/src/crypto/perlasm/x86asm.pl | |||
@@ -130,4 +130,6 @@ BSDI - a.out with a very primative version of as. | |||
130 | EOF | 130 | EOF |
131 | } | 131 | } |
132 | 132 | ||
133 | sub main'align() {} # swallow align statements in 0.9.7 context | ||
134 | |||
133 | 1; | 135 | 1; |
diff --git a/src/lib/libssl/src/crypto/perlasm/x86ms.pl b/src/lib/libssl/src/crypto/perlasm/x86ms.pl index fbb4afb9bd..b6bd744057 100644 --- a/src/lib/libssl/src/crypto/perlasm/x86ms.pl +++ b/src/lib/libssl/src/crypto/perlasm/x86ms.pl | |||
@@ -160,6 +160,7 @@ sub main'not { &out1("not",@_); } | |||
160 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } | 160 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } |
161 | sub main'ret { &out0("ret"); } | 161 | sub main'ret { &out0("ret"); } |
162 | sub main'nop { &out0("nop"); } | 162 | sub main'nop { &out0("nop"); } |
163 | sub main'movz { &out2("movzx",@_); } | ||
163 | 164 | ||
164 | sub out2 | 165 | sub out2 |
165 | { | 166 | { |
diff --git a/src/lib/libssl/src/crypto/perlasm/x86nasm.pl b/src/lib/libssl/src/crypto/perlasm/x86nasm.pl index 30346af4ea..5009acb4b3 100644 --- a/src/lib/libssl/src/crypto/perlasm/x86nasm.pl +++ b/src/lib/libssl/src/crypto/perlasm/x86nasm.pl | |||
@@ -86,7 +86,7 @@ sub get_mem | |||
86 | { | 86 | { |
87 | my($size,$addr,$reg1,$reg2,$idx)=@_; | 87 | my($size,$addr,$reg1,$reg2,$idx)=@_; |
88 | my($t,$post); | 88 | my($t,$post); |
89 | my($ret)="["; | 89 | my($ret)="$size ["; |
90 | $addr =~ s/^\s+//; | 90 | $addr =~ s/^\s+//; |
91 | if ($addr =~ /^(.+)\+(.+)$/) | 91 | if ($addr =~ /^(.+)\+(.+)$/) |
92 | { | 92 | { |
@@ -169,6 +169,7 @@ sub main'not { &out1("not",@_); } | |||
169 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } | 169 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } |
170 | sub main'ret { &out0("ret"); } | 170 | sub main'ret { &out0("ret"); } |
171 | sub main'nop { &out0("nop"); } | 171 | sub main'nop { &out0("nop"); } |
172 | sub main'movz { &out2("movzx",@_); } | ||
172 | 173 | ||
173 | sub out2 | 174 | sub out2 |
174 | { | 175 | { |
@@ -176,6 +177,11 @@ sub out2 | |||
176 | my($l,$t); | 177 | my($l,$t); |
177 | 178 | ||
178 | push(@out,"\t$name\t"); | 179 | push(@out,"\t$name\t"); |
180 | if ($name eq "lea") | ||
181 | { | ||
182 | $p1 =~ s/^[^\[]*\[/\[/; | ||
183 | $p2 =~ s/^[^\[]*\[/\[/; | ||
184 | } | ||
179 | $t=&conv($p1).","; | 185 | $t=&conv($p1).","; |
180 | $l=length($t); | 186 | $l=length($t); |
181 | push(@out,$t); | 187 | push(@out,$t); |
diff --git a/src/lib/libssl/src/crypto/perlasm/x86unix.pl b/src/lib/libssl/src/crypto/perlasm/x86unix.pl index 53ad5f4927..9717d18557 100644 --- a/src/lib/libssl/src/crypto/perlasm/x86unix.pl +++ b/src/lib/libssl/src/crypto/perlasm/x86unix.pl | |||
@@ -143,12 +143,12 @@ sub main'shl { &out2("sall",@_); } | |||
143 | sub main'shr { &out2("shrl",@_); } | 143 | sub main'shr { &out2("shrl",@_); } |
144 | sub main'xor { &out2("xorl",@_); } | 144 | sub main'xor { &out2("xorl",@_); } |
145 | sub main'xorb { &out2("xorb",@_); } | 145 | sub main'xorb { &out2("xorb",@_); } |
146 | sub main'add { &out2("addl",@_); } | 146 | sub main'add { &out2($_[0]=~/%[a-d][lh]/?"addb":"addl",@_); } |
147 | sub main'adc { &out2("adcl",@_); } | 147 | sub main'adc { &out2("adcl",@_); } |
148 | sub main'sub { &out2("subl",@_); } | 148 | sub main'sub { &out2("subl",@_); } |
149 | sub main'rotl { &out2("roll",@_); } | 149 | sub main'rotl { &out2("roll",@_); } |
150 | sub main'rotr { &out2("rorl",@_); } | 150 | sub main'rotr { &out2("rorl",@_); } |
151 | sub main'exch { &out2("xchg",@_); } | 151 | sub main'exch { &out2($_[0]=~/%[a-d][lh]/?"xchgb":"xchgl",@_); } |
152 | sub main'cmp { &out2("cmpl",@_); } | 152 | sub main'cmp { &out2("cmpl",@_); } |
153 | sub main'lea { &out2("leal",@_); } | 153 | sub main'lea { &out2("leal",@_); } |
154 | sub main'mul { &out1("mull",@_); } | 154 | sub main'mul { &out1("mull",@_); } |
@@ -170,7 +170,7 @@ sub main'jc { &out1("jc",@_); } | |||
170 | sub main'jnc { &out1("jnc",@_); } | 170 | sub main'jnc { &out1("jnc",@_); } |
171 | sub main'jno { &out1("jno",@_); } | 171 | sub main'jno { &out1("jno",@_); } |
172 | sub main'dec { &out1("decl",@_); } | 172 | sub main'dec { &out1("decl",@_); } |
173 | sub main'inc { &out1("incl",@_); } | 173 | sub main'inc { &out1($_[0]=~/%[a-d][hl]/?"incb":"incl",@_); } |
174 | sub main'push { &out1("pushl",@_); $stack+=4; } | 174 | sub main'push { &out1("pushl",@_); $stack+=4; } |
175 | sub main'pop { &out1("popl",@_); $stack-=4; } | 175 | sub main'pop { &out1("popl",@_); $stack-=4; } |
176 | sub main'pushf { &out0("pushf"); $stack+=4; } | 176 | sub main'pushf { &out0("pushf"); $stack+=4; } |
@@ -179,6 +179,7 @@ sub main'not { &out1("notl",@_); } | |||
179 | sub main'call { &out1("call",($_[0]=~/^\.L/?'':$under).$_[0]); } | 179 | sub main'call { &out1("call",($_[0]=~/^\.L/?'':$under).$_[0]); } |
180 | sub main'ret { &out0("ret"); } | 180 | sub main'ret { &out0("ret"); } |
181 | sub main'nop { &out0("nop"); } | 181 | sub main'nop { &out0("nop"); } |
182 | sub main'movz { &out2("movzbl",@_); } | ||
182 | 183 | ||
183 | # The bswapl instruction is new for the 486. Emulate if i386. | 184 | # The bswapl instruction is new for the 486. Emulate if i386. |
184 | sub main'bswap | 185 | sub main'bswap |
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_crpt.c b/src/lib/libssl/src/crypto/pkcs12/p12_crpt.c index 5e8958612b..003ec7a33e 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_crpt.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_crpt.c | |||
@@ -88,7 +88,7 @@ int PKCS12_PBE_keyivgen (EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
88 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de) | 88 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de) |
89 | { | 89 | { |
90 | PBEPARAM *pbe; | 90 | PBEPARAM *pbe; |
91 | int saltlen, iter; | 91 | int saltlen, iter, ret; |
92 | unsigned char *salt, *pbuf; | 92 | unsigned char *salt, *pbuf; |
93 | unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH]; | 93 | unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH]; |
94 | 94 | ||
@@ -117,8 +117,8 @@ int PKCS12_PBE_keyivgen (EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | PBEPARAM_free(pbe); | 119 | PBEPARAM_free(pbe); |
120 | EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, en_de); | 120 | ret = EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, en_de); |
121 | OPENSSL_cleanse(key, EVP_MAX_KEY_LENGTH); | 121 | OPENSSL_cleanse(key, EVP_MAX_KEY_LENGTH); |
122 | OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH); | 122 | OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH); |
123 | return 1; | 123 | return ret; |
124 | } | 124 | } |
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_init.c b/src/lib/libssl/src/crypto/pkcs12/p12_init.c index eb837a78cf..5276b12669 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_init.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_init.c | |||
@@ -76,15 +76,17 @@ PKCS12 *PKCS12_init (int mode) | |||
76 | if (!(pkcs12->authsafes->d.data = | 76 | if (!(pkcs12->authsafes->d.data = |
77 | M_ASN1_OCTET_STRING_new())) { | 77 | M_ASN1_OCTET_STRING_new())) { |
78 | PKCS12err(PKCS12_F_PKCS12_INIT,ERR_R_MALLOC_FAILURE); | 78 | PKCS12err(PKCS12_F_PKCS12_INIT,ERR_R_MALLOC_FAILURE); |
79 | return NULL; | 79 | goto err; |
80 | } | 80 | } |
81 | break; | 81 | break; |
82 | default: | 82 | default: |
83 | PKCS12err(PKCS12_F_PKCS12_INIT,PKCS12_R_UNSUPPORTED_PKCS12_MODE); | 83 | PKCS12err(PKCS12_F_PKCS12_INIT, |
84 | PKCS12_free(pkcs12); | 84 | PKCS12_R_UNSUPPORTED_PKCS12_MODE); |
85 | return NULL; | 85 | goto err; |
86 | break; | ||
87 | } | 86 | } |
88 | 87 | ||
89 | return pkcs12; | 88 | return pkcs12; |
89 | err: | ||
90 | if (pkcs12 != NULL) PKCS12_free(pkcs12); | ||
91 | return NULL; | ||
90 | } | 92 | } |
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_kiss.c b/src/lib/libssl/src/crypto/pkcs12/p12_kiss.c index 885087ad00..2b31999e11 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_kiss.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_kiss.c | |||
@@ -249,14 +249,26 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, | |||
249 | if (M_PKCS12_cert_bag_type(bag) != NID_x509Certificate ) | 249 | if (M_PKCS12_cert_bag_type(bag) != NID_x509Certificate ) |
250 | return 1; | 250 | return 1; |
251 | if (!(x509 = PKCS12_certbag2x509(bag))) return 0; | 251 | if (!(x509 = PKCS12_certbag2x509(bag))) return 0; |
252 | if(ckid) X509_keyid_set1(x509, ckid->data, ckid->length); | 252 | if(ckid) |
253 | { | ||
254 | if (!X509_keyid_set1(x509, ckid->data, ckid->length)) | ||
255 | { | ||
256 | X509_free(x509); | ||
257 | return 0; | ||
258 | } | ||
259 | } | ||
253 | if(fname) { | 260 | if(fname) { |
254 | int len; | 261 | int len, r; |
255 | unsigned char *data; | 262 | unsigned char *data; |
256 | len = ASN1_STRING_to_UTF8(&data, fname); | 263 | len = ASN1_STRING_to_UTF8(&data, fname); |
257 | if(len > 0) { | 264 | if(len > 0) { |
258 | X509_alias_set1(x509, data, len); | 265 | r = X509_alias_set1(x509, data, len); |
259 | OPENSSL_free(data); | 266 | OPENSSL_free(data); |
267 | if (!r) | ||
268 | { | ||
269 | X509_free(x509); | ||
270 | return 0; | ||
271 | } | ||
260 | } | 272 | } |
261 | } | 273 | } |
262 | 274 | ||
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_mutl.c b/src/lib/libssl/src/crypto/pkcs12/p12_mutl.c index 0fb67f74b8..4886b9b289 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_mutl.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_mutl.c | |||
@@ -148,7 +148,10 @@ int PKCS12_setup_mac (PKCS12 *p12, int iter, unsigned char *salt, int saltlen, | |||
148 | PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); | 148 | PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); |
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
151 | ASN1_INTEGER_set(p12->mac->iter, iter); | 151 | if (!ASN1_INTEGER_set(p12->mac->iter, iter)) { |
152 | PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); | ||
153 | return 0; | ||
154 | } | ||
152 | } | 155 | } |
153 | if (!saltlen) saltlen = PKCS12_SALT_LEN; | 156 | if (!saltlen) saltlen = PKCS12_SALT_LEN; |
154 | p12->mac->salt->length = saltlen; | 157 | p12->mac->salt->length = saltlen; |
diff --git a/src/lib/libssl/src/crypto/pkcs7/pk7_attr.c b/src/lib/libssl/src/crypto/pkcs7/pk7_attr.c index 5ff5a88b5c..039141027a 100644 --- a/src/lib/libssl/src/crypto/pkcs7/pk7_attr.c +++ b/src/lib/libssl/src/crypto/pkcs7/pk7_attr.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 2001. | 3 | * project 2001. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2001-2004 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -94,17 +94,18 @@ int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap) | |||
94 | } | 94 | } |
95 | 95 | ||
96 | STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si) | 96 | STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si) |
97 | { | 97 | { |
98 | ASN1_TYPE *cap; | 98 | ASN1_TYPE *cap; |
99 | unsigned char *p; | 99 | unsigned char *p; |
100 | cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities); | 100 | cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities); |
101 | if (!cap) return NULL; | 101 | if (!cap || (cap->type != V_ASN1_SEQUENCE)) |
102 | return NULL; | ||
102 | p = cap->value.sequence->data; | 103 | p = cap->value.sequence->data; |
103 | return d2i_ASN1_SET_OF_X509_ALGOR(NULL, &p, | 104 | return d2i_ASN1_SET_OF_X509_ALGOR(NULL, &p, |
104 | cap->value.sequence->length, | 105 | cap->value.sequence->length, |
105 | d2i_X509_ALGOR, X509_ALGOR_free, | 106 | d2i_X509_ALGOR, X509_ALGOR_free, |
106 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); | 107 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); |
107 | } | 108 | } |
108 | 109 | ||
109 | /* Basic smime-capabilities OID and optional integer arg */ | 110 | /* Basic smime-capabilities OID and optional integer arg */ |
110 | int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) | 111 | int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) |
diff --git a/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c b/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c index b78e22819c..4ac29ae14d 100644 --- a/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c +++ b/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c | |||
@@ -239,7 +239,13 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | |||
239 | OPENSSL_free(tmp); | 239 | OPENSSL_free(tmp); |
240 | goto err; | 240 | goto err; |
241 | } | 241 | } |
242 | M_ASN1_OCTET_STRING_set(ri->enc_key,tmp,jj); | 242 | if (!M_ASN1_OCTET_STRING_set(ri->enc_key,tmp,jj)) |
243 | { | ||
244 | PKCS7err(PKCS7_F_PKCS7_DATAINIT, | ||
245 | ERR_R_MALLOC_FAILURE); | ||
246 | OPENSSL_free(tmp); | ||
247 | goto err; | ||
248 | } | ||
243 | } | 249 | } |
244 | OPENSSL_free(tmp); | 250 | OPENSSL_free(tmp); |
245 | OPENSSL_cleanse(key, keylen); | 251 | OPENSSL_cleanse(key, keylen); |
@@ -520,12 +526,20 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
520 | case NID_pkcs7_signedAndEnveloped: | 526 | case NID_pkcs7_signedAndEnveloped: |
521 | /* XXXXXXXXXXXXXXXX */ | 527 | /* XXXXXXXXXXXXXXXX */ |
522 | si_sk=p7->d.signed_and_enveloped->signer_info; | 528 | si_sk=p7->d.signed_and_enveloped->signer_info; |
523 | os=M_ASN1_OCTET_STRING_new(); | 529 | if (!(os=M_ASN1_OCTET_STRING_new())) |
530 | { | ||
531 | PKCS7err(PKCS7_F_PKCS7_DATASIGN,ERR_R_MALLOC_FAILURE); | ||
532 | goto err; | ||
533 | } | ||
524 | p7->d.signed_and_enveloped->enc_data->enc_data=os; | 534 | p7->d.signed_and_enveloped->enc_data->enc_data=os; |
525 | break; | 535 | break; |
526 | case NID_pkcs7_enveloped: | 536 | case NID_pkcs7_enveloped: |
527 | /* XXXXXXXXXXXXXXXX */ | 537 | /* XXXXXXXXXXXXXXXX */ |
528 | os=M_ASN1_OCTET_STRING_new(); | 538 | if (!(os=M_ASN1_OCTET_STRING_new())) |
539 | { | ||
540 | PKCS7err(PKCS7_F_PKCS7_DATASIGN,ERR_R_MALLOC_FAILURE); | ||
541 | goto err; | ||
542 | } | ||
529 | p7->d.enveloped->enc_data->enc_data=os; | 543 | p7->d.enveloped->enc_data->enc_data=os; |
530 | break; | 544 | break; |
531 | case NID_pkcs7_signed: | 545 | case NID_pkcs7_signed: |
@@ -599,7 +613,12 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
599 | if (!PKCS7_get_signed_attribute(si, | 613 | if (!PKCS7_get_signed_attribute(si, |
600 | NID_pkcs9_signingTime)) | 614 | NID_pkcs9_signingTime)) |
601 | { | 615 | { |
602 | sign_time=X509_gmtime_adj(NULL,0); | 616 | if (!(sign_time=X509_gmtime_adj(NULL,0))) |
617 | { | ||
618 | PKCS7err(PKCS7_F_PKCS7_DATASIGN, | ||
619 | ERR_R_MALLOC_FAILURE); | ||
620 | goto err; | ||
621 | } | ||
603 | PKCS7_add_signed_attribute(si, | 622 | PKCS7_add_signed_attribute(si, |
604 | NID_pkcs9_signingTime, | 623 | NID_pkcs9_signingTime, |
605 | V_ASN1_UTCTIME,sign_time); | 624 | V_ASN1_UTCTIME,sign_time); |
@@ -608,8 +627,19 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
608 | /* Add digest */ | 627 | /* Add digest */ |
609 | md_tmp=EVP_MD_CTX_md(&ctx_tmp); | 628 | md_tmp=EVP_MD_CTX_md(&ctx_tmp); |
610 | EVP_DigestFinal_ex(&ctx_tmp,md_data,&md_len); | 629 | EVP_DigestFinal_ex(&ctx_tmp,md_data,&md_len); |
611 | digest=M_ASN1_OCTET_STRING_new(); | 630 | if (!(digest=M_ASN1_OCTET_STRING_new())) |
612 | M_ASN1_OCTET_STRING_set(digest,md_data,md_len); | 631 | { |
632 | PKCS7err(PKCS7_F_PKCS7_DATASIGN, | ||
633 | ERR_R_MALLOC_FAILURE); | ||
634 | goto err; | ||
635 | } | ||
636 | if (!M_ASN1_OCTET_STRING_set(digest,md_data, | ||
637 | md_len)) | ||
638 | { | ||
639 | PKCS7err(PKCS7_F_PKCS7_DATASIGN, | ||
640 | ERR_R_MALLOC_FAILURE); | ||
641 | goto err; | ||
642 | } | ||
613 | PKCS7_add_signed_attribute(si, | 643 | PKCS7_add_signed_attribute(si, |
614 | NID_pkcs9_messageDigest, | 644 | NID_pkcs9_messageDigest, |
615 | V_ASN1_OCTET_STRING,digest); | 645 | V_ASN1_OCTET_STRING,digest); |
diff --git a/src/lib/libssl/src/crypto/pkcs7/pk7_lib.c b/src/lib/libssl/src/crypto/pkcs7/pk7_lib.c index 985b07245c..ee1817c7af 100644 --- a/src/lib/libssl/src/crypto/pkcs7/pk7_lib.c +++ b/src/lib/libssl/src/crypto/pkcs7/pk7_lib.c | |||
@@ -164,7 +164,12 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
164 | p7->type=obj; | 164 | p7->type=obj; |
165 | if ((p7->d.sign=PKCS7_SIGNED_new()) == NULL) | 165 | if ((p7->d.sign=PKCS7_SIGNED_new()) == NULL) |
166 | goto err; | 166 | goto err; |
167 | ASN1_INTEGER_set(p7->d.sign->version,1); | 167 | if (!ASN1_INTEGER_set(p7->d.sign->version,1)) |
168 | { | ||
169 | PKCS7_SIGNED_free(p7->d.sign); | ||
170 | p7->d.sign=NULL; | ||
171 | goto err; | ||
172 | } | ||
168 | break; | 173 | break; |
169 | case NID_pkcs7_data: | 174 | case NID_pkcs7_data: |
170 | p7->type=obj; | 175 | p7->type=obj; |
@@ -176,6 +181,8 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
176 | if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new()) | 181 | if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new()) |
177 | == NULL) goto err; | 182 | == NULL) goto err; |
178 | ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1); | 183 | ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1); |
184 | if (!ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1)) | ||
185 | goto err; | ||
179 | p7->d.signed_and_enveloped->enc_data->content_type | 186 | p7->d.signed_and_enveloped->enc_data->content_type |
180 | = OBJ_nid2obj(NID_pkcs7_data); | 187 | = OBJ_nid2obj(NID_pkcs7_data); |
181 | break; | 188 | break; |
@@ -183,7 +190,8 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
183 | p7->type=obj; | 190 | p7->type=obj; |
184 | if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) | 191 | if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) |
185 | == NULL) goto err; | 192 | == NULL) goto err; |
186 | ASN1_INTEGER_set(p7->d.enveloped->version,0); | 193 | if (!ASN1_INTEGER_set(p7->d.enveloped->version,0)) |
194 | goto err; | ||
187 | p7->d.enveloped->enc_data->content_type | 195 | p7->d.enveloped->enc_data->content_type |
188 | = OBJ_nid2obj(NID_pkcs7_data); | 196 | = OBJ_nid2obj(NID_pkcs7_data); |
189 | break; | 197 | break; |
@@ -191,7 +199,8 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
191 | p7->type=obj; | 199 | p7->type=obj; |
192 | if ((p7->d.encrypted=PKCS7_ENCRYPT_new()) | 200 | if ((p7->d.encrypted=PKCS7_ENCRYPT_new()) |
193 | == NULL) goto err; | 201 | == NULL) goto err; |
194 | ASN1_INTEGER_set(p7->d.encrypted->version,0); | 202 | if (!ASN1_INTEGER_set(p7->d.encrypted->version,0)) |
203 | goto err; | ||
195 | p7->d.encrypted->enc_data->content_type | 204 | p7->d.encrypted->enc_data->content_type |
196 | = OBJ_nid2obj(NID_pkcs7_data); | 205 | = OBJ_nid2obj(NID_pkcs7_data); |
197 | break; | 206 | break; |
@@ -318,15 +327,18 @@ int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, | |||
318 | if (pkey->type == EVP_PKEY_DSA) is_dsa = 1; | 327 | if (pkey->type == EVP_PKEY_DSA) is_dsa = 1; |
319 | else is_dsa = 0; | 328 | else is_dsa = 0; |
320 | /* We now need to add another PKCS7_SIGNER_INFO entry */ | 329 | /* We now need to add another PKCS7_SIGNER_INFO entry */ |
321 | ASN1_INTEGER_set(p7i->version,1); | 330 | if (!ASN1_INTEGER_set(p7i->version,1)) |
322 | X509_NAME_set(&p7i->issuer_and_serial->issuer, | 331 | goto err; |
323 | X509_get_issuer_name(x509)); | 332 | if (!X509_NAME_set(&p7i->issuer_and_serial->issuer, |
333 | X509_get_issuer_name(x509))) | ||
334 | goto err; | ||
324 | 335 | ||
325 | /* because ASN1_INTEGER_set is used to set a 'long' we will do | 336 | /* because ASN1_INTEGER_set is used to set a 'long' we will do |
326 | * things the ugly way. */ | 337 | * things the ugly way. */ |
327 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); | 338 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); |
328 | p7i->issuer_and_serial->serial= | 339 | if (!(p7i->issuer_and_serial->serial= |
329 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)); | 340 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)))) |
341 | goto err; | ||
330 | 342 | ||
331 | /* lets keep the pkey around for a while */ | 343 | /* lets keep the pkey around for a while */ |
332 | CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); | 344 | CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); |
@@ -423,16 +435,20 @@ int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri) | |||
423 | 435 | ||
424 | int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) | 436 | int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) |
425 | { | 437 | { |
426 | ASN1_INTEGER_set(p7i->version,0); | 438 | if (!ASN1_INTEGER_set(p7i->version,0)) |
427 | X509_NAME_set(&p7i->issuer_and_serial->issuer, | 439 | return 0; |
428 | X509_get_issuer_name(x509)); | 440 | if (!X509_NAME_set(&p7i->issuer_and_serial->issuer, |
441 | X509_get_issuer_name(x509))) | ||
442 | return 0; | ||
429 | 443 | ||
430 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); | 444 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); |
431 | p7i->issuer_and_serial->serial= | 445 | if (!(p7i->issuer_and_serial->serial= |
432 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)); | 446 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)))) |
447 | return 0; | ||
433 | 448 | ||
434 | X509_ALGOR_free(p7i->key_enc_algor); | 449 | X509_ALGOR_free(p7i->key_enc_algor); |
435 | p7i->key_enc_algor= X509_ALGOR_dup(x509->cert_info->key->algor); | 450 | if (!(p7i->key_enc_algor= X509_ALGOR_dup(x509->cert_info->key->algor))) |
451 | return 0; | ||
436 | 452 | ||
437 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); | 453 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); |
438 | p7i->cert=x509; | 454 | p7i->cert=x509; |
diff --git a/src/lib/libssl/src/crypto/pkcs7/pk7_smime.c b/src/lib/libssl/src/crypto/pkcs7/pk7_smime.c index 6e5735de11..a852b49235 100644 --- a/src/lib/libssl/src/crypto/pkcs7/pk7_smime.c +++ b/src/lib/libssl/src/crypto/pkcs7/pk7_smime.c | |||
@@ -155,7 +155,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | |||
155 | char buf[4096]; | 155 | char buf[4096]; |
156 | int i, j=0, k, ret = 0; | 156 | int i, j=0, k, ret = 0; |
157 | BIO *p7bio; | 157 | BIO *p7bio; |
158 | BIO *tmpout; | 158 | BIO *tmpin, *tmpout; |
159 | 159 | ||
160 | if(!p7) { | 160 | if(!p7) { |
161 | PKCS7err(PKCS7_F_PKCS7_VERIFY,PKCS7_R_INVALID_NULL_POINTER); | 161 | PKCS7err(PKCS7_F_PKCS7_VERIFY,PKCS7_R_INVALID_NULL_POINTER); |
@@ -228,7 +228,30 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | |||
228 | /* Check for revocation status here */ | 228 | /* Check for revocation status here */ |
229 | } | 229 | } |
230 | 230 | ||
231 | p7bio=PKCS7_dataInit(p7,indata); | 231 | /* Performance optimization: if the content is a memory BIO then |
232 | * store its contents in a temporary read only memory BIO. This | ||
233 | * avoids potentially large numbers of slow copies of data which will | ||
234 | * occur when reading from a read write memory BIO when signatures | ||
235 | * are calculated. | ||
236 | */ | ||
237 | |||
238 | if (indata && (BIO_method_type(indata) == BIO_TYPE_MEM)) | ||
239 | { | ||
240 | char *ptr; | ||
241 | long len; | ||
242 | len = BIO_get_mem_data(indata, &ptr); | ||
243 | tmpin = BIO_new_mem_buf(ptr, len); | ||
244 | if (tmpin == NULL) | ||
245 | { | ||
246 | PKCS7err(PKCS7_F_PKCS7_VERIFY,ERR_R_MALLOC_FAILURE); | ||
247 | return 0; | ||
248 | } | ||
249 | } | ||
250 | else | ||
251 | tmpin = indata; | ||
252 | |||
253 | |||
254 | p7bio=PKCS7_dataInit(p7,tmpin); | ||
232 | 255 | ||
233 | if(flags & PKCS7_TEXT) { | 256 | if(flags & PKCS7_TEXT) { |
234 | if(!(tmpout = BIO_new(BIO_s_mem()))) { | 257 | if(!(tmpout = BIO_new(BIO_s_mem()))) { |
@@ -270,9 +293,15 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | |||
270 | ret = 1; | 293 | ret = 1; |
271 | 294 | ||
272 | err: | 295 | err: |
296 | |||
297 | if (tmpin == indata) | ||
298 | { | ||
299 | if(indata) BIO_pop(p7bio); | ||
300 | BIO_free_all(p7bio); | ||
301 | } | ||
302 | else | ||
303 | BIO_free_all(tmpin); | ||
273 | 304 | ||
274 | if(indata) BIO_pop(p7bio); | ||
275 | BIO_free_all(p7bio); | ||
276 | sk_X509_free(signers); | 305 | sk_X509_free(signers); |
277 | 306 | ||
278 | return ret; | 307 | return ret; |
@@ -296,10 +325,6 @@ STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) | |||
296 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_WRONG_CONTENT_TYPE); | 325 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_WRONG_CONTENT_TYPE); |
297 | return NULL; | 326 | return NULL; |
298 | } | 327 | } |
299 | if(!(signers = sk_X509_new_null())) { | ||
300 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,ERR_R_MALLOC_FAILURE); | ||
301 | return NULL; | ||
302 | } | ||
303 | 328 | ||
304 | /* Collect all the signers together */ | 329 | /* Collect all the signers together */ |
305 | 330 | ||
@@ -310,6 +335,11 @@ STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) | |||
310 | return 0; | 335 | return 0; |
311 | } | 336 | } |
312 | 337 | ||
338 | if(!(signers = sk_X509_new_null())) { | ||
339 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,ERR_R_MALLOC_FAILURE); | ||
340 | return NULL; | ||
341 | } | ||
342 | |||
313 | for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++) | 343 | for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++) |
314 | { | 344 | { |
315 | si = sk_PKCS7_SIGNER_INFO_value(sinfos, i); | 345 | si = sk_PKCS7_SIGNER_INFO_value(sinfos, i); |
diff --git a/src/lib/libssl/src/crypto/rand/md_rand.c b/src/lib/libssl/src/crypto/rand/md_rand.c index eeffc0df4c..c84968df88 100644 --- a/src/lib/libssl/src/crypto/rand/md_rand.c +++ b/src/lib/libssl/src/crypto/rand/md_rand.c | |||
@@ -126,6 +126,7 @@ | |||
126 | 126 | ||
127 | #include <openssl/crypto.h> | 127 | #include <openssl/crypto.h> |
128 | #include <openssl/err.h> | 128 | #include <openssl/err.h> |
129 | #include <openssl/fips.h> | ||
129 | 130 | ||
130 | #ifdef BN_DEBUG | 131 | #ifdef BN_DEBUG |
131 | # define PREDICT | 132 | # define PREDICT |
@@ -332,6 +333,14 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) | |||
332 | #endif | 333 | #endif |
333 | int do_stir_pool = 0; | 334 | int do_stir_pool = 0; |
334 | 335 | ||
336 | #ifdef OPENSSL_FIPS | ||
337 | if(FIPS_mode()) | ||
338 | { | ||
339 | FIPSerr(FIPS_F_SSLEAY_RAND_BYTES,FIPS_R_NON_FIPS_METHOD); | ||
340 | return 0; | ||
341 | } | ||
342 | #endif | ||
343 | |||
335 | #ifdef PREDICT | 344 | #ifdef PREDICT |
336 | if (rand_predictable) | 345 | if (rand_predictable) |
337 | { | 346 | { |
diff --git a/src/lib/libssl/src/crypto/rand/rand.h b/src/lib/libssl/src/crypto/rand/rand.h index 606382dd21..604df9be6c 100644 --- a/src/lib/libssl/src/crypto/rand/rand.h +++ b/src/lib/libssl/src/crypto/rand/rand.h | |||
@@ -71,6 +71,10 @@ | |||
71 | extern "C" { | 71 | extern "C" { |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | #if defined(OPENSSL_FIPS) | ||
75 | #define FIPS_RAND_SIZE_T int | ||
76 | #endif | ||
77 | |||
74 | typedef struct rand_meth_st | 78 | typedef struct rand_meth_st |
75 | { | 79 | { |
76 | void (*seed)(const void *buf, int num); | 80 | void (*seed)(const void *buf, int num); |
@@ -121,11 +125,17 @@ void ERR_load_RAND_strings(void); | |||
121 | /* Error codes for the RAND functions. */ | 125 | /* Error codes for the RAND functions. */ |
122 | 126 | ||
123 | /* Function codes. */ | 127 | /* Function codes. */ |
128 | #define RAND_F_FIPS_RAND_BYTES 102 | ||
124 | #define RAND_F_RAND_GET_RAND_METHOD 101 | 129 | #define RAND_F_RAND_GET_RAND_METHOD 101 |
125 | #define RAND_F_SSLEAY_RAND_BYTES 100 | 130 | #define RAND_F_SSLEAY_RAND_BYTES 100 |
126 | 131 | ||
127 | /* Reason codes. */ | 132 | /* Reason codes. */ |
133 | #define RAND_R_NON_FIPS_METHOD 101 | ||
134 | #define RAND_R_PRNG_ASKING_FOR_TOO_MUCH 105 | ||
135 | #define RAND_R_PRNG_NOT_REKEYED 103 | ||
136 | #define RAND_R_PRNG_NOT_RESEEDED 104 | ||
128 | #define RAND_R_PRNG_NOT_SEEDED 100 | 137 | #define RAND_R_PRNG_NOT_SEEDED 100 |
138 | #define RAND_R_PRNG_STUCK 102 | ||
129 | 139 | ||
130 | #ifdef __cplusplus | 140 | #ifdef __cplusplus |
131 | } | 141 | } |
diff --git a/src/lib/libssl/src/crypto/rand/rand_egd.c b/src/lib/libssl/src/crypto/rand/rand_egd.c index 6f742900a0..cd666abfcb 100644 --- a/src/lib/libssl/src/crypto/rand/rand_egd.c +++ b/src/lib/libssl/src/crypto/rand/rand_egd.c | |||
@@ -95,7 +95,7 @@ | |||
95 | * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. | 95 | * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. |
96 | */ | 96 | */ |
97 | 97 | ||
98 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) | 98 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_VOS) |
99 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | 99 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) |
100 | { | 100 | { |
101 | return(-1); | 101 | return(-1); |
@@ -216,7 +216,9 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | |||
216 | while (numbytes != 1) | 216 | while (numbytes != 1) |
217 | { | 217 | { |
218 | num = read(fd, egdbuf, 1); | 218 | num = read(fd, egdbuf, 1); |
219 | if (num >= 0) | 219 | if (num == 0) |
220 | goto err; /* descriptor closed */ | ||
221 | else if (num > 0) | ||
220 | numbytes += num; | 222 | numbytes += num; |
221 | else | 223 | else |
222 | { | 224 | { |
@@ -246,7 +248,9 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | |||
246 | while (numbytes != egdbuf[0]) | 248 | while (numbytes != egdbuf[0]) |
247 | { | 249 | { |
248 | num = read(fd, retrievebuf + numbytes, egdbuf[0] - numbytes); | 250 | num = read(fd, retrievebuf + numbytes, egdbuf[0] - numbytes); |
249 | if (num >= 0) | 251 | if (num == 0) |
252 | goto err; /* descriptor closed */ | ||
253 | else if (num > 0) | ||
250 | numbytes += num; | 254 | numbytes += num; |
251 | else | 255 | else |
252 | { | 256 | { |
diff --git a/src/lib/libssl/src/crypto/rand/rand_err.c b/src/lib/libssl/src/crypto/rand/rand_err.c index b77267e213..95574659ac 100644 --- a/src/lib/libssl/src/crypto/rand/rand_err.c +++ b/src/lib/libssl/src/crypto/rand/rand_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/rand/rand_err.c */ | 1 | /* crypto/rand/rand_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2003 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 |
@@ -66,6 +66,7 @@ | |||
66 | #ifndef OPENSSL_NO_ERR | 66 | #ifndef OPENSSL_NO_ERR |
67 | static ERR_STRING_DATA RAND_str_functs[]= | 67 | static ERR_STRING_DATA RAND_str_functs[]= |
68 | { | 68 | { |
69 | {ERR_PACK(0,RAND_F_FIPS_RAND_BYTES,0), "FIPS_RAND_BYTES"}, | ||
69 | {ERR_PACK(0,RAND_F_RAND_GET_RAND_METHOD,0), "RAND_get_rand_method"}, | 70 | {ERR_PACK(0,RAND_F_RAND_GET_RAND_METHOD,0), "RAND_get_rand_method"}, |
70 | {ERR_PACK(0,RAND_F_SSLEAY_RAND_BYTES,0), "SSLEAY_RAND_BYTES"}, | 71 | {ERR_PACK(0,RAND_F_SSLEAY_RAND_BYTES,0), "SSLEAY_RAND_BYTES"}, |
71 | {0,NULL} | 72 | {0,NULL} |
@@ -73,7 +74,12 @@ static ERR_STRING_DATA RAND_str_functs[]= | |||
73 | 74 | ||
74 | static ERR_STRING_DATA RAND_str_reasons[]= | 75 | static ERR_STRING_DATA RAND_str_reasons[]= |
75 | { | 76 | { |
77 | {RAND_R_NON_FIPS_METHOD ,"non fips method"}, | ||
78 | {RAND_R_PRNG_ASKING_FOR_TOO_MUCH ,"prng asking for too much"}, | ||
79 | {RAND_R_PRNG_NOT_REKEYED ,"prng not rekeyed"}, | ||
80 | {RAND_R_PRNG_NOT_RESEEDED ,"prng not reseeded"}, | ||
76 | {RAND_R_PRNG_NOT_SEEDED ,"PRNG not seeded"}, | 81 | {RAND_R_PRNG_NOT_SEEDED ,"PRNG not seeded"}, |
82 | {RAND_R_PRNG_STUCK ,"prng stuck"}, | ||
77 | {0,NULL} | 83 | {0,NULL} |
78 | }; | 84 | }; |
79 | 85 | ||
diff --git a/src/lib/libssl/src/crypto/rand/rand_lib.c b/src/lib/libssl/src/crypto/rand/rand_lib.c index 513e338985..88f1b56d91 100644 --- a/src/lib/libssl/src/crypto/rand/rand_lib.c +++ b/src/lib/libssl/src/crypto/rand/rand_lib.c | |||
@@ -63,6 +63,8 @@ | |||
63 | #ifndef OPENSSL_NO_ENGINE | 63 | #ifndef OPENSSL_NO_ENGINE |
64 | #include <openssl/engine.h> | 64 | #include <openssl/engine.h> |
65 | #endif | 65 | #endif |
66 | #include <openssl/fips.h> | ||
67 | #include <openssl/fips_rand.h> | ||
66 | 68 | ||
67 | #ifndef OPENSSL_NO_ENGINE | 69 | #ifndef OPENSSL_NO_ENGINE |
68 | /* non-NULL if default_RAND_meth is ENGINE-provided */ | 70 | /* non-NULL if default_RAND_meth is ENGINE-provided */ |
@@ -85,6 +87,16 @@ int RAND_set_rand_method(const RAND_METHOD *meth) | |||
85 | 87 | ||
86 | const RAND_METHOD *RAND_get_rand_method(void) | 88 | const RAND_METHOD *RAND_get_rand_method(void) |
87 | { | 89 | { |
90 | #ifdef OPENSSL_FIPS | ||
91 | if(FIPS_mode() | ||
92 | && default_RAND_meth != FIPS_rand_check()) | ||
93 | { | ||
94 | RANDerr(RAND_F_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD); | ||
95 | return 0; | ||
96 | } | ||
97 | #endif | ||
98 | |||
99 | |||
88 | if (!default_RAND_meth) | 100 | if (!default_RAND_meth) |
89 | { | 101 | { |
90 | #ifndef OPENSSL_NO_ENGINE | 102 | #ifndef OPENSSL_NO_ENGINE |
diff --git a/src/lib/libssl/src/crypto/rand/rand_unix.c b/src/lib/libssl/src/crypto/rand/rand_unix.c index 0599719dd1..9376554fae 100644 --- a/src/lib/libssl/src/crypto/rand/rand_unix.c +++ b/src/lib/libssl/src/crypto/rand/rand_unix.c | |||
@@ -120,6 +120,7 @@ | |||
120 | #include <sys/types.h> | 120 | #include <sys/types.h> |
121 | #include <sys/time.h> | 121 | #include <sys/time.h> |
122 | #include <sys/times.h> | 122 | #include <sys/times.h> |
123 | #include <sys/stat.h> | ||
123 | #include <fcntl.h> | 124 | #include <fcntl.h> |
124 | #include <unistd.h> | 125 | #include <unistd.h> |
125 | #include <time.h> | 126 | #include <time.h> |
@@ -151,9 +152,9 @@ int RAND_poll(void) | |||
151 | int n = 0; | 152 | int n = 0; |
152 | #endif | 153 | #endif |
153 | #ifdef DEVRANDOM | 154 | #ifdef DEVRANDOM |
154 | static const char *randomfiles[] = { DEVRANDOM, NULL }; | 155 | static const char *randomfiles[] = { DEVRANDOM }; |
155 | const char **randomfile = NULL; | 156 | struct stat randomstats[sizeof(randomfiles)/sizeof(randomfiles[0])]; |
156 | int fd; | 157 | int fd,i; |
157 | #endif | 158 | #endif |
158 | #ifdef DEVRANDOM_EGD | 159 | #ifdef DEVRANDOM_EGD |
159 | static const char *egdsockets[] = { DEVRANDOM_EGD, NULL }; | 160 | static const char *egdsockets[] = { DEVRANDOM_EGD, NULL }; |
@@ -161,26 +162,42 @@ int RAND_poll(void) | |||
161 | #endif | 162 | #endif |
162 | 163 | ||
163 | #ifdef DEVRANDOM | 164 | #ifdef DEVRANDOM |
165 | memset(randomstats,0,sizeof(randomstats)); | ||
164 | /* Use a random entropy pool device. Linux, FreeBSD and OpenBSD | 166 | /* Use a random entropy pool device. Linux, FreeBSD and OpenBSD |
165 | * have this. Use /dev/urandom if you can as /dev/random may block | 167 | * have this. Use /dev/urandom if you can as /dev/random may block |
166 | * if it runs out of random entries. */ | 168 | * if it runs out of random entries. */ |
167 | 169 | ||
168 | for (randomfile = randomfiles; *randomfile && n < ENTROPY_NEEDED; randomfile++) | 170 | for (i=0; i<sizeof(randomfiles)/sizeof(randomfiles[0]) && n < ENTROPY_NEEDED; i++) |
169 | { | 171 | { |
170 | if ((fd = open(*randomfile, O_RDONLY|O_NONBLOCK | 172 | if ((fd = open(randomfiles[i], O_RDONLY |
173 | #ifdef O_NONBLOCK | ||
174 | |O_NONBLOCK | ||
175 | #endif | ||
176 | #ifdef O_BINARY | ||
177 | |O_BINARY | ||
178 | #endif | ||
171 | #ifdef O_NOCTTY /* If it happens to be a TTY (god forbid), do not make it | 179 | #ifdef O_NOCTTY /* If it happens to be a TTY (god forbid), do not make it |
172 | our controlling tty */ | 180 | our controlling tty */ |
173 | |O_NOCTTY | 181 | |O_NOCTTY |
174 | #endif | 182 | #endif |
175 | #ifdef O_NOFOLLOW /* Fail if the file is a symbolic link */ | ||
176 | |O_NOFOLLOW | ||
177 | #endif | ||
178 | )) >= 0) | 183 | )) >= 0) |
179 | { | 184 | { |
180 | struct timeval t = { 0, 10*1000 }; /* Spend 10ms on | 185 | struct timeval t = { 0, 10*1000 }; /* Spend 10ms on |
181 | each file. */ | 186 | each file. */ |
182 | int r; | 187 | int r,j; |
183 | fd_set fset; | 188 | fd_set fset; |
189 | struct stat *st=&randomstats[i]; | ||
190 | |||
191 | /* Avoid using same input... Used to be O_NOFOLLOW | ||
192 | * above, but it's not universally appropriate... */ | ||
193 | if (fstat(fd,st) != 0) { close(fd); continue; } | ||
194 | for (j=0;j<i;j++) | ||
195 | { | ||
196 | if (randomstats[j].st_ino==st->st_ino && | ||
197 | randomstats[j].st_dev==st->st_dev) | ||
198 | break; | ||
199 | } | ||
200 | if (j<i) { close(fd); continue; } | ||
184 | 201 | ||
185 | do | 202 | do |
186 | { | 203 | { |
diff --git a/src/lib/libssl/src/crypto/rand/rand_vms.c b/src/lib/libssl/src/crypto/rand/rand_vms.c index 29b2d7af0b..1267a3acae 100644 --- a/src/lib/libssl/src/crypto/rand/rand_vms.c +++ b/src/lib/libssl/src/crypto/rand/rand_vms.c | |||
@@ -101,11 +101,12 @@ int RAND_poll(void) | |||
101 | pitem = item; | 101 | pitem = item; |
102 | 102 | ||
103 | /* Setup */ | 103 | /* Setup */ |
104 | while (pitems_data->length) | 104 | while (pitems_data->length |
105 | && (total_length + pitems_data->length <= 256)) | ||
105 | { | 106 | { |
106 | pitem->length = pitems_data->length; | 107 | pitem->length = pitems_data->length; |
107 | pitem->code = pitems_data->code; | 108 | pitem->code = pitems_data->code; |
108 | pitem->buffer = (long *)data_buffer[total_length]; | 109 | pitem->buffer = (long *)&data_buffer[total_length]; |
109 | pitem->retlen = 0; | 110 | pitem->retlen = 0; |
110 | total_length += pitems_data->length; | 111 | total_length += pitems_data->length; |
111 | pitems_data++; | 112 | pitems_data++; |
diff --git a/src/lib/libssl/src/crypto/rand/rand_win.c b/src/lib/libssl/src/crypto/rand/rand_win.c index 3584842224..30c69161ef 100644 --- a/src/lib/libssl/src/crypto/rand/rand_win.c +++ b/src/lib/libssl/src/crypto/rand/rand_win.c | |||
@@ -125,7 +125,7 @@ | |||
125 | * http://developer.intel.com/design/security/rng/redist_license.htm | 125 | * http://developer.intel.com/design/security/rng/redist_license.htm |
126 | */ | 126 | */ |
127 | #define PROV_INTEL_SEC 22 | 127 | #define PROV_INTEL_SEC 22 |
128 | #define INTEL_DEF_PROV TEXT("Intel Hardware Cryptographic Service Provider") | 128 | #define INTEL_DEF_PROV L"Intel Hardware Cryptographic Service Provider" |
129 | 129 | ||
130 | static void readtimer(void); | 130 | static void readtimer(void); |
131 | static void readscreen(void); | 131 | static void readscreen(void); |
@@ -152,7 +152,7 @@ typedef struct tagCURSORINFO | |||
152 | #define CURSOR_SHOWING 0x00000001 | 152 | #define CURSOR_SHOWING 0x00000001 |
153 | #endif /* CURSOR_SHOWING */ | 153 | #endif /* CURSOR_SHOWING */ |
154 | 154 | ||
155 | typedef BOOL (WINAPI *CRYPTACQUIRECONTEXT)(HCRYPTPROV *, LPCTSTR, LPCTSTR, | 155 | typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTW)(HCRYPTPROV *, LPCWSTR, LPCWSTR, |
156 | DWORD, DWORD); | 156 | DWORD, DWORD); |
157 | typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *); | 157 | typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *); |
158 | typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV, DWORD); | 158 | typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV, DWORD); |
@@ -194,7 +194,7 @@ int RAND_poll(void) | |||
194 | HWND h; | 194 | HWND h; |
195 | 195 | ||
196 | HMODULE advapi, kernel, user, netapi; | 196 | HMODULE advapi, kernel, user, netapi; |
197 | CRYPTACQUIRECONTEXT acquire = 0; | 197 | CRYPTACQUIRECONTEXTW acquire = 0; |
198 | CRYPTGENRANDOM gen = 0; | 198 | CRYPTGENRANDOM gen = 0; |
199 | CRYPTRELEASECONTEXT release = 0; | 199 | CRYPTRELEASECONTEXT release = 0; |
200 | #if 1 /* There was previously a problem with NETSTATGET. Currently, this | 200 | #if 1 /* There was previously a problem with NETSTATGET. Currently, this |
@@ -213,6 +213,9 @@ int RAND_poll(void) | |||
213 | GetVersionEx( &osverinfo ) ; | 213 | GetVersionEx( &osverinfo ) ; |
214 | 214 | ||
215 | #if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO | 215 | #if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO |
216 | #ifndef CryptAcquireContext | ||
217 | #define CryptAcquireContext CryptAcquireContextW | ||
218 | #endif | ||
216 | /* poll the CryptoAPI PRNG */ | 219 | /* poll the CryptoAPI PRNG */ |
217 | /* The CryptoAPI returns sizeof(buf) bytes of randomness */ | 220 | /* The CryptoAPI returns sizeof(buf) bytes of randomness */ |
218 | if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) | 221 | if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) |
@@ -223,21 +226,35 @@ int RAND_poll(void) | |||
223 | } | 226 | } |
224 | #endif | 227 | #endif |
225 | 228 | ||
229 | #ifndef OPENSSL_SYS_WINCE | ||
230 | /* | ||
231 | * None of below libraries are present on Windows CE, which is | ||
232 | * why we #ifndef the whole section. This also excuses us from | ||
233 | * handling the GetProcAddress issue. The trouble is that in | ||
234 | * real Win32 API GetProcAddress is available in ANSI flavor | ||
235 | * only. In WinCE on the other hand GetProcAddress is a macro | ||
236 | * most commonly defined as GetProcAddressW, which accepts | ||
237 | * Unicode argument. If we were to call GetProcAddress under | ||
238 | * WinCE, I'd recommend to either redefine GetProcAddress as | ||
239 | * GetProcAddressA (there seem to be one in common CE spec) or | ||
240 | * implement own shim routine, which would accept ANSI argument | ||
241 | * and expand it to Unicode. | ||
242 | */ | ||
243 | |||
226 | /* load functions dynamically - not available on all systems */ | 244 | /* load functions dynamically - not available on all systems */ |
227 | advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); | 245 | advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); |
228 | kernel = LoadLibrary(TEXT("KERNEL32.DLL")); | 246 | kernel = LoadLibrary(TEXT("KERNEL32.DLL")); |
229 | user = LoadLibrary(TEXT("USER32.DLL")); | 247 | user = LoadLibrary(TEXT("USER32.DLL")); |
230 | netapi = LoadLibrary(TEXT("NETAPI32.DLL")); | 248 | netapi = LoadLibrary(TEXT("NETAPI32.DLL")); |
231 | 249 | ||
232 | #ifndef OPENSSL_SYS_WINCE | ||
233 | #if 1 /* There was previously a problem with NETSTATGET. Currently, this | 250 | #if 1 /* There was previously a problem with NETSTATGET. Currently, this |
234 | * section is still experimental, but if all goes well, this conditional | 251 | * section is still experimental, but if all goes well, this conditional |
235 | * will be removed | 252 | * will be removed |
236 | */ | 253 | */ |
237 | if (netapi) | 254 | if (netapi) |
238 | { | 255 | { |
239 | netstatget = (NETSTATGET) GetProcAddress(netapi,TEXT("NetStatisticsGet")); | 256 | netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); |
240 | netfree = (NETFREE) GetProcAddress(netapi,TEXT("NetApiBufferFree")); | 257 | netfree = (NETFREE) GetProcAddress(netapi,"NetApiBufferFree"); |
241 | } | 258 | } |
242 | 259 | ||
243 | if (netstatget && netfree) | 260 | if (netstatget && netfree) |
@@ -264,9 +281,7 @@ int RAND_poll(void) | |||
264 | if (netapi) | 281 | if (netapi) |
265 | FreeLibrary(netapi); | 282 | FreeLibrary(netapi); |
266 | #endif /* 1 */ | 283 | #endif /* 1 */ |
267 | #endif /* !OPENSSL_SYS_WINCE */ | 284 | |
268 | |||
269 | #ifndef OPENSSL_SYS_WINCE | ||
270 | /* It appears like this can cause an exception deep within ADVAPI32.DLL | 285 | /* It appears like this can cause an exception deep within ADVAPI32.DLL |
271 | * at random times on Windows 2000. Reported by Jeffrey Altman. | 286 | * at random times on Windows 2000. Reported by Jeffrey Altman. |
272 | * Only use it on NT. | 287 | * Only use it on NT. |
@@ -321,16 +336,20 @@ int RAND_poll(void) | |||
321 | free(buf); | 336 | free(buf); |
322 | } | 337 | } |
323 | #endif | 338 | #endif |
324 | #endif /* !OPENSSL_SYS_WINCE */ | ||
325 | 339 | ||
326 | if (advapi) | 340 | if (advapi) |
327 | { | 341 | { |
328 | acquire = (CRYPTACQUIRECONTEXT) GetProcAddress(advapi, | 342 | /* |
329 | TEXT("CryptAcquireContextA")); | 343 | * If it's available, then it's available in both ANSI |
344 | * and UNICODE flavors even in Win9x, documentation says. | ||
345 | * We favor Unicode... | ||
346 | */ | ||
347 | acquire = (CRYPTACQUIRECONTEXTW) GetProcAddress(advapi, | ||
348 | "CryptAcquireContextW"); | ||
330 | gen = (CRYPTGENRANDOM) GetProcAddress(advapi, | 349 | gen = (CRYPTGENRANDOM) GetProcAddress(advapi, |
331 | TEXT("CryptGenRandom")); | 350 | "CryptGenRandom"); |
332 | release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi, | 351 | release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi, |
333 | TEXT("CryptReleaseContext")); | 352 | "CryptReleaseContext"); |
334 | } | 353 | } |
335 | 354 | ||
336 | if (acquire && gen && release) | 355 | if (acquire && gen && release) |
@@ -367,26 +386,15 @@ int RAND_poll(void) | |||
367 | if (advapi) | 386 | if (advapi) |
368 | FreeLibrary(advapi); | 387 | FreeLibrary(advapi); |
369 | 388 | ||
370 | /* timer data */ | ||
371 | readtimer(); | ||
372 | |||
373 | /* memory usage statistics */ | ||
374 | GlobalMemoryStatus(&m); | ||
375 | RAND_add(&m, sizeof(m), 1); | ||
376 | |||
377 | /* process ID */ | ||
378 | w = GetCurrentProcessId(); | ||
379 | RAND_add(&w, sizeof(w), 1); | ||
380 | |||
381 | if (user) | 389 | if (user) |
382 | { | 390 | { |
383 | GETCURSORINFO cursor; | 391 | GETCURSORINFO cursor; |
384 | GETFOREGROUNDWINDOW win; | 392 | GETFOREGROUNDWINDOW win; |
385 | GETQUEUESTATUS queue; | 393 | GETQUEUESTATUS queue; |
386 | 394 | ||
387 | win = (GETFOREGROUNDWINDOW) GetProcAddress(user, TEXT("GetForegroundWindow")); | 395 | win = (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow"); |
388 | cursor = (GETCURSORINFO) GetProcAddress(user, TEXT("GetCursorInfo")); | 396 | cursor = (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo"); |
389 | queue = (GETQUEUESTATUS) GetProcAddress(user, TEXT("GetQueueStatus")); | 397 | queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus"); |
390 | 398 | ||
391 | if (win) | 399 | if (win) |
392 | { | 400 | { |
@@ -458,19 +466,19 @@ int RAND_poll(void) | |||
458 | MODULEENTRY32 m; | 466 | MODULEENTRY32 m; |
459 | 467 | ||
460 | snap = (CREATETOOLHELP32SNAPSHOT) | 468 | snap = (CREATETOOLHELP32SNAPSHOT) |
461 | GetProcAddress(kernel, TEXT("CreateToolhelp32Snapshot")); | 469 | GetProcAddress(kernel, "CreateToolhelp32Snapshot"); |
462 | close_snap = (CLOSETOOLHELP32SNAPSHOT) | 470 | close_snap = (CLOSETOOLHELP32SNAPSHOT) |
463 | GetProcAddress(kernel, TEXT("CloseToolhelp32Snapshot")); | 471 | GetProcAddress(kernel, "CloseToolhelp32Snapshot"); |
464 | heap_first = (HEAP32FIRST) GetProcAddress(kernel, TEXT("Heap32First")); | 472 | heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First"); |
465 | heap_next = (HEAP32NEXT) GetProcAddress(kernel, TEXT("Heap32Next")); | 473 | heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next"); |
466 | heaplist_first = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListFirst")); | 474 | heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst"); |
467 | heaplist_next = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListNext")); | 475 | heaplist_next = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListNext"); |
468 | process_first = (PROCESS32) GetProcAddress(kernel, TEXT("Process32First")); | 476 | process_first = (PROCESS32) GetProcAddress(kernel, "Process32First"); |
469 | process_next = (PROCESS32) GetProcAddress(kernel, TEXT("Process32Next")); | 477 | process_next = (PROCESS32) GetProcAddress(kernel, "Process32Next"); |
470 | thread_first = (THREAD32) GetProcAddress(kernel, TEXT("Thread32First")); | 478 | thread_first = (THREAD32) GetProcAddress(kernel, "Thread32First"); |
471 | thread_next = (THREAD32) GetProcAddress(kernel, TEXT("Thread32Next")); | 479 | thread_next = (THREAD32) GetProcAddress(kernel, "Thread32Next"); |
472 | module_first = (MODULE32) GetProcAddress(kernel, TEXT("Module32First")); | 480 | module_first = (MODULE32) GetProcAddress(kernel, "Module32First"); |
473 | module_next = (MODULE32) GetProcAddress(kernel, TEXT("Module32Next")); | 481 | module_next = (MODULE32) GetProcAddress(kernel, "Module32Next"); |
474 | 482 | ||
475 | if (snap && heap_first && heap_next && heaplist_first && | 483 | if (snap && heap_first && heap_next && heaplist_first && |
476 | heaplist_next && process_first && process_next && | 484 | heaplist_next && process_first && process_next && |
@@ -546,6 +554,18 @@ int RAND_poll(void) | |||
546 | 554 | ||
547 | FreeLibrary(kernel); | 555 | FreeLibrary(kernel); |
548 | } | 556 | } |
557 | #endif /* !OPENSSL_SYS_WINCE */ | ||
558 | |||
559 | /* timer data */ | ||
560 | readtimer(); | ||
561 | |||
562 | /* memory usage statistics */ | ||
563 | GlobalMemoryStatus(&m); | ||
564 | RAND_add(&m, sizeof(m), 1); | ||
565 | |||
566 | /* process ID */ | ||
567 | w = GetCurrentProcessId(); | ||
568 | RAND_add(&w, sizeof(w), 1); | ||
549 | 569 | ||
550 | #if 0 | 570 | #if 0 |
551 | printf("Exiting RAND_poll\n"); | 571 | printf("Exiting RAND_poll\n"); |
@@ -607,7 +627,7 @@ static void readtimer(void) | |||
607 | DWORD w; | 627 | DWORD w; |
608 | LARGE_INTEGER l; | 628 | LARGE_INTEGER l; |
609 | static int have_perfc = 1; | 629 | static int have_perfc = 1; |
610 | #if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE) | 630 | #if defined(_MSC_VER) && defined(_M_X86) |
611 | static int have_tsc = 1; | 631 | static int have_tsc = 1; |
612 | DWORD cyclecount; | 632 | DWORD cyclecount; |
613 | 633 | ||
@@ -660,7 +680,7 @@ static void readtimer(void) | |||
660 | 680 | ||
661 | static void readscreen(void) | 681 | static void readscreen(void) |
662 | { | 682 | { |
663 | #ifndef OPENSSL_SYS_WINCE | 683 | #if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) |
664 | HDC hScrDC; /* screen DC */ | 684 | HDC hScrDC; /* screen DC */ |
665 | HDC hMemDC; /* memory DC */ | 685 | HDC hMemDC; /* memory DC */ |
666 | HBITMAP hBitmap; /* handle for our bitmap */ | 686 | HBITMAP hBitmap; /* handle for our bitmap */ |
diff --git a/src/lib/libssl/src/crypto/rand/randfile.c b/src/lib/libssl/src/crypto/rand/randfile.c index d88ee0d780..9bd89ba495 100644 --- a/src/lib/libssl/src/crypto/rand/randfile.c +++ b/src/lib/libssl/src/crypto/rand/randfile.c | |||
@@ -166,6 +166,7 @@ int RAND_write_file(const char *file) | |||
166 | } | 166 | } |
167 | 167 | ||
168 | #if defined(O_CREAT) && !defined(OPENSSL_SYS_WIN32) | 168 | #if defined(O_CREAT) && !defined(OPENSSL_SYS_WIN32) |
169 | { | ||
169 | /* For some reason Win32 can't write to files created this way */ | 170 | /* For some reason Win32 can't write to files created this way */ |
170 | 171 | ||
171 | /* chmod(..., 0600) is too late to protect the file, | 172 | /* chmod(..., 0600) is too late to protect the file, |
@@ -173,6 +174,7 @@ int RAND_write_file(const char *file) | |||
173 | int fd = open(file, O_CREAT, 0600); | 174 | int fd = open(file, O_CREAT, 0600); |
174 | if (fd != -1) | 175 | if (fd != -1) |
175 | out = fdopen(fd, "wb"); | 176 | out = fdopen(fd, "wb"); |
177 | } | ||
176 | #endif | 178 | #endif |
177 | if (out == NULL) | 179 | if (out == NULL) |
178 | out = fopen(file,"wb"); | 180 | out = fopen(file,"wb"); |
diff --git a/src/lib/libssl/src/crypto/rc2/rc2.h b/src/lib/libssl/src/crypto/rc2/rc2.h index 7816b454dc..71788158d8 100644 --- a/src/lib/libssl/src/crypto/rc2/rc2.h +++ b/src/lib/libssl/src/crypto/rc2/rc2.h | |||
@@ -79,7 +79,10 @@ typedef struct rc2_key_st | |||
79 | RC2_INT data[64]; | 79 | RC2_INT data[64]; |
80 | } RC2_KEY; | 80 | } RC2_KEY; |
81 | 81 | ||
82 | 82 | #ifdef OPENSSL_FIPS | |
83 | void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, | ||
84 | int bits); | ||
85 | #endif | ||
83 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); | 86 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); |
84 | void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, | 87 | void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, |
85 | int enc); | 88 | int enc); |
diff --git a/src/lib/libssl/src/crypto/rc2/rc2_skey.c b/src/lib/libssl/src/crypto/rc2/rc2_skey.c index cab3080c73..22f372f85c 100644 --- a/src/lib/libssl/src/crypto/rc2/rc2_skey.c +++ b/src/lib/libssl/src/crypto/rc2/rc2_skey.c | |||
@@ -57,6 +57,7 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/rc2.h> | 59 | #include <openssl/rc2.h> |
60 | #include <openssl/crypto.h> | ||
60 | #include "rc2_locl.h" | 61 | #include "rc2_locl.h" |
61 | 62 | ||
62 | static unsigned char key_table[256]={ | 63 | static unsigned char key_table[256]={ |
@@ -90,7 +91,19 @@ static unsigned char key_table[256]={ | |||
90 | * BSAFE uses the 'retarded' version. What I previously shipped is | 91 | * BSAFE uses the 'retarded' version. What I previously shipped is |
91 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses | 92 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses |
92 | * a version where the bits parameter is the same as len*8 */ | 93 | * a version where the bits parameter is the same as len*8 */ |
94 | |||
95 | #ifdef OPENSSL_FIPS | ||
96 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) | ||
97 | { | ||
98 | if (FIPS_mode()) | ||
99 | FIPS_BAD_ABORT(RC2) | ||
100 | private_RC2_set_key(key, len, data, bits); | ||
101 | } | ||
102 | void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, | ||
103 | int bits) | ||
104 | #else | ||
93 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) | 105 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) |
106 | #endif | ||
94 | { | 107 | { |
95 | int i,j; | 108 | int i,j; |
96 | unsigned char *k; | 109 | unsigned char *k; |
diff --git a/src/lib/libssl/src/crypto/rc4/asm/rc4-586.pl b/src/lib/libssl/src/crypto/rc4/asm/rc4-586.pl index 7ef889e5a1..d6e98f0811 100644 --- a/src/lib/libssl/src/crypto/rc4/asm/rc4-586.pl +++ b/src/lib/libssl/src/crypto/rc4/asm/rc4-586.pl | |||
@@ -1,16 +1,37 @@ | |||
1 | #!/usr/local/bin/perl | 1 | #!/usr/local/bin/perl |
2 | 2 | ||
3 | # define for pentium pro friendly version | 3 | # At some point it became apparent that the original SSLeay RC4 |
4 | # assembler implementation performs suboptimaly on latest IA-32 | ||
5 | # microarchitectures. After re-tuning performance has changed as | ||
6 | # following: | ||
7 | # | ||
8 | # Pentium +0% | ||
9 | # Pentium III +17% | ||
10 | # AMD +52%(*) | ||
11 | # P4 +180%(**) | ||
12 | # | ||
13 | # (*) This number is actually a trade-off:-) It's possible to | ||
14 | # achieve +72%, but at the cost of -48% off PIII performance. | ||
15 | # In other words code performing further 13% faster on AMD | ||
16 | # would perform almost 2 times slower on Intel PIII... | ||
17 | # For reference! This code delivers ~80% of rc4-amd64.pl | ||
18 | # performance on the same Opteron machine. | ||
19 | # (**) This number requires compressed key schedule set up by | ||
20 | # RC4_set_key and therefore doesn't apply to 0.9.7 [option for | ||
21 | # compressed key schedule is implemented in 0.9.8 and later, | ||
22 | # see commentary section in rc4_skey.c for further details]. | ||
23 | # | ||
24 | # <appro@fy.chalmers.se> | ||
4 | 25 | ||
5 | push(@INC,"perlasm","../../perlasm"); | 26 | push(@INC,"perlasm","../../perlasm"); |
6 | require "x86asm.pl"; | 27 | require "x86asm.pl"; |
7 | 28 | ||
8 | &asm_init($ARGV[0],"rc4-586.pl"); | 29 | &asm_init($ARGV[0],"rc4-586.pl"); |
9 | 30 | ||
10 | $tx="eax"; | 31 | $x="eax"; |
11 | $ty="ebx"; | 32 | $y="ebx"; |
12 | $x="ecx"; | 33 | $tx="ecx"; |
13 | $y="edx"; | 34 | $ty="edx"; |
14 | $in="esi"; | 35 | $in="esi"; |
15 | $out="edi"; | 36 | $out="edi"; |
16 | $d="ebp"; | 37 | $d="ebp"; |
@@ -31,7 +52,7 @@ sub RC4_loop | |||
31 | { | 52 | { |
32 | &mov($ty, &swtmp(2)); | 53 | &mov($ty, &swtmp(2)); |
33 | &cmp($ty, $in); | 54 | &cmp($ty, $in); |
34 | &jle(&label("finished")); | 55 | &jbe(&label("finished")); |
35 | &inc($in); | 56 | &inc($in); |
36 | } | 57 | } |
37 | else | 58 | else |
@@ -39,27 +60,23 @@ sub RC4_loop | |||
39 | &add($ty, 8); | 60 | &add($ty, 8); |
40 | &inc($in); | 61 | &inc($in); |
41 | &cmp($ty, $in); | 62 | &cmp($ty, $in); |
42 | &jl(&label("finished")); | 63 | &jb(&label("finished")); |
43 | &mov(&swtmp(2), $ty); | 64 | &mov(&swtmp(2), $ty); |
44 | } | 65 | } |
45 | } | 66 | } |
46 | # Moved out | 67 | # Moved out |
47 | # &mov( $tx, &DWP(0,$d,$x,4)) if $p < 0; | 68 | # &mov( $tx, &DWP(0,$d,$x,4)) if $p < 0; |
48 | 69 | ||
49 | &add( $y, $tx); | 70 | &add( &LB($y), &LB($tx)); |
50 | &and( $y, 0xff); | ||
51 | &inc( $x); # NEXT ROUND | ||
52 | &mov( $ty, &DWP(0,$d,$y,4)); | 71 | &mov( $ty, &DWP(0,$d,$y,4)); |
53 | # XXX | 72 | # XXX |
54 | &mov( &DWP(-4,$d,$x,4),$ty); # AGI | 73 | &mov( &DWP(0,$d,$x,4),$ty); |
55 | &add( $ty, $tx); | 74 | &add( $ty, $tx); |
56 | &and( $x, 0xff); # NEXT ROUND | ||
57 | &and( $ty, 0xff); | ||
58 | &mov( &DWP(0,$d,$y,4),$tx); | 75 | &mov( &DWP(0,$d,$y,4),$tx); |
59 | &nop(); | 76 | &and( $ty, 0xff); |
60 | &mov( $ty, &DWP(0,$d,$ty,4)); | 77 | &inc( &LB($x)); # NEXT ROUND |
61 | &mov( $tx, &DWP(0,$d,$x,4)) if $p < 1; # NEXT ROUND | 78 | &mov( $tx, &DWP(0,$d,$x,4)) if $p < 1; # NEXT ROUND |
62 | # XXX | 79 | &mov( $ty, &DWP(0,$d,$ty,4)); |
63 | 80 | ||
64 | if (!$char) | 81 | if (!$char) |
65 | { | 82 | { |
@@ -88,35 +105,47 @@ sub RC4 | |||
88 | 105 | ||
89 | &function_begin_B($name,""); | 106 | &function_begin_B($name,""); |
90 | 107 | ||
108 | &mov($ty,&wparam(1)); # len | ||
109 | &cmp($ty,0); | ||
110 | &jne(&label("proceed")); | ||
111 | &ret(); | ||
112 | &set_label("proceed"); | ||
113 | |||
91 | &comment(""); | 114 | &comment(""); |
92 | 115 | ||
93 | &push("ebp"); | 116 | &push("ebp"); |
94 | &push("ebx"); | 117 | &push("ebx"); |
95 | &mov( $d, &wparam(0)); # key | ||
96 | &mov( $ty, &wparam(1)); # num | ||
97 | &push("esi"); | 118 | &push("esi"); |
98 | &push("edi"); | 119 | &xor( $x, $x); # avoid partial register stalls |
120 | &push("edi"); | ||
121 | &xor( $y, $y); # avoid partial register stalls | ||
122 | &mov( $d, &wparam(0)); # key | ||
123 | &mov( $in, &wparam(2)); | ||
99 | 124 | ||
100 | &mov( $x, &DWP(0,$d,"",1)); | 125 | &movb( &LB($x), &BP(0,$d,"",1)); |
101 | &mov( $y, &DWP(4,$d,"",1)); | 126 | &movb( &LB($y), &BP(4,$d,"",1)); |
102 | 127 | ||
103 | &mov( $in, &wparam(2)); | 128 | &mov( $out, &wparam(3)); |
104 | &inc( $x); | 129 | &inc( &LB($x)); |
105 | 130 | ||
106 | &stack_push(3); # 3 temp variables | 131 | &stack_push(3); # 3 temp variables |
107 | &add( $d, 8); | 132 | &add( $d, 8); |
108 | &and( $x, 0xff); | 133 | |
134 | # detect compressed schedule, see commentary section in rc4_skey.c... | ||
135 | # in 0.9.7 context ~50 bytes below RC4_CHAR label remain redundant, | ||
136 | # as compressed key schedule is set up in 0.9.8 and later. | ||
137 | &cmp(&DWP(256,$d),-1); | ||
138 | &je(&label("RC4_CHAR")); | ||
109 | 139 | ||
110 | &lea( $ty, &DWP(-8,$ty,$in)); | 140 | &lea( $ty, &DWP(-8,$ty,$in)); |
111 | 141 | ||
112 | # check for 0 length input | 142 | # check for 0 length input |
113 | 143 | ||
114 | &mov( $out, &wparam(3)); | ||
115 | &mov( &swtmp(2), $ty); # this is now address to exit at | 144 | &mov( &swtmp(2), $ty); # this is now address to exit at |
116 | &mov( $tx, &DWP(0,$d,$x,4)); | 145 | &mov( $tx, &DWP(0,$d,$x,4)); |
117 | 146 | ||
118 | &cmp( $ty, $in); | 147 | &cmp( $ty, $in); |
119 | &jl( &label("end")); # less than 8 bytes | 148 | &jb( &label("end")); # less than 8 bytes |
120 | 149 | ||
121 | &set_label("start"); | 150 | &set_label("start"); |
122 | 151 | ||
@@ -148,7 +177,7 @@ sub RC4 | |||
148 | &mov( &DWP(-4,$out,"",0), $tx); | 177 | &mov( &DWP(-4,$out,"",0), $tx); |
149 | &mov( $tx, &DWP(0,$d,$x,4)); | 178 | &mov( $tx, &DWP(0,$d,$x,4)); |
150 | &cmp($in, $ty); | 179 | &cmp($in, $ty); |
151 | &jle(&label("start")); | 180 | &jbe(&label("start")); |
152 | 181 | ||
153 | &set_label("end"); | 182 | &set_label("end"); |
154 | 183 | ||
@@ -162,10 +191,37 @@ sub RC4 | |||
162 | &RC4_loop(5,0,1); | 191 | &RC4_loop(5,0,1); |
163 | &RC4_loop(6,1,1); | 192 | &RC4_loop(6,1,1); |
164 | 193 | ||
194 | &jmp(&label("finished")); | ||
195 | |||
196 | &align(16); | ||
197 | # this is essentially Intel P4 specific codepath, see rc4_skey.c, | ||
198 | # and is engaged in 0.9.8 and later context... | ||
199 | &set_label("RC4_CHAR"); | ||
200 | |||
201 | &lea ($ty,&DWP(0,$in,$ty)); | ||
202 | &mov (&swtmp(2),$ty); | ||
203 | |||
204 | # strangely enough unrolled loop performs over 20% slower... | ||
205 | &set_label("RC4_CHAR_loop"); | ||
206 | &movz ($tx,&BP(0,$d,$x)); | ||
207 | &add (&LB($y),&LB($tx)); | ||
208 | &movz ($ty,&BP(0,$d,$y)); | ||
209 | &movb (&BP(0,$d,$y),&LB($tx)); | ||
210 | &movb (&BP(0,$d,$x),&LB($ty)); | ||
211 | &add (&LB($ty),&LB($tx)); | ||
212 | &movz ($ty,&BP(0,$d,$ty)); | ||
213 | &xorb (&LB($ty),&BP(0,$in)); | ||
214 | &movb (&BP(0,$out),&LB($ty)); | ||
215 | &inc (&LB($x)); | ||
216 | &inc ($in); | ||
217 | &inc ($out); | ||
218 | &cmp ($in,&swtmp(2)); | ||
219 | &jb (&label("RC4_CHAR_loop")); | ||
220 | |||
165 | &set_label("finished"); | 221 | &set_label("finished"); |
166 | &dec( $x); | 222 | &dec( $x); |
167 | &stack_pop(3); | 223 | &stack_pop(3); |
168 | &mov( &DWP(-4,$d,"",0),$y); | 224 | &movb( &BP(-4,$d,"",0),&LB($y)); |
169 | &movb( &BP(-8,$d,"",0),&LB($x)); | 225 | &movb( &BP(-8,$d,"",0),&LB($x)); |
170 | 226 | ||
171 | &function_end($name); | 227 | &function_end($name); |
diff --git a/src/lib/libssl/src/crypto/rc4/rc4.h b/src/lib/libssl/src/crypto/rc4/rc4.h index 8722091f2e..dd90d9fde0 100644 --- a/src/lib/libssl/src/crypto/rc4/rc4.h +++ b/src/lib/libssl/src/crypto/rc4/rc4.h | |||
@@ -73,10 +73,17 @@ typedef struct rc4_key_st | |||
73 | { | 73 | { |
74 | RC4_INT x,y; | 74 | RC4_INT x,y; |
75 | RC4_INT data[256]; | 75 | RC4_INT data[256]; |
76 | #if defined(__ia64) || defined(__ia64__) || defined(_M_IA64) | ||
77 | /* see crypto/rc4/asm/rc4-ia64.S for further details... */ | ||
78 | RC4_INT pad[512-256-2]; | ||
79 | #endif | ||
76 | } RC4_KEY; | 80 | } RC4_KEY; |
77 | 81 | ||
78 | 82 | ||
79 | const char *RC4_options(void); | 83 | const char *RC4_options(void); |
84 | #ifdef OPENSSL_FIPS | ||
85 | void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); | ||
86 | #endif | ||
80 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); | 87 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); |
81 | void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | 88 | void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, |
82 | unsigned char *outdata); | 89 | unsigned char *outdata); |
diff --git a/src/lib/libssl/src/crypto/rc4/rc4_enc.c b/src/lib/libssl/src/crypto/rc4/rc4_enc.c index d5f18a3a70..81a97ea3b7 100644 --- a/src/lib/libssl/src/crypto/rc4/rc4_enc.c +++ b/src/lib/libssl/src/crypto/rc4/rc4_enc.c | |||
@@ -77,6 +77,10 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | |||
77 | x=key->x; | 77 | x=key->x; |
78 | y=key->y; | 78 | y=key->y; |
79 | d=key->data; | 79 | d=key->data; |
80 | #if defined(__ia64) || defined(__ia64__) || defined(_M_IA64) | ||
81 | /* see crypto/rc4/asm/rc4-ia64.S for further details... */ | ||
82 | d=(RC4_INT *)(((size_t)(d+255))&~(sizeof(key->data)-1)); | ||
83 | #endif | ||
80 | 84 | ||
81 | #if defined(RC4_CHUNK) | 85 | #if defined(RC4_CHUNK) |
82 | /* | 86 | /* |
diff --git a/src/lib/libssl/src/crypto/rc4/rc4_locl.h b/src/lib/libssl/src/crypto/rc4/rc4_locl.h index 3bb80b6ce9..c712e1632e 100644 --- a/src/lib/libssl/src/crypto/rc4/rc4_locl.h +++ b/src/lib/libssl/src/crypto/rc4/rc4_locl.h | |||
@@ -1,4 +1,5 @@ | |||
1 | #ifndef HEADER_RC4_LOCL_H | 1 | #ifndef HEADER_RC4_LOCL_H |
2 | #define HEADER_RC4_LOCL_H | 2 | #define HEADER_RC4_LOCL_H |
3 | #include <openssl/opensslconf.h> | 3 | #include <openssl/opensslconf.h> |
4 | #include <cryptlib.h> | ||
4 | #endif | 5 | #endif |
diff --git a/src/lib/libssl/src/crypto/rc4/rc4_skey.c b/src/lib/libssl/src/crypto/rc4/rc4_skey.c index bb10c1ebe2..07234f061a 100644 --- a/src/lib/libssl/src/crypto/rc4/rc4_skey.c +++ b/src/lib/libssl/src/crypto/rc4/rc4_skey.c | |||
@@ -57,6 +57,7 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/rc4.h> | 59 | #include <openssl/rc4.h> |
60 | #include <openssl/crypto.h> | ||
60 | #include "rc4_locl.h" | 61 | #include "rc4_locl.h" |
61 | #include <openssl/opensslv.h> | 62 | #include <openssl/opensslv.h> |
62 | 63 | ||
@@ -85,7 +86,7 @@ const char *RC4_options(void) | |||
85 | * Date: Wed, 14 Sep 1994 06:35:31 GMT | 86 | * Date: Wed, 14 Sep 1994 06:35:31 GMT |
86 | */ | 87 | */ |
87 | 88 | ||
88 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) | 89 | FIPS_NON_FIPS_VCIPHER_Init(RC4) |
89 | { | 90 | { |
90 | register RC4_INT tmp; | 91 | register RC4_INT tmp; |
91 | register int id1,id2; | 92 | register int id1,id2; |
@@ -93,6 +94,11 @@ void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) | |||
93 | unsigned int i; | 94 | unsigned int i; |
94 | 95 | ||
95 | d= &(key->data[0]); | 96 | d= &(key->data[0]); |
97 | #if defined(__ia64) || defined(__ia64__) || defined(_M_IA64) | ||
98 | /* see crypto/rc4/asm/rc4-ia64.S for further details... */ | ||
99 | d=(RC4_INT *)(((size_t)(d+255))&~(sizeof(key->data)-1)); | ||
100 | #endif | ||
101 | |||
96 | for (i=0; i<256; i++) | 102 | for (i=0; i<256; i++) |
97 | d[i]=i; | 103 | d[i]=i; |
98 | key->x = 0; | 104 | key->x = 0; |
diff --git a/src/lib/libssl/src/crypto/rc5/rc5.h b/src/lib/libssl/src/crypto/rc5/rc5.h index 4adfd2db5a..aa3f26920b 100644 --- a/src/lib/libssl/src/crypto/rc5/rc5.h +++ b/src/lib/libssl/src/crypto/rc5/rc5.h | |||
@@ -92,7 +92,10 @@ typedef struct rc5_key_st | |||
92 | RC5_32_INT data[2*(RC5_16_ROUNDS+1)]; | 92 | RC5_32_INT data[2*(RC5_16_ROUNDS+1)]; |
93 | } RC5_32_KEY; | 93 | } RC5_32_KEY; |
94 | 94 | ||
95 | 95 | #ifdef OPENSSL_FIPS | |
96 | void private_RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, | ||
97 | int rounds); | ||
98 | #endif | ||
96 | void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, | 99 | void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, |
97 | int rounds); | 100 | int rounds); |
98 | void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key, | 101 | void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key, |
diff --git a/src/lib/libssl/src/crypto/ripemd/ripemd.h b/src/lib/libssl/src/crypto/ripemd/ripemd.h index 78d5f36560..7d0d998189 100644 --- a/src/lib/libssl/src/crypto/ripemd/ripemd.h +++ b/src/lib/libssl/src/crypto/ripemd/ripemd.h | |||
@@ -90,6 +90,9 @@ typedef struct RIPEMD160state_st | |||
90 | int num; | 90 | int num; |
91 | } RIPEMD160_CTX; | 91 | } RIPEMD160_CTX; |
92 | 92 | ||
93 | #ifdef OPENSSL_FIPS | ||
94 | int private_RIPEMD160_Init(RIPEMD160_CTX *c); | ||
95 | #endif | ||
93 | int RIPEMD160_Init(RIPEMD160_CTX *c); | 96 | int RIPEMD160_Init(RIPEMD160_CTX *c); |
94 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len); | 97 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len); |
95 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); | 98 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); |
diff --git a/src/lib/libssl/src/crypto/ripemd/rmd_dgst.c b/src/lib/libssl/src/crypto/ripemd/rmd_dgst.c index 28896512e7..58ff010d11 100644 --- a/src/lib/libssl/src/crypto/ripemd/rmd_dgst.c +++ b/src/lib/libssl/src/crypto/ripemd/rmd_dgst.c | |||
@@ -58,6 +58,7 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "rmd_locl.h" | 60 | #include "rmd_locl.h" |
61 | #include <openssl/fips.h> | ||
61 | #include <openssl/opensslv.h> | 62 | #include <openssl/opensslv.h> |
62 | 63 | ||
63 | const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT; | 64 | const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT; |
@@ -69,7 +70,7 @@ const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT; | |||
69 | void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,int num); | 70 | void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,int num); |
70 | # endif | 71 | # endif |
71 | 72 | ||
72 | int RIPEMD160_Init(RIPEMD160_CTX *c) | 73 | FIPS_NON_FIPS_MD_Init(RIPEMD160) |
73 | { | 74 | { |
74 | c->A=RIPEMD160_A; | 75 | c->A=RIPEMD160_A; |
75 | c->B=RIPEMD160_B; | 76 | c->B=RIPEMD160_B; |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa.h b/src/lib/libssl/src/crypto/rsa/rsa.h index 62fa745f79..fc3bb5f86d 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa.h +++ b/src/lib/libssl/src/crypto/rsa/rsa.h | |||
@@ -72,6 +72,10 @@ | |||
72 | #error RSA is disabled. | 72 | #error RSA is disabled. |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | #if defined(OPENSSL_FIPS) | ||
76 | #define FIPS_RSA_SIZE_T int | ||
77 | #endif | ||
78 | |||
75 | #ifdef __cplusplus | 79 | #ifdef __cplusplus |
76 | extern "C" { | 80 | extern "C" { |
77 | #endif | 81 | #endif |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_eay.c b/src/lib/libssl/src/crypto/rsa/rsa_eay.c index e0d286266e..d4caab3f95 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_eay.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_eay.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <openssl/rsa.h> | 62 | #include <openssl/rsa.h> |
63 | #include <openssl/rand.h> | 63 | #include <openssl/rand.h> |
64 | 64 | ||
65 | #ifndef RSA_NULL | 65 | #if !defined(RSA_NULL) && !defined(OPENSSL_FIPS) |
66 | 66 | ||
67 | static int RSA_eay_public_encrypt(int flen, const unsigned char *from, | 67 | static int RSA_eay_public_encrypt(int flen, const unsigned char *from, |
68 | unsigned char *to, RSA *rsa,int padding); | 68 | unsigned char *to, RSA *rsa,int padding); |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_gen.c b/src/lib/libssl/src/crypto/rsa/rsa_gen.c index 00c25adbc5..adb5e34da5 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_gen.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_gen.c | |||
@@ -62,6 +62,8 @@ | |||
62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
63 | #include <openssl/rsa.h> | 63 | #include <openssl/rsa.h> |
64 | 64 | ||
65 | #ifndef OPENSSL_FIPS | ||
66 | |||
65 | RSA *RSA_generate_key(int bits, unsigned long e_value, | 67 | RSA *RSA_generate_key(int bits, unsigned long e_value, |
66 | void (*callback)(int,int,void *), void *cb_arg) | 68 | void (*callback)(int,int,void *), void *cb_arg) |
67 | { | 69 | { |
@@ -195,3 +197,4 @@ err: | |||
195 | return(rsa); | 197 | return(rsa); |
196 | } | 198 | } |
197 | 199 | ||
200 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_saos.c b/src/lib/libssl/src/crypto/rsa/rsa_saos.c index f462716a57..24fc94835e 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_saos.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_saos.c | |||
@@ -139,8 +139,11 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype, | |||
139 | ret=1; | 139 | ret=1; |
140 | err: | 140 | err: |
141 | if (sig != NULL) M_ASN1_OCTET_STRING_free(sig); | 141 | if (sig != NULL) M_ASN1_OCTET_STRING_free(sig); |
142 | OPENSSL_cleanse(s,(unsigned int)siglen); | 142 | if (s != NULL) |
143 | OPENSSL_free(s); | 143 | { |
144 | OPENSSL_cleanse(s,(unsigned int)siglen); | ||
145 | OPENSSL_free(s); | ||
146 | } | ||
144 | return(ret); | 147 | return(ret); |
145 | } | 148 | } |
146 | 149 | ||
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_sign.c b/src/lib/libssl/src/crypto/rsa/rsa_sign.c index 8a1e642183..cee09eccb1 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_sign.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_sign.c | |||
@@ -169,7 +169,7 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
169 | } | 169 | } |
170 | if((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH) ) { | 170 | if((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH) ) { |
171 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH); | 171 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH); |
172 | return(0); | 172 | goto err; |
173 | } | 173 | } |
174 | i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING); | 174 | i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING); |
175 | 175 | ||
@@ -222,8 +222,11 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
222 | } | 222 | } |
223 | err: | 223 | err: |
224 | if (sig != NULL) X509_SIG_free(sig); | 224 | if (sig != NULL) X509_SIG_free(sig); |
225 | OPENSSL_cleanse(s,(unsigned int)siglen); | 225 | if (s != NULL) |
226 | OPENSSL_free(s); | 226 | { |
227 | OPENSSL_cleanse(s,(unsigned int)siglen); | ||
228 | OPENSSL_free(s); | ||
229 | } | ||
227 | return(ret); | 230 | return(ret); |
228 | } | 231 | } |
229 | 232 | ||
diff --git a/src/lib/libssl/src/crypto/sha/asm/sha1-586.pl b/src/lib/libssl/src/crypto/sha/asm/sha1-586.pl index e00f709553..041acc0348 100644 --- a/src/lib/libssl/src/crypto/sha/asm/sha1-586.pl +++ b/src/lib/libssl/src/crypto/sha/asm/sha1-586.pl | |||
@@ -405,7 +405,7 @@ sub sha1_block_data | |||
405 | &mov(&DWP(16,$tmp1,"",0),$E); | 405 | &mov(&DWP(16,$tmp1,"",0),$E); |
406 | &cmp("esi","eax"); | 406 | &cmp("esi","eax"); |
407 | &mov(&DWP( 4,$tmp1,"",0),$B); | 407 | &mov(&DWP( 4,$tmp1,"",0),$B); |
408 | &jl(&label("start")); | 408 | &jb(&label("start")); |
409 | 409 | ||
410 | &stack_pop(18+9); | 410 | &stack_pop(18+9); |
411 | &pop("edi"); | 411 | &pop("edi"); |
diff --git a/src/lib/libssl/src/crypto/sha/sha.h b/src/lib/libssl/src/crypto/sha/sha.h index 3fd54a10cc..79c07b0fd1 100644 --- a/src/lib/libssl/src/crypto/sha/sha.h +++ b/src/lib/libssl/src/crypto/sha/sha.h | |||
@@ -69,6 +69,10 @@ extern "C" { | |||
69 | #error SHA is disabled. | 69 | #error SHA is disabled. |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | #if defined(OPENSSL_FIPS) | ||
73 | #define FIPS_SHA_SIZE_T unsigned long | ||
74 | #endif | ||
75 | |||
72 | /* | 76 | /* |
73 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
74 | * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! | 78 | * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! |
@@ -101,6 +105,9 @@ typedef struct SHAstate_st | |||
101 | } SHA_CTX; | 105 | } SHA_CTX; |
102 | 106 | ||
103 | #ifndef OPENSSL_NO_SHA0 | 107 | #ifndef OPENSSL_NO_SHA0 |
108 | #ifdef OPENSSL_FIPS | ||
109 | int private_SHA_Init(SHA_CTX *c); | ||
110 | #endif | ||
104 | int SHA_Init(SHA_CTX *c); | 111 | int SHA_Init(SHA_CTX *c); |
105 | int SHA_Update(SHA_CTX *c, const void *data, unsigned long len); | 112 | int SHA_Update(SHA_CTX *c, const void *data, unsigned long len); |
106 | int SHA_Final(unsigned char *md, SHA_CTX *c); | 113 | int SHA_Final(unsigned char *md, SHA_CTX *c); |
diff --git a/src/lib/libssl/src/crypto/sha/sha1dgst.c b/src/lib/libssl/src/crypto/sha/sha1dgst.c index 182f65982a..1e2009b760 100644 --- a/src/lib/libssl/src/crypto/sha/sha1dgst.c +++ b/src/lib/libssl/src/crypto/sha/sha1dgst.c | |||
@@ -62,12 +62,20 @@ | |||
62 | #define SHA_1 | 62 | #define SHA_1 |
63 | 63 | ||
64 | #include <openssl/opensslv.h> | 64 | #include <openssl/opensslv.h> |
65 | #include <openssl/opensslconf.h> | ||
65 | 66 | ||
67 | #ifndef OPENSSL_FIPS | ||
66 | const char *SHA1_version="SHA1" OPENSSL_VERSION_PTEXT; | 68 | const char *SHA1_version="SHA1" OPENSSL_VERSION_PTEXT; |
67 | 69 | ||
68 | /* The implementation is in ../md32_common.h */ | 70 | /* The implementation is in ../md32_common.h */ |
69 | 71 | ||
70 | #include "sha_locl.h" | 72 | #include "sha_locl.h" |
71 | 73 | ||
74 | #else /* ndef OPENSSL_FIPS */ | ||
75 | |||
76 | static void *dummy=&dummy; | ||
77 | |||
78 | #endif /* ndef OPENSSL_FIPS */ | ||
79 | |||
72 | #endif | 80 | #endif |
73 | 81 | ||
diff --git a/src/lib/libssl/src/crypto/sha/sha_locl.h b/src/lib/libssl/src/crypto/sha/sha_locl.h index 2dd63a62a6..a3623f72da 100644 --- a/src/lib/libssl/src/crypto/sha/sha_locl.h +++ b/src/lib/libssl/src/crypto/sha/sha_locl.h | |||
@@ -121,6 +121,11 @@ | |||
121 | # define sha1_block_data_order sha1_block_asm_data_order | 121 | # define sha1_block_data_order sha1_block_asm_data_order |
122 | # define DONT_IMPLEMENT_BLOCK_DATA_ORDER | 122 | # define DONT_IMPLEMENT_BLOCK_DATA_ORDER |
123 | # define HASH_BLOCK_DATA_ORDER_ALIGNED sha1_block_asm_data_order | 123 | # define HASH_BLOCK_DATA_ORDER_ALIGNED sha1_block_asm_data_order |
124 | # elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) | ||
125 | # define sha1_block_host_order sha1_block_asm_host_order | ||
126 | # define DONT_IMPLEMENT_BLOCK_HOST_ORDER | ||
127 | # define sha1_block_data_order sha1_block_asm_data_order | ||
128 | # define DONT_IMPLEMENT_BLOCK_DATA_ORDER | ||
124 | # endif | 129 | # endif |
125 | # endif | 130 | # endif |
126 | void sha1_block_host_order (SHA_CTX *c, const void *p,int num); | 131 | void sha1_block_host_order (SHA_CTX *c, const void *p,int num); |
@@ -138,7 +143,11 @@ | |||
138 | #define INIT_DATA_h3 0x10325476UL | 143 | #define INIT_DATA_h3 0x10325476UL |
139 | #define INIT_DATA_h4 0xc3d2e1f0UL | 144 | #define INIT_DATA_h4 0xc3d2e1f0UL |
140 | 145 | ||
146 | #if defined(SHA_0) && defined(OPENSSL_FIPS) | ||
147 | FIPS_NON_FIPS_MD_Init(SHA) | ||
148 | #else | ||
141 | int HASH_INIT (SHA_CTX *c) | 149 | int HASH_INIT (SHA_CTX *c) |
150 | #endif | ||
142 | { | 151 | { |
143 | c->h0=INIT_DATA_h0; | 152 | c->h0=INIT_DATA_h0; |
144 | c->h1=INIT_DATA_h1; | 153 | c->h1=INIT_DATA_h1; |
diff --git a/src/lib/libssl/src/crypto/sha/shatest.c b/src/lib/libssl/src/crypto/sha/shatest.c index 5d2b1d3b1a..ff702aa53e 100644 --- a/src/lib/libssl/src/crypto/sha/shatest.c +++ b/src/lib/libssl/src/crypto/sha/shatest.c | |||
@@ -62,10 +62,10 @@ | |||
62 | 62 | ||
63 | #include "../e_os.h" | 63 | #include "../e_os.h" |
64 | 64 | ||
65 | #ifdef OPENSSL_NO_SHA | 65 | #if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA0) |
66 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
67 | { | 67 | { |
68 | printf("No SHA support\n"); | 68 | printf("No SHA0 support\n"); |
69 | return(0); | 69 | return(0); |
70 | } | 70 | } |
71 | #else | 71 | #else |
diff --git a/src/lib/libssl/src/crypto/stack/safestack.h b/src/lib/libssl/src/crypto/stack/safestack.h index ed9ed2c23a..bd1121c279 100644 --- a/src/lib/libssl/src/crypto/stack/safestack.h +++ b/src/lib/libssl/src/crypto/stack/safestack.h | |||
@@ -113,6 +113,8 @@ STACK_OF(type) \ | |||
113 | ((type * (*)(STACK_OF(type) *))sk_pop)(st) | 113 | ((type * (*)(STACK_OF(type) *))sk_pop)(st) |
114 | #define SKM_sk_sort(type, st) \ | 114 | #define SKM_sk_sort(type, st) \ |
115 | ((void (*)(STACK_OF(type) *))sk_sort)(st) | 115 | ((void (*)(STACK_OF(type) *))sk_sort)(st) |
116 | #define SKM_sk_is_sorted(type, st) \ | ||
117 | ((int (*)(const STACK_OF(type) *))sk_is_sorted)(st) | ||
116 | 118 | ||
117 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | 119 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ |
118 | ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \ | 120 | ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \ |
@@ -187,6 +189,8 @@ STACK_OF(type) \ | |||
187 | ((type *)sk_pop(st)) | 189 | ((type *)sk_pop(st)) |
188 | #define SKM_sk_sort(type, st) \ | 190 | #define SKM_sk_sort(type, st) \ |
189 | sk_sort(st) | 191 | sk_sort(st) |
192 | #define SKM_sk_is_sorted(type, st) \ | ||
193 | sk_is_sorted(st) | ||
190 | 194 | ||
191 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | 195 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ |
192 | d2i_ASN1_SET(st,pp,length, (char *(*)())d2i_func, (void (*)(void *))free_func, ex_tag,ex_class) | 196 | d2i_ASN1_SET(st,pp,length, (char *(*)())d2i_func, (void (*)(void *))free_func, ex_tag,ex_class) |
@@ -223,6 +227,7 @@ STACK_OF(type) \ | |||
223 | #define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st)) | 227 | #define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st)) |
224 | #define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st)) | 228 | #define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st)) |
225 | #define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) | 229 | #define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) |
230 | #define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st)) | ||
226 | 231 | ||
227 | #define sk_ASN1_GENERALSTRING_new(st) SKM_sk_new(ASN1_GENERALSTRING, (st)) | 232 | #define sk_ASN1_GENERALSTRING_new(st) SKM_sk_new(ASN1_GENERALSTRING, (st)) |
228 | #define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING) | 233 | #define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING) |
@@ -243,6 +248,7 @@ STACK_OF(type) \ | |||
243 | #define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st)) | 248 | #define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st)) |
244 | #define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st)) | 249 | #define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st)) |
245 | #define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st)) | 250 | #define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st)) |
251 | #define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st)) | ||
246 | 252 | ||
247 | #define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st)) | 253 | #define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st)) |
248 | #define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) | 254 | #define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) |
@@ -263,6 +269,7 @@ STACK_OF(type) \ | |||
263 | #define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st)) | 269 | #define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st)) |
264 | #define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st)) | 270 | #define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st)) |
265 | #define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) | 271 | #define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) |
272 | #define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st)) | ||
266 | 273 | ||
267 | #define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st)) | 274 | #define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st)) |
268 | #define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) | 275 | #define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) |
@@ -283,6 +290,7 @@ STACK_OF(type) \ | |||
283 | #define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st)) | 290 | #define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st)) |
284 | #define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st)) | 291 | #define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st)) |
285 | #define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) | 292 | #define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) |
293 | #define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st)) | ||
286 | 294 | ||
287 | #define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st)) | 295 | #define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st)) |
288 | #define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) | 296 | #define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) |
@@ -303,6 +311,7 @@ STACK_OF(type) \ | |||
303 | #define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st)) | 311 | #define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st)) |
304 | #define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st)) | 312 | #define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st)) |
305 | #define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) | 313 | #define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) |
314 | #define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st)) | ||
306 | 315 | ||
307 | #define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st)) | 316 | #define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st)) |
308 | #define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) | 317 | #define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) |
@@ -323,6 +332,7 @@ STACK_OF(type) \ | |||
323 | #define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st)) | 332 | #define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st)) |
324 | #define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st)) | 333 | #define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st)) |
325 | #define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) | 334 | #define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) |
335 | #define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st)) | ||
326 | 336 | ||
327 | #define sk_ASN1_VALUE_new(st) SKM_sk_new(ASN1_VALUE, (st)) | 337 | #define sk_ASN1_VALUE_new(st) SKM_sk_new(ASN1_VALUE, (st)) |
328 | #define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE) | 338 | #define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE) |
@@ -343,6 +353,7 @@ STACK_OF(type) \ | |||
343 | #define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st)) | 353 | #define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st)) |
344 | #define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st)) | 354 | #define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st)) |
345 | #define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st)) | 355 | #define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st)) |
356 | #define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st)) | ||
346 | 357 | ||
347 | #define sk_BIO_new(st) SKM_sk_new(BIO, (st)) | 358 | #define sk_BIO_new(st) SKM_sk_new(BIO, (st)) |
348 | #define sk_BIO_new_null() SKM_sk_new_null(BIO) | 359 | #define sk_BIO_new_null() SKM_sk_new_null(BIO) |
@@ -363,6 +374,7 @@ STACK_OF(type) \ | |||
363 | #define sk_BIO_shift(st) SKM_sk_shift(BIO, (st)) | 374 | #define sk_BIO_shift(st) SKM_sk_shift(BIO, (st)) |
364 | #define sk_BIO_pop(st) SKM_sk_pop(BIO, (st)) | 375 | #define sk_BIO_pop(st) SKM_sk_pop(BIO, (st)) |
365 | #define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) | 376 | #define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) |
377 | #define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st)) | ||
366 | 378 | ||
367 | #define sk_CONF_IMODULE_new(st) SKM_sk_new(CONF_IMODULE, (st)) | 379 | #define sk_CONF_IMODULE_new(st) SKM_sk_new(CONF_IMODULE, (st)) |
368 | #define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE) | 380 | #define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE) |
@@ -383,6 +395,7 @@ STACK_OF(type) \ | |||
383 | #define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st)) | 395 | #define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st)) |
384 | #define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st)) | 396 | #define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st)) |
385 | #define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st)) | 397 | #define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st)) |
398 | #define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st)) | ||
386 | 399 | ||
387 | #define sk_CONF_MODULE_new(st) SKM_sk_new(CONF_MODULE, (st)) | 400 | #define sk_CONF_MODULE_new(st) SKM_sk_new(CONF_MODULE, (st)) |
388 | #define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE) | 401 | #define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE) |
@@ -403,6 +416,7 @@ STACK_OF(type) \ | |||
403 | #define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st)) | 416 | #define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st)) |
404 | #define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st)) | 417 | #define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st)) |
405 | #define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st)) | 418 | #define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st)) |
419 | #define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st)) | ||
406 | 420 | ||
407 | #define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st)) | 421 | #define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st)) |
408 | #define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) | 422 | #define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) |
@@ -423,6 +437,7 @@ STACK_OF(type) \ | |||
423 | #define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st)) | 437 | #define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st)) |
424 | #define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st)) | 438 | #define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st)) |
425 | #define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) | 439 | #define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) |
440 | #define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st)) | ||
426 | 441 | ||
427 | #define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (st)) | 442 | #define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (st)) |
428 | #define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) | 443 | #define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) |
@@ -443,6 +458,7 @@ STACK_OF(type) \ | |||
443 | #define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st)) | 458 | #define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st)) |
444 | #define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st)) | 459 | #define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st)) |
445 | #define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) | 460 | #define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) |
461 | #define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st)) | ||
446 | 462 | ||
447 | #define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st)) | 463 | #define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st)) |
448 | #define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) | 464 | #define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) |
@@ -463,6 +479,7 @@ STACK_OF(type) \ | |||
463 | #define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st)) | 479 | #define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st)) |
464 | #define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st)) | 480 | #define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st)) |
465 | #define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) | 481 | #define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) |
482 | #define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st)) | ||
466 | 483 | ||
467 | #define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st)) | 484 | #define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st)) |
468 | #define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) | 485 | #define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) |
@@ -483,6 +500,7 @@ STACK_OF(type) \ | |||
483 | #define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st)) | 500 | #define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st)) |
484 | #define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st)) | 501 | #define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st)) |
485 | #define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) | 502 | #define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) |
503 | #define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st)) | ||
486 | 504 | ||
487 | #define sk_ENGINE_new(st) SKM_sk_new(ENGINE, (st)) | 505 | #define sk_ENGINE_new(st) SKM_sk_new(ENGINE, (st)) |
488 | #define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE) | 506 | #define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE) |
@@ -503,6 +521,7 @@ STACK_OF(type) \ | |||
503 | #define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st)) | 521 | #define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st)) |
504 | #define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st)) | 522 | #define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st)) |
505 | #define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st)) | 523 | #define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st)) |
524 | #define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st)) | ||
506 | 525 | ||
507 | #define sk_ENGINE_CLEANUP_ITEM_new(st) SKM_sk_new(ENGINE_CLEANUP_ITEM, (st)) | 526 | #define sk_ENGINE_CLEANUP_ITEM_new(st) SKM_sk_new(ENGINE_CLEANUP_ITEM, (st)) |
508 | #define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM) | 527 | #define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM) |
@@ -523,6 +542,7 @@ STACK_OF(type) \ | |||
523 | #define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st)) | 542 | #define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st)) |
524 | #define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st)) | 543 | #define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st)) |
525 | #define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st)) | 544 | #define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st)) |
545 | #define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st)) | ||
526 | 546 | ||
527 | #define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st)) | 547 | #define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st)) |
528 | #define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) | 548 | #define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) |
@@ -543,6 +563,7 @@ STACK_OF(type) \ | |||
543 | #define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st)) | 563 | #define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st)) |
544 | #define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st)) | 564 | #define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st)) |
545 | #define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) | 565 | #define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) |
566 | #define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st)) | ||
546 | 567 | ||
547 | #define sk_KRB5_APREQBODY_new(st) SKM_sk_new(KRB5_APREQBODY, (st)) | 568 | #define sk_KRB5_APREQBODY_new(st) SKM_sk_new(KRB5_APREQBODY, (st)) |
548 | #define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY) | 569 | #define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY) |
@@ -563,6 +584,7 @@ STACK_OF(type) \ | |||
563 | #define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st)) | 584 | #define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st)) |
564 | #define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st)) | 585 | #define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st)) |
565 | #define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st)) | 586 | #define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st)) |
587 | #define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st)) | ||
566 | 588 | ||
567 | #define sk_KRB5_AUTHDATA_new(st) SKM_sk_new(KRB5_AUTHDATA, (st)) | 589 | #define sk_KRB5_AUTHDATA_new(st) SKM_sk_new(KRB5_AUTHDATA, (st)) |
568 | #define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA) | 590 | #define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA) |
@@ -583,6 +605,7 @@ STACK_OF(type) \ | |||
583 | #define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st)) | 605 | #define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st)) |
584 | #define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st)) | 606 | #define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st)) |
585 | #define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st)) | 607 | #define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st)) |
608 | #define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st)) | ||
586 | 609 | ||
587 | #define sk_KRB5_AUTHENTBODY_new(st) SKM_sk_new(KRB5_AUTHENTBODY, (st)) | 610 | #define sk_KRB5_AUTHENTBODY_new(st) SKM_sk_new(KRB5_AUTHENTBODY, (st)) |
588 | #define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY) | 611 | #define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY) |
@@ -603,6 +626,7 @@ STACK_OF(type) \ | |||
603 | #define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st)) | 626 | #define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st)) |
604 | #define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st)) | 627 | #define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st)) |
605 | #define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st)) | 628 | #define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st)) |
629 | #define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st)) | ||
606 | 630 | ||
607 | #define sk_KRB5_CHECKSUM_new(st) SKM_sk_new(KRB5_CHECKSUM, (st)) | 631 | #define sk_KRB5_CHECKSUM_new(st) SKM_sk_new(KRB5_CHECKSUM, (st)) |
608 | #define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM) | 632 | #define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM) |
@@ -623,6 +647,7 @@ STACK_OF(type) \ | |||
623 | #define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st)) | 647 | #define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st)) |
624 | #define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st)) | 648 | #define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st)) |
625 | #define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st)) | 649 | #define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st)) |
650 | #define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st)) | ||
626 | 651 | ||
627 | #define sk_KRB5_ENCDATA_new(st) SKM_sk_new(KRB5_ENCDATA, (st)) | 652 | #define sk_KRB5_ENCDATA_new(st) SKM_sk_new(KRB5_ENCDATA, (st)) |
628 | #define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA) | 653 | #define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA) |
@@ -643,6 +668,7 @@ STACK_OF(type) \ | |||
643 | #define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st)) | 668 | #define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st)) |
644 | #define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st)) | 669 | #define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st)) |
645 | #define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st)) | 670 | #define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st)) |
671 | #define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st)) | ||
646 | 672 | ||
647 | #define sk_KRB5_ENCKEY_new(st) SKM_sk_new(KRB5_ENCKEY, (st)) | 673 | #define sk_KRB5_ENCKEY_new(st) SKM_sk_new(KRB5_ENCKEY, (st)) |
648 | #define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY) | 674 | #define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY) |
@@ -663,6 +689,7 @@ STACK_OF(type) \ | |||
663 | #define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st)) | 689 | #define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st)) |
664 | #define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st)) | 690 | #define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st)) |
665 | #define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st)) | 691 | #define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st)) |
692 | #define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st)) | ||
666 | 693 | ||
667 | #define sk_KRB5_PRINCNAME_new(st) SKM_sk_new(KRB5_PRINCNAME, (st)) | 694 | #define sk_KRB5_PRINCNAME_new(st) SKM_sk_new(KRB5_PRINCNAME, (st)) |
668 | #define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME) | 695 | #define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME) |
@@ -683,6 +710,7 @@ STACK_OF(type) \ | |||
683 | #define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st)) | 710 | #define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st)) |
684 | #define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st)) | 711 | #define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st)) |
685 | #define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st)) | 712 | #define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st)) |
713 | #define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st)) | ||
686 | 714 | ||
687 | #define sk_KRB5_TKTBODY_new(st) SKM_sk_new(KRB5_TKTBODY, (st)) | 715 | #define sk_KRB5_TKTBODY_new(st) SKM_sk_new(KRB5_TKTBODY, (st)) |
688 | #define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY) | 716 | #define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY) |
@@ -703,6 +731,7 @@ STACK_OF(type) \ | |||
703 | #define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st)) | 731 | #define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st)) |
704 | #define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st)) | 732 | #define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st)) |
705 | #define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st)) | 733 | #define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st)) |
734 | #define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st)) | ||
706 | 735 | ||
707 | #define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st)) | 736 | #define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st)) |
708 | #define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) | 737 | #define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) |
@@ -723,6 +752,7 @@ STACK_OF(type) \ | |||
723 | #define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) | 752 | #define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) |
724 | #define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) | 753 | #define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) |
725 | #define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) | 754 | #define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) |
755 | #define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st)) | ||
726 | 756 | ||
727 | #define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st)) | 757 | #define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st)) |
728 | #define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) | 758 | #define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) |
@@ -743,6 +773,7 @@ STACK_OF(type) \ | |||
743 | #define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) | 773 | #define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) |
744 | #define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) | 774 | #define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) |
745 | #define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) | 775 | #define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) |
776 | #define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st)) | ||
746 | 777 | ||
747 | #define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st)) | 778 | #define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st)) |
748 | #define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) | 779 | #define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) |
@@ -763,6 +794,7 @@ STACK_OF(type) \ | |||
763 | #define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st)) | 794 | #define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st)) |
764 | #define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st)) | 795 | #define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st)) |
765 | #define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) | 796 | #define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) |
797 | #define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st)) | ||
766 | 798 | ||
767 | #define sk_OCSP_CERTID_new(st) SKM_sk_new(OCSP_CERTID, (st)) | 799 | #define sk_OCSP_CERTID_new(st) SKM_sk_new(OCSP_CERTID, (st)) |
768 | #define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID) | 800 | #define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID) |
@@ -783,6 +815,7 @@ STACK_OF(type) \ | |||
783 | #define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st)) | 815 | #define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st)) |
784 | #define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st)) | 816 | #define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st)) |
785 | #define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st)) | 817 | #define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st)) |
818 | #define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st)) | ||
786 | 819 | ||
787 | #define sk_OCSP_ONEREQ_new(st) SKM_sk_new(OCSP_ONEREQ, (st)) | 820 | #define sk_OCSP_ONEREQ_new(st) SKM_sk_new(OCSP_ONEREQ, (st)) |
788 | #define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ) | 821 | #define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ) |
@@ -803,6 +836,7 @@ STACK_OF(type) \ | |||
803 | #define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st)) | 836 | #define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st)) |
804 | #define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st)) | 837 | #define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st)) |
805 | #define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st)) | 838 | #define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st)) |
839 | #define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st)) | ||
806 | 840 | ||
807 | #define sk_OCSP_SINGLERESP_new(st) SKM_sk_new(OCSP_SINGLERESP, (st)) | 841 | #define sk_OCSP_SINGLERESP_new(st) SKM_sk_new(OCSP_SINGLERESP, (st)) |
808 | #define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP) | 842 | #define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP) |
@@ -823,6 +857,7 @@ STACK_OF(type) \ | |||
823 | #define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st)) | 857 | #define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st)) |
824 | #define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st)) | 858 | #define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st)) |
825 | #define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st)) | 859 | #define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st)) |
860 | #define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st)) | ||
826 | 861 | ||
827 | #define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st)) | 862 | #define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st)) |
828 | #define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) | 863 | #define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) |
@@ -843,6 +878,7 @@ STACK_OF(type) \ | |||
843 | #define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st)) | 878 | #define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st)) |
844 | #define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st)) | 879 | #define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st)) |
845 | #define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) | 880 | #define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) |
881 | #define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st)) | ||
846 | 882 | ||
847 | #define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st)) | 883 | #define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st)) |
848 | #define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) | 884 | #define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) |
@@ -863,6 +899,7 @@ STACK_OF(type) \ | |||
863 | #define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st)) | 899 | #define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st)) |
864 | #define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st)) | 900 | #define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st)) |
865 | #define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) | 901 | #define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) |
902 | #define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st)) | ||
866 | 903 | ||
867 | #define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st)) | 904 | #define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st)) |
868 | #define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) | 905 | #define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) |
@@ -883,6 +920,7 @@ STACK_OF(type) \ | |||
883 | #define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st)) | 920 | #define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st)) |
884 | #define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st)) | 921 | #define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st)) |
885 | #define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) | 922 | #define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) |
923 | #define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st)) | ||
886 | 924 | ||
887 | #define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st)) | 925 | #define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st)) |
888 | #define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) | 926 | #define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) |
@@ -903,6 +941,7 @@ STACK_OF(type) \ | |||
903 | #define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st)) | 941 | #define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st)) |
904 | #define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st)) | 942 | #define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st)) |
905 | #define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) | 943 | #define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) |
944 | #define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st)) | ||
906 | 945 | ||
907 | #define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st)) | 946 | #define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st)) |
908 | #define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) | 947 | #define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) |
@@ -923,6 +962,7 @@ STACK_OF(type) \ | |||
923 | #define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st)) | 962 | #define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st)) |
924 | #define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st)) | 963 | #define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st)) |
925 | #define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) | 964 | #define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) |
965 | #define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st)) | ||
926 | 966 | ||
927 | #define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st)) | 967 | #define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st)) |
928 | #define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) | 968 | #define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) |
@@ -943,6 +983,7 @@ STACK_OF(type) \ | |||
943 | #define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st)) | 983 | #define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st)) |
944 | #define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st)) | 984 | #define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st)) |
945 | #define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) | 985 | #define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) |
986 | #define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st)) | ||
946 | 987 | ||
947 | #define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st)) | 988 | #define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st)) |
948 | #define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) | 989 | #define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) |
@@ -963,6 +1004,7 @@ STACK_OF(type) \ | |||
963 | #define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st)) | 1004 | #define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st)) |
964 | #define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st)) | 1005 | #define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st)) |
965 | #define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) | 1006 | #define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) |
1007 | #define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st)) | ||
966 | 1008 | ||
967 | #define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st)) | 1009 | #define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st)) |
968 | #define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) | 1010 | #define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) |
@@ -983,6 +1025,7 @@ STACK_OF(type) \ | |||
983 | #define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st)) | 1025 | #define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st)) |
984 | #define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st)) | 1026 | #define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st)) |
985 | #define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) | 1027 | #define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) |
1028 | #define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st)) | ||
986 | 1029 | ||
987 | #define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st)) | 1030 | #define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st)) |
988 | #define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) | 1031 | #define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) |
@@ -1003,6 +1046,7 @@ STACK_OF(type) \ | |||
1003 | #define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st)) | 1046 | #define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st)) |
1004 | #define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st)) | 1047 | #define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st)) |
1005 | #define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) | 1048 | #define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) |
1049 | #define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st)) | ||
1006 | 1050 | ||
1007 | #define sk_UI_STRING_new(st) SKM_sk_new(UI_STRING, (st)) | 1051 | #define sk_UI_STRING_new(st) SKM_sk_new(UI_STRING, (st)) |
1008 | #define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) | 1052 | #define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) |
@@ -1023,6 +1067,7 @@ STACK_OF(type) \ | |||
1023 | #define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st)) | 1067 | #define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st)) |
1024 | #define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st)) | 1068 | #define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st)) |
1025 | #define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st)) | 1069 | #define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st)) |
1070 | #define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st)) | ||
1026 | 1071 | ||
1027 | #define sk_X509_new(st) SKM_sk_new(X509, (st)) | 1072 | #define sk_X509_new(st) SKM_sk_new(X509, (st)) |
1028 | #define sk_X509_new_null() SKM_sk_new_null(X509) | 1073 | #define sk_X509_new_null() SKM_sk_new_null(X509) |
@@ -1043,6 +1088,7 @@ STACK_OF(type) \ | |||
1043 | #define sk_X509_shift(st) SKM_sk_shift(X509, (st)) | 1088 | #define sk_X509_shift(st) SKM_sk_shift(X509, (st)) |
1044 | #define sk_X509_pop(st) SKM_sk_pop(X509, (st)) | 1089 | #define sk_X509_pop(st) SKM_sk_pop(X509, (st)) |
1045 | #define sk_X509_sort(st) SKM_sk_sort(X509, (st)) | 1090 | #define sk_X509_sort(st) SKM_sk_sort(X509, (st)) |
1091 | #define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st)) | ||
1046 | 1092 | ||
1047 | #define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st)) | 1093 | #define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st)) |
1048 | #define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) | 1094 | #define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) |
@@ -1063,6 +1109,7 @@ STACK_OF(type) \ | |||
1063 | #define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st)) | 1109 | #define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st)) |
1064 | #define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st)) | 1110 | #define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st)) |
1065 | #define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) | 1111 | #define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) |
1112 | #define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st)) | ||
1066 | 1113 | ||
1067 | #define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st)) | 1114 | #define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st)) |
1068 | #define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) | 1115 | #define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) |
@@ -1083,6 +1130,7 @@ STACK_OF(type) \ | |||
1083 | #define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st)) | 1130 | #define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st)) |
1084 | #define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st)) | 1131 | #define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st)) |
1085 | #define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) | 1132 | #define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) |
1133 | #define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st)) | ||
1086 | 1134 | ||
1087 | #define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st)) | 1135 | #define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st)) |
1088 | #define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) | 1136 | #define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) |
@@ -1103,6 +1151,7 @@ STACK_OF(type) \ | |||
1103 | #define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st)) | 1151 | #define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st)) |
1104 | #define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st)) | 1152 | #define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st)) |
1105 | #define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) | 1153 | #define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) |
1154 | #define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st)) | ||
1106 | 1155 | ||
1107 | #define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st)) | 1156 | #define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st)) |
1108 | #define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) | 1157 | #define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) |
@@ -1123,6 +1172,7 @@ STACK_OF(type) \ | |||
1123 | #define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st)) | 1172 | #define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st)) |
1124 | #define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st)) | 1173 | #define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st)) |
1125 | #define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) | 1174 | #define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) |
1175 | #define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st)) | ||
1126 | 1176 | ||
1127 | #define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st)) | 1177 | #define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st)) |
1128 | #define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) | 1178 | #define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) |
@@ -1143,6 +1193,7 @@ STACK_OF(type) \ | |||
1143 | #define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st)) | 1193 | #define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st)) |
1144 | #define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st)) | 1194 | #define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st)) |
1145 | #define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) | 1195 | #define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) |
1196 | #define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st)) | ||
1146 | 1197 | ||
1147 | #define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st)) | 1198 | #define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st)) |
1148 | #define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) | 1199 | #define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) |
@@ -1163,6 +1214,7 @@ STACK_OF(type) \ | |||
1163 | #define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st)) | 1214 | #define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st)) |
1164 | #define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st)) | 1215 | #define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st)) |
1165 | #define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) | 1216 | #define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) |
1217 | #define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st)) | ||
1166 | 1218 | ||
1167 | #define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st)) | 1219 | #define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st)) |
1168 | #define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) | 1220 | #define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) |
@@ -1183,6 +1235,7 @@ STACK_OF(type) \ | |||
1183 | #define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st)) | 1235 | #define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st)) |
1184 | #define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st)) | 1236 | #define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st)) |
1185 | #define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) | 1237 | #define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) |
1238 | #define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st)) | ||
1186 | 1239 | ||
1187 | #define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st)) | 1240 | #define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st)) |
1188 | #define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) | 1241 | #define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) |
@@ -1203,6 +1256,7 @@ STACK_OF(type) \ | |||
1203 | #define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st)) | 1256 | #define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st)) |
1204 | #define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st)) | 1257 | #define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st)) |
1205 | #define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) | 1258 | #define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) |
1259 | #define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st)) | ||
1206 | 1260 | ||
1207 | #define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st)) | 1261 | #define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st)) |
1208 | #define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) | 1262 | #define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) |
@@ -1223,6 +1277,7 @@ STACK_OF(type) \ | |||
1223 | #define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st)) | 1277 | #define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st)) |
1224 | #define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st)) | 1278 | #define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st)) |
1225 | #define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) | 1279 | #define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) |
1280 | #define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st)) | ||
1226 | 1281 | ||
1227 | #define sk_X509_OBJECT_new(st) SKM_sk_new(X509_OBJECT, (st)) | 1282 | #define sk_X509_OBJECT_new(st) SKM_sk_new(X509_OBJECT, (st)) |
1228 | #define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT) | 1283 | #define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT) |
@@ -1243,6 +1298,7 @@ STACK_OF(type) \ | |||
1243 | #define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st)) | 1298 | #define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st)) |
1244 | #define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st)) | 1299 | #define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st)) |
1245 | #define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st)) | 1300 | #define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st)) |
1301 | #define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st)) | ||
1246 | 1302 | ||
1247 | #define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st)) | 1303 | #define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st)) |
1248 | #define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) | 1304 | #define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) |
@@ -1263,6 +1319,7 @@ STACK_OF(type) \ | |||
1263 | #define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st)) | 1319 | #define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st)) |
1264 | #define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st)) | 1320 | #define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st)) |
1265 | #define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) | 1321 | #define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) |
1322 | #define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st)) | ||
1266 | 1323 | ||
1267 | #define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st)) | 1324 | #define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st)) |
1268 | #define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) | 1325 | #define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) |
@@ -1283,6 +1340,7 @@ STACK_OF(type) \ | |||
1283 | #define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st)) | 1340 | #define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st)) |
1284 | #define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st)) | 1341 | #define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st)) |
1285 | #define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) | 1342 | #define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) |
1343 | #define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st)) | ||
1286 | 1344 | ||
1287 | #define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st)) | 1345 | #define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st)) |
1288 | #define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) | 1346 | #define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) |
@@ -1303,6 +1361,7 @@ STACK_OF(type) \ | |||
1303 | #define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st)) | 1361 | #define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st)) |
1304 | #define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st)) | 1362 | #define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st)) |
1305 | #define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) | 1363 | #define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) |
1364 | #define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st)) | ||
1306 | 1365 | ||
1307 | #define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | 1366 | #define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ |
1308 | SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) | 1367 | SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) |
diff --git a/src/lib/libssl/src/crypto/stack/stack.c b/src/lib/libssl/src/crypto/stack/stack.c index 2496f28a8c..c7173eb6ab 100644 --- a/src/lib/libssl/src/crypto/stack/stack.c +++ b/src/lib/libssl/src/crypto/stack/stack.c | |||
@@ -191,8 +191,7 @@ char *sk_delete(STACK *st, int loc) | |||
191 | char *ret; | 191 | char *ret; |
192 | int i,j; | 192 | int i,j; |
193 | 193 | ||
194 | if ((st == NULL) || (st->num == 0) || (loc < 0) | 194 | if(!st || (loc < 0) || (loc >= st->num)) return NULL; |
195 | || (loc >= st->num)) return(NULL); | ||
196 | 195 | ||
197 | ret=st->data[loc]; | 196 | ret=st->data[loc]; |
198 | if (loc != st->num-1) | 197 | if (loc != st->num-1) |
@@ -306,13 +305,13 @@ int sk_num(const STACK *st) | |||
306 | 305 | ||
307 | char *sk_value(const STACK *st, int i) | 306 | char *sk_value(const STACK *st, int i) |
308 | { | 307 | { |
309 | if(st == NULL) return NULL; | 308 | if(!st || (i < 0) || (i >= st->num)) return NULL; |
310 | return st->data[i]; | 309 | return st->data[i]; |
311 | } | 310 | } |
312 | 311 | ||
313 | char *sk_set(STACK *st, int i, char *value) | 312 | char *sk_set(STACK *st, int i, char *value) |
314 | { | 313 | { |
315 | if(st == NULL) return NULL; | 314 | if(!st || (i < 0) || (i >= st->num)) return NULL; |
316 | return (st->data[i] = value); | 315 | return (st->data[i] = value); |
317 | } | 316 | } |
318 | 317 | ||
@@ -332,3 +331,10 @@ void sk_sort(STACK *st) | |||
332 | st->sorted=1; | 331 | st->sorted=1; |
333 | } | 332 | } |
334 | } | 333 | } |
334 | |||
335 | int sk_is_sorted(const STACK *st) | ||
336 | { | ||
337 | if (!st) | ||
338 | return 1; | ||
339 | return st->sorted; | ||
340 | } | ||
diff --git a/src/lib/libssl/src/crypto/stack/stack.h b/src/lib/libssl/src/crypto/stack/stack.h index 8b436ca4b9..7570b85fe8 100644 --- a/src/lib/libssl/src/crypto/stack/stack.h +++ b/src/lib/libssl/src/crypto/stack/stack.h | |||
@@ -99,6 +99,7 @@ int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *, | |||
99 | (const char * const *, const char * const *); | 99 | (const char * const *, const char * const *); |
100 | STACK *sk_dup(STACK *st); | 100 | STACK *sk_dup(STACK *st); |
101 | void sk_sort(STACK *st); | 101 | void sk_sort(STACK *st); |
102 | int sk_is_sorted(const STACK *st); | ||
102 | 103 | ||
103 | #ifdef __cplusplus | 104 | #ifdef __cplusplus |
104 | } | 105 | } |
diff --git a/src/lib/libssl/src/crypto/x509/by_file.c b/src/lib/libssl/src/crypto/x509/by_file.c index b4b04183d0..a5e0d4aefa 100644 --- a/src/lib/libssl/src/crypto/x509/by_file.c +++ b/src/lib/libssl/src/crypto/x509/by_file.c | |||
@@ -150,7 +150,7 @@ int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type) | |||
150 | x=PEM_read_bio_X509_AUX(in,NULL,NULL,NULL); | 150 | x=PEM_read_bio_X509_AUX(in,NULL,NULL,NULL); |
151 | if (x == NULL) | 151 | if (x == NULL) |
152 | { | 152 | { |
153 | if ((ERR_GET_REASON(ERR_peek_error()) == | 153 | if ((ERR_GET_REASON(ERR_peek_last_error()) == |
154 | PEM_R_NO_START_LINE) && (count > 0)) | 154 | PEM_R_NO_START_LINE) && (count > 0)) |
155 | { | 155 | { |
156 | ERR_clear_error(); | 156 | ERR_clear_error(); |
@@ -217,7 +217,7 @@ int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) | |||
217 | x=PEM_read_bio_X509_CRL(in,NULL,NULL,NULL); | 217 | x=PEM_read_bio_X509_CRL(in,NULL,NULL,NULL); |
218 | if (x == NULL) | 218 | if (x == NULL) |
219 | { | 219 | { |
220 | if ((ERR_GET_REASON(ERR_peek_error()) == | 220 | if ((ERR_GET_REASON(ERR_peek_last_error()) == |
221 | PEM_R_NO_START_LINE) && (count > 0)) | 221 | PEM_R_NO_START_LINE) && (count > 0)) |
222 | { | 222 | { |
223 | ERR_clear_error(); | 223 | ERR_clear_error(); |
diff --git a/src/lib/libssl/src/crypto/x509/x509.h b/src/lib/libssl/src/crypto/x509/x509.h index 8d0c7e2e17..e8c1a59cf2 100644 --- a/src/lib/libssl/src/crypto/x509/x509.h +++ b/src/lib/libssl/src/crypto/x509/x509.h | |||
@@ -410,6 +410,7 @@ typedef struct X509_crl_info_st | |||
410 | ASN1_TIME *nextUpdate; | 410 | ASN1_TIME *nextUpdate; |
411 | STACK_OF(X509_REVOKED) *revoked; | 411 | STACK_OF(X509_REVOKED) *revoked; |
412 | STACK_OF(X509_EXTENSION) /* [0] */ *extensions; | 412 | STACK_OF(X509_EXTENSION) /* [0] */ *extensions; |
413 | ASN1_ENCODING enc; | ||
413 | } X509_CRL_INFO; | 414 | } X509_CRL_INFO; |
414 | 415 | ||
415 | struct X509_crl_st | 416 | struct X509_crl_st |
@@ -1037,18 +1038,18 @@ int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, | |||
1037 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, | 1038 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, |
1038 | unsigned char *bytes, int len, int loc, int set); | 1039 | unsigned char *bytes, int len, int loc, int set); |
1039 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, | 1040 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, |
1040 | char *field, int type, unsigned char *bytes, int len); | 1041 | const char *field, int type, const unsigned char *bytes, int len); |
1041 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, | 1042 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, |
1042 | int type,unsigned char *bytes, int len); | 1043 | int type,unsigned char *bytes, int len); |
1043 | int X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type, | 1044 | int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, |
1044 | unsigned char *bytes, int len, int loc, int set); | 1045 | const unsigned char *bytes, int len, int loc, int set); |
1045 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, | 1046 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, |
1046 | ASN1_OBJECT *obj, int type,unsigned char *bytes, | 1047 | ASN1_OBJECT *obj, int type,const unsigned char *bytes, |
1047 | int len); | 1048 | int len); |
1048 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, | 1049 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, |
1049 | ASN1_OBJECT *obj); | 1050 | ASN1_OBJECT *obj); |
1050 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, | 1051 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, |
1051 | unsigned char *bytes, int len); | 1052 | const unsigned char *bytes, int len); |
1052 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); | 1053 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); |
1053 | ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); | 1054 | ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); |
1054 | 1055 | ||
diff --git a/src/lib/libssl/src/crypto/x509/x509_cmp.c b/src/lib/libssl/src/crypto/x509/x509_cmp.c index f460102f49..030d0966fc 100644 --- a/src/lib/libssl/src/crypto/x509/x509_cmp.c +++ b/src/lib/libssl/src/crypto/x509/x509_cmp.c | |||
@@ -254,33 +254,49 @@ static int nocase_spacenorm_cmp(const ASN1_STRING *a, const ASN1_STRING *b) | |||
254 | return 0; | 254 | return 0; |
255 | } | 255 | } |
256 | 256 | ||
257 | static int asn1_string_memcmp(ASN1_STRING *a, ASN1_STRING *b) | ||
258 | { | ||
259 | int j; | ||
260 | j = a->length - b->length; | ||
261 | if (j) | ||
262 | return j; | ||
263 | return memcmp(a->data, b->data, a->length); | ||
264 | } | ||
265 | |||
266 | #define STR_TYPE_CMP (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_UTF8STRING) | ||
267 | |||
257 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b) | 268 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b) |
258 | { | 269 | { |
259 | int i,j; | 270 | int i,j; |
260 | X509_NAME_ENTRY *na,*nb; | 271 | X509_NAME_ENTRY *na,*nb; |
261 | 272 | ||
262 | if (sk_X509_NAME_ENTRY_num(a->entries) | 273 | unsigned long nabit, nbbit; |
263 | != sk_X509_NAME_ENTRY_num(b->entries)) | 274 | |
264 | return sk_X509_NAME_ENTRY_num(a->entries) | 275 | j = sk_X509_NAME_ENTRY_num(a->entries) |
265 | -sk_X509_NAME_ENTRY_num(b->entries); | 276 | - sk_X509_NAME_ENTRY_num(b->entries); |
277 | if (j) | ||
278 | return j; | ||
266 | for (i=sk_X509_NAME_ENTRY_num(a->entries)-1; i>=0; i--) | 279 | for (i=sk_X509_NAME_ENTRY_num(a->entries)-1; i>=0; i--) |
267 | { | 280 | { |
268 | na=sk_X509_NAME_ENTRY_value(a->entries,i); | 281 | na=sk_X509_NAME_ENTRY_value(a->entries,i); |
269 | nb=sk_X509_NAME_ENTRY_value(b->entries,i); | 282 | nb=sk_X509_NAME_ENTRY_value(b->entries,i); |
270 | j=na->value->type-nb->value->type; | 283 | j=na->value->type-nb->value->type; |
271 | if (j) return(j); | 284 | if (j) |
272 | if (na->value->type == V_ASN1_PRINTABLESTRING) | 285 | { |
286 | nabit = ASN1_tag2bit(na->value->type); | ||
287 | nbbit = ASN1_tag2bit(nb->value->type); | ||
288 | if (!(nabit & STR_TYPE_CMP) || | ||
289 | !(nbbit & STR_TYPE_CMP)) | ||
290 | return j; | ||
291 | j = asn1_string_memcmp(na->value, nb->value); | ||
292 | } | ||
293 | else if (na->value->type == V_ASN1_PRINTABLESTRING) | ||
273 | j=nocase_spacenorm_cmp(na->value, nb->value); | 294 | j=nocase_spacenorm_cmp(na->value, nb->value); |
274 | else if (na->value->type == V_ASN1_IA5STRING | 295 | else if (na->value->type == V_ASN1_IA5STRING |
275 | && OBJ_obj2nid(na->object) == NID_pkcs9_emailAddress) | 296 | && OBJ_obj2nid(na->object) == NID_pkcs9_emailAddress) |
276 | j=nocase_cmp(na->value, nb->value); | 297 | j=nocase_cmp(na->value, nb->value); |
277 | else | 298 | else |
278 | { | 299 | j = asn1_string_memcmp(na->value, nb->value); |
279 | j=na->value->length-nb->value->length; | ||
280 | if (j) return(j); | ||
281 | j=memcmp(na->value->data,nb->value->data, | ||
282 | na->value->length); | ||
283 | } | ||
284 | if (j) return(j); | 300 | if (j) return(j); |
285 | j=na->set-nb->set; | 301 | j=na->set-nb->set; |
286 | if (j) return(j); | 302 | if (j) return(j); |
@@ -306,10 +322,16 @@ unsigned long X509_NAME_hash(X509_NAME *x) | |||
306 | { | 322 | { |
307 | unsigned long ret=0; | 323 | unsigned long ret=0; |
308 | unsigned char md[16]; | 324 | unsigned char md[16]; |
325 | EVP_MD_CTX md_ctx; | ||
309 | 326 | ||
310 | /* Make sure X509_NAME structure contains valid cached encoding */ | 327 | /* Make sure X509_NAME structure contains valid cached encoding */ |
311 | i2d_X509_NAME(x,NULL); | 328 | i2d_X509_NAME(x,NULL); |
312 | EVP_Digest(x->bytes->data, x->bytes->length, md, NULL, EVP_md5(), NULL); | 329 | EVP_MD_CTX_init(&md_ctx); |
330 | EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
331 | EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL); | ||
332 | EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length); | ||
333 | EVP_DigestFinal_ex(&md_ctx,md,NULL); | ||
334 | EVP_MD_CTX_cleanup(&md_ctx); | ||
313 | 335 | ||
314 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| | 336 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| |
315 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) | 337 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) |
diff --git a/src/lib/libssl/src/crypto/x509/x509_r2x.c b/src/lib/libssl/src/crypto/x509/x509_r2x.c index db051033d9..fb8a78dabe 100644 --- a/src/lib/libssl/src/crypto/x509/x509_r2x.c +++ b/src/lib/libssl/src/crypto/x509/x509_r2x.c | |||
@@ -92,8 +92,10 @@ X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey) | |||
92 | X509_set_subject_name(ret,X509_NAME_dup(xn)); | 92 | X509_set_subject_name(ret,X509_NAME_dup(xn)); |
93 | X509_set_issuer_name(ret,X509_NAME_dup(xn)); | 93 | X509_set_issuer_name(ret,X509_NAME_dup(xn)); |
94 | 94 | ||
95 | X509_gmtime_adj(xi->validity->notBefore,0); | 95 | if (X509_gmtime_adj(xi->validity->notBefore,0) == NULL) |
96 | X509_gmtime_adj(xi->validity->notAfter,(long)60*60*24*days); | 96 | goto err; |
97 | if (X509_gmtime_adj(xi->validity->notAfter,(long)60*60*24*days) == NULL) | ||
98 | goto err; | ||
97 | 99 | ||
98 | X509_set_pubkey(ret,X509_REQ_get_pubkey(r)); | 100 | X509_set_pubkey(ret,X509_REQ_get_pubkey(r)); |
99 | 101 | ||
diff --git a/src/lib/libssl/src/crypto/x509/x509_req.c b/src/lib/libssl/src/crypto/x509/x509_req.c index 0affa3bf30..59fc6ca548 100644 --- a/src/lib/libssl/src/crypto/x509/x509_req.c +++ b/src/lib/libssl/src/crypto/x509/x509_req.c | |||
@@ -118,7 +118,7 @@ EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req) | |||
118 | * used and there may be more: so the list is configurable. | 118 | * used and there may be more: so the list is configurable. |
119 | */ | 119 | */ |
120 | 120 | ||
121 | static int ext_nid_list[] = { NID_ms_ext_req, NID_ext_req, NID_undef}; | 121 | static int ext_nid_list[] = { NID_ext_req, NID_ms_ext_req, NID_undef}; |
122 | 122 | ||
123 | static int *ext_nids = ext_nid_list; | 123 | static int *ext_nids = ext_nid_list; |
124 | 124 | ||
@@ -143,32 +143,33 @@ void X509_REQ_set_extension_nids(int *nids) | |||
143 | } | 143 | } |
144 | 144 | ||
145 | STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req) | 145 | STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req) |
146 | { | 146 | { |
147 | X509_ATTRIBUTE *attr; | 147 | X509_ATTRIBUTE *attr; |
148 | STACK_OF(X509_ATTRIBUTE) *sk; | ||
149 | ASN1_TYPE *ext = NULL; | 148 | ASN1_TYPE *ext = NULL; |
150 | int i; | 149 | int idx, *pnid; |
151 | unsigned char *p; | 150 | unsigned char *p; |
152 | if ((req == NULL) || (req->req_info == NULL)) | 151 | |
152 | if ((req == NULL) || (req->req_info == NULL) || !ext_nids) | ||
153 | return(NULL); | 153 | return(NULL); |
154 | sk=req->req_info->attributes; | 154 | for (pnid = ext_nids; *pnid != NID_undef; pnid++) |
155 | if (!sk) return NULL; | 155 | { |
156 | for(i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) { | 156 | idx = X509_REQ_get_attr_by_NID(req, *pnid, -1); |
157 | attr = sk_X509_ATTRIBUTE_value(sk, i); | 157 | if (idx == -1) |
158 | if(X509_REQ_extension_nid(OBJ_obj2nid(attr->object))) { | 158 | continue; |
159 | if(attr->single) ext = attr->value.single; | 159 | attr = X509_REQ_get_attr(req, idx); |
160 | else if(sk_ASN1_TYPE_num(attr->value.set)) | 160 | if(attr->single) ext = attr->value.single; |
161 | ext = sk_ASN1_TYPE_value(attr->value.set, 0); | 161 | else if(sk_ASN1_TYPE_num(attr->value.set)) |
162 | break; | 162 | ext = sk_ASN1_TYPE_value(attr->value.set, 0); |
163 | break; | ||
163 | } | 164 | } |
164 | } | 165 | if(!ext || (ext->type != V_ASN1_SEQUENCE)) |
165 | if(!ext || (ext->type != V_ASN1_SEQUENCE)) return NULL; | 166 | return NULL; |
166 | p = ext->value.sequence->data; | 167 | p = ext->value.sequence->data; |
167 | return d2i_ASN1_SET_OF_X509_EXTENSION(NULL, &p, | 168 | return d2i_ASN1_SET_OF_X509_EXTENSION(NULL, &p, |
168 | ext->value.sequence->length, | 169 | ext->value.sequence->length, |
169 | d2i_X509_EXTENSION, X509_EXTENSION_free, | 170 | d2i_X509_EXTENSION, X509_EXTENSION_free, |
170 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); | 171 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); |
171 | } | 172 | } |
172 | 173 | ||
173 | /* Add a STACK_OF extensions to a certificate request: allow alternative OIDs | 174 | /* Add a STACK_OF extensions to a certificate request: allow alternative OIDs |
174 | * in case we want to create a non standard one. | 175 | * in case we want to create a non standard one. |
diff --git a/src/lib/libssl/src/crypto/x509/x509_txt.c b/src/lib/libssl/src/crypto/x509/x509_txt.c index e31ebc6741..f19e66a238 100644 --- a/src/lib/libssl/src/crypto/x509/x509_txt.c +++ b/src/lib/libssl/src/crypto/x509/x509_txt.c | |||
@@ -122,8 +122,14 @@ const char *X509_verify_cert_error_string(long n) | |||
122 | return("certificate revoked"); | 122 | return("certificate revoked"); |
123 | case X509_V_ERR_INVALID_CA: | 123 | case X509_V_ERR_INVALID_CA: |
124 | return ("invalid CA certificate"); | 124 | return ("invalid CA certificate"); |
125 | case X509_V_ERR_INVALID_NON_CA: | ||
126 | return ("invalid non-CA certificate (has CA markings)"); | ||
125 | case X509_V_ERR_PATH_LENGTH_EXCEEDED: | 127 | case X509_V_ERR_PATH_LENGTH_EXCEEDED: |
126 | return ("path length constraint exceeded"); | 128 | return ("path length constraint exceeded"); |
129 | case X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED: | ||
130 | return("proxy path length constraint exceeded"); | ||
131 | case X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED: | ||
132 | return("proxy cerificates not allowed, please set the appropriate flag"); | ||
127 | case X509_V_ERR_INVALID_PURPOSE: | 133 | case X509_V_ERR_INVALID_PURPOSE: |
128 | return ("unsupported certificate purpose"); | 134 | return ("unsupported certificate purpose"); |
129 | case X509_V_ERR_CERT_UNTRUSTED: | 135 | case X509_V_ERR_CERT_UNTRUSTED: |
@@ -140,19 +146,16 @@ const char *X509_verify_cert_error_string(long n) | |||
140 | return("authority and issuer serial number mismatch"); | 146 | return("authority and issuer serial number mismatch"); |
141 | case X509_V_ERR_KEYUSAGE_NO_CERTSIGN: | 147 | case X509_V_ERR_KEYUSAGE_NO_CERTSIGN: |
142 | return("key usage does not include certificate signing"); | 148 | return("key usage does not include certificate signing"); |
143 | |||
144 | case X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER: | 149 | case X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER: |
145 | return("unable to get CRL issuer certificate"); | 150 | return("unable to get CRL issuer certificate"); |
146 | |||
147 | case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION: | 151 | case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION: |
148 | return("unhandled critical extension"); | 152 | return("unhandled critical extension"); |
149 | |||
150 | case X509_V_ERR_KEYUSAGE_NO_CRL_SIGN: | 153 | case X509_V_ERR_KEYUSAGE_NO_CRL_SIGN: |
151 | return("key usage does not include CRL signing"); | 154 | return("key usage does not include CRL signing"); |
152 | 155 | case X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE: | |
156 | return("key usage does not include digital signature"); | ||
153 | case X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION: | 157 | case X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION: |
154 | return("unhandled critical CRL extension"); | 158 | return("unhandled critical CRL extension"); |
155 | |||
156 | default: | 159 | default: |
157 | BIO_snprintf(buf,sizeof buf,"error number %ld",n); | 160 | BIO_snprintf(buf,sizeof buf,"error number %ld",n); |
158 | return(buf); | 161 | return(buf); |
diff --git a/src/lib/libssl/src/crypto/x509/x509_vfy.c b/src/lib/libssl/src/crypto/x509/x509_vfy.c index 2e4d0b823a..e43c861ee7 100644 --- a/src/lib/libssl/src/crypto/x509/x509_vfy.c +++ b/src/lib/libssl/src/crypto/x509/x509_vfy.c | |||
@@ -73,7 +73,7 @@ | |||
73 | static int null_callback(int ok,X509_STORE_CTX *e); | 73 | static int null_callback(int ok,X509_STORE_CTX *e); |
74 | static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); | 74 | static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); |
75 | static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x); | 75 | static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x); |
76 | static int check_chain_purpose(X509_STORE_CTX *ctx); | 76 | static int check_chain_extensions(X509_STORE_CTX *ctx); |
77 | static int check_trust(X509_STORE_CTX *ctx); | 77 | static int check_trust(X509_STORE_CTX *ctx); |
78 | static int check_revocation(X509_STORE_CTX *ctx); | 78 | static int check_revocation(X509_STORE_CTX *ctx); |
79 | static int check_cert(X509_STORE_CTX *ctx); | 79 | static int check_cert(X509_STORE_CTX *ctx); |
@@ -281,7 +281,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx) | |||
281 | } | 281 | } |
282 | 282 | ||
283 | /* We have the chain complete: now we need to check its purpose */ | 283 | /* We have the chain complete: now we need to check its purpose */ |
284 | if (ctx->purpose > 0) ok = check_chain_purpose(ctx); | 284 | ok = check_chain_extensions(ctx); |
285 | 285 | ||
286 | if (!ok) goto end; | 286 | if (!ok) goto end; |
287 | 287 | ||
@@ -365,21 +365,39 @@ static int get_issuer_sk(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) | |||
365 | else | 365 | else |
366 | return 0; | 366 | return 0; |
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | /* Check a certificate chains extensions for consistency | 370 | /* Check a certificate chains extensions for consistency |
371 | * with the supplied purpose | 371 | * with the supplied purpose |
372 | */ | 372 | */ |
373 | 373 | ||
374 | static int check_chain_purpose(X509_STORE_CTX *ctx) | 374 | static int check_chain_extensions(X509_STORE_CTX *ctx) |
375 | { | 375 | { |
376 | #ifdef OPENSSL_NO_CHAIN_VERIFY | 376 | #ifdef OPENSSL_NO_CHAIN_VERIFY |
377 | return 1; | 377 | return 1; |
378 | #else | 378 | #else |
379 | int i, ok=0; | 379 | int i, ok=0, must_be_ca; |
380 | X509 *x; | 380 | X509 *x; |
381 | int (*cb)(); | 381 | int (*cb)(); |
382 | int proxy_path_length = 0; | ||
383 | int allow_proxy_certs = !!(ctx->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); | ||
382 | cb=ctx->verify_cb; | 384 | cb=ctx->verify_cb; |
385 | |||
386 | /* must_be_ca can have 1 of 3 values: | ||
387 | -1: we accept both CA and non-CA certificates, to allow direct | ||
388 | use of self-signed certificates (which are marked as CA). | ||
389 | 0: we only accept non-CA certificates. This is currently not | ||
390 | used, but the possibility is present for future extensions. | ||
391 | 1: we only accept CA certificates. This is currently used for | ||
392 | all certificates in the chain except the leaf certificate. | ||
393 | */ | ||
394 | must_be_ca = -1; | ||
395 | |||
396 | /* A hack to keep people who don't want to modify their software | ||
397 | happy */ | ||
398 | if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) | ||
399 | allow_proxy_certs = 1; | ||
400 | |||
383 | /* Check all untrusted certificates */ | 401 | /* Check all untrusted certificates */ |
384 | for (i = 0; i < ctx->last_untrusted; i++) | 402 | for (i = 0; i < ctx->last_untrusted; i++) |
385 | { | 403 | { |
@@ -394,23 +412,73 @@ static int check_chain_purpose(X509_STORE_CTX *ctx) | |||
394 | ok=cb(0,ctx); | 412 | ok=cb(0,ctx); |
395 | if (!ok) goto end; | 413 | if (!ok) goto end; |
396 | } | 414 | } |
397 | ret = X509_check_purpose(x, ctx->purpose, i); | 415 | if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) |
398 | if ((ret == 0) | ||
399 | || ((ctx->flags & X509_V_FLAG_X509_STRICT) | ||
400 | && (ret != 1))) | ||
401 | { | 416 | { |
402 | if (i) | 417 | ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; |
418 | ctx->error_depth = i; | ||
419 | ctx->current_cert = x; | ||
420 | ok=cb(0,ctx); | ||
421 | if (!ok) goto end; | ||
422 | } | ||
423 | ret = X509_check_ca(x); | ||
424 | switch(must_be_ca) | ||
425 | { | ||
426 | case -1: | ||
427 | if ((ctx->flags & X509_V_FLAG_X509_STRICT) | ||
428 | && (ret != 1) && (ret != 0)) | ||
429 | { | ||
430 | ret = 0; | ||
403 | ctx->error = X509_V_ERR_INVALID_CA; | 431 | ctx->error = X509_V_ERR_INVALID_CA; |
432 | } | ||
404 | else | 433 | else |
405 | ctx->error = X509_V_ERR_INVALID_PURPOSE; | 434 | ret = 1; |
435 | break; | ||
436 | case 0: | ||
437 | if (ret != 0) | ||
438 | { | ||
439 | ret = 0; | ||
440 | ctx->error = X509_V_ERR_INVALID_NON_CA; | ||
441 | } | ||
442 | else | ||
443 | ret = 1; | ||
444 | break; | ||
445 | default: | ||
446 | if ((ret == 0) | ||
447 | || ((ctx->flags & X509_V_FLAG_X509_STRICT) | ||
448 | && (ret != 1))) | ||
449 | { | ||
450 | ret = 0; | ||
451 | ctx->error = X509_V_ERR_INVALID_CA; | ||
452 | } | ||
453 | else | ||
454 | ret = 1; | ||
455 | break; | ||
456 | } | ||
457 | if (ret == 0) | ||
458 | { | ||
406 | ctx->error_depth = i; | 459 | ctx->error_depth = i; |
407 | ctx->current_cert = x; | 460 | ctx->current_cert = x; |
408 | ok=cb(0,ctx); | 461 | ok=cb(0,ctx); |
409 | if (!ok) goto end; | 462 | if (!ok) goto end; |
410 | } | 463 | } |
464 | if (ctx->purpose > 0) | ||
465 | { | ||
466 | ret = X509_check_purpose(x, ctx->purpose, | ||
467 | must_be_ca > 0); | ||
468 | if ((ret == 0) | ||
469 | || ((ctx->flags & X509_V_FLAG_X509_STRICT) | ||
470 | && (ret != 1))) | ||
471 | { | ||
472 | ctx->error = X509_V_ERR_INVALID_PURPOSE; | ||
473 | ctx->error_depth = i; | ||
474 | ctx->current_cert = x; | ||
475 | ok=cb(0,ctx); | ||
476 | if (!ok) goto end; | ||
477 | } | ||
478 | } | ||
411 | /* Check pathlen */ | 479 | /* Check pathlen */ |
412 | if ((i > 1) && (x->ex_pathlen != -1) | 480 | if ((i > 1) && (x->ex_pathlen != -1) |
413 | && (i > (x->ex_pathlen + 1))) | 481 | && (i > (x->ex_pathlen + proxy_path_length + 1))) |
414 | { | 482 | { |
415 | ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; | 483 | ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; |
416 | ctx->error_depth = i; | 484 | ctx->error_depth = i; |
@@ -418,6 +486,32 @@ static int check_chain_purpose(X509_STORE_CTX *ctx) | |||
418 | ok=cb(0,ctx); | 486 | ok=cb(0,ctx); |
419 | if (!ok) goto end; | 487 | if (!ok) goto end; |
420 | } | 488 | } |
489 | /* If this certificate is a proxy certificate, the next | ||
490 | certificate must be another proxy certificate or a EE | ||
491 | certificate. If not, the next certificate must be a | ||
492 | CA certificate. */ | ||
493 | if (x->ex_flags & EXFLAG_PROXY) | ||
494 | { | ||
495 | PROXY_CERT_INFO_EXTENSION *pci = | ||
496 | X509_get_ext_d2i(x, NID_proxyCertInfo, | ||
497 | NULL, NULL); | ||
498 | if (pci->pcPathLengthConstraint && | ||
499 | ASN1_INTEGER_get(pci->pcPathLengthConstraint) | ||
500 | < i) | ||
501 | { | ||
502 | PROXY_CERT_INFO_EXTENSION_free(pci); | ||
503 | ctx->error = X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED; | ||
504 | ctx->error_depth = i; | ||
505 | ctx->current_cert = x; | ||
506 | ok=cb(0,ctx); | ||
507 | if (!ok) goto end; | ||
508 | } | ||
509 | PROXY_CERT_INFO_EXTENSION_free(pci); | ||
510 | proxy_path_length++; | ||
511 | must_be_ca = 0; | ||
512 | } | ||
513 | else | ||
514 | must_be_ca = 1; | ||
421 | } | 515 | } |
422 | ok = 1; | 516 | ok = 1; |
423 | end: | 517 | end: |
@@ -627,6 +721,15 @@ static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x) | |||
627 | X509_EXTENSION *ext; | 721 | X509_EXTENSION *ext; |
628 | /* Look for serial number of certificate in CRL */ | 722 | /* Look for serial number of certificate in CRL */ |
629 | rtmp.serialNumber = X509_get_serialNumber(x); | 723 | rtmp.serialNumber = X509_get_serialNumber(x); |
724 | /* Sort revoked into serial number order if not already sorted. | ||
725 | * Do this under a lock to avoid race condition. | ||
726 | */ | ||
727 | if (!sk_X509_REVOKED_is_sorted(crl->crl->revoked)) | ||
728 | { | ||
729 | CRYPTO_w_lock(CRYPTO_LOCK_X509_CRL); | ||
730 | sk_X509_REVOKED_sort(crl->crl->revoked); | ||
731 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_CRL); | ||
732 | } | ||
630 | idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp); | 733 | idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp); |
631 | /* If found assume revoked: want something cleverer than | 734 | /* If found assume revoked: want something cleverer than |
632 | * this to handle entry extensions in V2 CRLs. | 735 | * this to handle entry extensions in V2 CRLs. |
@@ -772,6 +875,7 @@ static int internal_verify(X509_STORE_CTX *ctx) | |||
772 | } | 875 | } |
773 | 876 | ||
774 | /* The last error (if any) is still in the error value */ | 877 | /* The last error (if any) is still in the error value */ |
878 | ctx->current_issuer=xi; | ||
775 | ctx->current_cert=xs; | 879 | ctx->current_cert=xs; |
776 | ok=(*cb)(1,ctx); | 880 | ok=(*cb)(1,ctx); |
777 | if (!ok) goto end; | 881 | if (!ok) goto end; |
@@ -851,7 +955,8 @@ int X509_cmp_time(ASN1_TIME *ctm, time_t *cmp_time) | |||
851 | atm.length=sizeof(buff2); | 955 | atm.length=sizeof(buff2); |
852 | atm.data=(unsigned char *)buff2; | 956 | atm.data=(unsigned char *)buff2; |
853 | 957 | ||
854 | X509_time_adj(&atm,-offset*60, cmp_time); | 958 | if (X509_time_adj(&atm,-offset*60, cmp_time) == NULL) |
959 | return 0; | ||
855 | 960 | ||
856 | if (ctm->type == V_ASN1_UTCTIME) | 961 | if (ctm->type == V_ASN1_UTCTIME) |
857 | { | 962 | { |
diff --git a/src/lib/libssl/src/crypto/x509/x509_vfy.h b/src/lib/libssl/src/crypto/x509/x509_vfy.h index 198495884c..7fd1f0bc4d 100644 --- a/src/lib/libssl/src/crypto/x509/x509_vfy.h +++ b/src/lib/libssl/src/crypto/x509/x509_vfy.h | |||
@@ -276,7 +276,7 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
276 | #define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 | 276 | #define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 |
277 | #define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 | 277 | #define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 |
278 | #define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 | 278 | #define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 |
279 | #define X509_V_ERR_CERT_NOT_YET_VALID 9 | 279 | #define X509_V_ERR_CERT_NOT_YET_VALID 9 |
280 | #define X509_V_ERR_CERT_HAS_EXPIRED 10 | 280 | #define X509_V_ERR_CERT_HAS_EXPIRED 10 |
281 | #define X509_V_ERR_CRL_NOT_YET_VALID 11 | 281 | #define X509_V_ERR_CRL_NOT_YET_VALID 11 |
282 | #define X509_V_ERR_CRL_HAS_EXPIRED 12 | 282 | #define X509_V_ERR_CRL_HAS_EXPIRED 12 |
@@ -306,6 +306,10 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
306 | #define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 | 306 | #define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 |
307 | #define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 | 307 | #define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 |
308 | #define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 | 308 | #define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 |
309 | #define X509_V_ERR_INVALID_NON_CA 37 | ||
310 | #define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 | ||
311 | #define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 | ||
312 | #define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 | ||
309 | 313 | ||
310 | /* The application is not happy */ | 314 | /* The application is not happy */ |
311 | #define X509_V_ERR_APPLICATION_VERIFICATION 50 | 315 | #define X509_V_ERR_APPLICATION_VERIFICATION 50 |
@@ -324,6 +328,8 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
324 | #define X509_V_FLAG_IGNORE_CRITICAL 0x10 | 328 | #define X509_V_FLAG_IGNORE_CRITICAL 0x10 |
325 | /* Disable workarounds for broken certificates */ | 329 | /* Disable workarounds for broken certificates */ |
326 | #define X509_V_FLAG_X509_STRICT 0x20 | 330 | #define X509_V_FLAG_X509_STRICT 0x20 |
331 | /* Enable proxy certificate validation */ | ||
332 | #define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 | ||
327 | 333 | ||
328 | int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, | 334 | int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, |
329 | X509_NAME *name); | 335 | X509_NAME *name); |
diff --git a/src/lib/libssl/src/crypto/x509/x509cset.c b/src/lib/libssl/src/crypto/x509/x509cset.c index 6cac440ea9..9d1646d5c8 100644 --- a/src/lib/libssl/src/crypto/x509/x509cset.c +++ b/src/lib/libssl/src/crypto/x509/x509cset.c | |||
@@ -129,6 +129,7 @@ int X509_CRL_sort(X509_CRL *c) | |||
129 | r=sk_X509_REVOKED_value(c->crl->revoked,i); | 129 | r=sk_X509_REVOKED_value(c->crl->revoked,i); |
130 | r->sequence=i; | 130 | r->sequence=i; |
131 | } | 131 | } |
132 | c->crl->enc.modified = 1; | ||
132 | return 1; | 133 | return 1; |
133 | } | 134 | } |
134 | 135 | ||
diff --git a/src/lib/libssl/src/crypto/x509/x509name.c b/src/lib/libssl/src/crypto/x509/x509name.c index 4c20e03ece..068abfe5f0 100644 --- a/src/lib/libssl/src/crypto/x509/x509name.c +++ b/src/lib/libssl/src/crypto/x509/x509name.c | |||
@@ -195,8 +195,8 @@ int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, | |||
195 | return ret; | 195 | return ret; |
196 | } | 196 | } |
197 | 197 | ||
198 | int X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type, | 198 | int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, |
199 | unsigned char *bytes, int len, int loc, int set) | 199 | const unsigned char *bytes, int len, int loc, int set) |
200 | { | 200 | { |
201 | X509_NAME_ENTRY *ne; | 201 | X509_NAME_ENTRY *ne; |
202 | int ret; | 202 | int ret; |
@@ -273,7 +273,7 @@ err: | |||
273 | } | 273 | } |
274 | 274 | ||
275 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, | 275 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, |
276 | char *field, int type, unsigned char *bytes, int len) | 276 | const char *field, int type, const unsigned char *bytes, int len) |
277 | { | 277 | { |
278 | ASN1_OBJECT *obj; | 278 | ASN1_OBJECT *obj; |
279 | X509_NAME_ENTRY *nentry; | 279 | X509_NAME_ENTRY *nentry; |
@@ -309,7 +309,7 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, | |||
309 | } | 309 | } |
310 | 310 | ||
311 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, | 311 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, |
312 | ASN1_OBJECT *obj, int type, unsigned char *bytes, int len) | 312 | ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len) |
313 | { | 313 | { |
314 | X509_NAME_ENTRY *ret; | 314 | X509_NAME_ENTRY *ret; |
315 | 315 | ||
@@ -347,7 +347,7 @@ int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj) | |||
347 | } | 347 | } |
348 | 348 | ||
349 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, | 349 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, |
350 | unsigned char *bytes, int len) | 350 | const unsigned char *bytes, int len) |
351 | { | 351 | { |
352 | int i; | 352 | int i; |
353 | 353 | ||
diff --git a/src/lib/libssl/src/crypto/x509/x_all.c b/src/lib/libssl/src/crypto/x509/x_all.c index fb5015cd4d..ac6dea493a 100644 --- a/src/lib/libssl/src/crypto/x509/x_all.c +++ b/src/lib/libssl/src/crypto/x509/x_all.c | |||
@@ -103,6 +103,7 @@ int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md) | |||
103 | 103 | ||
104 | int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md) | 104 | int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md) |
105 | { | 105 | { |
106 | x->crl->enc.modified = 1; | ||
106 | return(ASN1_item_sign(ASN1_ITEM_rptr(X509_CRL_INFO),x->crl->sig_alg, | 107 | return(ASN1_item_sign(ASN1_ITEM_rptr(X509_CRL_INFO),x->crl->sig_alg, |
107 | x->sig_alg, x->signature, x->crl,pkey,md)); | 108 | x->sig_alg, x->signature, x->crl,pkey,md)); |
108 | } | 109 | } |
diff --git a/src/lib/libssl/src/crypto/x509v3/ext_dat.h b/src/lib/libssl/src/crypto/x509v3/ext_dat.h index 5442480595..d8328ac468 100644 --- a/src/lib/libssl/src/crypto/x509v3/ext_dat.h +++ b/src/lib/libssl/src/crypto/x509v3/ext_dat.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -60,10 +60,11 @@ | |||
60 | extern X509V3_EXT_METHOD v3_bcons, v3_nscert, v3_key_usage, v3_ext_ku; | 60 | extern X509V3_EXT_METHOD v3_bcons, v3_nscert, v3_key_usage, v3_ext_ku; |
61 | extern X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo; | 61 | extern X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo; |
62 | extern X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_id; | 62 | extern X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_id; |
63 | extern X509V3_EXT_METHOD v3_crl_num, v3_crl_reason, v3_crl_invdate, v3_cpols, v3_crld; | 63 | extern X509V3_EXT_METHOD v3_crl_num, v3_crl_reason, v3_crl_invdate; |
64 | extern X509V3_EXT_METHOD v3_delta_crl, v3_cpols, v3_crld; | ||
64 | extern X509V3_EXT_METHOD v3_ocsp_nonce, v3_ocsp_accresp, v3_ocsp_acutoff; | 65 | extern X509V3_EXT_METHOD v3_ocsp_nonce, v3_ocsp_accresp, v3_ocsp_acutoff; |
65 | extern X509V3_EXT_METHOD v3_ocsp_crlid, v3_ocsp_nocheck, v3_ocsp_serviceloc; | 66 | extern X509V3_EXT_METHOD v3_ocsp_crlid, v3_ocsp_nocheck, v3_ocsp_serviceloc; |
66 | extern X509V3_EXT_METHOD v3_crl_hold; | 67 | extern X509V3_EXT_METHOD v3_crl_hold, v3_pci; |
67 | 68 | ||
68 | /* This table will be searched using OBJ_bsearch so it *must* kept in | 69 | /* This table will be searched using OBJ_bsearch so it *must* kept in |
69 | * order of the ext_nid values. | 70 | * order of the ext_nid values. |
@@ -89,6 +90,7 @@ static X509V3_EXT_METHOD *standard_exts[] = { | |||
89 | &v3_akey_id, | 90 | &v3_akey_id, |
90 | &v3_crld, | 91 | &v3_crld, |
91 | &v3_ext_ku, | 92 | &v3_ext_ku, |
93 | &v3_delta_crl, | ||
92 | &v3_crl_reason, | 94 | &v3_crl_reason, |
93 | #ifndef OPENSSL_NO_OCSP | 95 | #ifndef OPENSSL_NO_OCSP |
94 | &v3_crl_invdate, | 96 | &v3_crl_invdate, |
@@ -105,8 +107,9 @@ static X509V3_EXT_METHOD *standard_exts[] = { | |||
105 | #endif | 107 | #endif |
106 | &v3_sinfo, | 108 | &v3_sinfo, |
107 | #ifndef OPENSSL_NO_OCSP | 109 | #ifndef OPENSSL_NO_OCSP |
108 | &v3_crl_hold | 110 | &v3_crl_hold, |
109 | #endif | 111 | #endif |
112 | &v3_pci, | ||
110 | }; | 113 | }; |
111 | 114 | ||
112 | /* Number of standard extensions */ | 115 | /* Number of standard extensions */ |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_bitst.c b/src/lib/libssl/src/crypto/x509v3/v3_bitst.c index 16cf125562..274965306d 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_bitst.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_bitst.c | |||
@@ -124,7 +124,12 @@ static ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, | |||
124 | for(bnam = method->usr_data; bnam->lname; bnam++) { | 124 | for(bnam = method->usr_data; bnam->lname; bnam++) { |
125 | if(!strcmp(bnam->sname, val->name) || | 125 | if(!strcmp(bnam->sname, val->name) || |
126 | !strcmp(bnam->lname, val->name) ) { | 126 | !strcmp(bnam->lname, val->name) ) { |
127 | ASN1_BIT_STRING_set_bit(bs, bnam->bitnum, 1); | 127 | if(!ASN1_BIT_STRING_set_bit(bs, bnam->bitnum, 1)) { |
128 | X509V3err(X509V3_F_V2I_ASN1_BIT_STRING, | ||
129 | ERR_R_MALLOC_FAILURE); | ||
130 | M_ASN1_BIT_STRING_free(bs); | ||
131 | return NULL; | ||
132 | } | ||
128 | break; | 133 | break; |
129 | } | 134 | } |
130 | } | 135 | } |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_ia5.c b/src/lib/libssl/src/crypto/x509v3/v3_ia5.c index f9414456de..9683afa47c 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_ia5.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_ia5.c | |||
@@ -82,7 +82,10 @@ static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | |||
82 | { | 82 | { |
83 | char *tmp; | 83 | char *tmp; |
84 | if(!ia5 || !ia5->length) return NULL; | 84 | if(!ia5 || !ia5->length) return NULL; |
85 | if (!(tmp = OPENSSL_malloc(ia5->length + 1))) return NULL; | 85 | if(!(tmp = OPENSSL_malloc(ia5->length + 1))) { |
86 | X509V3err(X509V3_F_I2S_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); | ||
87 | return NULL; | ||
88 | } | ||
86 | memcpy(tmp, ia5->data, ia5->length); | 89 | memcpy(tmp, ia5->data, ia5->length); |
87 | tmp[ia5->length] = 0; | 90 | tmp[ia5->length] = 0; |
88 | return tmp; | 91 | return tmp; |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_int.c b/src/lib/libssl/src/crypto/x509v3/v3_int.c index f34cbfb731..7a43b4717b 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_int.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_int.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -61,9 +61,16 @@ | |||
61 | #include <openssl/x509v3.h> | 61 | #include <openssl/x509v3.h> |
62 | 62 | ||
63 | X509V3_EXT_METHOD v3_crl_num = { | 63 | X509V3_EXT_METHOD v3_crl_num = { |
64 | NID_crl_number, 0, ASN1_ITEM_ref(ASN1_INTEGER), | 64 | NID_crl_number, 0, ASN1_ITEM_ref(ASN1_INTEGER), |
65 | 0,0,0,0, | 65 | 0,0,0,0, |
66 | (X509V3_EXT_I2S)i2s_ASN1_INTEGER, | 66 | (X509V3_EXT_I2S)i2s_ASN1_INTEGER, |
67 | 0, | 67 | 0, |
68 | 0,0,0,0, NULL}; | 68 | 0,0,0,0, NULL}; |
69 | |||
70 | X509V3_EXT_METHOD v3_delta_crl = { | ||
71 | NID_delta_crl, 0, ASN1_ITEM_ref(ASN1_INTEGER), | ||
72 | 0,0,0,0, | ||
73 | (X509V3_EXT_I2S)i2s_ASN1_INTEGER, | ||
74 | 0, | ||
75 | 0,0,0,0, NULL}; | ||
69 | 76 | ||
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_purp.c b/src/lib/libssl/src/crypto/x509v3/v3_purp.c index b3d1ae5d1c..bbdf6da493 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_purp.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_purp.c | |||
@@ -63,7 +63,6 @@ | |||
63 | 63 | ||
64 | static void x509v3_cache_extensions(X509 *x); | 64 | static void x509v3_cache_extensions(X509 *x); |
65 | 65 | ||
66 | static int ca_check(const X509 *x); | ||
67 | static int check_ssl_ca(const X509 *x); | 66 | static int check_ssl_ca(const X509 *x); |
68 | static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, int ca); | 67 | static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, int ca); |
69 | static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x, int ca); | 68 | static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x, int ca); |
@@ -286,7 +285,8 @@ int X509_supported_extension(X509_EXTENSION *ex) | |||
286 | NID_key_usage, /* 83 */ | 285 | NID_key_usage, /* 83 */ |
287 | NID_subject_alt_name, /* 85 */ | 286 | NID_subject_alt_name, /* 85 */ |
288 | NID_basic_constraints, /* 87 */ | 287 | NID_basic_constraints, /* 87 */ |
289 | NID_ext_key_usage /* 126 */ | 288 | NID_ext_key_usage, /* 126 */ |
289 | NID_proxyCertInfo /* 661 */ | ||
290 | }; | 290 | }; |
291 | 291 | ||
292 | int ex_nid; | 292 | int ex_nid; |
@@ -307,6 +307,7 @@ int X509_supported_extension(X509_EXTENSION *ex) | |||
307 | static void x509v3_cache_extensions(X509 *x) | 307 | static void x509v3_cache_extensions(X509 *x) |
308 | { | 308 | { |
309 | BASIC_CONSTRAINTS *bs; | 309 | BASIC_CONSTRAINTS *bs; |
310 | PROXY_CERT_INFO_EXTENSION *pci; | ||
310 | ASN1_BIT_STRING *usage; | 311 | ASN1_BIT_STRING *usage; |
311 | ASN1_BIT_STRING *ns; | 312 | ASN1_BIT_STRING *ns; |
312 | EXTENDED_KEY_USAGE *extusage; | 313 | EXTENDED_KEY_USAGE *extusage; |
@@ -335,6 +336,16 @@ static void x509v3_cache_extensions(X509 *x) | |||
335 | BASIC_CONSTRAINTS_free(bs); | 336 | BASIC_CONSTRAINTS_free(bs); |
336 | x->ex_flags |= EXFLAG_BCONS; | 337 | x->ex_flags |= EXFLAG_BCONS; |
337 | } | 338 | } |
339 | /* Handle proxy certificates */ | ||
340 | if((pci=X509_get_ext_d2i(x, NID_proxyCertInfo, NULL, NULL))) { | ||
341 | if (x->ex_flags & EXFLAG_CA | ||
342 | || X509_get_ext_by_NID(x, NID_subject_alt_name, 0) >= 0 | ||
343 | || X509_get_ext_by_NID(x, NID_issuer_alt_name, 0) >= 0) { | ||
344 | x->ex_flags |= EXFLAG_INVALID; | ||
345 | } | ||
346 | PROXY_CERT_INFO_EXTENSION_free(pci); | ||
347 | x->ex_flags |= EXFLAG_PROXY; | ||
348 | } | ||
338 | /* Handle key usage */ | 349 | /* Handle key usage */ |
339 | if((usage=X509_get_ext_d2i(x, NID_key_usage, NULL, NULL))) { | 350 | if((usage=X509_get_ext_d2i(x, NID_key_usage, NULL, NULL))) { |
340 | if(usage->length > 0) { | 351 | if(usage->length > 0) { |
@@ -426,7 +437,7 @@ static void x509v3_cache_extensions(X509 *x) | |||
426 | #define ns_reject(x, usage) \ | 437 | #define ns_reject(x, usage) \ |
427 | (((x)->ex_flags & EXFLAG_NSCERT) && !((x)->ex_nscert & (usage))) | 438 | (((x)->ex_flags & EXFLAG_NSCERT) && !((x)->ex_nscert & (usage))) |
428 | 439 | ||
429 | static int ca_check(const X509 *x) | 440 | static int check_ca(const X509 *x) |
430 | { | 441 | { |
431 | /* keyUsage if present should allow cert signing */ | 442 | /* keyUsage if present should allow cert signing */ |
432 | if(ku_reject(x, KU_KEY_CERT_SIGN)) return 0; | 443 | if(ku_reject(x, KU_KEY_CERT_SIGN)) return 0; |
@@ -435,25 +446,37 @@ static int ca_check(const X509 *x) | |||
435 | /* If basicConstraints says not a CA then say so */ | 446 | /* If basicConstraints says not a CA then say so */ |
436 | else return 0; | 447 | else return 0; |
437 | } else { | 448 | } else { |
449 | /* we support V1 roots for... uh, I don't really know why. */ | ||
438 | if((x->ex_flags & V1_ROOT) == V1_ROOT) return 3; | 450 | if((x->ex_flags & V1_ROOT) == V1_ROOT) return 3; |
439 | /* If key usage present it must have certSign so tolerate it */ | 451 | /* If key usage present it must have certSign so tolerate it */ |
440 | else if (x->ex_flags & EXFLAG_KUSAGE) return 4; | 452 | else if (x->ex_flags & EXFLAG_KUSAGE) return 4; |
441 | else return 2; | 453 | /* Older certificates could have Netscape-specific CA types */ |
454 | else if (x->ex_flags & EXFLAG_NSCERT | ||
455 | && x->ex_nscert & NS_ANY_CA) return 5; | ||
456 | /* can this still be regarded a CA certificate? I doubt it */ | ||
457 | return 0; | ||
442 | } | 458 | } |
443 | } | 459 | } |
444 | 460 | ||
461 | int X509_check_ca(X509 *x) | ||
462 | { | ||
463 | if(!(x->ex_flags & EXFLAG_SET)) { | ||
464 | CRYPTO_w_lock(CRYPTO_LOCK_X509); | ||
465 | x509v3_cache_extensions(x); | ||
466 | CRYPTO_w_unlock(CRYPTO_LOCK_X509); | ||
467 | } | ||
468 | |||
469 | return check_ca(x); | ||
470 | } | ||
471 | |||
445 | /* Check SSL CA: common checks for SSL client and server */ | 472 | /* Check SSL CA: common checks for SSL client and server */ |
446 | static int check_ssl_ca(const X509 *x) | 473 | static int check_ssl_ca(const X509 *x) |
447 | { | 474 | { |
448 | int ca_ret; | 475 | int ca_ret; |
449 | ca_ret = ca_check(x); | 476 | ca_ret = check_ca(x); |
450 | if(!ca_ret) return 0; | 477 | if(!ca_ret) return 0; |
451 | /* check nsCertType if present */ | 478 | /* check nsCertType if present */ |
452 | if(x->ex_flags & EXFLAG_NSCERT) { | 479 | if(ca_ret != 5 || x->ex_nscert & NS_SSL_CA) return ca_ret; |
453 | if(x->ex_nscert & NS_SSL_CA) return ca_ret; | ||
454 | return 0; | ||
455 | } | ||
456 | if(ca_ret != 2) return ca_ret; | ||
457 | else return 0; | 480 | else return 0; |
458 | } | 481 | } |
459 | 482 | ||
@@ -498,14 +521,10 @@ static int purpose_smime(const X509 *x, int ca) | |||
498 | if(xku_reject(x,XKU_SMIME)) return 0; | 521 | if(xku_reject(x,XKU_SMIME)) return 0; |
499 | if(ca) { | 522 | if(ca) { |
500 | int ca_ret; | 523 | int ca_ret; |
501 | ca_ret = ca_check(x); | 524 | ca_ret = check_ca(x); |
502 | if(!ca_ret) return 0; | 525 | if(!ca_ret) return 0; |
503 | /* check nsCertType if present */ | 526 | /* check nsCertType if present */ |
504 | if(x->ex_flags & EXFLAG_NSCERT) { | 527 | if(ca_ret != 5 || x->ex_nscert & NS_SMIME_CA) return ca_ret; |
505 | if(x->ex_nscert & NS_SMIME_CA) return ca_ret; | ||
506 | return 0; | ||
507 | } | ||
508 | if(ca_ret != 2) return ca_ret; | ||
509 | else return 0; | 528 | else return 0; |
510 | } | 529 | } |
511 | if(x->ex_flags & EXFLAG_NSCERT) { | 530 | if(x->ex_flags & EXFLAG_NSCERT) { |
@@ -539,7 +558,7 @@ static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, int ca) | |||
539 | { | 558 | { |
540 | if(ca) { | 559 | if(ca) { |
541 | int ca_ret; | 560 | int ca_ret; |
542 | if((ca_ret = ca_check(x)) != 2) return ca_ret; | 561 | if((ca_ret = check_ca(x)) != 2) return ca_ret; |
543 | else return 0; | 562 | else return 0; |
544 | } | 563 | } |
545 | if(ku_reject(x, KU_CRL_SIGN)) return 0; | 564 | if(ku_reject(x, KU_CRL_SIGN)) return 0; |
@@ -552,17 +571,9 @@ static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, int ca) | |||
552 | 571 | ||
553 | static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca) | 572 | static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca) |
554 | { | 573 | { |
555 | /* Must be a valid CA */ | 574 | /* Must be a valid CA. Should we really support the "I don't know" |
556 | if(ca) { | 575 | value (2)? */ |
557 | int ca_ret; | 576 | if(ca) return check_ca(x); |
558 | ca_ret = ca_check(x); | ||
559 | if(ca_ret != 2) return ca_ret; | ||
560 | if(x->ex_flags & EXFLAG_NSCERT) { | ||
561 | if(x->ex_nscert & NS_ANY_CA) return ca_ret; | ||
562 | return 0; | ||
563 | } | ||
564 | return 0; | ||
565 | } | ||
566 | /* leaf certificate is checked in OCSP_verify() */ | 577 | /* leaf certificate is checked in OCSP_verify() */ |
567 | return 1; | 578 | return 1; |
568 | } | 579 | } |
@@ -624,7 +635,13 @@ int X509_check_issued(X509 *issuer, X509 *subject) | |||
624 | return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH; | 635 | return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH; |
625 | } | 636 | } |
626 | } | 637 | } |
627 | if(ku_reject(issuer, KU_KEY_CERT_SIGN)) return X509_V_ERR_KEYUSAGE_NO_CERTSIGN; | 638 | if(subject->ex_flags & EXFLAG_PROXY) |
639 | { | ||
640 | if(ku_reject(issuer, KU_DIGITAL_SIGNATURE)) | ||
641 | return X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE; | ||
642 | } | ||
643 | else if(ku_reject(issuer, KU_KEY_CERT_SIGN)) | ||
644 | return X509_V_ERR_KEYUSAGE_NO_CERTSIGN; | ||
628 | return X509_V_OK; | 645 | return X509_V_OK; |
629 | } | 646 | } |
630 | 647 | ||
diff --git a/src/lib/libssl/src/crypto/x509v3/v3err.c b/src/lib/libssl/src/crypto/x509v3/v3err.c index 6458e95bb9..2df0c3ef01 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3err.c +++ b/src/lib/libssl/src/crypto/x509v3/v3err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/x509v3/v3err.c */ | 1 | /* crypto/x509v3/v3err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2005 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 |
@@ -72,12 +72,14 @@ static ERR_STRING_DATA X509V3_str_functs[]= | |||
72 | {ERR_PACK(0,X509V3_F_DO_EXT_I2D,0), "DO_EXT_I2D"}, | 72 | {ERR_PACK(0,X509V3_F_DO_EXT_I2D,0), "DO_EXT_I2D"}, |
73 | {ERR_PACK(0,X509V3_F_HEX_TO_STRING,0), "hex_to_string"}, | 73 | {ERR_PACK(0,X509V3_F_HEX_TO_STRING,0), "hex_to_string"}, |
74 | {ERR_PACK(0,X509V3_F_I2S_ASN1_ENUMERATED,0), "i2s_ASN1_ENUMERATED"}, | 74 | {ERR_PACK(0,X509V3_F_I2S_ASN1_ENUMERATED,0), "i2s_ASN1_ENUMERATED"}, |
75 | {ERR_PACK(0,X509V3_F_I2S_ASN1_IA5STRING,0), "I2S_ASN1_IA5STRING"}, | ||
75 | {ERR_PACK(0,X509V3_F_I2S_ASN1_INTEGER,0), "i2s_ASN1_INTEGER"}, | 76 | {ERR_PACK(0,X509V3_F_I2S_ASN1_INTEGER,0), "i2s_ASN1_INTEGER"}, |
76 | {ERR_PACK(0,X509V3_F_I2V_AUTHORITY_INFO_ACCESS,0), "I2V_AUTHORITY_INFO_ACCESS"}, | 77 | {ERR_PACK(0,X509V3_F_I2V_AUTHORITY_INFO_ACCESS,0), "I2V_AUTHORITY_INFO_ACCESS"}, |
77 | {ERR_PACK(0,X509V3_F_NOTICE_SECTION,0), "NOTICE_SECTION"}, | 78 | {ERR_PACK(0,X509V3_F_NOTICE_SECTION,0), "NOTICE_SECTION"}, |
78 | {ERR_PACK(0,X509V3_F_NREF_NOS,0), "NREF_NOS"}, | 79 | {ERR_PACK(0,X509V3_F_NREF_NOS,0), "NREF_NOS"}, |
79 | {ERR_PACK(0,X509V3_F_POLICY_SECTION,0), "POLICY_SECTION"}, | 80 | {ERR_PACK(0,X509V3_F_POLICY_SECTION,0), "POLICY_SECTION"}, |
80 | {ERR_PACK(0,X509V3_F_R2I_CERTPOL,0), "R2I_CERTPOL"}, | 81 | {ERR_PACK(0,X509V3_F_R2I_CERTPOL,0), "R2I_CERTPOL"}, |
82 | {ERR_PACK(0,X509V3_F_R2I_PCI,0), "R2I_PCI"}, | ||
81 | {ERR_PACK(0,X509V3_F_S2I_ASN1_IA5STRING,0), "S2I_ASN1_IA5STRING"}, | 83 | {ERR_PACK(0,X509V3_F_S2I_ASN1_IA5STRING,0), "S2I_ASN1_IA5STRING"}, |
82 | {ERR_PACK(0,X509V3_F_S2I_ASN1_INTEGER,0), "s2i_ASN1_INTEGER"}, | 84 | {ERR_PACK(0,X509V3_F_S2I_ASN1_INTEGER,0), "s2i_ASN1_INTEGER"}, |
83 | {ERR_PACK(0,X509V3_F_S2I_ASN1_OCTET_STRING,0), "s2i_ASN1_OCTET_STRING"}, | 85 | {ERR_PACK(0,X509V3_F_S2I_ASN1_OCTET_STRING,0), "s2i_ASN1_OCTET_STRING"}, |
@@ -128,6 +130,7 @@ static ERR_STRING_DATA X509V3_str_reasons[]= | |||
128 | {X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED,"extension setting not supported"}, | 130 | {X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED,"extension setting not supported"}, |
129 | {X509V3_R_EXTENSION_VALUE_ERROR ,"extension value error"}, | 131 | {X509V3_R_EXTENSION_VALUE_ERROR ,"extension value error"}, |
130 | {X509V3_R_ILLEGAL_HEX_DIGIT ,"illegal hex digit"}, | 132 | {X509V3_R_ILLEGAL_HEX_DIGIT ,"illegal hex digit"}, |
133 | {X509V3_R_INCORRECT_POLICY_SYNTAX_TAG ,"incorrect policy syntax tag"}, | ||
131 | {X509V3_R_INVALID_BOOLEAN_STRING ,"invalid boolean string"}, | 134 | {X509V3_R_INVALID_BOOLEAN_STRING ,"invalid boolean string"}, |
132 | {X509V3_R_INVALID_EXTENSION_STRING ,"invalid extension string"}, | 135 | {X509V3_R_INVALID_EXTENSION_STRING ,"invalid extension string"}, |
133 | {X509V3_R_INVALID_NAME ,"invalid name"}, | 136 | {X509V3_R_INVALID_NAME ,"invalid name"}, |
@@ -139,6 +142,8 @@ static ERR_STRING_DATA X509V3_str_reasons[]= | |||
139 | {X509V3_R_INVALID_OBJECT_IDENTIFIER ,"invalid object identifier"}, | 142 | {X509V3_R_INVALID_OBJECT_IDENTIFIER ,"invalid object identifier"}, |
140 | {X509V3_R_INVALID_OPTION ,"invalid option"}, | 143 | {X509V3_R_INVALID_OPTION ,"invalid option"}, |
141 | {X509V3_R_INVALID_POLICY_IDENTIFIER ,"invalid policy identifier"}, | 144 | {X509V3_R_INVALID_POLICY_IDENTIFIER ,"invalid policy identifier"}, |
145 | {X509V3_R_INVALID_PROXY_POLICY_IDENTIFIER,"invalid proxy policy identifier"}, | ||
146 | {X509V3_R_INVALID_PROXY_POLICY_SETTING ,"invalid proxy policy setting"}, | ||
142 | {X509V3_R_INVALID_PURPOSE ,"invalid purpose"}, | 147 | {X509V3_R_INVALID_PURPOSE ,"invalid purpose"}, |
143 | {X509V3_R_INVALID_SECTION ,"invalid section"}, | 148 | {X509V3_R_INVALID_SECTION ,"invalid section"}, |
144 | {X509V3_R_INVALID_SYNTAX ,"invalid syntax"}, | 149 | {X509V3_R_INVALID_SYNTAX ,"invalid syntax"}, |
@@ -149,9 +154,16 @@ static ERR_STRING_DATA X509V3_str_reasons[]= | |||
149 | {X509V3_R_NO_ISSUER_CERTIFICATE ,"no issuer certificate"}, | 154 | {X509V3_R_NO_ISSUER_CERTIFICATE ,"no issuer certificate"}, |
150 | {X509V3_R_NO_ISSUER_DETAILS ,"no issuer details"}, | 155 | {X509V3_R_NO_ISSUER_DETAILS ,"no issuer details"}, |
151 | {X509V3_R_NO_POLICY_IDENTIFIER ,"no policy identifier"}, | 156 | {X509V3_R_NO_POLICY_IDENTIFIER ,"no policy identifier"}, |
157 | {X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED,"no proxy cert policy language defined"}, | ||
152 | {X509V3_R_NO_PUBLIC_KEY ,"no public key"}, | 158 | {X509V3_R_NO_PUBLIC_KEY ,"no public key"}, |
153 | {X509V3_R_NO_SUBJECT_DETAILS ,"no subject details"}, | 159 | {X509V3_R_NO_SUBJECT_DETAILS ,"no subject details"}, |
154 | {X509V3_R_ODD_NUMBER_OF_DIGITS ,"odd number of digits"}, | 160 | {X509V3_R_ODD_NUMBER_OF_DIGITS ,"odd number of digits"}, |
161 | {X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED,"policy language alreadty defined"}, | ||
162 | {X509V3_R_POLICY_PATH_LENGTH ,"policy path length"}, | ||
163 | {X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED,"policy path length alreadty defined"}, | ||
164 | {X509V3_R_POLICY_SYNTAX_NOT ,"policy syntax not"}, | ||
165 | {X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED,"policy syntax not currently supported"}, | ||
166 | {X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY,"policy when proxy language requires no policy"}, | ||
155 | {X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS ,"unable to get issuer details"}, | 167 | {X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS ,"unable to get issuer details"}, |
156 | {X509V3_R_UNABLE_TO_GET_ISSUER_KEYID ,"unable to get issuer keyid"}, | 168 | {X509V3_R_UNABLE_TO_GET_ISSUER_KEYID ,"unable to get issuer keyid"}, |
157 | {X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT ,"unknown bit string argument"}, | 169 | {X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT ,"unknown bit string argument"}, |
diff --git a/src/lib/libssl/src/crypto/x509v3/x509v3.h b/src/lib/libssl/src/crypto/x509v3/x509v3.h index fb07a19016..e6d91251c2 100644 --- a/src/lib/libssl/src/crypto/x509v3/x509v3.h +++ b/src/lib/libssl/src/crypto/x509v3/x509v3.h | |||
@@ -287,6 +287,23 @@ typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; | |||
287 | DECLARE_STACK_OF(POLICYINFO) | 287 | DECLARE_STACK_OF(POLICYINFO) |
288 | DECLARE_ASN1_SET_OF(POLICYINFO) | 288 | DECLARE_ASN1_SET_OF(POLICYINFO) |
289 | 289 | ||
290 | /* Proxy certificate structures, see RFC 3820 */ | ||
291 | typedef struct PROXY_POLICY_st | ||
292 | { | ||
293 | ASN1_OBJECT *policyLanguage; | ||
294 | ASN1_OCTET_STRING *policy; | ||
295 | } PROXY_POLICY; | ||
296 | |||
297 | typedef struct PROXY_CERT_INFO_EXTENSION_st | ||
298 | { | ||
299 | ASN1_INTEGER *pcPathLengthConstraint; | ||
300 | PROXY_POLICY *proxyPolicy; | ||
301 | } PROXY_CERT_INFO_EXTENSION; | ||
302 | |||
303 | DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) | ||
304 | DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) | ||
305 | |||
306 | |||
290 | #define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ | 307 | #define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ |
291 | ",name:", val->name, ",value:", val->value); | 308 | ",name:", val->name, ",value:", val->value); |
292 | 309 | ||
@@ -325,6 +342,7 @@ DECLARE_ASN1_SET_OF(POLICYINFO) | |||
325 | #define EXFLAG_INVALID 0x80 | 342 | #define EXFLAG_INVALID 0x80 |
326 | #define EXFLAG_SET 0x100 | 343 | #define EXFLAG_SET 0x100 |
327 | #define EXFLAG_CRITICAL 0x200 | 344 | #define EXFLAG_CRITICAL 0x200 |
345 | #define EXFLAG_PROXY 0x400 | ||
328 | 346 | ||
329 | #define KU_DIGITAL_SIGNATURE 0x0080 | 347 | #define KU_DIGITAL_SIGNATURE 0x0080 |
330 | #define KU_NON_REPUDIATION 0x0040 | 348 | #define KU_NON_REPUDIATION 0x0040 |
@@ -527,6 +545,7 @@ int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); | |||
527 | 545 | ||
528 | int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent); | 546 | int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent); |
529 | 547 | ||
548 | int X509_check_ca(X509 *x); | ||
530 | int X509_check_purpose(X509 *x, int id, int ca); | 549 | int X509_check_purpose(X509 *x, int id, int ca); |
531 | int X509_supported_extension(X509_EXTENSION *ex); | 550 | int X509_supported_extension(X509_EXTENSION *ex); |
532 | int X509_PURPOSE_set(int *p, int purpose); | 551 | int X509_PURPOSE_set(int *p, int purpose); |
@@ -564,12 +583,14 @@ void ERR_load_X509V3_strings(void); | |||
564 | #define X509V3_F_DO_EXT_I2D 135 | 583 | #define X509V3_F_DO_EXT_I2D 135 |
565 | #define X509V3_F_HEX_TO_STRING 111 | 584 | #define X509V3_F_HEX_TO_STRING 111 |
566 | #define X509V3_F_I2S_ASN1_ENUMERATED 121 | 585 | #define X509V3_F_I2S_ASN1_ENUMERATED 121 |
586 | #define X509V3_F_I2S_ASN1_IA5STRING 142 | ||
567 | #define X509V3_F_I2S_ASN1_INTEGER 120 | 587 | #define X509V3_F_I2S_ASN1_INTEGER 120 |
568 | #define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 | 588 | #define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 |
569 | #define X509V3_F_NOTICE_SECTION 132 | 589 | #define X509V3_F_NOTICE_SECTION 132 |
570 | #define X509V3_F_NREF_NOS 133 | 590 | #define X509V3_F_NREF_NOS 133 |
571 | #define X509V3_F_POLICY_SECTION 131 | 591 | #define X509V3_F_POLICY_SECTION 131 |
572 | #define X509V3_F_R2I_CERTPOL 130 | 592 | #define X509V3_F_R2I_CERTPOL 130 |
593 | #define X509V3_F_R2I_PCI 142 | ||
573 | #define X509V3_F_S2I_ASN1_IA5STRING 100 | 594 | #define X509V3_F_S2I_ASN1_IA5STRING 100 |
574 | #define X509V3_F_S2I_ASN1_INTEGER 108 | 595 | #define X509V3_F_S2I_ASN1_INTEGER 108 |
575 | #define X509V3_F_S2I_ASN1_OCTET_STRING 112 | 596 | #define X509V3_F_S2I_ASN1_OCTET_STRING 112 |
@@ -617,6 +638,7 @@ void ERR_load_X509V3_strings(void); | |||
617 | #define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 | 638 | #define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 |
618 | #define X509V3_R_EXTENSION_VALUE_ERROR 116 | 639 | #define X509V3_R_EXTENSION_VALUE_ERROR 116 |
619 | #define X509V3_R_ILLEGAL_HEX_DIGIT 113 | 640 | #define X509V3_R_ILLEGAL_HEX_DIGIT 113 |
641 | #define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 153 | ||
620 | #define X509V3_R_INVALID_BOOLEAN_STRING 104 | 642 | #define X509V3_R_INVALID_BOOLEAN_STRING 104 |
621 | #define X509V3_R_INVALID_EXTENSION_STRING 105 | 643 | #define X509V3_R_INVALID_EXTENSION_STRING 105 |
622 | #define X509V3_R_INVALID_NAME 106 | 644 | #define X509V3_R_INVALID_NAME 106 |
@@ -628,6 +650,8 @@ void ERR_load_X509V3_strings(void); | |||
628 | #define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 | 650 | #define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 |
629 | #define X509V3_R_INVALID_OPTION 138 | 651 | #define X509V3_R_INVALID_OPTION 138 |
630 | #define X509V3_R_INVALID_POLICY_IDENTIFIER 134 | 652 | #define X509V3_R_INVALID_POLICY_IDENTIFIER 134 |
653 | #define X509V3_R_INVALID_PROXY_POLICY_IDENTIFIER 147 | ||
654 | #define X509V3_R_INVALID_PROXY_POLICY_SETTING 151 | ||
631 | #define X509V3_R_INVALID_PURPOSE 146 | 655 | #define X509V3_R_INVALID_PURPOSE 146 |
632 | #define X509V3_R_INVALID_SECTION 135 | 656 | #define X509V3_R_INVALID_SECTION 135 |
633 | #define X509V3_R_INVALID_SYNTAX 143 | 657 | #define X509V3_R_INVALID_SYNTAX 143 |
@@ -638,9 +662,16 @@ void ERR_load_X509V3_strings(void); | |||
638 | #define X509V3_R_NO_ISSUER_CERTIFICATE 121 | 662 | #define X509V3_R_NO_ISSUER_CERTIFICATE 121 |
639 | #define X509V3_R_NO_ISSUER_DETAILS 127 | 663 | #define X509V3_R_NO_ISSUER_DETAILS 127 |
640 | #define X509V3_R_NO_POLICY_IDENTIFIER 139 | 664 | #define X509V3_R_NO_POLICY_IDENTIFIER 139 |
665 | #define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 148 | ||
641 | #define X509V3_R_NO_PUBLIC_KEY 114 | 666 | #define X509V3_R_NO_PUBLIC_KEY 114 |
642 | #define X509V3_R_NO_SUBJECT_DETAILS 125 | 667 | #define X509V3_R_NO_SUBJECT_DETAILS 125 |
643 | #define X509V3_R_ODD_NUMBER_OF_DIGITS 112 | 668 | #define X509V3_R_ODD_NUMBER_OF_DIGITS 112 |
669 | #define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED 149 | ||
670 | #define X509V3_R_POLICY_PATH_LENGTH 152 | ||
671 | #define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED 150 | ||
672 | #define X509V3_R_POLICY_SYNTAX_NOT 154 | ||
673 | #define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 155 | ||
674 | #define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 156 | ||
644 | #define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 | 675 | #define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 |
645 | #define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 | 676 | #define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 |
646 | #define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 | 677 | #define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 |
diff --git a/src/lib/libssl/src/doc/apps/asn1parse.pod b/src/lib/libssl/src/doc/apps/asn1parse.pod index e76e9813ab..69ee4dfee6 100644 --- a/src/lib/libssl/src/doc/apps/asn1parse.pod +++ b/src/lib/libssl/src/doc/apps/asn1parse.pod | |||
@@ -123,7 +123,7 @@ C<1.2.3.4 shortName A long name> | |||
123 | 123 | ||
124 | =head1 BUGS | 124 | =head1 BUGS |
125 | 125 | ||
126 | There should be options to change the format of input lines. The output of some | 126 | There should be options to change the format of output lines. The output of some |
127 | ASN.1 types is not well handled (if at all). | 127 | ASN.1 types is not well handled (if at all). |
128 | 128 | ||
129 | =cut | 129 | =cut |
diff --git a/src/lib/libssl/src/doc/apps/dgst.pod b/src/lib/libssl/src/doc/apps/dgst.pod index 1648742bcf..b0d198724c 100644 --- a/src/lib/libssl/src/doc/apps/dgst.pod +++ b/src/lib/libssl/src/doc/apps/dgst.pod | |||
@@ -14,6 +14,7 @@ B<openssl> B<dgst> | |||
14 | [B<-binary>] | 14 | [B<-binary>] |
15 | [B<-out filename>] | 15 | [B<-out filename>] |
16 | [B<-sign filename>] | 16 | [B<-sign filename>] |
17 | [B<-passin arg>] | ||
17 | [B<-verify filename>] | 18 | [B<-verify filename>] |
18 | [B<-prverify filename>] | 19 | [B<-prverify filename>] |
19 | [B<-signature filename>] | 20 | [B<-signature filename>] |
@@ -59,6 +60,11 @@ filename to output to, or standard output by default. | |||
59 | 60 | ||
60 | digitally sign the digest using the private key in "filename". | 61 | digitally sign the digest using the private key in "filename". |
61 | 62 | ||
63 | =item B<-passin arg> | ||
64 | |||
65 | the private key password source. For more information about the format of B<arg> | ||
66 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
67 | |||
62 | =item B<-verify filename> | 68 | =item B<-verify filename> |
63 | 69 | ||
64 | verify the signature using the the public key in "filename". | 70 | verify the signature using the the public key in "filename". |
diff --git a/src/lib/libssl/src/doc/apps/enc.pod b/src/lib/libssl/src/doc/apps/enc.pod index ddf081617f..18fe7c81c7 100644 --- a/src/lib/libssl/src/doc/apps/enc.pod +++ b/src/lib/libssl/src/doc/apps/enc.pod | |||
@@ -86,7 +86,7 @@ versions of OpenSSL. Superseded by the B<-pass> argument. | |||
86 | =item B<-kfile filename> | 86 | =item B<-kfile filename> |
87 | 87 | ||
88 | read the password to derive the key from the first line of B<filename>. | 88 | read the password to derive the key from the first line of B<filename>. |
89 | This is for computability with previous versions of OpenSSL. Superseded by | 89 | This is for compatibility with previous versions of OpenSSL. Superseded by |
90 | the B<-pass> argument. | 90 | the B<-pass> argument. |
91 | 91 | ||
92 | =item B<-S salt> | 92 | =item B<-S salt> |
diff --git a/src/lib/libssl/src/doc/crypto/BN_num_bytes.pod b/src/lib/libssl/src/doc/crypto/BN_num_bytes.pod index 61589fb9ac..a6a2e3f819 100644 --- a/src/lib/libssl/src/doc/crypto/BN_num_bytes.pod +++ b/src/lib/libssl/src/doc/crypto/BN_num_bytes.pod | |||
@@ -16,8 +16,14 @@ BN_num_bits, BN_num_bytes, BN_num_bits_word - get BIGNUM size | |||
16 | 16 | ||
17 | =head1 DESCRIPTION | 17 | =head1 DESCRIPTION |
18 | 18 | ||
19 | These functions return the size of a B<BIGNUM> in bytes or bits, | 19 | BN_num_bytes() returns the size of a B<BIGNUM> in bytes. |
20 | and the size of an unsigned integer in bits. | 20 | |
21 | BN_num_bits_word() returns the number of significant bits in a word. | ||
22 | If we take 0x00000432 as an example, it returns 11, not 16, not 32. | ||
23 | Basically, except for a zero, it returns I<floor(log2(w))+1>. | ||
24 | |||
25 | BN_num_bits() returns the number of significant bits in a B<BIGNUM>, | ||
26 | following the same principle as BN_num_bits_word(). | ||
21 | 27 | ||
22 | BN_num_bytes() is a macro. | 28 | BN_num_bytes() is a macro. |
23 | 29 | ||
@@ -25,9 +31,23 @@ BN_num_bytes() is a macro. | |||
25 | 31 | ||
26 | The size. | 32 | The size. |
27 | 33 | ||
34 | =head1 NOTES | ||
35 | |||
36 | Some have tried using BN_num_bits() on individual numbers in RSA keys, | ||
37 | DH keys and DSA keys, and found that they don't always come up with | ||
38 | the number of bits they expected (something like 512, 1024, 2048, | ||
39 | ...). This is because generating a number with some specific number | ||
40 | of bits doesn't always set the highest bits, thereby making the number | ||
41 | of I<significant> bits a little lower. If you want to know the "key | ||
42 | size" of such a key, either use functions like RSA_size(), DH_size() | ||
43 | and DSA_size(), or use BN_num_bytes() and multiply with 8 (although | ||
44 | there's no real guarantee that will match the "key size", just a lot | ||
45 | more probability). | ||
46 | |||
28 | =head1 SEE ALSO | 47 | =head1 SEE ALSO |
29 | 48 | ||
30 | L<bn(3)|bn(3)> | 49 | L<bn(3)|bn(3)>, L<DH_size(3)|DH_size(3)>, L<DSA_size(3)|DSA_size(3)>, |
50 | L<RSA_size(3)|RSA_size(3)> | ||
31 | 51 | ||
32 | =head1 HISTORY | 52 | =head1 HISTORY |
33 | 53 | ||
diff --git a/src/lib/libssl/src/doc/crypto/ERR_error_string.pod b/src/lib/libssl/src/doc/crypto/ERR_error_string.pod index e01beb817a..cdfa7fe1fe 100644 --- a/src/lib/libssl/src/doc/crypto/ERR_error_string.pod +++ b/src/lib/libssl/src/doc/crypto/ERR_error_string.pod | |||
@@ -11,7 +11,7 @@ error message | |||
11 | #include <openssl/err.h> | 11 | #include <openssl/err.h> |
12 | 12 | ||
13 | char *ERR_error_string(unsigned long e, char *buf); | 13 | char *ERR_error_string(unsigned long e, char *buf); |
14 | char *ERR_error_string_n(unsigned long e, char *buf, size_t len); | 14 | void ERR_error_string_n(unsigned long e, char *buf, size_t len); |
15 | 15 | ||
16 | const char *ERR_lib_error_string(unsigned long e); | 16 | const char *ERR_lib_error_string(unsigned long e); |
17 | const char *ERR_func_error_string(unsigned long e); | 17 | const char *ERR_func_error_string(unsigned long e); |
diff --git a/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod b/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod index daf57e5895..40e525dd56 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod | |||
@@ -479,6 +479,7 @@ General encryption, decryption function example using FILE I/O and RC2 with an | |||
479 | if(!EVP_CipherUpdate(&ctx, outbuf, &outlen, inbuf, inlen)) | 479 | if(!EVP_CipherUpdate(&ctx, outbuf, &outlen, inbuf, inlen)) |
480 | { | 480 | { |
481 | /* Error */ | 481 | /* Error */ |
482 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
482 | return 0; | 483 | return 0; |
483 | } | 484 | } |
484 | fwrite(outbuf, 1, outlen, out); | 485 | fwrite(outbuf, 1, outlen, out); |
@@ -486,6 +487,7 @@ General encryption, decryption function example using FILE I/O and RC2 with an | |||
486 | if(!EVP_CipherFinal_ex(&ctx, outbuf, &outlen)) | 487 | if(!EVP_CipherFinal_ex(&ctx, outbuf, &outlen)) |
487 | { | 488 | { |
488 | /* Error */ | 489 | /* Error */ |
490 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
489 | return 0; | 491 | return 0; |
490 | } | 492 | } |
491 | fwrite(outbuf, 1, outlen, out); | 493 | fwrite(outbuf, 1, outlen, out); |
diff --git a/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod b/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod index b5e477e294..48a0e29954 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod | |||
@@ -8,8 +8,9 @@ EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption | |||
8 | 8 | ||
9 | #include <openssl/evp.h> | 9 | #include <openssl/evp.h> |
10 | 10 | ||
11 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, | 11 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
12 | int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); | 12 | unsigned char **ek, int *ekl, unsigned char *iv, |
13 | EVP_PKEY **pubk, int npubk); | ||
13 | int EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 14 | int EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
14 | int *outl, unsigned char *in, int inl); | 15 | int *outl, unsigned char *in, int inl); |
15 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | 16 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, |
diff --git a/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod b/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod index e65e54ce52..0bace24938 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod | |||
@@ -29,11 +29,10 @@ EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the | |||
29 | signature context B<ctx>. This function can be called several times on the | 29 | signature context B<ctx>. This function can be called several times on the |
30 | same B<ctx> to include additional data. | 30 | same B<ctx> to include additional data. |
31 | 31 | ||
32 | EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> | 32 | EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> and |
33 | and places the signature in B<sig>. If the B<s> parameter is not NULL | 33 | places the signature in B<sig>. The number of bytes of data written (i.e. the |
34 | then the number of bytes of data written (i.e. the length of the signature) | 34 | length of the signature) will be written to the integer at B<s>, at most |
35 | will be written to the integer at B<s>, at most EVP_PKEY_size(pkey) bytes | 35 | EVP_PKEY_size(pkey) bytes will be written. |
36 | will be written. | ||
37 | 36 | ||
38 | EVP_SignInit() initializes a signing context B<ctx> to use the default | 37 | EVP_SignInit() initializes a signing context B<ctx> to use the default |
39 | implementation of digest B<type>. | 38 | implementation of digest B<type>. |
diff --git a/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod b/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod index d53e19d2b7..ab0fe3b2cd 100644 --- a/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod +++ b/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod | |||
@@ -47,9 +47,10 @@ Encrypting user data directly with RSA is insecure. | |||
47 | =back | 47 | =back |
48 | 48 | ||
49 | B<flen> must be less than RSA_size(B<rsa>) - 11 for the PKCS #1 v1.5 | 49 | B<flen> must be less than RSA_size(B<rsa>) - 11 for the PKCS #1 v1.5 |
50 | based padding modes, and less than RSA_size(B<rsa>) - 41 for | 50 | based padding modes, less than RSA_size(B<rsa>) - 41 for |
51 | RSA_PKCS1_OAEP_PADDING. The random number generator must be seeded | 51 | RSA_PKCS1_OAEP_PADDING and exactly RSA_size(B<rsa>) for RSA_NO_PADDING. |
52 | prior to calling RSA_public_encrypt(). | 52 | The random number generator must be seeded prior to calling |
53 | RSA_public_encrypt(). | ||
53 | 54 | ||
54 | RSA_private_decrypt() decrypts the B<flen> bytes at B<from> using the | 55 | RSA_private_decrypt() decrypts the B<flen> bytes at B<from> using the |
55 | private key B<rsa> and stores the plaintext in B<to>. B<to> must point | 56 | private key B<rsa> and stores the plaintext in B<to>. B<to> must point |
diff --git a/src/lib/libssl/src/doc/crypto/blowfish.pod b/src/lib/libssl/src/doc/crypto/blowfish.pod index ed71334f56..5b2d274c15 100644 --- a/src/lib/libssl/src/doc/crypto/blowfish.pod +++ b/src/lib/libssl/src/doc/crypto/blowfish.pod | |||
@@ -32,7 +32,7 @@ by Counterpane (see http://www.counterpane.com/blowfish.html ). | |||
32 | 32 | ||
33 | Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data. | 33 | Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data. |
34 | It uses a variable size key, but typically, 128 bit (16 byte) keys are | 34 | It uses a variable size key, but typically, 128 bit (16 byte) keys are |
35 | a considered good for strong encryption. Blowfish can be used in the same | 35 | considered good for strong encryption. Blowfish can be used in the same |
36 | modes as DES (see L<des_modes(7)|des_modes(7)>). Blowfish is currently one | 36 | modes as DES (see L<des_modes(7)|des_modes(7)>). Blowfish is currently one |
37 | of the faster block ciphers. It is quite a bit faster than DES, and much | 37 | of the faster block ciphers. It is quite a bit faster than DES, and much |
38 | faster than IDEA or RC2. | 38 | faster than IDEA or RC2. |
diff --git a/src/lib/libssl/src/doc/crypto/pem.pod b/src/lib/libssl/src/doc/crypto/pem.pod index 8613114452..4f9a27df0c 100644 --- a/src/lib/libssl/src/doc/crypto/pem.pod +++ b/src/lib/libssl/src/doc/crypto/pem.pod | |||
@@ -471,6 +471,6 @@ is guaranteed to work. | |||
471 | =head1 RETURN CODES | 471 | =head1 RETURN CODES |
472 | 472 | ||
473 | The read routines return either a pointer to the structure read or NULL | 473 | The read routines return either a pointer to the structure read or NULL |
474 | is an error occurred. | 474 | if an error occurred. |
475 | 475 | ||
476 | The write routines return 1 for success or 0 for failure. | 476 | The write routines return 1 for success or 0 for failure. |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.pod b/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.pod index 914eb7c9e3..f62a869a9b 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.pod | |||
@@ -8,9 +8,9 @@ SSL_CIPHER_get_name, SSL_CIPHER_get_bits, SSL_CIPHER_get_version, SSL_CIPHER_des | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | const char *SSL_CIPHER_get_name(SSL_CIPHER *cipher); | 11 | const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher); |
12 | int SSL_CIPHER_get_bits(SSL_CIPHER *cipher, int *alg_bits); | 12 | int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits); |
13 | char *SSL_CIPHER_get_version(SSL_CIPHER *cipher); | 13 | char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher); |
14 | char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int size); | 14 | char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int size); |
15 | 15 | ||
16 | =head1 DESCRIPTION | 16 | =head1 DESCRIPTION |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_get_ex_new_index.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_get_ex_new_index.pod index 5686faf299..0c40a91f2f 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_get_ex_new_index.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_get_ex_new_index.pod | |||
@@ -15,7 +15,7 @@ SSL_CTX_get_ex_new_index, SSL_CTX_set_ex_data, SSL_CTX_get_ex_data - internal ap | |||
15 | 15 | ||
16 | int SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *arg); | 16 | int SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *arg); |
17 | 17 | ||
18 | void *SSL_CTX_get_ex_data(SSL_CTX *ctx, int idx); | 18 | void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx); |
19 | 19 | ||
20 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | 20 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, |
21 | int idx, long argl, void *argp); | 21 | int idx, long argl, void *argp); |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_get_verify_mode.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_get_verify_mode.pod index 7f10c6e945..2a3747e75c 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_get_verify_mode.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_get_verify_mode.pod | |||
@@ -8,12 +8,12 @@ SSL_CTX_get_verify_mode, SSL_get_verify_mode, SSL_CTX_get_verify_depth, SSL_get_ | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | int SSL_CTX_get_verify_mode(SSL_CTX *ctx); | 11 | int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); |
12 | int SSL_get_verify_mode(SSL *ssl); | 12 | int SSL_get_verify_mode(const SSL *ssl); |
13 | int SSL_CTX_get_verify_depth(SSL_CTX *ctx); | 13 | int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); |
14 | int SSL_get_verify_depth(SSL *ssl); | 14 | int SSL_get_verify_depth(const SSL *ssl); |
15 | int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int, X509_STORE_CTX *); | 15 | int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int, X509_STORE_CTX *); |
16 | int (*SSL_get_verify_callback(SSL *ssl))(int, X509_STORE_CTX *); | 16 | int (*SSL_get_verify_callback(const SSL *ssl))(int, X509_STORE_CTX *); |
17 | 17 | ||
18 | =head1 DESCRIPTION | 18 | =head1 DESCRIPTION |
19 | 19 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.pod index 3a240c4d37..6acf0d9f9b 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.pod | |||
@@ -9,7 +9,7 @@ SSL_CTX_set_cert_store, SSL_CTX_get_cert_store - manipulate X509 certificate ver | |||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store); | 11 | void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store); |
12 | X509_STORE *SSL_CTX_get_cert_store(SSL_CTX *ctx); | 12 | X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx); |
13 | 13 | ||
14 | =head1 DESCRIPTION | 14 | =head1 DESCRIPTION |
15 | 15 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.pod index 63d0b8d33f..0b4affd5eb 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.pod | |||
@@ -9,10 +9,10 @@ SSL_CTX_set_info_callback, SSL_CTX_get_info_callback, SSL_set_info_callback, SSL | |||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*callback)()); | 11 | void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*callback)()); |
12 | void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(); | 12 | void (*SSL_CTX_get_info_callback(const SSL_CTX *ctx))(); |
13 | 13 | ||
14 | void SSL_set_info_callback(SSL *ssl, void (*callback)()); | 14 | void SSL_set_info_callback(SSL *ssl, void (*callback)()); |
15 | void (*SSL_get_info_callback(SSL *ssl))(); | 15 | void (*SSL_get_info_callback(const SSL *ssl))(); |
16 | 16 | ||
17 | =head1 DESCRIPTION | 17 | =head1 DESCRIPTION |
18 | 18 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod index 766f0c9200..5ab1b32f93 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod | |||
@@ -163,7 +163,7 @@ When choosing a cipher, use the server's preferences instead of the client | |||
163 | preferences. When not set, the SSL server will always follow the clients | 163 | preferences. When not set, the SSL server will always follow the clients |
164 | preferences. When set, the SSLv3/TLSv1 server will choose following its | 164 | preferences. When set, the SSLv3/TLSv1 server will choose following its |
165 | own preferences. Because of the different protocol, for SSLv2 the server | 165 | own preferences. Because of the different protocol, for SSLv2 the server |
166 | will send his list of preferences to the client and the client chooses. | 166 | will send its list of preferences to the client and the client chooses. |
167 | 167 | ||
168 | =item SSL_OP_PKCS1_CHECK_1 | 168 | =item SSL_OP_PKCS1_CHECK_1 |
169 | 169 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.pod index 1d0526d59a..393f8ff0b4 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.pod | |||
@@ -9,10 +9,10 @@ SSL_CTX_set_quiet_shutdown, SSL_CTX_get_quiet_shutdown, SSL_set_quiet_shutdown, | |||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); | 11 | void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); |
12 | int SSL_CTX_get_quiet_shutdown(SSL_CTX *ctx); | 12 | int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); |
13 | 13 | ||
14 | void SSL_set_quiet_shutdown(SSL *ssl, int mode); | 14 | void SSL_set_quiet_shutdown(SSL *ssl, int mode); |
15 | int SSL_get_quiet_shutdown(SSL *ssl); | 15 | int SSL_get_quiet_shutdown(const SSL *ssl); |
16 | 16 | ||
17 | =head1 DESCRIPTION | 17 | =head1 DESCRIPTION |
18 | 18 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_id_context.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_id_context.pod index 5949395159..58fc685506 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_id_context.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_id_context.pod | |||
@@ -46,7 +46,8 @@ B<SSL_MAX_SSL_SESSION_ID_LENGTH>. | |||
46 | 46 | ||
47 | =head1 WARNINGS | 47 | =head1 WARNINGS |
48 | 48 | ||
49 | If the session id context is not set on an SSL/TLS server, stored sessions | 49 | If the session id context is not set on an SSL/TLS server and client |
50 | certificates are used, stored sessions | ||
50 | will not be reused but a fatal error will be flagged and the handshake | 51 | will not be reused but a fatal error will be flagged and the handshake |
51 | will fail. | 52 | will fail. |
52 | 53 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod index ea2faba3ec..48c888c337 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod | |||
@@ -31,8 +31,8 @@ SSL_CTX_use_certificate, SSL_CTX_use_certificate_ASN1, SSL_CTX_use_certificate_f | |||
31 | int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); | 31 | int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); |
32 | int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); | 32 | int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); |
33 | 33 | ||
34 | int SSL_CTX_check_private_key(SSL_CTX *ctx); | 34 | int SSL_CTX_check_private_key(const SSL_CTX *ctx); |
35 | int SSL_check_private_key(SSL *ssl); | 35 | int SSL_check_private_key(const SSL *ssl); |
36 | 36 | ||
37 | =head1 DESCRIPTION | 37 | =head1 DESCRIPTION |
38 | 38 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_ex_new_index.pod b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_ex_new_index.pod index da0bcf1590..657cda931f 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_ex_new_index.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_ex_new_index.pod | |||
@@ -15,7 +15,7 @@ SSL_SESSION_get_ex_new_index, SSL_SESSION_set_ex_data, SSL_SESSION_get_ex_data - | |||
15 | 15 | ||
16 | int SSL_SESSION_set_ex_data(SSL_SESSION *session, int idx, void *arg); | 16 | int SSL_SESSION_set_ex_data(SSL_SESSION *session, int idx, void *arg); |
17 | 17 | ||
18 | void *SSL_SESSION_get_ex_data(SSL_SESSION *session, int idx); | 18 | void *SSL_SESSION_get_ex_data(const SSL_SESSION *session, int idx); |
19 | 19 | ||
20 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | 20 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, |
21 | int idx, long argl, void *argp); | 21 | int idx, long argl, void *argp); |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod index ea3c2bcfe6..00883ed2a0 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod | |||
@@ -8,14 +8,14 @@ SSL_SESSION_get_time, SSL_SESSION_set_time, SSL_SESSION_get_timeout, SSL_SESSION | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | long SSL_SESSION_get_time(SSL_SESSION *s); | 11 | long SSL_SESSION_get_time(const SSL_SESSION *s); |
12 | long SSL_SESSION_set_time(SSL_SESSION *s, long tm); | 12 | long SSL_SESSION_set_time(SSL_SESSION *s, long tm); |
13 | long SSL_SESSION_get_timeout(SSL_SESSION *s); | 13 | long SSL_SESSION_get_timeout(const SSL_SESSION *s); |
14 | long SSL_SESSION_set_timeout(SSL_SESSION *s, long tm); | 14 | long SSL_SESSION_set_timeout(SSL_SESSION *s, long tm); |
15 | 15 | ||
16 | long SSL_get_time(SSL_SESSION *s); | 16 | long SSL_get_time(const SSL_SESSION *s); |
17 | long SSL_set_time(SSL_SESSION *s, long tm); | 17 | long SSL_set_time(SSL_SESSION *s, long tm); |
18 | long SSL_get_timeout(SSL_SESSION *s); | 18 | long SSL_get_timeout(const SSL_SESSION *s); |
19 | long SSL_set_timeout(SSL_SESSION *s, long tm); | 19 | long SSL_set_timeout(SSL_SESSION *s, long tm); |
20 | 20 | ||
21 | =head1 DESCRIPTION | 21 | =head1 DESCRIPTION |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.pod b/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.pod index 52d0227b19..659c482c79 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.pod | |||
@@ -8,7 +8,7 @@ SSL_get_SSL_CTX - get the SSL_CTX from which an SSL is created | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | SSL_CTX *SSL_get_SSL_CTX(SSL *ssl); | 11 | SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); |
12 | 12 | ||
13 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
14 | 14 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.pod b/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.pod index 2a57455c23..aecadd9138 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.pod | |||
@@ -8,8 +8,8 @@ SSL_get_ciphers, SSL_get_cipher_list - get list of available SSL_CIPHERs | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *ssl); | 11 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl); |
12 | const char *SSL_get_cipher_list(SSL *ssl, int priority); | 12 | const char *SSL_get_cipher_list(const SSL *ssl, int priority); |
13 | 13 | ||
14 | =head1 DESCRIPTION | 14 | =head1 DESCRIPTION |
15 | 15 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod b/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod index 5693fdebb2..68181b2407 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod | |||
@@ -8,8 +8,8 @@ SSL_get_client_CA_list, SSL_CTX_get_client_CA_list - get list of client CAs | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(SSL *s); | 11 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); |
12 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(SSL_CTX *ctx); | 12 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *ctx); |
13 | 13 | ||
14 | =head1 DESCRIPTION | 14 | =head1 DESCRIPTION |
15 | 15 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.pod b/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.pod index 2dd7261d89..e5ab12491e 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.pod | |||
@@ -9,7 +9,7 @@ SSL_get_cipher_bits, SSL_get_cipher_version - get SSL_CIPHER of a connection | |||
9 | 9 | ||
10 | #include <openssl/ssl.h> | 10 | #include <openssl/ssl.h> |
11 | 11 | ||
12 | SSL_CIPHER *SSL_get_current_cipher(SSL *ssl); | 12 | SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl); |
13 | #define SSL_get_cipher(s) \ | 13 | #define SSL_get_cipher(s) \ |
14 | SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | 14 | SSL_CIPHER_get_name(SSL_get_current_cipher(s)) |
15 | #define SSL_get_cipher_name(s) \ | 15 | #define SSL_get_cipher_name(s) \ |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.pod b/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.pod index 8d43b31345..a648a9b82d 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.pod | |||
@@ -8,7 +8,7 @@ SSL_get_default_timeout - get default session timeout value | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | long SSL_get_default_timeout(SSL *ssl); | 11 | long SSL_get_default_timeout(const SSL *ssl); |
12 | 12 | ||
13 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
14 | 14 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_error.pod b/src/lib/libssl/src/doc/ssl/SSL_get_error.pod index fe28dd942a..48c6b15db7 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_error.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_error.pod | |||
@@ -8,7 +8,7 @@ SSL_get_error - obtain result code for TLS/SSL I/O operation | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | int SSL_get_error(SSL *ssl, int ret); | 11 | int SSL_get_error(const SSL *ssl, int ret); |
12 | 12 | ||
13 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
14 | 14 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_ex_new_index.pod b/src/lib/libssl/src/doc/ssl/SSL_get_ex_new_index.pod index 6644ef8fbc..228d23d8c0 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_ex_new_index.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_ex_new_index.pod | |||
@@ -15,7 +15,7 @@ SSL_get_ex_new_index, SSL_set_ex_data, SSL_get_ex_data - internal application sp | |||
15 | 15 | ||
16 | int SSL_set_ex_data(SSL *ssl, int idx, void *arg); | 16 | int SSL_set_ex_data(SSL *ssl, int idx, void *arg); |
17 | 17 | ||
18 | void *SSL_get_ex_data(SSL *ssl, int idx); | 18 | void *SSL_get_ex_data(const SSL *ssl, int idx); |
19 | 19 | ||
20 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | 20 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, |
21 | int idx, long argl, void *argp); | 21 | int idx, long argl, void *argp); |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_fd.pod b/src/lib/libssl/src/doc/ssl/SSL_get_fd.pod index a3f7625931..89260b522c 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_fd.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_fd.pod | |||
@@ -8,9 +8,9 @@ SSL_get_fd - get file descriptor linked to an SSL object | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | int SSL_get_fd(SSL *ssl); | 11 | int SSL_get_fd(const SSL *ssl); |
12 | int SSL_get_rfd(SSL *ssl); | 12 | int SSL_get_rfd(const SSL *ssl); |
13 | int SSL_get_wfd(SSL *ssl); | 13 | int SSL_get_wfd(const SSL *ssl); |
14 | 14 | ||
15 | =head1 DESCRIPTION | 15 | =head1 DESCRIPTION |
16 | 16 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.pod b/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.pod index 390ce0b41b..49fb88f86f 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.pod | |||
@@ -8,7 +8,7 @@ SSL_get_peer_cert_chain - get the X509 certificate chain of the peer | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | STACKOF(X509) *SSL_get_peer_cert_chain(SSL *ssl); | 11 | STACKOF(X509) *SSL_get_peer_cert_chain(const SSL *ssl); |
12 | 12 | ||
13 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
14 | 14 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod b/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod index 60635a9660..ef7c8be180 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod | |||
@@ -8,7 +8,7 @@ SSL_get_peer_certificate - get the X509 certificate of the peer | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | X509 *SSL_get_peer_certificate(SSL *ssl); | 11 | X509 *SSL_get_peer_certificate(const SSL *ssl); |
12 | 12 | ||
13 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
14 | 14 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_session.pod b/src/lib/libssl/src/doc/ssl/SSL_get_session.pod index dd9aba40b6..0c41caa922 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_session.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_session.pod | |||
@@ -8,8 +8,8 @@ SSL_get_session - retrieve TLS/SSL session data | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | SSL_SESSION *SSL_get_session(SSL *ssl); | 11 | SSL_SESSION *SSL_get_session(const SSL *ssl); |
12 | SSL_SESSION *SSL_get0_session(SSL *ssl); | 12 | SSL_SESSION *SSL_get0_session(const SSL *ssl); |
13 | SSL_SESSION *SSL_get1_session(SSL *ssl); | 13 | SSL_SESSION *SSL_get1_session(SSL *ssl); |
14 | 14 | ||
15 | =head1 DESCRIPTION | 15 | =head1 DESCRIPTION |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.pod b/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.pod index e6bac9c35a..55b56a53f9 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.pod | |||
@@ -8,7 +8,7 @@ SSL_get_verify_result - get result of peer certificate verification | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | long SSL_get_verify_result(SSL *ssl); | 11 | long SSL_get_verify_result(const SSL *ssl); |
12 | 12 | ||
13 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
14 | 14 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_version.pod b/src/lib/libssl/src/doc/ssl/SSL_get_version.pod index 24d5291256..cc271db2c5 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_version.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_version.pod | |||
@@ -8,7 +8,7 @@ SSL_get_version - get the protocol version of a connection. | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | const char *SSL_get_version(SSL *ssl); | 11 | const char *SSL_get_version(const SSL *ssl); |
12 | 12 | ||
13 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
14 | 14 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_pending.pod b/src/lib/libssl/src/doc/ssl/SSL_pending.pod index b4c48598b2..43f2874e8b 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_pending.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_pending.pod | |||
@@ -8,7 +8,7 @@ SSL_pending - obtain number of readable bytes buffered in an SSL object | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | int SSL_pending(SSL *ssl); | 11 | int SSL_pending(const SSL *ssl); |
12 | 12 | ||
13 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
14 | 14 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod index 6289e635d9..011a022a12 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod | |||
@@ -10,7 +10,7 @@ SSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL connect | |||
10 | 10 | ||
11 | void SSL_set_shutdown(SSL *ssl, int mode); | 11 | void SSL_set_shutdown(SSL *ssl, int mode); |
12 | 12 | ||
13 | int SSL_get_shutdown(SSL *ssl); | 13 | int SSL_get_shutdown(const SSL *ssl); |
14 | 14 | ||
15 | =head1 DESCRIPTION | 15 | =head1 DESCRIPTION |
16 | 16 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod index 6b5012be7a..89911acbca 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod | |||
@@ -38,7 +38,7 @@ behaviour. | |||
38 | =over 4 | 38 | =over 4 |
39 | 39 | ||
40 | =item When the application is the first party to send the "close notify" | 40 | =item When the application is the first party to send the "close notify" |
41 | alert, SSL_shutdown() will only send the alert and the set the | 41 | alert, SSL_shutdown() will only send the alert and then set the |
42 | SSL_SENT_SHUTDOWN flag (so that the session is considered good and will | 42 | SSL_SENT_SHUTDOWN flag (so that the session is considered good and will |
43 | be kept in cache). SSL_shutdown() will then return with 0. If a unidirectional | 43 | be kept in cache). SSL_shutdown() will then return with 0. If a unidirectional |
44 | shutdown is enough (the underlying connection shall be closed anyway), this | 44 | shutdown is enough (the underlying connection shall be closed anyway), this |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_state_string.pod b/src/lib/libssl/src/doc/ssl/SSL_state_string.pod index b4be1aaa48..fe25d47c71 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_state_string.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_state_string.pod | |||
@@ -8,8 +8,8 @@ SSL_state_string, SSL_state_string_long - get textual description of state of an | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | const char *SSL_state_string(SSL *ssl); | 11 | const char *SSL_state_string(const SSL *ssl); |
12 | const char *SSL_state_string_long(SSL *ssl); | 12 | const char *SSL_state_string_long(const SSL *ssl); |
13 | 13 | ||
14 | =head1 DESCRIPTION | 14 | =head1 DESCRIPTION |
15 | 15 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_want.pod b/src/lib/libssl/src/doc/ssl/SSL_want.pod index 50cc89db80..c0059c0d4a 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_want.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_want.pod | |||
@@ -8,11 +8,11 @@ SSL_want, SSL_want_nothing, SSL_want_read, SSL_want_write, SSL_want_x509_lookup | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | int SSL_want(SSL *ssl); | 11 | int SSL_want(const SSL *ssl); |
12 | int SSL_want_nothing(SSL *ssl); | 12 | int SSL_want_nothing(const SSL *ssl); |
13 | int SSL_want_read(SSL *ssl); | 13 | int SSL_want_read(const SSL *ssl); |
14 | int SSL_want_write(SSL *ssl); | 14 | int SSL_want_write(const SSL *ssl); |
15 | int SSL_want_x509_lookup(SSL *ssl); | 15 | int SSL_want_x509_lookup(const SSL *ssl); |
16 | 16 | ||
17 | =head1 DESCRIPTION | 17 | =head1 DESCRIPTION |
18 | 18 | ||
diff --git a/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod b/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod index 0321a5a36f..81d276477f 100644 --- a/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod +++ b/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod | |||
@@ -8,7 +8,7 @@ d2i_SSL_SESSION, i2d_SSL_SESSION - convert SSL_SESSION object from/to ASN1 repre | |||
8 | 8 | ||
9 | #include <openssl/ssl.h> | 9 | #include <openssl/ssl.h> |
10 | 10 | ||
11 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, long length); | 11 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length); |
12 | int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); | 12 | int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); |
13 | 13 | ||
14 | =head1 DESCRIPTION | 14 | =head1 DESCRIPTION |
diff --git a/src/lib/libssl/src/doc/ssl/ssl.pod b/src/lib/libssl/src/doc/ssl/ssl.pod index 4d7a6b7e2b..b41f3e3645 100644 --- a/src/lib/libssl/src/doc/ssl/ssl.pod +++ b/src/lib/libssl/src/doc/ssl/ssl.pod | |||
@@ -213,7 +213,7 @@ protocol context defined in the B<SSL_CTX> structure. | |||
213 | 213 | ||
214 | =item int B<SSL_CTX_add_session>(SSL_CTX *ctx, SSL_SESSION *c); | 214 | =item int B<SSL_CTX_add_session>(SSL_CTX *ctx, SSL_SESSION *c); |
215 | 215 | ||
216 | =item int B<SSL_CTX_check_private_key>(SSL_CTX *ctx); | 216 | =item int B<SSL_CTX_check_private_key>(const SSL_CTX *ctx); |
217 | 217 | ||
218 | =item long B<SSL_CTX_ctrl>(SSL_CTX *ctx, int cmd, long larg, char *parg); | 218 | =item long B<SSL_CTX_ctrl>(SSL_CTX *ctx, int cmd, long larg, char *parg); |
219 | 219 | ||
@@ -225,23 +225,23 @@ protocol context defined in the B<SSL_CTX> structure. | |||
225 | 225 | ||
226 | =item X509_STORE *B<SSL_CTX_get_cert_store>(SSL_CTX *ctx); | 226 | =item X509_STORE *B<SSL_CTX_get_cert_store>(SSL_CTX *ctx); |
227 | 227 | ||
228 | =item STACK *B<SSL_CTX_get_client_CA_list>(SSL_CTX *ctx); | 228 | =item STACK *B<SSL_CTX_get_client_CA_list>(const SSL_CTX *ctx); |
229 | 229 | ||
230 | =item int (*B<SSL_CTX_get_client_cert_cb>(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); | 230 | =item int (*B<SSL_CTX_get_client_cert_cb>(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); |
231 | 231 | ||
232 | =item char *B<SSL_CTX_get_ex_data>(SSL_CTX *s, int idx); | 232 | =item char *B<SSL_CTX_get_ex_data>(const SSL_CTX *s, int idx); |
233 | 233 | ||
234 | =item int B<SSL_CTX_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | 234 | =item int B<SSL_CTX_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) |
235 | 235 | ||
236 | =item void (*B<SSL_CTX_get_info_callback>(SSL_CTX *ctx))(SSL *ssl, int cb, int ret); | 236 | =item void (*B<SSL_CTX_get_info_callback>(SSL_CTX *ctx))(SSL *ssl, int cb, int ret); |
237 | 237 | ||
238 | =item int B<SSL_CTX_get_quiet_shutdown>(SSL_CTX *ctx); | 238 | =item int B<SSL_CTX_get_quiet_shutdown>(const SSL_CTX *ctx); |
239 | 239 | ||
240 | =item int B<SSL_CTX_get_session_cache_mode>(SSL_CTX *ctx); | 240 | =item int B<SSL_CTX_get_session_cache_mode>(SSL_CTX *ctx); |
241 | 241 | ||
242 | =item long B<SSL_CTX_get_timeout>(SSL_CTX *ctx); | 242 | =item long B<SSL_CTX_get_timeout>(const SSL_CTX *ctx); |
243 | 243 | ||
244 | =item int (*B<SSL_CTX_get_verify_callback>(SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx); | 244 | =item int (*B<SSL_CTX_get_verify_callback>(const SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx); |
245 | 245 | ||
246 | =item int B<SSL_CTX_get_verify_mode>(SSL_CTX *ctx); | 246 | =item int B<SSL_CTX_get_verify_mode>(SSL_CTX *ctx); |
247 | 247 | ||
@@ -383,27 +383,27 @@ sessions defined in the B<SSL_SESSION> structures. | |||
383 | 383 | ||
384 | =over 4 | 384 | =over 4 |
385 | 385 | ||
386 | =item int B<SSL_SESSION_cmp>(SSL_SESSION *a, SSL_SESSION *b); | 386 | =item int B<SSL_SESSION_cmp>(const SSL_SESSION *a, const SSL_SESSION *b); |
387 | 387 | ||
388 | =item void B<SSL_SESSION_free>(SSL_SESSION *ss); | 388 | =item void B<SSL_SESSION_free>(SSL_SESSION *ss); |
389 | 389 | ||
390 | =item char *B<SSL_SESSION_get_app_data>(SSL_SESSION *s); | 390 | =item char *B<SSL_SESSION_get_app_data>(SSL_SESSION *s); |
391 | 391 | ||
392 | =item char *B<SSL_SESSION_get_ex_data>(SSL_SESSION *s, int idx); | 392 | =item char *B<SSL_SESSION_get_ex_data>(const SSL_SESSION *s, int idx); |
393 | 393 | ||
394 | =item int B<SSL_SESSION_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | 394 | =item int B<SSL_SESSION_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) |
395 | 395 | ||
396 | =item long B<SSL_SESSION_get_time>(SSL_SESSION *s); | 396 | =item long B<SSL_SESSION_get_time>(const SSL_SESSION *s); |
397 | 397 | ||
398 | =item long B<SSL_SESSION_get_timeout>(SSL_SESSION *s); | 398 | =item long B<SSL_SESSION_get_timeout>(const SSL_SESSION *s); |
399 | 399 | ||
400 | =item unsigned long B<SSL_SESSION_hash>(SSL_SESSION *a); | 400 | =item unsigned long B<SSL_SESSION_hash>(const SSL_SESSION *a); |
401 | 401 | ||
402 | =item SSL_SESSION *B<SSL_SESSION_new>(void); | 402 | =item SSL_SESSION *B<SSL_SESSION_new>(void); |
403 | 403 | ||
404 | =item int B<SSL_SESSION_print>(BIO *bp, SSL_SESSION *x); | 404 | =item int B<SSL_SESSION_print>(BIO *bp, const SSL_SESSION *x); |
405 | 405 | ||
406 | =item int B<SSL_SESSION_print_fp>(FILE *fp, SSL_SESSION *x); | 406 | =item int B<SSL_SESSION_print_fp>(FILE *fp, const SSL_SESSION *x); |
407 | 407 | ||
408 | =item void B<SSL_SESSION_set_app_data>(SSL_SESSION *s, char *a); | 408 | =item void B<SSL_SESSION_set_app_data>(SSL_SESSION *s, char *a); |
409 | 409 | ||
@@ -438,7 +438,7 @@ connection defined in the B<SSL> structure. | |||
438 | 438 | ||
439 | =item char *B<SSL_alert_type_string_long>(int value); | 439 | =item char *B<SSL_alert_type_string_long>(int value); |
440 | 440 | ||
441 | =item int B<SSL_check_private_key>(SSL *ssl); | 441 | =item int B<SSL_check_private_key>(const SSL *ssl); |
442 | 442 | ||
443 | =item void B<SSL_clear>(SSL *ssl); | 443 | =item void B<SSL_clear>(SSL *ssl); |
444 | 444 | ||
@@ -446,7 +446,7 @@ connection defined in the B<SSL> structure. | |||
446 | 446 | ||
447 | =item int B<SSL_connect>(SSL *ssl); | 447 | =item int B<SSL_connect>(SSL *ssl); |
448 | 448 | ||
449 | =item void B<SSL_copy_session_id>(SSL *t, SSL *f); | 449 | =item void B<SSL_copy_session_id>(SSL *t, const SSL *f); |
450 | 450 | ||
451 | =item long B<SSL_ctrl>(SSL *ssl, int cmd, long larg, char *parg); | 451 | =item long B<SSL_ctrl>(SSL *ssl, int cmd, long larg, char *parg); |
452 | 452 | ||
@@ -458,77 +458,77 @@ connection defined in the B<SSL> structure. | |||
458 | 458 | ||
459 | =item void B<SSL_free>(SSL *ssl); | 459 | =item void B<SSL_free>(SSL *ssl); |
460 | 460 | ||
461 | =item SSL_CTX *B<SSL_get_SSL_CTX>(SSL *ssl); | 461 | =item SSL_CTX *B<SSL_get_SSL_CTX>(const SSL *ssl); |
462 | 462 | ||
463 | =item char *B<SSL_get_app_data>(SSL *ssl); | 463 | =item char *B<SSL_get_app_data>(SSL *ssl); |
464 | 464 | ||
465 | =item X509 *B<SSL_get_certificate>(SSL *ssl); | 465 | =item X509 *B<SSL_get_certificate>(const SSL *ssl); |
466 | 466 | ||
467 | =item const char *B<SSL_get_cipher>(SSL *ssl); | 467 | =item const char *B<SSL_get_cipher>(const SSL *ssl); |
468 | 468 | ||
469 | =item int B<SSL_get_cipher_bits>(SSL *ssl, int *alg_bits); | 469 | =item int B<SSL_get_cipher_bits>(const SSL *ssl, int *alg_bits); |
470 | 470 | ||
471 | =item char *B<SSL_get_cipher_list>(SSL *ssl, int n); | 471 | =item char *B<SSL_get_cipher_list>(const SSL *ssl, int n); |
472 | 472 | ||
473 | =item char *B<SSL_get_cipher_name>(SSL *ssl); | 473 | =item char *B<SSL_get_cipher_name>(const SSL *ssl); |
474 | 474 | ||
475 | =item char *B<SSL_get_cipher_version>(SSL *ssl); | 475 | =item char *B<SSL_get_cipher_version>(const SSL *ssl); |
476 | 476 | ||
477 | =item STACK *B<SSL_get_ciphers>(SSL *ssl); | 477 | =item STACK *B<SSL_get_ciphers>(const SSL *ssl); |
478 | 478 | ||
479 | =item STACK *B<SSL_get_client_CA_list>(SSL *ssl); | 479 | =item STACK *B<SSL_get_client_CA_list>(const SSL *ssl); |
480 | 480 | ||
481 | =item SSL_CIPHER *B<SSL_get_current_cipher>(SSL *ssl); | 481 | =item SSL_CIPHER *B<SSL_get_current_cipher>(SSL *ssl); |
482 | 482 | ||
483 | =item long B<SSL_get_default_timeout>(SSL *ssl); | 483 | =item long B<SSL_get_default_timeout>(const SSL *ssl); |
484 | 484 | ||
485 | =item int B<SSL_get_error>(SSL *ssl, int i); | 485 | =item int B<SSL_get_error>(const SSL *ssl, int i); |
486 | 486 | ||
487 | =item char *B<SSL_get_ex_data>(SSL *ssl, int idx); | 487 | =item char *B<SSL_get_ex_data>(const SSL *ssl, int idx); |
488 | 488 | ||
489 | =item int B<SSL_get_ex_data_X509_STORE_CTX_idx>(void); | 489 | =item int B<SSL_get_ex_data_X509_STORE_CTX_idx>(void); |
490 | 490 | ||
491 | =item int B<SSL_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | 491 | =item int B<SSL_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) |
492 | 492 | ||
493 | =item int B<SSL_get_fd>(SSL *ssl); | 493 | =item int B<SSL_get_fd>(const SSL *ssl); |
494 | 494 | ||
495 | =item void (*B<SSL_get_info_callback>(SSL *ssl);)(void) | 495 | =item void (*B<SSL_get_info_callback>(const SSL *ssl);)() |
496 | 496 | ||
497 | =item STACK *B<SSL_get_peer_cert_chain>(SSL *ssl); | 497 | =item STACK *B<SSL_get_peer_cert_chain>(const SSL *ssl); |
498 | 498 | ||
499 | =item X509 *B<SSL_get_peer_certificate>(SSL *ssl); | 499 | =item X509 *B<SSL_get_peer_certificate>(const SSL *ssl); |
500 | 500 | ||
501 | =item EVP_PKEY *B<SSL_get_privatekey>(SSL *ssl); | 501 | =item EVP_PKEY *B<SSL_get_privatekey>(SSL *ssl); |
502 | 502 | ||
503 | =item int B<SSL_get_quiet_shutdown>(SSL *ssl); | 503 | =item int B<SSL_get_quiet_shutdown>(const SSL *ssl); |
504 | 504 | ||
505 | =item BIO *B<SSL_get_rbio>(SSL *ssl); | 505 | =item BIO *B<SSL_get_rbio>(const SSL *ssl); |
506 | 506 | ||
507 | =item int B<SSL_get_read_ahead>(SSL *ssl); | 507 | =item int B<SSL_get_read_ahead>(const SSL *ssl); |
508 | 508 | ||
509 | =item SSL_SESSION *B<SSL_get_session>(SSL *ssl); | 509 | =item SSL_SESSION *B<SSL_get_session>(const SSL *ssl); |
510 | 510 | ||
511 | =item char *B<SSL_get_shared_ciphers>(SSL *ssl, char *buf, int len); | 511 | =item char *B<SSL_get_shared_ciphers>(const SSL *ssl, char *buf, int len); |
512 | 512 | ||
513 | =item int B<SSL_get_shutdown>(SSL *ssl); | 513 | =item int B<SSL_get_shutdown>(const SSL *ssl); |
514 | 514 | ||
515 | =item SSL_METHOD *B<SSL_get_ssl_method>(SSL *ssl); | 515 | =item SSL_METHOD *B<SSL_get_ssl_method>(SSL *ssl); |
516 | 516 | ||
517 | =item int B<SSL_get_state>(SSL *ssl); | 517 | =item int B<SSL_get_state>(const SSL *ssl); |
518 | 518 | ||
519 | =item long B<SSL_get_time>(SSL *ssl); | 519 | =item long B<SSL_get_time>(const SSL *ssl); |
520 | 520 | ||
521 | =item long B<SSL_get_timeout>(SSL *ssl); | 521 | =item long B<SSL_get_timeout>(const SSL *ssl); |
522 | 522 | ||
523 | =item int (*B<SSL_get_verify_callback>(SSL *ssl);)(void) | 523 | =item int (*B<SSL_get_verify_callback>(const SSL *ssl))(int,X509_STORE_CTX *) |
524 | 524 | ||
525 | =item int B<SSL_get_verify_mode>(SSL *ssl); | 525 | =item int B<SSL_get_verify_mode>(const SSL *ssl); |
526 | 526 | ||
527 | =item long B<SSL_get_verify_result>(SSL *ssl); | 527 | =item long B<SSL_get_verify_result>(const SSL *ssl); |
528 | 528 | ||
529 | =item char *B<SSL_get_version>(SSL *ssl); | 529 | =item char *B<SSL_get_version>(const SSL *ssl); |
530 | 530 | ||
531 | =item BIO *B<SSL_get_wbio>(SSL *ssl); | 531 | =item BIO *B<SSL_get_wbio>(const SSL *ssl); |
532 | 532 | ||
533 | =item int B<SSL_in_accept_init>(SSL *ssl); | 533 | =item int B<SSL_in_accept_init>(SSL *ssl); |
534 | 534 | ||
@@ -550,7 +550,7 @@ connection defined in the B<SSL> structure. | |||
550 | 550 | ||
551 | =item int B<SSL_peek>(SSL *ssl, void *buf, int num); | 551 | =item int B<SSL_peek>(SSL *ssl, void *buf, int num); |
552 | 552 | ||
553 | =item int B<SSL_pending>(SSL *ssl); | 553 | =item int B<SSL_pending>(const SSL *ssl); |
554 | 554 | ||
555 | =item int B<SSL_read>(SSL *ssl, void *buf, int num); | 555 | =item int B<SSL_read>(SSL *ssl, void *buf, int num); |
556 | 556 | ||
@@ -610,11 +610,11 @@ connection defined in the B<SSL> structure. | |||
610 | 610 | ||
611 | =item int B<SSL_shutdown>(SSL *ssl); | 611 | =item int B<SSL_shutdown>(SSL *ssl); |
612 | 612 | ||
613 | =item int B<SSL_state>(SSL *ssl); | 613 | =item int B<SSL_state>(const SSL *ssl); |
614 | 614 | ||
615 | =item char *B<SSL_state_string>(SSL *ssl); | 615 | =item char *B<SSL_state_string>(const SSL *ssl); |
616 | 616 | ||
617 | =item char *B<SSL_state_string_long>(SSL *ssl); | 617 | =item char *B<SSL_state_string_long>(const SSL *ssl); |
618 | 618 | ||
619 | =item long B<SSL_total_renegotiations>(SSL *ssl); | 619 | =item long B<SSL_total_renegotiations>(SSL *ssl); |
620 | 620 | ||
@@ -636,17 +636,17 @@ connection defined in the B<SSL> structure. | |||
636 | 636 | ||
637 | =item int B<SSL_use_certificate_file>(SSL *ssl, char *file, int type); | 637 | =item int B<SSL_use_certificate_file>(SSL *ssl, char *file, int type); |
638 | 638 | ||
639 | =item int B<SSL_version>(SSL *ssl); | 639 | =item int B<SSL_version>(const SSL *ssl); |
640 | 640 | ||
641 | =item int B<SSL_want>(SSL *ssl); | 641 | =item int B<SSL_want>(const SSL *ssl); |
642 | 642 | ||
643 | =item int B<SSL_want_nothing>(SSL *ssl); | 643 | =item int B<SSL_want_nothing>(const SSL *ssl); |
644 | 644 | ||
645 | =item int B<SSL_want_read>(SSL *ssl); | 645 | =item int B<SSL_want_read>(const SSL *ssl); |
646 | 646 | ||
647 | =item int B<SSL_want_write>(SSL *ssl); | 647 | =item int B<SSL_want_write>(const SSL *ssl); |
648 | 648 | ||
649 | =item int B<SSL_want_x509_lookup>(s); | 649 | =item int B<SSL_want_x509_lookup>(const SSL *ssl); |
650 | 650 | ||
651 | =item int B<SSL_write>(SSL *ssl, const void *buf, int num); | 651 | =item int B<SSL_write>(SSL *ssl, const void *buf, int num); |
652 | 652 | ||
diff --git a/src/lib/libssl/src/doc/standards.txt b/src/lib/libssl/src/doc/standards.txt index edbe2f3a57..f6675b574b 100644 --- a/src/lib/libssl/src/doc/standards.txt +++ b/src/lib/libssl/src/doc/standards.txt | |||
@@ -88,6 +88,10 @@ PKCS#12: Personal Information Exchange Syntax Standard, version 1.0. | |||
88 | (Format: TXT=143173 bytes) (Obsoletes RFC2437) (Status: | 88 | (Format: TXT=143173 bytes) (Obsoletes RFC2437) (Status: |
89 | INFORMATIONAL) | 89 | INFORMATIONAL) |
90 | 90 | ||
91 | 3820 Internet X.509 Public Key Infrastructure (PKI) Proxy Certificate | ||
92 | Profile. S. Tuecke, V. Welch, D. Engert, L. Pearlman, M. Thompson. | ||
93 | June 2004. (Format: TXT=86374 bytes) (Status: PROPOSED STANDARD) | ||
94 | |||
91 | 95 | ||
92 | Related: | 96 | Related: |
93 | -------- | 97 | -------- |
diff --git a/src/lib/libssl/src/e_os.h b/src/lib/libssl/src/e_os.h index 096eabe09a..5a328b7fa8 100644 --- a/src/lib/libssl/src/e_os.h +++ b/src/lib/libssl/src/e_os.h | |||
@@ -510,11 +510,31 @@ extern char *sys_errlist[]; extern int sys_nerr; | |||
510 | #define IRIX_CC_BUG /* CDS++ up to V2.0Bsomething suffered from the same bug.*/ | 510 | #define IRIX_CC_BUG /* CDS++ up to V2.0Bsomething suffered from the same bug.*/ |
511 | #endif | 511 | #endif |
512 | 512 | ||
513 | #if defined(OPENSSL_SYS_WINDOWS) | ||
514 | # define strcasecmp _stricmp | ||
515 | # define strncasecmp _strnicmp | ||
516 | #elif defined(OPENSSL_SYS_VMS) | ||
517 | /* VMS below version 7.0 doesn't have strcasecmp() */ | ||
518 | # include "o_str.h" | ||
519 | # define strcasecmp OPENSSL_strcasecmp | ||
520 | # define strncasecmp OPENSSL_strncasecmp | ||
521 | # define OPENSSL_IMPLEMENTS_strncasecmp | ||
522 | #elif defined(OPENSSL_SYS_OS2) && defined(__EMX__) | ||
523 | # define strcasecmp stricmp | ||
524 | # define strncasecmp strnicmp | ||
525 | #else | ||
526 | # ifdef NO_STRINGS_H | ||
527 | int strcasecmp(); | ||
528 | int strncasecmp(); | ||
529 | # else | ||
530 | # include <strings.h> | ||
531 | # endif /* NO_STRINGS_H */ | ||
532 | #endif | ||
533 | |||
513 | #if defined(OPENSSL_SYS_OS2) && defined(__EMX__) | 534 | #if defined(OPENSSL_SYS_OS2) && defined(__EMX__) |
514 | # include <io.h> | 535 | # include <io.h> |
515 | # include <fcntl.h> | 536 | # include <fcntl.h> |
516 | # define NO_SYSLOG | 537 | # define NO_SYSLOG |
517 | # define strcasecmp stricmp | ||
518 | #endif | 538 | #endif |
519 | 539 | ||
520 | /* vxworks */ | 540 | /* vxworks */ |
diff --git a/src/lib/libssl/src/e_os2.h b/src/lib/libssl/src/e_os2.h index 81be3025f6..4ca79a4d65 100644 --- a/src/lib/libssl/src/e_os2.h +++ b/src/lib/libssl/src/e_os2.h | |||
@@ -189,6 +189,11 @@ extern "C" { | |||
189 | # endif | 189 | # endif |
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | /* --------------------------------- VOS ----------------------------------- */ | ||
193 | #ifdef OPENSSL_SYSNAME_VOS | ||
194 | # define OPENSSL_SYS_VOS | ||
195 | #endif | ||
196 | |||
192 | /* ------------------------------- VxWorks --------------------------------- */ | 197 | /* ------------------------------- VxWorks --------------------------------- */ |
193 | #ifdef OPENSSL_SYSNAME_VXWORKS | 198 | #ifdef OPENSSL_SYSNAME_VXWORKS |
194 | # define OPENSSL_SYS_VXWORKS | 199 | # define OPENSSL_SYS_VXWORKS |
@@ -243,7 +248,7 @@ extern "C" { | |||
243 | #define OPENSSL_EXTERN OPENSSL_IMPORT | 248 | #define OPENSSL_EXTERN OPENSSL_IMPORT |
244 | 249 | ||
245 | /* Macros to allow global variables to be reached through function calls when | 250 | /* Macros to allow global variables to be reached through function calls when |
246 | required (if a shared library version requvres it, for example. | 251 | required (if a shared library version requires it, for example. |
247 | The way it's done allows definitions like this: | 252 | The way it's done allows definitions like this: |
248 | 253 | ||
249 | // in foobar.c | 254 | // in foobar.c |
@@ -253,9 +258,10 @@ extern "C" { | |||
253 | #define foobar OPENSSL_GLOBAL_REF(foobar) | 258 | #define foobar OPENSSL_GLOBAL_REF(foobar) |
254 | */ | 259 | */ |
255 | #ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION | 260 | #ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION |
256 | # define OPENSSL_IMPLEMENT_GLOBAL(type,name) static type _hide_##name; \ | 261 | # define OPENSSL_IMPLEMENT_GLOBAL(type,name) \ |
257 | type *_shadow_##name(void) { return &_hide_##name; } \ | 262 | extern type _hide_##name; \ |
258 | static type _hide_##name | 263 | type *_shadow_##name(void) { return &_hide_##name; } \ |
264 | static type _hide_##name | ||
259 | # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) | 265 | # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) |
260 | # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) | 266 | # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) |
261 | #else | 267 | #else |
diff --git a/src/lib/libssl/src/install.com b/src/lib/libssl/src/install.com index 4e4fe80dfe..8de3a7f977 100644 --- a/src/lib/libssl/src/install.com +++ b/src/lib/libssl/src/install.com | |||
@@ -52,23 +52,23 @@ $ IF F$PARSE("WRK_SSLPRIVATE:") .EQS. "" THEN - | |||
52 | $ IF F$PARSE("WRK_SSLROOT:[VMS]") .EQS. "" THEN - | 52 | $ IF F$PARSE("WRK_SSLROOT:[VMS]") .EQS. "" THEN - |
53 | CREATE/DIR/LOG WRK_SSLROOT:[VMS] | 53 | CREATE/DIR/LOG WRK_SSLROOT:[VMS] |
54 | $ | 54 | $ |
55 | $ SDIRS := CRYPTO,SSL,APPS,VMS!,RSAREF,TEST,TOOLS | 55 | $ DIRS := CRYPTO,FIPS,SSL,APPS,VMS!,RSAREF,TEST,TOOLS |
56 | $ EXHEADER := e_os2.h | 56 | $ EXHEADER := e_os2.h |
57 | $ | 57 | $ |
58 | $ COPY 'EXHEADER' WRK_SSLINCLUDE: /LOG | 58 | $ COPY 'EXHEADER' WRK_SSLINCLUDE: /LOG |
59 | $ SET FILE/PROT=WORLD:RE WRK_SSLINCLUDE:'EXHEADER' | 59 | $ SET FILE/PROT=WORLD:RE WRK_SSLINCLUDE:'EXHEADER' |
60 | $ | 60 | $ |
61 | $ I = 0 | 61 | $ I = 0 |
62 | $ LOOP_SDIRS: | 62 | $ LOOP_DIRS: |
63 | $ D = F$ELEMENT(I, ",", SDIRS) | 63 | $ D = F$ELEMENT(I, ",", DIRS) |
64 | $ I = I + 1 | 64 | $ I = I + 1 |
65 | $ IF D .EQS. "," THEN GOTO LOOP_SDIRS_END | 65 | $ IF D .EQS. "," THEN GOTO LOOP_DIRS_END |
66 | $ WRITE SYS$OUTPUT "Installing ",D," files." | 66 | $ WRITE SYS$OUTPUT "Installing ",D," files." |
67 | $ SET DEFAULT [.'D'] | 67 | $ SET DEFAULT [.'D'] |
68 | $ @INSTALL 'ROOT'] | 68 | $ @INSTALL 'ROOT'] |
69 | $ SET DEFAULT [-] | 69 | $ SET DEFAULT [-] |
70 | $ GOTO LOOP_SDIRS | 70 | $ GOTO LOOP_DIRS |
71 | $ LOOP_SDIRS_END: | 71 | $ LOOP_DIRS_END: |
72 | $ | 72 | $ |
73 | $ DEASSIGN WRK_SSLROOT | 73 | $ DEASSIGN WRK_SSLROOT |
74 | $ DEASSIGN WRK_SSLVLIB | 74 | $ DEASSIGN WRK_SSLVLIB |
diff --git a/src/lib/libssl/src/makevms.com b/src/lib/libssl/src/makevms.com index 443f3c15c5..d892fe9f0d 100644 --- a/src/lib/libssl/src/makevms.com +++ b/src/lib/libssl/src/makevms.com | |||
@@ -178,7 +178,7 @@ $ WRITE H_FILE "# define OPENSSL_SYS_VMS" | |||
178 | $ WRITE H_FILE "#endif" | 178 | $ WRITE H_FILE "#endif" |
179 | $ CONFIG_LOGICALS := NO_ASM,NO_RSA,NO_DSA,NO_DH,NO_MD2,NO_MD5,NO_RIPEMD,- | 179 | $ CONFIG_LOGICALS := NO_ASM,NO_RSA,NO_DSA,NO_DH,NO_MD2,NO_MD5,NO_RIPEMD,- |
180 | NO_SHA,NO_SHA0,NO_SHA1,NO_DES/NO_MDC2;NO_MDC2,NO_RC2,NO_RC4,NO_RC5,- | 180 | NO_SHA,NO_SHA0,NO_SHA1,NO_DES/NO_MDC2;NO_MDC2,NO_RC2,NO_RC4,NO_RC5,- |
181 | NO_IDEA,NO_BF,NO_CAST,NO_HMAC,NO_SSL2 | 181 | NO_IDEA,NO_BF,NO_CAST,NO_HMAC,NO_SSL2,FIPS |
182 | $ CONFIG_LOG_I = 0 | 182 | $ CONFIG_LOG_I = 0 |
183 | $ CONFIG_LOG_LOOP: | 183 | $ CONFIG_LOG_LOOP: |
184 | $ CONFIG_LOG_E1 = F$ELEMENT(CONFIG_LOG_I,",",CONFIG_LOGICALS) | 184 | $ CONFIG_LOG_E1 = F$ELEMENT(CONFIG_LOG_I,",",CONFIG_LOGICALS) |
@@ -357,7 +357,7 @@ $! Copy a lot of files around. | |||
357 | $! | 357 | $! |
358 | $ SOFTLINKS: | 358 | $ SOFTLINKS: |
359 | $! | 359 | $! |
360 | $! Tell The User We Are Partly Rebuilding The [.TEST] Directory. | 360 | $! Tell The User We Are Partly Rebuilding The [.APPS] Directory. |
361 | $! | 361 | $! |
362 | $ WRITE SYS$OUTPUT "Rebuilding The '[.APPS]MD4.C', '[.APPS]MD5.C' And '[.APPS]RMD160.C' Files." | 362 | $ WRITE SYS$OUTPUT "Rebuilding The '[.APPS]MD4.C', '[.APPS]MD5.C' And '[.APPS]RMD160.C' Files." |
363 | $! | 363 | $! |
@@ -480,6 +480,33 @@ $! | |||
480 | $ EXHEADER := ssl.h,ssl2.h,ssl3.h,ssl23.h,tls1.h,kssl.h | 480 | $ EXHEADER := ssl.h,ssl2.h,ssl3.h,ssl23.h,tls1.h,kssl.h |
481 | $ COPY SYS$DISK:[.SSL]'EXHEADER' SYS$DISK:[.INCLUDE.OPENSSL] | 481 | $ COPY SYS$DISK:[.SSL]'EXHEADER' SYS$DISK:[.INCLUDE.OPENSSL] |
482 | $! | 482 | $! |
483 | $! Copy All The ".H" Files From The [.FIPS] Directories. | ||
484 | $! | ||
485 | $ FDIRS := ,SHA1,RAND,DES,AES,DSA,RSA | ||
486 | $ EXHEADER_ := fips.h | ||
487 | $ EXHEADER_SHA1 := | ||
488 | $ EXHEADER_RAND := fips_rand.h | ||
489 | $ EXHEADER_DES := | ||
490 | $ EXHEADER_AES := | ||
491 | $ EXHEADER_DSA := | ||
492 | $ EXHEADER_RSA := | ||
493 | $ | ||
494 | $ I = 0 | ||
495 | $ LOOP_FDIRS: | ||
496 | $ D = F$EDIT(F$ELEMENT(I, ",", FDIRS),"TRIM") | ||
497 | $ I = I + 1 | ||
498 | $ IF D .EQS. "," THEN GOTO LOOP_FDIRS_END | ||
499 | $ tmp = EXHEADER_'D' | ||
500 | $ IF tmp .EQS. "" THEN GOTO LOOP_FDIRS | ||
501 | $ IF D .EQS. "" | ||
502 | $ THEN | ||
503 | $ COPY [.FIPS]'tmp' SYS$DISK:[.INCLUDE.OPENSSL] !/LOG | ||
504 | $ ELSE | ||
505 | $ COPY [.FIPS.'D']'tmp' SYS$DISK:[.INCLUDE.OPENSSL] !/LOG | ||
506 | $ ENDIF | ||
507 | $ GOTO LOOP_FDIRS | ||
508 | $ LOOP_FDIRS_END: | ||
509 | $! | ||
483 | $! Purge all doubles | 510 | $! Purge all doubles |
484 | $! | 511 | $! |
485 | $ PURGE SYS$DISK:[.INCLUDE.OPENSSL]*.H | 512 | $ PURGE SYS$DISK:[.INCLUDE.OPENSSL]*.H |
@@ -505,9 +532,21 @@ $! Build The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library. | |||
505 | $! | 532 | $! |
506 | $ @CRYPTO-LIB LIBRARY 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''BUILDPART'" | 533 | $ @CRYPTO-LIB LIBRARY 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''BUILDPART'" |
507 | $! | 534 | $! |
535 | $! Go Back To The Main Directory. | ||
536 | $! | ||
537 | $ SET DEFAULT [-] | ||
538 | $! | ||
539 | $! Go To The [.FIPS] Directory. | ||
540 | $! | ||
541 | $ SET DEFAULT SYS$DISK:[.FIPS] | ||
542 | $! | ||
543 | $! Build The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library. | ||
544 | $! | ||
545 | $ @FIPS-LIB LIBRARY 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''BUILDPART'" | ||
546 | $! | ||
508 | $! Build The [.xxx.EXE.CRYPTO]*.EXE Test Applications. | 547 | $! Build The [.xxx.EXE.CRYPTO]*.EXE Test Applications. |
509 | $! | 548 | $! |
510 | $ @CRYPTO-LIB APPS 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN' | 549 | $ @FIPS-LIB APPS 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN' |
511 | $! | 550 | $! |
512 | $! Go Back To The Main Directory. | 551 | $! Go Back To The Main Directory. |
513 | $! | 552 | $! |
diff --git a/src/lib/libssl/src/ms/do_masm.bat b/src/lib/libssl/src/ms/do_masm.bat index f4c958c561..61c52562f7 100644 --- a/src/lib/libssl/src/ms/do_masm.bat +++ b/src/lib/libssl/src/ms/do_masm.bat | |||
@@ -1,3 +1,5 @@ | |||
1 | rem use "fips" as the first argument to make a proper FIPS build. | ||
2 | |||
1 | @echo off | 3 | @echo off |
2 | echo Generating x86 for MASM assember | 4 | echo Generating x86 for MASM assember |
3 | 5 | ||
@@ -56,13 +58,13 @@ cd ..\..\.. | |||
56 | echo on | 58 | echo on |
57 | 59 | ||
58 | perl util\mkfiles.pl >MINFO | 60 | perl util\mkfiles.pl >MINFO |
59 | rem perl util\mk1mf.pl VC-MSDOS no-sock >ms\msdos.mak | 61 | rem perl util\mk1mf.pl no-sock %1 VC-MSDOS >ms\msdos.mak |
60 | rem perl util\mk1mf.pl VC-W31-32 >ms\w31.mak | 62 | rem perl util\mk1mf.pl %1 VC-W31-32 >ms\w31.mak |
61 | perl util\mk1mf.pl dll VC-W31-32 >ms\w31dll.mak | 63 | perl util\mk1mf.pl dll %1 VC-W31-32 >ms\w31dll.mak |
62 | perl util\mk1mf.pl VC-WIN32 >ms\nt.mak | 64 | perl util\mk1mf.pl %1 VC-WIN32 >ms\nt.mak |
63 | perl util\mk1mf.pl dll VC-WIN32 >ms\ntdll.mak | 65 | perl util\mk1mf.pl dll %1 VC-WIN32 >ms\ntdll.mak |
64 | 66 | ||
65 | perl util\mkdef.pl 16 libeay > ms\libeay16.def | 67 | perl util\mkdef.pl 16 libeay %1 > ms\libeay16.def |
66 | perl util\mkdef.pl 32 libeay > ms\libeay32.def | 68 | perl util\mkdef.pl 32 libeay %1 > ms\libeay32.def |
67 | perl util\mkdef.pl 16 ssleay > ms\ssleay16.def | 69 | perl util\mkdef.pl 16 ssleay %1 > ms\ssleay16.def |
68 | perl util\mkdef.pl 32 ssleay > ms\ssleay32.def | 70 | perl util\mkdef.pl 32 ssleay %1 > ms\ssleay32.def |
diff --git a/src/lib/libssl/src/ms/do_ms.bat b/src/lib/libssl/src/ms/do_ms.bat index a8cf515bac..72179708bf 100644 --- a/src/lib/libssl/src/ms/do_ms.bat +++ b/src/lib/libssl/src/ms/do_ms.bat | |||
@@ -1,14 +1,14 @@ | |||
1 | 1 | ||
2 | perl util\mkfiles.pl >MINFO | 2 | perl util\mkfiles.pl >MINFO |
3 | rem perl util\mk1mf.pl VC-MSDOS no-sock >ms\msdos.mak | 3 | rem perl util\mk1mf.pl no-sock %1 VC-MSDOS >ms\msdos.mak |
4 | rem perl util\mk1mf.pl VC-W31-32 >ms\w31.mak | 4 | rem perl util\mk1mf.pl %1 VC-W31-32 >ms\w31.mak |
5 | perl util\mk1mf.pl dll VC-W31-32 >ms\w31dll.mak | 5 | perl util\mk1mf.pl dll %1 VC-W31-32 >ms\w31dll.mak |
6 | perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak | 6 | perl util\mk1mf.pl no-asm %1 VC-WIN32 >ms\nt.mak |
7 | perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak | 7 | perl util\mk1mf.pl dll no-asm %1 VC-WIN32 >ms\ntdll.mak |
8 | perl util\mk1mf.pl no-asm VC-CE >ms\ce.mak | 8 | perl util\mk1mf.pl no-asm %1 VC-CE >ms\ce.mak |
9 | perl util\mk1mf.pl dll no-asm VC-CE >ms\cedll.mak | 9 | perl util\mk1mf.pl dll no-asm %1 VC-CE >ms\cedll.mak |
10 | 10 | ||
11 | perl util\mkdef.pl 16 libeay > ms\libeay16.def | 11 | perl util\mkdef.pl 16 libeay %1 > ms\libeay16.def |
12 | perl util\mkdef.pl 32 libeay > ms\libeay32.def | 12 | perl util\mkdef.pl 32 libeay %1 > ms\libeay32.def |
13 | perl util\mkdef.pl 16 ssleay > ms\ssleay16.def | 13 | perl util\mkdef.pl 16 ssleay %1 > ms\ssleay16.def |
14 | perl util\mkdef.pl 32 ssleay > ms\ssleay32.def | 14 | perl util\mkdef.pl 32 ssleay %1 > ms\ssleay32.def |
diff --git a/src/lib/libssl/src/ms/do_nasm.bat b/src/lib/libssl/src/ms/do_nasm.bat index 557f8a66d7..270dab0058 100644 --- a/src/lib/libssl/src/ms/do_nasm.bat +++ b/src/lib/libssl/src/ms/do_nasm.bat | |||
@@ -1,3 +1,4 @@ | |||
1 | rem use "fips" as the first argument to make a proper FIPS build. | ||
1 | 2 | ||
2 | @echo off | 3 | @echo off |
3 | echo Generating x86 for NASM assember | 4 | echo Generating x86 for NASM assember |
@@ -57,14 +58,14 @@ cd ..\..\.. | |||
57 | echo on | 58 | echo on |
58 | 59 | ||
59 | perl util\mkfiles.pl >MINFO | 60 | perl util\mkfiles.pl >MINFO |
60 | rem perl util\mk1mf.pl VC-MSDOS no-sock >ms\msdos.mak | 61 | rem perl util\mk1mf.pl no-sock %1 VC-MSDOS >ms\msdos.mak |
61 | rem perl util\mk1mf.pl VC-W31-32 >ms\w31.mak | 62 | rem perl util\mk1mf.pl %1 VC-W31-32 >ms\w31.mak |
62 | perl util\mk1mf.pl dll VC-W31-32 >ms\w31dll.mak | 63 | perl util\mk1mf.pl dll %1 VC-W31-32 >ms\w31dll.mak |
63 | perl util\mk1mf.pl nasm VC-WIN32 >ms\nt.mak | 64 | perl util\mk1mf.pl nasm %1 VC-WIN32 >ms\nt.mak |
64 | perl util\mk1mf.pl dll nasm VC-WIN32 >ms\ntdll.mak | 65 | perl util\mk1mf.pl dll nasm %1 VC-WIN32 >ms\ntdll.mak |
65 | perl util\mk1mf.pl nasm BC-NT >ms\bcb.mak | 66 | perl util\mk1mf.pl nasm %1 BC-NT >ms\bcb.mak |
66 | 67 | ||
67 | perl util\mkdef.pl 16 libeay > ms\libeay16.def | 68 | perl util\mkdef.pl 16 libeay %1 > ms\libeay16.def |
68 | perl util\mkdef.pl 32 libeay > ms\libeay32.def | 69 | perl util\mkdef.pl 32 libeay %1 > ms\libeay32.def |
69 | perl util\mkdef.pl 16 ssleay > ms\ssleay16.def | 70 | perl util\mkdef.pl 16 ssleay %1 > ms\ssleay16.def |
70 | perl util\mkdef.pl 32 ssleay > ms\ssleay32.def | 71 | perl util\mkdef.pl 32 ssleay %1 > ms\ssleay32.def |
diff --git a/src/lib/libssl/src/ms/do_nt.bat b/src/lib/libssl/src/ms/do_nt.bat index 9c06c27caa..66b408b283 100644 --- a/src/lib/libssl/src/ms/do_nt.bat +++ b/src/lib/libssl/src/ms/do_nt.bat | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | perl util\mkfiles.pl >MINFO | 2 | perl util\mkfiles.pl >MINFO |
3 | perl util\mk1mf.pl no-asm VC-NT >ms\nt.mak | 3 | perl util\mk1mf.pl no-asm %1 VC-NT >ms\nt.mak |
4 | perl util\mk1mf.pl dll no-asm VC-NT >ms\ntdll.mak | 4 | perl util\mk1mf.pl dll no-asm %1 VC-NT >ms\ntdll.mak |
5 | 5 | ||
6 | perl util\mkdef.pl libeay NT > ms\libeay32.def | 6 | perl util\mkdef.pl libeay NT %1 > ms\libeay32.def |
7 | perl util\mkdef.pl ssleay NT > ms\ssleay32.def | 7 | perl util\mkdef.pl ssleay NT %1 > ms\ssleay32.def |
diff --git a/src/lib/libssl/src/ms/test.bat b/src/lib/libssl/src/ms/test.bat index c3a1b0c28d..7fb0442147 100644 --- a/src/lib/libssl/src/ms/test.bat +++ b/src/lib/libssl/src/ms/test.bat | |||
@@ -87,20 +87,22 @@ echo testss | |||
87 | call %test%\testss openssl | 87 | call %test%\testss openssl |
88 | if errorlevel 1 goto done | 88 | if errorlevel 1 goto done |
89 | 89 | ||
90 | set SSL_TEST=ssltest -key keyU.ss -cert certU.ss -c_key keyU.ss -c_cert certU.ss -CAfile certCA.ss | ||
91 | |||
90 | echo test sslv2 | 92 | echo test sslv2 |
91 | ssltest -ssl2 | 93 | ssltest -ssl2 |
92 | if errorlevel 1 goto done | 94 | if errorlevel 1 goto done |
93 | 95 | ||
94 | echo test sslv2 with server authentication | 96 | echo test sslv2 with server authentication |
95 | ssltest -ssl2 -server_auth -CAfile cert.tmp | 97 | %SSL_TEST% -ssl2 -server_auth |
96 | if errorlevel 1 goto done | 98 | if errorlevel 1 goto done |
97 | 99 | ||
98 | echo test sslv2 with client authentication | 100 | echo test sslv2 with client authentication |
99 | ssltest -ssl2 -client_auth -CAfile cert.tmp | 101 | %SSL_TEST% -ssl2 -client_auth |
100 | if errorlevel 1 goto done | 102 | if errorlevel 1 goto done |
101 | 103 | ||
102 | echo test sslv2 with both client and server authentication | 104 | echo test sslv2 with both client and server authentication |
103 | ssltest -ssl2 -server_auth -client_auth -CAfile cert.tmp | 105 | %SSL_TEST% -ssl2 -server_auth -client_auth |
104 | if errorlevel 1 goto done | 106 | if errorlevel 1 goto done |
105 | 107 | ||
106 | echo test sslv3 | 108 | echo test sslv3 |
@@ -108,15 +110,15 @@ ssltest -ssl3 | |||
108 | if errorlevel 1 goto done | 110 | if errorlevel 1 goto done |
109 | 111 | ||
110 | echo test sslv3 with server authentication | 112 | echo test sslv3 with server authentication |
111 | ssltest -ssl3 -server_auth -CAfile cert.tmp | 113 | %SSL_TEST% -ssl3 -server_auth |
112 | if errorlevel 1 goto done | 114 | if errorlevel 1 goto done |
113 | 115 | ||
114 | echo test sslv3 with client authentication | 116 | echo test sslv3 with client authentication |
115 | ssltest -ssl3 -client_auth -CAfile cert.tmp | 117 | %SSL_TEST% -ssl3 -client_auth |
116 | if errorlevel 1 goto done | 118 | if errorlevel 1 goto done |
117 | 119 | ||
118 | echo test sslv3 with both client and server authentication | 120 | echo test sslv3 with both client and server authentication |
119 | ssltest -ssl3 -server_auth -client_auth -CAfile cert.tmp | 121 | %SSL_TEST% -ssl3 -server_auth -client_auth |
120 | if errorlevel 1 goto done | 122 | if errorlevel 1 goto done |
121 | 123 | ||
122 | echo test sslv2/sslv3 | 124 | echo test sslv2/sslv3 |
@@ -124,15 +126,15 @@ ssltest | |||
124 | if errorlevel 1 goto done | 126 | if errorlevel 1 goto done |
125 | 127 | ||
126 | echo test sslv2/sslv3 with server authentication | 128 | echo test sslv2/sslv3 with server authentication |
127 | ssltest -server_auth -CAfile cert.tmp | 129 | %SSL_TEST% -server_auth |
128 | if errorlevel 1 goto done | 130 | if errorlevel 1 goto done |
129 | 131 | ||
130 | echo test sslv2/sslv3 with client authentication | 132 | echo test sslv2/sslv3 with client authentication |
131 | ssltest -client_auth -CAfile cert.tmp | 133 | %SSL_TEST% -client_auth |
132 | if errorlevel 1 goto done | 134 | if errorlevel 1 goto done |
133 | 135 | ||
134 | echo test sslv2/sslv3 with both client and server authentication | 136 | echo test sslv2/sslv3 with both client and server authentication |
135 | ssltest -server_auth -client_auth -CAfile cert.tmp | 137 | %SSL_TEST% -server_auth -client_auth |
136 | if errorlevel 1 goto done | 138 | if errorlevel 1 goto done |
137 | 139 | ||
138 | echo test sslv2 via BIO pair | 140 | echo test sslv2 via BIO pair |
@@ -144,15 +146,15 @@ ssltest -bio_pair -dhe1024dsa -v | |||
144 | if errorlevel 1 goto done | 146 | if errorlevel 1 goto done |
145 | 147 | ||
146 | echo test sslv2 with server authentication via BIO pair | 148 | echo test sslv2 with server authentication via BIO pair |
147 | ssltest -bio_pair -ssl2 -server_auth -CAfile cert.tmp | 149 | %SSL_TEST% -bio_pair -ssl2 -server_auth |
148 | if errorlevel 1 goto done | 150 | if errorlevel 1 goto done |
149 | 151 | ||
150 | echo test sslv2 with client authentication via BIO pair | 152 | echo test sslv2 with client authentication via BIO pair |
151 | ssltest -bio_pair -ssl2 -client_auth -CAfile cert.tmp | 153 | %SSL_TEST% -bio_pair -ssl2 -client_auth |
152 | if errorlevel 1 goto done | 154 | if errorlevel 1 goto done |
153 | 155 | ||
154 | echo test sslv2 with both client and server authentication via BIO pair | 156 | echo test sslv2 with both client and server authentication via BIO pair |
155 | ssltest -bio_pair -ssl2 -server_auth -client_auth -CAfile cert.tmp | 157 | %SSL_TEST% -bio_pair -ssl2 -server_auth -client_auth |
156 | if errorlevel 1 goto done | 158 | if errorlevel 1 goto done |
157 | 159 | ||
158 | echo test sslv3 via BIO pair | 160 | echo test sslv3 via BIO pair |
@@ -160,31 +162,31 @@ ssltest -bio_pair -ssl3 | |||
160 | if errorlevel 1 goto done | 162 | if errorlevel 1 goto done |
161 | 163 | ||
162 | echo test sslv3 with server authentication via BIO pair | 164 | echo test sslv3 with server authentication via BIO pair |
163 | ssltest -bio_pair -ssl3 -server_auth -CAfile cert.tmp | 165 | %SSL_TEST% -bio_pair -ssl3 -server_auth |
164 | if errorlevel 1 goto done | 166 | if errorlevel 1 goto done |
165 | 167 | ||
166 | echo test sslv3 with client authentication via BIO pair | 168 | echo test sslv3 with client authentication via BIO pair |
167 | ssltest -bio_pair -ssl3 -client_auth -CAfile cert.tmp | 169 | %SSL_TEST% -bio_pair -ssl3 -client_auth |
168 | if errorlevel 1 goto done | 170 | if errorlevel 1 goto done |
169 | 171 | ||
170 | echo test sslv3 with both client and server authentication via BIO pair | 172 | echo test sslv3 with both client and server authentication via BIO pair |
171 | ssltest -bio_pair -ssl3 -server_auth -client_auth -CAfile cert.tmp | 173 | %SSL_TEST% -bio_pair -ssl3 -server_auth -client_auth |
172 | if errorlevel 1 goto done | 174 | if errorlevel 1 goto done |
173 | 175 | ||
174 | echo test sslv2/sslv3 via BIO pair | 176 | echo test sslv2/sslv3 via BIO pair |
175 | ssltest | 177 | ssltest -bio_pair |
176 | if errorlevel 1 goto done | 178 | if errorlevel 1 goto done |
177 | 179 | ||
178 | echo test sslv2/sslv3 with server authentication | 180 | echo test sslv2/sslv3 with server authentication |
179 | ssltest -bio_pair -server_auth -CAfile cert.tmp | 181 | %SSL_TEST% -bio_pair -server_auth |
180 | if errorlevel 1 goto done | 182 | if errorlevel 1 goto done |
181 | 183 | ||
182 | echo test sslv2/sslv3 with client authentication via BIO pair | 184 | echo test sslv2/sslv3 with client authentication via BIO pair |
183 | ssltest -bio_pair -client_auth -CAfile cert.tmp | 185 | %SSL_TEST% -bio_pair -client_auth |
184 | if errorlevel 1 goto done | 186 | if errorlevel 1 goto done |
185 | 187 | ||
186 | echo test sslv2/sslv3 with both client and server authentication via BIO pair | 188 | echo test sslv2/sslv3 with both client and server authentication via BIO pair |
187 | ssltest -bio_pair -server_auth -client_auth -CAfile cert.tmp | 189 | %SSL_TEST% -bio_pair -server_auth -client_auth |
188 | if errorlevel 1 goto done | 190 | if errorlevel 1 goto done |
189 | 191 | ||
190 | del cert.tmp | 192 | del cert.tmp |
diff --git a/src/lib/libssl/src/ms/testss.bat b/src/lib/libssl/src/ms/testss.bat index f7e58e2756..b4aaf3c601 100644 --- a/src/lib/libssl/src/ms/testss.bat +++ b/src/lib/libssl/src/ms/testss.bat | |||
@@ -4,7 +4,7 @@ rem set ssleay=..\out\ssleay | |||
4 | set ssleay=%1 | 4 | set ssleay=%1 |
5 | 5 | ||
6 | set reqcmd=%ssleay% req | 6 | set reqcmd=%ssleay% req |
7 | set x509cmd=%ssleay% x509 | 7 | set x509cmd=%ssleay% x509 -sha1 |
8 | set verifycmd=%ssleay% verify | 8 | set verifycmd=%ssleay% verify |
9 | 9 | ||
10 | set CAkey=keyCA.ss | 10 | set CAkey=keyCA.ss |
diff --git a/src/lib/libssl/src/openssl.spec b/src/lib/libssl/src/openssl.spec index 6a272f6969..98ef153e3b 100644 --- a/src/lib/libssl/src/openssl.spec +++ b/src/lib/libssl/src/openssl.spec | |||
@@ -1,7 +1,7 @@ | |||
1 | %define libmaj 0 | 1 | %define libmaj 0 |
2 | %define libmin 9 | 2 | %define libmin 9 |
3 | %define librel 7 | 3 | %define librel 7 |
4 | %define librev d | 4 | %define librev g |
5 | Release: 1 | 5 | Release: 1 |
6 | 6 | ||
7 | %define openssldir /var/ssl | 7 | %define openssldir /var/ssl |
diff --git a/src/lib/libssl/src/shlib/hpux10-cc.sh b/src/lib/libssl/src/shlib/hpux10-cc.sh index 81eb9d4cab..fcadda827d 100644 --- a/src/lib/libssl/src/shlib/hpux10-cc.sh +++ b/src/lib/libssl/src/shlib/hpux10-cc.sh | |||
@@ -74,9 +74,9 @@ make clean | |||
74 | 74 | ||
75 | # Hack the Makefiles to pick up the dynamic libraries during linking | 75 | # Hack the Makefiles to pick up the dynamic libraries during linking |
76 | # | 76 | # |
77 | sed 's/^PEX_LIBS=.*$/PEX_LIBS=-L\/usr\/local\/ssl\/lib/' Makefile.ssl >xxx; mv xxx Makefile.ssl | 77 | sed 's/^PEX_LIBS=.*$/PEX_LIBS=-L\/usr\/local\/ssl\/lib/' Makefile >xxx; mv xxx Makefile.ssl |
78 | sed 's/-L\.\.//' apps/Makefile.ssl >xxx; mv xxx apps/Makefile.ssl | 78 | sed 's/-L\.\.//' apps/Makefile >xxx; mv xxx apps/Makefile |
79 | sed 's/-L\.\.//' test/Makefile.ssl >xxx; mv xxx test/Makefile.ssl | 79 | sed 's/-L\.\.//' test/Makefile >xxx; mv xxx test/Makefile |
80 | # Build the static libs and the executables in one make. | 80 | # Build the static libs and the executables in one make. |
81 | make | 81 | make |
82 | # Install everything | 82 | # Install everything |
diff --git a/src/lib/libssl/src/ssl/kssl.c b/src/lib/libssl/src/ssl/kssl.c index 51378897f6..3afa95f3fa 100644 --- a/src/lib/libssl/src/ssl/kssl.c +++ b/src/lib/libssl/src/ssl/kssl.c | |||
@@ -73,6 +73,8 @@ | |||
73 | #undef _XOPEN_SOURCE /* To avoid clashes with anything else... */ | 73 | #undef _XOPEN_SOURCE /* To avoid clashes with anything else... */ |
74 | #include <string.h> | 74 | #include <string.h> |
75 | 75 | ||
76 | #define KRB5_PRIVATE 1 | ||
77 | |||
76 | #include <openssl/ssl.h> | 78 | #include <openssl/ssl.h> |
77 | #include <openssl/evp.h> | 79 | #include <openssl/evp.h> |
78 | #include <openssl/objects.h> | 80 | #include <openssl/objects.h> |
@@ -80,6 +82,10 @@ | |||
80 | 82 | ||
81 | #ifndef OPENSSL_NO_KRB5 | 83 | #ifndef OPENSSL_NO_KRB5 |
82 | 84 | ||
85 | #ifndef ENOMEM | ||
86 | #define ENOMEM KRB5KRB_ERR_GENERIC | ||
87 | #endif | ||
88 | |||
83 | /* | 89 | /* |
84 | * When OpenSSL is built on Windows, we do not want to require that | 90 | * When OpenSSL is built on Windows, we do not want to require that |
85 | * the Kerberos DLLs be available in order for the OpenSSL DLLs to | 91 | * the Kerberos DLLs be available in order for the OpenSSL DLLs to |
@@ -932,7 +938,7 @@ print_krb5_data(char *label, krb5_data *kdata) | |||
932 | int i; | 938 | int i; |
933 | 939 | ||
934 | printf("%s[%d] ", label, kdata->length); | 940 | printf("%s[%d] ", label, kdata->length); |
935 | for (i=0; i < kdata->length; i++) | 941 | for (i=0; i < (int)kdata->length; i++) |
936 | { | 942 | { |
937 | if (0 && isprint((int) kdata->data[i])) | 943 | if (0 && isprint((int) kdata->data[i])) |
938 | printf( "%c ", kdata->data[i]); | 944 | printf( "%c ", kdata->data[i]); |
@@ -984,14 +990,14 @@ print_krb5_keyblock(char *label, krb5_keyblock *keyblk) | |||
984 | #ifdef KRB5_HEIMDAL | 990 | #ifdef KRB5_HEIMDAL |
985 | printf("%s\n\t[et%d:%d]: ", label, keyblk->keytype, | 991 | printf("%s\n\t[et%d:%d]: ", label, keyblk->keytype, |
986 | keyblk->keyvalue->length); | 992 | keyblk->keyvalue->length); |
987 | for (i=0; i < keyblk->keyvalue->length; i++) | 993 | for (i=0; i < (int)keyblk->keyvalue->length; i++) |
988 | { | 994 | { |
989 | printf("%02x",(unsigned char *)(keyblk->keyvalue->contents)[i]); | 995 | printf("%02x",(unsigned char *)(keyblk->keyvalue->contents)[i]); |
990 | } | 996 | } |
991 | printf("\n"); | 997 | printf("\n"); |
992 | #else | 998 | #else |
993 | printf("%s\n\t[et%d:%d]: ", label, keyblk->enctype, keyblk->length); | 999 | printf("%s\n\t[et%d:%d]: ", label, keyblk->enctype, keyblk->length); |
994 | for (i=0; i < keyblk->length; i++) | 1000 | for (i=0; i < (int)keyblk->length; i++) |
995 | { | 1001 | { |
996 | printf("%02x",keyblk->contents[i]); | 1002 | printf("%02x",keyblk->contents[i]); |
997 | } | 1003 | } |
@@ -1010,12 +1016,12 @@ print_krb5_princ(char *label, krb5_principal_data *princ) | |||
1010 | 1016 | ||
1011 | printf("%s principal Realm: ", label); | 1017 | printf("%s principal Realm: ", label); |
1012 | if (princ == NULL) return; | 1018 | if (princ == NULL) return; |
1013 | for (ui=0; ui < princ->realm.length; ui++) putchar(princ->realm.data[ui]); | 1019 | for (ui=0; ui < (int)princ->realm.length; ui++) putchar(princ->realm.data[ui]); |
1014 | printf(" (nametype %d) has %d strings:\n", princ->type,princ->length); | 1020 | printf(" (nametype %d) has %d strings:\n", princ->type,princ->length); |
1015 | for (i=0; i < princ->length; i++) | 1021 | for (i=0; i < (int)princ->length; i++) |
1016 | { | 1022 | { |
1017 | printf("\t%d [%d]: ", i, princ->data[i].length); | 1023 | printf("\t%d [%d]: ", i, princ->data[i].length); |
1018 | for (uj=0; uj < princ->data[i].length; uj++) { | 1024 | for (uj=0; uj < (int)princ->data[i].length; uj++) { |
1019 | putchar(princ->data[i].data[uj]); | 1025 | putchar(princ->data[i].data[uj]); |
1020 | } | 1026 | } |
1021 | printf("\n"); | 1027 | printf("\n"); |
diff --git a/src/lib/libssl/src/ssl/kssl.h b/src/lib/libssl/src/ssl/kssl.h index 19a689b089..a3d20e1ccb 100644 --- a/src/lib/libssl/src/ssl/kssl.h +++ b/src/lib/libssl/src/ssl/kssl.h | |||
@@ -82,6 +82,12 @@ extern "C" { | |||
82 | #ifdef KRB5_HEIMDAL | 82 | #ifdef KRB5_HEIMDAL |
83 | typedef unsigned char krb5_octet; | 83 | typedef unsigned char krb5_octet; |
84 | #define FAR | 84 | #define FAR |
85 | #else | ||
86 | |||
87 | #ifndef FAR | ||
88 | #define FAR | ||
89 | #endif | ||
90 | |||
85 | #endif | 91 | #endif |
86 | 92 | ||
87 | /* Uncomment this to debug kssl problems or | 93 | /* Uncomment this to debug kssl problems or |
diff --git a/src/lib/libssl/src/ssl/s23_clnt.c b/src/lib/libssl/src/ssl/s23_clnt.c index 64ee4269ec..779e94a35c 100644 --- a/src/lib/libssl/src/ssl/s23_clnt.c +++ b/src/lib/libssl/src/ssl/s23_clnt.c | |||
@@ -235,7 +235,8 @@ static int ssl23_client_hello(SSL *s) | |||
235 | #endif | 235 | #endif |
236 | 236 | ||
237 | p=s->s3->client_random; | 237 | p=s->s3->client_random; |
238 | RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE); | 238 | if(RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE) <= 0) |
239 | return -1; | ||
239 | 240 | ||
240 | /* Do the message type and length last */ | 241 | /* Do the message type and length last */ |
241 | d= &(buf[2]); | 242 | d= &(buf[2]); |
@@ -248,6 +249,14 @@ static int ssl23_client_hello(SSL *s) | |||
248 | *(d++)=TLS1_VERSION_MINOR; | 249 | *(d++)=TLS1_VERSION_MINOR; |
249 | s->client_version=TLS1_VERSION; | 250 | s->client_version=TLS1_VERSION; |
250 | } | 251 | } |
252 | #ifdef OPENSSL_FIPS | ||
253 | else if(FIPS_mode()) | ||
254 | { | ||
255 | SSLerr(SSL_F_SSL23_CLIENT_HELLO, | ||
256 | SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); | ||
257 | return -1; | ||
258 | } | ||
259 | #endif | ||
251 | else if (!(s->options & SSL_OP_NO_SSLv3)) | 260 | else if (!(s->options & SSL_OP_NO_SSLv3)) |
252 | { | 261 | { |
253 | *(d++)=SSL3_VERSION_MAJOR; | 262 | *(d++)=SSL3_VERSION_MAJOR; |
@@ -296,7 +305,9 @@ static int ssl23_client_hello(SSL *s) | |||
296 | i=ch_len; | 305 | i=ch_len; |
297 | s2n(i,d); | 306 | s2n(i,d); |
298 | memset(&(s->s3->client_random[0]),0,SSL3_RANDOM_SIZE); | 307 | memset(&(s->s3->client_random[0]),0,SSL3_RANDOM_SIZE); |
299 | RAND_pseudo_bytes(&(s->s3->client_random[SSL3_RANDOM_SIZE-i]),i); | 308 | if(RAND_pseudo_bytes(&(s->s3->client_random[SSL3_RANDOM_SIZE-i]),i) <= 0) |
309 | return -1; | ||
310 | |||
300 | memcpy(p,&(s->s3->client_random[SSL3_RANDOM_SIZE-i]),i); | 311 | memcpy(p,&(s->s3->client_random[SSL3_RANDOM_SIZE-i]),i); |
301 | p+=i; | 312 | p+=i; |
302 | 313 | ||
@@ -426,6 +437,14 @@ static int ssl23_get_server_hello(SSL *s) | |||
426 | if ((p[2] == SSL3_VERSION_MINOR) && | 437 | if ((p[2] == SSL3_VERSION_MINOR) && |
427 | !(s->options & SSL_OP_NO_SSLv3)) | 438 | !(s->options & SSL_OP_NO_SSLv3)) |
428 | { | 439 | { |
440 | #ifdef OPENSSL_FIPS | ||
441 | if(FIPS_mode()) | ||
442 | { | ||
443 | SSLerr(SSL_F_SSL23_GET_SERVER_HELLO, | ||
444 | SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); | ||
445 | goto err; | ||
446 | } | ||
447 | #endif | ||
429 | s->version=SSL3_VERSION; | 448 | s->version=SSL3_VERSION; |
430 | s->method=SSLv3_client_method(); | 449 | s->method=SSLv3_client_method(); |
431 | } | 450 | } |
diff --git a/src/lib/libssl/src/ssl/s23_lib.c b/src/lib/libssl/src/ssl/s23_lib.c index b70002a647..8d7dbcf569 100644 --- a/src/lib/libssl/src/ssl/s23_lib.c +++ b/src/lib/libssl/src/ssl/s23_lib.c | |||
@@ -87,7 +87,7 @@ static SSL_METHOD SSLv23_data= { | |||
87 | ssl3_ctx_ctrl, | 87 | ssl3_ctx_ctrl, |
88 | ssl23_get_cipher_by_char, | 88 | ssl23_get_cipher_by_char, |
89 | ssl23_put_cipher_by_char, | 89 | ssl23_put_cipher_by_char, |
90 | ssl_undefined_function, | 90 | ssl_undefined_const_function, |
91 | ssl23_num_ciphers, | 91 | ssl23_num_ciphers, |
92 | ssl23_get_cipher, | 92 | ssl23_get_cipher, |
93 | ssl_bad_method, | 93 | ssl_bad_method, |
diff --git a/src/lib/libssl/src/ssl/s23_srvr.c b/src/lib/libssl/src/ssl/s23_srvr.c index c5404ca0bc..92f3391f60 100644 --- a/src/lib/libssl/src/ssl/s23_srvr.c +++ b/src/lib/libssl/src/ssl/s23_srvr.c | |||
@@ -407,6 +407,15 @@ int ssl23_get_client_hello(SSL *s) | |||
407 | } | 407 | } |
408 | } | 408 | } |
409 | 409 | ||
410 | #ifdef OPENSSL_FIPS | ||
411 | if (FIPS_mode() && (s->version < TLS1_VERSION)) | ||
412 | { | ||
413 | SSLerr(SSL_F_SSL23_GET_CLIENT_HELLO, | ||
414 | SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); | ||
415 | goto err; | ||
416 | } | ||
417 | #endif | ||
418 | |||
410 | if (s->state == SSL23_ST_SR_CLNT_HELLO_B) | 419 | if (s->state == SSL23_ST_SR_CLNT_HELLO_B) |
411 | { | 420 | { |
412 | /* we have SSLv3/TLSv1 in an SSLv2 header | 421 | /* we have SSLv3/TLSv1 in an SSLv2 header |
diff --git a/src/lib/libssl/src/ssl/s2_clnt.c b/src/lib/libssl/src/ssl/s2_clnt.c index 43b32eb415..c67829f495 100644 --- a/src/lib/libssl/src/ssl/s2_clnt.c +++ b/src/lib/libssl/src/ssl/s2_clnt.c | |||
@@ -612,7 +612,8 @@ static int client_hello(SSL *s) | |||
612 | s->s2->challenge_length=SSL2_CHALLENGE_LENGTH; | 612 | s->s2->challenge_length=SSL2_CHALLENGE_LENGTH; |
613 | s2n(SSL2_CHALLENGE_LENGTH,p); /* challenge length */ | 613 | s2n(SSL2_CHALLENGE_LENGTH,p); /* challenge length */ |
614 | /*challenge id data*/ | 614 | /*challenge id data*/ |
615 | RAND_pseudo_bytes(s->s2->challenge,SSL2_CHALLENGE_LENGTH); | 615 | if(RAND_pseudo_bytes(s->s2->challenge,SSL2_CHALLENGE_LENGTH) <= 0) |
616 | return -1; | ||
616 | memcpy(d,s->s2->challenge,SSL2_CHALLENGE_LENGTH); | 617 | memcpy(d,s->s2->challenge,SSL2_CHALLENGE_LENGTH); |
617 | d+=SSL2_CHALLENGE_LENGTH; | 618 | d+=SSL2_CHALLENGE_LENGTH; |
618 | 619 | ||
@@ -660,7 +661,9 @@ static int client_master_key(SSL *s) | |||
660 | SSLerr(SSL_F_CLIENT_MASTER_KEY, ERR_R_INTERNAL_ERROR); | 661 | SSLerr(SSL_F_CLIENT_MASTER_KEY, ERR_R_INTERNAL_ERROR); |
661 | return -1; | 662 | return -1; |
662 | } | 663 | } |
663 | if (i > 0) RAND_pseudo_bytes(sess->key_arg,i); | 664 | if (i > 0) |
665 | if(RAND_pseudo_bytes(sess->key_arg,i) <= 0) | ||
666 | return -1; | ||
664 | 667 | ||
665 | /* make a master key */ | 668 | /* make a master key */ |
666 | i=EVP_CIPHER_key_length(c); | 669 | i=EVP_CIPHER_key_length(c); |
diff --git a/src/lib/libssl/src/ssl/s2_lib.c b/src/lib/libssl/src/ssl/s2_lib.c index edcef4dda2..26ce8c8d98 100644 --- a/src/lib/libssl/src/ssl/s2_lib.c +++ b/src/lib/libssl/src/ssl/s2_lib.c | |||
@@ -263,7 +263,7 @@ SSL_CIPHER *ssl2_get_cipher(unsigned int u) | |||
263 | return(NULL); | 263 | return(NULL); |
264 | } | 264 | } |
265 | 265 | ||
266 | int ssl2_pending(SSL *s) | 266 | int ssl2_pending(const SSL *s) |
267 | { | 267 | { |
268 | return SSL_in_init(s) ? 0 : s->s2->ract_data_length; | 268 | return SSL_in_init(s) ? 0 : s->s2->ract_data_length; |
269 | } | 269 | } |
diff --git a/src/lib/libssl/src/ssl/s2_srvr.c b/src/lib/libssl/src/ssl/s2_srvr.c index 5da2a54af3..853871f28c 100644 --- a/src/lib/libssl/src/ssl/s2_srvr.c +++ b/src/lib/libssl/src/ssl/s2_srvr.c | |||
@@ -498,7 +498,8 @@ static int get_client_master_key(SSL *s) | |||
498 | i=ek; | 498 | i=ek; |
499 | else | 499 | else |
500 | i=EVP_CIPHER_key_length(c); | 500 | i=EVP_CIPHER_key_length(c); |
501 | RAND_pseudo_bytes(p,i); | 501 | if(RAND_pseudo_bytes(p,i) <= 0) |
502 | return 0; | ||
502 | } | 503 | } |
503 | #else | 504 | #else |
504 | if (i < 0) | 505 | if (i < 0) |
@@ -804,7 +805,8 @@ static int server_hello(SSL *s) | |||
804 | /* make and send conn_id */ | 805 | /* make and send conn_id */ |
805 | s2n(SSL2_CONNECTION_ID_LENGTH,p); /* add conn_id length */ | 806 | s2n(SSL2_CONNECTION_ID_LENGTH,p); /* add conn_id length */ |
806 | s->s2->conn_id_length=SSL2_CONNECTION_ID_LENGTH; | 807 | s->s2->conn_id_length=SSL2_CONNECTION_ID_LENGTH; |
807 | RAND_pseudo_bytes(s->s2->conn_id,(int)s->s2->conn_id_length); | 808 | if(RAND_pseudo_bytes(s->s2->conn_id,(int)s->s2->conn_id_length) <= 0) |
809 | return -1; | ||
808 | memcpy(d,s->s2->conn_id,SSL2_CONNECTION_ID_LENGTH); | 810 | memcpy(d,s->s2->conn_id,SSL2_CONNECTION_ID_LENGTH); |
809 | d+=SSL2_CONNECTION_ID_LENGTH; | 811 | d+=SSL2_CONNECTION_ID_LENGTH; |
810 | 812 | ||
@@ -949,7 +951,8 @@ static int request_certificate(SSL *s) | |||
949 | p=(unsigned char *)s->init_buf->data; | 951 | p=(unsigned char *)s->init_buf->data; |
950 | *(p++)=SSL2_MT_REQUEST_CERTIFICATE; | 952 | *(p++)=SSL2_MT_REQUEST_CERTIFICATE; |
951 | *(p++)=SSL2_AT_MD5_WITH_RSA_ENCRYPTION; | 953 | *(p++)=SSL2_AT_MD5_WITH_RSA_ENCRYPTION; |
952 | RAND_pseudo_bytes(ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH); | 954 | if(RAND_pseudo_bytes(ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH) <= 0) |
955 | return -1; | ||
953 | memcpy(p,ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH); | 956 | memcpy(p,ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH); |
954 | 957 | ||
955 | s->state=SSL2_ST_SEND_REQUEST_CERTIFICATE_B; | 958 | s->state=SSL2_ST_SEND_REQUEST_CERTIFICATE_B; |
diff --git a/src/lib/libssl/src/ssl/s3_clnt.c b/src/lib/libssl/src/ssl/s3_clnt.c index 36f4a8b4c3..ebf83b0322 100644 --- a/src/lib/libssl/src/ssl/s3_clnt.c +++ b/src/lib/libssl/src/ssl/s3_clnt.c | |||
@@ -117,6 +117,7 @@ | |||
117 | #include <openssl/objects.h> | 117 | #include <openssl/objects.h> |
118 | #include <openssl/evp.h> | 118 | #include <openssl/evp.h> |
119 | #include <openssl/md5.h> | 119 | #include <openssl/md5.h> |
120 | #include <openssl/fips.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); |
@@ -534,7 +535,8 @@ static int ssl3_client_hello(SSL *s) | |||
534 | p=s->s3->client_random; | 535 | p=s->s3->client_random; |
535 | Time=time(NULL); /* Time */ | 536 | Time=time(NULL); /* Time */ |
536 | l2n(Time,p); | 537 | l2n(Time,p); |
537 | RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-sizeof(Time)); | 538 | if(RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0) |
539 | goto err; | ||
538 | 540 | ||
539 | /* Do the message type and length last */ | 541 | /* Do the message type and length last */ |
540 | d=p= &(buf[4]); | 542 | d=p= &(buf[4]); |
@@ -1160,11 +1162,14 @@ static int ssl3_get_key_exchange(SSL *s) | |||
1160 | q=md_buf; | 1162 | q=md_buf; |
1161 | for (num=2; num > 0; num--) | 1163 | for (num=2; num > 0; num--) |
1162 | { | 1164 | { |
1165 | EVP_MD_CTX_set_flags(&md_ctx, | ||
1166 | EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
1163 | EVP_DigestInit_ex(&md_ctx,(num == 2) | 1167 | EVP_DigestInit_ex(&md_ctx,(num == 2) |
1164 | ?s->ctx->md5:s->ctx->sha1, NULL); | 1168 | ?s->ctx->md5:s->ctx->sha1, NULL); |
1165 | EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); | 1169 | EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); |
1166 | EVP_DigestUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE); | 1170 | EVP_DigestUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE); |
1167 | EVP_DigestUpdate(&md_ctx,param,param_len); | 1171 | EVP_DigestUpdate(&md_ctx,param,param_len); |
1172 | |||
1168 | EVP_DigestFinal_ex(&md_ctx,q,(unsigned int *)&i); | 1173 | EVP_DigestFinal_ex(&md_ctx,q,(unsigned int *)&i); |
1169 | q+=i; | 1174 | q+=i; |
1170 | j+=i; | 1175 | j+=i; |
diff --git a/src/lib/libssl/src/ssl/s3_enc.c b/src/lib/libssl/src/ssl/s3_enc.c index 92efb9597d..a012d3f2b5 100644 --- a/src/lib/libssl/src/ssl/s3_enc.c +++ b/src/lib/libssl/src/ssl/s3_enc.c | |||
@@ -146,6 +146,7 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num) | |||
146 | #endif | 146 | #endif |
147 | k=0; | 147 | k=0; |
148 | EVP_MD_CTX_init(&m5); | 148 | EVP_MD_CTX_init(&m5); |
149 | EVP_MD_CTX_set_flags(&m5, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
149 | EVP_MD_CTX_init(&s1); | 150 | EVP_MD_CTX_init(&s1); |
150 | for (i=0; i<num; i+=MD5_DIGEST_LENGTH) | 151 | for (i=0; i<num; i+=MD5_DIGEST_LENGTH) |
151 | { | 152 | { |
@@ -501,6 +502,8 @@ int ssl3_enc(SSL *s, int send) | |||
501 | 502 | ||
502 | void ssl3_init_finished_mac(SSL *s) | 503 | void ssl3_init_finished_mac(SSL *s) |
503 | { | 504 | { |
505 | EVP_MD_CTX_set_flags(&(s->s3->finish_dgst1), | ||
506 | EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
504 | EVP_DigestInit_ex(&(s->s3->finish_dgst1),s->ctx->md5, NULL); | 507 | EVP_DigestInit_ex(&(s->s3->finish_dgst1),s->ctx->md5, NULL); |
505 | EVP_DigestInit_ex(&(s->s3->finish_dgst2),s->ctx->sha1, NULL); | 508 | EVP_DigestInit_ex(&(s->s3->finish_dgst2),s->ctx->sha1, NULL); |
506 | } | 509 | } |
@@ -641,6 +644,7 @@ int ssl3_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p, | |||
641 | unsigned int n; | 644 | unsigned int n; |
642 | 645 | ||
643 | EVP_MD_CTX_init(&ctx); | 646 | EVP_MD_CTX_init(&ctx); |
647 | EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
644 | for (i=0; i<3; i++) | 648 | for (i=0; i<3; i++) |
645 | { | 649 | { |
646 | EVP_DigestInit_ex(&ctx,s->ctx->sha1, NULL); | 650 | EVP_DigestInit_ex(&ctx,s->ctx->sha1, NULL); |
diff --git a/src/lib/libssl/src/ssl/s3_lib.c b/src/lib/libssl/src/ssl/s3_lib.c index d04096016c..9bf1dbec06 100644 --- a/src/lib/libssl/src/ssl/s3_lib.c +++ b/src/lib/libssl/src/ssl/s3_lib.c | |||
@@ -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|SSL_STRONG_NONE, | 145 | SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS, |
146 | 0, | 146 | 0, |
147 | 0, | 147 | 0, |
148 | 0, | 148 | 0, |
@@ -183,7 +183,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
183 | SSL3_TXT_ADH_DES_40_CBC_SHA, | 183 | SSL3_TXT_ADH_DES_40_CBC_SHA, |
184 | SSL3_CK_ADH_DES_40_CBC_SHA, | 184 | SSL3_CK_ADH_DES_40_CBC_SHA, |
185 | SSL_kEDH |SSL_aNULL|SSL_DES|SSL_SHA1|SSL_SSLV3, | 185 | SSL_kEDH |SSL_aNULL|SSL_DES|SSL_SHA1|SSL_SSLV3, |
186 | SSL_EXPORT|SSL_EXP40, | 186 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
187 | 0, | 187 | 0, |
188 | 40, | 188 | 40, |
189 | 128, | 189 | 128, |
@@ -196,7 +196,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
196 | SSL3_TXT_ADH_DES_64_CBC_SHA, | 196 | SSL3_TXT_ADH_DES_64_CBC_SHA, |
197 | SSL3_CK_ADH_DES_64_CBC_SHA, | 197 | SSL3_CK_ADH_DES_64_CBC_SHA, |
198 | SSL_kEDH |SSL_aNULL|SSL_DES |SSL_SHA1|SSL_SSLV3, | 198 | SSL_kEDH |SSL_aNULL|SSL_DES |SSL_SHA1|SSL_SSLV3, |
199 | SSL_NOT_EXP|SSL_LOW, | 199 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
200 | 0, | 200 | 0, |
201 | 56, | 201 | 56, |
202 | 56, | 202 | 56, |
@@ -209,7 +209,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
209 | SSL3_TXT_ADH_DES_192_CBC_SHA, | 209 | SSL3_TXT_ADH_DES_192_CBC_SHA, |
210 | SSL3_CK_ADH_DES_192_CBC_SHA, | 210 | SSL3_CK_ADH_DES_192_CBC_SHA, |
211 | SSL_kEDH |SSL_aNULL|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 211 | SSL_kEDH |SSL_aNULL|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
212 | SSL_NOT_EXP|SSL_HIGH, | 212 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
213 | 0, | 213 | 0, |
214 | 168, | 214 | 168, |
215 | 168, | 215 | 168, |
@@ -291,7 +291,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
291 | SSL3_TXT_RSA_DES_40_CBC_SHA, | 291 | SSL3_TXT_RSA_DES_40_CBC_SHA, |
292 | SSL3_CK_RSA_DES_40_CBC_SHA, | 292 | SSL3_CK_RSA_DES_40_CBC_SHA, |
293 | SSL_kRSA|SSL_aRSA|SSL_DES|SSL_SHA1|SSL_SSLV3, | 293 | SSL_kRSA|SSL_aRSA|SSL_DES|SSL_SHA1|SSL_SSLV3, |
294 | SSL_EXPORT|SSL_EXP40, | 294 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
295 | 0, | 295 | 0, |
296 | 40, | 296 | 40, |
297 | 56, | 297 | 56, |
@@ -304,7 +304,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
304 | SSL3_TXT_RSA_DES_64_CBC_SHA, | 304 | SSL3_TXT_RSA_DES_64_CBC_SHA, |
305 | SSL3_CK_RSA_DES_64_CBC_SHA, | 305 | SSL3_CK_RSA_DES_64_CBC_SHA, |
306 | SSL_kRSA|SSL_aRSA|SSL_DES |SSL_SHA1|SSL_SSLV3, | 306 | SSL_kRSA|SSL_aRSA|SSL_DES |SSL_SHA1|SSL_SSLV3, |
307 | SSL_NOT_EXP|SSL_LOW, | 307 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
308 | 0, | 308 | 0, |
309 | 56, | 309 | 56, |
310 | 56, | 310 | 56, |
@@ -317,7 +317,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
317 | SSL3_TXT_RSA_DES_192_CBC3_SHA, | 317 | SSL3_TXT_RSA_DES_192_CBC3_SHA, |
318 | SSL3_CK_RSA_DES_192_CBC3_SHA, | 318 | SSL3_CK_RSA_DES_192_CBC3_SHA, |
319 | SSL_kRSA|SSL_aRSA|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 319 | SSL_kRSA|SSL_aRSA|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
320 | SSL_NOT_EXP|SSL_HIGH, | 320 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
321 | 0, | 321 | 0, |
322 | 168, | 322 | 168, |
323 | 168, | 323 | 168, |
@@ -332,7 +332,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
332 | SSL3_TXT_DH_DSS_DES_40_CBC_SHA, | 332 | SSL3_TXT_DH_DSS_DES_40_CBC_SHA, |
333 | SSL3_CK_DH_DSS_DES_40_CBC_SHA, | 333 | SSL3_CK_DH_DSS_DES_40_CBC_SHA, |
334 | SSL_kDHd |SSL_aDH|SSL_DES|SSL_SHA1|SSL_SSLV3, | 334 | SSL_kDHd |SSL_aDH|SSL_DES|SSL_SHA1|SSL_SSLV3, |
335 | SSL_EXPORT|SSL_EXP40, | 335 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
336 | 0, | 336 | 0, |
337 | 40, | 337 | 40, |
338 | 56, | 338 | 56, |
@@ -345,7 +345,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
345 | SSL3_TXT_DH_DSS_DES_64_CBC_SHA, | 345 | SSL3_TXT_DH_DSS_DES_64_CBC_SHA, |
346 | SSL3_CK_DH_DSS_DES_64_CBC_SHA, | 346 | SSL3_CK_DH_DSS_DES_64_CBC_SHA, |
347 | SSL_kDHd |SSL_aDH|SSL_DES |SSL_SHA1|SSL_SSLV3, | 347 | SSL_kDHd |SSL_aDH|SSL_DES |SSL_SHA1|SSL_SSLV3, |
348 | SSL_NOT_EXP|SSL_LOW, | 348 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
349 | 0, | 349 | 0, |
350 | 56, | 350 | 56, |
351 | 56, | 351 | 56, |
@@ -358,7 +358,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
358 | SSL3_TXT_DH_DSS_DES_192_CBC3_SHA, | 358 | SSL3_TXT_DH_DSS_DES_192_CBC3_SHA, |
359 | SSL3_CK_DH_DSS_DES_192_CBC3_SHA, | 359 | SSL3_CK_DH_DSS_DES_192_CBC3_SHA, |
360 | SSL_kDHd |SSL_aDH|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 360 | SSL_kDHd |SSL_aDH|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
361 | SSL_NOT_EXP|SSL_HIGH, | 361 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
362 | 0, | 362 | 0, |
363 | 168, | 363 | 168, |
364 | 168, | 364 | 168, |
@@ -371,7 +371,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
371 | SSL3_TXT_DH_RSA_DES_40_CBC_SHA, | 371 | SSL3_TXT_DH_RSA_DES_40_CBC_SHA, |
372 | SSL3_CK_DH_RSA_DES_40_CBC_SHA, | 372 | SSL3_CK_DH_RSA_DES_40_CBC_SHA, |
373 | SSL_kDHr |SSL_aDH|SSL_DES|SSL_SHA1|SSL_SSLV3, | 373 | SSL_kDHr |SSL_aDH|SSL_DES|SSL_SHA1|SSL_SSLV3, |
374 | SSL_EXPORT|SSL_EXP40, | 374 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
375 | 0, | 375 | 0, |
376 | 40, | 376 | 40, |
377 | 56, | 377 | 56, |
@@ -384,7 +384,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
384 | SSL3_TXT_DH_RSA_DES_64_CBC_SHA, | 384 | SSL3_TXT_DH_RSA_DES_64_CBC_SHA, |
385 | SSL3_CK_DH_RSA_DES_64_CBC_SHA, | 385 | SSL3_CK_DH_RSA_DES_64_CBC_SHA, |
386 | SSL_kDHr |SSL_aDH|SSL_DES |SSL_SHA1|SSL_SSLV3, | 386 | SSL_kDHr |SSL_aDH|SSL_DES |SSL_SHA1|SSL_SSLV3, |
387 | SSL_NOT_EXP|SSL_LOW, | 387 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
388 | 0, | 388 | 0, |
389 | 56, | 389 | 56, |
390 | 56, | 390 | 56, |
@@ -397,7 +397,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
397 | SSL3_TXT_DH_RSA_DES_192_CBC3_SHA, | 397 | SSL3_TXT_DH_RSA_DES_192_CBC3_SHA, |
398 | SSL3_CK_DH_RSA_DES_192_CBC3_SHA, | 398 | SSL3_CK_DH_RSA_DES_192_CBC3_SHA, |
399 | SSL_kDHr |SSL_aDH|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 399 | SSL_kDHr |SSL_aDH|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
400 | SSL_NOT_EXP|SSL_HIGH, | 400 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
401 | 0, | 401 | 0, |
402 | 168, | 402 | 168, |
403 | 168, | 403 | 168, |
@@ -412,7 +412,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
412 | SSL3_TXT_EDH_DSS_DES_40_CBC_SHA, | 412 | SSL3_TXT_EDH_DSS_DES_40_CBC_SHA, |
413 | SSL3_CK_EDH_DSS_DES_40_CBC_SHA, | 413 | SSL3_CK_EDH_DSS_DES_40_CBC_SHA, |
414 | SSL_kEDH|SSL_aDSS|SSL_DES|SSL_SHA1|SSL_SSLV3, | 414 | SSL_kEDH|SSL_aDSS|SSL_DES|SSL_SHA1|SSL_SSLV3, |
415 | SSL_EXPORT|SSL_EXP40, | 415 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
416 | 0, | 416 | 0, |
417 | 40, | 417 | 40, |
418 | 56, | 418 | 56, |
@@ -425,7 +425,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
425 | SSL3_TXT_EDH_DSS_DES_64_CBC_SHA, | 425 | SSL3_TXT_EDH_DSS_DES_64_CBC_SHA, |
426 | SSL3_CK_EDH_DSS_DES_64_CBC_SHA, | 426 | SSL3_CK_EDH_DSS_DES_64_CBC_SHA, |
427 | SSL_kEDH|SSL_aDSS|SSL_DES |SSL_SHA1|SSL_SSLV3, | 427 | SSL_kEDH|SSL_aDSS|SSL_DES |SSL_SHA1|SSL_SSLV3, |
428 | SSL_NOT_EXP|SSL_LOW, | 428 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
429 | 0, | 429 | 0, |
430 | 56, | 430 | 56, |
431 | 56, | 431 | 56, |
@@ -438,7 +438,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
438 | SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA, | 438 | SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA, |
439 | SSL3_CK_EDH_DSS_DES_192_CBC3_SHA, | 439 | SSL3_CK_EDH_DSS_DES_192_CBC3_SHA, |
440 | SSL_kEDH|SSL_aDSS|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 440 | SSL_kEDH|SSL_aDSS|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
441 | SSL_NOT_EXP|SSL_HIGH, | 441 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
442 | 0, | 442 | 0, |
443 | 168, | 443 | 168, |
444 | 168, | 444 | 168, |
@@ -451,7 +451,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
451 | SSL3_TXT_EDH_RSA_DES_40_CBC_SHA, | 451 | SSL3_TXT_EDH_RSA_DES_40_CBC_SHA, |
452 | SSL3_CK_EDH_RSA_DES_40_CBC_SHA, | 452 | SSL3_CK_EDH_RSA_DES_40_CBC_SHA, |
453 | SSL_kEDH|SSL_aRSA|SSL_DES|SSL_SHA1|SSL_SSLV3, | 453 | SSL_kEDH|SSL_aRSA|SSL_DES|SSL_SHA1|SSL_SSLV3, |
454 | SSL_EXPORT|SSL_EXP40, | 454 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
455 | 0, | 455 | 0, |
456 | 40, | 456 | 40, |
457 | 56, | 457 | 56, |
@@ -464,7 +464,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
464 | SSL3_TXT_EDH_RSA_DES_64_CBC_SHA, | 464 | SSL3_TXT_EDH_RSA_DES_64_CBC_SHA, |
465 | SSL3_CK_EDH_RSA_DES_64_CBC_SHA, | 465 | SSL3_CK_EDH_RSA_DES_64_CBC_SHA, |
466 | SSL_kEDH|SSL_aRSA|SSL_DES |SSL_SHA1|SSL_SSLV3, | 466 | SSL_kEDH|SSL_aRSA|SSL_DES |SSL_SHA1|SSL_SSLV3, |
467 | SSL_NOT_EXP|SSL_LOW, | 467 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
468 | 0, | 468 | 0, |
469 | 56, | 469 | 56, |
470 | 56, | 470 | 56, |
@@ -477,7 +477,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
477 | SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA, | 477 | SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA, |
478 | SSL3_CK_EDH_RSA_DES_192_CBC3_SHA, | 478 | SSL3_CK_EDH_RSA_DES_192_CBC3_SHA, |
479 | SSL_kEDH|SSL_aRSA|SSL_3DES |SSL_SHA1|SSL_SSLV3, | 479 | SSL_kEDH|SSL_aRSA|SSL_3DES |SSL_SHA1|SSL_SSLV3, |
480 | SSL_NOT_EXP|SSL_HIGH, | 480 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
481 | 0, | 481 | 0, |
482 | 168, | 482 | 168, |
483 | 168, | 483 | 168, |
@@ -541,7 +541,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
541 | SSL3_TXT_KRB5_DES_64_CBC_SHA, | 541 | SSL3_TXT_KRB5_DES_64_CBC_SHA, |
542 | SSL3_CK_KRB5_DES_64_CBC_SHA, | 542 | SSL3_CK_KRB5_DES_64_CBC_SHA, |
543 | SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_SHA1 |SSL_SSLV3, | 543 | SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_SHA1 |SSL_SSLV3, |
544 | SSL_NOT_EXP|SSL_LOW, | 544 | SSL_NOT_EXP|SSL_LOW|SSL_FIPS, |
545 | 0, | 545 | 0, |
546 | 56, | 546 | 56, |
547 | 56, | 547 | 56, |
@@ -555,7 +555,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
555 | SSL3_TXT_KRB5_DES_192_CBC3_SHA, | 555 | SSL3_TXT_KRB5_DES_192_CBC3_SHA, |
556 | SSL3_CK_KRB5_DES_192_CBC3_SHA, | 556 | SSL3_CK_KRB5_DES_192_CBC3_SHA, |
557 | SSL_kKRB5|SSL_aKRB5| SSL_3DES|SSL_SHA1 |SSL_SSLV3, | 557 | SSL_kKRB5|SSL_aKRB5| SSL_3DES|SSL_SHA1 |SSL_SSLV3, |
558 | SSL_NOT_EXP|SSL_HIGH, | 558 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
559 | 0, | 559 | 0, |
560 | 112, | 560 | 112, |
561 | 168, | 561 | 168, |
@@ -653,7 +653,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
653 | SSL3_TXT_KRB5_DES_40_CBC_SHA, | 653 | SSL3_TXT_KRB5_DES_40_CBC_SHA, |
654 | SSL3_CK_KRB5_DES_40_CBC_SHA, | 654 | SSL3_CK_KRB5_DES_40_CBC_SHA, |
655 | SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_SHA1 |SSL_SSLV3, | 655 | SSL_kKRB5|SSL_aKRB5| SSL_DES|SSL_SHA1 |SSL_SSLV3, |
656 | SSL_EXPORT|SSL_EXP40, | 656 | SSL_EXPORT|SSL_EXP40|SSL_FIPS, |
657 | 0, | 657 | 0, |
658 | 40, | 658 | 40, |
659 | 56, | 659 | 56, |
@@ -767,7 +767,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
767 | TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA, | 767 | TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA, |
768 | TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA, | 768 | TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA, |
769 | SSL_kRSA|SSL_aRSA|SSL_DES|SSL_SHA|SSL_TLSV1, | 769 | SSL_kRSA|SSL_aRSA|SSL_DES|SSL_SHA|SSL_TLSV1, |
770 | SSL_EXPORT|SSL_EXP56, | 770 | SSL_EXPORT|SSL_EXP56|SSL_FIPS, |
771 | 0, | 771 | 0, |
772 | 56, | 772 | 56, |
773 | 56, | 773 | 56, |
@@ -780,7 +780,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
780 | TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA, | 780 | TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA, |
781 | TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA, | 781 | TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA, |
782 | SSL_kEDH|SSL_aDSS|SSL_DES|SSL_SHA|SSL_TLSV1, | 782 | SSL_kEDH|SSL_aDSS|SSL_DES|SSL_SHA|SSL_TLSV1, |
783 | SSL_EXPORT|SSL_EXP56, | 783 | SSL_EXPORT|SSL_EXP56|SSL_FIPS, |
784 | 0, | 784 | 0, |
785 | 56, | 785 | 56, |
786 | 56, | 786 | 56, |
@@ -835,7 +835,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
835 | TLS1_TXT_RSA_WITH_AES_128_SHA, | 835 | TLS1_TXT_RSA_WITH_AES_128_SHA, |
836 | TLS1_CK_RSA_WITH_AES_128_SHA, | 836 | TLS1_CK_RSA_WITH_AES_128_SHA, |
837 | SSL_kRSA|SSL_aRSA|SSL_AES|SSL_SHA |SSL_TLSV1, | 837 | SSL_kRSA|SSL_aRSA|SSL_AES|SSL_SHA |SSL_TLSV1, |
838 | SSL_NOT_EXP|SSL_MEDIUM, | 838 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
839 | 0, | 839 | 0, |
840 | 128, | 840 | 128, |
841 | 128, | 841 | 128, |
@@ -848,7 +848,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
848 | TLS1_TXT_DH_DSS_WITH_AES_128_SHA, | 848 | TLS1_TXT_DH_DSS_WITH_AES_128_SHA, |
849 | TLS1_CK_DH_DSS_WITH_AES_128_SHA, | 849 | TLS1_CK_DH_DSS_WITH_AES_128_SHA, |
850 | SSL_kDHd|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, | 850 | SSL_kDHd|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, |
851 | SSL_NOT_EXP|SSL_MEDIUM, | 851 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
852 | 0, | 852 | 0, |
853 | 128, | 853 | 128, |
854 | 128, | 854 | 128, |
@@ -861,7 +861,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
861 | TLS1_TXT_DH_RSA_WITH_AES_128_SHA, | 861 | TLS1_TXT_DH_RSA_WITH_AES_128_SHA, |
862 | TLS1_CK_DH_RSA_WITH_AES_128_SHA, | 862 | TLS1_CK_DH_RSA_WITH_AES_128_SHA, |
863 | SSL_kDHr|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, | 863 | SSL_kDHr|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, |
864 | SSL_NOT_EXP|SSL_MEDIUM, | 864 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
865 | 0, | 865 | 0, |
866 | 128, | 866 | 128, |
867 | 128, | 867 | 128, |
@@ -874,7 +874,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
874 | TLS1_TXT_DHE_DSS_WITH_AES_128_SHA, | 874 | TLS1_TXT_DHE_DSS_WITH_AES_128_SHA, |
875 | TLS1_CK_DHE_DSS_WITH_AES_128_SHA, | 875 | TLS1_CK_DHE_DSS_WITH_AES_128_SHA, |
876 | SSL_kEDH|SSL_aDSS|SSL_AES|SSL_SHA|SSL_TLSV1, | 876 | SSL_kEDH|SSL_aDSS|SSL_AES|SSL_SHA|SSL_TLSV1, |
877 | SSL_NOT_EXP|SSL_MEDIUM, | 877 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
878 | 0, | 878 | 0, |
879 | 128, | 879 | 128, |
880 | 128, | 880 | 128, |
@@ -887,7 +887,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
887 | TLS1_TXT_DHE_RSA_WITH_AES_128_SHA, | 887 | TLS1_TXT_DHE_RSA_WITH_AES_128_SHA, |
888 | TLS1_CK_DHE_RSA_WITH_AES_128_SHA, | 888 | TLS1_CK_DHE_RSA_WITH_AES_128_SHA, |
889 | SSL_kEDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1, | 889 | SSL_kEDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1, |
890 | SSL_NOT_EXP|SSL_MEDIUM, | 890 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
891 | 0, | 891 | 0, |
892 | 128, | 892 | 128, |
893 | 128, | 893 | 128, |
@@ -900,7 +900,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
900 | TLS1_TXT_ADH_WITH_AES_128_SHA, | 900 | TLS1_TXT_ADH_WITH_AES_128_SHA, |
901 | TLS1_CK_ADH_WITH_AES_128_SHA, | 901 | TLS1_CK_ADH_WITH_AES_128_SHA, |
902 | SSL_kEDH|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1, | 902 | SSL_kEDH|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1, |
903 | SSL_NOT_EXP|SSL_MEDIUM, | 903 | SSL_NOT_EXP|SSL_MEDIUM|SSL_FIPS, |
904 | 0, | 904 | 0, |
905 | 128, | 905 | 128, |
906 | 128, | 906 | 128, |
@@ -914,7 +914,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
914 | TLS1_TXT_RSA_WITH_AES_256_SHA, | 914 | TLS1_TXT_RSA_WITH_AES_256_SHA, |
915 | TLS1_CK_RSA_WITH_AES_256_SHA, | 915 | TLS1_CK_RSA_WITH_AES_256_SHA, |
916 | SSL_kRSA|SSL_aRSA|SSL_AES|SSL_SHA |SSL_TLSV1, | 916 | SSL_kRSA|SSL_aRSA|SSL_AES|SSL_SHA |SSL_TLSV1, |
917 | SSL_NOT_EXP|SSL_HIGH, | 917 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
918 | 0, | 918 | 0, |
919 | 256, | 919 | 256, |
920 | 256, | 920 | 256, |
@@ -927,7 +927,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
927 | TLS1_TXT_DH_DSS_WITH_AES_256_SHA, | 927 | TLS1_TXT_DH_DSS_WITH_AES_256_SHA, |
928 | TLS1_CK_DH_DSS_WITH_AES_256_SHA, | 928 | TLS1_CK_DH_DSS_WITH_AES_256_SHA, |
929 | SSL_kDHd|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, | 929 | SSL_kDHd|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, |
930 | SSL_NOT_EXP|SSL_HIGH, | 930 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
931 | 0, | 931 | 0, |
932 | 256, | 932 | 256, |
933 | 256, | 933 | 256, |
@@ -940,7 +940,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
940 | TLS1_TXT_DH_RSA_WITH_AES_256_SHA, | 940 | TLS1_TXT_DH_RSA_WITH_AES_256_SHA, |
941 | TLS1_CK_DH_RSA_WITH_AES_256_SHA, | 941 | TLS1_CK_DH_RSA_WITH_AES_256_SHA, |
942 | SSL_kDHr|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, | 942 | SSL_kDHr|SSL_aDH|SSL_AES|SSL_SHA|SSL_TLSV1, |
943 | SSL_NOT_EXP|SSL_HIGH, | 943 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
944 | 0, | 944 | 0, |
945 | 256, | 945 | 256, |
946 | 256, | 946 | 256, |
@@ -953,7 +953,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
953 | TLS1_TXT_DHE_DSS_WITH_AES_256_SHA, | 953 | TLS1_TXT_DHE_DSS_WITH_AES_256_SHA, |
954 | TLS1_CK_DHE_DSS_WITH_AES_256_SHA, | 954 | TLS1_CK_DHE_DSS_WITH_AES_256_SHA, |
955 | SSL_kEDH|SSL_aDSS|SSL_AES|SSL_SHA|SSL_TLSV1, | 955 | SSL_kEDH|SSL_aDSS|SSL_AES|SSL_SHA|SSL_TLSV1, |
956 | SSL_NOT_EXP|SSL_HIGH, | 956 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
957 | 0, | 957 | 0, |
958 | 256, | 958 | 256, |
959 | 256, | 959 | 256, |
@@ -966,7 +966,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
966 | TLS1_TXT_DHE_RSA_WITH_AES_256_SHA, | 966 | TLS1_TXT_DHE_RSA_WITH_AES_256_SHA, |
967 | TLS1_CK_DHE_RSA_WITH_AES_256_SHA, | 967 | TLS1_CK_DHE_RSA_WITH_AES_256_SHA, |
968 | SSL_kEDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1, | 968 | SSL_kEDH|SSL_aRSA|SSL_AES|SSL_SHA|SSL_TLSV1, |
969 | SSL_NOT_EXP|SSL_HIGH, | 969 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
970 | 0, | 970 | 0, |
971 | 256, | 971 | 256, |
972 | 256, | 972 | 256, |
@@ -979,7 +979,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
979 | TLS1_TXT_ADH_WITH_AES_256_SHA, | 979 | TLS1_TXT_ADH_WITH_AES_256_SHA, |
980 | TLS1_CK_ADH_WITH_AES_256_SHA, | 980 | TLS1_CK_ADH_WITH_AES_256_SHA, |
981 | SSL_kEDH|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1, | 981 | SSL_kEDH|SSL_aNULL|SSL_AES|SSL_SHA|SSL_TLSV1, |
982 | SSL_NOT_EXP|SSL_HIGH, | 982 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
983 | 0, | 983 | 0, |
984 | 256, | 984 | 256, |
985 | 256, | 985 | 256, |
@@ -1057,7 +1057,7 @@ SSL_CIPHER *ssl3_get_cipher(unsigned int u) | |||
1057 | return(NULL); | 1057 | return(NULL); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | int ssl3_pending(SSL *s) | 1060 | int ssl3_pending(const SSL *s) |
1061 | { | 1061 | { |
1062 | if (s->rstate == SSL_ST_READ_BODY) | 1062 | if (s->rstate == SSL_ST_READ_BODY) |
1063 | return 0; | 1063 | return 0; |
diff --git a/src/lib/libssl/src/ssl/s3_pkt.c b/src/lib/libssl/src/ssl/s3_pkt.c index 9f3e5139ad..cb0b12b400 100644 --- a/src/lib/libssl/src/ssl/s3_pkt.c +++ b/src/lib/libssl/src/ssl/s3_pkt.c | |||
@@ -862,7 +862,7 @@ start: | |||
862 | { | 862 | { |
863 | al=SSL_AD_UNEXPECTED_MESSAGE; | 863 | al=SSL_AD_UNEXPECTED_MESSAGE; |
864 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); | 864 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); |
865 | goto err; | 865 | goto f_err; |
866 | } | 866 | } |
867 | 867 | ||
868 | /* If the other end has shut down, throw anything we read away | 868 | /* If the other end has shut down, throw anything we read away |
@@ -969,7 +969,7 @@ start: | |||
969 | { | 969 | { |
970 | al=SSL_AD_DECODE_ERROR; | 970 | al=SSL_AD_DECODE_ERROR; |
971 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST); | 971 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST); |
972 | goto err; | 972 | goto f_err; |
973 | } | 973 | } |
974 | 974 | ||
975 | if (s->msg_callback) | 975 | if (s->msg_callback) |
@@ -1080,17 +1080,17 @@ start: | |||
1080 | if ( (rr->length != 1) || (rr->off != 0) || | 1080 | if ( (rr->length != 1) || (rr->off != 0) || |
1081 | (rr->data[0] != SSL3_MT_CCS)) | 1081 | (rr->data[0] != SSL3_MT_CCS)) |
1082 | { | 1082 | { |
1083 | i=SSL_AD_ILLEGAL_PARAMETER; | 1083 | al=SSL_AD_ILLEGAL_PARAMETER; |
1084 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC); | 1084 | SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC); |
1085 | goto err; | 1085 | goto f_err; |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | /* Check we have a cipher to change to */ | 1088 | /* Check we have a cipher to change to */ |
1089 | if (s->s3->tmp.new_cipher == NULL) | 1089 | if (s->s3->tmp.new_cipher == NULL) |
1090 | { | 1090 | { |
1091 | i=SSL_AD_UNEXPECTED_MESSAGE; | 1091 | al=SSL_AD_UNEXPECTED_MESSAGE; |
1092 | SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); | 1092 | SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); |
1093 | goto err; | 1093 | goto f_err; |
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | rr->length=0; | 1096 | rr->length=0; |
diff --git a/src/lib/libssl/src/ssl/s3_srvr.c b/src/lib/libssl/src/ssl/s3_srvr.c index deb3cffabe..c4a1a71523 100644 --- a/src/lib/libssl/src/ssl/s3_srvr.c +++ b/src/lib/libssl/src/ssl/s3_srvr.c | |||
@@ -125,6 +125,7 @@ | |||
125 | #include <openssl/krb5_asn.h> | 125 | #include <openssl/krb5_asn.h> |
126 | #endif | 126 | #endif |
127 | #include <openssl/md5.h> | 127 | #include <openssl/md5.h> |
128 | #include <openssl/fips.h> | ||
128 | 129 | ||
129 | static SSL_METHOD *ssl3_get_server_method(int ver); | 130 | static SSL_METHOD *ssl3_get_server_method(int ver); |
130 | static int ssl3_get_client_hello(SSL *s); | 131 | static int ssl3_get_client_hello(SSL *s); |
@@ -955,7 +956,8 @@ static int ssl3_send_server_hello(SSL *s) | |||
955 | p=s->s3->server_random; | 956 | p=s->s3->server_random; |
956 | Time=time(NULL); /* Time */ | 957 | Time=time(NULL); /* Time */ |
957 | l2n(Time,p); | 958 | l2n(Time,p); |
958 | RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-sizeof(Time)); | 959 | if(RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0) |
960 | return -1; | ||
959 | /* Do the message type and length last */ | 961 | /* Do the message type and length last */ |
960 | d=p= &(buf[4]); | 962 | d=p= &(buf[4]); |
961 | 963 | ||
@@ -1211,6 +1213,8 @@ static int ssl3_send_server_key_exchange(SSL *s) | |||
1211 | j=0; | 1213 | j=0; |
1212 | for (num=2; num > 0; num--) | 1214 | for (num=2; num > 0; num--) |
1213 | { | 1215 | { |
1216 | EVP_MD_CTX_set_flags(&md_ctx, | ||
1217 | EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
1214 | EVP_DigestInit_ex(&md_ctx,(num == 2) | 1218 | EVP_DigestInit_ex(&md_ctx,(num == 2) |
1215 | ?s->ctx->md5:s->ctx->sha1, NULL); | 1219 | ?s->ctx->md5:s->ctx->sha1, NULL); |
1216 | EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); | 1220 | EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); |
@@ -1491,7 +1495,8 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1491 | i = SSL_MAX_MASTER_KEY_LENGTH; | 1495 | i = SSL_MAX_MASTER_KEY_LENGTH; |
1492 | p[0] = s->client_version >> 8; | 1496 | p[0] = s->client_version >> 8; |
1493 | p[1] = s->client_version & 0xff; | 1497 | p[1] = s->client_version & 0xff; |
1494 | RAND_pseudo_bytes(p+2, i-2); /* should be RAND_bytes, but we cannot work around a failure */ | 1498 | if(RAND_pseudo_bytes(p+2, i-2) <= 0) /* should be RAND_bytes, but we cannot work around a failure */ |
1499 | goto err; | ||
1495 | } | 1500 | } |
1496 | 1501 | ||
1497 | s->session->master_key_length= | 1502 | s->session->master_key_length= |
@@ -1589,7 +1594,7 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1589 | n2s(p,i); | 1594 | n2s(p,i); |
1590 | enc_ticket.length = i; | 1595 | enc_ticket.length = i; |
1591 | 1596 | ||
1592 | if (n < enc_ticket.length + 6) | 1597 | if (n < (long)enc_ticket.length + 6) |
1593 | { | 1598 | { |
1594 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 1599 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
1595 | SSL_R_DATA_LENGTH_TOO_LONG); | 1600 | SSL_R_DATA_LENGTH_TOO_LONG); |
@@ -1602,7 +1607,7 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1602 | n2s(p,i); | 1607 | n2s(p,i); |
1603 | authenticator.length = i; | 1608 | authenticator.length = i; |
1604 | 1609 | ||
1605 | if (n < enc_ticket.length + authenticator.length + 6) | 1610 | if (n < (long)(enc_ticket.length + authenticator.length + 6)) |
1606 | { | 1611 | { |
1607 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 1612 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
1608 | SSL_R_DATA_LENGTH_TOO_LONG); | 1613 | SSL_R_DATA_LENGTH_TOO_LONG); |
@@ -1627,8 +1632,8 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1627 | goto err; | 1632 | goto err; |
1628 | } | 1633 | } |
1629 | 1634 | ||
1630 | if (n != enc_ticket.length + authenticator.length + | 1635 | if (n != (long)(enc_ticket.length + authenticator.length + |
1631 | enc_pms.length + 6) | 1636 | enc_pms.length + 6)) |
1632 | { | 1637 | { |
1633 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 1638 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
1634 | SSL_R_DATA_LENGTH_TOO_LONG); | 1639 | SSL_R_DATA_LENGTH_TOO_LONG); |
diff --git a/src/lib/libssl/src/ssl/ssl.h b/src/lib/libssl/src/ssl/ssl.h index 913bd40eea..3161f532cf 100644 --- a/src/lib/libssl/src/ssl/ssl.h +++ b/src/lib/libssl/src/ssl/ssl.h | |||
@@ -239,6 +239,7 @@ extern "C" { | |||
239 | #define SSL_TXT_LOW "LOW" | 239 | #define SSL_TXT_LOW "LOW" |
240 | #define SSL_TXT_MEDIUM "MEDIUM" | 240 | #define SSL_TXT_MEDIUM "MEDIUM" |
241 | #define SSL_TXT_HIGH "HIGH" | 241 | #define SSL_TXT_HIGH "HIGH" |
242 | #define SSL_TXT_FIPS "FIPS" | ||
242 | #define SSL_TXT_kFZA "kFZA" | 243 | #define SSL_TXT_kFZA "kFZA" |
243 | #define SSL_TXT_aFZA "aFZA" | 244 | #define SSL_TXT_aFZA "aFZA" |
244 | #define SSL_TXT_eFZA "eFZA" | 245 | #define SSL_TXT_eFZA "eFZA" |
@@ -372,7 +373,7 @@ typedef struct ssl_method_st | |||
372 | long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg); | 373 | long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg); |
373 | SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); | 374 | SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); |
374 | int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr); | 375 | int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr); |
375 | int (*ssl_pending)(SSL *s); | 376 | int (*ssl_pending)(const SSL *s); |
376 | int (*num_ciphers)(void); | 377 | int (*num_ciphers)(void); |
377 | SSL_CIPHER *(*get_cipher)(unsigned ncipher); | 378 | SSL_CIPHER *(*get_cipher)(unsigned ncipher); |
378 | struct ssl_method_st *(*get_ssl_method)(int version); | 379 | struct ssl_method_st *(*get_ssl_method)(int version); |
@@ -998,8 +999,8 @@ extern "C" { | |||
998 | * -- that we sent (SSL_get_finished) | 999 | * -- that we sent (SSL_get_finished) |
999 | * -- that we expected from peer (SSL_get_peer_finished). | 1000 | * -- that we expected from peer (SSL_get_peer_finished). |
1000 | * Returns length (0 == no Finished so far), copies up to 'count' bytes. */ | 1001 | * Returns length (0 == no Finished so far), copies up to 'count' bytes. */ |
1001 | size_t SSL_get_finished(SSL *s, void *buf, size_t count); | 1002 | size_t SSL_get_finished(const SSL *s, void *buf, size_t count); |
1002 | size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count); | 1003 | size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); |
1003 | 1004 | ||
1004 | /* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options | 1005 | /* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options |
1005 | * are 'ored' with SSL_VERIFY_PEER if they are desired */ | 1006 | * are 'ored' with SSL_VERIFY_PEER if they are desired */ |
@@ -1171,26 +1172,26 @@ int SSL_CTX_set_cipher_list(SSL_CTX *,const char *str); | |||
1171 | SSL_CTX *SSL_CTX_new(SSL_METHOD *meth); | 1172 | SSL_CTX *SSL_CTX_new(SSL_METHOD *meth); |
1172 | void SSL_CTX_free(SSL_CTX *); | 1173 | void SSL_CTX_free(SSL_CTX *); |
1173 | long SSL_CTX_set_timeout(SSL_CTX *ctx,long t); | 1174 | long SSL_CTX_set_timeout(SSL_CTX *ctx,long t); |
1174 | long SSL_CTX_get_timeout(SSL_CTX *ctx); | 1175 | long SSL_CTX_get_timeout(const SSL_CTX *ctx); |
1175 | X509_STORE *SSL_CTX_get_cert_store(SSL_CTX *); | 1176 | X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); |
1176 | void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *); | 1177 | void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *); |
1177 | int SSL_want(SSL *s); | 1178 | int SSL_want(const SSL *s); |
1178 | int SSL_clear(SSL *s); | 1179 | int SSL_clear(SSL *s); |
1179 | 1180 | ||
1180 | void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm); | 1181 | void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm); |
1181 | 1182 | ||
1182 | SSL_CIPHER *SSL_get_current_cipher(SSL *s); | 1183 | SSL_CIPHER *SSL_get_current_cipher(const SSL *s); |
1183 | int SSL_CIPHER_get_bits(SSL_CIPHER *c,int *alg_bits); | 1184 | int SSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits); |
1184 | char * SSL_CIPHER_get_version(SSL_CIPHER *c); | 1185 | char * SSL_CIPHER_get_version(const SSL_CIPHER *c); |
1185 | const char * SSL_CIPHER_get_name(SSL_CIPHER *c); | 1186 | const char * SSL_CIPHER_get_name(const SSL_CIPHER *c); |
1186 | 1187 | ||
1187 | int SSL_get_fd(SSL *s); | 1188 | int SSL_get_fd(const SSL *s); |
1188 | int SSL_get_rfd(SSL *s); | 1189 | int SSL_get_rfd(const SSL *s); |
1189 | int SSL_get_wfd(SSL *s); | 1190 | int SSL_get_wfd(const SSL *s); |
1190 | const char * SSL_get_cipher_list(SSL *s,int n); | 1191 | const char * SSL_get_cipher_list(const SSL *s,int n); |
1191 | char * SSL_get_shared_ciphers(SSL *s, char *buf, int len); | 1192 | char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len); |
1192 | int SSL_get_read_ahead(SSL * s); | 1193 | int SSL_get_read_ahead(const SSL * s); |
1193 | int SSL_pending(SSL *s); | 1194 | int SSL_pending(const SSL *s); |
1194 | #ifndef OPENSSL_NO_SOCK | 1195 | #ifndef OPENSSL_NO_SOCK |
1195 | int SSL_set_fd(SSL *s, int fd); | 1196 | int SSL_set_fd(SSL *s, int fd); |
1196 | int SSL_set_rfd(SSL *s, int fd); | 1197 | int SSL_set_rfd(SSL *s, int fd); |
@@ -1198,14 +1199,14 @@ int SSL_set_wfd(SSL *s, int fd); | |||
1198 | #endif | 1199 | #endif |
1199 | #ifndef OPENSSL_NO_BIO | 1200 | #ifndef OPENSSL_NO_BIO |
1200 | void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio); | 1201 | void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio); |
1201 | BIO * SSL_get_rbio(SSL *s); | 1202 | BIO * SSL_get_rbio(const SSL *s); |
1202 | BIO * SSL_get_wbio(SSL *s); | 1203 | BIO * SSL_get_wbio(const SSL *s); |
1203 | #endif | 1204 | #endif |
1204 | int SSL_set_cipher_list(SSL *s, const char *str); | 1205 | int SSL_set_cipher_list(SSL *s, const char *str); |
1205 | void SSL_set_read_ahead(SSL *s, int yes); | 1206 | void SSL_set_read_ahead(SSL *s, int yes); |
1206 | int SSL_get_verify_mode(SSL *s); | 1207 | int SSL_get_verify_mode(const SSL *s); |
1207 | int SSL_get_verify_depth(SSL *s); | 1208 | int SSL_get_verify_depth(const SSL *s); |
1208 | int (*SSL_get_verify_callback(SSL *s))(int,X509_STORE_CTX *); | 1209 | int (*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *); |
1209 | void SSL_set_verify(SSL *s, int mode, | 1210 | void SSL_set_verify(SSL *s, int mode, |
1210 | int (*callback)(int ok,X509_STORE_CTX *ctx)); | 1211 | int (*callback)(int ok,X509_STORE_CTX *ctx)); |
1211 | void SSL_set_verify_depth(SSL *s, int depth); | 1212 | void SSL_set_verify_depth(SSL *s, int depth); |
@@ -1243,20 +1244,20 @@ const char *SSL_state_string(const SSL *s); | |||
1243 | const char *SSL_rstate_string(const SSL *s); | 1244 | const char *SSL_rstate_string(const SSL *s); |
1244 | const char *SSL_state_string_long(const SSL *s); | 1245 | const char *SSL_state_string_long(const SSL *s); |
1245 | const char *SSL_rstate_string_long(const SSL *s); | 1246 | const char *SSL_rstate_string_long(const SSL *s); |
1246 | long SSL_SESSION_get_time(SSL_SESSION *s); | 1247 | long SSL_SESSION_get_time(const SSL_SESSION *s); |
1247 | long SSL_SESSION_set_time(SSL_SESSION *s, long t); | 1248 | long SSL_SESSION_set_time(SSL_SESSION *s, long t); |
1248 | long SSL_SESSION_get_timeout(SSL_SESSION *s); | 1249 | long SSL_SESSION_get_timeout(const SSL_SESSION *s); |
1249 | long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); | 1250 | long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); |
1250 | void SSL_copy_session_id(SSL *to,SSL *from); | 1251 | void SSL_copy_session_id(SSL *to,const SSL *from); |
1251 | 1252 | ||
1252 | SSL_SESSION *SSL_SESSION_new(void); | 1253 | SSL_SESSION *SSL_SESSION_new(void); |
1253 | unsigned long SSL_SESSION_hash(SSL_SESSION *a); | 1254 | unsigned long SSL_SESSION_hash(const SSL_SESSION *a); |
1254 | int SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b); | 1255 | int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b); |
1255 | #ifndef OPENSSL_NO_FP_API | 1256 | #ifndef OPENSSL_NO_FP_API |
1256 | int SSL_SESSION_print_fp(FILE *fp,SSL_SESSION *ses); | 1257 | int SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses); |
1257 | #endif | 1258 | #endif |
1258 | #ifndef OPENSSL_NO_BIO | 1259 | #ifndef OPENSSL_NO_BIO |
1259 | int SSL_SESSION_print(BIO *fp,SSL_SESSION *ses); | 1260 | int SSL_SESSION_print(BIO *fp,const SSL_SESSION *ses); |
1260 | #endif | 1261 | #endif |
1261 | void SSL_SESSION_free(SSL_SESSION *ses); | 1262 | void SSL_SESSION_free(SSL_SESSION *ses); |
1262 | int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp); | 1263 | int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp); |
@@ -1267,17 +1268,18 @@ int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB); | |||
1267 | int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); | 1268 | int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); |
1268 | int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, | 1269 | int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, |
1269 | unsigned int id_len); | 1270 | unsigned int id_len); |
1270 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,unsigned char **pp,long length); | 1271 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char * const *pp, |
1272 | long length); | ||
1271 | 1273 | ||
1272 | #ifdef HEADER_X509_H | 1274 | #ifdef HEADER_X509_H |
1273 | X509 * SSL_get_peer_certificate(SSL *s); | 1275 | X509 * SSL_get_peer_certificate(const SSL *s); |
1274 | #endif | 1276 | #endif |
1275 | 1277 | ||
1276 | STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s); | 1278 | STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); |
1277 | 1279 | ||
1278 | int SSL_CTX_get_verify_mode(SSL_CTX *ctx); | 1280 | int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); |
1279 | int SSL_CTX_get_verify_depth(SSL_CTX *ctx); | 1281 | int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); |
1280 | int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *); | 1282 | int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *); |
1281 | void SSL_CTX_set_verify(SSL_CTX *ctx,int mode, | 1283 | void SSL_CTX_set_verify(SSL_CTX *ctx,int mode, |
1282 | int (*callback)(int, X509_STORE_CTX *)); | 1284 | int (*callback)(int, X509_STORE_CTX *)); |
1283 | void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); | 1285 | void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); |
@@ -1295,8 +1297,8 @@ int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d); | |||
1295 | void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); | 1297 | void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); |
1296 | void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); | 1298 | void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); |
1297 | 1299 | ||
1298 | int SSL_CTX_check_private_key(SSL_CTX *ctx); | 1300 | int SSL_CTX_check_private_key(const SSL_CTX *ctx); |
1299 | int SSL_check_private_key(SSL *ctx); | 1301 | int SSL_check_private_key(const SSL *ctx); |
1300 | 1302 | ||
1301 | int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx, | 1303 | int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx, |
1302 | unsigned int sid_ctx_len); | 1304 | unsigned int sid_ctx_len); |
@@ -1321,8 +1323,8 @@ long SSL_callback_ctrl(SSL *, int, void (*)()); | |||
1321 | long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg); | 1323 | long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg); |
1322 | long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)()); | 1324 | long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)()); |
1323 | 1325 | ||
1324 | int SSL_get_error(SSL *s,int ret_code); | 1326 | int SSL_get_error(const SSL *s,int ret_code); |
1325 | const char *SSL_get_version(SSL *s); | 1327 | const char *SSL_get_version(const SSL *s); |
1326 | 1328 | ||
1327 | /* This sets the 'default' SSL version that SSL_new() will create */ | 1329 | /* This sets the 'default' SSL version that SSL_new() will create */ |
1328 | int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth); | 1330 | int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth); |
@@ -1343,7 +1345,7 @@ SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */ | |||
1343 | SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */ | 1345 | SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */ |
1344 | SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */ | 1346 | SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */ |
1345 | 1347 | ||
1346 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s); | 1348 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); |
1347 | 1349 | ||
1348 | int SSL_do_handshake(SSL *s); | 1350 | int SSL_do_handshake(SSL *s); |
1349 | int SSL_renegotiate(SSL *s); | 1351 | int SSL_renegotiate(SSL *s); |
@@ -1359,15 +1361,15 @@ const char *SSL_alert_desc_string(int value); | |||
1359 | 1361 | ||
1360 | void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); | 1362 | void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); |
1361 | void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); | 1363 | void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); |
1362 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(SSL *s); | 1364 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); |
1363 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(SSL_CTX *s); | 1365 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); |
1364 | int SSL_add_client_CA(SSL *ssl,X509 *x); | 1366 | int SSL_add_client_CA(SSL *ssl,X509 *x); |
1365 | int SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x); | 1367 | int SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x); |
1366 | 1368 | ||
1367 | void SSL_set_connect_state(SSL *s); | 1369 | void SSL_set_connect_state(SSL *s); |
1368 | void SSL_set_accept_state(SSL *s); | 1370 | void SSL_set_accept_state(SSL *s); |
1369 | 1371 | ||
1370 | long SSL_get_default_timeout(SSL *s); | 1372 | long SSL_get_default_timeout(const SSL *s); |
1371 | 1373 | ||
1372 | int SSL_library_init(void ); | 1374 | int SSL_library_init(void ); |
1373 | 1375 | ||
@@ -1376,43 +1378,43 @@ STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk); | |||
1376 | 1378 | ||
1377 | SSL *SSL_dup(SSL *ssl); | 1379 | SSL *SSL_dup(SSL *ssl); |
1378 | 1380 | ||
1379 | X509 *SSL_get_certificate(SSL *ssl); | 1381 | X509 *SSL_get_certificate(const SSL *ssl); |
1380 | /* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl); | 1382 | /* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl); |
1381 | 1383 | ||
1382 | void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode); | 1384 | void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode); |
1383 | int SSL_CTX_get_quiet_shutdown(SSL_CTX *ctx); | 1385 | int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); |
1384 | void SSL_set_quiet_shutdown(SSL *ssl,int mode); | 1386 | void SSL_set_quiet_shutdown(SSL *ssl,int mode); |
1385 | int SSL_get_quiet_shutdown(SSL *ssl); | 1387 | int SSL_get_quiet_shutdown(const SSL *ssl); |
1386 | void SSL_set_shutdown(SSL *ssl,int mode); | 1388 | void SSL_set_shutdown(SSL *ssl,int mode); |
1387 | int SSL_get_shutdown(SSL *ssl); | 1389 | int SSL_get_shutdown(const SSL *ssl); |
1388 | int SSL_version(SSL *ssl); | 1390 | int SSL_version(const SSL *ssl); |
1389 | int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); | 1391 | int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); |
1390 | int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, | 1392 | int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, |
1391 | const char *CApath); | 1393 | const char *CApath); |
1392 | #define SSL_get0_session SSL_get_session /* just peek at pointer */ | 1394 | #define SSL_get0_session SSL_get_session /* just peek at pointer */ |
1393 | SSL_SESSION *SSL_get_session(SSL *ssl); | 1395 | SSL_SESSION *SSL_get_session(const SSL *ssl); |
1394 | SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ | 1396 | SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ |
1395 | SSL_CTX *SSL_get_SSL_CTX(SSL *ssl); | 1397 | SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); |
1396 | void SSL_set_info_callback(SSL *ssl, | 1398 | void SSL_set_info_callback(SSL *ssl, |
1397 | void (*cb)(const SSL *ssl,int type,int val)); | 1399 | void (*cb)(const SSL *ssl,int type,int val)); |
1398 | void (*SSL_get_info_callback(SSL *ssl))(const SSL *ssl,int type,int val); | 1400 | void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val); |
1399 | int SSL_state(SSL *ssl); | 1401 | int SSL_state(const SSL *ssl); |
1400 | 1402 | ||
1401 | void SSL_set_verify_result(SSL *ssl,long v); | 1403 | void SSL_set_verify_result(SSL *ssl,long v); |
1402 | long SSL_get_verify_result(SSL *ssl); | 1404 | long SSL_get_verify_result(const SSL *ssl); |
1403 | 1405 | ||
1404 | int SSL_set_ex_data(SSL *ssl,int idx,void *data); | 1406 | int SSL_set_ex_data(SSL *ssl,int idx,void *data); |
1405 | void *SSL_get_ex_data(SSL *ssl,int idx); | 1407 | void *SSL_get_ex_data(const SSL *ssl,int idx); |
1406 | int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 1408 | int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
1407 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | 1409 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); |
1408 | 1410 | ||
1409 | int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data); | 1411 | int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data); |
1410 | void *SSL_SESSION_get_ex_data(SSL_SESSION *ss,int idx); | 1412 | void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss,int idx); |
1411 | int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 1413 | int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
1412 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | 1414 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); |
1413 | 1415 | ||
1414 | int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data); | 1416 | int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data); |
1415 | void *SSL_CTX_get_ex_data(SSL_CTX *ssl,int idx); | 1417 | void *SSL_CTX_get_ex_data(const SSL_CTX *ssl,int idx); |
1416 | int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 1418 | int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
1417 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | 1419 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); |
1418 | 1420 | ||
@@ -1603,6 +1605,7 @@ void ERR_load_SSL_strings(void); | |||
1603 | #define SSL_F_SSL_SET_TRUST 228 | 1605 | #define SSL_F_SSL_SET_TRUST 228 |
1604 | #define SSL_F_SSL_SET_WFD 196 | 1606 | #define SSL_F_SSL_SET_WFD 196 |
1605 | #define SSL_F_SSL_SHUTDOWN 224 | 1607 | #define SSL_F_SSL_SHUTDOWN 224 |
1608 | #define SSL_F_SSL_UNDEFINED_CONST_FUNCTION 243 | ||
1606 | #define SSL_F_SSL_UNDEFINED_FUNCTION 197 | 1609 | #define SSL_F_SSL_UNDEFINED_FUNCTION 197 |
1607 | #define SSL_F_SSL_USE_CERTIFICATE 198 | 1610 | #define SSL_F_SSL_USE_CERTIFICATE 198 |
1608 | #define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 | 1611 | #define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 |
@@ -1741,6 +1744,7 @@ void ERR_load_SSL_strings(void); | |||
1741 | #define SSL_R_NULL_SSL_CTX 195 | 1744 | #define SSL_R_NULL_SSL_CTX 195 |
1742 | #define SSL_R_NULL_SSL_METHOD_PASSED 196 | 1745 | #define SSL_R_NULL_SSL_METHOD_PASSED 196 |
1743 | #define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 | 1746 | #define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 |
1747 | #define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE 1115 | ||
1744 | #define SSL_R_PACKET_LENGTH_TOO_LONG 198 | 1748 | #define SSL_R_PACKET_LENGTH_TOO_LONG 198 |
1745 | #define SSL_R_PATH_TOO_LONG 270 | 1749 | #define SSL_R_PATH_TOO_LONG 270 |
1746 | #define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 | 1750 | #define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 |
diff --git a/src/lib/libssl/src/ssl/ssl_asn1.c b/src/lib/libssl/src/ssl/ssl_asn1.c index d8ff8fc4a3..4d5900ad2f 100644 --- a/src/lib/libssl/src/ssl/ssl_asn1.c +++ b/src/lib/libssl/src/ssl/ssl_asn1.c | |||
@@ -226,7 +226,7 @@ int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) | |||
226 | M_ASN1_I2D_finish(); | 226 | M_ASN1_I2D_finish(); |
227 | } | 227 | } |
228 | 228 | ||
229 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, | 229 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char * const *pp, |
230 | long length) | 230 | long length) |
231 | { | 231 | { |
232 | int version,ssl_version=0,i; | 232 | int version,ssl_version=0,i; |
@@ -266,7 +266,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, | |||
266 | ((unsigned long)os.data[1]<< 8L)| | 266 | ((unsigned long)os.data[1]<< 8L)| |
267 | (unsigned long)os.data[2]; | 267 | (unsigned long)os.data[2]; |
268 | } | 268 | } |
269 | else if ((ssl_version>>8) == 3) | 269 | else if ((ssl_version>>8) == SSL3_VERSION_MAJOR) |
270 | { | 270 | { |
271 | if (os.length != 2) | 271 | if (os.length != 2) |
272 | { | 272 | { |
@@ -287,9 +287,9 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, | |||
287 | ret->cipher_id=id; | 287 | ret->cipher_id=id; |
288 | 288 | ||
289 | M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING); | 289 | M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING); |
290 | if ((ssl_version>>8) == SSL3_VERSION) | 290 | if ((ssl_version>>8) == SSL3_VERSION_MAJOR) |
291 | i=SSL3_MAX_SSL_SESSION_ID_LENGTH; | 291 | i=SSL3_MAX_SSL_SESSION_ID_LENGTH; |
292 | else /* if (ssl_version == SSL2_VERSION) */ | 292 | else /* if (ssl_version == SSL2_VERSION_MAJOR) */ |
293 | i=SSL2_MAX_SSL_SESSION_ID_LENGTH; | 293 | i=SSL2_MAX_SSL_SESSION_ID_LENGTH; |
294 | 294 | ||
295 | if (os.length > i) | 295 | if (os.length > i) |
diff --git a/src/lib/libssl/src/ssl/ssl_cert.c b/src/lib/libssl/src/ssl/ssl_cert.c index 2cfb615878..b8b9bc2390 100644 --- a/src/lib/libssl/src/ssl/ssl_cert.c +++ b/src/lib/libssl/src/ssl/ssl_cert.c | |||
@@ -117,6 +117,7 @@ | |||
117 | 117 | ||
118 | #if defined(WIN32) | 118 | #if defined(WIN32) |
119 | #include <windows.h> | 119 | #include <windows.h> |
120 | #include <tchar.h> | ||
120 | #endif | 121 | #endif |
121 | 122 | ||
122 | #ifdef NeXT | 123 | #ifdef NeXT |
@@ -129,6 +130,7 @@ | |||
129 | #include <openssl/pem.h> | 130 | #include <openssl/pem.h> |
130 | #include <openssl/x509v3.h> | 131 | #include <openssl/x509v3.h> |
131 | #include "ssl_locl.h" | 132 | #include "ssl_locl.h" |
133 | #include <openssl/fips.h> | ||
132 | 134 | ||
133 | int SSL_get_ex_data_X509_STORE_CTX_idx(void) | 135 | int SSL_get_ex_data_X509_STORE_CTX_idx(void) |
134 | { | 136 | { |
@@ -542,12 +544,12 @@ void SSL_CTX_set_client_CA_list(SSL_CTX *ctx,STACK_OF(X509_NAME) *name_list) | |||
542 | set_client_CA_list(&(ctx->client_CA),name_list); | 544 | set_client_CA_list(&(ctx->client_CA),name_list); |
543 | } | 545 | } |
544 | 546 | ||
545 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(SSL_CTX *ctx) | 547 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *ctx) |
546 | { | 548 | { |
547 | return(ctx->client_CA); | 549 | return(ctx->client_CA); |
548 | } | 550 | } |
549 | 551 | ||
550 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(SSL *s) | 552 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s) |
551 | { | 553 | { |
552 | if (s->type == SSL_ST_CONNECT) | 554 | if (s->type == SSL_ST_CONNECT) |
553 | { /* we are in the client */ | 555 | { /* we are in the client */ |
@@ -783,36 +785,54 @@ err: | |||
783 | 785 | ||
784 | #else /* OPENSSL_SYS_WIN32 */ | 786 | #else /* OPENSSL_SYS_WIN32 */ |
785 | 787 | ||
788 | #if defined(_WIN32_WCE) | ||
789 | # ifndef UNICODE | ||
790 | # error "WinCE comes in UNICODE flavor only..." | ||
791 | # endif | ||
792 | # if _WIN32_WCE<101 && !defined(OPENSSL_NO_MULTIBYTE) | ||
793 | # define OPENSSL_NO_MULTIBYTE | ||
794 | # endif | ||
795 | # ifndef FindFirstFile | ||
796 | # define FindFirstFile FindFirstFileW | ||
797 | # endif | ||
798 | # ifndef FindNextFile | ||
799 | # define FindNextFile FindNextFileW | ||
800 | # endif | ||
801 | #endif | ||
802 | |||
786 | int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, | 803 | int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, |
787 | const char *dir) | 804 | const char *dir) |
788 | { | 805 | { |
789 | WIN32_FIND_DATA FindFileData; | 806 | WIN32_FIND_DATA FindFileData; |
790 | HANDLE hFind; | 807 | HANDLE hFind; |
791 | int ret = 0; | 808 | int ret = 0; |
792 | #ifdef OPENSSL_SYS_WINCE | 809 | TCHAR *wdir = NULL; |
793 | WCHAR* wdir = NULL; | 810 | size_t i,len_0 = strlen(dir)+1; /* len_0 accounts for trailing 0 */ |
794 | #endif | 811 | char buf[1024],*slash; |
812 | |||
813 | if (len_0 > (sizeof(buf)-14)) /* 14 is just some value... */ | ||
814 | { | ||
815 | SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); | ||
816 | return ret; | ||
817 | } | ||
795 | 818 | ||
796 | CRYPTO_w_lock(CRYPTO_LOCK_READDIR); | 819 | CRYPTO_w_lock(CRYPTO_LOCK_READDIR); |
797 | 820 | ||
798 | #ifdef OPENSSL_SYS_WINCE | 821 | if (sizeof(TCHAR) != sizeof(char)) |
799 | /* convert strings to UNICODE */ | 822 | { |
800 | { | 823 | wdir = (TCHAR *)malloc(len_0*sizeof(TCHAR)); |
801 | BOOL result = FALSE; | ||
802 | int i; | ||
803 | wdir = malloc((strlen(dir)+1)*2); | ||
804 | if (wdir == NULL) | 824 | if (wdir == NULL) |
805 | goto err_noclose; | 825 | goto err_noclose; |
806 | for (i=0; i<(int)strlen(dir)+1; i++) | 826 | #ifndef OPENSSL_NO_MULTIBYTE |
807 | wdir[i] = (short)dir[i]; | 827 | if (!MultiByteToWideChar(CP_ACP,0,dir,len_0, |
808 | } | 828 | (WCHAR *)wdir,len_0)) |
809 | #endif | 829 | #endif |
830 | for (i=0;i<len_0;i++) wdir[i]=(TCHAR)dir[i]; | ||
831 | |||
832 | hFind = FindFirstFile(wdir, &FindFileData); | ||
833 | } | ||
834 | else hFind = FindFirstFile((const TCHAR *)dir, &FindFileData); | ||
810 | 835 | ||
811 | #ifdef OPENSSL_SYS_WINCE | ||
812 | hFind = FindFirstFile(wdir, &FindFileData); | ||
813 | #else | ||
814 | hFind = FindFirstFile(dir, &FindFileData); | ||
815 | #endif | ||
816 | /* Note that a side effect is that the CAs will be sorted by name */ | 836 | /* Note that a side effect is that the CAs will be sorted by name */ |
817 | if(hFind == INVALID_HANDLE_VALUE) | 837 | if(hFind == INVALID_HANDLE_VALUE) |
818 | { | 838 | { |
@@ -821,25 +841,34 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, | |||
821 | SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); | 841 | SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); |
822 | goto err_noclose; | 842 | goto err_noclose; |
823 | } | 843 | } |
824 | 844 | ||
825 | do | 845 | strncpy(buf,dir,sizeof(buf)); /* strcpy is safe too... */ |
826 | { | 846 | buf[len_0-1]='/'; /* no trailing zero! */ |
827 | char buf[1024]; | 847 | slash=buf+len_0; |
828 | int r; | 848 | |
829 | 849 | do { | |
830 | #ifdef OPENSSL_SYS_WINCE | 850 | const TCHAR *fnam=FindFileData.cFileName; |
831 | if(strlen(dir)+_tcslen(FindFileData.cFileName)+2 > sizeof buf) | 851 | size_t flen_0=_tcslen(fnam)+1; |
832 | #else | 852 | |
833 | if(strlen(dir)+strlen(FindFileData.cFileName)+2 > sizeof buf) | 853 | if (flen_0 > (sizeof(buf)-len_0)) |
834 | #endif | ||
835 | { | 854 | { |
836 | SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); | 855 | SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); |
837 | goto err; | 856 | goto err; |
838 | } | 857 | } |
839 | 858 | /* else strcpy would be safe too... */ | |
840 | r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,FindFileData.cFileName); | 859 | |
841 | if (r <= 0 || r >= sizeof buf) | 860 | if (sizeof(TCHAR) != sizeof(char)) |
842 | goto err; | 861 | { |
862 | #ifndef OPENSSL_NO_MULTIBYTE | ||
863 | if (!WideCharToMultiByte(CP_ACP,0, | ||
864 | (WCHAR *)fnam,flen_0, | ||
865 | slash,sizeof(buf)-len_0, | ||
866 | NULL,0)) | ||
867 | #endif | ||
868 | for (i=0;i<flen_0;i++) slash[i]=(char)fnam[i]; | ||
869 | } | ||
870 | else strncpy(slash,(const char *)fnam,sizeof(buf)-len_0); | ||
871 | |||
843 | if(!SSL_add_file_cert_subjects_to_stack(stack,buf)) | 872 | if(!SSL_add_file_cert_subjects_to_stack(stack,buf)) |
844 | goto err; | 873 | goto err; |
845 | } | 874 | } |
@@ -849,10 +878,9 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, | |||
849 | err: | 878 | err: |
850 | FindClose(hFind); | 879 | FindClose(hFind); |
851 | err_noclose: | 880 | err_noclose: |
852 | #ifdef OPENSSL_SYS_WINCE | ||
853 | if (wdir != NULL) | 881 | if (wdir != NULL) |
854 | free(wdir); | 882 | free(wdir); |
855 | #endif | 883 | |
856 | CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); | 884 | CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); |
857 | return ret; | 885 | return ret; |
858 | } | 886 | } |
diff --git a/src/lib/libssl/src/ssl/ssl_ciph.c b/src/lib/libssl/src/ssl/ssl_ciph.c index 2d6eab20c3..a7ccefa30c 100644 --- a/src/lib/libssl/src/ssl/ssl_ciph.c +++ b/src/lib/libssl/src/ssl/ssl_ciph.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <openssl/objects.h> | 60 | #include <openssl/objects.h> |
61 | #include <openssl/comp.h> | 61 | #include <openssl/comp.h> |
62 | #include <openssl/fips.h> | ||
62 | #include "ssl_locl.h" | 63 | #include "ssl_locl.h" |
63 | 64 | ||
64 | #define SSL_ENC_DES_IDX 0 | 65 | #define SSL_ENC_DES_IDX 0 |
@@ -153,13 +154,13 @@ static const SSL_CIPHER cipher_aliases[]={ | |||
153 | {0,SSL_TXT_LOW, 0, 0, SSL_LOW, 0,0,0,0,SSL_STRONG_MASK}, | 154 | {0,SSL_TXT_LOW, 0, 0, SSL_LOW, 0,0,0,0,SSL_STRONG_MASK}, |
154 | {0,SSL_TXT_MEDIUM,0, 0,SSL_MEDIUM, 0,0,0,0,SSL_STRONG_MASK}, | 155 | {0,SSL_TXT_MEDIUM,0, 0,SSL_MEDIUM, 0,0,0,0,SSL_STRONG_MASK}, |
155 | {0,SSL_TXT_HIGH, 0, 0, SSL_HIGH, 0,0,0,0,SSL_STRONG_MASK}, | 156 | {0,SSL_TXT_HIGH, 0, 0, SSL_HIGH, 0,0,0,0,SSL_STRONG_MASK}, |
157 | {0,SSL_TXT_FIPS, 0, 0, SSL_FIPS, 0,0,0,0,SSL_FIPS|SSL_STRONG_NONE}, | ||
156 | }; | 158 | }; |
157 | 159 | ||
158 | static int init_ciphers=1; | 160 | static int init_ciphers=1; |
159 | 161 | ||
160 | static void load_ciphers(void) | 162 | static void load_ciphers(void) |
161 | { | 163 | { |
162 | init_ciphers=0; | ||
163 | ssl_cipher_methods[SSL_ENC_DES_IDX]= | 164 | ssl_cipher_methods[SSL_ENC_DES_IDX]= |
164 | EVP_get_cipherbyname(SN_des_cbc); | 165 | EVP_get_cipherbyname(SN_des_cbc); |
165 | ssl_cipher_methods[SSL_ENC_3DES_IDX]= | 166 | ssl_cipher_methods[SSL_ENC_3DES_IDX]= |
@@ -183,9 +184,10 @@ static void load_ciphers(void) | |||
183 | EVP_get_digestbyname(SN_md5); | 184 | EVP_get_digestbyname(SN_md5); |
184 | ssl_digest_methods[SSL_MD_SHA1_IDX]= | 185 | ssl_digest_methods[SSL_MD_SHA1_IDX]= |
185 | EVP_get_digestbyname(SN_sha1); | 186 | EVP_get_digestbyname(SN_sha1); |
187 | init_ciphers=0; | ||
186 | } | 188 | } |
187 | 189 | ||
188 | int ssl_cipher_get_evp(SSL_SESSION *s, const EVP_CIPHER **enc, | 190 | int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc, |
189 | const EVP_MD **md, SSL_COMP **comp) | 191 | const EVP_MD **md, SSL_COMP **comp) |
190 | { | 192 | { |
191 | int i; | 193 | int i; |
@@ -359,7 +361,12 @@ static void ssl_cipher_collect_ciphers(const SSL_METHOD *ssl_method, | |||
359 | { | 361 | { |
360 | c = ssl_method->get_cipher(i); | 362 | c = ssl_method->get_cipher(i); |
361 | /* drop those that use any of that is not available */ | 363 | /* drop those that use any of that is not available */ |
364 | #ifdef OPENSSL_FIPS | ||
365 | if ((c != NULL) && c->valid && !(c->algorithms & mask) | ||
366 | && (!FIPS_mode() || (c->algo_strength & SSL_FIPS))) | ||
367 | #else | ||
362 | if ((c != NULL) && c->valid && !(c->algorithms & mask)) | 368 | if ((c != NULL) && c->valid && !(c->algorithms & mask)) |
369 | #endif | ||
363 | { | 370 | { |
364 | co_list[co_list_num].cipher = c; | 371 | co_list[co_list_num].cipher = c; |
365 | co_list[co_list_num].next = NULL; | 372 | co_list[co_list_num].next = NULL; |
@@ -854,7 +861,11 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, | |||
854 | */ | 861 | */ |
855 | for (curr = head; curr != NULL; curr = curr->next) | 862 | for (curr = head; curr != NULL; curr = curr->next) |
856 | { | 863 | { |
864 | #ifdef OPENSSL_FIPS | ||
865 | if (curr->active && (!FIPS_mode() || curr->cipher->algo_strength & SSL_FIPS)) | ||
866 | #else | ||
857 | if (curr->active) | 867 | if (curr->active) |
868 | #endif | ||
858 | { | 869 | { |
859 | sk_SSL_CIPHER_push(cipherstack, curr->cipher); | 870 | sk_SSL_CIPHER_push(cipherstack, curr->cipher); |
860 | #ifdef CIPHER_DEBUG | 871 | #ifdef CIPHER_DEBUG |
@@ -1054,7 +1065,7 @@ char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int len) | |||
1054 | return(buf); | 1065 | return(buf); |
1055 | } | 1066 | } |
1056 | 1067 | ||
1057 | char *SSL_CIPHER_get_version(SSL_CIPHER *c) | 1068 | char *SSL_CIPHER_get_version(const SSL_CIPHER *c) |
1058 | { | 1069 | { |
1059 | int i; | 1070 | int i; |
1060 | 1071 | ||
@@ -1069,7 +1080,7 @@ char *SSL_CIPHER_get_version(SSL_CIPHER *c) | |||
1069 | } | 1080 | } |
1070 | 1081 | ||
1071 | /* return the actual cipher being used */ | 1082 | /* return the actual cipher being used */ |
1072 | const char *SSL_CIPHER_get_name(SSL_CIPHER *c) | 1083 | const char *SSL_CIPHER_get_name(const SSL_CIPHER *c) |
1073 | { | 1084 | { |
1074 | if (c != NULL) | 1085 | if (c != NULL) |
1075 | return(c->name); | 1086 | return(c->name); |
@@ -1077,7 +1088,7 @@ const char *SSL_CIPHER_get_name(SSL_CIPHER *c) | |||
1077 | } | 1088 | } |
1078 | 1089 | ||
1079 | /* number of bits for symmetric cipher */ | 1090 | /* number of bits for symmetric cipher */ |
1080 | int SSL_CIPHER_get_bits(SSL_CIPHER *c, int *alg_bits) | 1091 | int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits) |
1081 | { | 1092 | { |
1082 | int ret=0; | 1093 | int ret=0; |
1083 | 1094 | ||
diff --git a/src/lib/libssl/src/ssl/ssl_err.c b/src/lib/libssl/src/ssl/ssl_err.c index d2cb181503..29b8ff4788 100644 --- a/src/lib/libssl/src/ssl/ssl_err.c +++ b/src/lib/libssl/src/ssl/ssl_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* ssl/ssl_err.c */ | 1 | /* ssl/ssl_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2005 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 |
@@ -193,6 +193,7 @@ static ERR_STRING_DATA SSL_str_functs[]= | |||
193 | {ERR_PACK(0,SSL_F_SSL_SET_TRUST,0), "SSL_set_trust"}, | 193 | {ERR_PACK(0,SSL_F_SSL_SET_TRUST,0), "SSL_set_trust"}, |
194 | {ERR_PACK(0,SSL_F_SSL_SET_WFD,0), "SSL_set_wfd"}, | 194 | {ERR_PACK(0,SSL_F_SSL_SET_WFD,0), "SSL_set_wfd"}, |
195 | {ERR_PACK(0,SSL_F_SSL_SHUTDOWN,0), "SSL_shutdown"}, | 195 | {ERR_PACK(0,SSL_F_SSL_SHUTDOWN,0), "SSL_shutdown"}, |
196 | {ERR_PACK(0,SSL_F_SSL_UNDEFINED_CONST_FUNCTION,0), "SSL_UNDEFINED_CONST_FUNCTION"}, | ||
196 | {ERR_PACK(0,SSL_F_SSL_UNDEFINED_FUNCTION,0), "SSL_UNDEFINED_FUNCTION"}, | 197 | {ERR_PACK(0,SSL_F_SSL_UNDEFINED_FUNCTION,0), "SSL_UNDEFINED_FUNCTION"}, |
197 | {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE,0), "SSL_use_certificate"}, | 198 | {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE,0), "SSL_use_certificate"}, |
198 | {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE_ASN1,0), "SSL_use_certificate_ASN1"}, | 199 | {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE_ASN1,0), "SSL_use_certificate_ASN1"}, |
@@ -334,6 +335,7 @@ static ERR_STRING_DATA SSL_str_reasons[]= | |||
334 | {SSL_R_NULL_SSL_CTX ,"null ssl ctx"}, | 335 | {SSL_R_NULL_SSL_CTX ,"null ssl ctx"}, |
335 | {SSL_R_NULL_SSL_METHOD_PASSED ,"null ssl method passed"}, | 336 | {SSL_R_NULL_SSL_METHOD_PASSED ,"null ssl method passed"}, |
336 | {SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED ,"old session cipher not returned"}, | 337 | {SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED ,"old session cipher not returned"}, |
338 | {SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE ,"only tls allowed in fips mode"}, | ||
337 | {SSL_R_PACKET_LENGTH_TOO_LONG ,"packet length too long"}, | 339 | {SSL_R_PACKET_LENGTH_TOO_LONG ,"packet length too long"}, |
338 | {SSL_R_PATH_TOO_LONG ,"path too long"}, | 340 | {SSL_R_PATH_TOO_LONG ,"path too long"}, |
339 | {SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE ,"peer did not return a certificate"}, | 341 | {SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE ,"peer did not return a certificate"}, |
diff --git a/src/lib/libssl/src/ssl/ssl_lib.c b/src/lib/libssl/src/ssl/ssl_lib.c index ee9a82d586..631229558f 100644 --- a/src/lib/libssl/src/ssl/ssl_lib.c +++ b/src/lib/libssl/src/ssl/ssl_lib.c | |||
@@ -121,6 +121,7 @@ | |||
121 | #include <openssl/objects.h> | 121 | #include <openssl/objects.h> |
122 | #include <openssl/lhash.h> | 122 | #include <openssl/lhash.h> |
123 | #include <openssl/x509v3.h> | 123 | #include <openssl/x509v3.h> |
124 | #include <openssl/fips.h> | ||
124 | 125 | ||
125 | const char *SSL_version_str=OPENSSL_VERSION_TEXT; | 126 | const char *SSL_version_str=OPENSSL_VERSION_TEXT; |
126 | 127 | ||
@@ -500,18 +501,18 @@ void SSL_set_bio(SSL *s,BIO *rbio,BIO *wbio) | |||
500 | s->wbio=wbio; | 501 | s->wbio=wbio; |
501 | } | 502 | } |
502 | 503 | ||
503 | BIO *SSL_get_rbio(SSL *s) | 504 | BIO *SSL_get_rbio(const SSL *s) |
504 | { return(s->rbio); } | 505 | { return(s->rbio); } |
505 | 506 | ||
506 | BIO *SSL_get_wbio(SSL *s) | 507 | BIO *SSL_get_wbio(const SSL *s) |
507 | { return(s->wbio); } | 508 | { return(s->wbio); } |
508 | 509 | ||
509 | int SSL_get_fd(SSL *s) | 510 | int SSL_get_fd(const SSL *s) |
510 | { | 511 | { |
511 | return(SSL_get_rfd(s)); | 512 | return(SSL_get_rfd(s)); |
512 | } | 513 | } |
513 | 514 | ||
514 | int SSL_get_rfd(SSL *s) | 515 | int SSL_get_rfd(const SSL *s) |
515 | { | 516 | { |
516 | int ret= -1; | 517 | int ret= -1; |
517 | BIO *b,*r; | 518 | BIO *b,*r; |
@@ -523,7 +524,7 @@ int SSL_get_rfd(SSL *s) | |||
523 | return(ret); | 524 | return(ret); |
524 | } | 525 | } |
525 | 526 | ||
526 | int SSL_get_wfd(SSL *s) | 527 | int SSL_get_wfd(const SSL *s) |
527 | { | 528 | { |
528 | int ret= -1; | 529 | int ret= -1; |
529 | BIO *b,*r; | 530 | BIO *b,*r; |
@@ -605,7 +606,7 @@ err: | |||
605 | 606 | ||
606 | 607 | ||
607 | /* return length of latest Finished message we sent, copy to 'buf' */ | 608 | /* return length of latest Finished message we sent, copy to 'buf' */ |
608 | size_t SSL_get_finished(SSL *s, void *buf, size_t count) | 609 | size_t SSL_get_finished(const SSL *s, void *buf, size_t count) |
609 | { | 610 | { |
610 | size_t ret = 0; | 611 | size_t ret = 0; |
611 | 612 | ||
@@ -620,7 +621,7 @@ size_t SSL_get_finished(SSL *s, void *buf, size_t count) | |||
620 | } | 621 | } |
621 | 622 | ||
622 | /* return length of latest Finished message we expected, copy to 'buf' */ | 623 | /* return length of latest Finished message we expected, copy to 'buf' */ |
623 | size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count) | 624 | size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count) |
624 | { | 625 | { |
625 | size_t ret = 0; | 626 | size_t ret = 0; |
626 | 627 | ||
@@ -635,32 +636,32 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count) | |||
635 | } | 636 | } |
636 | 637 | ||
637 | 638 | ||
638 | int SSL_get_verify_mode(SSL *s) | 639 | int SSL_get_verify_mode(const SSL *s) |
639 | { | 640 | { |
640 | return(s->verify_mode); | 641 | return(s->verify_mode); |
641 | } | 642 | } |
642 | 643 | ||
643 | int SSL_get_verify_depth(SSL *s) | 644 | int SSL_get_verify_depth(const SSL *s) |
644 | { | 645 | { |
645 | return(s->verify_depth); | 646 | return(s->verify_depth); |
646 | } | 647 | } |
647 | 648 | ||
648 | int (*SSL_get_verify_callback(SSL *s))(int,X509_STORE_CTX *) | 649 | int (*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *) |
649 | { | 650 | { |
650 | return(s->verify_callback); | 651 | return(s->verify_callback); |
651 | } | 652 | } |
652 | 653 | ||
653 | int SSL_CTX_get_verify_mode(SSL_CTX *ctx) | 654 | int SSL_CTX_get_verify_mode(const SSL_CTX *ctx) |
654 | { | 655 | { |
655 | return(ctx->verify_mode); | 656 | return(ctx->verify_mode); |
656 | } | 657 | } |
657 | 658 | ||
658 | int SSL_CTX_get_verify_depth(SSL_CTX *ctx) | 659 | int SSL_CTX_get_verify_depth(const SSL_CTX *ctx) |
659 | { | 660 | { |
660 | return(ctx->verify_depth); | 661 | return(ctx->verify_depth); |
661 | } | 662 | } |
662 | 663 | ||
663 | int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *) | 664 | int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *) |
664 | { | 665 | { |
665 | return(ctx->default_verify_callback); | 666 | return(ctx->default_verify_callback); |
666 | } | 667 | } |
@@ -683,12 +684,12 @@ void SSL_set_read_ahead(SSL *s,int yes) | |||
683 | s->read_ahead=yes; | 684 | s->read_ahead=yes; |
684 | } | 685 | } |
685 | 686 | ||
686 | int SSL_get_read_ahead(SSL *s) | 687 | int SSL_get_read_ahead(const SSL *s) |
687 | { | 688 | { |
688 | return(s->read_ahead); | 689 | return(s->read_ahead); |
689 | } | 690 | } |
690 | 691 | ||
691 | int SSL_pending(SSL *s) | 692 | int SSL_pending(const SSL *s) |
692 | { | 693 | { |
693 | /* SSL_pending cannot work properly if read-ahead is enabled | 694 | /* SSL_pending cannot work properly if read-ahead is enabled |
694 | * (SSL_[CTX_]ctrl(..., SSL_CTRL_SET_READ_AHEAD, 1, NULL)), | 695 | * (SSL_[CTX_]ctrl(..., SSL_CTRL_SET_READ_AHEAD, 1, NULL)), |
@@ -700,7 +701,7 @@ int SSL_pending(SSL *s) | |||
700 | return(s->method->ssl_pending(s)); | 701 | return(s->method->ssl_pending(s)); |
701 | } | 702 | } |
702 | 703 | ||
703 | X509 *SSL_get_peer_certificate(SSL *s) | 704 | X509 *SSL_get_peer_certificate(const SSL *s) |
704 | { | 705 | { |
705 | X509 *r; | 706 | X509 *r; |
706 | 707 | ||
@@ -716,7 +717,7 @@ X509 *SSL_get_peer_certificate(SSL *s) | |||
716 | return(r); | 717 | return(r); |
717 | } | 718 | } |
718 | 719 | ||
719 | STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s) | 720 | STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s) |
720 | { | 721 | { |
721 | STACK_OF(X509) *r; | 722 | STACK_OF(X509) *r; |
722 | 723 | ||
@@ -733,7 +734,7 @@ STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s) | |||
733 | 734 | ||
734 | /* Now in theory, since the calling process own 't' it should be safe to | 735 | /* Now in theory, since the calling process own 't' it should be safe to |
735 | * modify. We need to be able to read f without being hassled */ | 736 | * modify. We need to be able to read f without being hassled */ |
736 | void SSL_copy_session_id(SSL *t,SSL *f) | 737 | void SSL_copy_session_id(SSL *t,const SSL *f) |
737 | { | 738 | { |
738 | CERT *tmp; | 739 | CERT *tmp; |
739 | 740 | ||
@@ -762,7 +763,7 @@ void SSL_copy_session_id(SSL *t,SSL *f) | |||
762 | } | 763 | } |
763 | 764 | ||
764 | /* Fix this so it checks all the valid key/cert options */ | 765 | /* Fix this so it checks all the valid key/cert options */ |
765 | int SSL_CTX_check_private_key(SSL_CTX *ctx) | 766 | int SSL_CTX_check_private_key(const SSL_CTX *ctx) |
766 | { | 767 | { |
767 | if ( (ctx == NULL) || | 768 | if ( (ctx == NULL) || |
768 | (ctx->cert == NULL) || | 769 | (ctx->cert == NULL) || |
@@ -780,7 +781,7 @@ int SSL_CTX_check_private_key(SSL_CTX *ctx) | |||
780 | } | 781 | } |
781 | 782 | ||
782 | /* Fix this function so that it takes an optional type parameter */ | 783 | /* Fix this function so that it takes an optional type parameter */ |
783 | int SSL_check_private_key(SSL *ssl) | 784 | int SSL_check_private_key(const SSL *ssl) |
784 | { | 785 | { |
785 | if (ssl == NULL) | 786 | if (ssl == NULL) |
786 | { | 787 | { |
@@ -824,7 +825,7 @@ int SSL_connect(SSL *s) | |||
824 | return(s->method->ssl_connect(s)); | 825 | return(s->method->ssl_connect(s)); |
825 | } | 826 | } |
826 | 827 | ||
827 | long SSL_get_default_timeout(SSL *s) | 828 | long SSL_get_default_timeout(const SSL *s) |
828 | { | 829 | { |
829 | return(s->method->get_timeout()); | 830 | return(s->method->get_timeout()); |
830 | } | 831 | } |
@@ -1071,7 +1072,7 @@ int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, | |||
1071 | 1072 | ||
1072 | /** return a STACK of the ciphers available for the SSL and in order of | 1073 | /** return a STACK of the ciphers available for the SSL and in order of |
1073 | * preference */ | 1074 | * preference */ |
1074 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s) | 1075 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s) |
1075 | { | 1076 | { |
1076 | if (s != NULL) | 1077 | if (s != NULL) |
1077 | { | 1078 | { |
@@ -1108,7 +1109,7 @@ STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s) | |||
1108 | } | 1109 | } |
1109 | 1110 | ||
1110 | /** The old interface to get the same thing as SSL_get_ciphers() */ | 1111 | /** The old interface to get the same thing as SSL_get_ciphers() */ |
1111 | const char *SSL_get_cipher_list(SSL *s,int n) | 1112 | const char *SSL_get_cipher_list(const SSL *s,int n) |
1112 | { | 1113 | { |
1113 | SSL_CIPHER *c; | 1114 | SSL_CIPHER *c; |
1114 | STACK_OF(SSL_CIPHER) *sk; | 1115 | STACK_OF(SSL_CIPHER) *sk; |
@@ -1145,7 +1146,7 @@ int SSL_set_cipher_list(SSL *s,const char *str) | |||
1145 | } | 1146 | } |
1146 | 1147 | ||
1147 | /* works well for SSLv2, not so good for SSLv3 */ | 1148 | /* works well for SSLv2, not so good for SSLv3 */ |
1148 | char *SSL_get_shared_ciphers(SSL *s,char *buf,int len) | 1149 | char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len) |
1149 | { | 1150 | { |
1150 | char *p; | 1151 | char *p; |
1151 | const char *cp; | 1152 | const char *cp; |
@@ -1249,7 +1250,7 @@ err: | |||
1249 | return(NULL); | 1250 | return(NULL); |
1250 | } | 1251 | } |
1251 | 1252 | ||
1252 | unsigned long SSL_SESSION_hash(SSL_SESSION *a) | 1253 | unsigned long SSL_SESSION_hash(const SSL_SESSION *a) |
1253 | { | 1254 | { |
1254 | unsigned long l; | 1255 | unsigned long l; |
1255 | 1256 | ||
@@ -1266,7 +1267,7 @@ unsigned long SSL_SESSION_hash(SSL_SESSION *a) | |||
1266 | * SSL_CTX_has_matching_session_id() is checked accordingly. It relies on being | 1267 | * SSL_CTX_has_matching_session_id() is checked accordingly. It relies on being |
1267 | * able to construct an SSL_SESSION that will collide with any existing session | 1268 | * able to construct an SSL_SESSION that will collide with any existing session |
1268 | * with a matching session ID. */ | 1269 | * with a matching session ID. */ |
1269 | int SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b) | 1270 | int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b) |
1270 | { | 1271 | { |
1271 | if (a->ssl_version != b->ssl_version) | 1272 | if (a->ssl_version != b->ssl_version) |
1272 | return(1); | 1273 | return(1); |
@@ -1292,6 +1293,14 @@ SSL_CTX *SSL_CTX_new(SSL_METHOD *meth) | |||
1292 | return(NULL); | 1293 | return(NULL); |
1293 | } | 1294 | } |
1294 | 1295 | ||
1296 | #ifdef OPENSSL_FIPS | ||
1297 | if (FIPS_mode() && (meth->version < TLS1_VERSION)) | ||
1298 | { | ||
1299 | SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); | ||
1300 | return NULL; | ||
1301 | } | ||
1302 | #endif | ||
1303 | |||
1295 | if (SSL_get_ex_data_X509_STORE_CTX_idx() < 0) | 1304 | if (SSL_get_ex_data_X509_STORE_CTX_idx() < 0) |
1296 | { | 1305 | { |
1297 | SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); | 1306 | SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); |
@@ -1722,7 +1731,7 @@ int SSL_set_ssl_method(SSL *s,SSL_METHOD *meth) | |||
1722 | return(ret); | 1731 | return(ret); |
1723 | } | 1732 | } |
1724 | 1733 | ||
1725 | int SSL_get_error(SSL *s,int i) | 1734 | int SSL_get_error(const SSL *s,int i) |
1726 | { | 1735 | { |
1727 | int reason; | 1736 | int reason; |
1728 | unsigned long l; | 1737 | unsigned long l; |
@@ -1856,13 +1865,19 @@ int ssl_undefined_function(SSL *s) | |||
1856 | return(0); | 1865 | return(0); |
1857 | } | 1866 | } |
1858 | 1867 | ||
1868 | int ssl_undefined_const_function(const SSL *s) | ||
1869 | { | ||
1870 | SSLerr(SSL_F_SSL_UNDEFINED_CONST_FUNCTION,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
1871 | return(0); | ||
1872 | } | ||
1873 | |||
1859 | SSL_METHOD *ssl_bad_method(int ver) | 1874 | SSL_METHOD *ssl_bad_method(int ver) |
1860 | { | 1875 | { |
1861 | SSLerr(SSL_F_SSL_BAD_METHOD,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1876 | SSLerr(SSL_F_SSL_BAD_METHOD,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
1862 | return(NULL); | 1877 | return(NULL); |
1863 | } | 1878 | } |
1864 | 1879 | ||
1865 | const char *SSL_get_version(SSL *s) | 1880 | const char *SSL_get_version(const SSL *s) |
1866 | { | 1881 | { |
1867 | if (s->version == TLS1_VERSION) | 1882 | if (s->version == TLS1_VERSION) |
1868 | return("TLSv1"); | 1883 | return("TLSv1"); |
@@ -2031,7 +2046,7 @@ void ssl_clear_cipher_ctx(SSL *s) | |||
2031 | } | 2046 | } |
2032 | 2047 | ||
2033 | /* Fix this function so that it takes an optional type parameter */ | 2048 | /* Fix this function so that it takes an optional type parameter */ |
2034 | X509 *SSL_get_certificate(SSL *s) | 2049 | X509 *SSL_get_certificate(const SSL *s) |
2035 | { | 2050 | { |
2036 | if (s->cert != NULL) | 2051 | if (s->cert != NULL) |
2037 | return(s->cert->key->x509); | 2052 | return(s->cert->key->x509); |
@@ -2048,7 +2063,7 @@ EVP_PKEY *SSL_get_privatekey(SSL *s) | |||
2048 | return(NULL); | 2063 | return(NULL); |
2049 | } | 2064 | } |
2050 | 2065 | ||
2051 | SSL_CIPHER *SSL_get_current_cipher(SSL *s) | 2066 | SSL_CIPHER *SSL_get_current_cipher(const SSL *s) |
2052 | { | 2067 | { |
2053 | if ((s->session != NULL) && (s->session->cipher != NULL)) | 2068 | if ((s->session != NULL) && (s->session->cipher != NULL)) |
2054 | return(s->session->cipher); | 2069 | return(s->session->cipher); |
@@ -2112,7 +2127,7 @@ void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode) | |||
2112 | ctx->quiet_shutdown=mode; | 2127 | ctx->quiet_shutdown=mode; |
2113 | } | 2128 | } |
2114 | 2129 | ||
2115 | int SSL_CTX_get_quiet_shutdown(SSL_CTX *ctx) | 2130 | int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx) |
2116 | { | 2131 | { |
2117 | return(ctx->quiet_shutdown); | 2132 | return(ctx->quiet_shutdown); |
2118 | } | 2133 | } |
@@ -2122,7 +2137,7 @@ void SSL_set_quiet_shutdown(SSL *s,int mode) | |||
2122 | s->quiet_shutdown=mode; | 2137 | s->quiet_shutdown=mode; |
2123 | } | 2138 | } |
2124 | 2139 | ||
2125 | int SSL_get_quiet_shutdown(SSL *s) | 2140 | int SSL_get_quiet_shutdown(const SSL *s) |
2126 | { | 2141 | { |
2127 | return(s->quiet_shutdown); | 2142 | return(s->quiet_shutdown); |
2128 | } | 2143 | } |
@@ -2132,17 +2147,17 @@ void SSL_set_shutdown(SSL *s,int mode) | |||
2132 | s->shutdown=mode; | 2147 | s->shutdown=mode; |
2133 | } | 2148 | } |
2134 | 2149 | ||
2135 | int SSL_get_shutdown(SSL *s) | 2150 | int SSL_get_shutdown(const SSL *s) |
2136 | { | 2151 | { |
2137 | return(s->shutdown); | 2152 | return(s->shutdown); |
2138 | } | 2153 | } |
2139 | 2154 | ||
2140 | int SSL_version(SSL *s) | 2155 | int SSL_version(const SSL *s) |
2141 | { | 2156 | { |
2142 | return(s->version); | 2157 | return(s->version); |
2143 | } | 2158 | } |
2144 | 2159 | ||
2145 | SSL_CTX *SSL_get_SSL_CTX(SSL *ssl) | 2160 | SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl) |
2146 | { | 2161 | { |
2147 | return(ssl->ctx); | 2162 | return(ssl->ctx); |
2148 | } | 2163 | } |
@@ -2156,7 +2171,9 @@ int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx) | |||
2156 | int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, | 2171 | int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, |
2157 | const char *CApath) | 2172 | const char *CApath) |
2158 | { | 2173 | { |
2159 | return(X509_STORE_load_locations(ctx->cert_store,CAfile,CApath)); | 2174 | int r; |
2175 | r=X509_STORE_load_locations(ctx->cert_store,CAfile,CApath); | ||
2176 | return r; | ||
2160 | } | 2177 | } |
2161 | #endif | 2178 | #endif |
2162 | 2179 | ||
@@ -2166,12 +2183,12 @@ void SSL_set_info_callback(SSL *ssl, | |||
2166 | ssl->info_callback=cb; | 2183 | ssl->info_callback=cb; |
2167 | } | 2184 | } |
2168 | 2185 | ||
2169 | void (*SSL_get_info_callback(SSL *ssl))(const SSL *ssl,int type,int val) | 2186 | void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val) |
2170 | { | 2187 | { |
2171 | return ssl->info_callback; | 2188 | return ssl->info_callback; |
2172 | } | 2189 | } |
2173 | 2190 | ||
2174 | int SSL_state(SSL *ssl) | 2191 | int SSL_state(const SSL *ssl) |
2175 | { | 2192 | { |
2176 | return(ssl->state); | 2193 | return(ssl->state); |
2177 | } | 2194 | } |
@@ -2181,7 +2198,7 @@ void SSL_set_verify_result(SSL *ssl,long arg) | |||
2181 | ssl->verify_result=arg; | 2198 | ssl->verify_result=arg; |
2182 | } | 2199 | } |
2183 | 2200 | ||
2184 | long SSL_get_verify_result(SSL *ssl) | 2201 | long SSL_get_verify_result(const SSL *ssl) |
2185 | { | 2202 | { |
2186 | return(ssl->verify_result); | 2203 | return(ssl->verify_result); |
2187 | } | 2204 | } |
@@ -2198,7 +2215,7 @@ int SSL_set_ex_data(SSL *s,int idx,void *arg) | |||
2198 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); | 2215 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); |
2199 | } | 2216 | } |
2200 | 2217 | ||
2201 | void *SSL_get_ex_data(SSL *s,int idx) | 2218 | void *SSL_get_ex_data(const SSL *s,int idx) |
2202 | { | 2219 | { |
2203 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); | 2220 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); |
2204 | } | 2221 | } |
@@ -2215,7 +2232,7 @@ int SSL_CTX_set_ex_data(SSL_CTX *s,int idx,void *arg) | |||
2215 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); | 2232 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); |
2216 | } | 2233 | } |
2217 | 2234 | ||
2218 | void *SSL_CTX_get_ex_data(SSL_CTX *s,int idx) | 2235 | void *SSL_CTX_get_ex_data(const SSL_CTX *s,int idx) |
2219 | { | 2236 | { |
2220 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); | 2237 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); |
2221 | } | 2238 | } |
@@ -2225,7 +2242,7 @@ int ssl_ok(SSL *s) | |||
2225 | return(1); | 2242 | return(1); |
2226 | } | 2243 | } |
2227 | 2244 | ||
2228 | X509_STORE *SSL_CTX_get_cert_store(SSL_CTX *ctx) | 2245 | X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx) |
2229 | { | 2246 | { |
2230 | return(ctx->cert_store); | 2247 | return(ctx->cert_store); |
2231 | } | 2248 | } |
@@ -2237,7 +2254,7 @@ void SSL_CTX_set_cert_store(SSL_CTX *ctx,X509_STORE *store) | |||
2237 | ctx->cert_store=store; | 2254 | ctx->cert_store=store; |
2238 | } | 2255 | } |
2239 | 2256 | ||
2240 | int SSL_want(SSL *s) | 2257 | int SSL_want(const SSL *s) |
2241 | { | 2258 | { |
2242 | return(s->rwstate); | 2259 | return(s->rwstate); |
2243 | } | 2260 | } |
diff --git a/src/lib/libssl/src/ssl/ssl_locl.h b/src/lib/libssl/src/ssl/ssl_locl.h index dd6c7a7323..25a144a0d0 100644 --- a/src/lib/libssl/src/ssl/ssl_locl.h +++ b/src/lib/libssl/src/ssl/ssl_locl.h | |||
@@ -302,8 +302,9 @@ | |||
302 | #define SSL_LOW 0x00000020L | 302 | #define SSL_LOW 0x00000020L |
303 | #define SSL_MEDIUM 0x00000040L | 303 | #define SSL_MEDIUM 0x00000040L |
304 | #define SSL_HIGH 0x00000080L | 304 | #define SSL_HIGH 0x00000080L |
305 | #define SSL_FIPS 0x00000100L | ||
305 | 306 | ||
306 | /* we have used 000000ff - 24 bits left to go */ | 307 | /* we have used 000001ff - 23 bits left to go */ |
307 | 308 | ||
308 | /* | 309 | /* |
309 | * Macros to check the export status and cipher strength for export ciphers. | 310 | * Macros to check the export status and cipher strength for export ciphers. |
@@ -498,10 +499,11 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, | |||
498 | STACK_OF(SSL_CIPHER) **sorted, | 499 | STACK_OF(SSL_CIPHER) **sorted, |
499 | const char *rule_str); | 500 | const char *rule_str); |
500 | void ssl_update_cache(SSL *s, int mode); | 501 | void ssl_update_cache(SSL *s, int mode); |
501 | int ssl_cipher_get_evp(SSL_SESSION *s,const EVP_CIPHER **enc,const EVP_MD **md, | 502 | int ssl_cipher_get_evp(const SSL_SESSION *s,const EVP_CIPHER **enc, |
502 | SSL_COMP **comp); | 503 | const EVP_MD **md,SSL_COMP **comp); |
503 | int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); | 504 | int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); |
504 | int ssl_undefined_function(SSL *s); | 505 | int ssl_undefined_function(SSL *s); |
506 | int ssl_undefined_const_function(const SSL *s); | ||
505 | X509 *ssl_get_server_send_cert(SSL *); | 507 | X509 *ssl_get_server_send_cert(SSL *); |
506 | EVP_PKEY *ssl_get_sign_pkey(SSL *,SSL_CIPHER *); | 508 | EVP_PKEY *ssl_get_sign_pkey(SSL *,SSL_CIPHER *); |
507 | int ssl_cert_type(X509 *x,EVP_PKEY *pkey); | 509 | int ssl_cert_type(X509 *x,EVP_PKEY *pkey); |
@@ -535,7 +537,7 @@ long ssl2_ctrl(SSL *s,int cmd, long larg, void *parg); | |||
535 | long ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); | 537 | long ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); |
536 | long ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)()); | 538 | long ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)()); |
537 | long ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)()); | 539 | long ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)()); |
538 | int ssl2_pending(SSL *s); | 540 | int ssl2_pending(const SSL *s); |
539 | 541 | ||
540 | SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); | 542 | SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); |
541 | int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); | 543 | int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); |
@@ -583,7 +585,7 @@ long ssl3_ctrl(SSL *s,int cmd, long larg, void *parg); | |||
583 | long ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); | 585 | long ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); |
584 | long ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)()); | 586 | long ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)()); |
585 | long ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)()); | 587 | long ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)()); |
586 | int ssl3_pending(SSL *s); | 588 | int ssl3_pending(const SSL *s); |
587 | 589 | ||
588 | int ssl23_accept(SSL *s); | 590 | int ssl23_accept(SSL *s); |
589 | int ssl23_connect(SSL *s); | 591 | int ssl23_connect(SSL *s); |
diff --git a/src/lib/libssl/src/ssl/ssl_rsa.c b/src/lib/libssl/src/ssl/ssl_rsa.c index 330390519b..fb0bd4d045 100644 --- a/src/lib/libssl/src/ssl/ssl_rsa.c +++ b/src/lib/libssl/src/ssl/ssl_rsa.c | |||
@@ -804,7 +804,7 @@ int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file) | |||
804 | /* When the while loop ends, it's usually just EOF. */ | 804 | /* When the while loop ends, it's usually just EOF. */ |
805 | err = ERR_peek_last_error(); | 805 | err = ERR_peek_last_error(); |
806 | if (ERR_GET_LIB(err) == ERR_LIB_PEM && ERR_GET_REASON(err) == PEM_R_NO_START_LINE) | 806 | if (ERR_GET_LIB(err) == ERR_LIB_PEM && ERR_GET_REASON(err) == PEM_R_NO_START_LINE) |
807 | (void)ERR_get_error(); | 807 | ERR_clear_error(); |
808 | else | 808 | else |
809 | ret = 0; /* some real error */ | 809 | ret = 0; /* some real error */ |
810 | } | 810 | } |
diff --git a/src/lib/libssl/src/ssl/ssl_sess.c b/src/lib/libssl/src/ssl/ssl_sess.c index 7016c87d3b..5f12aa361c 100644 --- a/src/lib/libssl/src/ssl/ssl_sess.c +++ b/src/lib/libssl/src/ssl/ssl_sess.c | |||
@@ -65,7 +65,7 @@ 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); | 65 | static void SSL_SESSION_list_add(SSL_CTX *ctx,SSL_SESSION *s); |
66 | static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck); | 66 | static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck); |
67 | 67 | ||
68 | SSL_SESSION *SSL_get_session(SSL *ssl) | 68 | SSL_SESSION *SSL_get_session(const SSL *ssl) |
69 | /* aka SSL_get0_session; gets 0 objects, just returns a copy of the pointer */ | 69 | /* aka SSL_get0_session; gets 0 objects, just returns a copy of the pointer */ |
70 | { | 70 | { |
71 | return(ssl->session); | 71 | return(ssl->session); |
@@ -98,7 +98,7 @@ int SSL_SESSION_set_ex_data(SSL_SESSION *s, int idx, void *arg) | |||
98 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); | 98 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); |
99 | } | 99 | } |
100 | 100 | ||
101 | void *SSL_SESSION_get_ex_data(SSL_SESSION *s, int idx) | 101 | void *SSL_SESSION_get_ex_data(const SSL_SESSION *s, int idx) |
102 | { | 102 | { |
103 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); | 103 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); |
104 | } | 104 | } |
@@ -141,7 +141,8 @@ static int def_generate_session_id(const SSL *ssl, unsigned char *id, | |||
141 | { | 141 | { |
142 | unsigned int retry = 0; | 142 | unsigned int retry = 0; |
143 | do | 143 | do |
144 | RAND_pseudo_bytes(id, *id_len); | 144 | if(RAND_pseudo_bytes(id, *id_len) <= 0) |
145 | return 0; | ||
145 | while(SSL_has_matching_session_id(ssl, id, *id_len) && | 146 | while(SSL_has_matching_session_id(ssl, id, *id_len) && |
146 | (++retry < MAX_SESS_ID_ATTEMPTS)); | 147 | (++retry < MAX_SESS_ID_ATTEMPTS)); |
147 | if(retry < MAX_SESS_ID_ATTEMPTS) | 148 | if(retry < MAX_SESS_ID_ATTEMPTS) |
@@ -609,13 +610,13 @@ long SSL_SESSION_set_timeout(SSL_SESSION *s, long t) | |||
609 | return(1); | 610 | return(1); |
610 | } | 611 | } |
611 | 612 | ||
612 | long SSL_SESSION_get_timeout(SSL_SESSION *s) | 613 | long SSL_SESSION_get_timeout(const SSL_SESSION *s) |
613 | { | 614 | { |
614 | if (s == NULL) return(0); | 615 | if (s == NULL) return(0); |
615 | return(s->timeout); | 616 | return(s->timeout); |
616 | } | 617 | } |
617 | 618 | ||
618 | long SSL_SESSION_get_time(SSL_SESSION *s) | 619 | long SSL_SESSION_get_time(const SSL_SESSION *s) |
619 | { | 620 | { |
620 | if (s == NULL) return(0); | 621 | if (s == NULL) return(0); |
621 | return(s->time); | 622 | return(s->time); |
@@ -637,7 +638,7 @@ long SSL_CTX_set_timeout(SSL_CTX *s, long t) | |||
637 | return(l); | 638 | return(l); |
638 | } | 639 | } |
639 | 640 | ||
640 | long SSL_CTX_get_timeout(SSL_CTX *s) | 641 | long SSL_CTX_get_timeout(const SSL_CTX *s) |
641 | { | 642 | { |
642 | if (s == NULL) return(0); | 643 | if (s == NULL) return(0); |
643 | return(s->session_timeout); | 644 | return(s->session_timeout); |
diff --git a/src/lib/libssl/src/ssl/ssl_txt.c b/src/lib/libssl/src/ssl/ssl_txt.c index 40b76b1b26..8655a31333 100644 --- a/src/lib/libssl/src/ssl/ssl_txt.c +++ b/src/lib/libssl/src/ssl/ssl_txt.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #include "ssl_locl.h" | 61 | #include "ssl_locl.h" |
62 | 62 | ||
63 | #ifndef OPENSSL_NO_FP_API | 63 | #ifndef OPENSSL_NO_FP_API |
64 | int SSL_SESSION_print_fp(FILE *fp, SSL_SESSION *x) | 64 | int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x) |
65 | { | 65 | { |
66 | BIO *b; | 66 | BIO *b; |
67 | int ret; | 67 | int ret; |
@@ -78,7 +78,7 @@ int SSL_SESSION_print_fp(FILE *fp, SSL_SESSION *x) | |||
78 | } | 78 | } |
79 | #endif | 79 | #endif |
80 | 80 | ||
81 | int SSL_SESSION_print(BIO *bp, SSL_SESSION *x) | 81 | int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) |
82 | { | 82 | { |
83 | unsigned int i; | 83 | unsigned int i; |
84 | char *s; | 84 | char *s; |
diff --git a/src/lib/libssl/src/ssl/ssltest.c b/src/lib/libssl/src/ssl/ssltest.c index 033f309ffe..3a0db0cb51 100644 --- a/src/lib/libssl/src/ssl/ssltest.c +++ b/src/lib/libssl/src/ssl/ssltest.c | |||
@@ -120,6 +120,7 @@ | |||
120 | #include <string.h> | 120 | #include <string.h> |
121 | #include <time.h> | 121 | #include <time.h> |
122 | #include <inttypes.h> | 122 | #include <inttypes.h> |
123 | #include <ctype.h> | ||
123 | 124 | ||
124 | #define USE_SOCKETS | 125 | #define USE_SOCKETS |
125 | #include "e_os.h" | 126 | #include "e_os.h" |
@@ -128,12 +129,14 @@ | |||
128 | #include <openssl/crypto.h> | 129 | #include <openssl/crypto.h> |
129 | #include <openssl/evp.h> | 130 | #include <openssl/evp.h> |
130 | #include <openssl/x509.h> | 131 | #include <openssl/x509.h> |
132 | #include <openssl/x509v3.h> | ||
131 | #include <openssl/ssl.h> | 133 | #include <openssl/ssl.h> |
132 | #ifndef OPENSSL_NO_ENGINE | 134 | #ifndef OPENSSL_NO_ENGINE |
133 | #include <openssl/engine.h> | 135 | #include <openssl/engine.h> |
134 | #endif | 136 | #endif |
135 | #include <openssl/err.h> | 137 | #include <openssl/err.h> |
136 | #include <openssl/rand.h> | 138 | #include <openssl/rand.h> |
139 | #include <openssl/fips.h> | ||
137 | 140 | ||
138 | #define _XOPEN_SOURCE_EXTENDED 1 /* Or gethostname won't be declared properly | 141 | #define _XOPEN_SOURCE_EXTENDED 1 /* Or gethostname won't be declared properly |
139 | on Compaq platforms (at least with DEC C). | 142 | on Compaq platforms (at least with DEC C). |
@@ -169,8 +172,15 @@ static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export,int keylength); | |||
169 | static void free_tmp_rsa(void); | 172 | static void free_tmp_rsa(void); |
170 | #endif | 173 | #endif |
171 | static int MS_CALLBACK app_verify_callback(X509_STORE_CTX *ctx, void *arg); | 174 | static int MS_CALLBACK app_verify_callback(X509_STORE_CTX *ctx, void *arg); |
172 | #define APP_CALLBACK "Test Callback Argument" | 175 | #define APP_CALLBACK_STRING "Test Callback Argument" |
173 | static char *app_verify_arg = APP_CALLBACK; | 176 | struct app_verify_arg |
177 | { | ||
178 | char *string; | ||
179 | int app_verify; | ||
180 | int allow_proxy_certs; | ||
181 | char *proxy_auth; | ||
182 | char *proxy_cond; | ||
183 | }; | ||
174 | 184 | ||
175 | #ifndef OPENSSL_NO_DH | 185 | #ifndef OPENSSL_NO_DH |
176 | static DH *get_dh512(void); | 186 | static DH *get_dh512(void); |
@@ -199,8 +209,14 @@ static void sv_usage(void) | |||
199 | { | 209 | { |
200 | fprintf(stderr,"usage: ssltest [args ...]\n"); | 210 | fprintf(stderr,"usage: ssltest [args ...]\n"); |
201 | fprintf(stderr,"\n"); | 211 | fprintf(stderr,"\n"); |
212 | #ifdef OPENSSL_FIPS | ||
213 | fprintf(stderr,"-F - run test in FIPS mode\n"); | ||
214 | #endif | ||
202 | fprintf(stderr," -server_auth - check server certificate\n"); | 215 | fprintf(stderr," -server_auth - check server certificate\n"); |
203 | fprintf(stderr," -client_auth - do client authentication\n"); | 216 | fprintf(stderr," -client_auth - do client authentication\n"); |
217 | fprintf(stderr," -proxy - allow proxy certificates\n"); | ||
218 | fprintf(stderr," -proxy_auth <val> - set proxy policy rights\n"); | ||
219 | fprintf(stderr," -proxy_cond <val> - experssion to test proxy policy rights\n"); | ||
204 | fprintf(stderr," -v - more output\n"); | 220 | fprintf(stderr," -v - more output\n"); |
205 | fprintf(stderr," -d - debug output\n"); | 221 | fprintf(stderr," -d - debug output\n"); |
206 | fprintf(stderr," -reuse - use session-id reuse\n"); | 222 | fprintf(stderr," -reuse - use session-id reuse\n"); |
@@ -350,7 +366,8 @@ int main(int argc, char *argv[]) | |||
350 | int tls1=0,ssl2=0,ssl3=0,ret=1; | 366 | int tls1=0,ssl2=0,ssl3=0,ret=1; |
351 | int client_auth=0; | 367 | int client_auth=0; |
352 | int server_auth=0,i; | 368 | int server_auth=0,i; |
353 | int app_verify=0; | 369 | struct app_verify_arg app_verify_arg = |
370 | { APP_CALLBACK_STRING, 0, 0, NULL, NULL }; | ||
354 | char *server_cert=TEST_SERVER_CERT; | 371 | char *server_cert=TEST_SERVER_CERT; |
355 | char *server_key=NULL; | 372 | char *server_key=NULL; |
356 | char *client_cert=TEST_CLIENT_CERT; | 373 | char *client_cert=TEST_CLIENT_CERT; |
@@ -370,6 +387,10 @@ int main(int argc, char *argv[]) | |||
370 | clock_t s_time = 0, c_time = 0; | 387 | clock_t s_time = 0, c_time = 0; |
371 | int comp = 0; | 388 | int comp = 0; |
372 | COMP_METHOD *cm = NULL; | 389 | COMP_METHOD *cm = NULL; |
390 | #ifdef OPENSSL_FIPS | ||
391 | int fips_mode=0; | ||
392 | const char *path=argv[0]; | ||
393 | #endif | ||
373 | 394 | ||
374 | verbose = 0; | 395 | verbose = 0; |
375 | debug = 0; | 396 | debug = 0; |
@@ -401,10 +422,29 @@ int main(int argc, char *argv[]) | |||
401 | 422 | ||
402 | while (argc >= 1) | 423 | while (argc >= 1) |
403 | { | 424 | { |
404 | if (strcmp(*argv,"-server_auth") == 0) | 425 | if(!strcmp(*argv,"-F")) |
426 | { | ||
427 | #ifdef OPENSSL_FIPS | ||
428 | fips_mode=1; | ||
429 | #else | ||
430 | fprintf(stderr,"not compiled with FIPS support, so exitting without running.\n"); | ||
431 | EXIT(0); | ||
432 | #endif | ||
433 | } | ||
434 | else if (strcmp(*argv,"-server_auth") == 0) | ||
405 | server_auth=1; | 435 | server_auth=1; |
406 | else if (strcmp(*argv,"-client_auth") == 0) | 436 | else if (strcmp(*argv,"-client_auth") == 0) |
407 | client_auth=1; | 437 | client_auth=1; |
438 | else if (strcmp(*argv,"-proxy_auth") == 0) | ||
439 | { | ||
440 | if (--argc < 1) goto bad; | ||
441 | app_verify_arg.proxy_auth= *(++argv); | ||
442 | } | ||
443 | else if (strcmp(*argv,"-proxy_cond") == 0) | ||
444 | { | ||
445 | if (--argc < 1) goto bad; | ||
446 | app_verify_arg.proxy_cond= *(++argv); | ||
447 | } | ||
408 | else if (strcmp(*argv,"-v") == 0) | 448 | else if (strcmp(*argv,"-v") == 0) |
409 | verbose=1; | 449 | verbose=1; |
410 | else if (strcmp(*argv,"-d") == 0) | 450 | else if (strcmp(*argv,"-d") == 0) |
@@ -517,7 +557,11 @@ int main(int argc, char *argv[]) | |||
517 | } | 557 | } |
518 | else if (strcmp(*argv,"-app_verify") == 0) | 558 | else if (strcmp(*argv,"-app_verify") == 0) |
519 | { | 559 | { |
520 | app_verify = 1; | 560 | app_verify_arg.app_verify = 1; |
561 | } | ||
562 | else if (strcmp(*argv,"-proxy") == 0) | ||
563 | { | ||
564 | app_verify_arg.allow_proxy_certs = 1; | ||
521 | } | 565 | } |
522 | else | 566 | else |
523 | { | 567 | { |
@@ -535,6 +579,7 @@ bad: | |||
535 | goto end; | 579 | goto end; |
536 | } | 580 | } |
537 | 581 | ||
582 | |||
538 | if (!ssl2 && !ssl3 && !tls1 && number > 1 && !reuse && !force) | 583 | if (!ssl2 && !ssl3 && !tls1 && number > 1 && !reuse && !force) |
539 | { | 584 | { |
540 | fprintf(stderr, "This case cannot work. Use -f to perform " | 585 | fprintf(stderr, "This case cannot work. Use -f to perform " |
@@ -544,6 +589,20 @@ bad: | |||
544 | EXIT(1); | 589 | EXIT(1); |
545 | } | 590 | } |
546 | 591 | ||
592 | #ifdef OPENSSL_FIPS | ||
593 | if(fips_mode) | ||
594 | { | ||
595 | if(!FIPS_mode_set(1,path)) | ||
596 | { | ||
597 | ERR_load_crypto_strings(); | ||
598 | ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE)); | ||
599 | EXIT(1); | ||
600 | } | ||
601 | else | ||
602 | fprintf(stderr,"*** IN FIPS MODE ***\n"); | ||
603 | } | ||
604 | #endif | ||
605 | |||
547 | if (print_time) | 606 | if (print_time) |
548 | { | 607 | { |
549 | if (!bio_pair) | 608 | if (!bio_pair) |
@@ -677,20 +736,14 @@ bad: | |||
677 | SSL_CTX_set_verify(s_ctx, | 736 | SSL_CTX_set_verify(s_ctx, |
678 | SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT, | 737 | SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT, |
679 | verify_callback); | 738 | verify_callback); |
680 | if (app_verify) | 739 | SSL_CTX_set_cert_verify_callback(s_ctx, app_verify_callback, &app_verify_arg); |
681 | { | ||
682 | SSL_CTX_set_cert_verify_callback(s_ctx, app_verify_callback, app_verify_arg); | ||
683 | } | ||
684 | } | 740 | } |
685 | if (server_auth) | 741 | if (server_auth) |
686 | { | 742 | { |
687 | BIO_printf(bio_err,"server authentication\n"); | 743 | BIO_printf(bio_err,"server authentication\n"); |
688 | SSL_CTX_set_verify(c_ctx,SSL_VERIFY_PEER, | 744 | SSL_CTX_set_verify(c_ctx,SSL_VERIFY_PEER, |
689 | verify_callback); | 745 | verify_callback); |
690 | if (app_verify) | 746 | SSL_CTX_set_cert_verify_callback(c_ctx, app_verify_callback, &app_verify_arg); |
691 | { | ||
692 | SSL_CTX_set_cert_verify_callback(s_ctx, app_verify_callback, app_verify_arg); | ||
693 | } | ||
694 | } | 747 | } |
695 | 748 | ||
696 | { | 749 | { |
@@ -1472,6 +1525,22 @@ err: | |||
1472 | return(ret); | 1525 | return(ret); |
1473 | } | 1526 | } |
1474 | 1527 | ||
1528 | static int get_proxy_auth_ex_data_idx(void) | ||
1529 | { | ||
1530 | static volatile int idx = -1; | ||
1531 | if (idx < 0) | ||
1532 | { | ||
1533 | CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); | ||
1534 | if (idx < 0) | ||
1535 | { | ||
1536 | idx = X509_STORE_CTX_get_ex_new_index(0, | ||
1537 | "SSLtest for verify callback", NULL,NULL,NULL); | ||
1538 | } | ||
1539 | CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX); | ||
1540 | } | ||
1541 | return idx; | ||
1542 | } | ||
1543 | |||
1475 | static int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx) | 1544 | static int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx) |
1476 | { | 1545 | { |
1477 | char *s,buf[256]; | 1546 | char *s,buf[256]; |
@@ -1481,42 +1550,467 @@ static int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx) | |||
1481 | if (s != NULL) | 1550 | if (s != NULL) |
1482 | { | 1551 | { |
1483 | if (ok) | 1552 | if (ok) |
1484 | fprintf(stderr,"depth=%d %s\n",ctx->error_depth,buf); | 1553 | fprintf(stderr,"depth=%d %s\n", |
1554 | ctx->error_depth,buf); | ||
1485 | else | 1555 | else |
1556 | { | ||
1486 | fprintf(stderr,"depth=%d error=%d %s\n", | 1557 | fprintf(stderr,"depth=%d error=%d %s\n", |
1487 | ctx->error_depth,ctx->error,buf); | 1558 | ctx->error_depth,ctx->error,buf); |
1559 | } | ||
1488 | } | 1560 | } |
1489 | 1561 | ||
1490 | if (ok == 0) | 1562 | if (ok == 0) |
1491 | { | 1563 | { |
1564 | fprintf(stderr,"Error string: %s\n", | ||
1565 | X509_verify_cert_error_string(ctx->error)); | ||
1492 | switch (ctx->error) | 1566 | switch (ctx->error) |
1493 | { | 1567 | { |
1494 | case X509_V_ERR_CERT_NOT_YET_VALID: | 1568 | case X509_V_ERR_CERT_NOT_YET_VALID: |
1495 | case X509_V_ERR_CERT_HAS_EXPIRED: | 1569 | case X509_V_ERR_CERT_HAS_EXPIRED: |
1496 | case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: | 1570 | case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: |
1571 | fprintf(stderr," ... ignored.\n"); | ||
1497 | ok=1; | 1572 | ok=1; |
1498 | } | 1573 | } |
1499 | } | 1574 | } |
1500 | 1575 | ||
1576 | if (ok == 1) | ||
1577 | { | ||
1578 | X509 *xs = ctx->current_cert; | ||
1579 | #if 0 | ||
1580 | X509 *xi = ctx->current_issuer; | ||
1581 | #endif | ||
1582 | |||
1583 | if (xs->ex_flags & EXFLAG_PROXY) | ||
1584 | { | ||
1585 | unsigned int *letters = | ||
1586 | X509_STORE_CTX_get_ex_data(ctx, | ||
1587 | get_proxy_auth_ex_data_idx()); | ||
1588 | |||
1589 | if (letters) | ||
1590 | { | ||
1591 | int found_any = 0; | ||
1592 | int i; | ||
1593 | PROXY_CERT_INFO_EXTENSION *pci = | ||
1594 | X509_get_ext_d2i(xs, NID_proxyCertInfo, | ||
1595 | NULL, NULL); | ||
1596 | |||
1597 | switch (OBJ_obj2nid(pci->proxyPolicy->policyLanguage)) | ||
1598 | { | ||
1599 | case NID_Independent: | ||
1600 | /* Completely meaningless in this | ||
1601 | program, as there's no way to | ||
1602 | grant explicit rights to a | ||
1603 | specific PrC. Basically, using | ||
1604 | id-ppl-Independent is the perfect | ||
1605 | way to grant no rights at all. */ | ||
1606 | fprintf(stderr, " Independent proxy certificate"); | ||
1607 | for (i = 0; i < 26; i++) | ||
1608 | letters[i] = 0; | ||
1609 | break; | ||
1610 | case NID_id_ppl_inheritAll: | ||
1611 | /* This is basically a NOP, we | ||
1612 | simply let the current rights | ||
1613 | stand as they are. */ | ||
1614 | fprintf(stderr, " Proxy certificate inherits all"); | ||
1615 | break; | ||
1616 | default: | ||
1617 | s = (char *) | ||
1618 | pci->proxyPolicy->policy->data; | ||
1619 | i = pci->proxyPolicy->policy->length; | ||
1620 | |||
1621 | /* The algorithm works as follows: | ||
1622 | it is assumed that previous | ||
1623 | iterations or the initial granted | ||
1624 | rights has already set some elements | ||
1625 | of `letters'. What we need to do is | ||
1626 | to clear those that weren't granted | ||
1627 | by the current PrC as well. The | ||
1628 | easiest way to do this is to add 1 | ||
1629 | to all the elements whose letters | ||
1630 | are given with the current policy. | ||
1631 | That way, all elements that are set | ||
1632 | by the current policy and were | ||
1633 | already set by earlier policies and | ||
1634 | through the original grant of rights | ||
1635 | will get the value 2 or higher. | ||
1636 | The last thing to do is to sweep | ||
1637 | through `letters' and keep the | ||
1638 | elements having the value 2 as set, | ||
1639 | and clear all the others. */ | ||
1640 | |||
1641 | fprintf(stderr, " Certificate proxy rights = %*.*s", i, i, s); | ||
1642 | while(i-- > 0) | ||
1643 | { | ||
1644 | char c = *s++; | ||
1645 | if (isascii(c) && isalpha(c)) | ||
1646 | { | ||
1647 | if (islower(c)) | ||
1648 | c = toupper(c); | ||
1649 | letters[c - 'A']++; | ||
1650 | } | ||
1651 | } | ||
1652 | for (i = 0; i < 26; i++) | ||
1653 | if (letters[i] < 2) | ||
1654 | letters[i] = 0; | ||
1655 | else | ||
1656 | letters[i] = 1; | ||
1657 | } | ||
1658 | |||
1659 | found_any = 0; | ||
1660 | fprintf(stderr, | ||
1661 | ", resulting proxy rights = "); | ||
1662 | for(i = 0; i < 26; i++) | ||
1663 | if (letters[i]) | ||
1664 | { | ||
1665 | fprintf(stderr, "%c", i + 'A'); | ||
1666 | found_any = 1; | ||
1667 | } | ||
1668 | if (!found_any) | ||
1669 | fprintf(stderr, "none"); | ||
1670 | fprintf(stderr, "\n"); | ||
1671 | |||
1672 | PROXY_CERT_INFO_EXTENSION_free(pci); | ||
1673 | } | ||
1674 | } | ||
1675 | } | ||
1676 | |||
1501 | return(ok); | 1677 | return(ok); |
1502 | } | 1678 | } |
1503 | 1679 | ||
1680 | static void process_proxy_debug(int indent, const char *format, ...) | ||
1681 | { | ||
1682 | static const char indentation[] = | ||
1683 | ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" | ||
1684 | ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; /* That's 80 > */ | ||
1685 | char my_format[256]; | ||
1686 | va_list args; | ||
1687 | |||
1688 | BIO_snprintf(my_format, sizeof(my_format), "%*.*s %s", | ||
1689 | indent, indent, indentation, format); | ||
1690 | |||
1691 | va_start(args, format); | ||
1692 | vfprintf(stderr, my_format, args); | ||
1693 | va_end(args); | ||
1694 | } | ||
1695 | /* Priority levels: | ||
1696 | 0 [!]var, () | ||
1697 | 1 & ^ | ||
1698 | 2 | | ||
1699 | */ | ||
1700 | static int process_proxy_cond_adders(unsigned int letters[26], | ||
1701 | const char *cond, const char **cond_end, int *pos, int indent); | ||
1702 | static int process_proxy_cond_val(unsigned int letters[26], | ||
1703 | const char *cond, const char **cond_end, int *pos, int indent) | ||
1704 | { | ||
1705 | char c; | ||
1706 | int ok = 1; | ||
1707 | int negate = 0; | ||
1708 | |||
1709 | while(isspace(*cond)) | ||
1710 | { | ||
1711 | cond++; (*pos)++; | ||
1712 | } | ||
1713 | c = *cond; | ||
1714 | |||
1715 | if (debug) | ||
1716 | process_proxy_debug(indent, | ||
1717 | "Start process_proxy_cond_val at position %d: %s\n", | ||
1718 | *pos, cond); | ||
1719 | |||
1720 | while(c == '!') | ||
1721 | { | ||
1722 | negate = !negate; | ||
1723 | cond++; (*pos)++; | ||
1724 | while(isspace(*cond)) | ||
1725 | { | ||
1726 | cond++; (*pos)++; | ||
1727 | } | ||
1728 | c = *cond; | ||
1729 | } | ||
1730 | |||
1731 | if (c == '(') | ||
1732 | { | ||
1733 | cond++; (*pos)++; | ||
1734 | ok = process_proxy_cond_adders(letters, cond, cond_end, pos, | ||
1735 | indent + 1); | ||
1736 | cond = *cond_end; | ||
1737 | if (ok < 0) | ||
1738 | goto end; | ||
1739 | while(isspace(*cond)) | ||
1740 | { | ||
1741 | cond++; (*pos)++; | ||
1742 | } | ||
1743 | c = *cond; | ||
1744 | if (c != ')') | ||
1745 | { | ||
1746 | fprintf(stderr, | ||
1747 | "Weird condition character in position %d: " | ||
1748 | "%c\n", *pos, c); | ||
1749 | ok = -1; | ||
1750 | goto end; | ||
1751 | } | ||
1752 | cond++; (*pos)++; | ||
1753 | } | ||
1754 | else if (isascii(c) && isalpha(c)) | ||
1755 | { | ||
1756 | if (islower(c)) | ||
1757 | c = toupper(c); | ||
1758 | ok = letters[c - 'A']; | ||
1759 | cond++; (*pos)++; | ||
1760 | } | ||
1761 | else | ||
1762 | { | ||
1763 | fprintf(stderr, | ||
1764 | "Weird condition character in position %d: " | ||
1765 | "%c\n", *pos, c); | ||
1766 | ok = -1; | ||
1767 | goto end; | ||
1768 | } | ||
1769 | end: | ||
1770 | *cond_end = cond; | ||
1771 | if (ok >= 0 && negate) | ||
1772 | ok = !ok; | ||
1773 | |||
1774 | if (debug) | ||
1775 | process_proxy_debug(indent, | ||
1776 | "End process_proxy_cond_val at position %d: %s, returning %d\n", | ||
1777 | *pos, cond, ok); | ||
1778 | |||
1779 | return ok; | ||
1780 | } | ||
1781 | static int process_proxy_cond_multipliers(unsigned int letters[26], | ||
1782 | const char *cond, const char **cond_end, int *pos, int indent) | ||
1783 | { | ||
1784 | int ok; | ||
1785 | char c; | ||
1786 | |||
1787 | if (debug) | ||
1788 | process_proxy_debug(indent, | ||
1789 | "Start process_proxy_cond_multipliers at position %d: %s\n", | ||
1790 | *pos, cond); | ||
1791 | |||
1792 | ok = process_proxy_cond_val(letters, cond, cond_end, pos, indent + 1); | ||
1793 | cond = *cond_end; | ||
1794 | if (ok < 0) | ||
1795 | goto end; | ||
1796 | |||
1797 | while(ok >= 0) | ||
1798 | { | ||
1799 | while(isspace(*cond)) | ||
1800 | { | ||
1801 | cond++; (*pos)++; | ||
1802 | } | ||
1803 | c = *cond; | ||
1804 | |||
1805 | switch(c) | ||
1806 | { | ||
1807 | case '&': | ||
1808 | case '^': | ||
1809 | { | ||
1810 | int save_ok = ok; | ||
1811 | |||
1812 | cond++; (*pos)++; | ||
1813 | ok = process_proxy_cond_val(letters, | ||
1814 | cond, cond_end, pos, indent + 1); | ||
1815 | cond = *cond_end; | ||
1816 | if (ok < 0) | ||
1817 | break; | ||
1818 | |||
1819 | switch(c) | ||
1820 | { | ||
1821 | case '&': | ||
1822 | ok &= save_ok; | ||
1823 | break; | ||
1824 | case '^': | ||
1825 | ok ^= save_ok; | ||
1826 | break; | ||
1827 | default: | ||
1828 | fprintf(stderr, "SOMETHING IS SERIOUSLY WRONG!" | ||
1829 | " STOPPING\n"); | ||
1830 | EXIT(1); | ||
1831 | } | ||
1832 | } | ||
1833 | break; | ||
1834 | default: | ||
1835 | goto end; | ||
1836 | } | ||
1837 | } | ||
1838 | end: | ||
1839 | if (debug) | ||
1840 | process_proxy_debug(indent, | ||
1841 | "End process_proxy_cond_multipliers at position %d: %s, returning %d\n", | ||
1842 | *pos, cond, ok); | ||
1843 | |||
1844 | *cond_end = cond; | ||
1845 | return ok; | ||
1846 | } | ||
1847 | static int process_proxy_cond_adders(unsigned int letters[26], | ||
1848 | const char *cond, const char **cond_end, int *pos, int indent) | ||
1849 | { | ||
1850 | int ok; | ||
1851 | char c; | ||
1852 | |||
1853 | if (debug) | ||
1854 | process_proxy_debug(indent, | ||
1855 | "Start process_proxy_cond_adders at position %d: %s\n", | ||
1856 | *pos, cond); | ||
1857 | |||
1858 | ok = process_proxy_cond_multipliers(letters, cond, cond_end, pos, | ||
1859 | indent + 1); | ||
1860 | cond = *cond_end; | ||
1861 | if (ok < 0) | ||
1862 | goto end; | ||
1863 | |||
1864 | while(ok >= 0) | ||
1865 | { | ||
1866 | while(isspace(*cond)) | ||
1867 | { | ||
1868 | cond++; (*pos)++; | ||
1869 | } | ||
1870 | c = *cond; | ||
1871 | |||
1872 | switch(c) | ||
1873 | { | ||
1874 | case '|': | ||
1875 | { | ||
1876 | int save_ok = ok; | ||
1877 | |||
1878 | cond++; (*pos)++; | ||
1879 | ok = process_proxy_cond_multipliers(letters, | ||
1880 | cond, cond_end, pos, indent + 1); | ||
1881 | cond = *cond_end; | ||
1882 | if (ok < 0) | ||
1883 | break; | ||
1884 | |||
1885 | switch(c) | ||
1886 | { | ||
1887 | case '|': | ||
1888 | ok |= save_ok; | ||
1889 | break; | ||
1890 | default: | ||
1891 | fprintf(stderr, "SOMETHING IS SERIOUSLY WRONG!" | ||
1892 | " STOPPING\n"); | ||
1893 | EXIT(1); | ||
1894 | } | ||
1895 | } | ||
1896 | break; | ||
1897 | default: | ||
1898 | goto end; | ||
1899 | } | ||
1900 | } | ||
1901 | end: | ||
1902 | if (debug) | ||
1903 | process_proxy_debug(indent, | ||
1904 | "End process_proxy_cond_adders at position %d: %s, returning %d\n", | ||
1905 | *pos, cond, ok); | ||
1906 | |||
1907 | *cond_end = cond; | ||
1908 | return ok; | ||
1909 | } | ||
1910 | |||
1911 | static int process_proxy_cond(unsigned int letters[26], | ||
1912 | const char *cond, const char **cond_end) | ||
1913 | { | ||
1914 | int pos = 1; | ||
1915 | return process_proxy_cond_adders(letters, cond, cond_end, &pos, 1); | ||
1916 | } | ||
1917 | |||
1504 | static int MS_CALLBACK app_verify_callback(X509_STORE_CTX *ctx, void *arg) | 1918 | static int MS_CALLBACK app_verify_callback(X509_STORE_CTX *ctx, void *arg) |
1505 | { | 1919 | { |
1506 | char *s = NULL,buf[256]; | ||
1507 | int ok=1; | 1920 | int ok=1; |
1921 | struct app_verify_arg *cb_arg = arg; | ||
1922 | unsigned int letters[26]; /* only used with proxy_auth */ | ||
1508 | 1923 | ||
1509 | fprintf(stderr, "In app_verify_callback, allowing cert. "); | 1924 | if (cb_arg->app_verify) |
1510 | fprintf(stderr, "Arg is: %s\n", (char *)arg); | ||
1511 | fprintf(stderr, "Finished printing do we have a context? 0x%lx a cert? 0x%lx\n", | ||
1512 | (uintptr_t)ctx, (uintptr_t)ctx->cert); | ||
1513 | if (ctx->cert) | ||
1514 | s=X509_NAME_oneline(X509_get_subject_name(ctx->cert),buf,256); | ||
1515 | if (s != NULL) | ||
1516 | { | 1925 | { |
1926 | char *s = NULL,buf[256]; | ||
1927 | |||
1928 | fprintf(stderr, "In app_verify_callback, allowing cert. "); | ||
1929 | fprintf(stderr, "Arg is: %s\n", cb_arg->string); | ||
1930 | fprintf(stderr, "Finished printing do we have a context? 0x%x a cert? 0x%x\n", | ||
1931 | (unsigned int)ctx, (unsigned int)ctx->cert); | ||
1932 | if (ctx->cert) | ||
1933 | s=X509_NAME_oneline(X509_get_subject_name(ctx->cert),buf,256); | ||
1934 | if (s != NULL) | ||
1935 | { | ||
1517 | fprintf(stderr,"cert depth=%d %s\n",ctx->error_depth,buf); | 1936 | fprintf(stderr,"cert depth=%d %s\n",ctx->error_depth,buf); |
1937 | } | ||
1938 | return(1); | ||
1518 | } | 1939 | } |
1940 | if (cb_arg->proxy_auth) | ||
1941 | { | ||
1942 | int found_any = 0, i; | ||
1943 | char *sp; | ||
1944 | |||
1945 | for(i = 0; i < 26; i++) | ||
1946 | letters[i] = 0; | ||
1947 | for(sp = cb_arg->proxy_auth; *sp; sp++) | ||
1948 | { | ||
1949 | char c = *sp; | ||
1950 | if (isascii(c) && isalpha(c)) | ||
1951 | { | ||
1952 | if (islower(c)) | ||
1953 | c = toupper(c); | ||
1954 | letters[c - 'A'] = 1; | ||
1955 | } | ||
1956 | } | ||
1519 | 1957 | ||
1958 | fprintf(stderr, | ||
1959 | " Initial proxy rights = "); | ||
1960 | for(i = 0; i < 26; i++) | ||
1961 | if (letters[i]) | ||
1962 | { | ||
1963 | fprintf(stderr, "%c", i + 'A'); | ||
1964 | found_any = 1; | ||
1965 | } | ||
1966 | if (!found_any) | ||
1967 | fprintf(stderr, "none"); | ||
1968 | fprintf(stderr, "\n"); | ||
1969 | |||
1970 | X509_STORE_CTX_set_ex_data(ctx, | ||
1971 | get_proxy_auth_ex_data_idx(),letters); | ||
1972 | } | ||
1973 | if (cb_arg->allow_proxy_certs) | ||
1974 | { | ||
1975 | X509_STORE_CTX_set_flags(ctx, X509_V_FLAG_ALLOW_PROXY_CERTS); | ||
1976 | } | ||
1977 | |||
1978 | #ifndef OPENSSL_NO_X509_VERIFY | ||
1979 | # ifdef OPENSSL_FIPS | ||
1980 | if(s->version == TLS1_VERSION) | ||
1981 | FIPS_allow_md5(1); | ||
1982 | # endif | ||
1983 | ok = X509_verify_cert(ctx); | ||
1984 | # ifdef OPENSSL_FIPS | ||
1985 | if(s->version == TLS1_VERSION) | ||
1986 | FIPS_allow_md5(0); | ||
1987 | # endif | ||
1988 | #endif | ||
1989 | |||
1990 | if (cb_arg->proxy_auth) | ||
1991 | { | ||
1992 | if (ok) | ||
1993 | { | ||
1994 | const char *cond_end = NULL; | ||
1995 | |||
1996 | ok = process_proxy_cond(letters, | ||
1997 | cb_arg->proxy_cond, &cond_end); | ||
1998 | |||
1999 | if (ok < 0) | ||
2000 | EXIT(3); | ||
2001 | if (*cond_end) | ||
2002 | { | ||
2003 | fprintf(stderr, "Stopped processing condition before it's end.\n"); | ||
2004 | ok = 0; | ||
2005 | } | ||
2006 | if (!ok) | ||
2007 | fprintf(stderr, "Proxy rights check with condition '%s' proved invalid\n", | ||
2008 | cb_arg->proxy_cond); | ||
2009 | else | ||
2010 | fprintf(stderr, "Proxy rights check with condition '%s' proved valid\n", | ||
2011 | cb_arg->proxy_cond); | ||
2012 | } | ||
2013 | } | ||
1520 | return(ok); | 2014 | return(ok); |
1521 | } | 2015 | } |
1522 | 2016 | ||
diff --git a/src/lib/libssl/src/ssl/t1_enc.c b/src/lib/libssl/src/ssl/t1_enc.c index 271e247eea..2c6246abf5 100644 --- a/src/lib/libssl/src/ssl/t1_enc.c +++ b/src/lib/libssl/src/ssl/t1_enc.c | |||
@@ -115,6 +115,7 @@ | |||
115 | #include <openssl/evp.h> | 115 | #include <openssl/evp.h> |
116 | #include <openssl/hmac.h> | 116 | #include <openssl/hmac.h> |
117 | #include <openssl/md5.h> | 117 | #include <openssl/md5.h> |
118 | #include <openssl/fips.h> | ||
118 | 119 | ||
119 | static void tls1_P_hash(const EVP_MD *md, const unsigned char *sec, | 120 | static void tls1_P_hash(const EVP_MD *md, const unsigned char *sec, |
120 | int sec_len, unsigned char *seed, int seed_len, | 121 | int sec_len, unsigned char *seed, int seed_len, |
@@ -131,6 +132,8 @@ static void tls1_P_hash(const EVP_MD *md, const unsigned char *sec, | |||
131 | 132 | ||
132 | HMAC_CTX_init(&ctx); | 133 | HMAC_CTX_init(&ctx); |
133 | HMAC_CTX_init(&ctx_tmp); | 134 | HMAC_CTX_init(&ctx_tmp); |
135 | HMAC_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
136 | HMAC_CTX_set_flags(&ctx_tmp, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
134 | HMAC_Init_ex(&ctx,sec,sec_len,md, NULL); | 137 | HMAC_Init_ex(&ctx,sec,sec_len,md, NULL); |
135 | HMAC_Init_ex(&ctx_tmp,sec,sec_len,md, NULL); | 138 | HMAC_Init_ex(&ctx_tmp,sec,sec_len,md, NULL); |
136 | HMAC_Update(&ctx,seed,seed_len); | 139 | HMAC_Update(&ctx,seed,seed_len); |
@@ -177,7 +180,6 @@ static void tls1_PRF(const EVP_MD *md5, const EVP_MD *sha1, | |||
177 | S2= &(sec[len]); | 180 | S2= &(sec[len]); |
178 | len+=(slen&1); /* add for odd, make longer */ | 181 | len+=(slen&1); /* add for odd, make longer */ |
179 | 182 | ||
180 | |||
181 | tls1_P_hash(md5 ,S1,len,label,label_len,out1,olen); | 183 | tls1_P_hash(md5 ,S1,len,label,label_len,out1,olen); |
182 | tls1_P_hash(sha1,S2,len,label,label_len,out2,olen); | 184 | tls1_P_hash(sha1,S2,len,label,label_len,out2,olen); |
183 | 185 | ||
diff --git a/src/lib/libssl/src/test/bctest b/src/lib/libssl/src/test/bctest index bdb3218f7a..e81fc0733a 100644 --- a/src/lib/libssl/src/test/bctest +++ b/src/lib/libssl/src/test/bctest | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # This script is used by test/Makefile.ssl to check whether a sane 'bc' | 3 | # This script is used by test/Makefile to check whether a sane 'bc' |
4 | # is installed. | 4 | # is installed. |
5 | # ('make test_bn' should not try to run 'bc' if it does not exist or if | 5 | # ('make test_bn' should not try to run 'bc' if it does not exist or if |
6 | # it is a broken 'bc' version that is known to cause trouble.) | 6 | # it is a broken 'bc' version that is known to cause trouble.) |
diff --git a/src/lib/libssl/src/test/maketests.com b/src/lib/libssl/src/test/maketests.com index 7c44e4545a..dfbfef7b1b 100644 --- a/src/lib/libssl/src/test/maketests.com +++ b/src/lib/libssl/src/test/maketests.com | |||
@@ -615,7 +615,7 @@ $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - | |||
615 | THEN CC = "CC/DECC" | 615 | THEN CC = "CC/DECC" |
616 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - | 616 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - |
617 | "/NOLIST/PREFIX=ALL" + - | 617 | "/NOLIST/PREFIX=ALL" + - |
618 | "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS | 618 | "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS |
619 | $! | 619 | $! |
620 | $! Define The Linker Options File Name. | 620 | $! Define The Linker Options File Name. |
621 | $! | 621 | $! |
@@ -648,7 +648,7 @@ $ EXIT | |||
648 | $ ENDIF | 648 | $ ENDIF |
649 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" | 649 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" |
650 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | 650 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - |
651 | "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS | 651 | "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS |
652 | $ CCDEFS = CCDEFS + ",""VAXC""" | 652 | $ CCDEFS = CCDEFS + ",""VAXC""" |
653 | $! | 653 | $! |
654 | $! Define <sys> As SYS$COMMON:[SYSLIB] | 654 | $! Define <sys> As SYS$COMMON:[SYSLIB] |
@@ -679,7 +679,7 @@ $! | |||
679 | $! Use GNU C... | 679 | $! Use GNU C... |
680 | $! | 680 | $! |
681 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | 681 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - |
682 | "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS | 682 | "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS |
683 | $! | 683 | $! |
684 | $! Define The Linker Options File Name. | 684 | $! Define The Linker Options File Name. |
685 | $! | 685 | $! |
diff --git a/src/lib/libssl/src/test/tcrl b/src/lib/libssl/src/test/tcrl index f71ef7a863..3ffed12a03 100644 --- a/src/lib/libssl/src/test/tcrl +++ b/src/lib/libssl/src/test/tcrl | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl crl' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl crl' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/src/test/testca b/src/lib/libssl/src/test/testca index 8215ebb5d1..5b2faa78f1 100644 --- a/src/lib/libssl/src/test/testca +++ b/src/lib/libssl/src/test/testca | |||
@@ -11,6 +11,9 @@ export SH PATH | |||
11 | SSLEAY_CONFIG="-config CAss.cnf" | 11 | SSLEAY_CONFIG="-config CAss.cnf" |
12 | export SSLEAY_CONFIG | 12 | export SSLEAY_CONFIG |
13 | 13 | ||
14 | OPENSSL="`pwd`/../util/shlib_wrap.sh openssl" | ||
15 | export OPENSSL | ||
16 | |||
14 | /bin/rm -fr demoCA | 17 | /bin/rm -fr demoCA |
15 | $SH ../apps/CA.sh -newca <<EOF | 18 | $SH ../apps/CA.sh -newca <<EOF |
16 | EOF | 19 | EOF |
diff --git a/src/lib/libssl/src/test/testenc b/src/lib/libssl/src/test/testenc index 0656c7f525..4571ea2875 100644 --- a/src/lib/libssl/src/test/testenc +++ b/src/lib/libssl/src/test/testenc | |||
@@ -1,14 +1,14 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | testsrc=Makefile.ssl | 3 | testsrc=Makefile |
4 | test=./p | 4 | test=./p |
5 | cmd=../apps/openssl | 5 | cmd="../util/shlib_wrap.sh ../apps/openssl" |
6 | 6 | ||
7 | cat $testsrc >$test; | 7 | cat $testsrc >$test; |
8 | 8 | ||
9 | echo cat | 9 | echo cat |
10 | $cmd enc < $test > $test.cipher | 10 | $cmd enc -non-fips-allow < $test > $test.cipher |
11 | $cmd enc < $test.cipher >$test.clear | 11 | $cmd enc -non-fips-allow < $test.cipher >$test.clear |
12 | cmp $test $test.clear | 12 | cmp $test $test.clear |
13 | if [ $? != 0 ] | 13 | if [ $? != 0 ] |
14 | then | 14 | then |
@@ -17,8 +17,8 @@ else | |||
17 | /bin/rm $test.cipher $test.clear | 17 | /bin/rm $test.cipher $test.clear |
18 | fi | 18 | fi |
19 | echo base64 | 19 | echo base64 |
20 | $cmd enc -a -e < $test > $test.cipher | 20 | $cmd enc -non-fips-allow -a -e < $test > $test.cipher |
21 | $cmd enc -a -d < $test.cipher >$test.clear | 21 | $cmd enc -non-fips-allow -a -d < $test.cipher >$test.clear |
22 | cmp $test $test.clear | 22 | cmp $test $test.clear |
23 | if [ $? != 0 ] | 23 | if [ $? != 0 ] |
24 | then | 24 | then |
@@ -30,8 +30,8 @@ fi | |||
30 | for i in `$cmd list-cipher-commands` | 30 | for i in `$cmd list-cipher-commands` |
31 | do | 31 | do |
32 | echo $i | 32 | echo $i |
33 | $cmd $i -bufsize 113 -e -k test < $test > $test.$i.cipher | 33 | $cmd $i -non-fips-allow -bufsize 113 -e -k test < $test > $test.$i.cipher |
34 | $cmd $i -bufsize 157 -d -k test < $test.$i.cipher >$test.$i.clear | 34 | $cmd $i -non-fips-allow -bufsize 157 -d -k test < $test.$i.cipher >$test.$i.clear |
35 | cmp $test $test.$i.clear | 35 | cmp $test $test.$i.clear |
36 | if [ $? != 0 ] | 36 | if [ $? != 0 ] |
37 | then | 37 | then |
@@ -41,8 +41,8 @@ do | |||
41 | fi | 41 | fi |
42 | 42 | ||
43 | echo $i base64 | 43 | echo $i base64 |
44 | $cmd $i -bufsize 113 -a -e -k test < $test > $test.$i.cipher | 44 | $cmd $i -non-fips-allow -bufsize 113 -a -e -k test < $test > $test.$i.cipher |
45 | $cmd $i -bufsize 157 -a -d -k test < $test.$i.cipher >$test.$i.clear | 45 | $cmd $i -non-fips-allow -bufsize 157 -a -d -k test < $test.$i.cipher >$test.$i.clear |
46 | cmp $test $test.$i.clear | 46 | cmp $test $test.$i.clear |
47 | if [ $? != 0 ] | 47 | if [ $? != 0 ] |
48 | then | 48 | then |
diff --git a/src/lib/libssl/src/test/testenc.com b/src/lib/libssl/src/test/testenc.com index c24fa388c0..5e6f521f9d 100644 --- a/src/lib/libssl/src/test/testenc.com +++ b/src/lib/libssl/src/test/testenc.com | |||
@@ -4,7 +4,7 @@ $ __arch := VAX | |||
4 | $ if f$getsyi("cpu") .ge. 128 then __arch := AXP | 4 | $ if f$getsyi("cpu") .ge. 128 then __arch := AXP |
5 | $ exe_dir := sys$disk:[-.'__arch'.exe.apps] | 5 | $ exe_dir := sys$disk:[-.'__arch'.exe.apps] |
6 | $ | 6 | $ |
7 | $ testsrc := makefile.ssl | 7 | $ testsrc := makefile. |
8 | $ test := p.txt | 8 | $ test := p.txt |
9 | $ cmd := mcr 'exe_dir'openssl | 9 | $ cmd := mcr 'exe_dir'openssl |
10 | $ | 10 | $ |
diff --git a/src/lib/libssl/src/test/testgen b/src/lib/libssl/src/test/testgen index 3798543e04..524c0d134c 100644 --- a/src/lib/libssl/src/test/testgen +++ b/src/lib/libssl/src/test/testgen | |||
@@ -17,7 +17,7 @@ echo "generating certificate request" | |||
17 | 17 | ||
18 | echo "string to make the random number generator think it has entropy" >> ./.rnd | 18 | echo "string to make the random number generator think it has entropy" >> ./.rnd |
19 | 19 | ||
20 | if ../apps/openssl no-rsa; then | 20 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then |
21 | req_new='-newkey dsa:../apps/dsa512.pem' | 21 | req_new='-newkey dsa:../apps/dsa512.pem' |
22 | else | 22 | else |
23 | req_new='-new' | 23 | req_new='-new' |
@@ -29,13 +29,13 @@ echo "This could take some time." | |||
29 | 29 | ||
30 | rm -f testkey.pem testreq.pem | 30 | rm -f testkey.pem testreq.pem |
31 | 31 | ||
32 | ../apps/openssl req -config test.cnf $req_new -out testreq.pem | 32 | ../util/shlib_wrap.sh ../apps/openssl req -config test.cnf $req_new -out testreq.pem |
33 | if [ $? != 0 ]; then | 33 | if [ $? != 0 ]; then |
34 | echo problems creating request | 34 | echo problems creating request |
35 | exit 1 | 35 | exit 1 |
36 | fi | 36 | fi |
37 | 37 | ||
38 | ../apps/openssl req -config test.cnf -verify -in testreq.pem -noout | 38 | ../util/shlib_wrap.sh ../apps/openssl req -config test.cnf -verify -in testreq.pem -noout |
39 | if [ $? != 0 ]; then | 39 | if [ $? != 0 ]; then |
40 | echo signature on req is wrong | 40 | echo signature on req is wrong |
41 | exit 1 | 41 | exit 1 |
diff --git a/src/lib/libssl/src/test/testss b/src/lib/libssl/src/test/testss index 8d3557f356..1a426857d3 100644 --- a/src/lib/libssl/src/test/testss +++ b/src/lib/libssl/src/test/testss | |||
@@ -1,9 +1,9 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | digest='-md5' | 3 | digest='-sha1' |
4 | reqcmd="../apps/openssl req" | 4 | reqcmd="../util/shlib_wrap.sh ../apps/openssl req" |
5 | x509cmd="../apps/openssl x509 $digest" | 5 | x509cmd="../util/shlib_wrap.sh ../apps/openssl x509 $digest" |
6 | verifycmd="../apps/openssl verify" | 6 | verifycmd="../util/shlib_wrap.sh ../apps/openssl verify" |
7 | dummycnf="../apps/openssl.cnf" | 7 | dummycnf="../apps/openssl.cnf" |
8 | 8 | ||
9 | CAkey="keyCA.ss" | 9 | CAkey="keyCA.ss" |
@@ -17,12 +17,24 @@ Ukey="keyU.ss" | |||
17 | Ureq="reqU.ss" | 17 | Ureq="reqU.ss" |
18 | Ucert="certU.ss" | 18 | Ucert="certU.ss" |
19 | 19 | ||
20 | P1conf="P1ss.cnf" | ||
21 | P1key="keyP1.ss" | ||
22 | P1req="reqP1.ss" | ||
23 | P1cert="certP1.ss" | ||
24 | P1intermediate="tmp_intP1.ss" | ||
25 | |||
26 | P2conf="P2ss.cnf" | ||
27 | P2key="keyP2.ss" | ||
28 | P2req="reqP2.ss" | ||
29 | P2cert="certP2.ss" | ||
30 | P2intermediate="tmp_intP2.ss" | ||
31 | |||
20 | echo | 32 | echo |
21 | echo "make a certificate request using 'req'" | 33 | echo "make a certificate request using 'req'" |
22 | 34 | ||
23 | echo "string to make the random number generator think it has entropy" >> ./.rnd | 35 | echo "string to make the random number generator think it has entropy" >> ./.rnd |
24 | 36 | ||
25 | if ../apps/openssl no-rsa; then | 37 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then |
26 | req_new='-newkey dsa:../apps/dsa512.pem' | 38 | req_new='-newkey dsa:../apps/dsa512.pem' |
27 | else | 39 | else |
28 | req_new='-new' | 40 | req_new='-new' |
@@ -35,7 +47,7 @@ if [ $? != 0 ]; then | |||
35 | fi | 47 | fi |
36 | echo | 48 | echo |
37 | echo "convert the certificate request into a self signed certificate using 'x509'" | 49 | echo "convert the certificate request into a self signed certificate using 'x509'" |
38 | $x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey >err.ss | 50 | $x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey -extfile $CAconf -extensions v3_ca >err.ss |
39 | if [ $? != 0 ]; then | 51 | if [ $? != 0 ]; then |
40 | echo "error using 'x509' to self sign a certificate request" | 52 | echo "error using 'x509' to self sign a certificate request" |
41 | exit 1 | 53 | exit 1 |
@@ -68,18 +80,18 @@ if [ $? != 0 ]; then | |||
68 | fi | 80 | fi |
69 | 81 | ||
70 | echo | 82 | echo |
71 | echo "make another certificate request using 'req'" | 83 | echo "make a user certificate request using 'req'" |
72 | $reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss | 84 | $reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss |
73 | if [ $? != 0 ]; then | 85 | if [ $? != 0 ]; then |
74 | echo "error using 'req' to generate a certificate request" | 86 | echo "error using 'req' to generate a user certificate request" |
75 | exit 1 | 87 | exit 1 |
76 | fi | 88 | fi |
77 | 89 | ||
78 | echo | 90 | echo |
79 | echo "sign certificate request with the just created CA via 'x509'" | 91 | echo "sign user certificate request with the just created CA via 'x509'" |
80 | $x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey >err.ss | 92 | $x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey -extfile $Uconf -extensions v3_ee >err.ss |
81 | if [ $? != 0 ]; then | 93 | if [ $? != 0 ]; then |
82 | echo "error using 'x509' to sign a certificate request" | 94 | echo "error using 'x509' to sign a user certificate request" |
83 | exit 1 | 95 | exit 1 |
84 | fi | 96 | fi |
85 | 97 | ||
@@ -89,11 +101,63 @@ echo "Certificate details" | |||
89 | $x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert | 101 | $x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert |
90 | 102 | ||
91 | echo | 103 | echo |
104 | echo "make a proxy certificate request using 'req'" | ||
105 | $reqcmd -config $P1conf -out $P1req -keyout $P1key $req_new >err.ss | ||
106 | if [ $? != 0 ]; then | ||
107 | echo "error using 'req' to generate a proxy certificate request" | ||
108 | exit 1 | ||
109 | fi | ||
110 | |||
111 | echo | ||
112 | echo "sign proxy certificate request with the just created user certificate via 'x509'" | ||
113 | $x509cmd -CAcreateserial -in $P1req -days 30 -req -out $P1cert -CA $Ucert -CAkey $Ukey -extfile $P1conf -extensions v3_proxy >err.ss | ||
114 | if [ $? != 0 ]; then | ||
115 | echo "error using 'x509' to sign a proxy certificate request" | ||
116 | exit 1 | ||
117 | fi | ||
118 | |||
119 | cat $Ucert > $P1intermediate | ||
120 | $verifycmd -CAfile $CAcert -untrusted $P1intermediate $P1cert | ||
121 | echo | ||
122 | echo "Certificate details" | ||
123 | $x509cmd -subject -issuer -startdate -enddate -noout -in $P1cert | ||
124 | |||
125 | echo | ||
126 | echo "make another proxy certificate request using 'req'" | ||
127 | $reqcmd -config $P2conf -out $P2req -keyout $P2key $req_new >err.ss | ||
128 | if [ $? != 0 ]; then | ||
129 | echo "error using 'req' to generate another proxy certificate request" | ||
130 | exit 1 | ||
131 | fi | ||
132 | |||
133 | echo | ||
134 | echo "sign second proxy certificate request with the first proxy certificate via 'x509'" | ||
135 | $x509cmd -CAcreateserial -in $P2req -days 30 -req -out $P2cert -CA $P1cert -CAkey $P1key -extfile $P2conf -extensions v3_proxy >err.ss | ||
136 | if [ $? != 0 ]; then | ||
137 | echo "error using 'x509' to sign a second proxy certificate request" | ||
138 | exit 1 | ||
139 | fi | ||
140 | |||
141 | cat $Ucert $P1cert > $P2intermediate | ||
142 | $verifycmd -CAfile $CAcert -untrusted $P2intermediate $P2cert | ||
143 | echo | ||
144 | echo "Certificate details" | ||
145 | $x509cmd -subject -issuer -startdate -enddate -noout -in $P2cert | ||
146 | |||
147 | echo | ||
92 | echo The generated CA certificate is $CAcert | 148 | echo The generated CA certificate is $CAcert |
93 | echo The generated CA private key is $CAkey | 149 | echo The generated CA private key is $CAkey |
94 | 150 | ||
95 | echo The generated user certificate is $Ucert | 151 | echo The generated user certificate is $Ucert |
96 | echo The generated user private key is $Ukey | 152 | echo The generated user private key is $Ukey |
97 | 153 | ||
154 | echo The first generated proxy certificate is $P1cert | ||
155 | echo The first generated proxy private key is $P1key | ||
156 | |||
157 | echo The second generated proxy certificate is $P2cert | ||
158 | echo The second generated proxy private key is $P2key | ||
159 | |||
98 | /bin/rm err.ss | 160 | /bin/rm err.ss |
161 | #/bin/rm $P1intermediate | ||
162 | #/bin/rm $P2intermediate | ||
99 | exit 0 | 163 | exit 0 |
diff --git a/src/lib/libssl/src/test/testssl b/src/lib/libssl/src/test/testssl index ca8e718022..8ac90ae5ee 100644 --- a/src/lib/libssl/src/test/testssl +++ b/src/lib/libssl/src/test/testssl | |||
@@ -10,9 +10,9 @@ if [ "$2" = "" ]; then | |||
10 | else | 10 | else |
11 | cert="$2" | 11 | cert="$2" |
12 | fi | 12 | fi |
13 | ssltest="./ssltest -key $key -cert $cert -c_key $key -c_cert $cert" | 13 | ssltest="../util/shlib_wrap.sh ./ssltest -key $key -cert $cert -c_key $key -c_cert $cert" |
14 | 14 | ||
15 | if ../apps/openssl x509 -in $cert -text -noout | fgrep 'DSA Public Key' >/dev/null; then | 15 | if ../util/shlib_wrap.sh ../apps/openssl x509 -in $cert -text -noout | fgrep 'DSA Public Key' >/dev/null; then |
16 | dsa_cert=YES | 16 | dsa_cert=YES |
17 | else | 17 | else |
18 | dsa_cert=NO | 18 | dsa_cert=NO |
@@ -121,24 +121,24 @@ $ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exit 1 | |||
121 | 121 | ||
122 | ############################################################################# | 122 | ############################################################################# |
123 | 123 | ||
124 | if ../apps/openssl no-dh; then | 124 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then |
125 | echo skipping anonymous DH tests | 125 | echo skipping anonymous DH tests |
126 | else | 126 | else |
127 | echo test tls1 with 1024bit anonymous DH, multiple handshakes | 127 | echo test tls1 with 1024bit anonymous DH, multiple handshakes |
128 | $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1 | 128 | $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1 |
129 | fi | 129 | fi |
130 | 130 | ||
131 | if ../apps/openssl no-rsa; then | 131 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then |
132 | echo skipping RSA tests | 132 | echo skipping RSA tests |
133 | else | 133 | else |
134 | echo test tls1 with 1024bit RSA, no DHE, multiple handshakes | 134 | echo test tls1 with 1024bit RSA, no DHE, multiple handshakes |
135 | ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -num 10 -f -time $extra || exit 1 | 135 | ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -num 10 -f -time $extra || exit 1 |
136 | 136 | ||
137 | if ../apps/openssl no-dh; then | 137 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then |
138 | echo skipping RSA+DHE tests | 138 | echo skipping RSA+DHE tests |
139 | else | 139 | else |
140 | echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes | 140 | echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes |
141 | ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1 | 141 | ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1 |
142 | fi | 142 | fi |
143 | fi | 143 | fi |
144 | 144 | ||
diff --git a/src/lib/libssl/src/test/tpkcs7 b/src/lib/libssl/src/test/tpkcs7 index cf3bd9fadb..79bb6e0edf 100644 --- a/src/lib/libssl/src/test/tpkcs7 +++ b/src/lib/libssl/src/test/tpkcs7 | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl pkcs7' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl pkcs7' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/src/test/tpkcs7d b/src/lib/libssl/src/test/tpkcs7d index 18f9311b06..20394b34c4 100644 --- a/src/lib/libssl/src/test/tpkcs7d +++ b/src/lib/libssl/src/test/tpkcs7d | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl pkcs7' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl pkcs7' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/src/test/treq b/src/lib/libssl/src/test/treq index 47a8273cde..7e020210a5 100644 --- a/src/lib/libssl/src/test/treq +++ b/src/lib/libssl/src/test/treq | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl req -config ../apps/openssl.cnf' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl req -config ../apps/openssl.cnf' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/src/test/trsa b/src/lib/libssl/src/test/trsa index 413e2ec0a0..67b4a98841 100644 --- a/src/lib/libssl/src/test/trsa +++ b/src/lib/libssl/src/test/trsa | |||
@@ -7,12 +7,12 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | if ../apps/openssl no-rsa; then | 10 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then |
11 | echo skipping rsa conversion test | 11 | echo skipping rsa conversion test |
12 | exit 0 | 12 | exit 0 |
13 | fi | 13 | fi |
14 | 14 | ||
15 | cmd='../apps/openssl rsa' | 15 | cmd='../util/shlib_wrap.sh ../apps/openssl rsa' |
16 | 16 | ||
17 | if [ "$1"x != "x" ]; then | 17 | if [ "$1"x != "x" ]; then |
18 | t=$1 | 18 | t=$1 |
diff --git a/src/lib/libssl/src/test/tsid b/src/lib/libssl/src/test/tsid index 40a1dfa97c..fb4a7213b9 100644 --- a/src/lib/libssl/src/test/tsid +++ b/src/lib/libssl/src/test/tsid | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl sess_id' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl sess_id' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/src/test/tverify.com b/src/lib/libssl/src/test/tverify.com index f97e71478f..2060184d1e 100644 --- a/src/lib/libssl/src/test/tverify.com +++ b/src/lib/libssl/src/test/tverify.com | |||
@@ -15,12 +15,15 @@ $ f = f$search("[-.certs]*.pem") | |||
15 | $ if f .nes. "" .and. f .nes. old_f | 15 | $ if f .nes. "" .and. f .nes. old_f |
16 | $ then | 16 | $ then |
17 | $ certs = certs + " [-.certs]" + f$parse(f,,,"NAME") + ".pem" | 17 | $ certs = certs + " [-.certs]" + f$parse(f,,,"NAME") + ".pem" |
18 | $ if f$length(certs) .lt. 180 then goto loop_certs2 | ||
19 | $ c := YES | 18 | $ c := YES |
19 | $ if f$length(certs) .lt. 180 then goto loop_certs2 | ||
20 | $ endif | 20 | $ endif |
21 | $ certs = certs - " " | 21 | $ certs = certs - " " |
22 | $ | 22 | $ |
23 | $ mcr 'exe_dir'openssl verify "-CAfile" certs.tmp 'certs' | 23 | $ if c |
24 | $ if c then goto loop_certs | 24 | $ then |
25 | $ mcr 'exe_dir'openssl verify "-CAfile" certs.tmp 'certs' | ||
26 | $ goto loop_certs | ||
27 | $ endif | ||
25 | $ | 28 | $ |
26 | $ delete certs.tmp;* | 29 | $ delete certs.tmp;* |
diff --git a/src/lib/libssl/src/test/tx509 b/src/lib/libssl/src/test/tx509 index d380963abc..1b9c8661f3 100644 --- a/src/lib/libssl/src/test/tx509 +++ b/src/lib/libssl/src/test/tx509 | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl x509' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl x509' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/src/tools/c_issuer b/src/lib/libssl/src/tools/c_issuer index 4c691201bb..55821ab740 100644 --- a/src/lib/libssl/src/tools/c_issuer +++ b/src/lib/libssl/src/tools/c_issuer | |||
@@ -6,5 +6,5 @@ | |||
6 | for i in $* | 6 | for i in $* |
7 | do | 7 | do |
8 | n=`openssl x509 -issuer -noout -in $i` | 8 | n=`openssl x509 -issuer -noout -in $i` |
9 | echo "$i\t$n" | 9 | echo "$i $n" |
10 | done | 10 | done |
diff --git a/src/lib/libssl/src/util/cygwin.sh b/src/lib/libssl/src/util/cygwin.sh index 930f766b4f..7f791d47f4 100644 --- a/src/lib/libssl/src/util/cygwin.sh +++ b/src/lib/libssl/src/util/cygwin.sh | |||
@@ -21,11 +21,11 @@ function cleanup() | |||
21 | 21 | ||
22 | function get_openssl_version() | 22 | function get_openssl_version() |
23 | { | 23 | { |
24 | eval `grep '^VERSION=' Makefile.ssl` | 24 | eval `grep '^VERSION=' Makefile` |
25 | if [ -z "${VERSION}" ] | 25 | if [ -z "${VERSION}" ] |
26 | then | 26 | then |
27 | echo "Error: Couldn't retrieve OpenSSL version from Makefile.ssl." | 27 | echo "Error: Couldn't retrieve OpenSSL version from Makefile." |
28 | echo " Check value of variable VERSION in Makefile.ssl." | 28 | echo " Check value of variable VERSION in Makefile." |
29 | exit 1 | 29 | exit 1 |
30 | fi | 30 | fi |
31 | } | 31 | } |
@@ -39,7 +39,7 @@ function base_install() | |||
39 | 39 | ||
40 | function doc_install() | 40 | function doc_install() |
41 | { | 41 | { |
42 | DOC_DIR=${INSTALL_PREFIX}/usr/doc/openssl | 42 | DOC_DIR=${INSTALL_PREFIX}/usr/share/doc/openssl |
43 | 43 | ||
44 | mkdir -p ${DOC_DIR} | 44 | mkdir -p ${DOC_DIR} |
45 | cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR} | 45 | cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR} |
@@ -49,7 +49,7 @@ function doc_install() | |||
49 | 49 | ||
50 | function create_cygwin_readme() | 50 | function create_cygwin_readme() |
51 | { | 51 | { |
52 | README_DIR=${INSTALL_PREFIX}/usr/doc/Cygwin | 52 | README_DIR=${INSTALL_PREFIX}/usr/share/doc/Cygwin |
53 | README_FILE=${README_DIR}/openssl-${VERSION}.README | 53 | README_FILE=${README_DIR}/openssl-${VERSION}.README |
54 | 54 | ||
55 | mkdir -p ${README_DIR} | 55 | mkdir -p ${README_DIR} |
@@ -112,8 +112,8 @@ cd ${INSTALL_PREFIX} | |||
112 | strip usr/bin/*.exe usr/bin/*.dll | 112 | strip usr/bin/*.exe usr/bin/*.dll |
113 | 113 | ||
114 | # Runtime package | 114 | # Runtime package |
115 | find etc usr/bin usr/doc usr/ssl/certs usr/ssl/man/man[157] usr/ssl/misc \ | 115 | find etc usr/bin usr/share/doc usr/ssl/certs usr/ssl/man/man[157] \ |
116 | usr/ssl/openssl.cnf usr/ssl/private -empty -o \! -type d | | 116 | usr/ssl/misc usr/ssl/openssl.cnf usr/ssl/private -empty -o \! -type d | |
117 | tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 - | 117 | tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 - |
118 | # Development package | 118 | # Development package |
119 | find usr/include usr/lib usr/ssl/man/man3 -empty -o \! -type d | | 119 | find usr/include usr/lib usr/ssl/man/man3 -empty -o \! -type d | |
diff --git a/src/lib/libssl/src/util/domd b/src/lib/libssl/src/util/domd index 49310bbdd1..5610521f0b 100644 --- a/src/lib/libssl/src/util/domd +++ b/src/lib/libssl/src/util/domd | |||
@@ -11,7 +11,7 @@ if [ "$1" = "-MD" ]; then | |||
11 | fi | 11 | fi |
12 | if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi | 12 | if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi |
13 | 13 | ||
14 | cp Makefile.ssl Makefile.save | 14 | cp Makefile Makefile.save |
15 | # fake the presence of Kerberos | 15 | # fake the presence of Kerberos |
16 | touch $TOP/krb5.h | 16 | touch $TOP/krb5.h |
17 | if [ "$MAKEDEPEND" = "gcc" ]; then | 17 | if [ "$MAKEDEPEND" = "gcc" ]; then |
@@ -20,15 +20,15 @@ if [ "$MAKEDEPEND" = "gcc" ]; then | |||
20 | if [ "$1" != "--" ]; then args="$args $1"; fi | 20 | if [ "$1" != "--" ]; then args="$args $1"; fi |
21 | shift | 21 | shift |
22 | done | 22 | done |
23 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile.ssl > Makefile.tmp | 23 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp |
24 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp | 24 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp |
25 | gcc -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp | 25 | gcc -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp |
26 | ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new | 26 | ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new |
27 | rm -f Makefile.tmp | 27 | rm -f Makefile.tmp |
28 | else | 28 | else |
29 | ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND -f Makefile.ssl $@ | 29 | ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND -f Makefile $@ |
30 | ${PERL} $TOP/util/clean-depend.pl < Makefile.ssl > Makefile.new | 30 | ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new |
31 | fi | 31 | fi |
32 | mv Makefile.new Makefile.ssl | 32 | mv Makefile.new Makefile |
33 | # unfake the presence of Kerberos | 33 | # unfake the presence of Kerberos |
34 | rm $TOP/krb5.h | 34 | rm $TOP/krb5.h |
diff --git a/src/lib/libssl/src/util/libeay.num b/src/lib/libssl/src/util/libeay.num index 203c7713e7..56fb7446e0 100644 --- a/src/lib/libssl/src/util/libeay.num +++ b/src/lib/libssl/src/util/libeay.num | |||
@@ -284,20 +284,20 @@ EVP_add_alias 291 NOEXIST::FUNCTION: | |||
284 | EVP_add_cipher 292 EXIST::FUNCTION: | 284 | EVP_add_cipher 292 EXIST::FUNCTION: |
285 | EVP_add_digest 293 EXIST::FUNCTION: | 285 | EVP_add_digest 293 EXIST::FUNCTION: |
286 | EVP_bf_cbc 294 EXIST::FUNCTION:BF | 286 | EVP_bf_cbc 294 EXIST::FUNCTION:BF |
287 | EVP_bf_cfb 295 EXIST::FUNCTION:BF | 287 | EVP_bf_cfb64 295 EXIST::FUNCTION:BF |
288 | EVP_bf_ecb 296 EXIST::FUNCTION:BF | 288 | EVP_bf_ecb 296 EXIST::FUNCTION:BF |
289 | EVP_bf_ofb 297 EXIST::FUNCTION:BF | 289 | EVP_bf_ofb 297 EXIST::FUNCTION:BF |
290 | EVP_cleanup 298 EXIST::FUNCTION: | 290 | EVP_cleanup 298 EXIST::FUNCTION: |
291 | EVP_des_cbc 299 EXIST::FUNCTION:DES | 291 | EVP_des_cbc 299 EXIST::FUNCTION:DES |
292 | EVP_des_cfb 300 EXIST::FUNCTION:DES | 292 | EVP_des_cfb64 300 EXIST::FUNCTION:DES |
293 | EVP_des_ecb 301 EXIST::FUNCTION:DES | 293 | EVP_des_ecb 301 EXIST::FUNCTION:DES |
294 | EVP_des_ede 302 EXIST::FUNCTION:DES | 294 | EVP_des_ede 302 EXIST::FUNCTION:DES |
295 | EVP_des_ede3 303 EXIST::FUNCTION:DES | 295 | EVP_des_ede3 303 EXIST::FUNCTION:DES |
296 | EVP_des_ede3_cbc 304 EXIST::FUNCTION:DES | 296 | EVP_des_ede3_cbc 304 EXIST::FUNCTION:DES |
297 | EVP_des_ede3_cfb 305 EXIST::FUNCTION:DES | 297 | EVP_des_ede3_cfb64 305 EXIST::FUNCTION:DES |
298 | EVP_des_ede3_ofb 306 EXIST::FUNCTION:DES | 298 | EVP_des_ede3_ofb 306 EXIST::FUNCTION:DES |
299 | EVP_des_ede_cbc 307 EXIST::FUNCTION:DES | 299 | EVP_des_ede_cbc 307 EXIST::FUNCTION:DES |
300 | EVP_des_ede_cfb 308 EXIST::FUNCTION:DES | 300 | EVP_des_ede_cfb64 308 EXIST::FUNCTION:DES |
301 | EVP_des_ede_ofb 309 EXIST::FUNCTION:DES | 301 | EVP_des_ede_ofb 309 EXIST::FUNCTION:DES |
302 | EVP_des_ofb 310 EXIST::FUNCTION:DES | 302 | EVP_des_ofb 310 EXIST::FUNCTION:DES |
303 | EVP_desx_cbc 311 EXIST::FUNCTION:DES | 303 | EVP_desx_cbc 311 EXIST::FUNCTION:DES |
@@ -308,14 +308,14 @@ EVP_get_cipherbyname 315 EXIST::FUNCTION: | |||
308 | EVP_get_digestbyname 316 EXIST::FUNCTION: | 308 | EVP_get_digestbyname 316 EXIST::FUNCTION: |
309 | EVP_get_pw_prompt 317 EXIST::FUNCTION: | 309 | EVP_get_pw_prompt 317 EXIST::FUNCTION: |
310 | EVP_idea_cbc 318 EXIST::FUNCTION:IDEA | 310 | EVP_idea_cbc 318 EXIST::FUNCTION:IDEA |
311 | EVP_idea_cfb 319 EXIST::FUNCTION:IDEA | 311 | EVP_idea_cfb64 319 EXIST::FUNCTION:IDEA |
312 | EVP_idea_ecb 320 EXIST::FUNCTION:IDEA | 312 | EVP_idea_ecb 320 EXIST::FUNCTION:IDEA |
313 | EVP_idea_ofb 321 EXIST::FUNCTION:IDEA | 313 | EVP_idea_ofb 321 EXIST::FUNCTION:IDEA |
314 | EVP_md2 322 EXIST::FUNCTION:MD2 | 314 | EVP_md2 322 EXIST::FUNCTION:MD2 |
315 | EVP_md5 323 EXIST::FUNCTION:MD5 | 315 | EVP_md5 323 EXIST::FUNCTION:MD5 |
316 | EVP_md_null 324 EXIST::FUNCTION: | 316 | EVP_md_null 324 EXIST::FUNCTION: |
317 | EVP_rc2_cbc 325 EXIST::FUNCTION:RC2 | 317 | EVP_rc2_cbc 325 EXIST::FUNCTION:RC2 |
318 | EVP_rc2_cfb 326 EXIST::FUNCTION:RC2 | 318 | EVP_rc2_cfb64 326 EXIST::FUNCTION:RC2 |
319 | EVP_rc2_ecb 327 EXIST::FUNCTION:RC2 | 319 | EVP_rc2_ecb 327 EXIST::FUNCTION:RC2 |
320 | EVP_rc2_ofb 328 EXIST::FUNCTION:RC2 | 320 | EVP_rc2_ofb 328 EXIST::FUNCTION:RC2 |
321 | EVP_rc4 329 EXIST::FUNCTION:RC4 | 321 | EVP_rc4 329 EXIST::FUNCTION:RC4 |
@@ -962,7 +962,7 @@ i2t_ASN1_OBJECT 979 EXIST::FUNCTION: | |||
962 | BN_BLINDING_new 980 EXIST::FUNCTION: | 962 | BN_BLINDING_new 980 EXIST::FUNCTION: |
963 | BN_BLINDING_free 981 EXIST::FUNCTION: | 963 | BN_BLINDING_free 981 EXIST::FUNCTION: |
964 | EVP_cast5_cbc 983 EXIST::FUNCTION:CAST | 964 | EVP_cast5_cbc 983 EXIST::FUNCTION:CAST |
965 | EVP_cast5_cfb 984 EXIST::FUNCTION:CAST | 965 | EVP_cast5_cfb64 984 EXIST::FUNCTION:CAST |
966 | EVP_cast5_ecb 985 EXIST::FUNCTION:CAST | 966 | EVP_cast5_ecb 985 EXIST::FUNCTION:CAST |
967 | EVP_cast5_ofb 986 EXIST::FUNCTION:CAST | 967 | EVP_cast5_ofb 986 EXIST::FUNCTION:CAST |
968 | BF_decrypt 987 EXIST::FUNCTION:BF | 968 | BF_decrypt 987 EXIST::FUNCTION:BF |
@@ -1057,7 +1057,7 @@ EVP_CIPHER_param_to_asn1 1084 EXIST::FUNCTION: | |||
1057 | EVP_CIPHER_get_asn1_iv 1085 EXIST::FUNCTION: | 1057 | EVP_CIPHER_get_asn1_iv 1085 EXIST::FUNCTION: |
1058 | EVP_CIPHER_set_asn1_iv 1086 EXIST::FUNCTION: | 1058 | EVP_CIPHER_set_asn1_iv 1086 EXIST::FUNCTION: |
1059 | EVP_rc5_32_12_16_cbc 1087 EXIST::FUNCTION:RC5 | 1059 | EVP_rc5_32_12_16_cbc 1087 EXIST::FUNCTION:RC5 |
1060 | EVP_rc5_32_12_16_cfb 1088 EXIST::FUNCTION:RC5 | 1060 | EVP_rc5_32_12_16_cfb64 1088 EXIST::FUNCTION:RC5 |
1061 | EVP_rc5_32_12_16_ecb 1089 EXIST::FUNCTION:RC5 | 1061 | EVP_rc5_32_12_16_ecb 1089 EXIST::FUNCTION:RC5 |
1062 | EVP_rc5_32_12_16_ofb 1090 EXIST::FUNCTION:RC5 | 1062 | EVP_rc5_32_12_16_ofb 1090 EXIST::FUNCTION:RC5 |
1063 | asn1_add_error 1091 EXIST::FUNCTION: | 1063 | asn1_add_error 1091 EXIST::FUNCTION: |
@@ -2776,10 +2776,10 @@ ENGINE_load_4758cca 3218 EXIST::FUNCTION:ENGINE | |||
2776 | _ossl_096_des_random_seed 3219 EXIST::FUNCTION:DES | 2776 | _ossl_096_des_random_seed 3219 EXIST::FUNCTION:DES |
2777 | EVP_aes_256_ofb 3220 EXIST::FUNCTION:AES | 2777 | EVP_aes_256_ofb 3220 EXIST::FUNCTION:AES |
2778 | EVP_aes_192_ofb 3221 EXIST::FUNCTION:AES | 2778 | EVP_aes_192_ofb 3221 EXIST::FUNCTION:AES |
2779 | EVP_aes_128_cfb 3222 EXIST::FUNCTION:AES | 2779 | EVP_aes_128_cfb128 3222 EXIST::FUNCTION:AES |
2780 | EVP_aes_256_cfb 3223 EXIST::FUNCTION:AES | 2780 | EVP_aes_256_cfb128 3223 EXIST::FUNCTION:AES |
2781 | EVP_aes_128_ofb 3224 EXIST::FUNCTION:AES | 2781 | EVP_aes_128_ofb 3224 EXIST::FUNCTION:AES |
2782 | EVP_aes_192_cfb 3225 EXIST::FUNCTION:AES | 2782 | EVP_aes_192_cfb128 3225 EXIST::FUNCTION:AES |
2783 | CONF_modules_free 3226 EXIST::FUNCTION: | 2783 | CONF_modules_free 3226 EXIST::FUNCTION: |
2784 | NCONF_default 3227 EXIST::FUNCTION: | 2784 | NCONF_default 3227 EXIST::FUNCTION: |
2785 | OPENSSL_no_config 3228 EXIST::FUNCTION: | 2785 | OPENSSL_no_config 3228 EXIST::FUNCTION: |
@@ -2803,3 +2803,67 @@ OpenSSLDie 3244 EXIST::FUNCTION: | |||
2803 | OPENSSL_cleanse 3245 EXIST::FUNCTION: | 2803 | OPENSSL_cleanse 3245 EXIST::FUNCTION: |
2804 | ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE | 2804 | ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE |
2805 | ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH | 2805 | ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH |
2806 | EVP_aes_128_cfb8 3248 EXIST::FUNCTION:AES | ||
2807 | FIPS_corrupt_rsa 3249 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2808 | FIPS_selftest_des 3250 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2809 | EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES | ||
2810 | EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES | ||
2811 | FIPS_mode_set 3253 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2812 | FIPS_selftest_dsa 3254 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2813 | EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES | ||
2814 | FIPS_allow_md5 3256 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2815 | DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES | ||
2816 | EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES | ||
2817 | FIPS_rand_seeded 3259 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2818 | AES_cfbr_encrypt_block 3260 EXIST::FUNCTION:AES | ||
2819 | AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES | ||
2820 | FIPS_rand_seed 3262 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2821 | FIPS_corrupt_des 3263 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2822 | EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES | ||
2823 | FIPS_selftest_aes 3265 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2824 | FIPS_set_prng_key 3266 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2825 | EVP_des_cfb8 3267 EXIST::FUNCTION:DES | ||
2826 | FIPS_corrupt_dsa 3268 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2827 | FIPS_test_mode 3269 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2828 | FIPS_rand_method 3270 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2829 | EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES | ||
2830 | ERR_load_FIPS_strings 3272 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2831 | FIPS_corrupt_aes 3273 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2832 | FIPS_selftest_sha1 3274 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2833 | FIPS_selftest_rsa 3275 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2834 | FIPS_corrupt_sha1 3276 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2835 | EVP_des_cfb1 3277 EXIST::FUNCTION:DES | ||
2836 | FIPS_dsa_check 3278 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2837 | AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES | ||
2838 | EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES | ||
2839 | FIPS_rand_check 3281 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2840 | FIPS_md5_allowed 3282 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2841 | FIPS_mode 3283 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2842 | FIPS_selftest_failed 3284 EXIST:OPENSSL_FIPS:FUNCTION: | ||
2843 | sk_is_sorted 3285 EXIST::FUNCTION: | ||
2844 | X509_check_ca 3286 EXIST::FUNCTION: | ||
2845 | private_idea_set_encrypt_key 3287 EXIST:OPENSSL_FIPS:FUNCTION:IDEA | ||
2846 | HMAC_CTX_set_flags 3288 EXIST::FUNCTION:HMAC | ||
2847 | private_SHA_Init 3289 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA0 | ||
2848 | private_CAST_set_key 3290 EXIST:OPENSSL_FIPS:FUNCTION:CAST | ||
2849 | private_RIPEMD160_Init 3291 EXIST:OPENSSL_FIPS:FUNCTION:RIPEMD | ||
2850 | private_RC5_32_set_key 3292 EXIST:OPENSSL_FIPS:FUNCTION:RC5 | ||
2851 | private_MD5_Init 3293 EXIST:OPENSSL_FIPS:FUNCTION:MD5 | ||
2852 | private_RC4_set_key 3294 EXIST:OPENSSL_FIPS:FUNCTION:RC4 | ||
2853 | private_MDC2_Init 3295 EXIST:OPENSSL_FIPS:FUNCTION:MDC2 | ||
2854 | private_RC2_set_key 3296 EXIST:OPENSSL_FIPS:FUNCTION:RC2 | ||
2855 | private_MD4_Init 3297 EXIST:OPENSSL_FIPS:FUNCTION:MD4 | ||
2856 | private_BF_set_key 3298 EXIST:OPENSSL_FIPS:FUNCTION:BF | ||
2857 | private_MD2_Init 3299 EXIST:OPENSSL_FIPS:FUNCTION:MD2 | ||
2858 | d2i_PROXY_CERT_INFO_EXTENSION 3300 EXIST::FUNCTION: | ||
2859 | PROXY_POLICY_it 3301 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
2860 | PROXY_POLICY_it 3301 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
2861 | i2d_PROXY_POLICY 3302 EXIST::FUNCTION: | ||
2862 | i2d_PROXY_CERT_INFO_EXTENSION 3303 EXIST::FUNCTION: | ||
2863 | d2i_PROXY_POLICY 3304 EXIST::FUNCTION: | ||
2864 | PROXY_CERT_INFO_EXTENSION_new 3305 EXIST::FUNCTION: | ||
2865 | PROXY_CERT_INFO_EXTENSION_free 3306 EXIST::FUNCTION: | ||
2866 | PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
2867 | PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
2868 | PROXY_POLICY_free 3308 EXIST::FUNCTION: | ||
2869 | PROXY_POLICY_new 3309 EXIST::FUNCTION: | ||
diff --git a/src/lib/libssl/src/util/mk1mf.pl b/src/lib/libssl/src/util/mk1mf.pl index b4bc0457e5..957264c6b5 100644 --- a/src/lib/libssl/src/util/mk1mf.pl +++ b/src/lib/libssl/src/util/mk1mf.pl | |||
@@ -10,7 +10,7 @@ $OPTIONS=""; | |||
10 | $ssl_version=""; | 10 | $ssl_version=""; |
11 | $banner="\t\@echo Building OpenSSL"; | 11 | $banner="\t\@echo Building OpenSSL"; |
12 | 12 | ||
13 | open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n"; | 13 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; |
14 | while(<IN>) { | 14 | while(<IN>) { |
15 | $ssl_version=$1 if (/^VERSION=(.*)$/); | 15 | $ssl_version=$1 if (/^VERSION=(.*)$/); |
16 | $OPTIONS=$1 if (/^OPTIONS=(.*)$/); | 16 | $OPTIONS=$1 if (/^OPTIONS=(.*)$/); |
@@ -18,7 +18,7 @@ while(<IN>) { | |||
18 | } | 18 | } |
19 | close(IN); | 19 | close(IN); |
20 | 20 | ||
21 | die "Makefile.ssl is not the toplevel Makefile!\n" if $ssl_version eq ""; | 21 | die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; |
22 | 22 | ||
23 | $infile="MINFO"; | 23 | $infile="MINFO"; |
24 | 24 | ||
@@ -222,7 +222,7 @@ $cflags.=" -DOPENSSL_NO_SHA" if $no_sha; | |||
222 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; | 222 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; |
223 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; | 223 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; |
224 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; | 224 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; |
225 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; | 225 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; |
226 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; | 226 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; |
227 | $cflags.=" -DOPENSSL_NO_DES" if $no_des; | 227 | $cflags.=" -DOPENSSL_NO_DES" if $no_des; |
228 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; | 228 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; |
@@ -236,6 +236,7 @@ $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; | |||
236 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; | 236 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; |
237 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; | 237 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; |
238 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | 238 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; |
239 | $cflags.=" -DOPENSSL_FIPS" if $fips; | ||
239 | #$cflags.=" -DRSAref" if $rsaref ne ""; | 240 | #$cflags.=" -DRSAref" if $rsaref ne ""; |
240 | 241 | ||
241 | ## if ($unix) | 242 | ## if ($unix) |
@@ -631,15 +632,21 @@ foreach (split(/\s+/,$test)) | |||
631 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | 632 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); |
632 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); | 633 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); |
633 | 634 | ||
634 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | 635 | if ($fips) |
635 | 636 | { | |
637 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)","\$(BIN_D)$o.sha1","\$(BIN_D)$o\$(E_EXE)$exep"); | ||
638 | } | ||
639 | else | ||
640 | { | ||
641 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | ||
642 | } | ||
636 | print $defs; | 643 | print $defs; |
637 | 644 | ||
638 | if ($platform eq "linux-elf") { | 645 | if ($platform eq "linux-elf") { |
639 | print <<"EOF"; | 646 | print <<"EOF"; |
640 | # Generate perlasm output files | 647 | # Generate perlasm output files |
641 | %.cpp: | 648 | %.cpp: |
642 | (cd \$(\@D)/..; PERL=perl make -f Makefile.ssl asm/\$(\@F)) | 649 | (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F)) |
643 | EOF | 650 | EOF |
644 | } | 651 | } |
645 | print "###################################################################\n"; | 652 | print "###################################################################\n"; |
@@ -921,6 +928,7 @@ sub read_options | |||
921 | $no_aes=1; } | 928 | $no_aes=1; } |
922 | 929 | ||
923 | elsif (/^rsaref$/) { } | 930 | elsif (/^rsaref$/) { } |
931 | elsif (/^fips$/) { $fips=1; } | ||
924 | elsif (/^gcc$/) { $gcc=1; } | 932 | elsif (/^gcc$/) { $gcc=1; } |
925 | elsif (/^debug$/) { $debug=1; } | 933 | elsif (/^debug$/) { $debug=1; } |
926 | elsif (/^profile$/) { $profile=1; } | 934 | elsif (/^profile$/) { $profile=1; } |
diff --git a/src/lib/libssl/src/util/mkdef.pl b/src/lib/libssl/src/util/mkdef.pl index 01a1bfda19..9918c3d549 100644 --- a/src/lib/libssl/src/util/mkdef.pl +++ b/src/lib/libssl/src/util/mkdef.pl | |||
@@ -79,7 +79,7 @@ my $OS2=0; | |||
79 | my $safe_stack_def = 0; | 79 | my $safe_stack_def = 0; |
80 | 80 | ||
81 | my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", | 81 | my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", |
82 | "EXPORT_VAR_AS_FUNCTION" ); | 82 | "EXPORT_VAR_AS_FUNCTION", "OPENSSL_FIPS" ); |
83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); | 83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); |
84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | 84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", |
85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", | 85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", |
@@ -94,7 +94,7 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | |||
94 | "FP_API", "STDIO", "SOCK", "KRB5", "ENGINE", "HW" ); | 94 | "FP_API", "STDIO", "SOCK", "KRB5", "ENGINE", "HW" ); |
95 | 95 | ||
96 | my $options=""; | 96 | my $options=""; |
97 | open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n"; | 97 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; |
98 | while(<IN>) { | 98 | while(<IN>) { |
99 | $options=$1 if (/^OPTIONS=(.*)$/); | 99 | $options=$1 if (/^OPTIONS=(.*)$/); |
100 | } | 100 | } |
@@ -109,6 +109,7 @@ my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; | |||
109 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; | 109 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; |
110 | my $no_ec; my $no_engine; my $no_hw; | 110 | my $no_ec; my $no_engine; my $no_hw; |
111 | my $no_fp_api; | 111 | my $no_fp_api; |
112 | my $fips; | ||
112 | 113 | ||
113 | foreach (@ARGV, split(/ /, $options)) | 114 | foreach (@ARGV, split(/ /, $options)) |
114 | { | 115 | { |
@@ -129,6 +130,7 @@ foreach (@ARGV, split(/ /, $options)) | |||
129 | } | 130 | } |
130 | $VMS=1 if $_ eq "VMS"; | 131 | $VMS=1 if $_ eq "VMS"; |
131 | $OS2=1 if $_ eq "OS2"; | 132 | $OS2=1 if $_ eq "OS2"; |
133 | $fips=1 if $_ eq "fips"; | ||
132 | 134 | ||
133 | $do_ssl=1 if $_ eq "ssleay"; | 135 | $do_ssl=1 if $_ eq "ssleay"; |
134 | if ($_ eq "ssl") { | 136 | if ($_ eq "ssl") { |
@@ -265,6 +267,7 @@ $crypto.=" crypto/ocsp/ocsp.h"; | |||
265 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; | 267 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; |
266 | $crypto.=" crypto/krb5/krb5_asn.h"; | 268 | $crypto.=" crypto/krb5/krb5_asn.h"; |
267 | $crypto.=" crypto/tmdiff.h"; | 269 | $crypto.=" crypto/tmdiff.h"; |
270 | $crypto.=" fips/fips.h fips/rand/fips_rand.h"; | ||
268 | 271 | ||
269 | my $symhacks="crypto/symhacks.h"; | 272 | my $symhacks="crypto/symhacks.h"; |
270 | 273 | ||
@@ -469,7 +472,7 @@ sub do_defs | |||
469 | push(@tag,$1); | 472 | push(@tag,$1); |
470 | $tag{$1}=-1; | 473 | $tag{$1}=-1; |
471 | } | 474 | } |
472 | } elsif (/^\#\s*ifdef\s+(.*)/) { | 475 | } elsif (/^\#\s*ifdef\s+(\S*)/) { |
473 | push(@tag,"-"); | 476 | push(@tag,"-"); |
474 | push(@tag,$1); | 477 | push(@tag,$1); |
475 | $tag{$1}=1; | 478 | $tag{$1}=1; |
@@ -794,7 +797,7 @@ sub do_defs | |||
794 | } | 797 | } |
795 | close(IN); | 798 | close(IN); |
796 | 799 | ||
797 | my $algs; | 800 | my $algs = ''; |
798 | my $plays; | 801 | my $plays; |
799 | 802 | ||
800 | print STDERR "DEBUG: postprocessing ----------\n" if $debug; | 803 | print STDERR "DEBUG: postprocessing ----------\n" if $debug; |
@@ -864,6 +867,7 @@ sub do_defs | |||
864 | 867 | ||
865 | $platform{$s} = | 868 | $platform{$s} = |
866 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); | 869 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); |
870 | $algorithm{$s} = '' if !defined $algorithm{$s}; | ||
867 | $algorithm{$s} .= ','.$a; | 871 | $algorithm{$s} .= ','.$a; |
868 | 872 | ||
869 | if (defined($variant{$s})) { | 873 | if (defined($variant{$s})) { |
@@ -1028,6 +1032,9 @@ sub is_valid | |||
1028 | if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { | 1032 | if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { |
1029 | return 1; | 1033 | return 1; |
1030 | } | 1034 | } |
1035 | if ($keyword eq "OPENSSL_FIPS" && $fips) { | ||
1036 | return 1; | ||
1037 | } | ||
1031 | return 0; | 1038 | return 0; |
1032 | } else { | 1039 | } else { |
1033 | # algorithms | 1040 | # algorithms |
@@ -1119,7 +1126,7 @@ sub print_test_file | |||
1119 | sub get_version { | 1126 | sub get_version { |
1120 | local *MF; | 1127 | local *MF; |
1121 | my $v = '?'; | 1128 | my $v = '?'; |
1122 | open MF, 'Makefile.ssl' or return $v; | 1129 | open MF, 'Makefile' or return $v; |
1123 | while (<MF>) { | 1130 | while (<MF>) { |
1124 | $v = $1, last if /^VERSION=(.*?)\s*$/; | 1131 | $v = $1, last if /^VERSION=(.*?)\s*$/; |
1125 | } | 1132 | } |
diff --git a/src/lib/libssl/src/util/mkerr.pl b/src/lib/libssl/src/util/mkerr.pl index 1b2915c767..60e534807e 100644 --- a/src/lib/libssl/src/util/mkerr.pl +++ b/src/lib/libssl/src/util/mkerr.pl | |||
@@ -41,7 +41,8 @@ while (@ARGV) { | |||
41 | } | 41 | } |
42 | 42 | ||
43 | if($recurse) { | 43 | if($recurse) { |
44 | @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>); | 44 | @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <fips/*.c>, |
45 | <fips/*/*.c>); | ||
45 | } else { | 46 | } else { |
46 | @source = @ARGV; | 47 | @source = @ARGV; |
47 | } | 48 | } |
@@ -262,7 +263,7 @@ foreach $lib (keys %csrc) | |||
262 | } else { | 263 | } else { |
263 | push @out, | 264 | push @out, |
264 | "/* ====================================================================\n", | 265 | "/* ====================================================================\n", |
265 | " * Copyright (c) 2001-2003 The OpenSSL Project. All rights reserved.\n", | 266 | " * Copyright (c) 2001-2005 The OpenSSL Project. All rights reserved.\n", |
266 | " *\n", | 267 | " *\n", |
267 | " * Redistribution and use in source and binary forms, with or without\n", | 268 | " * Redistribution and use in source and binary forms, with or without\n", |
268 | " * modification, are permitted provided that the following conditions\n", | 269 | " * modification, are permitted provided that the following conditions\n", |
@@ -404,7 +405,7 @@ EOF | |||
404 | print OUT <<"EOF"; | 405 | print OUT <<"EOF"; |
405 | /* $cfile */ | 406 | /* $cfile */ |
406 | /* ==================================================================== | 407 | /* ==================================================================== |
407 | * Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved. | 408 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. |
408 | * | 409 | * |
409 | * Redistribution and use in source and binary forms, with or without | 410 | * Redistribution and use in source and binary forms, with or without |
410 | * modification, are permitted provided that the following conditions | 411 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libssl/src/util/mkfiles.pl b/src/lib/libssl/src/util/mkfiles.pl index 29e1404c69..928a274303 100644 --- a/src/lib/libssl/src/util/mkfiles.pl +++ b/src/lib/libssl/src/util/mkfiles.pl | |||
@@ -51,6 +51,14 @@ my @dirs = ( | |||
51 | "crypto/ocsp", | 51 | "crypto/ocsp", |
52 | "crypto/ui", | 52 | "crypto/ui", |
53 | "crypto/krb5", | 53 | "crypto/krb5", |
54 | "fips", | ||
55 | "fips/aes", | ||
56 | "fips/des", | ||
57 | "fips/dsa", | ||
58 | "fips/dh", | ||
59 | "fips/rand", | ||
60 | "fips/rsa", | ||
61 | "fips/sha1", | ||
54 | "ssl", | 62 | "ssl", |
55 | "apps", | 63 | "apps", |
56 | "test", | 64 | "test", |
@@ -58,7 +66,7 @@ my @dirs = ( | |||
58 | ); | 66 | ); |
59 | 67 | ||
60 | foreach (@dirs) { | 68 | foreach (@dirs) { |
61 | &files_dir ($_, "Makefile.ssl"); | 69 | &files_dir ($_, "Makefile"); |
62 | } | 70 | } |
63 | 71 | ||
64 | exit(0); | 72 | exit(0); |
diff --git a/src/lib/libssl/src/util/mklink.pl b/src/lib/libssl/src/util/mklink.pl index 9386da7aa4..c8653cecc3 100644 --- a/src/lib/libssl/src/util/mklink.pl +++ b/src/lib/libssl/src/util/mklink.pl | |||
@@ -52,6 +52,7 @@ $symlink_exists=eval {symlink("",""); 1}; | |||
52 | foreach $file (@files) { | 52 | foreach $file (@files) { |
53 | my $err = ""; | 53 | my $err = ""; |
54 | if ($symlink_exists) { | 54 | if ($symlink_exists) { |
55 | unlink "$from/$file"; | ||
55 | symlink("$to/$file", "$from/$file") or $err = " [$!]"; | 56 | symlink("$to/$file", "$from/$file") or $err = " [$!]"; |
56 | } else { | 57 | } else { |
57 | unlink "$from/$file"; | 58 | unlink "$from/$file"; |
diff --git a/src/lib/libssl/src/util/mkstack.pl b/src/lib/libssl/src/util/mkstack.pl index 085c50f790..0ca9eb6a76 100644 --- a/src/lib/libssl/src/util/mkstack.pl +++ b/src/lib/libssl/src/util/mkstack.pl | |||
@@ -84,6 +84,7 @@ while(<IN>) { | |||
84 | #define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st)) | 84 | #define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st)) |
85 | #define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st)) | 85 | #define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st)) |
86 | #define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st)) | 86 | #define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st)) |
87 | #define sk_${type_thing}_is_sorted(st) SKM_sk_is_sorted($type_thing, (st)) | ||
87 | EOF | 88 | EOF |
88 | } | 89 | } |
89 | foreach $type_thing (sort @asn1setlst) { | 90 | foreach $type_thing (sort @asn1setlst) { |
diff --git a/src/lib/libssl/src/util/pl/BC-16.pl b/src/lib/libssl/src/util/pl/BC-16.pl index 2033f524ca..8030653daa 100644 --- a/src/lib/libssl/src/util/pl/BC-16.pl +++ b/src/lib/libssl/src/util/pl/BC-16.pl | |||
@@ -64,7 +64,7 @@ $lfile=''; | |||
64 | 64 | ||
65 | $asm='bcc -c -B -Tml'; | 65 | $asm='bcc -c -B -Tml'; |
66 | $afile='/o'; | 66 | $afile='/o'; |
67 | if ($no_asm) | 67 | if ($no_asm || $fips) |
68 | { | 68 | { |
69 | $bn_asm_obj=''; | 69 | $bn_asm_obj=''; |
70 | $bn_asm_src=''; | 70 | $bn_asm_src=''; |
@@ -119,11 +119,11 @@ sub do_lib_rule | |||
119 | 119 | ||
120 | sub do_link_rule | 120 | sub do_link_rule |
121 | { | 121 | { |
122 | local($target,$files,$dep_libs,$libs)=@_; | 122 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
123 | local($ret,$f,$_,@f); | 123 | local($ret,$f,$_,@f); |
124 | 124 | ||
125 | $file =~ s/\//$o/g if $o ne '/'; | 125 | $file =~ s/\//$o/g if $o ne '/'; |
126 | $n=&bname($targer); | 126 | $n=&bname($target); |
127 | $ret.="$target: $files $dep_libs\n"; | 127 | $ret.="$target: $files $dep_libs\n"; |
128 | $ret.=" \$(LINK) @&&|"; | 128 | $ret.=" \$(LINK) @&&|"; |
129 | 129 | ||
@@ -139,7 +139,12 @@ sub do_link_rule | |||
139 | } | 139 | } |
140 | else | 140 | else |
141 | { $ret.="\n $r \$(APP_EX_OBJ) $files\n"; } | 141 | { $ret.="\n $r \$(APP_EX_OBJ) $files\n"; } |
142 | $ret.=" $target\n\n $libs\n\n|\n\n"; | 142 | $ret.=" $target\n\n $libs\n\n|\n"; |
143 | if (defined $sha1file) | ||
144 | { | ||
145 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
146 | } | ||
147 | $ret.="\n"; | ||
143 | return($ret); | 148 | return($ret); |
144 | } | 149 | } |
145 | 150 | ||
diff --git a/src/lib/libssl/src/util/pl/BC-32.pl b/src/lib/libssl/src/util/pl/BC-32.pl index e83b336190..897ae9d824 100644 --- a/src/lib/libssl/src/util/pl/BC-32.pl +++ b/src/lib/libssl/src/util/pl/BC-32.pl | |||
@@ -62,7 +62,7 @@ $des_enc_src=''; | |||
62 | $bf_enc_obj=''; | 62 | $bf_enc_obj=''; |
63 | $bf_enc_src=''; | 63 | $bf_enc_src=''; |
64 | 64 | ||
65 | if (!$no_asm) | 65 | if (!$no_asm && !$fips) |
66 | { | 66 | { |
67 | $bn_mulw_obj='crypto\bn\asm\bn_win32.obj'; | 67 | $bn_mulw_obj='crypto\bn\asm\bn_win32.obj'; |
68 | $bn_mulw_src='crypto\bn\asm\bn_win32.asm'; | 68 | $bn_mulw_src='crypto\bn\asm\bn_win32.asm'; |
@@ -122,13 +122,18 @@ sub do_lib_rule | |||
122 | 122 | ||
123 | sub do_link_rule | 123 | sub do_link_rule |
124 | { | 124 | { |
125 | local($target,$files,$dep_libs,$libs)=@_; | 125 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
126 | local($ret,$_); | 126 | local($ret,$_); |
127 | 127 | ||
128 | $file =~ s/\//$o/g if $o ne '/'; | 128 | $file =~ s/\//$o/g if $o ne '/'; |
129 | $n=&bname($targer); | 129 | $n=&bname($targer); |
130 | $ret.="$target: $files $dep_libs\n"; | 130 | $ret.="$target: $files $dep_libs\n"; |
131 | $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n"; | 131 | $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n"; |
132 | if (defined $sha1file) | ||
133 | { | ||
134 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
135 | } | ||
136 | $ret.="\n"; | ||
132 | return($ret); | 137 | return($ret); |
133 | } | 138 | } |
134 | 139 | ||
diff --git a/src/lib/libssl/src/util/pl/Mingw32.pl b/src/lib/libssl/src/util/pl/Mingw32.pl index 4bee638c4a..b9bb24d21d 100644 --- a/src/lib/libssl/src/util/pl/Mingw32.pl +++ b/src/lib/libssl/src/util/pl/Mingw32.pl | |||
@@ -21,7 +21,7 @@ if ($debug) | |||
21 | else | 21 | else |
22 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -mcpu=i486 -Wall"; } | 22 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -mcpu=i486 -Wall"; } |
23 | 23 | ||
24 | if ($gaswin and !$no_asm) | 24 | if ($gaswin and !$no_asm and !$fips) |
25 | { | 25 | { |
26 | $bn_asm_obj='$(OBJ_D)\bn-win32.o'; | 26 | $bn_asm_obj='$(OBJ_D)\bn-win32.o'; |
27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; | 27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; |
@@ -92,13 +92,18 @@ sub do_lib_rule | |||
92 | 92 | ||
93 | sub do_link_rule | 93 | sub do_link_rule |
94 | { | 94 | { |
95 | local($target,$files,$dep_libs,$libs)=@_; | 95 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
96 | local($ret,$_); | 96 | local($ret,$_); |
97 | 97 | ||
98 | $file =~ s/\//$o/g if $o ne '/'; | 98 | $file =~ s/\//$o/g if $o ne '/'; |
99 | $n=&bname($target); | 99 | $n=&bname($target); |
100 | $ret.="$target: $files $dep_libs\n"; | 100 | $ret.="$target: $files $dep_libs\n"; |
101 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | 101 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n"; |
102 | if (defined $sha1file) | ||
103 | { | ||
104 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
105 | } | ||
106 | $ret.="\n"; | ||
102 | return($ret); | 107 | return($ret); |
103 | } | 108 | } |
104 | 1; | 109 | 1; |
diff --git a/src/lib/libssl/src/util/pl/OS2-EMX.pl b/src/lib/libssl/src/util/pl/OS2-EMX.pl index ddb3524210..75d72ebbcb 100644 --- a/src/lib/libssl/src/util/pl/OS2-EMX.pl +++ b/src/lib/libssl/src/util/pl/OS2-EMX.pl | |||
@@ -48,7 +48,7 @@ $des_enc_src=""; | |||
48 | $bf_enc_obj=""; | 48 | $bf_enc_obj=""; |
49 | $bf_enc_src=""; | 49 | $bf_enc_src=""; |
50 | 50 | ||
51 | if (!$no_asm) | 51 | if (!$no_asm && !$fips) |
52 | { | 52 | { |
53 | $bn_asm_obj="crypto/bn/asm/bn-os2$obj crypto/bn/asm/co-os2$obj"; | 53 | $bn_asm_obj="crypto/bn/asm/bn-os2$obj crypto/bn/asm/co-os2$obj"; |
54 | $bn_asm_src="crypto/bn/asm/bn-os2.asm crypto/bn/asm/co-os2.asm"; | 54 | $bn_asm_src="crypto/bn/asm/bn-os2.asm crypto/bn/asm/co-os2.asm"; |
@@ -106,13 +106,18 @@ sub do_lib_rule | |||
106 | 106 | ||
107 | sub do_link_rule | 107 | sub do_link_rule |
108 | { | 108 | { |
109 | local($target,$files,$dep_libs,$libs)=@_; | 109 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
110 | local($ret,$_); | 110 | local($ret,$_); |
111 | 111 | ||
112 | $file =~ s/\//$o/g if $o ne '/'; | 112 | $file =~ s/\//$o/g if $o ne '/'; |
113 | $n=&bname($target); | 113 | $n=&bname($target); |
114 | $ret.="$target: $files $dep_libs\n"; | 114 | $ret.="$target: $files $dep_libs\n"; |
115 | $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n"; | 115 | $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n"; |
116 | if (defined $sha1file) | ||
117 | { | ||
118 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
119 | } | ||
120 | $ret.="\n"; | ||
116 | return($ret); | 121 | return($ret); |
117 | } | 122 | } |
118 | 123 | ||
diff --git a/src/lib/libssl/src/util/pl/VC-16.pl b/src/lib/libssl/src/util/pl/VC-16.pl index 7cda5e67a9..564ba3fd08 100644 --- a/src/lib/libssl/src/util/pl/VC-16.pl +++ b/src/lib/libssl/src/util/pl/VC-16.pl | |||
@@ -61,7 +61,7 @@ if ($shlib) | |||
61 | else | 61 | else |
62 | { $mlflags=''; } | 62 | { $mlflags=''; } |
63 | 63 | ||
64 | $app_ex_obj="setargv.obj"; | 64 | $app_ex_obj=""; |
65 | 65 | ||
66 | $obj='.obj'; | 66 | $obj='.obj'; |
67 | $ofile="/Fo"; | 67 | $ofile="/Fo"; |
@@ -90,7 +90,7 @@ $des_enc_src=''; | |||
90 | $bf_enc_obj=''; | 90 | $bf_enc_obj=''; |
91 | $bf_enc_src=''; | 91 | $bf_enc_src=''; |
92 | 92 | ||
93 | if (!$no_asm) | 93 | if (!$no_asm && !$fips) |
94 | { | 94 | { |
95 | if ($asmbits == 32) | 95 | if ($asmbits == 32) |
96 | { | 96 | { |
@@ -147,7 +147,7 @@ sub do_lib_rule | |||
147 | 147 | ||
148 | sub do_link_rule | 148 | sub do_link_rule |
149 | { | 149 | { |
150 | local($target,$files,$dep_libs,$libs)=@_; | 150 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
151 | local($ret,$f,$_,@f); | 151 | local($ret,$f,$_,@f); |
152 | 152 | ||
153 | $file =~ s/\//$o/g if $o ne '/'; | 153 | $file =~ s/\//$o/g if $o ne '/'; |
@@ -165,7 +165,12 @@ sub do_link_rule | |||
165 | } | 165 | } |
166 | else | 166 | else |
167 | { $ret.=" \$(APP_EX_OBJ) $files"; } | 167 | { $ret.=" \$(APP_EX_OBJ) $files"; } |
168 | $ret.="\n $target\n\n $libs\n\n<<\n\n"; | 168 | $ret.="\n $target\n\n $libs\n\n<<\n"; |
169 | if (defined $sha1file) | ||
170 | { | ||
171 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
172 | } | ||
173 | $ret.="\n"; | ||
169 | return($ret); | 174 | return($ret); |
170 | } | 175 | } |
171 | 176 | ||
diff --git a/src/lib/libssl/src/util/pl/VC-32.pl b/src/lib/libssl/src/util/pl/VC-32.pl index 285990c589..cf689b9feb 100644 --- a/src/lib/libssl/src/util/pl/VC-32.pl +++ b/src/lib/libssl/src/util/pl/VC-32.pl | |||
@@ -64,7 +64,7 @@ $des_enc_src=''; | |||
64 | $bf_enc_obj=''; | 64 | $bf_enc_obj=''; |
65 | $bf_enc_src=''; | 65 | $bf_enc_src=''; |
66 | 66 | ||
67 | if (!$no_asm) | 67 | if (!$no_asm && !$fips) |
68 | { | 68 | { |
69 | $bn_asm_obj='crypto\bn\asm\bn_win32.obj'; | 69 | $bn_asm_obj='crypto\bn\asm\bn_win32.obj'; |
70 | $bn_asm_src='crypto\bn\asm\bn_win32.asm'; | 70 | $bn_asm_src='crypto\bn\asm\bn_win32.asm'; |
@@ -126,14 +126,19 @@ sub do_lib_rule | |||
126 | 126 | ||
127 | sub do_link_rule | 127 | sub do_link_rule |
128 | { | 128 | { |
129 | local($target,$files,$dep_libs,$libs)=@_; | 129 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
130 | local($ret,$_); | 130 | local($ret,$_); |
131 | 131 | ||
132 | $file =~ s/\//$o/g if $o ne '/'; | 132 | $file =~ s/\//$o/g if $o ne '/'; |
133 | $n=&bname($targer); | 133 | $n=&bname($targer); |
134 | $ret.="$target: $files $dep_libs\n"; | 134 | $ret.="$target: $files $dep_libs\n"; |
135 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; | 135 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; |
136 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n\n"; | 136 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; |
137 | if (defined $sha1file) | ||
138 | { | ||
139 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
140 | } | ||
141 | $ret.="\n"; | ||
137 | return($ret); | 142 | return($ret); |
138 | } | 143 | } |
139 | 144 | ||
diff --git a/src/lib/libssl/src/util/pl/linux.pl b/src/lib/libssl/src/util/pl/linux.pl index 8924ed5480..df05c40526 100644 --- a/src/lib/libssl/src/util/pl/linux.pl +++ b/src/lib/libssl/src/util/pl/linux.pl | |||
@@ -72,13 +72,18 @@ sub do_shlib_rule | |||
72 | 72 | ||
73 | sub do_link_rule | 73 | sub do_link_rule |
74 | { | 74 | { |
75 | local($target,$files,$dep_libs,$libs)=@_; | 75 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
76 | local($ret,$_); | 76 | local($ret,$_); |
77 | 77 | ||
78 | $file =~ s/\//$o/g if $o ne '/'; | 78 | $file =~ s/\//$o/g if $o ne '/'; |
79 | $n=&bname($target); | 79 | $n=&bname($target); |
80 | $ret.="$target: $files $dep_libs\n"; | 80 | $ret.="$target: $files $dep_libs\n"; |
81 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | 81 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n"; |
82 | if (defined $sha1file) | ||
83 | { | ||
84 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
85 | } | ||
86 | $ret.="\n"; | ||
82 | return($ret); | 87 | return($ret); |
83 | } | 88 | } |
84 | 89 | ||
diff --git a/src/lib/libssl/src/util/pl/ultrix.pl b/src/lib/libssl/src/util/pl/ultrix.pl index ea370c71f9..447b854708 100644 --- a/src/lib/libssl/src/util/pl/ultrix.pl +++ b/src/lib/libssl/src/util/pl/ultrix.pl | |||
@@ -17,7 +17,7 @@ else | |||
17 | 17 | ||
18 | $cflags.=" -std1 -DL_ENDIAN"; | 18 | $cflags.=" -std1 -DL_ENDIAN"; |
19 | 19 | ||
20 | if (!$no_asm) | 20 | if (!$no_asm && !$fips) |
21 | { | 21 | { |
22 | $bn_asm_obj='$(OBJ_D)/mips1.o'; | 22 | $bn_asm_obj='$(OBJ_D)/mips1.o'; |
23 | $bn_asm_src='crypto/bn/asm/mips1.s'; | 23 | $bn_asm_src='crypto/bn/asm/mips1.s'; |
@@ -25,13 +25,18 @@ if (!$no_asm) | |||
25 | 25 | ||
26 | sub do_link_rule | 26 | sub do_link_rule |
27 | { | 27 | { |
28 | local($target,$files,$dep_libs,$libs)=@_; | 28 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
29 | local($ret,$_); | 29 | local($ret,$_); |
30 | 30 | ||
31 | $file =~ s/\//$o/g if $o ne '/'; | 31 | $file =~ s/\//$o/g if $o ne '/'; |
32 | $n=&bname($target); | 32 | $n=&bname($target); |
33 | $ret.="$target: $files $dep_libs\n"; | 33 | $ret.="$target: $files $dep_libs\n"; |
34 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | 34 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n"; |
35 | if (defined $sha1file) | ||
36 | { | ||
37 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
38 | } | ||
39 | $ret.="\n"; | ||
35 | return($ret); | 40 | return($ret); |
36 | } | 41 | } |
37 | 42 | ||
diff --git a/src/lib/libssl/src/util/pl/unix.pl b/src/lib/libssl/src/util/pl/unix.pl index 146611ad99..bbd1798a2e 100644 --- a/src/lib/libssl/src/util/pl/unix.pl +++ b/src/lib/libssl/src/util/pl/unix.pl | |||
@@ -70,13 +70,18 @@ sub do_lib_rule | |||
70 | 70 | ||
71 | sub do_link_rule | 71 | sub do_link_rule |
72 | { | 72 | { |
73 | local($target,$files,$dep_libs,$libs)=@_; | 73 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
74 | local($ret,$_); | 74 | local($ret,$_); |
75 | 75 | ||
76 | $file =~ s/\//$o/g if $o ne '/'; | 76 | $file =~ s/\//$o/g if $o ne '/'; |
77 | $n=&bname($target); | 77 | $n=&bname($target); |
78 | $ret.="$target: $files $dep_libs\n"; | 78 | $ret.="$target: $files $dep_libs\n"; |
79 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | 79 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n"; |
80 | if (defined $sha1file) | ||
81 | { | ||
82 | $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
83 | } | ||
84 | $ret.="\n"; | ||
80 | return($ret); | 85 | return($ret); |
81 | } | 86 | } |
82 | 87 | ||
diff --git a/src/lib/libssl/src/util/selftest.pl b/src/lib/libssl/src/util/selftest.pl index 276b81183d..e9d5aa8938 100644 --- a/src/lib/libssl/src/util/selftest.pl +++ b/src/lib/libssl/src/util/selftest.pl | |||
@@ -34,9 +34,9 @@ foreach $_ (split("\n",$c)) { | |||
34 | $platform0=$1 if (/Configuring for (.*)$/); | 34 | $platform0=$1 if (/Configuring for (.*)$/); |
35 | } | 35 | } |
36 | 36 | ||
37 | system "sh config" if (! -f "Makefile.ssl"); | 37 | system "sh config" if (! -f "Makefile"); |
38 | 38 | ||
39 | if (open(IN,"<Makefile.ssl")) { | 39 | if (open(IN,"<Makefile")) { |
40 | while (<IN>) { | 40 | while (<IN>) { |
41 | $version=$1 if (/^VERSION=(.*)$/); | 41 | $version=$1 if (/^VERSION=(.*)$/); |
42 | $platform=$1 if (/^PLATFORM=(.*)$/); | 42 | $platform=$1 if (/^PLATFORM=(.*)$/); |
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h index 913bd40eea..3161f532cf 100644 --- a/src/lib/libssl/ssl.h +++ b/src/lib/libssl/ssl.h | |||
@@ -239,6 +239,7 @@ extern "C" { | |||
239 | #define SSL_TXT_LOW "LOW" | 239 | #define SSL_TXT_LOW "LOW" |
240 | #define SSL_TXT_MEDIUM "MEDIUM" | 240 | #define SSL_TXT_MEDIUM "MEDIUM" |
241 | #define SSL_TXT_HIGH "HIGH" | 241 | #define SSL_TXT_HIGH "HIGH" |
242 | #define SSL_TXT_FIPS "FIPS" | ||
242 | #define SSL_TXT_kFZA "kFZA" | 243 | #define SSL_TXT_kFZA "kFZA" |
243 | #define SSL_TXT_aFZA "aFZA" | 244 | #define SSL_TXT_aFZA "aFZA" |
244 | #define SSL_TXT_eFZA "eFZA" | 245 | #define SSL_TXT_eFZA "eFZA" |
@@ -372,7 +373,7 @@ typedef struct ssl_method_st | |||
372 | long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg); | 373 | long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg); |
373 | SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); | 374 | SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); |
374 | int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr); | 375 | int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr); |
375 | int (*ssl_pending)(SSL *s); | 376 | int (*ssl_pending)(const SSL *s); |
376 | int (*num_ciphers)(void); | 377 | int (*num_ciphers)(void); |
377 | SSL_CIPHER *(*get_cipher)(unsigned ncipher); | 378 | SSL_CIPHER *(*get_cipher)(unsigned ncipher); |
378 | struct ssl_method_st *(*get_ssl_method)(int version); | 379 | struct ssl_method_st *(*get_ssl_method)(int version); |
@@ -998,8 +999,8 @@ extern "C" { | |||
998 | * -- that we sent (SSL_get_finished) | 999 | * -- that we sent (SSL_get_finished) |
999 | * -- that we expected from peer (SSL_get_peer_finished). | 1000 | * -- that we expected from peer (SSL_get_peer_finished). |
1000 | * Returns length (0 == no Finished so far), copies up to 'count' bytes. */ | 1001 | * Returns length (0 == no Finished so far), copies up to 'count' bytes. */ |
1001 | size_t SSL_get_finished(SSL *s, void *buf, size_t count); | 1002 | size_t SSL_get_finished(const SSL *s, void *buf, size_t count); |
1002 | size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count); | 1003 | size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); |
1003 | 1004 | ||
1004 | /* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options | 1005 | /* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options |
1005 | * are 'ored' with SSL_VERIFY_PEER if they are desired */ | 1006 | * are 'ored' with SSL_VERIFY_PEER if they are desired */ |
@@ -1171,26 +1172,26 @@ int SSL_CTX_set_cipher_list(SSL_CTX *,const char *str); | |||
1171 | SSL_CTX *SSL_CTX_new(SSL_METHOD *meth); | 1172 | SSL_CTX *SSL_CTX_new(SSL_METHOD *meth); |
1172 | void SSL_CTX_free(SSL_CTX *); | 1173 | void SSL_CTX_free(SSL_CTX *); |
1173 | long SSL_CTX_set_timeout(SSL_CTX *ctx,long t); | 1174 | long SSL_CTX_set_timeout(SSL_CTX *ctx,long t); |
1174 | long SSL_CTX_get_timeout(SSL_CTX *ctx); | 1175 | long SSL_CTX_get_timeout(const SSL_CTX *ctx); |
1175 | X509_STORE *SSL_CTX_get_cert_store(SSL_CTX *); | 1176 | X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); |
1176 | void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *); | 1177 | void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *); |
1177 | int SSL_want(SSL *s); | 1178 | int SSL_want(const SSL *s); |
1178 | int SSL_clear(SSL *s); | 1179 | int SSL_clear(SSL *s); |
1179 | 1180 | ||
1180 | void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm); | 1181 | void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm); |
1181 | 1182 | ||
1182 | SSL_CIPHER *SSL_get_current_cipher(SSL *s); | 1183 | SSL_CIPHER *SSL_get_current_cipher(const SSL *s); |
1183 | int SSL_CIPHER_get_bits(SSL_CIPHER *c,int *alg_bits); | 1184 | int SSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits); |
1184 | char * SSL_CIPHER_get_version(SSL_CIPHER *c); | 1185 | char * SSL_CIPHER_get_version(const SSL_CIPHER *c); |
1185 | const char * SSL_CIPHER_get_name(SSL_CIPHER *c); | 1186 | const char * SSL_CIPHER_get_name(const SSL_CIPHER *c); |
1186 | 1187 | ||
1187 | int SSL_get_fd(SSL *s); | 1188 | int SSL_get_fd(const SSL *s); |
1188 | int SSL_get_rfd(SSL *s); | 1189 | int SSL_get_rfd(const SSL *s); |
1189 | int SSL_get_wfd(SSL *s); | 1190 | int SSL_get_wfd(const SSL *s); |
1190 | const char * SSL_get_cipher_list(SSL *s,int n); | 1191 | const char * SSL_get_cipher_list(const SSL *s,int n); |
1191 | char * SSL_get_shared_ciphers(SSL *s, char *buf, int len); | 1192 | char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len); |
1192 | int SSL_get_read_ahead(SSL * s); | 1193 | int SSL_get_read_ahead(const SSL * s); |
1193 | int SSL_pending(SSL *s); | 1194 | int SSL_pending(const SSL *s); |
1194 | #ifndef OPENSSL_NO_SOCK | 1195 | #ifndef OPENSSL_NO_SOCK |
1195 | int SSL_set_fd(SSL *s, int fd); | 1196 | int SSL_set_fd(SSL *s, int fd); |
1196 | int SSL_set_rfd(SSL *s, int fd); | 1197 | int SSL_set_rfd(SSL *s, int fd); |
@@ -1198,14 +1199,14 @@ int SSL_set_wfd(SSL *s, int fd); | |||
1198 | #endif | 1199 | #endif |
1199 | #ifndef OPENSSL_NO_BIO | 1200 | #ifndef OPENSSL_NO_BIO |
1200 | void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio); | 1201 | void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio); |
1201 | BIO * SSL_get_rbio(SSL *s); | 1202 | BIO * SSL_get_rbio(const SSL *s); |
1202 | BIO * SSL_get_wbio(SSL *s); | 1203 | BIO * SSL_get_wbio(const SSL *s); |
1203 | #endif | 1204 | #endif |
1204 | int SSL_set_cipher_list(SSL *s, const char *str); | 1205 | int SSL_set_cipher_list(SSL *s, const char *str); |
1205 | void SSL_set_read_ahead(SSL *s, int yes); | 1206 | void SSL_set_read_ahead(SSL *s, int yes); |
1206 | int SSL_get_verify_mode(SSL *s); | 1207 | int SSL_get_verify_mode(const SSL *s); |
1207 | int SSL_get_verify_depth(SSL *s); | 1208 | int SSL_get_verify_depth(const SSL *s); |
1208 | int (*SSL_get_verify_callback(SSL *s))(int,X509_STORE_CTX *); | 1209 | int (*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *); |
1209 | void SSL_set_verify(SSL *s, int mode, | 1210 | void SSL_set_verify(SSL *s, int mode, |
1210 | int (*callback)(int ok,X509_STORE_CTX *ctx)); | 1211 | int (*callback)(int ok,X509_STORE_CTX *ctx)); |
1211 | void SSL_set_verify_depth(SSL *s, int depth); | 1212 | void SSL_set_verify_depth(SSL *s, int depth); |
@@ -1243,20 +1244,20 @@ const char *SSL_state_string(const SSL *s); | |||
1243 | const char *SSL_rstate_string(const SSL *s); | 1244 | const char *SSL_rstate_string(const SSL *s); |
1244 | const char *SSL_state_string_long(const SSL *s); | 1245 | const char *SSL_state_string_long(const SSL *s); |
1245 | const char *SSL_rstate_string_long(const SSL *s); | 1246 | const char *SSL_rstate_string_long(const SSL *s); |
1246 | long SSL_SESSION_get_time(SSL_SESSION *s); | 1247 | long SSL_SESSION_get_time(const SSL_SESSION *s); |
1247 | long SSL_SESSION_set_time(SSL_SESSION *s, long t); | 1248 | long SSL_SESSION_set_time(SSL_SESSION *s, long t); |
1248 | long SSL_SESSION_get_timeout(SSL_SESSION *s); | 1249 | long SSL_SESSION_get_timeout(const SSL_SESSION *s); |
1249 | long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); | 1250 | long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); |
1250 | void SSL_copy_session_id(SSL *to,SSL *from); | 1251 | void SSL_copy_session_id(SSL *to,const SSL *from); |
1251 | 1252 | ||
1252 | SSL_SESSION *SSL_SESSION_new(void); | 1253 | SSL_SESSION *SSL_SESSION_new(void); |
1253 | unsigned long SSL_SESSION_hash(SSL_SESSION *a); | 1254 | unsigned long SSL_SESSION_hash(const SSL_SESSION *a); |
1254 | int SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b); | 1255 | int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b); |
1255 | #ifndef OPENSSL_NO_FP_API | 1256 | #ifndef OPENSSL_NO_FP_API |
1256 | int SSL_SESSION_print_fp(FILE *fp,SSL_SESSION *ses); | 1257 | int SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses); |
1257 | #endif | 1258 | #endif |
1258 | #ifndef OPENSSL_NO_BIO | 1259 | #ifndef OPENSSL_NO_BIO |
1259 | int SSL_SESSION_print(BIO *fp,SSL_SESSION *ses); | 1260 | int SSL_SESSION_print(BIO *fp,const SSL_SESSION *ses); |
1260 | #endif | 1261 | #endif |
1261 | void SSL_SESSION_free(SSL_SESSION *ses); | 1262 | void SSL_SESSION_free(SSL_SESSION *ses); |
1262 | int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp); | 1263 | int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp); |
@@ -1267,17 +1268,18 @@ int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB); | |||
1267 | int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); | 1268 | int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); |
1268 | int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, | 1269 | int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, |
1269 | unsigned int id_len); | 1270 | unsigned int id_len); |
1270 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,unsigned char **pp,long length); | 1271 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char * const *pp, |
1272 | long length); | ||
1271 | 1273 | ||
1272 | #ifdef HEADER_X509_H | 1274 | #ifdef HEADER_X509_H |
1273 | X509 * SSL_get_peer_certificate(SSL *s); | 1275 | X509 * SSL_get_peer_certificate(const SSL *s); |
1274 | #endif | 1276 | #endif |
1275 | 1277 | ||
1276 | STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s); | 1278 | STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); |
1277 | 1279 | ||
1278 | int SSL_CTX_get_verify_mode(SSL_CTX *ctx); | 1280 | int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); |
1279 | int SSL_CTX_get_verify_depth(SSL_CTX *ctx); | 1281 | int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); |
1280 | int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *); | 1282 | int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *); |
1281 | void SSL_CTX_set_verify(SSL_CTX *ctx,int mode, | 1283 | void SSL_CTX_set_verify(SSL_CTX *ctx,int mode, |
1282 | int (*callback)(int, X509_STORE_CTX *)); | 1284 | int (*callback)(int, X509_STORE_CTX *)); |
1283 | void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); | 1285 | void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); |
@@ -1295,8 +1297,8 @@ int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d); | |||
1295 | void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); | 1297 | void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); |
1296 | void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); | 1298 | void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); |
1297 | 1299 | ||
1298 | int SSL_CTX_check_private_key(SSL_CTX *ctx); | 1300 | int SSL_CTX_check_private_key(const SSL_CTX *ctx); |
1299 | int SSL_check_private_key(SSL *ctx); | 1301 | int SSL_check_private_key(const SSL *ctx); |
1300 | 1302 | ||
1301 | int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx, | 1303 | int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx, |
1302 | unsigned int sid_ctx_len); | 1304 | unsigned int sid_ctx_len); |
@@ -1321,8 +1323,8 @@ long SSL_callback_ctrl(SSL *, int, void (*)()); | |||
1321 | long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg); | 1323 | long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg); |
1322 | long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)()); | 1324 | long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)()); |
1323 | 1325 | ||
1324 | int SSL_get_error(SSL *s,int ret_code); | 1326 | int SSL_get_error(const SSL *s,int ret_code); |
1325 | const char *SSL_get_version(SSL *s); | 1327 | const char *SSL_get_version(const SSL *s); |
1326 | 1328 | ||
1327 | /* This sets the 'default' SSL version that SSL_new() will create */ | 1329 | /* This sets the 'default' SSL version that SSL_new() will create */ |
1328 | int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth); | 1330 | int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth); |
@@ -1343,7 +1345,7 @@ SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */ | |||
1343 | SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */ | 1345 | SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */ |
1344 | SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */ | 1346 | SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */ |
1345 | 1347 | ||
1346 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s); | 1348 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); |
1347 | 1349 | ||
1348 | int SSL_do_handshake(SSL *s); | 1350 | int SSL_do_handshake(SSL *s); |
1349 | int SSL_renegotiate(SSL *s); | 1351 | int SSL_renegotiate(SSL *s); |
@@ -1359,15 +1361,15 @@ const char *SSL_alert_desc_string(int value); | |||
1359 | 1361 | ||
1360 | void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); | 1362 | void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); |
1361 | void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); | 1363 | void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); |
1362 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(SSL *s); | 1364 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); |
1363 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(SSL_CTX *s); | 1365 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); |
1364 | int SSL_add_client_CA(SSL *ssl,X509 *x); | 1366 | int SSL_add_client_CA(SSL *ssl,X509 *x); |
1365 | int SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x); | 1367 | int SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x); |
1366 | 1368 | ||
1367 | void SSL_set_connect_state(SSL *s); | 1369 | void SSL_set_connect_state(SSL *s); |
1368 | void SSL_set_accept_state(SSL *s); | 1370 | void SSL_set_accept_state(SSL *s); |
1369 | 1371 | ||
1370 | long SSL_get_default_timeout(SSL *s); | 1372 | long SSL_get_default_timeout(const SSL *s); |
1371 | 1373 | ||
1372 | int SSL_library_init(void ); | 1374 | int SSL_library_init(void ); |
1373 | 1375 | ||
@@ -1376,43 +1378,43 @@ STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk); | |||
1376 | 1378 | ||
1377 | SSL *SSL_dup(SSL *ssl); | 1379 | SSL *SSL_dup(SSL *ssl); |
1378 | 1380 | ||
1379 | X509 *SSL_get_certificate(SSL *ssl); | 1381 | X509 *SSL_get_certificate(const SSL *ssl); |
1380 | /* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl); | 1382 | /* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl); |
1381 | 1383 | ||
1382 | void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode); | 1384 | void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode); |
1383 | int SSL_CTX_get_quiet_shutdown(SSL_CTX *ctx); | 1385 | int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); |
1384 | void SSL_set_quiet_shutdown(SSL *ssl,int mode); | 1386 | void SSL_set_quiet_shutdown(SSL *ssl,int mode); |
1385 | int SSL_get_quiet_shutdown(SSL *ssl); | 1387 | int SSL_get_quiet_shutdown(const SSL *ssl); |
1386 | void SSL_set_shutdown(SSL *ssl,int mode); | 1388 | void SSL_set_shutdown(SSL *ssl,int mode); |
1387 | int SSL_get_shutdown(SSL *ssl); | 1389 | int SSL_get_shutdown(const SSL *ssl); |
1388 | int SSL_version(SSL *ssl); | 1390 | int SSL_version(const SSL *ssl); |
1389 | int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); | 1391 | int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); |
1390 | int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, | 1392 | int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, |
1391 | const char *CApath); | 1393 | const char *CApath); |
1392 | #define SSL_get0_session SSL_get_session /* just peek at pointer */ | 1394 | #define SSL_get0_session SSL_get_session /* just peek at pointer */ |
1393 | SSL_SESSION *SSL_get_session(SSL *ssl); | 1395 | SSL_SESSION *SSL_get_session(const SSL *ssl); |
1394 | SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ | 1396 | SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ |
1395 | SSL_CTX *SSL_get_SSL_CTX(SSL *ssl); | 1397 | SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); |
1396 | void SSL_set_info_callback(SSL *ssl, | 1398 | void SSL_set_info_callback(SSL *ssl, |
1397 | void (*cb)(const SSL *ssl,int type,int val)); | 1399 | void (*cb)(const SSL *ssl,int type,int val)); |
1398 | void (*SSL_get_info_callback(SSL *ssl))(const SSL *ssl,int type,int val); | 1400 | void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val); |
1399 | int SSL_state(SSL *ssl); | 1401 | int SSL_state(const SSL *ssl); |
1400 | 1402 | ||
1401 | void SSL_set_verify_result(SSL *ssl,long v); | 1403 | void SSL_set_verify_result(SSL *ssl,long v); |
1402 | long SSL_get_verify_result(SSL *ssl); | 1404 | long SSL_get_verify_result(const SSL *ssl); |
1403 | 1405 | ||
1404 | int SSL_set_ex_data(SSL *ssl,int idx,void *data); | 1406 | int SSL_set_ex_data(SSL *ssl,int idx,void *data); |
1405 | void *SSL_get_ex_data(SSL *ssl,int idx); | 1407 | void *SSL_get_ex_data(const SSL *ssl,int idx); |
1406 | int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 1408 | int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
1407 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | 1409 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); |
1408 | 1410 | ||
1409 | int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data); | 1411 | int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data); |
1410 | void *SSL_SESSION_get_ex_data(SSL_SESSION *ss,int idx); | 1412 | void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss,int idx); |
1411 | int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 1413 | int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
1412 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | 1414 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); |
1413 | 1415 | ||
1414 | int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data); | 1416 | int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data); |
1415 | void *SSL_CTX_get_ex_data(SSL_CTX *ssl,int idx); | 1417 | void *SSL_CTX_get_ex_data(const SSL_CTX *ssl,int idx); |
1416 | int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 1418 | int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
1417 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | 1419 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); |
1418 | 1420 | ||
@@ -1603,6 +1605,7 @@ void ERR_load_SSL_strings(void); | |||
1603 | #define SSL_F_SSL_SET_TRUST 228 | 1605 | #define SSL_F_SSL_SET_TRUST 228 |
1604 | #define SSL_F_SSL_SET_WFD 196 | 1606 | #define SSL_F_SSL_SET_WFD 196 |
1605 | #define SSL_F_SSL_SHUTDOWN 224 | 1607 | #define SSL_F_SSL_SHUTDOWN 224 |
1608 | #define SSL_F_SSL_UNDEFINED_CONST_FUNCTION 243 | ||
1606 | #define SSL_F_SSL_UNDEFINED_FUNCTION 197 | 1609 | #define SSL_F_SSL_UNDEFINED_FUNCTION 197 |
1607 | #define SSL_F_SSL_USE_CERTIFICATE 198 | 1610 | #define SSL_F_SSL_USE_CERTIFICATE 198 |
1608 | #define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 | 1611 | #define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 |
@@ -1741,6 +1744,7 @@ void ERR_load_SSL_strings(void); | |||
1741 | #define SSL_R_NULL_SSL_CTX 195 | 1744 | #define SSL_R_NULL_SSL_CTX 195 |
1742 | #define SSL_R_NULL_SSL_METHOD_PASSED 196 | 1745 | #define SSL_R_NULL_SSL_METHOD_PASSED 196 |
1743 | #define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 | 1746 | #define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 |
1747 | #define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE 1115 | ||
1744 | #define SSL_R_PACKET_LENGTH_TOO_LONG 198 | 1748 | #define SSL_R_PACKET_LENGTH_TOO_LONG 198 |
1745 | #define SSL_R_PATH_TOO_LONG 270 | 1749 | #define SSL_R_PATH_TOO_LONG 270 |
1746 | #define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 | 1750 | #define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 |
diff --git a/src/lib/libssl/ssl_asn1.c b/src/lib/libssl/ssl_asn1.c index d8ff8fc4a3..4d5900ad2f 100644 --- a/src/lib/libssl/ssl_asn1.c +++ b/src/lib/libssl/ssl_asn1.c | |||
@@ -226,7 +226,7 @@ int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) | |||
226 | M_ASN1_I2D_finish(); | 226 | M_ASN1_I2D_finish(); |
227 | } | 227 | } |
228 | 228 | ||
229 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, | 229 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char * const *pp, |
230 | long length) | 230 | long length) |
231 | { | 231 | { |
232 | int version,ssl_version=0,i; | 232 | int version,ssl_version=0,i; |
@@ -266,7 +266,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, | |||
266 | ((unsigned long)os.data[1]<< 8L)| | 266 | ((unsigned long)os.data[1]<< 8L)| |
267 | (unsigned long)os.data[2]; | 267 | (unsigned long)os.data[2]; |
268 | } | 268 | } |
269 | else if ((ssl_version>>8) == 3) | 269 | else if ((ssl_version>>8) == SSL3_VERSION_MAJOR) |
270 | { | 270 | { |
271 | if (os.length != 2) | 271 | if (os.length != 2) |
272 | { | 272 | { |
@@ -287,9 +287,9 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, | |||
287 | ret->cipher_id=id; | 287 | ret->cipher_id=id; |
288 | 288 | ||
289 | M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING); | 289 | M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING); |
290 | if ((ssl_version>>8) == SSL3_VERSION) | 290 | if ((ssl_version>>8) == SSL3_VERSION_MAJOR) |
291 | i=SSL3_MAX_SSL_SESSION_ID_LENGTH; | 291 | i=SSL3_MAX_SSL_SESSION_ID_LENGTH; |
292 | else /* if (ssl_version == SSL2_VERSION) */ | 292 | else /* if (ssl_version == SSL2_VERSION_MAJOR) */ |
293 | i=SSL2_MAX_SSL_SESSION_ID_LENGTH; | 293 | i=SSL2_MAX_SSL_SESSION_ID_LENGTH; |
294 | 294 | ||
295 | if (os.length > i) | 295 | if (os.length > i) |
diff --git a/src/lib/libssl/ssl_cert.c b/src/lib/libssl/ssl_cert.c index 2cfb615878..b8b9bc2390 100644 --- a/src/lib/libssl/ssl_cert.c +++ b/src/lib/libssl/ssl_cert.c | |||
@@ -117,6 +117,7 @@ | |||
117 | 117 | ||
118 | #if defined(WIN32) | 118 | #if defined(WIN32) |
119 | #include <windows.h> | 119 | #include <windows.h> |
120 | #include <tchar.h> | ||
120 | #endif | 121 | #endif |
121 | 122 | ||
122 | #ifdef NeXT | 123 | #ifdef NeXT |
@@ -129,6 +130,7 @@ | |||
129 | #include <openssl/pem.h> | 130 | #include <openssl/pem.h> |
130 | #include <openssl/x509v3.h> | 131 | #include <openssl/x509v3.h> |
131 | #include "ssl_locl.h" | 132 | #include "ssl_locl.h" |
133 | #include <openssl/fips.h> | ||
132 | 134 | ||
133 | int SSL_get_ex_data_X509_STORE_CTX_idx(void) | 135 | int SSL_get_ex_data_X509_STORE_CTX_idx(void) |
134 | { | 136 | { |
@@ -542,12 +544,12 @@ void SSL_CTX_set_client_CA_list(SSL_CTX *ctx,STACK_OF(X509_NAME) *name_list) | |||
542 | set_client_CA_list(&(ctx->client_CA),name_list); | 544 | set_client_CA_list(&(ctx->client_CA),name_list); |
543 | } | 545 | } |
544 | 546 | ||
545 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(SSL_CTX *ctx) | 547 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *ctx) |
546 | { | 548 | { |
547 | return(ctx->client_CA); | 549 | return(ctx->client_CA); |
548 | } | 550 | } |
549 | 551 | ||
550 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(SSL *s) | 552 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s) |
551 | { | 553 | { |
552 | if (s->type == SSL_ST_CONNECT) | 554 | if (s->type == SSL_ST_CONNECT) |
553 | { /* we are in the client */ | 555 | { /* we are in the client */ |
@@ -783,36 +785,54 @@ err: | |||
783 | 785 | ||
784 | #else /* OPENSSL_SYS_WIN32 */ | 786 | #else /* OPENSSL_SYS_WIN32 */ |
785 | 787 | ||
788 | #if defined(_WIN32_WCE) | ||
789 | # ifndef UNICODE | ||
790 | # error "WinCE comes in UNICODE flavor only..." | ||
791 | # endif | ||
792 | # if _WIN32_WCE<101 && !defined(OPENSSL_NO_MULTIBYTE) | ||
793 | # define OPENSSL_NO_MULTIBYTE | ||
794 | # endif | ||
795 | # ifndef FindFirstFile | ||
796 | # define FindFirstFile FindFirstFileW | ||
797 | # endif | ||
798 | # ifndef FindNextFile | ||
799 | # define FindNextFile FindNextFileW | ||
800 | # endif | ||
801 | #endif | ||
802 | |||
786 | int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, | 803 | int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, |
787 | const char *dir) | 804 | const char *dir) |
788 | { | 805 | { |
789 | WIN32_FIND_DATA FindFileData; | 806 | WIN32_FIND_DATA FindFileData; |
790 | HANDLE hFind; | 807 | HANDLE hFind; |
791 | int ret = 0; | 808 | int ret = 0; |
792 | #ifdef OPENSSL_SYS_WINCE | 809 | TCHAR *wdir = NULL; |
793 | WCHAR* wdir = NULL; | 810 | size_t i,len_0 = strlen(dir)+1; /* len_0 accounts for trailing 0 */ |
794 | #endif | 811 | char buf[1024],*slash; |
812 | |||
813 | if (len_0 > (sizeof(buf)-14)) /* 14 is just some value... */ | ||
814 | { | ||
815 | SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); | ||
816 | return ret; | ||
817 | } | ||
795 | 818 | ||
796 | CRYPTO_w_lock(CRYPTO_LOCK_READDIR); | 819 | CRYPTO_w_lock(CRYPTO_LOCK_READDIR); |
797 | 820 | ||
798 | #ifdef OPENSSL_SYS_WINCE | 821 | if (sizeof(TCHAR) != sizeof(char)) |
799 | /* convert strings to UNICODE */ | 822 | { |
800 | { | 823 | wdir = (TCHAR *)malloc(len_0*sizeof(TCHAR)); |
801 | BOOL result = FALSE; | ||
802 | int i; | ||
803 | wdir = malloc((strlen(dir)+1)*2); | ||
804 | if (wdir == NULL) | 824 | if (wdir == NULL) |
805 | goto err_noclose; | 825 | goto err_noclose; |
806 | for (i=0; i<(int)strlen(dir)+1; i++) | 826 | #ifndef OPENSSL_NO_MULTIBYTE |
807 | wdir[i] = (short)dir[i]; | 827 | if (!MultiByteToWideChar(CP_ACP,0,dir,len_0, |
808 | } | 828 | (WCHAR *)wdir,len_0)) |
809 | #endif | 829 | #endif |
830 | for (i=0;i<len_0;i++) wdir[i]=(TCHAR)dir[i]; | ||
831 | |||
832 | hFind = FindFirstFile(wdir, &FindFileData); | ||
833 | } | ||
834 | else hFind = FindFirstFile((const TCHAR *)dir, &FindFileData); | ||
810 | 835 | ||
811 | #ifdef OPENSSL_SYS_WINCE | ||
812 | hFind = FindFirstFile(wdir, &FindFileData); | ||
813 | #else | ||
814 | hFind = FindFirstFile(dir, &FindFileData); | ||
815 | #endif | ||
816 | /* Note that a side effect is that the CAs will be sorted by name */ | 836 | /* Note that a side effect is that the CAs will be sorted by name */ |
817 | if(hFind == INVALID_HANDLE_VALUE) | 837 | if(hFind == INVALID_HANDLE_VALUE) |
818 | { | 838 | { |
@@ -821,25 +841,34 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, | |||
821 | SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); | 841 | SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); |
822 | goto err_noclose; | 842 | goto err_noclose; |
823 | } | 843 | } |
824 | 844 | ||
825 | do | 845 | strncpy(buf,dir,sizeof(buf)); /* strcpy is safe too... */ |
826 | { | 846 | buf[len_0-1]='/'; /* no trailing zero! */ |
827 | char buf[1024]; | 847 | slash=buf+len_0; |
828 | int r; | 848 | |
829 | 849 | do { | |
830 | #ifdef OPENSSL_SYS_WINCE | 850 | const TCHAR *fnam=FindFileData.cFileName; |
831 | if(strlen(dir)+_tcslen(FindFileData.cFileName)+2 > sizeof buf) | 851 | size_t flen_0=_tcslen(fnam)+1; |
832 | #else | 852 | |
833 | if(strlen(dir)+strlen(FindFileData.cFileName)+2 > sizeof buf) | 853 | if (flen_0 > (sizeof(buf)-len_0)) |
834 | #endif | ||
835 | { | 854 | { |
836 | SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); | 855 | SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); |
837 | goto err; | 856 | goto err; |
838 | } | 857 | } |
839 | 858 | /* else strcpy would be safe too... */ | |
840 | r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,FindFileData.cFileName); | 859 | |
841 | if (r <= 0 || r >= sizeof buf) | 860 | if (sizeof(TCHAR) != sizeof(char)) |
842 | goto err; | 861 | { |
862 | #ifndef OPENSSL_NO_MULTIBYTE | ||
863 | if (!WideCharToMultiByte(CP_ACP,0, | ||
864 | (WCHAR *)fnam,flen_0, | ||
865 | slash,sizeof(buf)-len_0, | ||
866 | NULL,0)) | ||
867 | #endif | ||
868 | for (i=0;i<flen_0;i++) slash[i]=(char)fnam[i]; | ||
869 | } | ||
870 | else strncpy(slash,(const char *)fnam,sizeof(buf)-len_0); | ||
871 | |||
843 | if(!SSL_add_file_cert_subjects_to_stack(stack,buf)) | 872 | if(!SSL_add_file_cert_subjects_to_stack(stack,buf)) |
844 | goto err; | 873 | goto err; |
845 | } | 874 | } |
@@ -849,10 +878,9 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, | |||
849 | err: | 878 | err: |
850 | FindClose(hFind); | 879 | FindClose(hFind); |
851 | err_noclose: | 880 | err_noclose: |
852 | #ifdef OPENSSL_SYS_WINCE | ||
853 | if (wdir != NULL) | 881 | if (wdir != NULL) |
854 | free(wdir); | 882 | free(wdir); |
855 | #endif | 883 | |
856 | CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); | 884 | CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); |
857 | return ret; | 885 | return ret; |
858 | } | 886 | } |
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c index 2d6eab20c3..a7ccefa30c 100644 --- a/src/lib/libssl/ssl_ciph.c +++ b/src/lib/libssl/ssl_ciph.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <openssl/objects.h> | 60 | #include <openssl/objects.h> |
61 | #include <openssl/comp.h> | 61 | #include <openssl/comp.h> |
62 | #include <openssl/fips.h> | ||
62 | #include "ssl_locl.h" | 63 | #include "ssl_locl.h" |
63 | 64 | ||
64 | #define SSL_ENC_DES_IDX 0 | 65 | #define SSL_ENC_DES_IDX 0 |
@@ -153,13 +154,13 @@ static const SSL_CIPHER cipher_aliases[]={ | |||
153 | {0,SSL_TXT_LOW, 0, 0, SSL_LOW, 0,0,0,0,SSL_STRONG_MASK}, | 154 | {0,SSL_TXT_LOW, 0, 0, SSL_LOW, 0,0,0,0,SSL_STRONG_MASK}, |
154 | {0,SSL_TXT_MEDIUM,0, 0,SSL_MEDIUM, 0,0,0,0,SSL_STRONG_MASK}, | 155 | {0,SSL_TXT_MEDIUM,0, 0,SSL_MEDIUM, 0,0,0,0,SSL_STRONG_MASK}, |
155 | {0,SSL_TXT_HIGH, 0, 0, SSL_HIGH, 0,0,0,0,SSL_STRONG_MASK}, | 156 | {0,SSL_TXT_HIGH, 0, 0, SSL_HIGH, 0,0,0,0,SSL_STRONG_MASK}, |
157 | {0,SSL_TXT_FIPS, 0, 0, SSL_FIPS, 0,0,0,0,SSL_FIPS|SSL_STRONG_NONE}, | ||
156 | }; | 158 | }; |
157 | 159 | ||
158 | static int init_ciphers=1; | 160 | static int init_ciphers=1; |
159 | 161 | ||
160 | static void load_ciphers(void) | 162 | static void load_ciphers(void) |
161 | { | 163 | { |
162 | init_ciphers=0; | ||
163 | ssl_cipher_methods[SSL_ENC_DES_IDX]= | 164 | ssl_cipher_methods[SSL_ENC_DES_IDX]= |
164 | EVP_get_cipherbyname(SN_des_cbc); | 165 | EVP_get_cipherbyname(SN_des_cbc); |
165 | ssl_cipher_methods[SSL_ENC_3DES_IDX]= | 166 | ssl_cipher_methods[SSL_ENC_3DES_IDX]= |
@@ -183,9 +184,10 @@ static void load_ciphers(void) | |||
183 | EVP_get_digestbyname(SN_md5); | 184 | EVP_get_digestbyname(SN_md5); |
184 | ssl_digest_methods[SSL_MD_SHA1_IDX]= | 185 | ssl_digest_methods[SSL_MD_SHA1_IDX]= |
185 | EVP_get_digestbyname(SN_sha1); | 186 | EVP_get_digestbyname(SN_sha1); |
187 | init_ciphers=0; | ||
186 | } | 188 | } |
187 | 189 | ||
188 | int ssl_cipher_get_evp(SSL_SESSION *s, const EVP_CIPHER **enc, | 190 | int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc, |
189 | const EVP_MD **md, SSL_COMP **comp) | 191 | const EVP_MD **md, SSL_COMP **comp) |
190 | { | 192 | { |
191 | int i; | 193 | int i; |
@@ -359,7 +361,12 @@ static void ssl_cipher_collect_ciphers(const SSL_METHOD *ssl_method, | |||
359 | { | 361 | { |
360 | c = ssl_method->get_cipher(i); | 362 | c = ssl_method->get_cipher(i); |
361 | /* drop those that use any of that is not available */ | 363 | /* drop those that use any of that is not available */ |
364 | #ifdef OPENSSL_FIPS | ||
365 | if ((c != NULL) && c->valid && !(c->algorithms & mask) | ||
366 | && (!FIPS_mode() || (c->algo_strength & SSL_FIPS))) | ||
367 | #else | ||
362 | if ((c != NULL) && c->valid && !(c->algorithms & mask)) | 368 | if ((c != NULL) && c->valid && !(c->algorithms & mask)) |
369 | #endif | ||
363 | { | 370 | { |
364 | co_list[co_list_num].cipher = c; | 371 | co_list[co_list_num].cipher = c; |
365 | co_list[co_list_num].next = NULL; | 372 | co_list[co_list_num].next = NULL; |
@@ -854,7 +861,11 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, | |||
854 | */ | 861 | */ |
855 | for (curr = head; curr != NULL; curr = curr->next) | 862 | for (curr = head; curr != NULL; curr = curr->next) |
856 | { | 863 | { |
864 | #ifdef OPENSSL_FIPS | ||
865 | if (curr->active && (!FIPS_mode() || curr->cipher->algo_strength & SSL_FIPS)) | ||
866 | #else | ||
857 | if (curr->active) | 867 | if (curr->active) |
868 | #endif | ||
858 | { | 869 | { |
859 | sk_SSL_CIPHER_push(cipherstack, curr->cipher); | 870 | sk_SSL_CIPHER_push(cipherstack, curr->cipher); |
860 | #ifdef CIPHER_DEBUG | 871 | #ifdef CIPHER_DEBUG |
@@ -1054,7 +1065,7 @@ char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int len) | |||
1054 | return(buf); | 1065 | return(buf); |
1055 | } | 1066 | } |
1056 | 1067 | ||
1057 | char *SSL_CIPHER_get_version(SSL_CIPHER *c) | 1068 | char *SSL_CIPHER_get_version(const SSL_CIPHER *c) |
1058 | { | 1069 | { |
1059 | int i; | 1070 | int i; |
1060 | 1071 | ||
@@ -1069,7 +1080,7 @@ char *SSL_CIPHER_get_version(SSL_CIPHER *c) | |||
1069 | } | 1080 | } |
1070 | 1081 | ||
1071 | /* return the actual cipher being used */ | 1082 | /* return the actual cipher being used */ |
1072 | const char *SSL_CIPHER_get_name(SSL_CIPHER *c) | 1083 | const char *SSL_CIPHER_get_name(const SSL_CIPHER *c) |
1073 | { | 1084 | { |
1074 | if (c != NULL) | 1085 | if (c != NULL) |
1075 | return(c->name); | 1086 | return(c->name); |
@@ -1077,7 +1088,7 @@ const char *SSL_CIPHER_get_name(SSL_CIPHER *c) | |||
1077 | } | 1088 | } |
1078 | 1089 | ||
1079 | /* number of bits for symmetric cipher */ | 1090 | /* number of bits for symmetric cipher */ |
1080 | int SSL_CIPHER_get_bits(SSL_CIPHER *c, int *alg_bits) | 1091 | int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits) |
1081 | { | 1092 | { |
1082 | int ret=0; | 1093 | int ret=0; |
1083 | 1094 | ||
diff --git a/src/lib/libssl/ssl_err.c b/src/lib/libssl/ssl_err.c index d2cb181503..29b8ff4788 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-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2005 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 |
@@ -193,6 +193,7 @@ static ERR_STRING_DATA SSL_str_functs[]= | |||
193 | {ERR_PACK(0,SSL_F_SSL_SET_TRUST,0), "SSL_set_trust"}, | 193 | {ERR_PACK(0,SSL_F_SSL_SET_TRUST,0), "SSL_set_trust"}, |
194 | {ERR_PACK(0,SSL_F_SSL_SET_WFD,0), "SSL_set_wfd"}, | 194 | {ERR_PACK(0,SSL_F_SSL_SET_WFD,0), "SSL_set_wfd"}, |
195 | {ERR_PACK(0,SSL_F_SSL_SHUTDOWN,0), "SSL_shutdown"}, | 195 | {ERR_PACK(0,SSL_F_SSL_SHUTDOWN,0), "SSL_shutdown"}, |
196 | {ERR_PACK(0,SSL_F_SSL_UNDEFINED_CONST_FUNCTION,0), "SSL_UNDEFINED_CONST_FUNCTION"}, | ||
196 | {ERR_PACK(0,SSL_F_SSL_UNDEFINED_FUNCTION,0), "SSL_UNDEFINED_FUNCTION"}, | 197 | {ERR_PACK(0,SSL_F_SSL_UNDEFINED_FUNCTION,0), "SSL_UNDEFINED_FUNCTION"}, |
197 | {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE,0), "SSL_use_certificate"}, | 198 | {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE,0), "SSL_use_certificate"}, |
198 | {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE_ASN1,0), "SSL_use_certificate_ASN1"}, | 199 | {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE_ASN1,0), "SSL_use_certificate_ASN1"}, |
@@ -334,6 +335,7 @@ static ERR_STRING_DATA SSL_str_reasons[]= | |||
334 | {SSL_R_NULL_SSL_CTX ,"null ssl ctx"}, | 335 | {SSL_R_NULL_SSL_CTX ,"null ssl ctx"}, |
335 | {SSL_R_NULL_SSL_METHOD_PASSED ,"null ssl method passed"}, | 336 | {SSL_R_NULL_SSL_METHOD_PASSED ,"null ssl method passed"}, |
336 | {SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED ,"old session cipher not returned"}, | 337 | {SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED ,"old session cipher not returned"}, |
338 | {SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE ,"only tls allowed in fips mode"}, | ||
337 | {SSL_R_PACKET_LENGTH_TOO_LONG ,"packet length too long"}, | 339 | {SSL_R_PACKET_LENGTH_TOO_LONG ,"packet length too long"}, |
338 | {SSL_R_PATH_TOO_LONG ,"path too long"}, | 340 | {SSL_R_PATH_TOO_LONG ,"path too long"}, |
339 | {SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE ,"peer did not return a certificate"}, | 341 | {SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE ,"peer did not return a certificate"}, |
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index ee9a82d586..631229558f 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -121,6 +121,7 @@ | |||
121 | #include <openssl/objects.h> | 121 | #include <openssl/objects.h> |
122 | #include <openssl/lhash.h> | 122 | #include <openssl/lhash.h> |
123 | #include <openssl/x509v3.h> | 123 | #include <openssl/x509v3.h> |
124 | #include <openssl/fips.h> | ||
124 | 125 | ||
125 | const char *SSL_version_str=OPENSSL_VERSION_TEXT; | 126 | const char *SSL_version_str=OPENSSL_VERSION_TEXT; |
126 | 127 | ||
@@ -500,18 +501,18 @@ void SSL_set_bio(SSL *s,BIO *rbio,BIO *wbio) | |||
500 | s->wbio=wbio; | 501 | s->wbio=wbio; |
501 | } | 502 | } |
502 | 503 | ||
503 | BIO *SSL_get_rbio(SSL *s) | 504 | BIO *SSL_get_rbio(const SSL *s) |
504 | { return(s->rbio); } | 505 | { return(s->rbio); } |
505 | 506 | ||
506 | BIO *SSL_get_wbio(SSL *s) | 507 | BIO *SSL_get_wbio(const SSL *s) |
507 | { return(s->wbio); } | 508 | { return(s->wbio); } |
508 | 509 | ||
509 | int SSL_get_fd(SSL *s) | 510 | int SSL_get_fd(const SSL *s) |
510 | { | 511 | { |
511 | return(SSL_get_rfd(s)); | 512 | return(SSL_get_rfd(s)); |
512 | } | 513 | } |
513 | 514 | ||
514 | int SSL_get_rfd(SSL *s) | 515 | int SSL_get_rfd(const SSL *s) |
515 | { | 516 | { |
516 | int ret= -1; | 517 | int ret= -1; |
517 | BIO *b,*r; | 518 | BIO *b,*r; |
@@ -523,7 +524,7 @@ int SSL_get_rfd(SSL *s) | |||
523 | return(ret); | 524 | return(ret); |
524 | } | 525 | } |
525 | 526 | ||
526 | int SSL_get_wfd(SSL *s) | 527 | int SSL_get_wfd(const SSL *s) |
527 | { | 528 | { |
528 | int ret= -1; | 529 | int ret= -1; |
529 | BIO *b,*r; | 530 | BIO *b,*r; |
@@ -605,7 +606,7 @@ err: | |||
605 | 606 | ||
606 | 607 | ||
607 | /* return length of latest Finished message we sent, copy to 'buf' */ | 608 | /* return length of latest Finished message we sent, copy to 'buf' */ |
608 | size_t SSL_get_finished(SSL *s, void *buf, size_t count) | 609 | size_t SSL_get_finished(const SSL *s, void *buf, size_t count) |
609 | { | 610 | { |
610 | size_t ret = 0; | 611 | size_t ret = 0; |
611 | 612 | ||
@@ -620,7 +621,7 @@ size_t SSL_get_finished(SSL *s, void *buf, size_t count) | |||
620 | } | 621 | } |
621 | 622 | ||
622 | /* return length of latest Finished message we expected, copy to 'buf' */ | 623 | /* return length of latest Finished message we expected, copy to 'buf' */ |
623 | size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count) | 624 | size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count) |
624 | { | 625 | { |
625 | size_t ret = 0; | 626 | size_t ret = 0; |
626 | 627 | ||
@@ -635,32 +636,32 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count) | |||
635 | } | 636 | } |
636 | 637 | ||
637 | 638 | ||
638 | int SSL_get_verify_mode(SSL *s) | 639 | int SSL_get_verify_mode(const SSL *s) |
639 | { | 640 | { |
640 | return(s->verify_mode); | 641 | return(s->verify_mode); |
641 | } | 642 | } |
642 | 643 | ||
643 | int SSL_get_verify_depth(SSL *s) | 644 | int SSL_get_verify_depth(const SSL *s) |
644 | { | 645 | { |
645 | return(s->verify_depth); | 646 | return(s->verify_depth); |
646 | } | 647 | } |
647 | 648 | ||
648 | int (*SSL_get_verify_callback(SSL *s))(int,X509_STORE_CTX *) | 649 | int (*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *) |
649 | { | 650 | { |
650 | return(s->verify_callback); | 651 | return(s->verify_callback); |
651 | } | 652 | } |
652 | 653 | ||
653 | int SSL_CTX_get_verify_mode(SSL_CTX *ctx) | 654 | int SSL_CTX_get_verify_mode(const SSL_CTX *ctx) |
654 | { | 655 | { |
655 | return(ctx->verify_mode); | 656 | return(ctx->verify_mode); |
656 | } | 657 | } |
657 | 658 | ||
658 | int SSL_CTX_get_verify_depth(SSL_CTX *ctx) | 659 | int SSL_CTX_get_verify_depth(const SSL_CTX *ctx) |
659 | { | 660 | { |
660 | return(ctx->verify_depth); | 661 | return(ctx->verify_depth); |
661 | } | 662 | } |
662 | 663 | ||
663 | int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *) | 664 | int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *) |
664 | { | 665 | { |
665 | return(ctx->default_verify_callback); | 666 | return(ctx->default_verify_callback); |
666 | } | 667 | } |
@@ -683,12 +684,12 @@ void SSL_set_read_ahead(SSL *s,int yes) | |||
683 | s->read_ahead=yes; | 684 | s->read_ahead=yes; |
684 | } | 685 | } |
685 | 686 | ||
686 | int SSL_get_read_ahead(SSL *s) | 687 | int SSL_get_read_ahead(const SSL *s) |
687 | { | 688 | { |
688 | return(s->read_ahead); | 689 | return(s->read_ahead); |
689 | } | 690 | } |
690 | 691 | ||
691 | int SSL_pending(SSL *s) | 692 | int SSL_pending(const SSL *s) |
692 | { | 693 | { |
693 | /* SSL_pending cannot work properly if read-ahead is enabled | 694 | /* SSL_pending cannot work properly if read-ahead is enabled |
694 | * (SSL_[CTX_]ctrl(..., SSL_CTRL_SET_READ_AHEAD, 1, NULL)), | 695 | * (SSL_[CTX_]ctrl(..., SSL_CTRL_SET_READ_AHEAD, 1, NULL)), |
@@ -700,7 +701,7 @@ int SSL_pending(SSL *s) | |||
700 | return(s->method->ssl_pending(s)); | 701 | return(s->method->ssl_pending(s)); |
701 | } | 702 | } |
702 | 703 | ||
703 | X509 *SSL_get_peer_certificate(SSL *s) | 704 | X509 *SSL_get_peer_certificate(const SSL *s) |
704 | { | 705 | { |
705 | X509 *r; | 706 | X509 *r; |
706 | 707 | ||
@@ -716,7 +717,7 @@ X509 *SSL_get_peer_certificate(SSL *s) | |||
716 | return(r); | 717 | return(r); |
717 | } | 718 | } |
718 | 719 | ||
719 | STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s) | 720 | STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s) |
720 | { | 721 | { |
721 | STACK_OF(X509) *r; | 722 | STACK_OF(X509) *r; |
722 | 723 | ||
@@ -733,7 +734,7 @@ STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s) | |||
733 | 734 | ||
734 | /* Now in theory, since the calling process own 't' it should be safe to | 735 | /* Now in theory, since the calling process own 't' it should be safe to |
735 | * modify. We need to be able to read f without being hassled */ | 736 | * modify. We need to be able to read f without being hassled */ |
736 | void SSL_copy_session_id(SSL *t,SSL *f) | 737 | void SSL_copy_session_id(SSL *t,const SSL *f) |
737 | { | 738 | { |
738 | CERT *tmp; | 739 | CERT *tmp; |
739 | 740 | ||
@@ -762,7 +763,7 @@ void SSL_copy_session_id(SSL *t,SSL *f) | |||
762 | } | 763 | } |
763 | 764 | ||
764 | /* Fix this so it checks all the valid key/cert options */ | 765 | /* Fix this so it checks all the valid key/cert options */ |
765 | int SSL_CTX_check_private_key(SSL_CTX *ctx) | 766 | int SSL_CTX_check_private_key(const SSL_CTX *ctx) |
766 | { | 767 | { |
767 | if ( (ctx == NULL) || | 768 | if ( (ctx == NULL) || |
768 | (ctx->cert == NULL) || | 769 | (ctx->cert == NULL) || |
@@ -780,7 +781,7 @@ int SSL_CTX_check_private_key(SSL_CTX *ctx) | |||
780 | } | 781 | } |
781 | 782 | ||
782 | /* Fix this function so that it takes an optional type parameter */ | 783 | /* Fix this function so that it takes an optional type parameter */ |
783 | int SSL_check_private_key(SSL *ssl) | 784 | int SSL_check_private_key(const SSL *ssl) |
784 | { | 785 | { |
785 | if (ssl == NULL) | 786 | if (ssl == NULL) |
786 | { | 787 | { |
@@ -824,7 +825,7 @@ int SSL_connect(SSL *s) | |||
824 | return(s->method->ssl_connect(s)); | 825 | return(s->method->ssl_connect(s)); |
825 | } | 826 | } |
826 | 827 | ||
827 | long SSL_get_default_timeout(SSL *s) | 828 | long SSL_get_default_timeout(const SSL *s) |
828 | { | 829 | { |
829 | return(s->method->get_timeout()); | 830 | return(s->method->get_timeout()); |
830 | } | 831 | } |
@@ -1071,7 +1072,7 @@ int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, | |||
1071 | 1072 | ||
1072 | /** return a STACK of the ciphers available for the SSL and in order of | 1073 | /** return a STACK of the ciphers available for the SSL and in order of |
1073 | * preference */ | 1074 | * preference */ |
1074 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s) | 1075 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s) |
1075 | { | 1076 | { |
1076 | if (s != NULL) | 1077 | if (s != NULL) |
1077 | { | 1078 | { |
@@ -1108,7 +1109,7 @@ STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s) | |||
1108 | } | 1109 | } |
1109 | 1110 | ||
1110 | /** The old interface to get the same thing as SSL_get_ciphers() */ | 1111 | /** The old interface to get the same thing as SSL_get_ciphers() */ |
1111 | const char *SSL_get_cipher_list(SSL *s,int n) | 1112 | const char *SSL_get_cipher_list(const SSL *s,int n) |
1112 | { | 1113 | { |
1113 | SSL_CIPHER *c; | 1114 | SSL_CIPHER *c; |
1114 | STACK_OF(SSL_CIPHER) *sk; | 1115 | STACK_OF(SSL_CIPHER) *sk; |
@@ -1145,7 +1146,7 @@ int SSL_set_cipher_list(SSL *s,const char *str) | |||
1145 | } | 1146 | } |
1146 | 1147 | ||
1147 | /* works well for SSLv2, not so good for SSLv3 */ | 1148 | /* works well for SSLv2, not so good for SSLv3 */ |
1148 | char *SSL_get_shared_ciphers(SSL *s,char *buf,int len) | 1149 | char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len) |
1149 | { | 1150 | { |
1150 | char *p; | 1151 | char *p; |
1151 | const char *cp; | 1152 | const char *cp; |
@@ -1249,7 +1250,7 @@ err: | |||
1249 | return(NULL); | 1250 | return(NULL); |
1250 | } | 1251 | } |
1251 | 1252 | ||
1252 | unsigned long SSL_SESSION_hash(SSL_SESSION *a) | 1253 | unsigned long SSL_SESSION_hash(const SSL_SESSION *a) |
1253 | { | 1254 | { |
1254 | unsigned long l; | 1255 | unsigned long l; |
1255 | 1256 | ||
@@ -1266,7 +1267,7 @@ unsigned long SSL_SESSION_hash(SSL_SESSION *a) | |||
1266 | * SSL_CTX_has_matching_session_id() is checked accordingly. It relies on being | 1267 | * SSL_CTX_has_matching_session_id() is checked accordingly. It relies on being |
1267 | * able to construct an SSL_SESSION that will collide with any existing session | 1268 | * able to construct an SSL_SESSION that will collide with any existing session |
1268 | * with a matching session ID. */ | 1269 | * with a matching session ID. */ |
1269 | int SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b) | 1270 | int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b) |
1270 | { | 1271 | { |
1271 | if (a->ssl_version != b->ssl_version) | 1272 | if (a->ssl_version != b->ssl_version) |
1272 | return(1); | 1273 | return(1); |
@@ -1292,6 +1293,14 @@ SSL_CTX *SSL_CTX_new(SSL_METHOD *meth) | |||
1292 | return(NULL); | 1293 | return(NULL); |
1293 | } | 1294 | } |
1294 | 1295 | ||
1296 | #ifdef OPENSSL_FIPS | ||
1297 | if (FIPS_mode() && (meth->version < TLS1_VERSION)) | ||
1298 | { | ||
1299 | SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); | ||
1300 | return NULL; | ||
1301 | } | ||
1302 | #endif | ||
1303 | |||
1295 | if (SSL_get_ex_data_X509_STORE_CTX_idx() < 0) | 1304 | if (SSL_get_ex_data_X509_STORE_CTX_idx() < 0) |
1296 | { | 1305 | { |
1297 | SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); | 1306 | SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); |
@@ -1722,7 +1731,7 @@ int SSL_set_ssl_method(SSL *s,SSL_METHOD *meth) | |||
1722 | return(ret); | 1731 | return(ret); |
1723 | } | 1732 | } |
1724 | 1733 | ||
1725 | int SSL_get_error(SSL *s,int i) | 1734 | int SSL_get_error(const SSL *s,int i) |
1726 | { | 1735 | { |
1727 | int reason; | 1736 | int reason; |
1728 | unsigned long l; | 1737 | unsigned long l; |
@@ -1856,13 +1865,19 @@ int ssl_undefined_function(SSL *s) | |||
1856 | return(0); | 1865 | return(0); |
1857 | } | 1866 | } |
1858 | 1867 | ||
1868 | int ssl_undefined_const_function(const SSL *s) | ||
1869 | { | ||
1870 | SSLerr(SSL_F_SSL_UNDEFINED_CONST_FUNCTION,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
1871 | return(0); | ||
1872 | } | ||
1873 | |||
1859 | SSL_METHOD *ssl_bad_method(int ver) | 1874 | SSL_METHOD *ssl_bad_method(int ver) |
1860 | { | 1875 | { |
1861 | SSLerr(SSL_F_SSL_BAD_METHOD,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1876 | SSLerr(SSL_F_SSL_BAD_METHOD,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
1862 | return(NULL); | 1877 | return(NULL); |
1863 | } | 1878 | } |
1864 | 1879 | ||
1865 | const char *SSL_get_version(SSL *s) | 1880 | const char *SSL_get_version(const SSL *s) |
1866 | { | 1881 | { |
1867 | if (s->version == TLS1_VERSION) | 1882 | if (s->version == TLS1_VERSION) |
1868 | return("TLSv1"); | 1883 | return("TLSv1"); |
@@ -2031,7 +2046,7 @@ void ssl_clear_cipher_ctx(SSL *s) | |||
2031 | } | 2046 | } |
2032 | 2047 | ||
2033 | /* Fix this function so that it takes an optional type parameter */ | 2048 | /* Fix this function so that it takes an optional type parameter */ |
2034 | X509 *SSL_get_certificate(SSL *s) | 2049 | X509 *SSL_get_certificate(const SSL *s) |
2035 | { | 2050 | { |
2036 | if (s->cert != NULL) | 2051 | if (s->cert != NULL) |
2037 | return(s->cert->key->x509); | 2052 | return(s->cert->key->x509); |
@@ -2048,7 +2063,7 @@ EVP_PKEY *SSL_get_privatekey(SSL *s) | |||
2048 | return(NULL); | 2063 | return(NULL); |
2049 | } | 2064 | } |
2050 | 2065 | ||
2051 | SSL_CIPHER *SSL_get_current_cipher(SSL *s) | 2066 | SSL_CIPHER *SSL_get_current_cipher(const SSL *s) |
2052 | { | 2067 | { |
2053 | if ((s->session != NULL) && (s->session->cipher != NULL)) | 2068 | if ((s->session != NULL) && (s->session->cipher != NULL)) |
2054 | return(s->session->cipher); | 2069 | return(s->session->cipher); |
@@ -2112,7 +2127,7 @@ void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode) | |||
2112 | ctx->quiet_shutdown=mode; | 2127 | ctx->quiet_shutdown=mode; |
2113 | } | 2128 | } |
2114 | 2129 | ||
2115 | int SSL_CTX_get_quiet_shutdown(SSL_CTX *ctx) | 2130 | int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx) |
2116 | { | 2131 | { |
2117 | return(ctx->quiet_shutdown); | 2132 | return(ctx->quiet_shutdown); |
2118 | } | 2133 | } |
@@ -2122,7 +2137,7 @@ void SSL_set_quiet_shutdown(SSL *s,int mode) | |||
2122 | s->quiet_shutdown=mode; | 2137 | s->quiet_shutdown=mode; |
2123 | } | 2138 | } |
2124 | 2139 | ||
2125 | int SSL_get_quiet_shutdown(SSL *s) | 2140 | int SSL_get_quiet_shutdown(const SSL *s) |
2126 | { | 2141 | { |
2127 | return(s->quiet_shutdown); | 2142 | return(s->quiet_shutdown); |
2128 | } | 2143 | } |
@@ -2132,17 +2147,17 @@ void SSL_set_shutdown(SSL *s,int mode) | |||
2132 | s->shutdown=mode; | 2147 | s->shutdown=mode; |
2133 | } | 2148 | } |
2134 | 2149 | ||
2135 | int SSL_get_shutdown(SSL *s) | 2150 | int SSL_get_shutdown(const SSL *s) |
2136 | { | 2151 | { |
2137 | return(s->shutdown); | 2152 | return(s->shutdown); |
2138 | } | 2153 | } |
2139 | 2154 | ||
2140 | int SSL_version(SSL *s) | 2155 | int SSL_version(const SSL *s) |
2141 | { | 2156 | { |
2142 | return(s->version); | 2157 | return(s->version); |
2143 | } | 2158 | } |
2144 | 2159 | ||
2145 | SSL_CTX *SSL_get_SSL_CTX(SSL *ssl) | 2160 | SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl) |
2146 | { | 2161 | { |
2147 | return(ssl->ctx); | 2162 | return(ssl->ctx); |
2148 | } | 2163 | } |
@@ -2156,7 +2171,9 @@ int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx) | |||
2156 | int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, | 2171 | int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, |
2157 | const char *CApath) | 2172 | const char *CApath) |
2158 | { | 2173 | { |
2159 | return(X509_STORE_load_locations(ctx->cert_store,CAfile,CApath)); | 2174 | int r; |
2175 | r=X509_STORE_load_locations(ctx->cert_store,CAfile,CApath); | ||
2176 | return r; | ||
2160 | } | 2177 | } |
2161 | #endif | 2178 | #endif |
2162 | 2179 | ||
@@ -2166,12 +2183,12 @@ void SSL_set_info_callback(SSL *ssl, | |||
2166 | ssl->info_callback=cb; | 2183 | ssl->info_callback=cb; |
2167 | } | 2184 | } |
2168 | 2185 | ||
2169 | void (*SSL_get_info_callback(SSL *ssl))(const SSL *ssl,int type,int val) | 2186 | void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val) |
2170 | { | 2187 | { |
2171 | return ssl->info_callback; | 2188 | return ssl->info_callback; |
2172 | } | 2189 | } |
2173 | 2190 | ||
2174 | int SSL_state(SSL *ssl) | 2191 | int SSL_state(const SSL *ssl) |
2175 | { | 2192 | { |
2176 | return(ssl->state); | 2193 | return(ssl->state); |
2177 | } | 2194 | } |
@@ -2181,7 +2198,7 @@ void SSL_set_verify_result(SSL *ssl,long arg) | |||
2181 | ssl->verify_result=arg; | 2198 | ssl->verify_result=arg; |
2182 | } | 2199 | } |
2183 | 2200 | ||
2184 | long SSL_get_verify_result(SSL *ssl) | 2201 | long SSL_get_verify_result(const SSL *ssl) |
2185 | { | 2202 | { |
2186 | return(ssl->verify_result); | 2203 | return(ssl->verify_result); |
2187 | } | 2204 | } |
@@ -2198,7 +2215,7 @@ int SSL_set_ex_data(SSL *s,int idx,void *arg) | |||
2198 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); | 2215 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); |
2199 | } | 2216 | } |
2200 | 2217 | ||
2201 | void *SSL_get_ex_data(SSL *s,int idx) | 2218 | void *SSL_get_ex_data(const SSL *s,int idx) |
2202 | { | 2219 | { |
2203 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); | 2220 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); |
2204 | } | 2221 | } |
@@ -2215,7 +2232,7 @@ int SSL_CTX_set_ex_data(SSL_CTX *s,int idx,void *arg) | |||
2215 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); | 2232 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); |
2216 | } | 2233 | } |
2217 | 2234 | ||
2218 | void *SSL_CTX_get_ex_data(SSL_CTX *s,int idx) | 2235 | void *SSL_CTX_get_ex_data(const SSL_CTX *s,int idx) |
2219 | { | 2236 | { |
2220 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); | 2237 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); |
2221 | } | 2238 | } |
@@ -2225,7 +2242,7 @@ int ssl_ok(SSL *s) | |||
2225 | return(1); | 2242 | return(1); |
2226 | } | 2243 | } |
2227 | 2244 | ||
2228 | X509_STORE *SSL_CTX_get_cert_store(SSL_CTX *ctx) | 2245 | X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx) |
2229 | { | 2246 | { |
2230 | return(ctx->cert_store); | 2247 | return(ctx->cert_store); |
2231 | } | 2248 | } |
@@ -2237,7 +2254,7 @@ void SSL_CTX_set_cert_store(SSL_CTX *ctx,X509_STORE *store) | |||
2237 | ctx->cert_store=store; | 2254 | ctx->cert_store=store; |
2238 | } | 2255 | } |
2239 | 2256 | ||
2240 | int SSL_want(SSL *s) | 2257 | int SSL_want(const SSL *s) |
2241 | { | 2258 | { |
2242 | return(s->rwstate); | 2259 | return(s->rwstate); |
2243 | } | 2260 | } |
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h index dd6c7a7323..25a144a0d0 100644 --- a/src/lib/libssl/ssl_locl.h +++ b/src/lib/libssl/ssl_locl.h | |||
@@ -302,8 +302,9 @@ | |||
302 | #define SSL_LOW 0x00000020L | 302 | #define SSL_LOW 0x00000020L |
303 | #define SSL_MEDIUM 0x00000040L | 303 | #define SSL_MEDIUM 0x00000040L |
304 | #define SSL_HIGH 0x00000080L | 304 | #define SSL_HIGH 0x00000080L |
305 | #define SSL_FIPS 0x00000100L | ||
305 | 306 | ||
306 | /* we have used 000000ff - 24 bits left to go */ | 307 | /* we have used 000001ff - 23 bits left to go */ |
307 | 308 | ||
308 | /* | 309 | /* |
309 | * Macros to check the export status and cipher strength for export ciphers. | 310 | * Macros to check the export status and cipher strength for export ciphers. |
@@ -498,10 +499,11 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, | |||
498 | STACK_OF(SSL_CIPHER) **sorted, | 499 | STACK_OF(SSL_CIPHER) **sorted, |
499 | const char *rule_str); | 500 | const char *rule_str); |
500 | void ssl_update_cache(SSL *s, int mode); | 501 | void ssl_update_cache(SSL *s, int mode); |
501 | int ssl_cipher_get_evp(SSL_SESSION *s,const EVP_CIPHER **enc,const EVP_MD **md, | 502 | int ssl_cipher_get_evp(const SSL_SESSION *s,const EVP_CIPHER **enc, |
502 | SSL_COMP **comp); | 503 | const EVP_MD **md,SSL_COMP **comp); |
503 | int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); | 504 | int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); |
504 | int ssl_undefined_function(SSL *s); | 505 | int ssl_undefined_function(SSL *s); |
506 | int ssl_undefined_const_function(const SSL *s); | ||
505 | X509 *ssl_get_server_send_cert(SSL *); | 507 | X509 *ssl_get_server_send_cert(SSL *); |
506 | EVP_PKEY *ssl_get_sign_pkey(SSL *,SSL_CIPHER *); | 508 | EVP_PKEY *ssl_get_sign_pkey(SSL *,SSL_CIPHER *); |
507 | int ssl_cert_type(X509 *x,EVP_PKEY *pkey); | 509 | int ssl_cert_type(X509 *x,EVP_PKEY *pkey); |
@@ -535,7 +537,7 @@ long ssl2_ctrl(SSL *s,int cmd, long larg, void *parg); | |||
535 | long ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); | 537 | long ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); |
536 | long ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)()); | 538 | long ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)()); |
537 | long ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)()); | 539 | long ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)()); |
538 | int ssl2_pending(SSL *s); | 540 | int ssl2_pending(const SSL *s); |
539 | 541 | ||
540 | SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); | 542 | SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); |
541 | int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); | 543 | int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); |
@@ -583,7 +585,7 @@ long ssl3_ctrl(SSL *s,int cmd, long larg, void *parg); | |||
583 | long ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); | 585 | long ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); |
584 | long ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)()); | 586 | long ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)()); |
585 | long ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)()); | 587 | long ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)()); |
586 | int ssl3_pending(SSL *s); | 588 | int ssl3_pending(const SSL *s); |
587 | 589 | ||
588 | int ssl23_accept(SSL *s); | 590 | int ssl23_accept(SSL *s); |
589 | int ssl23_connect(SSL *s); | 591 | int ssl23_connect(SSL *s); |
diff --git a/src/lib/libssl/ssl_rsa.c b/src/lib/libssl/ssl_rsa.c index 330390519b..fb0bd4d045 100644 --- a/src/lib/libssl/ssl_rsa.c +++ b/src/lib/libssl/ssl_rsa.c | |||
@@ -804,7 +804,7 @@ int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file) | |||
804 | /* When the while loop ends, it's usually just EOF. */ | 804 | /* When the while loop ends, it's usually just EOF. */ |
805 | err = ERR_peek_last_error(); | 805 | err = ERR_peek_last_error(); |
806 | if (ERR_GET_LIB(err) == ERR_LIB_PEM && ERR_GET_REASON(err) == PEM_R_NO_START_LINE) | 806 | if (ERR_GET_LIB(err) == ERR_LIB_PEM && ERR_GET_REASON(err) == PEM_R_NO_START_LINE) |
807 | (void)ERR_get_error(); | 807 | ERR_clear_error(); |
808 | else | 808 | else |
809 | ret = 0; /* some real error */ | 809 | ret = 0; /* some real error */ |
810 | } | 810 | } |
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c index 7016c87d3b..5f12aa361c 100644 --- a/src/lib/libssl/ssl_sess.c +++ b/src/lib/libssl/ssl_sess.c | |||
@@ -65,7 +65,7 @@ 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); | 65 | static void SSL_SESSION_list_add(SSL_CTX *ctx,SSL_SESSION *s); |
66 | static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck); | 66 | static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck); |
67 | 67 | ||
68 | SSL_SESSION *SSL_get_session(SSL *ssl) | 68 | SSL_SESSION *SSL_get_session(const SSL *ssl) |
69 | /* aka SSL_get0_session; gets 0 objects, just returns a copy of the pointer */ | 69 | /* aka SSL_get0_session; gets 0 objects, just returns a copy of the pointer */ |
70 | { | 70 | { |
71 | return(ssl->session); | 71 | return(ssl->session); |
@@ -98,7 +98,7 @@ int SSL_SESSION_set_ex_data(SSL_SESSION *s, int idx, void *arg) | |||
98 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); | 98 | return(CRYPTO_set_ex_data(&s->ex_data,idx,arg)); |
99 | } | 99 | } |
100 | 100 | ||
101 | void *SSL_SESSION_get_ex_data(SSL_SESSION *s, int idx) | 101 | void *SSL_SESSION_get_ex_data(const SSL_SESSION *s, int idx) |
102 | { | 102 | { |
103 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); | 103 | return(CRYPTO_get_ex_data(&s->ex_data,idx)); |
104 | } | 104 | } |
@@ -141,7 +141,8 @@ static int def_generate_session_id(const SSL *ssl, unsigned char *id, | |||
141 | { | 141 | { |
142 | unsigned int retry = 0; | 142 | unsigned int retry = 0; |
143 | do | 143 | do |
144 | RAND_pseudo_bytes(id, *id_len); | 144 | if(RAND_pseudo_bytes(id, *id_len) <= 0) |
145 | return 0; | ||
145 | while(SSL_has_matching_session_id(ssl, id, *id_len) && | 146 | while(SSL_has_matching_session_id(ssl, id, *id_len) && |
146 | (++retry < MAX_SESS_ID_ATTEMPTS)); | 147 | (++retry < MAX_SESS_ID_ATTEMPTS)); |
147 | if(retry < MAX_SESS_ID_ATTEMPTS) | 148 | if(retry < MAX_SESS_ID_ATTEMPTS) |
@@ -609,13 +610,13 @@ long SSL_SESSION_set_timeout(SSL_SESSION *s, long t) | |||
609 | return(1); | 610 | return(1); |
610 | } | 611 | } |
611 | 612 | ||
612 | long SSL_SESSION_get_timeout(SSL_SESSION *s) | 613 | long SSL_SESSION_get_timeout(const SSL_SESSION *s) |
613 | { | 614 | { |
614 | if (s == NULL) return(0); | 615 | if (s == NULL) return(0); |
615 | return(s->timeout); | 616 | return(s->timeout); |
616 | } | 617 | } |
617 | 618 | ||
618 | long SSL_SESSION_get_time(SSL_SESSION *s) | 619 | long SSL_SESSION_get_time(const SSL_SESSION *s) |
619 | { | 620 | { |
620 | if (s == NULL) return(0); | 621 | if (s == NULL) return(0); |
621 | return(s->time); | 622 | return(s->time); |
@@ -637,7 +638,7 @@ long SSL_CTX_set_timeout(SSL_CTX *s, long t) | |||
637 | return(l); | 638 | return(l); |
638 | } | 639 | } |
639 | 640 | ||
640 | long SSL_CTX_get_timeout(SSL_CTX *s) | 641 | long SSL_CTX_get_timeout(const SSL_CTX *s) |
641 | { | 642 | { |
642 | if (s == NULL) return(0); | 643 | if (s == NULL) return(0); |
643 | return(s->session_timeout); | 644 | return(s->session_timeout); |
diff --git a/src/lib/libssl/ssl_txt.c b/src/lib/libssl/ssl_txt.c index 40b76b1b26..8655a31333 100644 --- a/src/lib/libssl/ssl_txt.c +++ b/src/lib/libssl/ssl_txt.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #include "ssl_locl.h" | 61 | #include "ssl_locl.h" |
62 | 62 | ||
63 | #ifndef OPENSSL_NO_FP_API | 63 | #ifndef OPENSSL_NO_FP_API |
64 | int SSL_SESSION_print_fp(FILE *fp, SSL_SESSION *x) | 64 | int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x) |
65 | { | 65 | { |
66 | BIO *b; | 66 | BIO *b; |
67 | int ret; | 67 | int ret; |
@@ -78,7 +78,7 @@ int SSL_SESSION_print_fp(FILE *fp, SSL_SESSION *x) | |||
78 | } | 78 | } |
79 | #endif | 79 | #endif |
80 | 80 | ||
81 | int SSL_SESSION_print(BIO *bp, SSL_SESSION *x) | 81 | int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) |
82 | { | 82 | { |
83 | unsigned int i; | 83 | unsigned int i; |
84 | char *s; | 84 | char *s; |
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c index 271e247eea..2c6246abf5 100644 --- a/src/lib/libssl/t1_enc.c +++ b/src/lib/libssl/t1_enc.c | |||
@@ -115,6 +115,7 @@ | |||
115 | #include <openssl/evp.h> | 115 | #include <openssl/evp.h> |
116 | #include <openssl/hmac.h> | 116 | #include <openssl/hmac.h> |
117 | #include <openssl/md5.h> | 117 | #include <openssl/md5.h> |
118 | #include <openssl/fips.h> | ||
118 | 119 | ||
119 | static void tls1_P_hash(const EVP_MD *md, const unsigned char *sec, | 120 | static void tls1_P_hash(const EVP_MD *md, const unsigned char *sec, |
120 | int sec_len, unsigned char *seed, int seed_len, | 121 | int sec_len, unsigned char *seed, int seed_len, |
@@ -131,6 +132,8 @@ static void tls1_P_hash(const EVP_MD *md, const unsigned char *sec, | |||
131 | 132 | ||
132 | HMAC_CTX_init(&ctx); | 133 | HMAC_CTX_init(&ctx); |
133 | HMAC_CTX_init(&ctx_tmp); | 134 | HMAC_CTX_init(&ctx_tmp); |
135 | HMAC_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
136 | HMAC_CTX_set_flags(&ctx_tmp, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
134 | HMAC_Init_ex(&ctx,sec,sec_len,md, NULL); | 137 | HMAC_Init_ex(&ctx,sec,sec_len,md, NULL); |
135 | HMAC_Init_ex(&ctx_tmp,sec,sec_len,md, NULL); | 138 | HMAC_Init_ex(&ctx_tmp,sec,sec_len,md, NULL); |
136 | HMAC_Update(&ctx,seed,seed_len); | 139 | HMAC_Update(&ctx,seed,seed_len); |
@@ -177,7 +180,6 @@ static void tls1_PRF(const EVP_MD *md5, const EVP_MD *sha1, | |||
177 | S2= &(sec[len]); | 180 | S2= &(sec[len]); |
178 | len+=(slen&1); /* add for odd, make longer */ | 181 | len+=(slen&1); /* add for odd, make longer */ |
179 | 182 | ||
180 | |||
181 | tls1_P_hash(md5 ,S1,len,label,label_len,out1,olen); | 183 | tls1_P_hash(md5 ,S1,len,label,label_len,out1,olen); |
182 | tls1_P_hash(sha1,S2,len,label,label_len,out2,olen); | 184 | tls1_P_hash(sha1,S2,len,label,label_len,out2,olen); |
183 | 185 | ||
diff --git a/src/lib/libssl/test/bctest b/src/lib/libssl/test/bctest index bdb3218f7a..e81fc0733a 100644 --- a/src/lib/libssl/test/bctest +++ b/src/lib/libssl/test/bctest | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # This script is used by test/Makefile.ssl to check whether a sane 'bc' | 3 | # This script is used by test/Makefile to check whether a sane 'bc' |
4 | # is installed. | 4 | # is installed. |
5 | # ('make test_bn' should not try to run 'bc' if it does not exist or if | 5 | # ('make test_bn' should not try to run 'bc' if it does not exist or if |
6 | # it is a broken 'bc' version that is known to cause trouble.) | 6 | # it is a broken 'bc' version that is known to cause trouble.) |
diff --git a/src/lib/libssl/test/maketests.com b/src/lib/libssl/test/maketests.com index 7c44e4545a..dfbfef7b1b 100644 --- a/src/lib/libssl/test/maketests.com +++ b/src/lib/libssl/test/maketests.com | |||
@@ -615,7 +615,7 @@ $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - | |||
615 | THEN CC = "CC/DECC" | 615 | THEN CC = "CC/DECC" |
616 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - | 616 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - |
617 | "/NOLIST/PREFIX=ALL" + - | 617 | "/NOLIST/PREFIX=ALL" + - |
618 | "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS | 618 | "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS |
619 | $! | 619 | $! |
620 | $! Define The Linker Options File Name. | 620 | $! Define The Linker Options File Name. |
621 | $! | 621 | $! |
@@ -648,7 +648,7 @@ $ EXIT | |||
648 | $ ENDIF | 648 | $ ENDIF |
649 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" | 649 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" |
650 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | 650 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - |
651 | "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS | 651 | "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS |
652 | $ CCDEFS = CCDEFS + ",""VAXC""" | 652 | $ CCDEFS = CCDEFS + ",""VAXC""" |
653 | $! | 653 | $! |
654 | $! Define <sys> As SYS$COMMON:[SYSLIB] | 654 | $! Define <sys> As SYS$COMMON:[SYSLIB] |
@@ -679,7 +679,7 @@ $! | |||
679 | $! Use GNU C... | 679 | $! Use GNU C... |
680 | $! | 680 | $! |
681 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | 681 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - |
682 | "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS | 682 | "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS |
683 | $! | 683 | $! |
684 | $! Define The Linker Options File Name. | 684 | $! Define The Linker Options File Name. |
685 | $! | 685 | $! |
diff --git a/src/lib/libssl/test/tcrl b/src/lib/libssl/test/tcrl index f71ef7a863..3ffed12a03 100644 --- a/src/lib/libssl/test/tcrl +++ b/src/lib/libssl/test/tcrl | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl crl' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl crl' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/test/testca b/src/lib/libssl/test/testca index 8215ebb5d1..5b2faa78f1 100644 --- a/src/lib/libssl/test/testca +++ b/src/lib/libssl/test/testca | |||
@@ -11,6 +11,9 @@ export SH PATH | |||
11 | SSLEAY_CONFIG="-config CAss.cnf" | 11 | SSLEAY_CONFIG="-config CAss.cnf" |
12 | export SSLEAY_CONFIG | 12 | export SSLEAY_CONFIG |
13 | 13 | ||
14 | OPENSSL="`pwd`/../util/shlib_wrap.sh openssl" | ||
15 | export OPENSSL | ||
16 | |||
14 | /bin/rm -fr demoCA | 17 | /bin/rm -fr demoCA |
15 | $SH ../apps/CA.sh -newca <<EOF | 18 | $SH ../apps/CA.sh -newca <<EOF |
16 | EOF | 19 | EOF |
diff --git a/src/lib/libssl/test/testenc b/src/lib/libssl/test/testenc index 0656c7f525..4571ea2875 100644 --- a/src/lib/libssl/test/testenc +++ b/src/lib/libssl/test/testenc | |||
@@ -1,14 +1,14 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | testsrc=Makefile.ssl | 3 | testsrc=Makefile |
4 | test=./p | 4 | test=./p |
5 | cmd=../apps/openssl | 5 | cmd="../util/shlib_wrap.sh ../apps/openssl" |
6 | 6 | ||
7 | cat $testsrc >$test; | 7 | cat $testsrc >$test; |
8 | 8 | ||
9 | echo cat | 9 | echo cat |
10 | $cmd enc < $test > $test.cipher | 10 | $cmd enc -non-fips-allow < $test > $test.cipher |
11 | $cmd enc < $test.cipher >$test.clear | 11 | $cmd enc -non-fips-allow < $test.cipher >$test.clear |
12 | cmp $test $test.clear | 12 | cmp $test $test.clear |
13 | if [ $? != 0 ] | 13 | if [ $? != 0 ] |
14 | then | 14 | then |
@@ -17,8 +17,8 @@ else | |||
17 | /bin/rm $test.cipher $test.clear | 17 | /bin/rm $test.cipher $test.clear |
18 | fi | 18 | fi |
19 | echo base64 | 19 | echo base64 |
20 | $cmd enc -a -e < $test > $test.cipher | 20 | $cmd enc -non-fips-allow -a -e < $test > $test.cipher |
21 | $cmd enc -a -d < $test.cipher >$test.clear | 21 | $cmd enc -non-fips-allow -a -d < $test.cipher >$test.clear |
22 | cmp $test $test.clear | 22 | cmp $test $test.clear |
23 | if [ $? != 0 ] | 23 | if [ $? != 0 ] |
24 | then | 24 | then |
@@ -30,8 +30,8 @@ fi | |||
30 | for i in `$cmd list-cipher-commands` | 30 | for i in `$cmd list-cipher-commands` |
31 | do | 31 | do |
32 | echo $i | 32 | echo $i |
33 | $cmd $i -bufsize 113 -e -k test < $test > $test.$i.cipher | 33 | $cmd $i -non-fips-allow -bufsize 113 -e -k test < $test > $test.$i.cipher |
34 | $cmd $i -bufsize 157 -d -k test < $test.$i.cipher >$test.$i.clear | 34 | $cmd $i -non-fips-allow -bufsize 157 -d -k test < $test.$i.cipher >$test.$i.clear |
35 | cmp $test $test.$i.clear | 35 | cmp $test $test.$i.clear |
36 | if [ $? != 0 ] | 36 | if [ $? != 0 ] |
37 | then | 37 | then |
@@ -41,8 +41,8 @@ do | |||
41 | fi | 41 | fi |
42 | 42 | ||
43 | echo $i base64 | 43 | echo $i base64 |
44 | $cmd $i -bufsize 113 -a -e -k test < $test > $test.$i.cipher | 44 | $cmd $i -non-fips-allow -bufsize 113 -a -e -k test < $test > $test.$i.cipher |
45 | $cmd $i -bufsize 157 -a -d -k test < $test.$i.cipher >$test.$i.clear | 45 | $cmd $i -non-fips-allow -bufsize 157 -a -d -k test < $test.$i.cipher >$test.$i.clear |
46 | cmp $test $test.$i.clear | 46 | cmp $test $test.$i.clear |
47 | if [ $? != 0 ] | 47 | if [ $? != 0 ] |
48 | then | 48 | then |
diff --git a/src/lib/libssl/test/testenc.com b/src/lib/libssl/test/testenc.com index c24fa388c0..5e6f521f9d 100644 --- a/src/lib/libssl/test/testenc.com +++ b/src/lib/libssl/test/testenc.com | |||
@@ -4,7 +4,7 @@ $ __arch := VAX | |||
4 | $ if f$getsyi("cpu") .ge. 128 then __arch := AXP | 4 | $ if f$getsyi("cpu") .ge. 128 then __arch := AXP |
5 | $ exe_dir := sys$disk:[-.'__arch'.exe.apps] | 5 | $ exe_dir := sys$disk:[-.'__arch'.exe.apps] |
6 | $ | 6 | $ |
7 | $ testsrc := makefile.ssl | 7 | $ testsrc := makefile. |
8 | $ test := p.txt | 8 | $ test := p.txt |
9 | $ cmd := mcr 'exe_dir'openssl | 9 | $ cmd := mcr 'exe_dir'openssl |
10 | $ | 10 | $ |
diff --git a/src/lib/libssl/test/testgen b/src/lib/libssl/test/testgen index 3798543e04..524c0d134c 100644 --- a/src/lib/libssl/test/testgen +++ b/src/lib/libssl/test/testgen | |||
@@ -17,7 +17,7 @@ echo "generating certificate request" | |||
17 | 17 | ||
18 | echo "string to make the random number generator think it has entropy" >> ./.rnd | 18 | echo "string to make the random number generator think it has entropy" >> ./.rnd |
19 | 19 | ||
20 | if ../apps/openssl no-rsa; then | 20 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then |
21 | req_new='-newkey dsa:../apps/dsa512.pem' | 21 | req_new='-newkey dsa:../apps/dsa512.pem' |
22 | else | 22 | else |
23 | req_new='-new' | 23 | req_new='-new' |
@@ -29,13 +29,13 @@ echo "This could take some time." | |||
29 | 29 | ||
30 | rm -f testkey.pem testreq.pem | 30 | rm -f testkey.pem testreq.pem |
31 | 31 | ||
32 | ../apps/openssl req -config test.cnf $req_new -out testreq.pem | 32 | ../util/shlib_wrap.sh ../apps/openssl req -config test.cnf $req_new -out testreq.pem |
33 | if [ $? != 0 ]; then | 33 | if [ $? != 0 ]; then |
34 | echo problems creating request | 34 | echo problems creating request |
35 | exit 1 | 35 | exit 1 |
36 | fi | 36 | fi |
37 | 37 | ||
38 | ../apps/openssl req -config test.cnf -verify -in testreq.pem -noout | 38 | ../util/shlib_wrap.sh ../apps/openssl req -config test.cnf -verify -in testreq.pem -noout |
39 | if [ $? != 0 ]; then | 39 | if [ $? != 0 ]; then |
40 | echo signature on req is wrong | 40 | echo signature on req is wrong |
41 | exit 1 | 41 | exit 1 |
diff --git a/src/lib/libssl/test/testss b/src/lib/libssl/test/testss index 8d3557f356..1a426857d3 100644 --- a/src/lib/libssl/test/testss +++ b/src/lib/libssl/test/testss | |||
@@ -1,9 +1,9 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | digest='-md5' | 3 | digest='-sha1' |
4 | reqcmd="../apps/openssl req" | 4 | reqcmd="../util/shlib_wrap.sh ../apps/openssl req" |
5 | x509cmd="../apps/openssl x509 $digest" | 5 | x509cmd="../util/shlib_wrap.sh ../apps/openssl x509 $digest" |
6 | verifycmd="../apps/openssl verify" | 6 | verifycmd="../util/shlib_wrap.sh ../apps/openssl verify" |
7 | dummycnf="../apps/openssl.cnf" | 7 | dummycnf="../apps/openssl.cnf" |
8 | 8 | ||
9 | CAkey="keyCA.ss" | 9 | CAkey="keyCA.ss" |
@@ -17,12 +17,24 @@ Ukey="keyU.ss" | |||
17 | Ureq="reqU.ss" | 17 | Ureq="reqU.ss" |
18 | Ucert="certU.ss" | 18 | Ucert="certU.ss" |
19 | 19 | ||
20 | P1conf="P1ss.cnf" | ||
21 | P1key="keyP1.ss" | ||
22 | P1req="reqP1.ss" | ||
23 | P1cert="certP1.ss" | ||
24 | P1intermediate="tmp_intP1.ss" | ||
25 | |||
26 | P2conf="P2ss.cnf" | ||
27 | P2key="keyP2.ss" | ||
28 | P2req="reqP2.ss" | ||
29 | P2cert="certP2.ss" | ||
30 | P2intermediate="tmp_intP2.ss" | ||
31 | |||
20 | echo | 32 | echo |
21 | echo "make a certificate request using 'req'" | 33 | echo "make a certificate request using 'req'" |
22 | 34 | ||
23 | echo "string to make the random number generator think it has entropy" >> ./.rnd | 35 | echo "string to make the random number generator think it has entropy" >> ./.rnd |
24 | 36 | ||
25 | if ../apps/openssl no-rsa; then | 37 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then |
26 | req_new='-newkey dsa:../apps/dsa512.pem' | 38 | req_new='-newkey dsa:../apps/dsa512.pem' |
27 | else | 39 | else |
28 | req_new='-new' | 40 | req_new='-new' |
@@ -35,7 +47,7 @@ if [ $? != 0 ]; then | |||
35 | fi | 47 | fi |
36 | echo | 48 | echo |
37 | echo "convert the certificate request into a self signed certificate using 'x509'" | 49 | echo "convert the certificate request into a self signed certificate using 'x509'" |
38 | $x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey >err.ss | 50 | $x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey -extfile $CAconf -extensions v3_ca >err.ss |
39 | if [ $? != 0 ]; then | 51 | if [ $? != 0 ]; then |
40 | echo "error using 'x509' to self sign a certificate request" | 52 | echo "error using 'x509' to self sign a certificate request" |
41 | exit 1 | 53 | exit 1 |
@@ -68,18 +80,18 @@ if [ $? != 0 ]; then | |||
68 | fi | 80 | fi |
69 | 81 | ||
70 | echo | 82 | echo |
71 | echo "make another certificate request using 'req'" | 83 | echo "make a user certificate request using 'req'" |
72 | $reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss | 84 | $reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss |
73 | if [ $? != 0 ]; then | 85 | if [ $? != 0 ]; then |
74 | echo "error using 'req' to generate a certificate request" | 86 | echo "error using 'req' to generate a user certificate request" |
75 | exit 1 | 87 | exit 1 |
76 | fi | 88 | fi |
77 | 89 | ||
78 | echo | 90 | echo |
79 | echo "sign certificate request with the just created CA via 'x509'" | 91 | echo "sign user certificate request with the just created CA via 'x509'" |
80 | $x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey >err.ss | 92 | $x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey -extfile $Uconf -extensions v3_ee >err.ss |
81 | if [ $? != 0 ]; then | 93 | if [ $? != 0 ]; then |
82 | echo "error using 'x509' to sign a certificate request" | 94 | echo "error using 'x509' to sign a user certificate request" |
83 | exit 1 | 95 | exit 1 |
84 | fi | 96 | fi |
85 | 97 | ||
@@ -89,11 +101,63 @@ echo "Certificate details" | |||
89 | $x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert | 101 | $x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert |
90 | 102 | ||
91 | echo | 103 | echo |
104 | echo "make a proxy certificate request using 'req'" | ||
105 | $reqcmd -config $P1conf -out $P1req -keyout $P1key $req_new >err.ss | ||
106 | if [ $? != 0 ]; then | ||
107 | echo "error using 'req' to generate a proxy certificate request" | ||
108 | exit 1 | ||
109 | fi | ||
110 | |||
111 | echo | ||
112 | echo "sign proxy certificate request with the just created user certificate via 'x509'" | ||
113 | $x509cmd -CAcreateserial -in $P1req -days 30 -req -out $P1cert -CA $Ucert -CAkey $Ukey -extfile $P1conf -extensions v3_proxy >err.ss | ||
114 | if [ $? != 0 ]; then | ||
115 | echo "error using 'x509' to sign a proxy certificate request" | ||
116 | exit 1 | ||
117 | fi | ||
118 | |||
119 | cat $Ucert > $P1intermediate | ||
120 | $verifycmd -CAfile $CAcert -untrusted $P1intermediate $P1cert | ||
121 | echo | ||
122 | echo "Certificate details" | ||
123 | $x509cmd -subject -issuer -startdate -enddate -noout -in $P1cert | ||
124 | |||
125 | echo | ||
126 | echo "make another proxy certificate request using 'req'" | ||
127 | $reqcmd -config $P2conf -out $P2req -keyout $P2key $req_new >err.ss | ||
128 | if [ $? != 0 ]; then | ||
129 | echo "error using 'req' to generate another proxy certificate request" | ||
130 | exit 1 | ||
131 | fi | ||
132 | |||
133 | echo | ||
134 | echo "sign second proxy certificate request with the first proxy certificate via 'x509'" | ||
135 | $x509cmd -CAcreateserial -in $P2req -days 30 -req -out $P2cert -CA $P1cert -CAkey $P1key -extfile $P2conf -extensions v3_proxy >err.ss | ||
136 | if [ $? != 0 ]; then | ||
137 | echo "error using 'x509' to sign a second proxy certificate request" | ||
138 | exit 1 | ||
139 | fi | ||
140 | |||
141 | cat $Ucert $P1cert > $P2intermediate | ||
142 | $verifycmd -CAfile $CAcert -untrusted $P2intermediate $P2cert | ||
143 | echo | ||
144 | echo "Certificate details" | ||
145 | $x509cmd -subject -issuer -startdate -enddate -noout -in $P2cert | ||
146 | |||
147 | echo | ||
92 | echo The generated CA certificate is $CAcert | 148 | echo The generated CA certificate is $CAcert |
93 | echo The generated CA private key is $CAkey | 149 | echo The generated CA private key is $CAkey |
94 | 150 | ||
95 | echo The generated user certificate is $Ucert | 151 | echo The generated user certificate is $Ucert |
96 | echo The generated user private key is $Ukey | 152 | echo The generated user private key is $Ukey |
97 | 153 | ||
154 | echo The first generated proxy certificate is $P1cert | ||
155 | echo The first generated proxy private key is $P1key | ||
156 | |||
157 | echo The second generated proxy certificate is $P2cert | ||
158 | echo The second generated proxy private key is $P2key | ||
159 | |||
98 | /bin/rm err.ss | 160 | /bin/rm err.ss |
161 | #/bin/rm $P1intermediate | ||
162 | #/bin/rm $P2intermediate | ||
99 | exit 0 | 163 | exit 0 |
diff --git a/src/lib/libssl/test/testssl b/src/lib/libssl/test/testssl index ca8e718022..8ac90ae5ee 100644 --- a/src/lib/libssl/test/testssl +++ b/src/lib/libssl/test/testssl | |||
@@ -10,9 +10,9 @@ if [ "$2" = "" ]; then | |||
10 | else | 10 | else |
11 | cert="$2" | 11 | cert="$2" |
12 | fi | 12 | fi |
13 | ssltest="./ssltest -key $key -cert $cert -c_key $key -c_cert $cert" | 13 | ssltest="../util/shlib_wrap.sh ./ssltest -key $key -cert $cert -c_key $key -c_cert $cert" |
14 | 14 | ||
15 | if ../apps/openssl x509 -in $cert -text -noout | fgrep 'DSA Public Key' >/dev/null; then | 15 | if ../util/shlib_wrap.sh ../apps/openssl x509 -in $cert -text -noout | fgrep 'DSA Public Key' >/dev/null; then |
16 | dsa_cert=YES | 16 | dsa_cert=YES |
17 | else | 17 | else |
18 | dsa_cert=NO | 18 | dsa_cert=NO |
@@ -121,24 +121,24 @@ $ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exit 1 | |||
121 | 121 | ||
122 | ############################################################################# | 122 | ############################################################################# |
123 | 123 | ||
124 | if ../apps/openssl no-dh; then | 124 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then |
125 | echo skipping anonymous DH tests | 125 | echo skipping anonymous DH tests |
126 | else | 126 | else |
127 | echo test tls1 with 1024bit anonymous DH, multiple handshakes | 127 | echo test tls1 with 1024bit anonymous DH, multiple handshakes |
128 | $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1 | 128 | $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1 |
129 | fi | 129 | fi |
130 | 130 | ||
131 | if ../apps/openssl no-rsa; then | 131 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then |
132 | echo skipping RSA tests | 132 | echo skipping RSA tests |
133 | else | 133 | else |
134 | echo test tls1 with 1024bit RSA, no DHE, multiple handshakes | 134 | echo test tls1 with 1024bit RSA, no DHE, multiple handshakes |
135 | ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -num 10 -f -time $extra || exit 1 | 135 | ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -num 10 -f -time $extra || exit 1 |
136 | 136 | ||
137 | if ../apps/openssl no-dh; then | 137 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then |
138 | echo skipping RSA+DHE tests | 138 | echo skipping RSA+DHE tests |
139 | else | 139 | else |
140 | echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes | 140 | echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes |
141 | ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1 | 141 | ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1 |
142 | fi | 142 | fi |
143 | fi | 143 | fi |
144 | 144 | ||
diff --git a/src/lib/libssl/test/tpkcs7 b/src/lib/libssl/test/tpkcs7 index cf3bd9fadb..79bb6e0edf 100644 --- a/src/lib/libssl/test/tpkcs7 +++ b/src/lib/libssl/test/tpkcs7 | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl pkcs7' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl pkcs7' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/test/tpkcs7d b/src/lib/libssl/test/tpkcs7d index 18f9311b06..20394b34c4 100644 --- a/src/lib/libssl/test/tpkcs7d +++ b/src/lib/libssl/test/tpkcs7d | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl pkcs7' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl pkcs7' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/test/treq b/src/lib/libssl/test/treq index 47a8273cde..7e020210a5 100644 --- a/src/lib/libssl/test/treq +++ b/src/lib/libssl/test/treq | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl req -config ../apps/openssl.cnf' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl req -config ../apps/openssl.cnf' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/test/trsa b/src/lib/libssl/test/trsa index 413e2ec0a0..67b4a98841 100644 --- a/src/lib/libssl/test/trsa +++ b/src/lib/libssl/test/trsa | |||
@@ -7,12 +7,12 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | if ../apps/openssl no-rsa; then | 10 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then |
11 | echo skipping rsa conversion test | 11 | echo skipping rsa conversion test |
12 | exit 0 | 12 | exit 0 |
13 | fi | 13 | fi |
14 | 14 | ||
15 | cmd='../apps/openssl rsa' | 15 | cmd='../util/shlib_wrap.sh ../apps/openssl rsa' |
16 | 16 | ||
17 | if [ "$1"x != "x" ]; then | 17 | if [ "$1"x != "x" ]; then |
18 | t=$1 | 18 | t=$1 |
diff --git a/src/lib/libssl/test/tsid b/src/lib/libssl/test/tsid index 40a1dfa97c..fb4a7213b9 100644 --- a/src/lib/libssl/test/tsid +++ b/src/lib/libssl/test/tsid | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl sess_id' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl sess_id' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |
diff --git a/src/lib/libssl/test/tverify.com b/src/lib/libssl/test/tverify.com index f97e71478f..2060184d1e 100644 --- a/src/lib/libssl/test/tverify.com +++ b/src/lib/libssl/test/tverify.com | |||
@@ -15,12 +15,15 @@ $ f = f$search("[-.certs]*.pem") | |||
15 | $ if f .nes. "" .and. f .nes. old_f | 15 | $ if f .nes. "" .and. f .nes. old_f |
16 | $ then | 16 | $ then |
17 | $ certs = certs + " [-.certs]" + f$parse(f,,,"NAME") + ".pem" | 17 | $ certs = certs + " [-.certs]" + f$parse(f,,,"NAME") + ".pem" |
18 | $ if f$length(certs) .lt. 180 then goto loop_certs2 | ||
19 | $ c := YES | 18 | $ c := YES |
19 | $ if f$length(certs) .lt. 180 then goto loop_certs2 | ||
20 | $ endif | 20 | $ endif |
21 | $ certs = certs - " " | 21 | $ certs = certs - " " |
22 | $ | 22 | $ |
23 | $ mcr 'exe_dir'openssl verify "-CAfile" certs.tmp 'certs' | 23 | $ if c |
24 | $ if c then goto loop_certs | 24 | $ then |
25 | $ mcr 'exe_dir'openssl verify "-CAfile" certs.tmp 'certs' | ||
26 | $ goto loop_certs | ||
27 | $ endif | ||
25 | $ | 28 | $ |
26 | $ delete certs.tmp;* | 29 | $ delete certs.tmp;* |
diff --git a/src/lib/libssl/test/tx509 b/src/lib/libssl/test/tx509 index d380963abc..1b9c8661f3 100644 --- a/src/lib/libssl/test/tx509 +++ b/src/lib/libssl/test/tx509 | |||
@@ -7,7 +7,7 @@ else | |||
7 | fi | 7 | fi |
8 | export PATH | 8 | export PATH |
9 | 9 | ||
10 | cmd='../apps/openssl x509' | 10 | cmd='../util/shlib_wrap.sh ../apps/openssl x509' |
11 | 11 | ||
12 | if [ "$1"x != "x" ]; then | 12 | if [ "$1"x != "x" ]; then |
13 | t=$1 | 13 | t=$1 |