diff options
182 files changed, 3051 insertions, 1088 deletions
diff --git a/src/lib/libcrypto/Attic/Makefile b/src/lib/libcrypto/Attic/Makefile index 947dd5d44e..a90809b2b8 100644 --- a/src/lib/libcrypto/Attic/Makefile +++ b/src/lib/libcrypto/Attic/Makefile | |||
| @@ -77,7 +77,9 @@ ia64cpuid.s: ia64cpuid.S; $(CC) $(CFLAGS) -E ia64cpuid.S > $@ | |||
| 77 | ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@ | 77 | ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@ |
| 78 | pariscid.s: pariscid.pl; $(PERL) pariscid.pl $(PERLASM_SCHEME) $@ | 78 | pariscid.s: pariscid.pl; $(PERL) pariscid.pl $(PERLASM_SCHEME) $@ |
| 79 | alphacpuid.s: alphacpuid.pl | 79 | alphacpuid.s: alphacpuid.pl |
| 80 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null | 80 | (preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \ |
| 81 | $(PERL) alphacpuid.pl > $$preproc && \ | ||
| 82 | $(CC) -E $$preproc > $@ && rm $$preproc) | ||
| 81 | 83 | ||
| 82 | testapps: | 84 | testapps: |
| 83 | [ -z "$(THIS)" ] || ( if echo $(SDIRS) | fgrep ' des '; \ | 85 | [ -z "$(THIS)" ] || ( if echo $(SDIRS) | fgrep ' des '; \ |
diff --git a/src/lib/libcrypto/bn/Makefile b/src/lib/libcrypto/bn/Makefile index 672773454c..6dd136be5d 100644 --- a/src/lib/libcrypto/bn/Makefile +++ b/src/lib/libcrypto/bn/Makefile | |||
| @@ -125,7 +125,9 @@ ppc-mont.s: asm/ppc-mont.pl;$(PERL) asm/ppc-mont.pl $(PERLASM_SCHEME) $@ | |||
| 125 | ppc64-mont.s: asm/ppc64-mont.pl;$(PERL) asm/ppc64-mont.pl $(PERLASM_SCHEME) $@ | 125 | ppc64-mont.s: asm/ppc64-mont.pl;$(PERL) asm/ppc64-mont.pl $(PERLASM_SCHEME) $@ |
| 126 | 126 | ||
| 127 | alpha-mont.s: asm/alpha-mont.pl | 127 | alpha-mont.s: asm/alpha-mont.pl |
| 128 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null | 128 | (preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \ |
| 129 | $(PERL) asm/alpha-mont.pl > $$preproc && \ | ||
| 130 | $(CC) -E $$preproc > $@ && rm $$preproc) | ||
| 129 | 131 | ||
| 130 | # GNU make "catch all" | 132 | # GNU make "catch all" |
| 131 | %-mont.s: asm/%-mont.pl; $(PERL) $< $(PERLASM_SCHEME) $@ | 133 | %-mont.s: asm/%-mont.pl; $(PERL) $< $(PERLASM_SCHEME) $@ |
diff --git a/src/lib/libcrypto/ec/ectest.c b/src/lib/libcrypto/ec/ectest.c index f107782de0..102eaa9b23 100644 --- a/src/lib/libcrypto/ec/ectest.c +++ b/src/lib/libcrypto/ec/ectest.c | |||
| @@ -236,7 +236,7 @@ static void group_order_tests(EC_GROUP *group) | |||
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | static void prime_field_tests(void) | 238 | static void prime_field_tests(void) |
| 239 | { | 239 | { |
| 240 | BN_CTX *ctx = NULL; | 240 | BN_CTX *ctx = NULL; |
| 241 | BIGNUM *p, *a, *b; | 241 | BIGNUM *p, *a, *b; |
| 242 | EC_GROUP *group; | 242 | EC_GROUP *group; |
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index 3e7fff1c1e..5a715aca4f 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
| @@ -29,14 +29,16 @@ | |||
| 29 | #include <openssl/objects.h> | 29 | #include <openssl/objects.h> |
| 30 | #include <openssl/engine.h> | 30 | #include <openssl/engine.h> |
| 31 | #include <openssl/evp.h> | 31 | #include <openssl/evp.h> |
| 32 | #include <openssl/bn.h> | ||
| 32 | 33 | ||
| 33 | #if (defined(__unix__) || defined(unix)) && !defined(USG) | 34 | #if (defined(__unix__) || defined(unix)) && !defined(USG) && \ |
| 35 | (defined(OpenBSD) || defined(__FreeBSD__)) | ||
| 34 | #include <sys/param.h> | 36 | #include <sys/param.h> |
| 35 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) | 37 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) |
| 36 | # define HAVE_CRYPTODEV | 38 | # define HAVE_CRYPTODEV |
| 37 | # endif | 39 | # endif |
| 38 | # if (OpenBSD >= 200110) | 40 | # if (OpenBSD >= 200110) |
| 39 | # define HAVE_SYSLOG_R | 41 | # define HAVE_SYSLOG_R |
| 40 | # endif | 42 | # endif |
| 41 | #endif | 43 | #endif |
| 42 | 44 | ||
| @@ -50,9 +52,13 @@ ENGINE_load_cryptodev(void) | |||
| 50 | } | 52 | } |
| 51 | 53 | ||
| 52 | #else | 54 | #else |
| 53 | 55 | ||
| 54 | #include <sys/types.h> | 56 | #include <sys/types.h> |
| 55 | #include <crypto/cryptodev.h> | 57 | #include <crypto/cryptodev.h> |
| 58 | #include <crypto/dh/dh.h> | ||
| 59 | #include <crypto/dsa/dsa.h> | ||
| 60 | #include <crypto/err/err.h> | ||
| 61 | #include <crypto/rsa/rsa.h> | ||
| 56 | #include <sys/ioctl.h> | 62 | #include <sys/ioctl.h> |
| 57 | #include <errno.h> | 63 | #include <errno.h> |
| 58 | #include <stdio.h> | 64 | #include <stdio.h> |
| @@ -66,6 +72,14 @@ ENGINE_load_cryptodev(void) | |||
| 66 | struct dev_crypto_state { | 72 | struct dev_crypto_state { |
| 67 | struct session_op d_sess; | 73 | struct session_op d_sess; |
| 68 | int d_fd; | 74 | int d_fd; |
| 75 | |||
| 76 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 77 | char dummy_mac_key[HASH_MAX_LEN]; | ||
| 78 | |||
| 79 | unsigned char digest_res[HASH_MAX_LEN]; | ||
| 80 | char *mac_data; | ||
| 81 | int mac_len; | ||
| 82 | #endif | ||
| 69 | }; | 83 | }; |
| 70 | 84 | ||
| 71 | static u_int32_t cryptodev_asymfeat = 0; | 85 | static u_int32_t cryptodev_asymfeat = 0; |
| @@ -73,15 +87,14 @@ static u_int32_t cryptodev_asymfeat = 0; | |||
| 73 | static int get_asym_dev_crypto(void); | 87 | static int get_asym_dev_crypto(void); |
| 74 | static int open_dev_crypto(void); | 88 | static int open_dev_crypto(void); |
| 75 | static int get_dev_crypto(void); | 89 | static int get_dev_crypto(void); |
| 76 | static int cryptodev_max_iv(int cipher); | ||
| 77 | static int cryptodev_key_length_valid(int cipher, int len); | ||
| 78 | static int cipher_nid_to_cryptodev(int nid); | ||
| 79 | static int get_cryptodev_ciphers(const int **cnids); | 90 | static int get_cryptodev_ciphers(const int **cnids); |
| 80 | /*static int get_cryptodev_digests(const int **cnids);*/ | 91 | #ifdef USE_CRYPTODEV_DIGESTS |
| 92 | static int get_cryptodev_digests(const int **cnids); | ||
| 93 | #endif | ||
| 81 | static int cryptodev_usable_ciphers(const int **nids); | 94 | static int cryptodev_usable_ciphers(const int **nids); |
| 82 | static int cryptodev_usable_digests(const int **nids); | 95 | static int cryptodev_usable_digests(const int **nids); |
| 83 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 96 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 84 | const unsigned char *in, unsigned int inl); | 97 | const unsigned char *in, size_t inl); |
| 85 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 98 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 86 | const unsigned char *iv, int enc); | 99 | const unsigned char *iv, int enc); |
| 87 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); | 100 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); |
| @@ -98,8 +111,8 @@ static int cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, | |||
| 98 | static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, | 111 | static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, |
| 99 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 112 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
| 100 | static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, | 113 | static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, |
| 101 | RSA *rsa); | 114 | RSA *rsa, BN_CTX *ctx); |
| 102 | static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); | 115 | static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx); |
| 103 | static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, | 116 | static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, |
| 104 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 117 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
| 105 | static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | 118 | static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, |
| @@ -115,7 +128,7 @@ static int cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | |||
| 115 | static int cryptodev_dh_compute_key(unsigned char *key, | 128 | static int cryptodev_dh_compute_key(unsigned char *key, |
| 116 | const BIGNUM *pub_key, DH *dh); | 129 | const BIGNUM *pub_key, DH *dh); |
| 117 | static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, | 130 | static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, |
| 118 | void (*f)()); | 131 | void (*f)(void)); |
| 119 | void ENGINE_load_cryptodev(void); | 132 | void ENGINE_load_cryptodev(void); |
| 120 | 133 | ||
| 121 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { | 134 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { |
| @@ -128,27 +141,32 @@ static struct { | |||
| 128 | int ivmax; | 141 | int ivmax; |
| 129 | int keylen; | 142 | int keylen; |
| 130 | } ciphers[] = { | 143 | } ciphers[] = { |
| 144 | { CRYPTO_ARC4, NID_rc4, 0, 16, }, | ||
| 131 | { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, }, | 145 | { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, }, |
| 132 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, | 146 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, |
| 133 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, | 147 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, |
| 148 | { CRYPTO_AES_CBC, NID_aes_192_cbc, 16, 24, }, | ||
| 149 | { CRYPTO_AES_CBC, NID_aes_256_cbc, 16, 32, }, | ||
| 134 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, | 150 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, |
| 135 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, | 151 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, |
| 136 | { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, }, | 152 | { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, }, |
| 137 | { 0, NID_undef, 0, 0, }, | 153 | { 0, NID_undef, 0, 0, }, |
| 138 | }; | 154 | }; |
| 139 | 155 | ||
| 140 | #if 0 /* UNUSED */ | 156 | #ifdef USE_CRYPTODEV_DIGESTS |
| 141 | static struct { | 157 | static struct { |
| 142 | int id; | 158 | int id; |
| 143 | int nid; | 159 | int nid; |
| 160 | int keylen; | ||
| 144 | } digests[] = { | 161 | } digests[] = { |
| 145 | { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, }, | 162 | { CRYPTO_MD5_HMAC, NID_hmacWithMD5, 16}, |
| 146 | { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, }, | 163 | { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, 20}, |
| 147 | { CRYPTO_MD5_KPDK, NID_undef, }, | 164 | { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, 16/*?*/}, |
| 148 | { CRYPTO_SHA1_KPDK, NID_undef, }, | 165 | { CRYPTO_MD5_KPDK, NID_undef, 0}, |
| 149 | { CRYPTO_MD5, NID_md5, }, | 166 | { CRYPTO_SHA1_KPDK, NID_undef, 0}, |
| 150 | { CRYPTO_SHA1, NID_undef, }, | 167 | { CRYPTO_MD5, NID_md5, 16}, |
| 151 | { 0, NID_undef, }, | 168 | { CRYPTO_SHA1, NID_sha1, 20}, |
| 169 | { 0, NID_undef, 0}, | ||
| 152 | }; | 170 | }; |
| 153 | #endif | 171 | #endif |
| 154 | 172 | ||
| @@ -180,6 +198,7 @@ get_dev_crypto(void) | |||
| 180 | 198 | ||
| 181 | if ((fd = open_dev_crypto()) == -1) | 199 | if ((fd = open_dev_crypto()) == -1) |
| 182 | return (-1); | 200 | return (-1); |
| 201 | #ifndef CRIOGET_NOT_NEEDED | ||
| 183 | if (ioctl(fd, CRIOGET, &retfd) == -1) | 202 | if (ioctl(fd, CRIOGET, &retfd) == -1) |
| 184 | return (-1); | 203 | return (-1); |
| 185 | 204 | ||
| @@ -188,9 +207,19 @@ get_dev_crypto(void) | |||
| 188 | close(retfd); | 207 | close(retfd); |
| 189 | return (-1); | 208 | return (-1); |
| 190 | } | 209 | } |
| 210 | #else | ||
| 211 | retfd = fd; | ||
| 212 | #endif | ||
| 191 | return (retfd); | 213 | return (retfd); |
| 192 | } | 214 | } |
| 193 | 215 | ||
| 216 | static void put_dev_crypto(int fd) | ||
| 217 | { | ||
| 218 | #ifndef CRIOGET_NOT_NEEDED | ||
| 219 | close(fd); | ||
| 220 | #endif | ||
| 221 | } | ||
| 222 | |||
| 194 | /* Caching version for asym operations */ | 223 | /* Caching version for asym operations */ |
| 195 | static int | 224 | static int |
| 196 | get_asym_dev_crypto(void) | 225 | get_asym_dev_crypto(void) |
| @@ -203,50 +232,6 @@ get_asym_dev_crypto(void) | |||
| 203 | } | 232 | } |
| 204 | 233 | ||
| 205 | /* | 234 | /* |
| 206 | * XXXX this needs to be set for each alg - and determined from | ||
| 207 | * a running card. | ||
| 208 | */ | ||
| 209 | static int | ||
| 210 | cryptodev_max_iv(int cipher) | ||
| 211 | { | ||
| 212 | int i; | ||
| 213 | |||
| 214 | for (i = 0; ciphers[i].id; i++) | ||
| 215 | if (ciphers[i].id == cipher) | ||
| 216 | return (ciphers[i].ivmax); | ||
| 217 | return (0); | ||
| 218 | } | ||
| 219 | |||
| 220 | /* | ||
| 221 | * XXXX this needs to be set for each alg - and determined from | ||
| 222 | * a running card. For now, fake it out - but most of these | ||
| 223 | * for real devices should return 1 for the supported key | ||
| 224 | * sizes the device can handle. | ||
| 225 | */ | ||
| 226 | static int | ||
| 227 | cryptodev_key_length_valid(int cipher, int len) | ||
| 228 | { | ||
| 229 | int i; | ||
| 230 | |||
| 231 | for (i = 0; ciphers[i].id; i++) | ||
| 232 | if (ciphers[i].id == cipher) | ||
| 233 | return (ciphers[i].keylen == len); | ||
| 234 | return (0); | ||
| 235 | } | ||
| 236 | |||
| 237 | /* convert libcrypto nids to cryptodev */ | ||
| 238 | static int | ||
| 239 | cipher_nid_to_cryptodev(int nid) | ||
| 240 | { | ||
| 241 | int i; | ||
| 242 | |||
| 243 | for (i = 0; ciphers[i].id; i++) | ||
| 244 | if (ciphers[i].nid == nid) | ||
| 245 | return (ciphers[i].id); | ||
| 246 | return (0); | ||
| 247 | } | ||
| 248 | |||
| 249 | /* | ||
| 250 | * Find out what ciphers /dev/crypto will let us have a session for. | 235 | * Find out what ciphers /dev/crypto will let us have a session for. |
| 251 | * XXX note, that some of these openssl doesn't deal with yet! | 236 | * XXX note, that some of these openssl doesn't deal with yet! |
| 252 | * returning them here is harmless, as long as we return NULL | 237 | * returning them here is harmless, as long as we return NULL |
| @@ -264,7 +249,7 @@ get_cryptodev_ciphers(const int **cnids) | |||
| 264 | return (0); | 249 | return (0); |
| 265 | } | 250 | } |
| 266 | memset(&sess, 0, sizeof(sess)); | 251 | memset(&sess, 0, sizeof(sess)); |
| 267 | sess.key = (caddr_t)"123456781234567812345678"; | 252 | sess.key = (caddr_t)"123456789abcdefghijklmno"; |
| 268 | 253 | ||
| 269 | for (i = 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { | 254 | for (i = 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { |
| 270 | if (ciphers[i].nid == NID_undef) | 255 | if (ciphers[i].nid == NID_undef) |
| @@ -276,7 +261,7 @@ get_cryptodev_ciphers(const int **cnids) | |||
| 276 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) | 261 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) |
| 277 | nids[count++] = ciphers[i].nid; | 262 | nids[count++] = ciphers[i].nid; |
| 278 | } | 263 | } |
| 279 | close(fd); | 264 | put_dev_crypto(fd); |
| 280 | 265 | ||
| 281 | if (count > 0) | 266 | if (count > 0) |
| 282 | *cnids = nids; | 267 | *cnids = nids; |
| @@ -285,13 +270,13 @@ get_cryptodev_ciphers(const int **cnids) | |||
| 285 | return (count); | 270 | return (count); |
| 286 | } | 271 | } |
| 287 | 272 | ||
| 273 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 288 | /* | 274 | /* |
| 289 | * Find out what digests /dev/crypto will let us have a session for. | 275 | * Find out what digests /dev/crypto will let us have a session for. |
| 290 | * XXX note, that some of these openssl doesn't deal with yet! | 276 | * XXX note, that some of these openssl doesn't deal with yet! |
| 291 | * returning them here is harmless, as long as we return NULL | 277 | * returning them here is harmless, as long as we return NULL |
| 292 | * when asked for a handler in the cryptodev_engine_digests routine | 278 | * when asked for a handler in the cryptodev_engine_digests routine |
| 293 | */ | 279 | */ |
| 294 | #if 0 /* UNUSED */ | ||
| 295 | static int | 280 | static int |
| 296 | get_cryptodev_digests(const int **cnids) | 281 | get_cryptodev_digests(const int **cnids) |
| 297 | { | 282 | { |
| @@ -304,16 +289,18 @@ get_cryptodev_digests(const int **cnids) | |||
| 304 | return (0); | 289 | return (0); |
| 305 | } | 290 | } |
| 306 | memset(&sess, 0, sizeof(sess)); | 291 | memset(&sess, 0, sizeof(sess)); |
| 292 | sess.mackey = (caddr_t)"123456789abcdefghijklmno"; | ||
| 307 | for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { | 293 | for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { |
| 308 | if (digests[i].nid == NID_undef) | 294 | if (digests[i].nid == NID_undef) |
| 309 | continue; | 295 | continue; |
| 310 | sess.mac = digests[i].id; | 296 | sess.mac = digests[i].id; |
| 297 | sess.mackeylen = digests[i].keylen; | ||
| 311 | sess.cipher = 0; | 298 | sess.cipher = 0; |
| 312 | if (ioctl(fd, CIOCGSESSION, &sess) != -1 && | 299 | if (ioctl(fd, CIOCGSESSION, &sess) != -1 && |
| 313 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) | 300 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) |
| 314 | nids[count++] = digests[i].nid; | 301 | nids[count++] = digests[i].nid; |
| 315 | } | 302 | } |
| 316 | close(fd); | 303 | put_dev_crypto(fd); |
| 317 | 304 | ||
| 318 | if (count > 0) | 305 | if (count > 0) |
| 319 | *cnids = nids; | 306 | *cnids = nids; |
| @@ -321,7 +308,7 @@ get_cryptodev_digests(const int **cnids) | |||
| 321 | *cnids = NULL; | 308 | *cnids = NULL; |
| 322 | return (count); | 309 | return (count); |
| 323 | } | 310 | } |
| 324 | #endif | 311 | #endif /* 0 */ |
| 325 | 312 | ||
| 326 | /* | 313 | /* |
| 327 | * Find the useable ciphers|digests from dev/crypto - this is the first | 314 | * Find the useable ciphers|digests from dev/crypto - this is the first |
| @@ -353,6 +340,9 @@ cryptodev_usable_ciphers(const int **nids) | |||
| 353 | static int | 340 | static int |
| 354 | cryptodev_usable_digests(const int **nids) | 341 | cryptodev_usable_digests(const int **nids) |
| 355 | { | 342 | { |
| 343 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 344 | return (get_cryptodev_digests(nids)); | ||
| 345 | #else | ||
| 356 | /* | 346 | /* |
| 357 | * XXXX just disable all digests for now, because it sucks. | 347 | * XXXX just disable all digests for now, because it sucks. |
| 358 | * we need a better way to decide this - i.e. I may not | 348 | * we need a better way to decide this - i.e. I may not |
| @@ -367,16 +357,17 @@ cryptodev_usable_digests(const int **nids) | |||
| 367 | */ | 357 | */ |
| 368 | *nids = NULL; | 358 | *nids = NULL; |
| 369 | return (0); | 359 | return (0); |
| 360 | #endif | ||
| 370 | } | 361 | } |
| 371 | 362 | ||
| 372 | static int | 363 | static int |
| 373 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 364 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 374 | const unsigned char *in, unsigned int inl) | 365 | const unsigned char *in, size_t inl) |
| 375 | { | 366 | { |
| 376 | struct crypt_op cryp; | 367 | struct crypt_op cryp; |
| 377 | struct dev_crypto_state *state = ctx->cipher_data; | 368 | struct dev_crypto_state *state = ctx->cipher_data; |
| 378 | struct session_op *sess = &state->d_sess; | 369 | struct session_op *sess = &state->d_sess; |
| 379 | void *iiv; | 370 | const void *iiv; |
| 380 | unsigned char save_iv[EVP_MAX_IV_LENGTH]; | 371 | unsigned char save_iv[EVP_MAX_IV_LENGTH]; |
| 381 | 372 | ||
| 382 | if (state->d_fd < 0) | 373 | if (state->d_fd < 0) |
| @@ -400,7 +391,7 @@ cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 400 | if (ctx->cipher->iv_len) { | 391 | if (ctx->cipher->iv_len) { |
| 401 | cryp.iv = (caddr_t) ctx->iv; | 392 | cryp.iv = (caddr_t) ctx->iv; |
| 402 | if (!ctx->encrypt) { | 393 | if (!ctx->encrypt) { |
| 403 | iiv = (void *) in + inl - ctx->cipher->iv_len; | 394 | iiv = in + inl - ctx->cipher->iv_len; |
| 404 | memcpy(save_iv, iiv, ctx->cipher->iv_len); | 395 | memcpy(save_iv, iiv, ctx->cipher->iv_len); |
| 405 | } | 396 | } |
| 406 | } else | 397 | } else |
| @@ -415,7 +406,7 @@ cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 415 | 406 | ||
| 416 | if (ctx->cipher->iv_len) { | 407 | if (ctx->cipher->iv_len) { |
| 417 | if (ctx->encrypt) | 408 | if (ctx->encrypt) |
| 418 | iiv = (void *) out + inl - ctx->cipher->iv_len; | 409 | iiv = out + inl - ctx->cipher->iv_len; |
| 419 | else | 410 | else |
| 420 | iiv = save_iv; | 411 | iiv = save_iv; |
| 421 | memcpy(ctx->iv, iiv, ctx->cipher->iv_len); | 412 | memcpy(ctx->iv, iiv, ctx->cipher->iv_len); |
| @@ -429,28 +420,32 @@ cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 429 | { | 420 | { |
| 430 | struct dev_crypto_state *state = ctx->cipher_data; | 421 | struct dev_crypto_state *state = ctx->cipher_data; |
| 431 | struct session_op *sess = &state->d_sess; | 422 | struct session_op *sess = &state->d_sess; |
| 432 | int cipher; | 423 | int cipher = -1, i; |
| 433 | 424 | ||
| 434 | if ((cipher = cipher_nid_to_cryptodev(ctx->cipher->nid)) == NID_undef) | 425 | for (i = 0; ciphers[i].id; i++) |
| 435 | return (0); | 426 | if (ctx->cipher->nid == ciphers[i].nid && |
| 436 | 427 | ctx->cipher->iv_len <= ciphers[i].ivmax && | |
| 437 | if (ctx->cipher->iv_len > cryptodev_max_iv(cipher)) | 428 | ctx->key_len == ciphers[i].keylen) { |
| 438 | return (0); | 429 | cipher = ciphers[i].id; |
| 430 | break; | ||
| 431 | } | ||
| 439 | 432 | ||
| 440 | if (!cryptodev_key_length_valid(cipher, ctx->key_len)) | 433 | if (!ciphers[i].id) { |
| 434 | state->d_fd = -1; | ||
| 441 | return (0); | 435 | return (0); |
| 436 | } | ||
| 442 | 437 | ||
| 443 | memset(sess, 0, sizeof(struct session_op)); | 438 | memset(sess, 0, sizeof(struct session_op)); |
| 444 | 439 | ||
| 445 | if ((state->d_fd = get_dev_crypto()) < 0) | 440 | if ((state->d_fd = get_dev_crypto()) < 0) |
| 446 | return (0); | 441 | return (0); |
| 447 | 442 | ||
| 448 | sess->key = (unsigned char *)key; | 443 | sess->key = (caddr_t)key; |
| 449 | sess->keylen = ctx->key_len; | 444 | sess->keylen = ctx->key_len; |
| 450 | sess->cipher = cipher; | 445 | sess->cipher = cipher; |
| 451 | 446 | ||
| 452 | if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) { | 447 | if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) { |
| 453 | close(state->d_fd); | 448 | put_dev_crypto(state->d_fd); |
| 454 | state->d_fd = -1; | 449 | state->d_fd = -1; |
| 455 | return (0); | 450 | return (0); |
| 456 | } | 451 | } |
| @@ -487,7 +482,7 @@ cryptodev_cleanup(EVP_CIPHER_CTX *ctx) | |||
| 487 | } else { | 482 | } else { |
| 488 | ret = 1; | 483 | ret = 1; |
| 489 | } | 484 | } |
| 490 | close(state->d_fd); | 485 | put_dev_crypto(state->d_fd); |
| 491 | state->d_fd = -1; | 486 | state->d_fd = -1; |
| 492 | 487 | ||
| 493 | return (ret); | 488 | return (ret); |
| @@ -498,6 +493,20 @@ cryptodev_cleanup(EVP_CIPHER_CTX *ctx) | |||
| 498 | * gets called when libcrypto requests a cipher NID. | 493 | * gets called when libcrypto requests a cipher NID. |
| 499 | */ | 494 | */ |
| 500 | 495 | ||
| 496 | /* RC4 */ | ||
| 497 | const EVP_CIPHER cryptodev_rc4 = { | ||
| 498 | NID_rc4, | ||
| 499 | 1, 16, 0, | ||
| 500 | EVP_CIPH_VARIABLE_LENGTH, | ||
| 501 | cryptodev_init_key, | ||
| 502 | cryptodev_cipher, | ||
| 503 | cryptodev_cleanup, | ||
| 504 | sizeof(struct dev_crypto_state), | ||
| 505 | NULL, | ||
| 506 | NULL, | ||
| 507 | NULL | ||
| 508 | }; | ||
| 509 | |||
| 501 | /* DES CBC EVP */ | 510 | /* DES CBC EVP */ |
| 502 | const EVP_CIPHER cryptodev_des_cbc = { | 511 | const EVP_CIPHER cryptodev_des_cbc = { |
| 503 | NID_des_cbc, | 512 | NID_des_cbc, |
| @@ -565,6 +574,32 @@ const EVP_CIPHER cryptodev_aes_cbc = { | |||
| 565 | NULL | 574 | NULL |
| 566 | }; | 575 | }; |
| 567 | 576 | ||
| 577 | const EVP_CIPHER cryptodev_aes_192_cbc = { | ||
| 578 | NID_aes_192_cbc, | ||
| 579 | 16, 24, 16, | ||
| 580 | EVP_CIPH_CBC_MODE, | ||
| 581 | cryptodev_init_key, | ||
| 582 | cryptodev_cipher, | ||
| 583 | cryptodev_cleanup, | ||
| 584 | sizeof(struct dev_crypto_state), | ||
| 585 | EVP_CIPHER_set_asn1_iv, | ||
| 586 | EVP_CIPHER_get_asn1_iv, | ||
| 587 | NULL | ||
| 588 | }; | ||
| 589 | |||
| 590 | const EVP_CIPHER cryptodev_aes_256_cbc = { | ||
| 591 | NID_aes_256_cbc, | ||
| 592 | 16, 32, 16, | ||
| 593 | EVP_CIPH_CBC_MODE, | ||
| 594 | cryptodev_init_key, | ||
| 595 | cryptodev_cipher, | ||
| 596 | cryptodev_cleanup, | ||
| 597 | sizeof(struct dev_crypto_state), | ||
| 598 | EVP_CIPHER_set_asn1_iv, | ||
| 599 | EVP_CIPHER_get_asn1_iv, | ||
| 600 | NULL | ||
| 601 | }; | ||
| 602 | |||
| 568 | /* | 603 | /* |
| 569 | * Registered by the ENGINE when used to find out how to deal with | 604 | * Registered by the ENGINE when used to find out how to deal with |
| 570 | * a particular NID in the ENGINE. this says what we'll do at the | 605 | * a particular NID in the ENGINE. this says what we'll do at the |
| @@ -578,6 +613,9 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | |||
| 578 | return (cryptodev_usable_ciphers(nids)); | 613 | return (cryptodev_usable_ciphers(nids)); |
| 579 | 614 | ||
| 580 | switch (nid) { | 615 | switch (nid) { |
| 616 | case NID_rc4: | ||
| 617 | *cipher = &cryptodev_rc4; | ||
| 618 | break; | ||
| 581 | case NID_des_ede3_cbc: | 619 | case NID_des_ede3_cbc: |
| 582 | *cipher = &cryptodev_3des_cbc; | 620 | *cipher = &cryptodev_3des_cbc; |
| 583 | break; | 621 | break; |
| @@ -593,6 +631,12 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | |||
| 593 | case NID_aes_128_cbc: | 631 | case NID_aes_128_cbc: |
| 594 | *cipher = &cryptodev_aes_cbc; | 632 | *cipher = &cryptodev_aes_cbc; |
| 595 | break; | 633 | break; |
| 634 | case NID_aes_192_cbc: | ||
| 635 | *cipher = &cryptodev_aes_192_cbc; | ||
| 636 | break; | ||
| 637 | case NID_aes_256_cbc: | ||
| 638 | *cipher = &cryptodev_aes_256_cbc; | ||
| 639 | break; | ||
| 596 | default: | 640 | default: |
| 597 | *cipher = NULL; | 641 | *cipher = NULL; |
| 598 | break; | 642 | break; |
| @@ -600,6 +644,256 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | |||
| 600 | return (*cipher != NULL); | 644 | return (*cipher != NULL); |
| 601 | } | 645 | } |
| 602 | 646 | ||
| 647 | |||
| 648 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 649 | |||
| 650 | /* convert digest type to cryptodev */ | ||
| 651 | static int | ||
| 652 | digest_nid_to_cryptodev(int nid) | ||
| 653 | { | ||
| 654 | int i; | ||
| 655 | |||
| 656 | for (i = 0; digests[i].id; i++) | ||
| 657 | if (digests[i].nid == nid) | ||
| 658 | return (digests[i].id); | ||
| 659 | return (0); | ||
| 660 | } | ||
| 661 | |||
| 662 | |||
| 663 | static int | ||
| 664 | digest_key_length(int nid) | ||
| 665 | { | ||
| 666 | int i; | ||
| 667 | |||
| 668 | for (i = 0; digests[i].id; i++) | ||
| 669 | if (digests[i].nid == nid) | ||
| 670 | return digests[i].keylen; | ||
| 671 | return (0); | ||
| 672 | } | ||
| 673 | |||
| 674 | |||
| 675 | static int cryptodev_digest_init(EVP_MD_CTX *ctx) | ||
| 676 | { | ||
| 677 | struct dev_crypto_state *state = ctx->md_data; | ||
| 678 | struct session_op *sess = &state->d_sess; | ||
| 679 | int digest; | ||
| 680 | |||
| 681 | if ((digest = digest_nid_to_cryptodev(ctx->digest->type)) == NID_undef){ | ||
| 682 | printf("cryptodev_digest_init: Can't get digest \n"); | ||
| 683 | return (0); | ||
| 684 | } | ||
| 685 | |||
| 686 | memset(state, 0, sizeof(struct dev_crypto_state)); | ||
| 687 | |||
| 688 | if ((state->d_fd = get_dev_crypto()) < 0) { | ||
| 689 | printf("cryptodev_digest_init: Can't get Dev \n"); | ||
| 690 | return (0); | ||
| 691 | } | ||
| 692 | |||
| 693 | sess->mackey = state->dummy_mac_key; | ||
| 694 | sess->mackeylen = digest_key_length(ctx->digest->type); | ||
| 695 | sess->mac = digest; | ||
| 696 | |||
| 697 | if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) { | ||
| 698 | put_dev_crypto(state->d_fd); | ||
| 699 | state->d_fd = -1; | ||
| 700 | printf("cryptodev_digest_init: Open session failed\n"); | ||
| 701 | return (0); | ||
| 702 | } | ||
| 703 | |||
| 704 | return (1); | ||
| 705 | } | ||
| 706 | |||
| 707 | static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data, | ||
| 708 | size_t count) | ||
| 709 | { | ||
| 710 | struct crypt_op cryp; | ||
| 711 | struct dev_crypto_state *state = ctx->md_data; | ||
| 712 | struct session_op *sess = &state->d_sess; | ||
| 713 | |||
| 714 | if (!data || state->d_fd < 0) { | ||
| 715 | printf("cryptodev_digest_update: illegal inputs \n"); | ||
| 716 | return (0); | ||
| 717 | } | ||
| 718 | |||
| 719 | if (!count) { | ||
| 720 | return (0); | ||
| 721 | } | ||
| 722 | |||
| 723 | if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) { | ||
| 724 | /* if application doesn't support one buffer */ | ||
| 725 | state->mac_data = OPENSSL_realloc(state->mac_data, state->mac_len + count); | ||
| 726 | |||
| 727 | if (!state->mac_data) { | ||
| 728 | printf("cryptodev_digest_update: realloc failed\n"); | ||
| 729 | return (0); | ||
| 730 | } | ||
| 731 | |||
| 732 | memcpy(state->mac_data + state->mac_len, data, count); | ||
| 733 | state->mac_len += count; | ||
| 734 | |||
| 735 | return (1); | ||
| 736 | } | ||
| 737 | |||
| 738 | memset(&cryp, 0, sizeof(cryp)); | ||
| 739 | |||
| 740 | cryp.ses = sess->ses; | ||
| 741 | cryp.flags = 0; | ||
| 742 | cryp.len = count; | ||
| 743 | cryp.src = (caddr_t) data; | ||
| 744 | cryp.dst = NULL; | ||
| 745 | cryp.mac = (caddr_t) state->digest_res; | ||
| 746 | if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { | ||
| 747 | printf("cryptodev_digest_update: digest failed\n"); | ||
| 748 | return (0); | ||
| 749 | } | ||
| 750 | return (1); | ||
| 751 | } | ||
| 752 | |||
| 753 | |||
| 754 | static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md) | ||
| 755 | { | ||
| 756 | struct crypt_op cryp; | ||
| 757 | struct dev_crypto_state *state = ctx->md_data; | ||
| 758 | struct session_op *sess = &state->d_sess; | ||
| 759 | |||
| 760 | int ret = 1; | ||
| 761 | |||
| 762 | if (!md || state->d_fd < 0) { | ||
| 763 | printf("cryptodev_digest_final: illegal input\n"); | ||
| 764 | return(0); | ||
| 765 | } | ||
| 766 | |||
| 767 | if (! (ctx->flags & EVP_MD_CTX_FLAG_ONESHOT) ) { | ||
| 768 | /* if application doesn't support one buffer */ | ||
| 769 | memset(&cryp, 0, sizeof(cryp)); | ||
| 770 | cryp.ses = sess->ses; | ||
| 771 | cryp.flags = 0; | ||
| 772 | cryp.len = state->mac_len; | ||
| 773 | cryp.src = state->mac_data; | ||
| 774 | cryp.dst = NULL; | ||
| 775 | cryp.mac = (caddr_t)md; | ||
| 776 | if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { | ||
| 777 | printf("cryptodev_digest_final: digest failed\n"); | ||
| 778 | return (0); | ||
| 779 | } | ||
| 780 | |||
| 781 | return 1; | ||
| 782 | } | ||
| 783 | |||
| 784 | memcpy(md, state->digest_res, ctx->digest->md_size); | ||
| 785 | |||
| 786 | return (ret); | ||
| 787 | } | ||
| 788 | |||
| 789 | |||
| 790 | static int cryptodev_digest_cleanup(EVP_MD_CTX *ctx) | ||
| 791 | { | ||
| 792 | int ret = 1; | ||
| 793 | struct dev_crypto_state *state = ctx->md_data; | ||
| 794 | struct session_op *sess = &state->d_sess; | ||
| 795 | |||
| 796 | if (state == NULL) | ||
| 797 | return 0; | ||
| 798 | |||
| 799 | if (state->d_fd < 0) { | ||
| 800 | printf("cryptodev_digest_cleanup: illegal input\n"); | ||
| 801 | return (0); | ||
| 802 | } | ||
| 803 | |||
| 804 | if (state->mac_data) { | ||
| 805 | OPENSSL_free(state->mac_data); | ||
| 806 | state->mac_data = NULL; | ||
| 807 | state->mac_len = 0; | ||
| 808 | } | ||
| 809 | |||
| 810 | if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) { | ||
| 811 | printf("cryptodev_digest_cleanup: failed to close session\n"); | ||
| 812 | ret = 0; | ||
| 813 | } else { | ||
| 814 | ret = 1; | ||
| 815 | } | ||
| 816 | put_dev_crypto(state->d_fd); | ||
| 817 | state->d_fd = -1; | ||
| 818 | |||
| 819 | return (ret); | ||
| 820 | } | ||
| 821 | |||
| 822 | static int cryptodev_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from) | ||
| 823 | { | ||
| 824 | struct dev_crypto_state *fstate = from->md_data; | ||
| 825 | struct dev_crypto_state *dstate = to->md_data; | ||
| 826 | struct session_op *sess; | ||
| 827 | int digest; | ||
| 828 | |||
| 829 | if (dstate == NULL || fstate == NULL) | ||
| 830 | return 1; | ||
| 831 | |||
| 832 | memcpy(dstate, fstate, sizeof(struct dev_crypto_state)); | ||
| 833 | |||
| 834 | sess = &dstate->d_sess; | ||
| 835 | |||
| 836 | digest = digest_nid_to_cryptodev(to->digest->type); | ||
| 837 | |||
| 838 | sess->mackey = dstate->dummy_mac_key; | ||
| 839 | sess->mackeylen = digest_key_length(to->digest->type); | ||
| 840 | sess->mac = digest; | ||
| 841 | |||
| 842 | dstate->d_fd = get_dev_crypto(); | ||
| 843 | |||
| 844 | if (ioctl(dstate->d_fd, CIOCGSESSION, sess) < 0) { | ||
| 845 | put_dev_crypto(dstate->d_fd); | ||
| 846 | dstate->d_fd = -1; | ||
| 847 | printf("cryptodev_digest_init: Open session failed\n"); | ||
| 848 | return (0); | ||
| 849 | } | ||
| 850 | |||
| 851 | if (fstate->mac_len != 0) { | ||
| 852 | if (fstate->mac_data != NULL) | ||
| 853 | { | ||
| 854 | dstate->mac_data = OPENSSL_malloc(fstate->mac_len); | ||
| 855 | memcpy(dstate->mac_data, fstate->mac_data, fstate->mac_len); | ||
| 856 | dstate->mac_len = fstate->mac_len; | ||
| 857 | } | ||
| 858 | } | ||
| 859 | |||
| 860 | return 1; | ||
| 861 | } | ||
| 862 | |||
| 863 | |||
| 864 | const EVP_MD cryptodev_sha1 = { | ||
| 865 | NID_sha1, | ||
| 866 | NID_undef, | ||
| 867 | SHA_DIGEST_LENGTH, | ||
| 868 | EVP_MD_FLAG_ONESHOT, | ||
| 869 | cryptodev_digest_init, | ||
| 870 | cryptodev_digest_update, | ||
| 871 | cryptodev_digest_final, | ||
| 872 | cryptodev_digest_copy, | ||
| 873 | cryptodev_digest_cleanup, | ||
| 874 | EVP_PKEY_NULL_method, | ||
| 875 | SHA_CBLOCK, | ||
| 876 | sizeof(struct dev_crypto_state), | ||
| 877 | }; | ||
| 878 | |||
| 879 | const EVP_MD cryptodev_md5 = { | ||
| 880 | NID_md5, | ||
| 881 | NID_undef, | ||
| 882 | 16 /* MD5_DIGEST_LENGTH */, | ||
| 883 | EVP_MD_FLAG_ONESHOT, | ||
| 884 | cryptodev_digest_init, | ||
| 885 | cryptodev_digest_update, | ||
| 886 | cryptodev_digest_final, | ||
| 887 | cryptodev_digest_copy, | ||
| 888 | cryptodev_digest_cleanup, | ||
| 889 | EVP_PKEY_NULL_method, | ||
| 890 | 64 /* MD5_CBLOCK */, | ||
| 891 | sizeof(struct dev_crypto_state), | ||
| 892 | }; | ||
| 893 | |||
| 894 | #endif /* USE_CRYPTODEV_DIGESTS */ | ||
| 895 | |||
| 896 | |||
| 603 | static int | 897 | static int |
| 604 | cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | 898 | cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, |
| 605 | const int **nids, int nid) | 899 | const int **nids, int nid) |
| @@ -608,10 +902,15 @@ cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | |||
| 608 | return (cryptodev_usable_digests(nids)); | 902 | return (cryptodev_usable_digests(nids)); |
| 609 | 903 | ||
| 610 | switch (nid) { | 904 | switch (nid) { |
| 905 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 611 | case NID_md5: | 906 | case NID_md5: |
| 612 | *digest = NULL; /* need to make a clean md5 critter */ | 907 | *digest = &cryptodev_md5; |
| 613 | break; | 908 | break; |
| 909 | case NID_sha1: | ||
| 910 | *digest = &cryptodev_sha1; | ||
| 911 | break; | ||
| 614 | default: | 912 | default: |
| 913 | #endif /* USE_CRYPTODEV_DIGESTS */ | ||
| 615 | *digest = NULL; | 914 | *digest = NULL; |
| 616 | break; | 915 | break; |
| 617 | } | 916 | } |
| @@ -639,8 +938,9 @@ bn2crparam(const BIGNUM *a, struct crparam *crp) | |||
| 639 | b = malloc(bytes); | 938 | b = malloc(bytes); |
| 640 | if (b == NULL) | 939 | if (b == NULL) |
| 641 | return (1); | 940 | return (1); |
| 941 | memset(b, 0, bytes); | ||
| 642 | 942 | ||
| 643 | crp->crp_p = b; | 943 | crp->crp_p = (caddr_t) b; |
| 644 | crp->crp_nbits = bits; | 944 | crp->crp_nbits = bits; |
| 645 | 945 | ||
| 646 | for (i = 0, j = 0; i < a->top; i++) { | 946 | for (i = 0, j = 0; i < a->top; i++) { |
| @@ -683,7 +983,7 @@ zapparams(struct crypt_kop *kop) | |||
| 683 | { | 983 | { |
| 684 | int i; | 984 | int i; |
| 685 | 985 | ||
| 686 | for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) { | 986 | for (i = 0; i < kop->crk_iparams + kop->crk_oparams; i++) { |
| 687 | if (kop->crk_param[i].crp_p) | 987 | if (kop->crk_param[i].crp_p) |
| 688 | free(kop->crk_param[i].crp_p); | 988 | free(kop->crk_param[i].crp_p); |
| 689 | kop->crk_param[i].crp_p = NULL; | 989 | kop->crk_param[i].crp_p = NULL; |
| @@ -748,21 +1048,27 @@ cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | |||
| 748 | goto err; | 1048 | goto err; |
| 749 | kop.crk_iparams = 3; | 1049 | kop.crk_iparams = 3; |
| 750 | 1050 | ||
| 751 | if (cryptodev_asym(&kop, BN_num_bytes(m), r, 0, NULL) == -1) { | 1051 | if (cryptodev_asym(&kop, BN_num_bytes(m), r, 0, NULL)) { |
| 1052 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 1053 | printf("OCF asym process failed, Running in software\n"); | ||
| 1054 | ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont); | ||
| 1055 | |||
| 1056 | } else if (ECANCELED == kop.crk_status) { | ||
| 752 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | 1057 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); |
| 1058 | printf("OCF hardware operation cancelled. Running in Software\n"); | ||
| 753 | ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont); | 1059 | ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont); |
| 754 | } | 1060 | } |
| 1061 | /* else cryptodev operation worked ok ==> ret = 1*/ | ||
| 1062 | |||
| 755 | err: | 1063 | err: |
| 756 | zapparams(&kop); | 1064 | zapparams(&kop); |
| 757 | return (ret); | 1065 | return (ret); |
| 758 | } | 1066 | } |
| 759 | 1067 | ||
| 760 | static int | 1068 | static int |
| 761 | cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | 1069 | cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) |
| 762 | { | 1070 | { |
| 763 | int r; | 1071 | int r; |
| 764 | BN_CTX *ctx; | ||
| 765 | |||
| 766 | ctx = BN_CTX_new(); | 1072 | ctx = BN_CTX_new(); |
| 767 | r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL); | 1073 | r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL); |
| 768 | BN_CTX_free(ctx); | 1074 | BN_CTX_free(ctx); |
| @@ -770,7 +1076,7 @@ cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | |||
| 770 | } | 1076 | } |
| 771 | 1077 | ||
| 772 | static int | 1078 | static int |
| 773 | cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | 1079 | cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) |
| 774 | { | 1080 | { |
| 775 | struct crypt_kop kop; | 1081 | struct crypt_kop kop; |
| 776 | int ret = 1; | 1082 | int ret = 1; |
| @@ -797,10 +1103,18 @@ cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | |||
| 797 | goto err; | 1103 | goto err; |
| 798 | kop.crk_iparams = 6; | 1104 | kop.crk_iparams = 6; |
| 799 | 1105 | ||
| 800 | if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL) == -1) { | 1106 | if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL)) { |
| 1107 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 1108 | printf("OCF asym process failed, running in Software\n"); | ||
| 1109 | ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx); | ||
| 1110 | |||
| 1111 | } else if (ECANCELED == kop.crk_status) { | ||
| 801 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | 1112 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); |
| 802 | ret = (*meth->rsa_mod_exp)(r0, I, rsa); | 1113 | printf("OCF hardware operation cancelled. Running in Software\n"); |
| 1114 | ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx); | ||
| 803 | } | 1115 | } |
| 1116 | /* else cryptodev operation worked ok ==> ret = 1*/ | ||
| 1117 | |||
| 804 | err: | 1118 | err: |
| 805 | zapparams(&kop); | 1119 | zapparams(&kop); |
| 806 | return (ret); | 1120 | return (ret); |
| @@ -936,7 +1250,8 @@ cryptodev_dsa_verify(const unsigned char *dgst, int dlen, | |||
| 936 | kop.crk_iparams = 7; | 1250 | kop.crk_iparams = 7; |
| 937 | 1251 | ||
| 938 | if (cryptodev_asym(&kop, 0, NULL, 0, NULL) == 0) { | 1252 | if (cryptodev_asym(&kop, 0, NULL, 0, NULL) == 0) { |
| 939 | dsaret = kop.crk_status; | 1253 | /*OCF success value is 0, if not zero, change dsaret to fail*/ |
| 1254 | if(0 != kop.crk_status) dsaret = 0; | ||
| 940 | } else { | 1255 | } else { |
| 941 | const DSA_METHOD *meth = DSA_OpenSSL(); | 1256 | const DSA_METHOD *meth = DSA_OpenSSL(); |
| 942 | 1257 | ||
| @@ -996,7 +1311,7 @@ cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) | |||
| 996 | goto err; | 1311 | goto err; |
| 997 | kop.crk_iparams = 3; | 1312 | kop.crk_iparams = 3; |
| 998 | 1313 | ||
| 999 | kop.crk_param[3].crp_p = key; | 1314 | kop.crk_param[3].crp_p = (caddr_t) key; |
| 1000 | kop.crk_param[3].crp_nbits = keylen * 8; | 1315 | kop.crk_param[3].crp_nbits = keylen * 8; |
| 1001 | kop.crk_oparams = 1; | 1316 | kop.crk_oparams = 1; |
| 1002 | 1317 | ||
| @@ -1027,7 +1342,7 @@ static DH_METHOD cryptodev_dh = { | |||
| 1027 | * but I expect we'll want some options soon. | 1342 | * but I expect we'll want some options soon. |
| 1028 | */ | 1343 | */ |
| 1029 | static int | 1344 | static int |
| 1030 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | 1345 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) |
| 1031 | { | 1346 | { |
| 1032 | #ifdef HAVE_SYSLOG_R | 1347 | #ifdef HAVE_SYSLOG_R |
| 1033 | struct syslog_data sd = SYSLOG_DATA_INIT; | 1348 | struct syslog_data sd = SYSLOG_DATA_INIT; |
| @@ -1063,11 +1378,11 @@ ENGINE_load_cryptodev(void) | |||
| 1063 | * find out what asymmetric crypto algorithms we support | 1378 | * find out what asymmetric crypto algorithms we support |
| 1064 | */ | 1379 | */ |
| 1065 | if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { | 1380 | if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { |
| 1066 | close(fd); | 1381 | put_dev_crypto(fd); |
| 1067 | ENGINE_free(engine); | 1382 | ENGINE_free(engine); |
| 1068 | return; | 1383 | return; |
| 1069 | } | 1384 | } |
| 1070 | close(fd); | 1385 | put_dev_crypto(fd); |
| 1071 | 1386 | ||
| 1072 | if (!ENGINE_set_id(engine, "cryptodev") || | 1387 | if (!ENGINE_set_id(engine, "cryptodev") || |
| 1073 | !ENGINE_set_name(engine, "BSD cryptodev engine") || | 1388 | !ENGINE_set_name(engine, "BSD cryptodev engine") || |
diff --git a/src/lib/libcrypto/evp/Makefile b/src/lib/libcrypto/evp/Makefile index 0fe1b96bff..5d0c6b7db4 100644 --- a/src/lib/libcrypto/evp/Makefile +++ b/src/lib/libcrypto/evp/Makefile | |||
| @@ -18,7 +18,7 @@ TESTDATA=evptests.txt | |||
| 18 | APPS= | 18 | APPS= |
| 19 | 19 | ||
| 20 | LIB=$(TOP)/libcrypto.a | 20 | LIB=$(TOP)/libcrypto.a |
| 21 | LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \ | 21 | LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c evp_cnf.c \ |
| 22 | e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\ | 22 | e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\ |
| 23 | e_rc4.c e_aes.c names.c e_seed.c \ | 23 | e_rc4.c e_aes.c names.c e_seed.c \ |
| 24 | e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ | 24 | e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ |
| @@ -31,7 +31,7 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \ | |||
| 31 | e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c evp_fips.c \ | 31 | e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c evp_fips.c \ |
| 32 | e_aes_cbc_hmac_sha1.c e_rc4_hmac_md5.c | 32 | e_aes_cbc_hmac_sha1.c e_rc4_hmac_md5.c |
| 33 | 33 | ||
| 34 | LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \ | 34 | LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o evp_cnf.o \ |
| 35 | e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\ | 35 | e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\ |
| 36 | e_rc4.o e_aes.o names.o e_seed.o \ | 36 | e_rc4.o e_aes.o names.o e_seed.o \ |
| 37 | e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \ | 37 | e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \ |
| @@ -67,7 +67,7 @@ files: | |||
| 67 | links: | 67 | links: |
| 68 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | 68 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) |
| 69 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | 69 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) |
| 70 | cp $(TESTDATA) ../../test | 70 | @[ -f $(TESTDATA) ] && cp $(TESTDATA) ../../test && echo "$(TESTDATA) -> ../../test/$(TESTDATA)" |
| 71 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | 71 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) |
| 72 | 72 | ||
| 73 | install: | 73 | install: |
| @@ -356,6 +356,20 @@ evp_acnf.o: ../../include/openssl/opensslconf.h | |||
| 356 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 356 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 357 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 357 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 358 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c | 358 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c |
| 359 | evp_cnf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 360 | evp_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 361 | evp_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 362 | evp_cnf.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 363 | evp_cnf.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 364 | evp_cnf.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 365 | evp_cnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 366 | evp_cnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 367 | evp_cnf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 368 | evp_cnf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 369 | evp_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 370 | evp_cnf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 371 | evp_cnf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 372 | evp_cnf.o: ../../include/openssl/x509v3.h ../cryptlib.h evp_cnf.c | ||
| 359 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h | 373 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h |
| 360 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 374 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 361 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 375 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| @@ -437,28 +451,22 @@ evp_pkey.o: ../asn1/asn1_locl.h ../cryptlib.h evp_pkey.c | |||
| 437 | m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 451 | m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 438 | m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 452 | m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 439 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 453 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 440 | m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 454 | m_dss.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 441 | m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 455 | m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 442 | m_dss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | 456 | m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 443 | m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 457 | m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 444 | m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 445 | m_dss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 446 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 458 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 447 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 459 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 448 | m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 449 | m_dss.o: ../cryptlib.h m_dss.c | 460 | m_dss.o: ../cryptlib.h m_dss.c |
| 450 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 461 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 451 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 462 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 452 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 463 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 453 | m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 464 | m_dss1.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 454 | m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 465 | m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 455 | m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | 466 | m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 456 | m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 467 | m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 457 | m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 458 | m_dss1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 459 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 468 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 460 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 469 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 461 | m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 462 | m_dss1.o: ../cryptlib.h m_dss1.c | 470 | m_dss1.o: ../cryptlib.h m_dss1.c |
| 463 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h | 471 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h |
| 464 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 472 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| @@ -563,16 +571,13 @@ m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | |||
| 563 | m_sha.o: ../cryptlib.h evp_locl.h m_sha.c | 571 | m_sha.o: ../cryptlib.h evp_locl.h m_sha.c |
| 564 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 572 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 565 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 573 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 566 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 574 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 567 | m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 575 | m_sha1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 568 | m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 576 | m_sha1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 569 | m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 577 | m_sha1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 570 | m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 578 | m_sha1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h |
| 571 | m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 572 | m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 573 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 579 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 574 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 580 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 575 | m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 576 | m_sha1.o: ../cryptlib.h m_sha1.c | 581 | m_sha1.o: ../cryptlib.h m_sha1.c |
| 577 | m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h | 582 | m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h |
| 578 | m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 583 | m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c index 21c0011380..1cc62eafd1 100644 --- a/src/lib/libcrypto/mem.c +++ b/src/lib/libcrypto/mem.c | |||
| @@ -121,10 +121,10 @@ static void (*set_debug_options_func)(long) = NULL; | |||
| 121 | static long (*get_debug_options_func)(void) = NULL; | 121 | static long (*get_debug_options_func)(void) = NULL; |
| 122 | #endif | 122 | #endif |
| 123 | 123 | ||
| 124 | |||
| 125 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), | 124 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), |
| 126 | void (*f)(void *)) | 125 | void (*f)(void *)) |
| 127 | { | 126 | { |
| 127 | /* Dummy call just to ensure OPENSSL_init() gets linked in */ | ||
| 128 | OPENSSL_init(); | 128 | OPENSSL_init(); |
| 129 | if (!allow_customize) | 129 | if (!allow_customize) |
| 130 | return 0; | 130 | return 0; |
diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c index fcdd3f2a84..aee1c30b0a 100644 --- a/src/lib/libcrypto/rand/md_rand.c +++ b/src/lib/libcrypto/rand/md_rand.c | |||
| @@ -123,10 +123,10 @@ | |||
| 123 | 123 | ||
| 124 | #include "e_os.h" | 124 | #include "e_os.h" |
| 125 | 125 | ||
| 126 | #include <openssl/crypto.h> | ||
| 126 | #include <openssl/rand.h> | 127 | #include <openssl/rand.h> |
| 127 | #include "rand_lcl.h" | 128 | #include "rand_lcl.h" |
| 128 | 129 | ||
| 129 | #include <openssl/crypto.h> | ||
| 130 | #include <openssl/err.h> | 130 | #include <openssl/err.h> |
| 131 | 131 | ||
| 132 | #ifdef BN_DEBUG | 132 | #ifdef BN_DEBUG |
| @@ -198,6 +198,9 @@ static void ssleay_rand_add(const void *buf, int num, double add) | |||
| 198 | EVP_MD_CTX m; | 198 | EVP_MD_CTX m; |
| 199 | int do_not_lock; | 199 | int do_not_lock; |
| 200 | 200 | ||
| 201 | if (!num) | ||
| 202 | return; | ||
| 203 | |||
| 201 | /* | 204 | /* |
| 202 | * (Based on the rand(3) manpage) | 205 | * (Based on the rand(3) manpage) |
| 203 | * | 206 | * |
| @@ -380,8 +383,11 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo) | |||
| 380 | * are fed into the hash function and the results are kept in the | 383 | * are fed into the hash function and the results are kept in the |
| 381 | * global 'md'. | 384 | * global 'md'. |
| 382 | */ | 385 | */ |
| 383 | 386 | #ifdef OPENSSL_FIPS | |
| 384 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | 387 | /* NB: in FIPS mode we are already under a lock */ |
| 388 | if (!FIPS_mode()) | ||
| 389 | #endif | ||
| 390 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 385 | 391 | ||
| 386 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ | 392 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ |
| 387 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); | 393 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); |
| @@ -460,7 +466,10 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo) | |||
| 460 | 466 | ||
| 461 | /* before unlocking, we must clear 'crypto_lock_rand' */ | 467 | /* before unlocking, we must clear 'crypto_lock_rand' */ |
| 462 | crypto_lock_rand = 0; | 468 | crypto_lock_rand = 0; |
| 463 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | 469 | #ifdef OPENSSL_FIPS |
| 470 | if (!FIPS_mode()) | ||
| 471 | #endif | ||
| 472 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 464 | 473 | ||
| 465 | while (num > 0) | 474 | while (num > 0) |
| 466 | { | 475 | { |
| @@ -512,10 +521,16 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo) | |||
| 512 | MD_Init(&m); | 521 | MD_Init(&m); |
| 513 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); | 522 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); |
| 514 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); | 523 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); |
| 515 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | 524 | #ifdef OPENSSL_FIPS |
| 525 | if (!FIPS_mode()) | ||
| 526 | #endif | ||
| 527 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 516 | MD_Update(&m,md,MD_DIGEST_LENGTH); | 528 | MD_Update(&m,md,MD_DIGEST_LENGTH); |
| 517 | MD_Final(&m,md); | 529 | MD_Final(&m,md); |
| 518 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | 530 | #ifdef OPENSSL_FIPS |
| 531 | if (!FIPS_mode()) | ||
| 532 | #endif | ||
| 533 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 519 | 534 | ||
| 520 | EVP_MD_CTX_cleanup(&m); | 535 | EVP_MD_CTX_cleanup(&m); |
| 521 | if (ok) | 536 | if (ok) |
diff --git a/src/lib/libcrypto/rand/rand_win.c b/src/lib/libcrypto/rand/rand_win.c index 5d134e186b..34ffcd23f9 100644 --- a/src/lib/libcrypto/rand/rand_win.c +++ b/src/lib/libcrypto/rand/rand_win.c | |||
| @@ -750,7 +750,7 @@ static void readscreen(void) | |||
| 750 | int y; /* y-coordinate of screen lines to grab */ | 750 | int y; /* y-coordinate of screen lines to grab */ |
| 751 | int n = 16; /* number of screen lines to grab at a time */ | 751 | int n = 16; /* number of screen lines to grab at a time */ |
| 752 | 752 | ||
| 753 | if (GetVersion() < 0x80000000 && OPENSSL_isservice()>0) | 753 | if (check_winnt() && OPENSSL_isservice()>0) |
| 754 | return; | 754 | return; |
| 755 | 755 | ||
| 756 | /* Create a screen DC and a memory DC compatible to screen DC */ | 756 | /* Create a screen DC and a memory DC compatible to screen DC */ |
diff --git a/src/lib/libcrypto/sha/Makefile b/src/lib/libcrypto/sha/Makefile index 6d191d3936..2eb2b7af99 100644 --- a/src/lib/libcrypto/sha/Makefile +++ b/src/lib/libcrypto/sha/Makefile | |||
| @@ -60,7 +60,9 @@ sha256-armv4.S: asm/sha256-armv4.pl | |||
| 60 | $(PERL) $< $(PERLASM_SCHEME) $@ | 60 | $(PERL) $< $(PERLASM_SCHEME) $@ |
| 61 | 61 | ||
| 62 | sha1-alpha.s: asm/sha1-alpha.pl | 62 | sha1-alpha.s: asm/sha1-alpha.pl |
| 63 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null | 63 | (preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \ |
| 64 | $(PERL) asm/sha1-alpha.pl > $$preproc && \ | ||
| 65 | $(CC) -E $$preproc > $@ && rm $$preproc) | ||
| 64 | 66 | ||
| 65 | # Solaris make has to be explicitly told | 67 | # Solaris make has to be explicitly told |
| 66 | sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $(PERLASM_SCHEME) > $@ | 68 | sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $(PERLASM_SCHEME) > $@ |
diff --git a/src/lib/libcrypto/sha/sha_dgst.c b/src/lib/libcrypto/sha/sha_dgst.c index c946ad827d..fb63b17ff2 100644 --- a/src/lib/libcrypto/sha/sha_dgst.c +++ b/src/lib/libcrypto/sha/sha_dgst.c | |||
| @@ -56,8 +56,8 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <openssl/opensslconf.h> | ||
| 60 | #include <openssl/crypto.h> | 59 | #include <openssl/crypto.h> |
| 60 | #include <openssl/opensslconf.h> | ||
| 61 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) | 61 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) |
| 62 | 62 | ||
| 63 | #undef SHA_1 | 63 | #undef SHA_1 |
diff --git a/src/lib/libcrypto/symhacks.h b/src/lib/libcrypto/symhacks.h index 403f592dcd..bd2f000d59 100644 --- a/src/lib/libcrypto/symhacks.h +++ b/src/lib/libcrypto/symhacks.h | |||
| @@ -193,17 +193,23 @@ | |||
| 193 | #undef SSL_CTX_set_srp_username_callback | 193 | #undef SSL_CTX_set_srp_username_callback |
| 194 | #define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb | 194 | #define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb |
| 195 | #undef ssl_add_clienthello_use_srtp_ext | 195 | #undef ssl_add_clienthello_use_srtp_ext |
| 196 | #define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext | 196 | #define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext |
| 197 | #undef ssl_add_serverhello_use_srtp_ext | 197 | #undef ssl_add_serverhello_use_srtp_ext |
| 198 | #define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext | 198 | #define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext |
| 199 | #undef ssl_parse_clienthello_use_srtp_ext | 199 | #undef ssl_parse_clienthello_use_srtp_ext |
| 200 | #define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext | 200 | #define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext |
| 201 | #undef ssl_parse_serverhello_use_srtp_ext | 201 | #undef ssl_parse_serverhello_use_srtp_ext |
| 202 | #define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext | 202 | #define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext |
| 203 | #undef SSL_CTX_set_next_protos_advertised_cb | 203 | #undef SSL_CTX_set_next_protos_advertised_cb |
| 204 | #define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb | 204 | #define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb |
| 205 | #undef SSL_CTX_set_next_proto_select_cb | 205 | #undef SSL_CTX_set_next_proto_select_cb |
| 206 | #define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb | 206 | #define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb |
| 207 | #undef ssl3_cbc_record_digest_supported | ||
| 208 | #define ssl3_cbc_record_digest_supported ssl3_cbc_record_digest_support | ||
| 209 | #undef ssl_check_clienthello_tlsext_late | ||
| 210 | #define ssl_check_clienthello_tlsext_late ssl_check_clihello_tlsext_late | ||
| 211 | #undef ssl_check_clienthello_tlsext_early | ||
| 212 | #define ssl_check_clienthello_tlsext_early ssl_check_clihello_tlsext_early | ||
| 207 | 213 | ||
| 208 | /* Hack some long ENGINE names */ | 214 | /* Hack some long ENGINE names */ |
| 209 | #undef ENGINE_get_default_BN_mod_exp_crt | 215 | #undef ENGINE_get_default_BN_mod_exp_crt |
| @@ -316,8 +322,6 @@ | |||
| 316 | #define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf | 322 | #define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf |
| 317 | #undef ec_GFp_simple_points_make_affine | 323 | #undef ec_GFp_simple_points_make_affine |
| 318 | #define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine | 324 | #define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine |
| 319 | #undef ec_GFp_simple_group_get_curve_GFp | ||
| 320 | #define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp | ||
| 321 | #undef ec_GFp_simple_set_Jprojective_coordinates_GFp | 325 | #undef ec_GFp_simple_set_Jprojective_coordinates_GFp |
| 322 | #define ec_GFp_simple_set_Jprojective_coordinates_GFp \ | 326 | #define ec_GFp_simple_set_Jprojective_coordinates_GFp \ |
| 323 | ec_GFp_smp_set_Jproj_coords_GFp | 327 | ec_GFp_smp_set_Jproj_coords_GFp |
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num index 93f80ba0c6..aa86b2b8b1 100644 --- a/src/lib/libcrypto/util/libeay.num +++ b/src/lib/libcrypto/util/libeay.num | |||
| @@ -3510,6 +3510,8 @@ BIO_get_callback_arg 3902 EXIST::FUNCTION: | |||
| 3510 | BIO_set_callback 3903 EXIST::FUNCTION: | 3510 | BIO_set_callback 3903 EXIST::FUNCTION: |
| 3511 | d2i_ASIdOrRange 3904 EXIST::FUNCTION:RFC3779 | 3511 | d2i_ASIdOrRange 3904 EXIST::FUNCTION:RFC3779 |
| 3512 | i2d_ASIdentifiers 3905 EXIST::FUNCTION:RFC3779 | 3512 | i2d_ASIdentifiers 3905 EXIST::FUNCTION:RFC3779 |
| 3513 | CRYPTO_memcmp 3906 EXIST::FUNCTION: | ||
| 3514 | BN_consttime_swap 3907 EXIST::FUNCTION: | ||
| 3513 | SEED_decrypt 3908 EXIST::FUNCTION:SEED | 3515 | SEED_decrypt 3908 EXIST::FUNCTION:SEED |
| 3514 | SEED_encrypt 3909 EXIST::FUNCTION:SEED | 3516 | SEED_encrypt 3909 EXIST::FUNCTION:SEED |
| 3515 | SEED_cbc_encrypt 3910 EXIST::FUNCTION:SEED | 3517 | SEED_cbc_encrypt 3910 EXIST::FUNCTION:SEED |
| @@ -3687,7 +3689,7 @@ FIPS_dh_new 4073 NOEXIST::FUNCTION: | |||
| 3687 | FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION: | 3689 | FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION: |
| 3688 | FIPS_dh_free 4075 NOEXIST::FUNCTION: | 3690 | FIPS_dh_free 4075 NOEXIST::FUNCTION: |
| 3689 | fips_pkey_signature_test 4076 NOEXIST::FUNCTION: | 3691 | fips_pkey_signature_test 4076 NOEXIST::FUNCTION: |
| 3690 | EVP_add_alg_module 4077 NOEXIST::FUNCTION: | 3692 | EVP_add_alg_module 4077 EXIST::FUNCTION: |
| 3691 | int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION: | 3693 | int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION: |
| 3692 | int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION: | 3694 | int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION: |
| 3693 | int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION: | 3695 | int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION: |
diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl index 1f1e13fb40..b41bb45e82 100644 --- a/src/lib/libcrypto/util/pl/BC-32.pl +++ b/src/lib/libcrypto/util/pl/BC-32.pl | |||
| @@ -18,7 +18,7 @@ $out_def="out32"; | |||
| 18 | $tmp_def="tmp32"; | 18 | $tmp_def="tmp32"; |
| 19 | $inc_def="inc32"; | 19 | $inc_def="inc32"; |
| 20 | #enable max error messages, disable most common warnings | 20 | #enable max error messages, disable most common warnings |
| 21 | $cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp "; | 21 | $cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp -D_timeb=timeb -D_ftime=ftime "; |
| 22 | if ($debug) | 22 | if ($debug) |
| 23 | { | 23 | { |
| 24 | $cflags.="-Od -y -v -vi- -D_DEBUG"; | 24 | $cflags.="-Od -y -v -vi- -D_DEBUG"; |
| @@ -38,7 +38,7 @@ $efile=""; | |||
| 38 | $exep='.exe'; | 38 | $exep='.exe'; |
| 39 | if ($no_sock) | 39 | if ($no_sock) |
| 40 | { $ex_libs=""; } | 40 | { $ex_libs=""; } |
| 41 | else { $ex_libs="cw32mt.lib import32.lib"; } | 41 | else { $ex_libs="cw32mt.lib import32.lib crypt32.lib ws2_32.lib"; } |
| 42 | 42 | ||
| 43 | # static library stuff | 43 | # static library stuff |
| 44 | $mklib='tlib /P64'; | 44 | $mklib='tlib /P64'; |
| @@ -51,8 +51,8 @@ $lfile=''; | |||
| 51 | $shlib_ex_obj=""; | 51 | $shlib_ex_obj=""; |
| 52 | $app_ex_obj="c0x32.obj"; | 52 | $app_ex_obj="c0x32.obj"; |
| 53 | 53 | ||
| 54 | $asm='nasmw -f obj -d__omf__'; | 54 | $asm=(`nasm -v 2>NUL` ge `nasmw -v 2>NUL`?"nasm":"nasmw")." -f obj -d__omf__"; |
| 55 | $asm.=" /Zi" if $debug; | 55 | $asm.=" -g" if $debug; |
| 56 | $afile='-o'; | 56 | $afile='-o'; |
| 57 | 57 | ||
| 58 | $bn_mulw_obj=''; | 58 | $bn_mulw_obj=''; |
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl index c503bd52b9..3705fc73b7 100644 --- a/src/lib/libcrypto/util/pl/VC-32.pl +++ b/src/lib/libcrypto/util/pl/VC-32.pl | |||
| @@ -27,6 +27,8 @@ $zlib_lib="zlib1.lib"; | |||
| 27 | $l_flags =~ s/-L("\[^"]+")/\/libpath:$1/g; | 27 | $l_flags =~ s/-L("\[^"]+")/\/libpath:$1/g; |
| 28 | $l_flags =~ s/-L(\S+)/\/libpath:$1/g; | 28 | $l_flags =~ s/-L(\S+)/\/libpath:$1/g; |
| 29 | 29 | ||
| 30 | my $ff = ""; | ||
| 31 | |||
| 30 | # C compiler stuff | 32 | # C compiler stuff |
| 31 | $cc='cl'; | 33 | $cc='cl'; |
| 32 | if ($FLAVOR =~ /WIN64/) | 34 | if ($FLAVOR =~ /WIN64/) |
| @@ -118,7 +120,7 @@ elsif ($FLAVOR =~ /CE/) | |||
| 118 | $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'})); | 120 | $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'})); |
| 119 | $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'})); | 121 | $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'})); |
| 120 | $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... | 122 | $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... |
| 121 | $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG'; | 123 | $dbg_cflags=' /MC /Od -DDEBUG -D_DEBUG'; |
| 122 | $lflags="/nologo /opt:ref $wcelflag"; | 124 | $lflags="/nologo /opt:ref $wcelflag"; |
| 123 | } | 125 | } |
| 124 | else # Win32 | 126 | else # Win32 |
| @@ -126,6 +128,7 @@ else # Win32 | |||
| 126 | $base_cflags= " $mf_cflag"; | 128 | $base_cflags= " $mf_cflag"; |
| 127 | my $f = $shlib || $fips ?' /MD':' /MT'; | 129 | my $f = $shlib || $fips ?' /MD':' /MT'; |
| 128 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib | 130 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib |
| 131 | $ff = "/fixed"; | ||
| 129 | $opt_cflags=$f.' /Ox /O2 /Ob2'; | 132 | $opt_cflags=$f.' /Ox /O2 /Ob2'; |
| 130 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; | 133 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; |
| 131 | $lflags="/nologo /subsystem:console /opt:ref"; | 134 | $lflags="/nologo /subsystem:console /opt:ref"; |
| @@ -318,7 +321,7 @@ sub do_lib_rule | |||
| 318 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; | 321 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; |
| 319 | $ret.="\tSET FIPS_TARGET=$target\n"; | 322 | $ret.="\tSET FIPS_TARGET=$target\n"; |
| 320 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; | 323 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; |
| 321 | $ret.="\t\$(FIPSLINK) \$(MLFLAGS) /map $base_arg $efile$target "; | 324 | $ret.="\t\$(FIPSLINK) \$(MLFLAGS) $ff /map $base_arg $efile$target "; |
| 322 | $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs \$(EX_LIBS) "; | 325 | $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs \$(EX_LIBS) "; |
| 323 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n"; | 326 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n"; |
| 324 | } | 327 | } |
| @@ -355,7 +358,7 @@ sub do_link_rule | |||
| 355 | $ret.="\tSET FIPS_TARGET=$target\n"; | 358 | $ret.="\tSET FIPS_TARGET=$target\n"; |
| 356 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; | 359 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; |
| 357 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; | 360 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; |
| 358 | $ret.="\t\$(FIPSLINK) \$(LFLAGS) /map $efile$target @<<\n"; | 361 | $ret.="\t\$(FIPSLINK) \$(LFLAGS) $ff /map $efile$target @<<\n"; |
| 359 | $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n"; | 362 | $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n"; |
| 360 | } | 363 | } |
| 361 | else | 364 | else |
diff --git a/src/lib/libcrypto/util/shlib_wrap.sh b/src/lib/libcrypto/util/shlib_wrap.sh index 9416d593d2..8775cb5411 100755 --- a/src/lib/libcrypto/util/shlib_wrap.sh +++ b/src/lib/libcrypto/util/shlib_wrap.sh | |||
| @@ -90,4 +90,8 @@ fi | |||
| 90 | 90 | ||
| 91 | cmd="$1${EXE_EXT}" | 91 | cmd="$1${EXE_EXT}" |
| 92 | shift | 92 | shift |
| 93 | exec "$cmd" "$@" | 93 | if [ $# -eq 0 ]; then |
| 94 | exec "$cmd" # old sh, such as Tru64 4.x, fails to expand empty "$@" | ||
| 95 | else | ||
| 96 | exec "$cmd" "$@" | ||
| 97 | fi | ||
diff --git a/src/lib/libssl/src/CHANGES b/src/lib/libssl/src/CHANGES index 7013e4c12c..4fcfd1d4be 100644 --- a/src/lib/libssl/src/CHANGES +++ b/src/lib/libssl/src/CHANGES | |||
| @@ -2,6 +2,104 @@ | |||
| 2 | OpenSSL CHANGES | 2 | OpenSSL CHANGES |
| 3 | _______________ | 3 | _______________ |
| 4 | 4 | ||
| 5 | Changes between 1.0.1f and 1.0.1g [7 Apr 2014] | ||
| 6 | |||
| 7 | *) A missing bounds check in the handling of the TLS heartbeat extension | ||
| 8 | can be used to reveal up to 64k of memory to a connected client or | ||
| 9 | server. | ||
| 10 | |||
| 11 | Thanks for Neel Mehta of Google Security for discovering this bug and to | ||
| 12 | Adam Langley <agl@chromium.org> and Bodo Moeller <bmoeller@acm.org> for | ||
| 13 | preparing the fix (CVE-2014-0160) | ||
| 14 | [Adam Langley, Bodo Moeller] | ||
| 15 | |||
| 16 | *) Fix for the attack described in the paper "Recovering OpenSSL | ||
| 17 | ECDSA Nonces Using the FLUSH+RELOAD Cache Side-channel Attack" | ||
| 18 | by Yuval Yarom and Naomi Benger. Details can be obtained from: | ||
| 19 | http://eprint.iacr.org/2014/140 | ||
| 20 | |||
| 21 | Thanks to Yuval Yarom and Naomi Benger for discovering this | ||
| 22 | flaw and to Yuval Yarom for supplying a fix (CVE-2014-0076) | ||
| 23 | [Yuval Yarom and Naomi Benger] | ||
| 24 | |||
| 25 | *) TLS pad extension: draft-agl-tls-padding-03 | ||
| 26 | |||
| 27 | Workaround for the "TLS hang bug" (see FAQ and PR#2771): if the | ||
| 28 | TLS client Hello record length value would otherwise be > 255 and | ||
| 29 | less that 512 pad with a dummy extension containing zeroes so it | ||
| 30 | is at least 512 bytes long. | ||
| 31 | |||
| 32 | [Adam Langley, Steve Henson] | ||
| 33 | |||
| 34 | Changes between 1.0.1e and 1.0.1f [6 Jan 2014] | ||
| 35 | |||
| 36 | *) Fix for TLS record tampering bug. A carefully crafted invalid | ||
| 37 | handshake could crash OpenSSL with a NULL pointer exception. | ||
| 38 | Thanks to Anton Johansson for reporting this issues. | ||
| 39 | (CVE-2013-4353) | ||
| 40 | |||
| 41 | *) Keep original DTLS digest and encryption contexts in retransmission | ||
| 42 | structures so we can use the previous session parameters if they need | ||
| 43 | to be resent. (CVE-2013-6450) | ||
| 44 | [Steve Henson] | ||
| 45 | |||
| 46 | *) Add option SSL_OP_SAFARI_ECDHE_ECDSA_BUG (part of SSL_OP_ALL) which | ||
| 47 | avoids preferring ECDHE-ECDSA ciphers when the client appears to be | ||
| 48 | Safari on OS X. Safari on OS X 10.8..10.8.3 advertises support for | ||
| 49 | several ECDHE-ECDSA ciphers, but fails to negotiate them. The bug | ||
| 50 | is fixed in OS X 10.8.4, but Apple have ruled out both hot fixing | ||
| 51 | 10.8..10.8.3 and forcing users to upgrade to 10.8.4 or newer. | ||
| 52 | [Rob Stradling, Adam Langley] | ||
| 53 | |||
| 54 | Changes between 1.0.1d and 1.0.1e [11 Feb 2013] | ||
| 55 | |||
| 56 | *) Correct fix for CVE-2013-0169. The original didn't work on AES-NI | ||
| 57 | supporting platforms or when small records were transferred. | ||
| 58 | [Andy Polyakov, Steve Henson] | ||
| 59 | |||
| 60 | Changes between 1.0.1c and 1.0.1d [5 Feb 2013] | ||
| 61 | |||
| 62 | *) Make the decoding of SSLv3, TLS and DTLS CBC records constant time. | ||
| 63 | |||
| 64 | This addresses the flaw in CBC record processing discovered by | ||
| 65 | Nadhem Alfardan and Kenny Paterson. Details of this attack can be found | ||
| 66 | at: http://www.isg.rhul.ac.uk/tls/ | ||
| 67 | |||
| 68 | Thanks go to Nadhem Alfardan and Kenny Paterson of the Information | ||
| 69 | Security Group at Royal Holloway, University of London | ||
| 70 | (www.isg.rhul.ac.uk) for discovering this flaw and Adam Langley and | ||
| 71 | Emilia Käsper for the initial patch. | ||
| 72 | (CVE-2013-0169) | ||
| 73 | [Emilia Käsper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson] | ||
| 74 | |||
| 75 | *) Fix flaw in AESNI handling of TLS 1.2 and 1.1 records for CBC mode | ||
| 76 | ciphersuites which can be exploited in a denial of service attack. | ||
| 77 | Thanks go to and to Adam Langley <agl@chromium.org> for discovering | ||
| 78 | and detecting this bug and to Wolfgang Ettlinger | ||
| 79 | <wolfgang.ettlinger@gmail.com> for independently discovering this issue. | ||
| 80 | (CVE-2012-2686) | ||
| 81 | [Adam Langley] | ||
| 82 | |||
| 83 | *) Return an error when checking OCSP signatures when key is NULL. | ||
| 84 | This fixes a DoS attack. (CVE-2013-0166) | ||
| 85 | [Steve Henson] | ||
| 86 | |||
| 87 | *) Make openssl verify return errors. | ||
| 88 | [Chris Palmer <palmer@google.com> and Ben Laurie] | ||
| 89 | |||
| 90 | *) Call OCSP Stapling callback after ciphersuite has been chosen, so | ||
| 91 | the right response is stapled. Also change SSL_get_certificate() | ||
| 92 | so it returns the certificate actually sent. | ||
| 93 | See http://rt.openssl.org/Ticket/Display.html?id=2836. | ||
| 94 | [Rob Stradling <rob.stradling@comodo.com>] | ||
| 95 | |||
| 96 | *) Fix possible deadlock when decoding public keys. | ||
| 97 | [Steve Henson] | ||
| 98 | |||
| 99 | *) Don't use TLS 1.0 record version number in initial client hello | ||
| 100 | if renegotiating. | ||
| 101 | [Steve Henson] | ||
| 102 | |||
| 5 | Changes between 1.0.1b and 1.0.1c [10 May 2012] | 103 | Changes between 1.0.1b and 1.0.1c [10 May 2012] |
| 6 | 104 | ||
| 7 | *) Sanity check record length before skipping explicit IV in TLS | 105 | *) Sanity check record length before skipping explicit IV in TLS |
| @@ -357,6 +455,63 @@ | |||
| 357 | Add command line options to s_client/s_server. | 455 | Add command line options to s_client/s_server. |
| 358 | [Steve Henson] | 456 | [Steve Henson] |
| 359 | 457 | ||
| 458 | Changes between 1.0.0j and 1.0.0k [5 Feb 2013] | ||
| 459 | |||
| 460 | *) Make the decoding of SSLv3, TLS and DTLS CBC records constant time. | ||
| 461 | |||
| 462 | This addresses the flaw in CBC record processing discovered by | ||
| 463 | Nadhem Alfardan and Kenny Paterson. Details of this attack can be found | ||
| 464 | at: http://www.isg.rhul.ac.uk/tls/ | ||
| 465 | |||
| 466 | Thanks go to Nadhem Alfardan and Kenny Paterson of the Information | ||
| 467 | Security Group at Royal Holloway, University of London | ||
| 468 | (www.isg.rhul.ac.uk) for discovering this flaw and Adam Langley and | ||
| 469 | Emilia Käsper for the initial patch. | ||
| 470 | (CVE-2013-0169) | ||
| 471 | [Emilia Käsper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson] | ||
| 472 | |||
| 473 | *) Return an error when checking OCSP signatures when key is NULL. | ||
| 474 | This fixes a DoS attack. (CVE-2013-0166) | ||
| 475 | [Steve Henson] | ||
| 476 | |||
| 477 | *) Call OCSP Stapling callback after ciphersuite has been chosen, so | ||
| 478 | the right response is stapled. Also change SSL_get_certificate() | ||
| 479 | so it returns the certificate actually sent. | ||
| 480 | See http://rt.openssl.org/Ticket/Display.html?id=2836. | ||
| 481 | (This is a backport) | ||
| 482 | [Rob Stradling <rob.stradling@comodo.com>] | ||
| 483 | |||
| 484 | *) Fix possible deadlock when decoding public keys. | ||
| 485 | [Steve Henson] | ||
| 486 | |||
| 487 | Changes between 1.0.0i and 1.0.0j [10 May 2012] | ||
| 488 | |||
| 489 | [NB: OpenSSL 1.0.0i and later 1.0.0 patch levels were released after | ||
| 490 | OpenSSL 1.0.1.] | ||
| 491 | |||
| 492 | *) Sanity check record length before skipping explicit IV in DTLS | ||
| 493 | to fix DoS attack. | ||
| 494 | |||
| 495 | Thanks to Codenomicon for discovering this issue using Fuzz-o-Matic | ||
| 496 | fuzzing as a service testing platform. | ||
| 497 | (CVE-2012-2333) | ||
| 498 | [Steve Henson] | ||
| 499 | |||
| 500 | *) Initialise tkeylen properly when encrypting CMS messages. | ||
| 501 | Thanks to Solar Designer of Openwall for reporting this issue. | ||
| 502 | [Steve Henson] | ||
| 503 | |||
| 504 | Changes between 1.0.0h and 1.0.0i [19 Apr 2012] | ||
| 505 | |||
| 506 | *) Check for potentially exploitable overflows in asn1_d2i_read_bio | ||
| 507 | BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer | ||
| 508 | in CRYPTO_realloc_clean. | ||
| 509 | |||
| 510 | Thanks to Tavis Ormandy, Google Security Team, for discovering this | ||
| 511 | issue and to Adam Langley <agl@chromium.org> for fixing it. | ||
| 512 | (CVE-2012-2110) | ||
| 513 | [Adam Langley (Google), Tavis Ormandy, Google Security Team] | ||
| 514 | |||
| 360 | Changes between 1.0.0g and 1.0.0h [12 Mar 2012] | 515 | Changes between 1.0.0g and 1.0.0h [12 Mar 2012] |
| 361 | 516 | ||
| 362 | *) Fix MMA (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) weakness | 517 | *) Fix MMA (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) weakness |
| @@ -1347,6 +1502,86 @@ | |||
| 1347 | *) Change 'Configure' script to enable Camellia by default. | 1502 | *) Change 'Configure' script to enable Camellia by default. |
| 1348 | [NTT] | 1503 | [NTT] |
| 1349 | 1504 | ||
| 1505 | Changes between 0.9.8x and 0.9.8y [5 Feb 2013] | ||
| 1506 | |||
| 1507 | *) Make the decoding of SSLv3, TLS and DTLS CBC records constant time. | ||
| 1508 | |||
| 1509 | This addresses the flaw in CBC record processing discovered by | ||
| 1510 | Nadhem Alfardan and Kenny Paterson. Details of this attack can be found | ||
| 1511 | at: http://www.isg.rhul.ac.uk/tls/ | ||
| 1512 | |||
| 1513 | Thanks go to Nadhem Alfardan and Kenny Paterson of the Information | ||
| 1514 | Security Group at Royal Holloway, University of London | ||
| 1515 | (www.isg.rhul.ac.uk) for discovering this flaw and Adam Langley and | ||
| 1516 | Emilia Käsper for the initial patch. | ||
| 1517 | (CVE-2013-0169) | ||
| 1518 | [Emilia Käsper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson] | ||
| 1519 | |||
| 1520 | *) Return an error when checking OCSP signatures when key is NULL. | ||
| 1521 | This fixes a DoS attack. (CVE-2013-0166) | ||
| 1522 | [Steve Henson] | ||
| 1523 | |||
| 1524 | *) Call OCSP Stapling callback after ciphersuite has been chosen, so | ||
| 1525 | the right response is stapled. Also change SSL_get_certificate() | ||
| 1526 | so it returns the certificate actually sent. | ||
| 1527 | See http://rt.openssl.org/Ticket/Display.html?id=2836. | ||
| 1528 | (This is a backport) | ||
| 1529 | [Rob Stradling <rob.stradling@comodo.com>] | ||
| 1530 | |||
| 1531 | *) Fix possible deadlock when decoding public keys. | ||
| 1532 | [Steve Henson] | ||
| 1533 | |||
| 1534 | Changes between 0.9.8w and 0.9.8x [10 May 2012] | ||
| 1535 | |||
| 1536 | *) Sanity check record length before skipping explicit IV in DTLS | ||
| 1537 | to fix DoS attack. | ||
| 1538 | |||
| 1539 | Thanks to Codenomicon for discovering this issue using Fuzz-o-Matic | ||
| 1540 | fuzzing as a service testing platform. | ||
| 1541 | (CVE-2012-2333) | ||
| 1542 | [Steve Henson] | ||
| 1543 | |||
| 1544 | *) Initialise tkeylen properly when encrypting CMS messages. | ||
| 1545 | Thanks to Solar Designer of Openwall for reporting this issue. | ||
| 1546 | [Steve Henson] | ||
| 1547 | |||
| 1548 | Changes between 0.9.8v and 0.9.8w [23 Apr 2012] | ||
| 1549 | |||
| 1550 | *) The fix for CVE-2012-2110 did not take into account that the | ||
| 1551 | 'len' argument to BUF_MEM_grow and BUF_MEM_grow_clean is an | ||
| 1552 | int in OpenSSL 0.9.8, making it still vulnerable. Fix by | ||
| 1553 | rejecting negative len parameter. (CVE-2012-2131) | ||
| 1554 | [Tomas Hoger <thoger@redhat.com>] | ||
| 1555 | |||
| 1556 | Changes between 0.9.8u and 0.9.8v [19 Apr 2012] | ||
| 1557 | |||
| 1558 | *) Check for potentially exploitable overflows in asn1_d2i_read_bio | ||
| 1559 | BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer | ||
| 1560 | in CRYPTO_realloc_clean. | ||
| 1561 | |||
| 1562 | Thanks to Tavis Ormandy, Google Security Team, for discovering this | ||
| 1563 | issue and to Adam Langley <agl@chromium.org> for fixing it. | ||
| 1564 | (CVE-2012-2110) | ||
| 1565 | [Adam Langley (Google), Tavis Ormandy, Google Security Team] | ||
| 1566 | |||
| 1567 | Changes between 0.9.8t and 0.9.8u [12 Mar 2012] | ||
| 1568 | |||
| 1569 | *) Fix MMA (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) weakness | ||
| 1570 | in CMS and PKCS7 code. When RSA decryption fails use a random key for | ||
| 1571 | content decryption and always return the same error. Note: this attack | ||
| 1572 | needs on average 2^20 messages so it only affects automated senders. The | ||
| 1573 | old behaviour can be reenabled in the CMS code by setting the | ||
| 1574 | CMS_DEBUG_DECRYPT flag: this is useful for debugging and testing where | ||
| 1575 | an MMA defence is not necessary. | ||
| 1576 | Thanks to Ivan Nestlerode <inestlerode@us.ibm.com> for discovering | ||
| 1577 | this issue. (CVE-2012-0884) | ||
| 1578 | [Steve Henson] | ||
| 1579 | |||
| 1580 | *) Fix CVE-2011-4619: make sure we really are receiving a | ||
| 1581 | client hello before rejecting multiple SGC restarts. Thanks to | ||
| 1582 | Ivan Nestlerode <inestlerode@us.ibm.com> for discovering this bug. | ||
| 1583 | [Steve Henson] | ||
| 1584 | |||
| 1350 | Changes between 0.9.8s and 0.9.8t [18 Jan 2012] | 1585 | Changes between 0.9.8s and 0.9.8t [18 Jan 2012] |
| 1351 | 1586 | ||
| 1352 | *) Fix for DTLS DoS issue introduced by fix for CVE-2011-4109. | 1587 | *) Fix for DTLS DoS issue introduced by fix for CVE-2011-4109. |
| @@ -1354,7 +1589,7 @@ | |||
| 1354 | Development, Cisco Systems, Inc. for discovering this bug and | 1589 | Development, Cisco Systems, Inc. for discovering this bug and |
| 1355 | preparing a fix. (CVE-2012-0050) | 1590 | preparing a fix. (CVE-2012-0050) |
| 1356 | [Antonio Martin] | 1591 | [Antonio Martin] |
| 1357 | 1592 | ||
| 1358 | Changes between 0.9.8r and 0.9.8s [4 Jan 2012] | 1593 | Changes between 0.9.8r and 0.9.8s [4 Jan 2012] |
| 1359 | 1594 | ||
| 1360 | *) Nadhem Alfardan and Kenny Paterson have discovered an extension | 1595 | *) Nadhem Alfardan and Kenny Paterson have discovered an extension |
diff --git a/src/lib/libssl/src/Configure b/src/lib/libssl/src/Configure index cbbf4de8b2..de78469b9f 100644 --- a/src/lib/libssl/src/Configure +++ b/src/lib/libssl/src/Configure | |||
| @@ -171,20 +171,22 @@ my %table=( | |||
| 171 | "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)::::", | 171 | "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)::::", |
| 172 | "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)::::", | 172 | "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)::::", |
| 173 | "debug-ben-debug", "gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::", | 173 | "debug-ben-debug", "gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::", |
| 174 | "debug-ben-debug-64", "gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | ||
| 174 | "debug-ben-macos", "cc:$gcc_devteam_warn -arch i386 -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::-Wl,-search_paths_first::::", | 175 | "debug-ben-macos", "cc:$gcc_devteam_warn -arch i386 -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::-Wl,-search_paths_first::::", |
| 175 | "debug-ben-macos-gcc46", "gcc-mp-4.6:$gcc_devteam_warn -Wconversion -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::::::", | 176 | "debug-ben-macos-gcc46", "gcc-mp-4.6:$gcc_devteam_warn -Wconversion -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::::::", |
| 177 | "debug-ben-darwin64","cc:$gcc_devteam_warn -Wno-language-extension-token -Wno-extended-offsetof -arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", | ||
| 176 | "debug-ben-no-opt", "gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::", | 178 | "debug-ben-no-opt", "gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::", |
| 177 | "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)::::::", | 179 | "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)::::::", |
| 178 | "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", | 180 | "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", |
| 179 | "debug-bodo", "gcc:$gcc_devteam_warn -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", | 181 | "debug-bodo", "gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", |
| 180 | "debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll", | 182 | "debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll", |
| 181 | "debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 183 | "debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -Wno-overlength-strings -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 182 | "debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 184 | "debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 183 | "debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 185 | "debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 184 | "debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 186 | "debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 185 | "debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 187 | "debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 186 | "debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 188 | "debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 187 | "debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 189 | "debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 188 | "debug-geoff32","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 190 | "debug-geoff32","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 189 | "debug-geoff64","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 191 | "debug-geoff64","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 190 | "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", | 192 | "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", |
| @@ -243,7 +245,7 @@ my %table=( | |||
| 243 | "solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 245 | "solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 244 | "solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 246 | "solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 245 | "solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 247 | "solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 246 | "solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs::/64", | 248 | "solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64", |
| 247 | #### | 249 | #### |
| 248 | "debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 250 | "debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 249 | "debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 251 | "debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| @@ -464,8 +466,8 @@ my %table=( | |||
| 464 | "aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64", | 466 | "aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64", |
| 465 | # Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE | 467 | # Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE |
| 466 | # at build time. $OBJECT_MODE is respected at ./config stage! | 468 | # at build time. $OBJECT_MODE is respected at ./config stage! |
| 467 | "aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", | 469 | "aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", |
| 468 | "aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64", | 470 | "aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64", |
| 469 | 471 | ||
| 470 | # | 472 | # |
| 471 | # Cray T90 and similar (SDSC) | 473 | # Cray T90 and similar (SDSC) |
| @@ -524,7 +526,7 @@ my %table=( | |||
| 524 | # 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE' | 526 | # 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE' |
| 525 | "VC-WIN32","cl:-W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32", | 527 | "VC-WIN32","cl:-W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32", |
| 526 | # Unified CE target | 528 | # Unified CE target |
| 527 | "debug-VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32", | 529 | "debug-VC-WIN32","cl:-W3 -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32", |
| 528 | "VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32", | 530 | "VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32", |
| 529 | 531 | ||
| 530 | # Borland C++ 4.5 | 532 | # Borland C++ 4.5 |
diff --git a/src/lib/libssl/src/FAQ b/src/lib/libssl/src/FAQ index bb6f7e2d29..59d135396e 100644 --- a/src/lib/libssl/src/FAQ +++ b/src/lib/libssl/src/FAQ | |||
| @@ -83,11 +83,11 @@ OpenSSL - Frequently Asked Questions | |||
| 83 | * Which is the current version of OpenSSL? | 83 | * Which is the current version of OpenSSL? |
| 84 | 84 | ||
| 85 | The current version is available from <URL: http://www.openssl.org>. | 85 | The current version is available from <URL: http://www.openssl.org>. |
| 86 | OpenSSL 1.0.1c was released on May 10th, 2012. | 86 | OpenSSL 1.0.1e was released on Feb 11th, 2013. |
| 87 | 87 | ||
| 88 | In addition to the current stable release, you can also access daily | 88 | In addition to the current stable release, you can also access daily |
| 89 | snapshots of the OpenSSL development version at <URL: | 89 | snapshots of the OpenSSL development version at <URL: |
| 90 | ftp://ftp.openssl.org/snapshot/>, or get it by anonymous CVS access. | 90 | ftp://ftp.openssl.org/snapshot/>, or get it by anonymous Git access. |
| 91 | 91 | ||
| 92 | 92 | ||
| 93 | * Where is the documentation? | 93 | * Where is the documentation? |
| @@ -768,6 +768,9 @@ openssl-security@openssl.org if you don't get a prompt reply at least | |||
| 768 | acknowledging receipt then resend or mail it directly to one of the | 768 | acknowledging receipt then resend or mail it directly to one of the |
| 769 | more active team members (e.g. Steve). | 769 | more active team members (e.g. Steve). |
| 770 | 770 | ||
| 771 | Note that bugs only present in the openssl utility are not in general | ||
| 772 | considered to be security issues. | ||
| 773 | |||
| 771 | [PROG] ======================================================================== | 774 | [PROG] ======================================================================== |
| 772 | 775 | ||
| 773 | * Is OpenSSL thread-safe? | 776 | * Is OpenSSL thread-safe? |
diff --git a/src/lib/libssl/src/INSTALL.W32 b/src/lib/libssl/src/INSTALL.W32 index d23c4baf62..80e538273e 100644 --- a/src/lib/libssl/src/INSTALL.W32 +++ b/src/lib/libssl/src/INSTALL.W32 | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | is required if you intend to utilize assembler modules. Note that NASM | 29 | is required if you intend to utilize assembler modules. Note that NASM |
| 30 | is now the only supported assembler. | 30 | is now the only supported assembler. |
| 31 | 31 | ||
| 32 | If you are compiling from a tarball or a CVS snapshot then the Win32 files | 32 | If you are compiling from a tarball or a Git snapshot then the Win32 files |
| 33 | may well be not up to date. This may mean that some "tweaking" is required to | 33 | may well be not up to date. This may mean that some "tweaking" is required to |
| 34 | get it all to work. See the trouble shooting section later on for if (when?) | 34 | get it all to work. See the trouble shooting section later on for if (when?) |
| 35 | it goes wrong. | 35 | it goes wrong. |
| @@ -257,7 +257,7 @@ | |||
| 257 | 257 | ||
| 258 | then ms\do_XXX should not give a warning any more. However the numbers that | 258 | then ms\do_XXX should not give a warning any more. However the numbers that |
| 259 | get assigned by this technique may not match those that eventually get | 259 | get assigned by this technique may not match those that eventually get |
| 260 | assigned in the CVS tree: so anything linked against this version of the | 260 | assigned in the Git tree: so anything linked against this version of the |
| 261 | library may need to be recompiled. | 261 | library may need to be recompiled. |
| 262 | 262 | ||
| 263 | If you get errors about unresolved symbols there are several possible | 263 | If you get errors about unresolved symbols there are several possible |
diff --git a/src/lib/libssl/src/Makefile b/src/lib/libssl/src/Makefile index d5db11b417..4a40b701d9 100644 --- a/src/lib/libssl/src/Makefile +++ b/src/lib/libssl/src/Makefile | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ## Makefile for OpenSSL | 4 | ## Makefile for OpenSSL |
| 5 | ## | 5 | ## |
| 6 | 6 | ||
| 7 | VERSION=1.0.1c | 7 | VERSION=1.0.1g |
| 8 | MAJOR=1 | 8 | MAJOR=1 |
| 9 | MINOR=0.1 | 9 | MINOR=0.1 |
| 10 | SHLIB_VERSION_NUMBER=1.0.0 | 10 | SHLIB_VERSION_NUMBER=1.0.0 |
| @@ -71,7 +71,7 @@ RANLIB= /usr/bin/ranlib | |||
| 71 | NM= nm | 71 | NM= nm |
| 72 | PERL= /usr/bin/perl | 72 | PERL= /usr/bin/perl |
| 73 | TAR= tar | 73 | TAR= tar |
| 74 | TARFLAGS= --no-recursion | 74 | TARFLAGS= --no-recursion --record-size=10240 |
| 75 | MAKEDEPPROG=makedepend | 75 | MAKEDEPPROG=makedepend |
| 76 | LIBDIR=lib | 76 | LIBDIR=lib |
| 77 | 77 | ||
| @@ -304,7 +304,8 @@ libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT) | |||
| 304 | FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \ | 304 | FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \ |
| 305 | export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \ | 305 | export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \ |
| 306 | fi; \ | 306 | fi; \ |
| 307 | $(MAKE) -e SHLIBDIRS=crypto build-shared; \ | 307 | $(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared && \ |
| 308 | (touch -c fips_premain_dso$(EXE_EXT) || :); \ | ||
| 308 | else \ | 309 | else \ |
| 309 | echo "There's no support for shared libraries on this platform" >&2; \ | 310 | echo "There's no support for shared libraries on this platform" >&2; \ |
| 310 | exit 1; \ | 311 | exit 1; \ |
| @@ -446,7 +447,7 @@ rehash.time: certs apps | |||
| 446 | [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \ | 447 | [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \ |
| 447 | OPENSSL_DEBUG_MEMORY=on; \ | 448 | OPENSSL_DEBUG_MEMORY=on; \ |
| 448 | export OPENSSL OPENSSL_DEBUG_MEMORY; \ | 449 | export OPENSSL OPENSSL_DEBUG_MEMORY; \ |
| 449 | $(PERL) tools/c_rehash certs) && \ | 450 | $(PERL) tools/c_rehash certs/demo) && \ |
| 450 | touch rehash.time; \ | 451 | touch rehash.time; \ |
| 451 | else :; fi | 452 | else :; fi |
| 452 | 453 | ||
diff --git a/src/lib/libssl/src/Makefile.org b/src/lib/libssl/src/Makefile.org index 55273ea364..c92806f920 100644 --- a/src/lib/libssl/src/Makefile.org +++ b/src/lib/libssl/src/Makefile.org | |||
| @@ -69,7 +69,7 @@ RANLIB= ranlib | |||
| 69 | NM= nm | 69 | NM= nm |
| 70 | PERL= perl | 70 | PERL= perl |
| 71 | TAR= tar | 71 | TAR= tar |
| 72 | TARFLAGS= --no-recursion | 72 | TARFLAGS= --no-recursion --record-size=10240 |
| 73 | MAKEDEPPROG=makedepend | 73 | MAKEDEPPROG=makedepend |
| 74 | LIBDIR=lib | 74 | LIBDIR=lib |
| 75 | 75 | ||
| @@ -302,7 +302,8 @@ libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT) | |||
| 302 | FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \ | 302 | FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \ |
| 303 | export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \ | 303 | export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \ |
| 304 | fi; \ | 304 | fi; \ |
| 305 | $(MAKE) -e SHLIBDIRS=crypto build-shared; \ | 305 | $(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared && \ |
| 306 | (touch -c fips_premain_dso$(EXE_EXT) || :); \ | ||
| 306 | else \ | 307 | else \ |
| 307 | echo "There's no support for shared libraries on this platform" >&2; \ | 308 | echo "There's no support for shared libraries on this platform" >&2; \ |
| 308 | exit 1; \ | 309 | exit 1; \ |
| @@ -444,7 +445,7 @@ rehash.time: certs apps | |||
| 444 | [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \ | 445 | [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \ |
| 445 | OPENSSL_DEBUG_MEMORY=on; \ | 446 | OPENSSL_DEBUG_MEMORY=on; \ |
| 446 | export OPENSSL OPENSSL_DEBUG_MEMORY; \ | 447 | export OPENSSL OPENSSL_DEBUG_MEMORY; \ |
| 447 | $(PERL) tools/c_rehash certs) && \ | 448 | $(PERL) tools/c_rehash certs/demo) && \ |
| 448 | touch rehash.time; \ | 449 | touch rehash.time; \ |
| 449 | else :; fi | 450 | else :; fi |
| 450 | 451 | ||
diff --git a/src/lib/libssl/src/NEWS b/src/lib/libssl/src/NEWS index 4f069cbd14..ed486d146d 100644 --- a/src/lib/libssl/src/NEWS +++ b/src/lib/libssl/src/NEWS | |||
| @@ -5,24 +5,49 @@ | |||
| 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 1.0.1b and OpenSSL 1.0.1c: | 8 | Major changes between OpenSSL 1.0.1f and OpenSSL 1.0.1g [7 Apr 2014] |
| 9 | |||
| 10 | o Fix for CVE-2014-0160 | ||
| 11 | o Add TLS padding extension workaround for broken servers. | ||
| 12 | o Fix for CVE-2014-0076 | ||
| 13 | |||
| 14 | Major changes between OpenSSL 1.0.1e and OpenSSL 1.0.1f [6 Jan 2014] | ||
| 15 | |||
| 16 | o Don't include gmt_unix_time in TLS server and client random values | ||
| 17 | o Fix for TLS record tampering bug CVE-2013-4353 | ||
| 18 | o Fix for TLS version checking bug CVE-2013-6449 | ||
| 19 | o Fix for DTLS retransmission bug CVE-2013-6450 | ||
| 20 | |||
| 21 | Major changes between OpenSSL 1.0.1d and OpenSSL 1.0.1e [11 Feb 2013]: | ||
| 22 | |||
| 23 | o Corrected fix for CVE-2013-0169 | ||
| 24 | |||
| 25 | Major changes between OpenSSL 1.0.1c and OpenSSL 1.0.1d [4 Feb 2013]: | ||
| 26 | |||
| 27 | o Fix renegotiation in TLS 1.1, 1.2 by using the correct TLS version. | ||
| 28 | o Include the fips configuration module. | ||
| 29 | o Fix OCSP bad key DoS attack CVE-2013-0166 | ||
| 30 | o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169 | ||
| 31 | o Fix for TLS AESNI record handling flaw CVE-2012-2686 | ||
| 32 | |||
| 33 | Major changes between OpenSSL 1.0.1b and OpenSSL 1.0.1c [10 May 2012]: | ||
| 9 | 34 | ||
| 10 | o Fix TLS/DTLS record length checking bug CVE-2012-2333 | 35 | o Fix TLS/DTLS record length checking bug CVE-2012-2333 |
| 11 | o Don't attempt to use non-FIPS composite ciphers in FIPS mode. | 36 | o Don't attempt to use non-FIPS composite ciphers in FIPS mode. |
| 12 | 37 | ||
| 13 | Major changes between OpenSSL 1.0.1a and OpenSSL 1.0.1b: | 38 | Major changes between OpenSSL 1.0.1a and OpenSSL 1.0.1b [26 Apr 2012]: |
| 14 | 39 | ||
| 15 | o Fix compilation error on non-x86 platforms. | 40 | o Fix compilation error on non-x86 platforms. |
| 16 | o Make FIPS capable OpenSSL ciphers work in non-FIPS mode. | 41 | o Make FIPS capable OpenSSL ciphers work in non-FIPS mode. |
| 17 | o Fix SSL_OP_NO_TLSv1_1 clash with SSL_OP_ALL in OpenSSL 1.0.0 | 42 | o Fix SSL_OP_NO_TLSv1_1 clash with SSL_OP_ALL in OpenSSL 1.0.0 |
| 18 | 43 | ||
| 19 | Major changes between OpenSSL 1.0.1 and OpenSSL 1.0.1a: | 44 | Major changes between OpenSSL 1.0.1 and OpenSSL 1.0.1a [19 Apr 2012]: |
| 20 | 45 | ||
| 21 | o Fix for ASN1 overflow bug CVE-2012-2110 | 46 | o Fix for ASN1 overflow bug CVE-2012-2110 |
| 22 | o Workarounds for some servers that hang on long client hellos. | 47 | o Workarounds for some servers that hang on long client hellos. |
| 23 | o Fix SEGV in AES code. | 48 | o Fix SEGV in AES code. |
| 24 | 49 | ||
| 25 | Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1: | 50 | Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1 [14 Mar 2012]: |
| 26 | 51 | ||
| 27 | o TLS/DTLS heartbeat support. | 52 | o TLS/DTLS heartbeat support. |
| 28 | o SCTP support. | 53 | o SCTP support. |
| @@ -35,17 +60,30 @@ | |||
| 35 | o Preliminary FIPS capability for unvalidated 2.0 FIPS module. | 60 | o Preliminary FIPS capability for unvalidated 2.0 FIPS module. |
| 36 | o SRP support. | 61 | o SRP support. |
| 37 | 62 | ||
| 38 | Major changes between OpenSSL 1.0.0g and OpenSSL 1.0.0h: | 63 | Major changes between OpenSSL 1.0.0j and OpenSSL 1.0.0k [5 Feb 2013]: |
| 64 | |||
| 65 | o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169 | ||
| 66 | o Fix OCSP bad key DoS attack CVE-2013-0166 | ||
| 67 | |||
| 68 | Major changes between OpenSSL 1.0.0i and OpenSSL 1.0.0j [10 May 2012]: | ||
| 69 | |||
| 70 | o Fix DTLS record length checking bug CVE-2012-2333 | ||
| 71 | |||
| 72 | Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.0i [19 Apr 2012]: | ||
| 73 | |||
| 74 | o Fix for ASN1 overflow bug CVE-2012-2110 | ||
| 75 | |||
| 76 | Major changes between OpenSSL 1.0.0g and OpenSSL 1.0.0h [12 Mar 2012]: | ||
| 39 | 77 | ||
| 40 | o Fix for CMS/PKCS#7 MMA CVE-2012-0884 | 78 | o Fix for CMS/PKCS#7 MMA CVE-2012-0884 |
| 41 | o Corrected fix for CVE-2011-4619 | 79 | o Corrected fix for CVE-2011-4619 |
| 42 | o Various DTLS fixes. | 80 | o Various DTLS fixes. |
| 43 | 81 | ||
| 44 | Major changes between OpenSSL 1.0.0f and OpenSSL 1.0.0g: | 82 | Major changes between OpenSSL 1.0.0f and OpenSSL 1.0.0g [18 Jan 2012]: |
| 45 | 83 | ||
| 46 | o Fix for DTLS DoS issue CVE-2012-0050 | 84 | o Fix for DTLS DoS issue CVE-2012-0050 |
| 47 | 85 | ||
| 48 | Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f: | 86 | Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f [4 Jan 2012]: |
| 49 | 87 | ||
| 50 | o Fix for DTLS plaintext recovery attack CVE-2011-4108 | 88 | o Fix for DTLS plaintext recovery attack CVE-2011-4108 |
| 51 | o Clear block padding bytes of SSL 3.0 records CVE-2011-4576 | 89 | o Clear block padding bytes of SSL 3.0 records CVE-2011-4576 |
| @@ -53,7 +91,7 @@ | |||
| 53 | o Check parameters are not NULL in GOST ENGINE CVE-2012-0027 | 91 | o Check parameters are not NULL in GOST ENGINE CVE-2012-0027 |
| 54 | o Check for malformed RFC3779 data CVE-2011-4577 | 92 | o Check for malformed RFC3779 data CVE-2011-4577 |
| 55 | 93 | ||
| 56 | Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e: | 94 | Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e [6 Sep 2011]: |
| 57 | 95 | ||
| 58 | o Fix for CRL vulnerability issue CVE-2011-3207 | 96 | o Fix for CRL vulnerability issue CVE-2011-3207 |
| 59 | o Fix for ECDH crashes CVE-2011-3210 | 97 | o Fix for ECDH crashes CVE-2011-3210 |
| @@ -61,11 +99,11 @@ | |||
| 61 | o Support ECDH ciphersuites for certificates using SHA2 algorithms. | 99 | o Support ECDH ciphersuites for certificates using SHA2 algorithms. |
| 62 | o Various DTLS fixes. | 100 | o Various DTLS fixes. |
| 63 | 101 | ||
| 64 | Major changes between OpenSSL 1.0.0c and OpenSSL 1.0.0d: | 102 | Major changes between OpenSSL 1.0.0c and OpenSSL 1.0.0d [8 Feb 2011]: |
| 65 | 103 | ||
| 66 | o Fix for security issue CVE-2011-0014 | 104 | o Fix for security issue CVE-2011-0014 |
| 67 | 105 | ||
| 68 | Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c: | 106 | Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c [2 Dec 2010]: |
| 69 | 107 | ||
| 70 | o Fix for security issue CVE-2010-4180 | 108 | o Fix for security issue CVE-2010-4180 |
| 71 | o Fix for CVE-2010-4252 | 109 | o Fix for CVE-2010-4252 |
| @@ -73,18 +111,18 @@ | |||
| 73 | o Fix various platform compilation issues. | 111 | o Fix various platform compilation issues. |
| 74 | o Corrected fix for security issue CVE-2010-3864. | 112 | o Corrected fix for security issue CVE-2010-3864. |
| 75 | 113 | ||
| 76 | Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b: | 114 | Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b [16 Nov 2010]: |
| 77 | 115 | ||
| 78 | o Fix for security issue CVE-2010-3864. | 116 | o Fix for security issue CVE-2010-3864. |
| 79 | o Fix for CVE-2010-2939 | 117 | o Fix for CVE-2010-2939 |
| 80 | o Fix WIN32 build system for GOST ENGINE. | 118 | o Fix WIN32 build system for GOST ENGINE. |
| 81 | 119 | ||
| 82 | Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a: | 120 | Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a [1 Jun 2010]: |
| 83 | 121 | ||
| 84 | o Fix for security issue CVE-2010-1633. | 122 | o Fix for security issue CVE-2010-1633. |
| 85 | o GOST MAC and CFB fixes. | 123 | o GOST MAC and CFB fixes. |
| 86 | 124 | ||
| 87 | Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0: | 125 | Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0 [29 Mar 2010]: |
| 88 | 126 | ||
| 89 | o RFC3280 path validation: sufficient to process PKITS tests. | 127 | o RFC3280 path validation: sufficient to process PKITS tests. |
| 90 | o Integrated support for PVK files and keyblobs. | 128 | o Integrated support for PVK files and keyblobs. |
| @@ -107,20 +145,55 @@ | |||
| 107 | o Opaque PRF Input TLS extension support. | 145 | o Opaque PRF Input TLS extension support. |
| 108 | o Updated time routines to avoid OS limitations. | 146 | o Updated time routines to avoid OS limitations. |
| 109 | 147 | ||
| 110 | Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r: | 148 | Major changes between OpenSSL 0.9.8x and OpenSSL 0.9.8y [5 Feb 2013]: |
| 149 | |||
| 150 | o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169 | ||
| 151 | o Fix OCSP bad key DoS attack CVE-2013-0166 | ||
| 152 | |||
| 153 | Major changes between OpenSSL 0.9.8w and OpenSSL 0.9.8x [10 May 2012]: | ||
| 154 | |||
| 155 | o Fix DTLS record length checking bug CVE-2012-2333 | ||
| 156 | |||
| 157 | Major changes between OpenSSL 0.9.8v and OpenSSL 0.9.8w [23 Apr 2012]: | ||
| 158 | |||
| 159 | o Fix for CVE-2012-2131 (corrected fix for 0.9.8 and CVE-2012-2110) | ||
| 160 | |||
| 161 | Major changes between OpenSSL 0.9.8u and OpenSSL 0.9.8v [19 Apr 2012]: | ||
| 162 | |||
| 163 | o Fix for ASN1 overflow bug CVE-2012-2110 | ||
| 164 | |||
| 165 | Major changes between OpenSSL 0.9.8t and OpenSSL 0.9.8u [12 Mar 2012]: | ||
| 166 | |||
| 167 | o Fix for CMS/PKCS#7 MMA CVE-2012-0884 | ||
| 168 | o Corrected fix for CVE-2011-4619 | ||
| 169 | o Various DTLS fixes. | ||
| 170 | |||
| 171 | Major changes between OpenSSL 0.9.8s and OpenSSL 0.9.8t [18 Jan 2012]: | ||
| 172 | |||
| 173 | o Fix for DTLS DoS issue CVE-2012-0050 | ||
| 174 | |||
| 175 | Major changes between OpenSSL 0.9.8r and OpenSSL 0.9.8s [4 Jan 2012]: | ||
| 176 | |||
| 177 | o Fix for DTLS plaintext recovery attack CVE-2011-4108 | ||
| 178 | o Fix policy check double free error CVE-2011-4109 | ||
| 179 | o Clear block padding bytes of SSL 3.0 records CVE-2011-4576 | ||
| 180 | o Only allow one SGC handshake restart for SSL/TLS CVE-2011-4619 | ||
| 181 | o Check for malformed RFC3779 data CVE-2011-4577 | ||
| 182 | |||
| 183 | Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r [8 Feb 2011]: | ||
| 111 | 184 | ||
| 112 | o Fix for security issue CVE-2011-0014 | 185 | o Fix for security issue CVE-2011-0014 |
| 113 | 186 | ||
| 114 | Major changes between OpenSSL 0.9.8p and OpenSSL 0.9.8q: | 187 | Major changes between OpenSSL 0.9.8p and OpenSSL 0.9.8q [2 Dec 2010]: |
| 115 | 188 | ||
| 116 | o Fix for security issue CVE-2010-4180 | 189 | o Fix for security issue CVE-2010-4180 |
| 117 | o Fix for CVE-2010-4252 | 190 | o Fix for CVE-2010-4252 |
| 118 | 191 | ||
| 119 | Major changes between OpenSSL 0.9.8o and OpenSSL 0.9.8p: | 192 | Major changes between OpenSSL 0.9.8o and OpenSSL 0.9.8p [16 Nov 2010]: |
| 120 | 193 | ||
| 121 | o Fix for security issue CVE-2010-3864. | 194 | o Fix for security issue CVE-2010-3864. |
| 122 | 195 | ||
| 123 | Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o: | 196 | Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o [1 Jun 2010]: |
| 124 | 197 | ||
| 125 | o Fix for security issue CVE-2010-0742. | 198 | o Fix for security issue CVE-2010-0742. |
| 126 | o Various DTLS fixes. | 199 | o Various DTLS fixes. |
| @@ -128,12 +201,12 @@ | |||
| 128 | o Fix for no-rc4 compilation. | 201 | o Fix for no-rc4 compilation. |
| 129 | o Chil ENGINE unload workaround. | 202 | o Chil ENGINE unload workaround. |
| 130 | 203 | ||
| 131 | Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n: | 204 | Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n [24 Mar 2010]: |
| 132 | 205 | ||
| 133 | o CFB cipher definition fixes. | 206 | o CFB cipher definition fixes. |
| 134 | o Fix security issues CVE-2010-0740 and CVE-2010-0433. | 207 | o Fix security issues CVE-2010-0740 and CVE-2010-0433. |
| 135 | 208 | ||
| 136 | Major changes between OpenSSL 0.9.8l and OpenSSL 0.9.8m: | 209 | Major changes between OpenSSL 0.9.8l and OpenSSL 0.9.8m [25 Feb 2010]: |
| 137 | 210 | ||
| 138 | o Cipher definition fixes. | 211 | o Cipher definition fixes. |
| 139 | o Workaround for slow RAND_poll() on some WIN32 versions. | 212 | o Workaround for slow RAND_poll() on some WIN32 versions. |
| @@ -145,33 +218,33 @@ | |||
| 145 | o Ticket and SNI coexistence fixes. | 218 | o Ticket and SNI coexistence fixes. |
| 146 | o Many fixes to DTLS handling. | 219 | o Many fixes to DTLS handling. |
| 147 | 220 | ||
| 148 | Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l: | 221 | Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l [5 Nov 2009]: |
| 149 | 222 | ||
| 150 | o Temporary work around for CVE-2009-3555: disable renegotiation. | 223 | o Temporary work around for CVE-2009-3555: disable renegotiation. |
| 151 | 224 | ||
| 152 | Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k: | 225 | Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k [25 Mar 2009]: |
| 153 | 226 | ||
| 154 | o Fix various build issues. | 227 | o Fix various build issues. |
| 155 | o Fix security issues (CVE-2009-0590, CVE-2009-0591, CVE-2009-0789) | 228 | o Fix security issues (CVE-2009-0590, CVE-2009-0591, CVE-2009-0789) |
| 156 | 229 | ||
| 157 | Major changes between OpenSSL 0.9.8i and OpenSSL 0.9.8j: | 230 | Major changes between OpenSSL 0.9.8i and OpenSSL 0.9.8j [7 Jan 2009]: |
| 158 | 231 | ||
| 159 | o Fix security issue (CVE-2008-5077) | 232 | o Fix security issue (CVE-2008-5077) |
| 160 | o Merge FIPS 140-2 branch code. | 233 | o Merge FIPS 140-2 branch code. |
| 161 | 234 | ||
| 162 | Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h: | 235 | Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h [28 May 2008]: |
| 163 | 236 | ||
| 164 | o CryptoAPI ENGINE support. | 237 | o CryptoAPI ENGINE support. |
| 165 | o Various precautionary measures. | 238 | o Various precautionary measures. |
| 166 | o Fix for bugs affecting certificate request creation. | 239 | o Fix for bugs affecting certificate request creation. |
| 167 | o Support for local machine keyset attribute in PKCS#12 files. | 240 | o Support for local machine keyset attribute in PKCS#12 files. |
| 168 | 241 | ||
| 169 | Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g: | 242 | Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g [19 Oct 2007]: |
| 170 | 243 | ||
| 171 | o Backport of CMS functionality to 0.9.8. | 244 | o Backport of CMS functionality to 0.9.8. |
| 172 | o Fixes for bugs introduced with 0.9.8f. | 245 | o Fixes for bugs introduced with 0.9.8f. |
| 173 | 246 | ||
| 174 | Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f: | 247 | Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f [11 Oct 2007]: |
| 175 | 248 | ||
| 176 | o Add gcc 4.2 support. | 249 | o Add gcc 4.2 support. |
| 177 | o Add support for AES and SSE2 assembly lanugauge optimization | 250 | o Add support for AES and SSE2 assembly lanugauge optimization |
| @@ -182,23 +255,23 @@ | |||
| 182 | o RFC4507bis support. | 255 | o RFC4507bis support. |
| 183 | o TLS Extensions support. | 256 | o TLS Extensions support. |
| 184 | 257 | ||
| 185 | Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e: | 258 | Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e [23 Feb 2007]: |
| 186 | 259 | ||
| 187 | o Various ciphersuite selection fixes. | 260 | o Various ciphersuite selection fixes. |
| 188 | o RFC3779 support. | 261 | o RFC3779 support. |
| 189 | 262 | ||
| 190 | Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d: | 263 | Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d [28 Sep 2006]: |
| 191 | 264 | ||
| 192 | o Introduce limits to prevent malicious key DoS (CVE-2006-2940) | 265 | o Introduce limits to prevent malicious key DoS (CVE-2006-2940) |
| 193 | o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343) | 266 | o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343) |
| 194 | o Changes to ciphersuite selection algorithm | 267 | o Changes to ciphersuite selection algorithm |
| 195 | 268 | ||
| 196 | Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c: | 269 | Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c [5 Sep 2006]: |
| 197 | 270 | ||
| 198 | o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339 | 271 | o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339 |
| 199 | o New cipher Camellia | 272 | o New cipher Camellia |
| 200 | 273 | ||
| 201 | Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b: | 274 | Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b [4 May 2006]: |
| 202 | 275 | ||
| 203 | o Cipher string fixes. | 276 | o Cipher string fixes. |
| 204 | o Fixes for VC++ 2005. | 277 | o Fixes for VC++ 2005. |
| @@ -208,12 +281,12 @@ | |||
| 208 | o Built in dynamic engine compilation support on Win32. | 281 | o Built in dynamic engine compilation support on Win32. |
| 209 | o Fixes auto dynamic engine loading in Win32. | 282 | o Fixes auto dynamic engine loading in Win32. |
| 210 | 283 | ||
| 211 | Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a: | 284 | Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a [11 Oct 2005]: |
| 212 | 285 | ||
| 213 | o Fix potential SSL 2.0 rollback, CVE-2005-2969 | 286 | o Fix potential SSL 2.0 rollback, CVE-2005-2969 |
| 214 | o Extended Windows CE support | 287 | o Extended Windows CE support |
| 215 | 288 | ||
| 216 | Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8: | 289 | Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8 [5 Jul 2005]: |
| 217 | 290 | ||
| 218 | o Major work on the BIGNUM library for higher efficiency and to | 291 | o Major work on the BIGNUM library for higher efficiency and to |
| 219 | make operations more streamlined and less contradictory. This | 292 | make operations more streamlined and less contradictory. This |
| @@ -287,36 +360,36 @@ | |||
| 287 | o Added initial support for Win64. | 360 | o Added initial support for Win64. |
| 288 | o Added alternate pkg-config files. | 361 | o Added alternate pkg-config files. |
| 289 | 362 | ||
| 290 | Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m: | 363 | Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m [23 Feb 2007]: |
| 291 | 364 | ||
| 292 | o FIPS 1.1.1 module linking. | 365 | o FIPS 1.1.1 module linking. |
| 293 | o Various ciphersuite selection fixes. | 366 | o Various ciphersuite selection fixes. |
| 294 | 367 | ||
| 295 | Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l: | 368 | Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l [28 Sep 2006]: |
| 296 | 369 | ||
| 297 | o Introduce limits to prevent malicious key DoS (CVE-2006-2940) | 370 | o Introduce limits to prevent malicious key DoS (CVE-2006-2940) |
| 298 | o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343) | 371 | o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343) |
| 299 | 372 | ||
| 300 | Major changes between OpenSSL 0.9.7j and OpenSSL 0.9.7k: | 373 | Major changes between OpenSSL 0.9.7j and OpenSSL 0.9.7k [5 Sep 2006]: |
| 301 | 374 | ||
| 302 | o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339 | 375 | o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339 |
| 303 | 376 | ||
| 304 | Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j: | 377 | Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j [4 May 2006]: |
| 305 | 378 | ||
| 306 | o Visual C++ 2005 fixes. | 379 | o Visual C++ 2005 fixes. |
| 307 | o Update Windows build system for FIPS. | 380 | o Update Windows build system for FIPS. |
| 308 | 381 | ||
| 309 | Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i: | 382 | Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i [14 Oct 2005]: |
| 310 | 383 | ||
| 311 | o Give EVP_MAX_MD_SIZE it's old value, except for a FIPS build. | 384 | o Give EVP_MAX_MD_SIZE it's old value, except for a FIPS build. |
| 312 | 385 | ||
| 313 | Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h: | 386 | Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h [11 Oct 2005]: |
| 314 | 387 | ||
| 315 | o Fix SSL 2.0 Rollback, CVE-2005-2969 | 388 | o Fix SSL 2.0 Rollback, CVE-2005-2969 |
| 316 | o Allow use of fixed-length exponent on DSA signing | 389 | o Allow use of fixed-length exponent on DSA signing |
| 317 | o Default fixed-window RSA, DSA, DH private-key operations | 390 | o Default fixed-window RSA, DSA, DH private-key operations |
| 318 | 391 | ||
| 319 | Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g: | 392 | Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g [11 Apr 2005]: |
| 320 | 393 | ||
| 321 | o More compilation issues fixed. | 394 | o More compilation issues fixed. |
| 322 | o Adaptation to more modern Kerberos API. | 395 | o Adaptation to more modern Kerberos API. |
| @@ -325,7 +398,7 @@ | |||
| 325 | o More constification. | 398 | o More constification. |
| 326 | o Added processing of proxy certificates (RFC 3820). | 399 | o Added processing of proxy certificates (RFC 3820). |
| 327 | 400 | ||
| 328 | Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f: | 401 | Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f [22 Mar 2005]: |
| 329 | 402 | ||
| 330 | o Several compilation issues fixed. | 403 | o Several compilation issues fixed. |
| 331 | o Many memory allocation failure checks added. | 404 | o Many memory allocation failure checks added. |
| @@ -333,12 +406,12 @@ | |||
| 333 | o Mandatory basic checks on certificates. | 406 | o Mandatory basic checks on certificates. |
| 334 | o Performance improvements. | 407 | o Performance improvements. |
| 335 | 408 | ||
| 336 | Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e: | 409 | Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e [25 Oct 2004]: |
| 337 | 410 | ||
| 338 | o Fix race condition in CRL checking code. | 411 | o Fix race condition in CRL checking code. |
| 339 | o Fixes to PKCS#7 (S/MIME) code. | 412 | o Fixes to PKCS#7 (S/MIME) code. |
| 340 | 413 | ||
| 341 | Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d: | 414 | Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d [17 Mar 2004]: |
| 342 | 415 | ||
| 343 | o Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug | 416 | o Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug |
| 344 | o Security: Fix null-pointer assignment in do_change_cipher_spec() | 417 | o Security: Fix null-pointer assignment in do_change_cipher_spec() |
| @@ -346,14 +419,14 @@ | |||
| 346 | o Multiple X509 verification fixes | 419 | o Multiple X509 verification fixes |
| 347 | o Speed up HMAC and other operations | 420 | o Speed up HMAC and other operations |
| 348 | 421 | ||
| 349 | Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c: | 422 | Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c [30 Sep 2003]: |
| 350 | 423 | ||
| 351 | o Security: fix various ASN1 parsing bugs. | 424 | o Security: fix various ASN1 parsing bugs. |
| 352 | o New -ignore_err option to OCSP utility. | 425 | o New -ignore_err option to OCSP utility. |
| 353 | o Various interop and bug fixes in S/MIME code. | 426 | o Various interop and bug fixes in S/MIME code. |
| 354 | o SSL/TLS protocol fix for unrequested client certificates. | 427 | o SSL/TLS protocol fix for unrequested client certificates. |
| 355 | 428 | ||
| 356 | Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b: | 429 | Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b [10 Apr 2003]: |
| 357 | 430 | ||
| 358 | o Security: counter the Klima-Pokorny-Rosa extension of | 431 | o Security: counter the Klima-Pokorny-Rosa extension of |
| 359 | Bleichbacher's attack | 432 | Bleichbacher's attack |
| @@ -364,7 +437,7 @@ | |||
| 364 | o ASN.1: treat domainComponent correctly. | 437 | o ASN.1: treat domainComponent correctly. |
| 365 | o Documentation: fixes and additions. | 438 | o Documentation: fixes and additions. |
| 366 | 439 | ||
| 367 | Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a: | 440 | Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a [19 Feb 2003]: |
| 368 | 441 | ||
| 369 | o Security: Important security related bugfixes. | 442 | o Security: Important security related bugfixes. |
| 370 | o Enhanced compatibility with MIT Kerberos. | 443 | o Enhanced compatibility with MIT Kerberos. |
| @@ -375,7 +448,7 @@ | |||
| 375 | o SSL/TLS: now handles manual certificate chain building. | 448 | o SSL/TLS: now handles manual certificate chain building. |
| 376 | o SSL/TLS: certain session ID malfunctions corrected. | 449 | o SSL/TLS: certain session ID malfunctions corrected. |
| 377 | 450 | ||
| 378 | Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7: | 451 | Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7 [30 Dec 2002]: |
| 379 | 452 | ||
| 380 | o New library section OCSP. | 453 | o New library section OCSP. |
| 381 | o Complete rewrite of ASN1 code. | 454 | o Complete rewrite of ASN1 code. |
| @@ -421,23 +494,23 @@ | |||
| 421 | o SSL/TLS: add callback to retrieve SSL/TLS messages. | 494 | o SSL/TLS: add callback to retrieve SSL/TLS messages. |
| 422 | o SSL/TLS: support AES cipher suites (RFC3268). | 495 | o SSL/TLS: support AES cipher suites (RFC3268). |
| 423 | 496 | ||
| 424 | Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k: | 497 | Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k [30 Sep 2003]: |
| 425 | 498 | ||
| 426 | o Security: fix various ASN1 parsing bugs. | 499 | o Security: fix various ASN1 parsing bugs. |
| 427 | o SSL/TLS protocol fix for unrequested client certificates. | 500 | o SSL/TLS protocol fix for unrequested client certificates. |
| 428 | 501 | ||
| 429 | Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j: | 502 | Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j [10 Apr 2003]: |
| 430 | 503 | ||
| 431 | o Security: counter the Klima-Pokorny-Rosa extension of | 504 | o Security: counter the Klima-Pokorny-Rosa extension of |
| 432 | Bleichbacher's attack | 505 | Bleichbacher's attack |
| 433 | o Security: make RSA blinding default. | 506 | o Security: make RSA blinding default. |
| 434 | o Build: shared library support fixes. | 507 | o Build: shared library support fixes. |
| 435 | 508 | ||
| 436 | Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i: | 509 | Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i [19 Feb 2003]: |
| 437 | 510 | ||
| 438 | o Important security related bugfixes. | 511 | o Important security related bugfixes. |
| 439 | 512 | ||
| 440 | Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h: | 513 | Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h [5 Dec 2002]: |
| 441 | 514 | ||
| 442 | o New configuration targets for Tandem OSS and A/UX. | 515 | o New configuration targets for Tandem OSS and A/UX. |
| 443 | o New OIDs for Microsoft attributes. | 516 | o New OIDs for Microsoft attributes. |
| @@ -451,25 +524,25 @@ | |||
| 451 | o Fixes for smaller building problems. | 524 | o Fixes for smaller building problems. |
| 452 | o Updates of manuals, FAQ and other instructive documents. | 525 | o Updates of manuals, FAQ and other instructive documents. |
| 453 | 526 | ||
| 454 | Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g: | 527 | Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g [9 Aug 2002]: |
| 455 | 528 | ||
| 456 | o Important building fixes on Unix. | 529 | o Important building fixes on Unix. |
| 457 | 530 | ||
| 458 | Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f: | 531 | Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f [8 Aug 2002]: |
| 459 | 532 | ||
| 460 | o Various important bugfixes. | 533 | o Various important bugfixes. |
| 461 | 534 | ||
| 462 | Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e: | 535 | Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e [30 Jul 2002]: |
| 463 | 536 | ||
| 464 | o Important security related bugfixes. | 537 | o Important security related bugfixes. |
| 465 | o Various SSL/TLS library bugfixes. | 538 | o Various SSL/TLS library bugfixes. |
| 466 | 539 | ||
| 467 | Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d: | 540 | Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d [9 May 2002]: |
| 468 | 541 | ||
| 469 | o Various SSL/TLS library bugfixes. | 542 | o Various SSL/TLS library bugfixes. |
| 470 | o Fix DH parameter generation for 'non-standard' generators. | 543 | o Fix DH parameter generation for 'non-standard' generators. |
| 471 | 544 | ||
| 472 | Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c: | 545 | Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c [21 Dec 2001]: |
| 473 | 546 | ||
| 474 | o Various SSL/TLS library bugfixes. | 547 | o Various SSL/TLS library bugfixes. |
| 475 | o BIGNUM library fixes. | 548 | o BIGNUM library fixes. |
| @@ -482,7 +555,7 @@ | |||
| 482 | Broadcom and Cryptographic Appliance's keyserver | 555 | Broadcom and Cryptographic Appliance's keyserver |
| 483 | [in 0.9.6c-engine release]. | 556 | [in 0.9.6c-engine release]. |
| 484 | 557 | ||
| 485 | Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b: | 558 | Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b [9 Jul 2001]: |
| 486 | 559 | ||
| 487 | o Security fix: PRNG improvements. | 560 | o Security fix: PRNG improvements. |
| 488 | o Security fix: RSA OAEP check. | 561 | o Security fix: RSA OAEP check. |
| @@ -499,7 +572,7 @@ | |||
| 499 | o Increase default size for BIO buffering filter. | 572 | o Increase default size for BIO buffering filter. |
| 500 | o Compatibility fixes in some scripts. | 573 | o Compatibility fixes in some scripts. |
| 501 | 574 | ||
| 502 | Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a: | 575 | Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a [5 Apr 2001]: |
| 503 | 576 | ||
| 504 | o Security fix: change behavior of OpenSSL to avoid using | 577 | o Security fix: change behavior of OpenSSL to avoid using |
| 505 | environment variables when running as root. | 578 | environment variables when running as root. |
| @@ -524,7 +597,7 @@ | |||
| 524 | o New function BN_rand_range(). | 597 | o New function BN_rand_range(). |
| 525 | o Add "-rand" option to openssl s_client and s_server. | 598 | o Add "-rand" option to openssl s_client and s_server. |
| 526 | 599 | ||
| 527 | Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6: | 600 | Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6 [10 Oct 2000]: |
| 528 | 601 | ||
| 529 | o Some documentation for BIO and SSL libraries. | 602 | o Some documentation for BIO and SSL libraries. |
| 530 | o Enhanced chain verification using key identifiers. | 603 | o Enhanced chain verification using key identifiers. |
| @@ -539,7 +612,7 @@ | |||
| 539 | [1] The support for external crypto devices is currently a separate | 612 | [1] The support for external crypto devices is currently a separate |
| 540 | distribution. See the file README.ENGINE. | 613 | distribution. See the file README.ENGINE. |
| 541 | 614 | ||
| 542 | Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a: | 615 | Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a [1 Apr 2000]: |
| 543 | 616 | ||
| 544 | o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8 | 617 | o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8 |
| 545 | o Shared library support for HPUX and Solaris-gcc | 618 | o Shared library support for HPUX and Solaris-gcc |
| @@ -548,7 +621,7 @@ | |||
| 548 | o New 'rand' application | 621 | o New 'rand' application |
| 549 | o New way to check for existence of algorithms from scripts | 622 | o New way to check for existence of algorithms from scripts |
| 550 | 623 | ||
| 551 | Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5: | 624 | Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5 [25 May 2000]: |
| 552 | 625 | ||
| 553 | o S/MIME support in new 'smime' command | 626 | o S/MIME support in new 'smime' command |
| 554 | o Documentation for the OpenSSL command line application | 627 | o Documentation for the OpenSSL command line application |
| @@ -584,7 +657,7 @@ | |||
| 584 | o Enhanced support for Alpha Linux | 657 | o Enhanced support for Alpha Linux |
| 585 | o Experimental MacOS support | 658 | o Experimental MacOS support |
| 586 | 659 | ||
| 587 | Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4: | 660 | Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4 [9 Aug 1999]: |
| 588 | 661 | ||
| 589 | o Transparent support for PKCS#8 format private keys: these are used | 662 | o Transparent support for PKCS#8 format private keys: these are used |
| 590 | by several software packages and are more secure than the standard | 663 | by several software packages and are more secure than the standard |
| @@ -595,7 +668,7 @@ | |||
| 595 | o New pipe-like BIO that allows using the SSL library when actual I/O | 668 | o New pipe-like BIO that allows using the SSL library when actual I/O |
| 596 | must be handled by the application (BIO pair) | 669 | must be handled by the application (BIO pair) |
| 597 | 670 | ||
| 598 | Major changes between OpenSSL 0.9.2b and OpenSSL 0.9.3: | 671 | Major changes between OpenSSL 0.9.2b and OpenSSL 0.9.3 [24 May 1999]: |
| 599 | o Lots of enhancements and cleanups to the Configuration mechanism | 672 | o Lots of enhancements and cleanups to the Configuration mechanism |
| 600 | o RSA OEAP related fixes | 673 | o RSA OEAP related fixes |
| 601 | o Added `openssl ca -revoke' option for revoking a certificate | 674 | o Added `openssl ca -revoke' option for revoking a certificate |
| @@ -609,7 +682,7 @@ | |||
| 609 | o Sparc assembler bignum implementation, optimized hash functions | 682 | o Sparc assembler bignum implementation, optimized hash functions |
| 610 | o Option to disable selected ciphers | 683 | o Option to disable selected ciphers |
| 611 | 684 | ||
| 612 | Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b: | 685 | Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b [22 Mar 1999]: |
| 613 | o Fixed a security hole related to session resumption | 686 | o Fixed a security hole related to session resumption |
| 614 | o Fixed RSA encryption routines for the p < q case | 687 | o Fixed RSA encryption routines for the p < q case |
| 615 | o "ALL" in cipher lists now means "everything except NULL ciphers" | 688 | o "ALL" in cipher lists now means "everything except NULL ciphers" |
| @@ -631,7 +704,7 @@ | |||
| 631 | o Lots of memory leak fixes. | 704 | o Lots of memory leak fixes. |
| 632 | o Lots of bug fixes. | 705 | o Lots of bug fixes. |
| 633 | 706 | ||
| 634 | Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c: | 707 | Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c [23 Dec 1998]: |
| 635 | o Integration of the popular NO_RSA/NO_DSA patches | 708 | o Integration of the popular NO_RSA/NO_DSA patches |
| 636 | o Initial support for compression inside the SSL record layer | 709 | o Initial support for compression inside the SSL record layer |
| 637 | o Added BIO proxy and filtering functionality | 710 | o Added BIO proxy and filtering functionality |
diff --git a/src/lib/libssl/src/PROBLEMS b/src/lib/libssl/src/PROBLEMS index d247470f06..3eaab01f2c 100644 --- a/src/lib/libssl/src/PROBLEMS +++ b/src/lib/libssl/src/PROBLEMS | |||
| @@ -197,3 +197,17 @@ reconfigure with additional no-sse2 [or 386] option passed to ./config. | |||
| 197 | We don't have framework to associate -ldl with no-dso, therefore the only | 197 | We don't have framework to associate -ldl with no-dso, therefore the only |
| 198 | way is to edit Makefile right after ./config no-dso and remove -ldl from | 198 | way is to edit Makefile right after ./config no-dso and remove -ldl from |
| 199 | EX_LIBS line. | 199 | EX_LIBS line. |
| 200 | |||
| 201 | * hpux-parisc2-cc no-asm build fails with SEGV in ECDSA/DH. | ||
| 202 | |||
| 203 | Compiler bug, presumably at particular patch level. Remaining | ||
| 204 | hpux*-parisc*-cc configurations can be affected too. Drop optimization | ||
| 205 | level to +O2 when compiling bn_nist.o. | ||
| 206 | |||
| 207 | * solaris64-sparcv9-cc link failure | ||
| 208 | |||
| 209 | Solaris 8 ar can fail to maintain symbol table in .a, which results in | ||
| 210 | link failures. Apply 109147-09 or later or modify Makefile generated | ||
| 211 | by ./Configure solaris64-sparcv9-cc and replace RANLIB assignment with | ||
| 212 | |||
| 213 | RANLIB= /usr/ccs/bin/ar rs | ||
diff --git a/src/lib/libssl/src/README b/src/lib/libssl/src/README index de51583a6f..10b74d19d2 100644 --- a/src/lib/libssl/src/README +++ b/src/lib/libssl/src/README | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | OpenSSL 1.0.1c 10 May 2012 | 2 | OpenSSL 1.0.1g 7 Apr 2014 |
| 3 | 3 | ||
| 4 | Copyright (c) 1998-2011 The OpenSSL Project | 4 | Copyright (c) 1998-2011 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 |
| @@ -190,7 +190,7 @@ | |||
| 190 | reason as to why that feature isn't implemented. | 190 | reason as to why that feature isn't implemented. |
| 191 | 191 | ||
| 192 | Patches should be as up to date as possible, preferably relative to the | 192 | Patches should be as up to date as possible, preferably relative to the |
| 193 | current CVS or the last snapshot. They should follow the coding style of | 193 | current Git or the last snapshot. They should follow the coding style of |
| 194 | OpenSSL and compile without warnings. Some of the core team developer targets | 194 | OpenSSL and compile without warnings. Some of the core team developer targets |
| 195 | can be used for testing purposes, (debug-steve64, debug-geoff etc). OpenSSL | 195 | can be used for testing purposes, (debug-steve64, debug-geoff etc). OpenSSL |
| 196 | compiles on many varied platforms: try to ensure you only use portable | 196 | compiles on many varied platforms: try to ensure you only use portable |
diff --git a/src/lib/libssl/src/apps/Makefile b/src/lib/libssl/src/apps/Makefile index 95f499e330..72657ea658 100644 --- a/src/lib/libssl/src/apps/Makefile +++ b/src/lib/libssl/src/apps/Makefile | |||
| @@ -577,14 +577,15 @@ openssl.o: ../include/openssl/objects.h ../include/openssl/ocsp.h | |||
| 577 | openssl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | 577 | openssl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h |
| 578 | openssl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h | 578 | openssl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h |
| 579 | openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h | 579 | openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h |
| 580 | openssl.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h | 580 | openssl.o: ../include/openssl/pqueue.h ../include/openssl/rand.h |
| 581 | openssl.o: ../include/openssl/sha.h ../include/openssl/srtp.h | 581 | openssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h |
| 582 | openssl.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h | 582 | openssl.o: ../include/openssl/srtp.h ../include/openssl/ssl.h |
| 583 | openssl.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h | 583 | openssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h |
| 584 | openssl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h | 584 | openssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h |
| 585 | openssl.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h | 585 | openssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h |
| 586 | openssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h | 586 | openssl.o: ../include/openssl/txt_db.h ../include/openssl/x509.h |
| 587 | openssl.o: ../include/openssl/x509v3.h apps.h openssl.c progs.h s_apps.h | 587 | openssl.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h |
| 588 | openssl.o: openssl.c progs.h s_apps.h | ||
| 588 | passwd.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h | 589 | passwd.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h |
| 589 | passwd.o: ../include/openssl/buffer.h ../include/openssl/conf.h | 590 | passwd.o: ../include/openssl/buffer.h ../include/openssl/conf.h |
| 590 | passwd.o: ../include/openssl/crypto.h ../include/openssl/des.h | 591 | passwd.o: ../include/openssl/crypto.h ../include/openssl/des.h |
diff --git a/src/lib/libssl/src/apps/apps.c b/src/lib/libssl/src/apps/apps.c index 4e11915b02..b76db10a5e 100644 --- a/src/lib/libssl/src/apps/apps.c +++ b/src/lib/libssl/src/apps/apps.c | |||
| @@ -586,12 +586,12 @@ int password_callback(char *buf, int bufsiz, int verify, | |||
| 586 | 586 | ||
| 587 | if (ok >= 0) | 587 | if (ok >= 0) |
| 588 | ok = UI_add_input_string(ui,prompt,ui_flags,buf, | 588 | ok = UI_add_input_string(ui,prompt,ui_flags,buf, |
| 589 | PW_MIN_LENGTH,BUFSIZ-1); | 589 | PW_MIN_LENGTH,bufsiz-1); |
| 590 | if (ok >= 0 && verify) | 590 | if (ok >= 0 && verify) |
| 591 | { | 591 | { |
| 592 | buff = (char *)OPENSSL_malloc(bufsiz); | 592 | buff = (char *)OPENSSL_malloc(bufsiz); |
| 593 | ok = UI_add_verify_string(ui,prompt,ui_flags,buff, | 593 | ok = UI_add_verify_string(ui,prompt,ui_flags,buff, |
| 594 | PW_MIN_LENGTH,BUFSIZ-1, buf); | 594 | PW_MIN_LENGTH,bufsiz-1, buf); |
| 595 | } | 595 | } |
| 596 | if (ok >= 0) | 596 | if (ok >= 0) |
| 597 | do | 597 | do |
| @@ -2132,7 +2132,7 @@ X509_NAME *parse_name(char *subject, long chtype, int multirdn) | |||
| 2132 | X509_NAME *n = NULL; | 2132 | X509_NAME *n = NULL; |
| 2133 | int nid; | 2133 | int nid; |
| 2134 | 2134 | ||
| 2135 | if (!buf || !ne_types || !ne_values) | 2135 | if (!buf || !ne_types || !ne_values || !mval) |
| 2136 | { | 2136 | { |
| 2137 | BIO_printf(bio_err, "malloc error\n"); | 2137 | BIO_printf(bio_err, "malloc error\n"); |
| 2138 | goto error; | 2138 | goto error; |
| @@ -2236,6 +2236,7 @@ X509_NAME *parse_name(char *subject, long chtype, int multirdn) | |||
| 2236 | OPENSSL_free(ne_values); | 2236 | OPENSSL_free(ne_values); |
| 2237 | OPENSSL_free(ne_types); | 2237 | OPENSSL_free(ne_types); |
| 2238 | OPENSSL_free(buf); | 2238 | OPENSSL_free(buf); |
| 2239 | OPENSSL_free(mval); | ||
| 2239 | return n; | 2240 | return n; |
| 2240 | 2241 | ||
| 2241 | error: | 2242 | error: |
| @@ -2244,6 +2245,8 @@ error: | |||
| 2244 | OPENSSL_free(ne_values); | 2245 | OPENSSL_free(ne_values); |
| 2245 | if (ne_types) | 2246 | if (ne_types) |
| 2246 | OPENSSL_free(ne_types); | 2247 | OPENSSL_free(ne_types); |
| 2248 | if (mval) | ||
| 2249 | OPENSSL_free(mval); | ||
| 2247 | if (buf) | 2250 | if (buf) |
| 2248 | OPENSSL_free(buf); | 2251 | OPENSSL_free(buf); |
| 2249 | return NULL; | 2252 | return NULL; |
| @@ -2838,7 +2841,7 @@ double app_tminterval(int stop,int usertime) | |||
| 2838 | 2841 | ||
| 2839 | if (proc==NULL) | 2842 | if (proc==NULL) |
| 2840 | { | 2843 | { |
| 2841 | if (GetVersion() < 0x80000000) | 2844 | if (check_winnt()) |
| 2842 | proc = OpenProcess(PROCESS_QUERY_INFORMATION,FALSE, | 2845 | proc = OpenProcess(PROCESS_QUERY_INFORMATION,FALSE, |
| 2843 | GetCurrentProcessId()); | 2846 | GetCurrentProcessId()); |
| 2844 | if (proc==NULL) proc = (HANDLE)-1; | 2847 | if (proc==NULL) proc = (HANDLE)-1; |
diff --git a/src/lib/libssl/src/apps/apps.h b/src/lib/libssl/src/apps/apps.h index c1ca99da12..3aeb46c4e2 100644 --- a/src/lib/libssl/src/apps/apps.h +++ b/src/lib/libssl/src/apps/apps.h | |||
| @@ -188,6 +188,7 @@ extern BIO *bio_err; | |||
| 188 | do { CONF_modules_unload(1); destroy_ui_method(); \ | 188 | do { CONF_modules_unload(1); destroy_ui_method(); \ |
| 189 | OBJ_cleanup(); EVP_cleanup(); ENGINE_cleanup(); \ | 189 | OBJ_cleanup(); EVP_cleanup(); ENGINE_cleanup(); \ |
| 190 | CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \ | 190 | CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \ |
| 191 | RAND_cleanup(); \ | ||
| 191 | ERR_free_strings(); zlib_cleanup();} while(0) | 192 | ERR_free_strings(); zlib_cleanup();} while(0) |
| 192 | # else | 193 | # else |
| 193 | # define apps_startup() \ | 194 | # define apps_startup() \ |
| @@ -198,6 +199,7 @@ extern BIO *bio_err; | |||
| 198 | do { CONF_modules_unload(1); destroy_ui_method(); \ | 199 | do { CONF_modules_unload(1); destroy_ui_method(); \ |
| 199 | OBJ_cleanup(); EVP_cleanup(); \ | 200 | OBJ_cleanup(); EVP_cleanup(); \ |
| 200 | CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \ | 201 | CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \ |
| 202 | RAND_cleanup(); \ | ||
| 201 | ERR_free_strings(); zlib_cleanup(); } while(0) | 203 | ERR_free_strings(); zlib_cleanup(); } while(0) |
| 202 | # endif | 204 | # endif |
| 203 | #endif | 205 | #endif |
diff --git a/src/lib/libssl/src/apps/ca.c b/src/lib/libssl/src/apps/ca.c index 2a83d1936e..1cf50e0029 100644 --- a/src/lib/libssl/src/apps/ca.c +++ b/src/lib/libssl/src/apps/ca.c | |||
| @@ -1408,6 +1408,7 @@ bad: | |||
| 1408 | if (!NCONF_get_number(conf,section, | 1408 | if (!NCONF_get_number(conf,section, |
| 1409 | ENV_DEFAULT_CRL_HOURS, &crlhours)) | 1409 | ENV_DEFAULT_CRL_HOURS, &crlhours)) |
| 1410 | crlhours = 0; | 1410 | crlhours = 0; |
| 1411 | ERR_clear_error(); | ||
| 1411 | } | 1412 | } |
| 1412 | if ((crldays == 0) && (crlhours == 0) && (crlsec == 0)) | 1413 | if ((crldays == 0) && (crlhours == 0) && (crlsec == 0)) |
| 1413 | { | 1414 | { |
diff --git a/src/lib/libssl/src/apps/crl.c b/src/lib/libssl/src/apps/crl.c index c395b2afd5..8797d300cf 100644 --- a/src/lib/libssl/src/apps/crl.c +++ b/src/lib/libssl/src/apps/crl.c | |||
| @@ -81,6 +81,9 @@ static const char *crl_usage[]={ | |||
| 81 | " -in arg - input file - default stdin\n", | 81 | " -in arg - input file - default stdin\n", |
| 82 | " -out arg - output file - default stdout\n", | 82 | " -out arg - output file - default stdout\n", |
| 83 | " -hash - print hash value\n", | 83 | " -hash - print hash value\n", |
| 84 | #ifndef OPENSSL_NO_MD5 | ||
| 85 | " -hash_old - print old-style (MD5) hash value\n", | ||
| 86 | #endif | ||
| 84 | " -fingerprint - print the crl fingerprint\n", | 87 | " -fingerprint - print the crl fingerprint\n", |
| 85 | " -issuer - print issuer DN\n", | 88 | " -issuer - print issuer DN\n", |
| 86 | " -lastupdate - lastUpdate field\n", | 89 | " -lastupdate - lastUpdate field\n", |
| @@ -108,6 +111,9 @@ int MAIN(int argc, char **argv) | |||
| 108 | int informat,outformat; | 111 | int informat,outformat; |
| 109 | char *infile=NULL,*outfile=NULL; | 112 | char *infile=NULL,*outfile=NULL; |
| 110 | int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0; | 113 | int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0; |
| 114 | #ifndef OPENSSL_NO_MD5 | ||
| 115 | int hash_old=0; | ||
| 116 | #endif | ||
| 111 | int fingerprint = 0, crlnumber = 0; | 117 | int fingerprint = 0, crlnumber = 0; |
| 112 | const char **pp; | 118 | const char **pp; |
| 113 | X509_STORE *store = NULL; | 119 | X509_STORE *store = NULL; |
| @@ -192,6 +198,10 @@ int MAIN(int argc, char **argv) | |||
| 192 | text = 1; | 198 | text = 1; |
| 193 | else if (strcmp(*argv,"-hash") == 0) | 199 | else if (strcmp(*argv,"-hash") == 0) |
| 194 | hash= ++num; | 200 | hash= ++num; |
| 201 | #ifndef OPENSSL_NO_MD5 | ||
| 202 | else if (strcmp(*argv,"-hash_old") == 0) | ||
| 203 | hash_old= ++num; | ||
| 204 | #endif | ||
| 195 | else if (strcmp(*argv,"-nameopt") == 0) | 205 | else if (strcmp(*argv,"-nameopt") == 0) |
| 196 | { | 206 | { |
| 197 | if (--argc < 1) goto bad; | 207 | if (--argc < 1) goto bad; |
| @@ -304,6 +314,14 @@ bad: | |||
| 304 | BIO_printf(bio_out,"%08lx\n", | 314 | BIO_printf(bio_out,"%08lx\n", |
| 305 | X509_NAME_hash(X509_CRL_get_issuer(x))); | 315 | X509_NAME_hash(X509_CRL_get_issuer(x))); |
| 306 | } | 316 | } |
| 317 | #ifndef OPENSSL_NO_MD5 | ||
| 318 | if (hash_old == i) | ||
| 319 | { | ||
| 320 | BIO_printf(bio_out,"%08lx\n", | ||
| 321 | X509_NAME_hash_old( | ||
| 322 | X509_CRL_get_issuer(x))); | ||
| 323 | } | ||
| 324 | #endif | ||
| 307 | if (lastupdate == i) | 325 | if (lastupdate == i) |
| 308 | { | 326 | { |
| 309 | BIO_printf(bio_out,"lastUpdate="); | 327 | BIO_printf(bio_out,"lastUpdate="); |
diff --git a/src/lib/libssl/src/apps/dgst.c b/src/lib/libssl/src/apps/dgst.c index b08e9a7c78..f4aec779c1 100644 --- a/src/lib/libssl/src/apps/dgst.c +++ b/src/lib/libssl/src/apps/dgst.c | |||
| @@ -216,10 +216,10 @@ int MAIN(int argc, char **argv) | |||
| 216 | out_bin = 1; | 216 | out_bin = 1; |
| 217 | else if (strcmp(*argv,"-d") == 0) | 217 | else if (strcmp(*argv,"-d") == 0) |
| 218 | debug=1; | 218 | debug=1; |
| 219 | else if (strcmp(*argv,"-non-fips-allow") == 0) | ||
| 220 | non_fips_allow=1; | ||
| 221 | else if (!strcmp(*argv,"-fips-fingerprint")) | 219 | else if (!strcmp(*argv,"-fips-fingerprint")) |
| 222 | hmac_key = "etaonrishdlcupfm"; | 220 | hmac_key = "etaonrishdlcupfm"; |
| 221 | else if (strcmp(*argv,"-non-fips-allow") == 0) | ||
| 222 | non_fips_allow=1; | ||
| 223 | else if (!strcmp(*argv,"-hmac")) | 223 | else if (!strcmp(*argv,"-hmac")) |
| 224 | { | 224 | { |
| 225 | if (--argc < 1) | 225 | if (--argc < 1) |
| @@ -427,9 +427,9 @@ int MAIN(int argc, char **argv) | |||
| 427 | goto end; | 427 | goto end; |
| 428 | } | 428 | } |
| 429 | if (do_verify) | 429 | if (do_verify) |
| 430 | r = EVP_DigestVerifyInit(mctx, &pctx, md, e, sigkey); | 430 | r = EVP_DigestVerifyInit(mctx, &pctx, md, NULL, sigkey); |
| 431 | else | 431 | else |
| 432 | r = EVP_DigestSignInit(mctx, &pctx, md, e, sigkey); | 432 | r = EVP_DigestSignInit(mctx, &pctx, md, NULL, sigkey); |
| 433 | if (!r) | 433 | if (!r) |
| 434 | { | 434 | { |
| 435 | BIO_printf(bio_err, "Error setting context\n"); | 435 | BIO_printf(bio_err, "Error setting context\n"); |
diff --git a/src/lib/libssl/src/apps/dhparam.c b/src/lib/libssl/src/apps/dhparam.c index b47097cbb2..1297d6fb5e 100644 --- a/src/lib/libssl/src/apps/dhparam.c +++ b/src/lib/libssl/src/apps/dhparam.c | |||
| @@ -332,7 +332,6 @@ bad: | |||
| 332 | BIO_printf(bio_err,"This is going to take a long time\n"); | 332 | BIO_printf(bio_err,"This is going to take a long time\n"); |
| 333 | if(!dh || !DH_generate_parameters_ex(dh, num, g, &cb)) | 333 | if(!dh || !DH_generate_parameters_ex(dh, num, g, &cb)) |
| 334 | { | 334 | { |
| 335 | if(dh) DH_free(dh); | ||
| 336 | ERR_print_errors(bio_err); | 335 | ERR_print_errors(bio_err); |
| 337 | goto end; | 336 | goto end; |
| 338 | } | 337 | } |
diff --git a/src/lib/libssl/src/apps/dsaparam.c b/src/lib/libssl/src/apps/dsaparam.c index fe72c1d3df..683d51391b 100644 --- a/src/lib/libssl/src/apps/dsaparam.c +++ b/src/lib/libssl/src/apps/dsaparam.c | |||
| @@ -326,6 +326,7 @@ bad: | |||
| 326 | goto end; | 326 | goto end; |
| 327 | } | 327 | } |
| 328 | #endif | 328 | #endif |
| 329 | ERR_print_errors(bio_err); | ||
| 329 | BIO_printf(bio_err,"Error, DSA key generation failed\n"); | 330 | BIO_printf(bio_err,"Error, DSA key generation failed\n"); |
| 330 | goto end; | 331 | goto end; |
| 331 | } | 332 | } |
| @@ -429,13 +430,19 @@ bad: | |||
| 429 | 430 | ||
| 430 | assert(need_rand); | 431 | assert(need_rand); |
| 431 | if ((dsakey=DSAparams_dup(dsa)) == NULL) goto end; | 432 | if ((dsakey=DSAparams_dup(dsa)) == NULL) goto end; |
| 432 | if (!DSA_generate_key(dsakey)) goto end; | 433 | if (!DSA_generate_key(dsakey)) |
| 434 | { | ||
| 435 | ERR_print_errors(bio_err); | ||
| 436 | DSA_free(dsakey); | ||
| 437 | goto end; | ||
| 438 | } | ||
| 433 | if (outformat == FORMAT_ASN1) | 439 | if (outformat == FORMAT_ASN1) |
| 434 | i=i2d_DSAPrivateKey_bio(out,dsakey); | 440 | i=i2d_DSAPrivateKey_bio(out,dsakey); |
| 435 | else if (outformat == FORMAT_PEM) | 441 | else if (outformat == FORMAT_PEM) |
| 436 | i=PEM_write_bio_DSAPrivateKey(out,dsakey,NULL,NULL,0,NULL,NULL); | 442 | i=PEM_write_bio_DSAPrivateKey(out,dsakey,NULL,NULL,0,NULL,NULL); |
| 437 | else { | 443 | else { |
| 438 | BIO_printf(bio_err,"bad output format specified for outfile\n"); | 444 | BIO_printf(bio_err,"bad output format specified for outfile\n"); |
| 445 | DSA_free(dsakey); | ||
| 439 | goto end; | 446 | goto end; |
| 440 | } | 447 | } |
| 441 | DSA_free(dsakey); | 448 | DSA_free(dsakey); |
diff --git a/src/lib/libssl/src/apps/genrsa.c b/src/lib/libssl/src/apps/genrsa.c index 37e9310910..ece114c876 100644 --- a/src/lib/libssl/src/apps/genrsa.c +++ b/src/lib/libssl/src/apps/genrsa.c | |||
| @@ -78,7 +78,7 @@ | |||
| 78 | #include <openssl/pem.h> | 78 | #include <openssl/pem.h> |
| 79 | #include <openssl/rand.h> | 79 | #include <openssl/rand.h> |
| 80 | 80 | ||
| 81 | #define DEFBITS 512 | 81 | #define DEFBITS 1024 |
| 82 | #undef PROG | 82 | #undef PROG |
| 83 | #define PROG genrsa_main | 83 | #define PROG genrsa_main |
| 84 | 84 | ||
diff --git a/src/lib/libssl/src/apps/ocsp.c b/src/lib/libssl/src/apps/ocsp.c index 01847dfad7..83c5a76700 100644 --- a/src/lib/libssl/src/apps/ocsp.c +++ b/src/lib/libssl/src/apps/ocsp.c | |||
| @@ -617,7 +617,7 @@ int MAIN(int argc, char **argv) | |||
| 617 | BIO_printf (bio_err, "-ndays n number of days before next update\n"); | 617 | BIO_printf (bio_err, "-ndays n number of days before next update\n"); |
| 618 | BIO_printf (bio_err, "-resp_key_id identify reponse by signing certificate key ID\n"); | 618 | BIO_printf (bio_err, "-resp_key_id identify reponse by signing certificate key ID\n"); |
| 619 | BIO_printf (bio_err, "-nrequest n number of requests to accept (default unlimited)\n"); | 619 | BIO_printf (bio_err, "-nrequest n number of requests to accept (default unlimited)\n"); |
| 620 | BIO_printf (bio_err, "-<dgst alg> use specified digest in the request"); | 620 | BIO_printf (bio_err, "-<dgst alg> use specified digest in the request\n"); |
| 621 | goto end; | 621 | goto end; |
| 622 | } | 622 | } |
| 623 | 623 | ||
diff --git a/src/lib/libssl/src/apps/openssl.c b/src/lib/libssl/src/apps/openssl.c index 1c880d90ba..71e1e48ece 100644 --- a/src/lib/libssl/src/apps/openssl.c +++ b/src/lib/libssl/src/apps/openssl.c | |||
| @@ -117,6 +117,7 @@ | |||
| 117 | #include "apps.h" | 117 | #include "apps.h" |
| 118 | #include <openssl/bio.h> | 118 | #include <openssl/bio.h> |
| 119 | #include <openssl/crypto.h> | 119 | #include <openssl/crypto.h> |
| 120 | #include <openssl/rand.h> | ||
| 120 | #include <openssl/lhash.h> | 121 | #include <openssl/lhash.h> |
| 121 | #include <openssl/conf.h> | 122 | #include <openssl/conf.h> |
| 122 | #include <openssl/x509.h> | 123 | #include <openssl/x509.h> |
diff --git a/src/lib/libssl/src/apps/pkcs12.c b/src/lib/libssl/src/apps/pkcs12.c index b54c6f84a4..4d62a7b8ca 100644 --- a/src/lib/libssl/src/apps/pkcs12.c +++ b/src/lib/libssl/src/apps/pkcs12.c | |||
| @@ -112,7 +112,7 @@ int MAIN(int argc, char **argv) | |||
| 112 | int maciter = PKCS12_DEFAULT_ITER; | 112 | int maciter = PKCS12_DEFAULT_ITER; |
| 113 | int twopass = 0; | 113 | int twopass = 0; |
| 114 | int keytype = 0; | 114 | int keytype = 0; |
| 115 | int cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC; | 115 | int cert_pbe; |
| 116 | int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | 116 | int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; |
| 117 | int ret = 1; | 117 | int ret = 1; |
| 118 | int macver = 1; | 118 | int macver = 1; |
| @@ -130,6 +130,13 @@ int MAIN(int argc, char **argv) | |||
| 130 | 130 | ||
| 131 | apps_startup(); | 131 | apps_startup(); |
| 132 | 132 | ||
| 133 | #ifdef OPENSSL_FIPS | ||
| 134 | if (FIPS_mode()) | ||
| 135 | cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | ||
| 136 | else | ||
| 137 | #endif | ||
| 138 | cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC; | ||
| 139 | |||
| 133 | enc = EVP_des_ede3_cbc(); | 140 | enc = EVP_des_ede3_cbc(); |
| 134 | if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); | 141 | if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); |
| 135 | 142 | ||
diff --git a/src/lib/libssl/src/apps/req.c b/src/lib/libssl/src/apps/req.c index 85526581ce..5e034a85e8 100644 --- a/src/lib/libssl/src/apps/req.c +++ b/src/lib/libssl/src/apps/req.c | |||
| @@ -644,6 +644,11 @@ bad: | |||
| 644 | if (inrand) | 644 | if (inrand) |
| 645 | app_RAND_load_files(inrand); | 645 | app_RAND_load_files(inrand); |
| 646 | 646 | ||
| 647 | if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey)) | ||
| 648 | { | ||
| 649 | newkey=DEFAULT_KEY_LENGTH; | ||
| 650 | } | ||
| 651 | |||
| 647 | if (keyalg) | 652 | if (keyalg) |
| 648 | { | 653 | { |
| 649 | genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey, | 654 | genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey, |
| @@ -652,12 +657,6 @@ bad: | |||
| 652 | goto end; | 657 | goto end; |
| 653 | } | 658 | } |
| 654 | 659 | ||
| 655 | if (newkey <= 0) | ||
| 656 | { | ||
| 657 | if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey)) | ||
| 658 | newkey=DEFAULT_KEY_LENGTH; | ||
| 659 | } | ||
| 660 | |||
| 661 | if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA)) | 660 | if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA)) |
| 662 | { | 661 | { |
| 663 | BIO_printf(bio_err,"private key length is too short,\n"); | 662 | BIO_printf(bio_err,"private key length is too short,\n"); |
| @@ -1649,6 +1648,8 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type, | |||
| 1649 | keylen = atol(p + 1); | 1648 | keylen = atol(p + 1); |
| 1650 | *pkeylen = keylen; | 1649 | *pkeylen = keylen; |
| 1651 | } | 1650 | } |
| 1651 | else | ||
| 1652 | keylen = *pkeylen; | ||
| 1652 | } | 1653 | } |
| 1653 | else if (p) | 1654 | else if (p) |
| 1654 | paramfile = p + 1; | 1655 | paramfile = p + 1; |
diff --git a/src/lib/libssl/src/apps/s_cb.c b/src/lib/libssl/src/apps/s_cb.c index 2cd73376df..84c3b447c2 100644 --- a/src/lib/libssl/src/apps/s_cb.c +++ b/src/lib/libssl/src/apps/s_cb.c | |||
| @@ -237,8 +237,8 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file) | |||
| 237 | 237 | ||
| 238 | /* If we are using DSA, we can copy the parameters from | 238 | /* If we are using DSA, we can copy the parameters from |
| 239 | * the private key */ | 239 | * the private key */ |
| 240 | 240 | ||
| 241 | 241 | ||
| 242 | /* Now we know that a key and cert have been set against | 242 | /* Now we know that a key and cert have been set against |
| 243 | * the SSL context */ | 243 | * the SSL context */ |
| 244 | if (!SSL_CTX_check_private_key(ctx)) | 244 | if (!SSL_CTX_check_private_key(ctx)) |
| @@ -436,6 +436,8 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void * | |||
| 436 | 436 | ||
| 437 | if (version == SSL3_VERSION || | 437 | if (version == SSL3_VERSION || |
| 438 | version == TLS1_VERSION || | 438 | version == TLS1_VERSION || |
| 439 | version == TLS1_1_VERSION || | ||
| 440 | version == TLS1_2_VERSION || | ||
| 439 | version == DTLS1_VERSION || | 441 | version == DTLS1_VERSION || |
| 440 | version == DTLS1_BAD_VER) | 442 | version == DTLS1_BAD_VER) |
| 441 | { | 443 | { |
diff --git a/src/lib/libssl/src/apps/s_client.c b/src/lib/libssl/src/apps/s_client.c index fc806eb672..3ba6605603 100644 --- a/src/lib/libssl/src/apps/s_client.c +++ b/src/lib/libssl/src/apps/s_client.c | |||
| @@ -357,12 +357,14 @@ static void sc_usage(void) | |||
| 357 | BIO_printf(bio_err," -tlsextdebug - hex dump of all TLS extensions received\n"); | 357 | BIO_printf(bio_err," -tlsextdebug - hex dump of all TLS extensions received\n"); |
| 358 | BIO_printf(bio_err," -status - request certificate status from server\n"); | 358 | BIO_printf(bio_err," -status - request certificate status from server\n"); |
| 359 | BIO_printf(bio_err," -no_ticket - disable use of RFC4507bis session tickets\n"); | 359 | BIO_printf(bio_err," -no_ticket - disable use of RFC4507bis session tickets\n"); |
| 360 | # if !defined(OPENSSL_NO_NEXTPROTONEG) | 360 | # ifndef OPENSSL_NO_NEXTPROTONEG |
| 361 | BIO_printf(bio_err," -nextprotoneg arg - enable NPN extension, considering named protocols supported (comma-separated list)\n"); | 361 | BIO_printf(bio_err," -nextprotoneg arg - enable NPN extension, considering named protocols supported (comma-separated list)\n"); |
| 362 | # endif | 362 | # endif |
| 363 | #endif | 363 | #endif |
| 364 | BIO_printf(bio_err," -legacy_renegotiation - enable use of legacy renegotiation (dangerous)\n"); | 364 | BIO_printf(bio_err," -legacy_renegotiation - enable use of legacy renegotiation (dangerous)\n"); |
| 365 | #ifndef OPENSSL_NO_SRTP | ||
| 365 | BIO_printf(bio_err," -use_srtp profiles - Offer SRTP key management with a colon-separated profile list\n"); | 366 | BIO_printf(bio_err," -use_srtp profiles - Offer SRTP key management with a colon-separated profile list\n"); |
| 367 | #endif | ||
| 366 | BIO_printf(bio_err," -keymatexport label - Export keying material using label\n"); | 368 | BIO_printf(bio_err," -keymatexport label - Export keying material using label\n"); |
| 367 | BIO_printf(bio_err," -keymatexportlen len - Export len bytes of keying material (default 20)\n"); | 369 | BIO_printf(bio_err," -keymatexportlen len - Export len bytes of keying material (default 20)\n"); |
| 368 | } | 370 | } |
| @@ -502,7 +504,9 @@ static char * MS_CALLBACK ssl_give_srp_client_pwd_cb(SSL *s, void *arg) | |||
| 502 | } | 504 | } |
| 503 | 505 | ||
| 504 | #endif | 506 | #endif |
| 507 | #ifndef OPENSSL_NO_SRTP | ||
| 505 | char *srtp_profiles = NULL; | 508 | char *srtp_profiles = NULL; |
| 509 | #endif | ||
| 506 | 510 | ||
| 507 | # ifndef OPENSSL_NO_NEXTPROTONEG | 511 | # ifndef OPENSSL_NO_NEXTPROTONEG |
| 508 | /* This the context that we pass to next_proto_cb */ | 512 | /* This the context that we pass to next_proto_cb */ |
| @@ -536,7 +540,7 @@ static int next_proto_cb(SSL *s, unsigned char **out, unsigned char *outlen, con | |||
| 536 | ctx->status = SSL_select_next_proto(out, outlen, in, inlen, ctx->data, ctx->len); | 540 | ctx->status = SSL_select_next_proto(out, outlen, in, inlen, ctx->data, ctx->len); |
| 537 | return SSL_TLSEXT_ERR_OK; | 541 | return SSL_TLSEXT_ERR_OK; |
| 538 | } | 542 | } |
| 539 | # endif | 543 | # endif /* ndef OPENSSL_NO_NEXTPROTONEG */ |
| 540 | #endif | 544 | #endif |
| 541 | 545 | ||
| 542 | enum | 546 | enum |
| @@ -945,11 +949,13 @@ int MAIN(int argc, char **argv) | |||
| 945 | jpake_secret = *++argv; | 949 | jpake_secret = *++argv; |
| 946 | } | 950 | } |
| 947 | #endif | 951 | #endif |
| 952 | #ifndef OPENSSL_NO_SRTP | ||
| 948 | else if (strcmp(*argv,"-use_srtp") == 0) | 953 | else if (strcmp(*argv,"-use_srtp") == 0) |
| 949 | { | 954 | { |
| 950 | if (--argc < 1) goto bad; | 955 | if (--argc < 1) goto bad; |
| 951 | srtp_profiles = *(++argv); | 956 | srtp_profiles = *(++argv); |
| 952 | } | 957 | } |
| 958 | #endif | ||
| 953 | else if (strcmp(*argv,"-keymatexport") == 0) | 959 | else if (strcmp(*argv,"-keymatexport") == 0) |
| 954 | { | 960 | { |
| 955 | if (--argc < 1) goto bad; | 961 | if (--argc < 1) goto bad; |
| @@ -1130,6 +1136,8 @@ bad: | |||
| 1130 | BIO_printf(bio_c_out, "PSK key given or JPAKE in use, setting client callback\n"); | 1136 | BIO_printf(bio_c_out, "PSK key given or JPAKE in use, setting client callback\n"); |
| 1131 | SSL_CTX_set_psk_client_callback(ctx, psk_client_cb); | 1137 | SSL_CTX_set_psk_client_callback(ctx, psk_client_cb); |
| 1132 | } | 1138 | } |
| 1139 | #endif | ||
| 1140 | #ifndef OPENSSL_NO_SRTP | ||
| 1133 | if (srtp_profiles != NULL) | 1141 | if (srtp_profiles != NULL) |
| 1134 | SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles); | 1142 | SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles); |
| 1135 | #endif | 1143 | #endif |
| @@ -1890,6 +1898,10 @@ end: | |||
| 1890 | print_stuff(bio_c_out,con,1); | 1898 | print_stuff(bio_c_out,con,1); |
| 1891 | SSL_free(con); | 1899 | SSL_free(con); |
| 1892 | } | 1900 | } |
| 1901 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) | ||
| 1902 | if (next_proto.data) | ||
| 1903 | OPENSSL_free(next_proto.data); | ||
| 1904 | #endif | ||
| 1893 | if (ctx != NULL) SSL_CTX_free(ctx); | 1905 | if (ctx != NULL) SSL_CTX_free(ctx); |
| 1894 | if (cert) | 1906 | if (cert) |
| 1895 | X509_free(cert); | 1907 | X509_free(cert); |
| @@ -1897,6 +1909,8 @@ end: | |||
| 1897 | EVP_PKEY_free(key); | 1909 | EVP_PKEY_free(key); |
| 1898 | if (pass) | 1910 | if (pass) |
| 1899 | OPENSSL_free(pass); | 1911 | OPENSSL_free(pass); |
| 1912 | if (vpm) | ||
| 1913 | X509_VERIFY_PARAM_free(vpm); | ||
| 1900 | if (cbuf != NULL) { OPENSSL_cleanse(cbuf,BUFSIZZ); OPENSSL_free(cbuf); } | 1914 | if (cbuf != NULL) { OPENSSL_cleanse(cbuf,BUFSIZZ); OPENSSL_free(cbuf); } |
| 1901 | if (sbuf != NULL) { OPENSSL_cleanse(sbuf,BUFSIZZ); OPENSSL_free(sbuf); } | 1915 | if (sbuf != NULL) { OPENSSL_cleanse(sbuf,BUFSIZZ); OPENSSL_free(sbuf); } |
| 1902 | if (mbuf != NULL) { OPENSSL_cleanse(mbuf,BUFSIZZ); OPENSSL_free(mbuf); } | 1916 | if (mbuf != NULL) { OPENSSL_cleanse(mbuf,BUFSIZZ); OPENSSL_free(mbuf); } |
| @@ -2061,6 +2075,7 @@ static void print_stuff(BIO *bio, SSL *s, int full) | |||
| 2061 | } | 2075 | } |
| 2062 | #endif | 2076 | #endif |
| 2063 | 2077 | ||
| 2078 | #ifndef OPENSSL_NO_SRTP | ||
| 2064 | { | 2079 | { |
| 2065 | SRTP_PROTECTION_PROFILE *srtp_profile=SSL_get_selected_srtp_profile(s); | 2080 | SRTP_PROTECTION_PROFILE *srtp_profile=SSL_get_selected_srtp_profile(s); |
| 2066 | 2081 | ||
| @@ -2068,6 +2083,7 @@ static void print_stuff(BIO *bio, SSL *s, int full) | |||
| 2068 | BIO_printf(bio,"SRTP Extension negotiated, profile=%s\n", | 2083 | BIO_printf(bio,"SRTP Extension negotiated, profile=%s\n", |
| 2069 | srtp_profile->name); | 2084 | srtp_profile->name); |
| 2070 | } | 2085 | } |
| 2086 | #endif | ||
| 2071 | 2087 | ||
| 2072 | SSL_SESSION_print(bio,SSL_get_session(s)); | 2088 | SSL_SESSION_print(bio,SSL_get_session(s)); |
| 2073 | if (keymatexportlabel != NULL) | 2089 | if (keymatexportlabel != NULL) |
diff --git a/src/lib/libssl/src/apps/s_server.c b/src/lib/libssl/src/apps/s_server.c index 3f9b3704c6..8198d7f065 100644 --- a/src/lib/libssl/src/apps/s_server.c +++ b/src/lib/libssl/src/apps/s_server.c | |||
| @@ -556,7 +556,9 @@ static void sv_usage(void) | |||
| 556 | # ifndef OPENSSL_NO_NEXTPROTONEG | 556 | # ifndef OPENSSL_NO_NEXTPROTONEG |
| 557 | BIO_printf(bio_err," -nextprotoneg arg - set the advertised protocols for the NPN extension (comma-separated list)\n"); | 557 | BIO_printf(bio_err," -nextprotoneg arg - set the advertised protocols for the NPN extension (comma-separated list)\n"); |
| 558 | # endif | 558 | # endif |
| 559 | # ifndef OPENSSL_NO_SRTP | ||
| 559 | BIO_printf(bio_err," -use_srtp profiles - Offer SRTP key management with a colon-separated profile list\n"); | 560 | BIO_printf(bio_err," -use_srtp profiles - Offer SRTP key management with a colon-separated profile list\n"); |
| 561 | # endif | ||
| 560 | #endif | 562 | #endif |
| 561 | BIO_printf(bio_err," -keymatexport label - Export keying material using label\n"); | 563 | BIO_printf(bio_err," -keymatexport label - Export keying material using label\n"); |
| 562 | BIO_printf(bio_err," -keymatexportlen len - Export len bytes of keying material (default 20)\n"); | 564 | BIO_printf(bio_err," -keymatexportlen len - Export len bytes of keying material (default 20)\n"); |
| @@ -923,7 +925,9 @@ static char *jpake_secret = NULL; | |||
| 923 | #ifndef OPENSSL_NO_SRP | 925 | #ifndef OPENSSL_NO_SRP |
| 924 | static srpsrvparm srp_callback_parm; | 926 | static srpsrvparm srp_callback_parm; |
| 925 | #endif | 927 | #endif |
| 928 | #ifndef OPENSSL_NO_SRTP | ||
| 926 | static char *srtp_profiles = NULL; | 929 | static char *srtp_profiles = NULL; |
| 930 | #endif | ||
| 927 | 931 | ||
| 928 | int MAIN(int argc, char *argv[]) | 932 | int MAIN(int argc, char *argv[]) |
| 929 | { | 933 | { |
| @@ -1206,13 +1210,13 @@ int MAIN(int argc, char *argv[]) | |||
| 1206 | { | 1210 | { |
| 1207 | if (--argc < 1) goto bad; | 1211 | if (--argc < 1) goto bad; |
| 1208 | srp_verifier_file = *(++argv); | 1212 | srp_verifier_file = *(++argv); |
| 1209 | meth=TLSv1_server_method(); | 1213 | meth = TLSv1_server_method(); |
| 1210 | } | 1214 | } |
| 1211 | else if (strcmp(*argv, "-srpuserseed") == 0) | 1215 | else if (strcmp(*argv, "-srpuserseed") == 0) |
| 1212 | { | 1216 | { |
| 1213 | if (--argc < 1) goto bad; | 1217 | if (--argc < 1) goto bad; |
| 1214 | srpuserseed = *(++argv); | 1218 | srpuserseed = *(++argv); |
| 1215 | meth=TLSv1_server_method(); | 1219 | meth = TLSv1_server_method(); |
| 1216 | } | 1220 | } |
| 1217 | #endif | 1221 | #endif |
| 1218 | else if (strcmp(*argv,"-www") == 0) | 1222 | else if (strcmp(*argv,"-www") == 0) |
| @@ -1319,11 +1323,13 @@ int MAIN(int argc, char *argv[]) | |||
| 1319 | jpake_secret = *(++argv); | 1323 | jpake_secret = *(++argv); |
| 1320 | } | 1324 | } |
| 1321 | #endif | 1325 | #endif |
| 1326 | #ifndef OPENSSL_NO_SRTP | ||
| 1322 | else if (strcmp(*argv,"-use_srtp") == 0) | 1327 | else if (strcmp(*argv,"-use_srtp") == 0) |
| 1323 | { | 1328 | { |
| 1324 | if (--argc < 1) goto bad; | 1329 | if (--argc < 1) goto bad; |
| 1325 | srtp_profiles = *(++argv); | 1330 | srtp_profiles = *(++argv); |
| 1326 | } | 1331 | } |
| 1332 | #endif | ||
| 1327 | else if (strcmp(*argv,"-keymatexport") == 0) | 1333 | else if (strcmp(*argv,"-keymatexport") == 0) |
| 1328 | { | 1334 | { |
| 1329 | if (--argc < 1) goto bad; | 1335 | if (--argc < 1) goto bad; |
| @@ -1431,25 +1437,24 @@ bad: | |||
| 1431 | goto end; | 1437 | goto end; |
| 1432 | } | 1438 | } |
| 1433 | } | 1439 | } |
| 1434 | |||
| 1435 | # ifndef OPENSSL_NO_NEXTPROTONEG | ||
| 1436 | if (next_proto_neg_in) | ||
| 1437 | { | ||
| 1438 | unsigned short len; | ||
| 1439 | next_proto.data = next_protos_parse(&len, | ||
| 1440 | next_proto_neg_in); | ||
| 1441 | if (next_proto.data == NULL) | ||
| 1442 | goto end; | ||
| 1443 | next_proto.len = len; | ||
| 1444 | } | ||
| 1445 | else | ||
| 1446 | { | ||
| 1447 | next_proto.data = NULL; | ||
| 1448 | } | ||
| 1449 | # endif | ||
| 1450 | #endif | 1440 | #endif |
| 1451 | } | 1441 | } |
| 1452 | 1442 | ||
| 1443 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) | ||
| 1444 | if (next_proto_neg_in) | ||
| 1445 | { | ||
| 1446 | unsigned short len; | ||
| 1447 | next_proto.data = next_protos_parse(&len, next_proto_neg_in); | ||
| 1448 | if (next_proto.data == NULL) | ||
| 1449 | goto end; | ||
| 1450 | next_proto.len = len; | ||
| 1451 | } | ||
| 1452 | else | ||
| 1453 | { | ||
| 1454 | next_proto.data = NULL; | ||
| 1455 | } | ||
| 1456 | #endif | ||
| 1457 | |||
| 1453 | 1458 | ||
| 1454 | if (s_dcert_file) | 1459 | if (s_dcert_file) |
| 1455 | { | 1460 | { |
| @@ -1550,8 +1555,10 @@ bad: | |||
| 1550 | else | 1555 | else |
| 1551 | SSL_CTX_sess_set_cache_size(ctx,128); | 1556 | SSL_CTX_sess_set_cache_size(ctx,128); |
| 1552 | 1557 | ||
| 1558 | #ifndef OPENSSL_NO_SRTP | ||
| 1553 | if (srtp_profiles != NULL) | 1559 | if (srtp_profiles != NULL) |
| 1554 | SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles); | 1560 | SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles); |
| 1561 | #endif | ||
| 1555 | 1562 | ||
| 1556 | #if 0 | 1563 | #if 0 |
| 1557 | if (cipher == NULL) cipher=getenv("SSL_CIPHER"); | 1564 | if (cipher == NULL) cipher=getenv("SSL_CIPHER"); |
| @@ -1730,7 +1737,7 @@ bad: | |||
| 1730 | } | 1737 | } |
| 1731 | #endif | 1738 | #endif |
| 1732 | 1739 | ||
| 1733 | if (!set_cert_key_stuff(ctx,s_cert,s_key)) | 1740 | if (!set_cert_key_stuff(ctx, s_cert, s_key)) |
| 1734 | goto end; | 1741 | goto end; |
| 1735 | #ifndef OPENSSL_NO_TLSEXT | 1742 | #ifndef OPENSSL_NO_TLSEXT |
| 1736 | if (ctx2 && !set_cert_key_stuff(ctx2,s_cert2,s_key2)) | 1743 | if (ctx2 && !set_cert_key_stuff(ctx2,s_cert2,s_key2)) |
| @@ -1738,7 +1745,7 @@ bad: | |||
| 1738 | #endif | 1745 | #endif |
| 1739 | if (s_dcert != NULL) | 1746 | if (s_dcert != NULL) |
| 1740 | { | 1747 | { |
| 1741 | if (!set_cert_key_stuff(ctx,s_dcert,s_dkey)) | 1748 | if (!set_cert_key_stuff(ctx, s_dcert, s_dkey)) |
| 1742 | goto end; | 1749 | goto end; |
| 1743 | } | 1750 | } |
| 1744 | 1751 | ||
| @@ -1893,7 +1900,15 @@ end: | |||
| 1893 | OPENSSL_free(pass); | 1900 | OPENSSL_free(pass); |
| 1894 | if (dpass) | 1901 | if (dpass) |
| 1895 | OPENSSL_free(dpass); | 1902 | OPENSSL_free(dpass); |
| 1903 | if (vpm) | ||
| 1904 | X509_VERIFY_PARAM_free(vpm); | ||
| 1896 | #ifndef OPENSSL_NO_TLSEXT | 1905 | #ifndef OPENSSL_NO_TLSEXT |
| 1906 | if (tlscstatp.host) | ||
| 1907 | OPENSSL_free(tlscstatp.host); | ||
| 1908 | if (tlscstatp.port) | ||
| 1909 | OPENSSL_free(tlscstatp.port); | ||
| 1910 | if (tlscstatp.path) | ||
| 1911 | OPENSSL_free(tlscstatp.path); | ||
| 1897 | if (ctx2 != NULL) SSL_CTX_free(ctx2); | 1912 | if (ctx2 != NULL) SSL_CTX_free(ctx2); |
| 1898 | if (s_cert2) | 1913 | if (s_cert2) |
| 1899 | X509_free(s_cert2); | 1914 | X509_free(s_cert2); |
| @@ -2433,6 +2448,7 @@ static int init_ssl_connection(SSL *con) | |||
| 2433 | BIO_printf(bio_s_out,"Shared ciphers:%s\n",buf); | 2448 | BIO_printf(bio_s_out,"Shared ciphers:%s\n",buf); |
| 2434 | str=SSL_CIPHER_get_name(SSL_get_current_cipher(con)); | 2449 | str=SSL_CIPHER_get_name(SSL_get_current_cipher(con)); |
| 2435 | BIO_printf(bio_s_out,"CIPHER is %s\n",(str != NULL)?str:"(NONE)"); | 2450 | BIO_printf(bio_s_out,"CIPHER is %s\n",(str != NULL)?str:"(NONE)"); |
| 2451 | |||
| 2436 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) | 2452 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) |
| 2437 | SSL_get0_next_proto_negotiated(con, &next_proto_neg, &next_proto_neg_len); | 2453 | SSL_get0_next_proto_negotiated(con, &next_proto_neg, &next_proto_neg_len); |
| 2438 | if (next_proto_neg) | 2454 | if (next_proto_neg) |
| @@ -2442,6 +2458,7 @@ static int init_ssl_connection(SSL *con) | |||
| 2442 | BIO_printf(bio_s_out, "\n"); | 2458 | BIO_printf(bio_s_out, "\n"); |
| 2443 | } | 2459 | } |
| 2444 | #endif | 2460 | #endif |
| 2461 | #ifndef OPENSSL_NO_SRTP | ||
| 2445 | { | 2462 | { |
| 2446 | SRTP_PROTECTION_PROFILE *srtp_profile | 2463 | SRTP_PROTECTION_PROFILE *srtp_profile |
| 2447 | = SSL_get_selected_srtp_profile(con); | 2464 | = SSL_get_selected_srtp_profile(con); |
| @@ -2450,6 +2467,7 @@ static int init_ssl_connection(SSL *con) | |||
| 2450 | BIO_printf(bio_s_out,"SRTP Extension negotiated, profile=%s\n", | 2467 | BIO_printf(bio_s_out,"SRTP Extension negotiated, profile=%s\n", |
| 2451 | srtp_profile->name); | 2468 | srtp_profile->name); |
| 2452 | } | 2469 | } |
| 2470 | #endif | ||
| 2453 | if (SSL_cache_hit(con)) BIO_printf(bio_s_out,"Reused session-id\n"); | 2471 | if (SSL_cache_hit(con)) BIO_printf(bio_s_out,"Reused session-id\n"); |
| 2454 | if (SSL_ctrl(con,SSL_CTRL_GET_FLAGS,0,NULL) & | 2472 | if (SSL_ctrl(con,SSL_CTRL_GET_FLAGS,0,NULL) & |
| 2455 | TLS1_FLAGS_TLS_PADDING_BUG) | 2473 | TLS1_FLAGS_TLS_PADDING_BUG) |
| @@ -2701,6 +2719,11 @@ static int www_body(char *hostname, int s, unsigned char *context) | |||
| 2701 | } | 2719 | } |
| 2702 | BIO_puts(io,"\n"); | 2720 | BIO_puts(io,"\n"); |
| 2703 | 2721 | ||
| 2722 | BIO_printf(io, | ||
| 2723 | "Secure Renegotiation IS%s supported\n", | ||
| 2724 | SSL_get_secure_renegotiation_support(con) ? | ||
| 2725 | "" : " NOT"); | ||
| 2726 | |||
| 2704 | /* The following is evil and should not really | 2727 | /* The following is evil and should not really |
| 2705 | * be done */ | 2728 | * be done */ |
| 2706 | BIO_printf(io,"Ciphers supported in s_server binary\n"); | 2729 | BIO_printf(io,"Ciphers supported in s_server binary\n"); |
diff --git a/src/lib/libssl/src/apps/speed.c b/src/lib/libssl/src/apps/speed.c index 8358b12fdd..9886ca3766 100644 --- a/src/lib/libssl/src/apps/speed.c +++ b/src/lib/libssl/src/apps/speed.c | |||
| @@ -254,7 +254,7 @@ static const char *names[ALGOR_NUM]={ | |||
| 254 | "aes-128 cbc","aes-192 cbc","aes-256 cbc", | 254 | "aes-128 cbc","aes-192 cbc","aes-256 cbc", |
| 255 | "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc", | 255 | "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc", |
| 256 | "evp","sha256","sha512","whirlpool", | 256 | "evp","sha256","sha512","whirlpool", |
| 257 | "aes-128 ige","aes-192 ige","aes-256 ige","ghash"}; | 257 | "aes-128 ige","aes-192 ige","aes-256 ige","ghash" }; |
| 258 | static double results[ALGOR_NUM][SIZE_NUM]; | 258 | static double results[ALGOR_NUM][SIZE_NUM]; |
| 259 | static int lengths[SIZE_NUM]={16,64,256,1024,8*1024}; | 259 | static int lengths[SIZE_NUM]={16,64,256,1024,8*1024}; |
| 260 | #ifndef OPENSSL_NO_RSA | 260 | #ifndef OPENSSL_NO_RSA |
| @@ -299,7 +299,7 @@ static SIGRETTYPE sig_done(int sig) | |||
| 299 | #if defined(_WIN32) | 299 | #if defined(_WIN32) |
| 300 | 300 | ||
| 301 | #if !defined(SIGALRM) | 301 | #if !defined(SIGALRM) |
| 302 | #define SIGALRM | 302 | # define SIGALRM |
| 303 | #endif | 303 | #endif |
| 304 | static unsigned int lapse,schlock; | 304 | static unsigned int lapse,schlock; |
| 305 | static void alarm_win32(unsigned int secs) { lapse = secs*1000; } | 305 | static void alarm_win32(unsigned int secs) { lapse = secs*1000; } |
diff --git a/src/lib/libssl/src/apps/verify.c b/src/lib/libssl/src/apps/verify.c index b9749dcd36..893670ff41 100644 --- a/src/lib/libssl/src/apps/verify.c +++ b/src/lib/libssl/src/apps/verify.c | |||
| @@ -222,11 +222,19 @@ int MAIN(int argc, char **argv) | |||
| 222 | goto end; | 222 | goto end; |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, crls, e); | 225 | ret = 0; |
| 226 | if (argc < 1) | ||
| 227 | { | ||
| 228 | if (1 != check(cert_ctx, NULL, untrusted, trusted, crls, e)) | ||
| 229 | ret = -1; | ||
| 230 | } | ||
| 226 | else | 231 | else |
| 232 | { | ||
| 227 | for (i=0; i<argc; i++) | 233 | for (i=0; i<argc; i++) |
| 228 | check(cert_ctx,argv[i], untrusted, trusted, crls, e); | 234 | if (1 != check(cert_ctx,argv[i], untrusted, trusted, crls, e)) |
| 229 | ret=0; | 235 | ret = -1; |
| 236 | } | ||
| 237 | |||
| 230 | end: | 238 | end: |
| 231 | if (ret == 1) { | 239 | if (ret == 1) { |
| 232 | BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] [-purpose purpose] [-crl_check]"); | 240 | BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] [-purpose purpose] [-crl_check]"); |
| @@ -235,13 +243,16 @@ end: | |||
| 235 | BIO_printf(bio_err," [-engine e]"); | 243 | BIO_printf(bio_err," [-engine e]"); |
| 236 | #endif | 244 | #endif |
| 237 | BIO_printf(bio_err," cert1 cert2 ...\n"); | 245 | BIO_printf(bio_err," cert1 cert2 ...\n"); |
| 246 | |||
| 238 | BIO_printf(bio_err,"recognized usages:\n"); | 247 | BIO_printf(bio_err,"recognized usages:\n"); |
| 239 | for(i = 0; i < X509_PURPOSE_get_count(); i++) { | 248 | for(i = 0; i < X509_PURPOSE_get_count(); i++) |
| 249 | { | ||
| 240 | X509_PURPOSE *ptmp; | 250 | X509_PURPOSE *ptmp; |
| 241 | ptmp = X509_PURPOSE_get0(i); | 251 | ptmp = X509_PURPOSE_get0(i); |
| 242 | BIO_printf(bio_err, "\t%-10s\t%s\n", X509_PURPOSE_get0_sname(ptmp), | 252 | BIO_printf(bio_err, "\t%-10s\t%s\n", |
| 243 | X509_PURPOSE_get0_name(ptmp)); | 253 | X509_PURPOSE_get0_sname(ptmp), |
| 244 | } | 254 | X509_PURPOSE_get0_name(ptmp)); |
| 255 | } | ||
| 245 | } | 256 | } |
| 246 | if (vpm) X509_VERIFY_PARAM_free(vpm); | 257 | if (vpm) X509_VERIFY_PARAM_free(vpm); |
| 247 | if (cert_ctx != NULL) X509_STORE_free(cert_ctx); | 258 | if (cert_ctx != NULL) X509_STORE_free(cert_ctx); |
| @@ -249,7 +260,7 @@ end: | |||
| 249 | sk_X509_pop_free(trusted, X509_free); | 260 | sk_X509_pop_free(trusted, X509_free); |
| 250 | sk_X509_CRL_pop_free(crls, X509_CRL_free); | 261 | sk_X509_CRL_pop_free(crls, X509_CRL_free); |
| 251 | apps_shutdown(); | 262 | apps_shutdown(); |
| 252 | OPENSSL_EXIT(ret); | 263 | OPENSSL_EXIT(ret < 0 ? 2 : ret); |
| 253 | } | 264 | } |
| 254 | 265 | ||
| 255 | static int check(X509_STORE *ctx, char *file, | 266 | static int check(X509_STORE *ctx, char *file, |
diff --git a/src/lib/libssl/src/apps/x509.c b/src/lib/libssl/src/apps/x509.c index e6e5e0d4e5..3863ab968d 100644 --- a/src/lib/libssl/src/apps/x509.c +++ b/src/lib/libssl/src/apps/x509.c | |||
| @@ -288,7 +288,7 @@ int MAIN(int argc, char **argv) | |||
| 288 | days=atoi(*(++argv)); | 288 | days=atoi(*(++argv)); |
| 289 | if (days == 0) | 289 | if (days == 0) |
| 290 | { | 290 | { |
| 291 | BIO_printf(STDout,"bad number of days\n"); | 291 | BIO_printf(bio_err,"bad number of days\n"); |
| 292 | goto bad; | 292 | goto bad; |
| 293 | } | 293 | } |
| 294 | } | 294 | } |
| @@ -912,7 +912,7 @@ bad: | |||
| 912 | } | 912 | } |
| 913 | else if (text == i) | 913 | else if (text == i) |
| 914 | { | 914 | { |
| 915 | X509_print_ex(out,x,nmflag, certflag); | 915 | X509_print_ex(STDout,x,nmflag, certflag); |
| 916 | } | 916 | } |
| 917 | else if (startdate == i) | 917 | else if (startdate == i) |
| 918 | { | 918 | { |
diff --git a/src/lib/libssl/src/config b/src/lib/libssl/src/config index 88b9bc69da..41fa2a6b82 100644 --- a/src/lib/libssl/src/config +++ b/src/lib/libssl/src/config | |||
| @@ -739,7 +739,7 @@ case "$GUESSOS" in | |||
| 739 | libc=/usr/lib/libc.so | 739 | libc=/usr/lib/libc.so |
| 740 | else # OpenBSD | 740 | else # OpenBSD |
| 741 | # ld searches for highest libc.so.* and so do we | 741 | # ld searches for highest libc.so.* and so do we |
| 742 | libc=`(ls /usr/lib/libc.so.* | tail -1) 2>/dev/null` | 742 | libc=`(ls /usr/lib/libc.so.* /lib/libc.so.* | tail -1) 2>/dev/null` |
| 743 | fi | 743 | fi |
| 744 | case "`(file -L $libc) 2>/dev/null`" in | 744 | case "`(file -L $libc) 2>/dev/null`" in |
| 745 | *ELF*) OUT="BSD-x86-elf" ;; | 745 | *ELF*) OUT="BSD-x86-elf" ;; |
diff --git a/src/lib/libssl/src/crypto/Makefile b/src/lib/libssl/src/crypto/Makefile index 947dd5d44e..a90809b2b8 100644 --- a/src/lib/libssl/src/crypto/Makefile +++ b/src/lib/libssl/src/crypto/Makefile | |||
| @@ -77,7 +77,9 @@ ia64cpuid.s: ia64cpuid.S; $(CC) $(CFLAGS) -E ia64cpuid.S > $@ | |||
| 77 | ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@ | 77 | ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@ |
| 78 | pariscid.s: pariscid.pl; $(PERL) pariscid.pl $(PERLASM_SCHEME) $@ | 78 | pariscid.s: pariscid.pl; $(PERL) pariscid.pl $(PERLASM_SCHEME) $@ |
| 79 | alphacpuid.s: alphacpuid.pl | 79 | alphacpuid.s: alphacpuid.pl |
| 80 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null | 80 | (preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \ |
| 81 | $(PERL) alphacpuid.pl > $$preproc && \ | ||
| 82 | $(CC) -E $$preproc > $@ && rm $$preproc) | ||
| 81 | 83 | ||
| 82 | testapps: | 84 | testapps: |
| 83 | [ -z "$(THIS)" ] || ( if echo $(SDIRS) | fgrep ' des '; \ | 85 | [ -z "$(THIS)" ] || ( if echo $(SDIRS) | fgrep ' des '; \ |
diff --git a/src/lib/libssl/src/crypto/asn1/a_int.c b/src/lib/libssl/src/crypto/asn1/a_int.c index ad0d2506f6..297c45a9ff 100644 --- a/src/lib/libssl/src/crypto/asn1/a_int.c +++ b/src/lib/libssl/src/crypto/asn1/a_int.c | |||
| @@ -116,7 +116,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp) | |||
| 116 | int pad=0,ret,i,neg; | 116 | int pad=0,ret,i,neg; |
| 117 | unsigned char *p,*n,pb=0; | 117 | unsigned char *p,*n,pb=0; |
| 118 | 118 | ||
| 119 | if ((a == NULL) || (a->data == NULL)) return(0); | 119 | if (a == NULL) return(0); |
| 120 | neg=a->type & V_ASN1_NEG; | 120 | neg=a->type & V_ASN1_NEG; |
| 121 | if (a->length == 0) | 121 | if (a->length == 0) |
| 122 | ret=1; | 122 | ret=1; |
diff --git a/src/lib/libssl/src/crypto/asn1/a_strex.c b/src/lib/libssl/src/crypto/asn1/a_strex.c index 264ebf2393..ead37ac325 100644 --- a/src/lib/libssl/src/crypto/asn1/a_strex.c +++ b/src/lib/libssl/src/crypto/asn1/a_strex.c | |||
| @@ -567,6 +567,7 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in) | |||
| 567 | if(mbflag == -1) return -1; | 567 | if(mbflag == -1) return -1; |
| 568 | mbflag |= MBSTRING_FLAG; | 568 | mbflag |= MBSTRING_FLAG; |
| 569 | stmp.data = NULL; | 569 | stmp.data = NULL; |
| 570 | stmp.length = 0; | ||
| 570 | ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); | 571 | ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); |
| 571 | if(ret < 0) return ret; | 572 | if(ret < 0) return ret; |
| 572 | *out = stmp.data; | 573 | *out = stmp.data; |
diff --git a/src/lib/libssl/src/crypto/asn1/a_verify.c b/src/lib/libssl/src/crypto/asn1/a_verify.c index 432722e409..fc84cd3d19 100644 --- a/src/lib/libssl/src/crypto/asn1/a_verify.c +++ b/src/lib/libssl/src/crypto/asn1/a_verify.c | |||
| @@ -140,6 +140,12 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, | |||
| 140 | 140 | ||
| 141 | int mdnid, pknid; | 141 | int mdnid, pknid; |
| 142 | 142 | ||
| 143 | if (!pkey) | ||
| 144 | { | ||
| 145 | ASN1err(ASN1_F_ASN1_ITEM_VERIFY, ERR_R_PASSED_NULL_PARAMETER); | ||
| 146 | return -1; | ||
| 147 | } | ||
| 148 | |||
| 143 | EVP_MD_CTX_init(&ctx); | 149 | EVP_MD_CTX_init(&ctx); |
| 144 | 150 | ||
| 145 | /* Convert signature OID into digest and public key OIDs */ | 151 | /* Convert signature OID into digest and public key OIDs */ |
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_err.c b/src/lib/libssl/src/crypto/asn1/asn1_err.c index 1a30bf119b..aa60203ba8 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1_err.c +++ b/src/lib/libssl/src/crypto/asn1/asn1_err.c | |||
| @@ -305,7 +305,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]= | |||
| 305 | {ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, | 305 | {ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, |
| 306 | {ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorithm"}, | 306 | {ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorithm"}, |
| 307 | {ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"}, | 307 | {ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"}, |
| 308 | {ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unkown format"}, | 308 | {ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unknown format"}, |
| 309 | {ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, | 309 | {ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, |
| 310 | {ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, | 310 | {ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, |
| 311 | {ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, | 311 | {ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, |
diff --git a/src/lib/libssl/src/crypto/asn1/x_pubkey.c b/src/lib/libssl/src/crypto/asn1/x_pubkey.c index 627ec87f9f..b649e1fcf9 100644 --- a/src/lib/libssl/src/crypto/asn1/x_pubkey.c +++ b/src/lib/libssl/src/crypto/asn1/x_pubkey.c | |||
| @@ -175,12 +175,15 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) | |||
| 175 | CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY); | 175 | CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY); |
| 176 | if (key->pkey) | 176 | if (key->pkey) |
| 177 | { | 177 | { |
| 178 | CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY); | ||
| 178 | EVP_PKEY_free(ret); | 179 | EVP_PKEY_free(ret); |
| 179 | ret = key->pkey; | 180 | ret = key->pkey; |
| 180 | } | 181 | } |
| 181 | else | 182 | else |
| 183 | { | ||
| 182 | key->pkey = ret; | 184 | key->pkey = ret; |
| 183 | CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY); | 185 | CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY); |
| 186 | } | ||
| 184 | CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY); | 187 | CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY); |
| 185 | 188 | ||
| 186 | return ret; | 189 | return ret; |
diff --git a/src/lib/libssl/src/crypto/bio/bss_log.c b/src/lib/libssl/src/crypto/bio/bss_log.c index b7dce5c1a2..2227b2b52d 100644 --- a/src/lib/libssl/src/crypto/bio/bss_log.c +++ b/src/lib/libssl/src/crypto/bio/bss_log.c | |||
| @@ -245,7 +245,7 @@ static int MS_CALLBACK slg_puts(BIO *bp, const char *str) | |||
| 245 | 245 | ||
| 246 | static void xopenlog(BIO* bp, char* name, int level) | 246 | static void xopenlog(BIO* bp, char* name, int level) |
| 247 | { | 247 | { |
| 248 | if (GetVersion() < 0x80000000) | 248 | if (check_winnt()) |
| 249 | bp->ptr = RegisterEventSourceA(NULL,name); | 249 | bp->ptr = RegisterEventSourceA(NULL,name); |
| 250 | else | 250 | else |
| 251 | bp->ptr = NULL; | 251 | bp->ptr = NULL; |
diff --git a/src/lib/libssl/src/crypto/bn/Makefile b/src/lib/libssl/src/crypto/bn/Makefile index 672773454c..6dd136be5d 100644 --- a/src/lib/libssl/src/crypto/bn/Makefile +++ b/src/lib/libssl/src/crypto/bn/Makefile | |||
| @@ -125,7 +125,9 @@ ppc-mont.s: asm/ppc-mont.pl;$(PERL) asm/ppc-mont.pl $(PERLASM_SCHEME) $@ | |||
| 125 | ppc64-mont.s: asm/ppc64-mont.pl;$(PERL) asm/ppc64-mont.pl $(PERLASM_SCHEME) $@ | 125 | ppc64-mont.s: asm/ppc64-mont.pl;$(PERL) asm/ppc64-mont.pl $(PERLASM_SCHEME) $@ |
| 126 | 126 | ||
| 127 | alpha-mont.s: asm/alpha-mont.pl | 127 | alpha-mont.s: asm/alpha-mont.pl |
| 128 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null | 128 | (preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \ |
| 129 | $(PERL) asm/alpha-mont.pl > $$preproc && \ | ||
| 130 | $(CC) -E $$preproc > $@ && rm $$preproc) | ||
| 129 | 131 | ||
| 130 | # GNU make "catch all" | 132 | # GNU make "catch all" |
| 131 | %-mont.s: asm/%-mont.pl; $(PERL) $< $(PERLASM_SCHEME) $@ | 133 | %-mont.s: asm/%-mont.pl; $(PERL) $< $(PERLASM_SCHEME) $@ |
diff --git a/src/lib/libssl/src/crypto/bn/bn.h b/src/lib/libssl/src/crypto/bn/bn.h index f34248ec4f..21a1a3fe35 100644 --- a/src/lib/libssl/src/crypto/bn/bn.h +++ b/src/lib/libssl/src/crypto/bn/bn.h | |||
| @@ -538,6 +538,8 @@ BIGNUM *BN_mod_inverse(BIGNUM *ret, | |||
| 538 | BIGNUM *BN_mod_sqrt(BIGNUM *ret, | 538 | BIGNUM *BN_mod_sqrt(BIGNUM *ret, |
| 539 | const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx); | 539 | const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx); |
| 540 | 540 | ||
| 541 | void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); | ||
| 542 | |||
| 541 | /* Deprecated versions */ | 543 | /* Deprecated versions */ |
| 542 | #ifndef OPENSSL_NO_DEPRECATED | 544 | #ifndef OPENSSL_NO_DEPRECATED |
| 543 | BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe, | 545 | BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe, |
| @@ -774,11 +776,20 @@ int RAND_pseudo_bytes(unsigned char *buf,int num); | |||
| 774 | 776 | ||
| 775 | #define bn_fix_top(a) bn_check_top(a) | 777 | #define bn_fix_top(a) bn_check_top(a) |
| 776 | 778 | ||
| 779 | #define bn_check_size(bn, bits) bn_wcheck_size(bn, ((bits+BN_BITS2-1))/BN_BITS2) | ||
| 780 | #define bn_wcheck_size(bn, words) \ | ||
| 781 | do { \ | ||
| 782 | const BIGNUM *_bnum2 = (bn); \ | ||
| 783 | assert(words <= (_bnum2)->dmax && words >= (_bnum2)->top); \ | ||
| 784 | } while(0) | ||
| 785 | |||
| 777 | #else /* !BN_DEBUG */ | 786 | #else /* !BN_DEBUG */ |
| 778 | 787 | ||
| 779 | #define bn_pollute(a) | 788 | #define bn_pollute(a) |
| 780 | #define bn_check_top(a) | 789 | #define bn_check_top(a) |
| 781 | #define bn_fix_top(a) bn_correct_top(a) | 790 | #define bn_fix_top(a) bn_correct_top(a) |
| 791 | #define bn_check_size(bn, bits) | ||
| 792 | #define bn_wcheck_size(bn, words) | ||
| 782 | 793 | ||
| 783 | #endif | 794 | #endif |
| 784 | 795 | ||
diff --git a/src/lib/libssl/src/crypto/bn/bn_div.c b/src/lib/libssl/src/crypto/bn/bn_div.c index 52b3304293..7b2403185e 100644 --- a/src/lib/libssl/src/crypto/bn/bn_div.c +++ b/src/lib/libssl/src/crypto/bn/bn_div.c | |||
| @@ -141,6 +141,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, | |||
| 141 | * | 141 | * |
| 142 | * <appro@fy.chalmers.se> | 142 | * <appro@fy.chalmers.se> |
| 143 | */ | 143 | */ |
| 144 | #undef bn_div_words | ||
| 144 | # define bn_div_words(n0,n1,d0) \ | 145 | # define bn_div_words(n0,n1,d0) \ |
| 145 | ({ asm volatile ( \ | 146 | ({ asm volatile ( \ |
| 146 | "divl %4" \ | 147 | "divl %4" \ |
| @@ -155,6 +156,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, | |||
| 155 | * Same story here, but it's 128-bit by 64-bit division. Wow! | 156 | * Same story here, but it's 128-bit by 64-bit division. Wow! |
| 156 | * <appro@fy.chalmers.se> | 157 | * <appro@fy.chalmers.se> |
| 157 | */ | 158 | */ |
| 159 | # undef bn_div_words | ||
| 158 | # define bn_div_words(n0,n1,d0) \ | 160 | # define bn_div_words(n0,n1,d0) \ |
| 159 | ({ asm volatile ( \ | 161 | ({ asm volatile ( \ |
| 160 | "divq %4" \ | 162 | "divq %4" \ |
diff --git a/src/lib/libssl/src/crypto/bn/bn_gcd.c b/src/lib/libssl/src/crypto/bn/bn_gcd.c index 4a352119ba..a808f53178 100644 --- a/src/lib/libssl/src/crypto/bn/bn_gcd.c +++ b/src/lib/libssl/src/crypto/bn/bn_gcd.c | |||
| @@ -205,6 +205,7 @@ err: | |||
| 205 | /* solves ax == 1 (mod n) */ | 205 | /* solves ax == 1 (mod n) */ |
| 206 | static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, | 206 | static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, |
| 207 | const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); | 207 | const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); |
| 208 | |||
| 208 | BIGNUM *BN_mod_inverse(BIGNUM *in, | 209 | BIGNUM *BN_mod_inverse(BIGNUM *in, |
| 209 | const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) | 210 | const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) |
| 210 | { | 211 | { |
diff --git a/src/lib/libssl/src/crypto/bn/bn_lcl.h b/src/lib/libssl/src/crypto/bn/bn_lcl.h index eecfd8cc99..817c773b65 100644 --- a/src/lib/libssl/src/crypto/bn/bn_lcl.h +++ b/src/lib/libssl/src/crypto/bn/bn_lcl.h | |||
| @@ -282,16 +282,23 @@ extern "C" { | |||
| 282 | # endif | 282 | # endif |
| 283 | # elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)) | 283 | # elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)) |
| 284 | # if defined(__GNUC__) && __GNUC__>=2 | 284 | # if defined(__GNUC__) && __GNUC__>=2 |
| 285 | # define BN_UMULT_HIGH(a,b) ({ \ | 285 | # if __GNUC__>=4 && __GNUC_MINOR__>=4 /* "h" constraint is no more since 4.4 */ |
| 286 | # define BN_UMULT_HIGH(a,b) (((__uint128_t)(a)*(b))>>64) | ||
| 287 | # define BN_UMULT_LOHI(low,high,a,b) ({ \ | ||
| 288 | __uint128_t ret=(__uint128_t)(a)*(b); \ | ||
| 289 | (high)=ret>>64; (low)=ret; }) | ||
| 290 | # else | ||
| 291 | # define BN_UMULT_HIGH(a,b) ({ \ | ||
| 286 | register BN_ULONG ret; \ | 292 | register BN_ULONG ret; \ |
| 287 | asm ("dmultu %1,%2" \ | 293 | asm ("dmultu %1,%2" \ |
| 288 | : "=h"(ret) \ | 294 | : "=h"(ret) \ |
| 289 | : "r"(a), "r"(b) : "l"); \ | 295 | : "r"(a), "r"(b) : "l"); \ |
| 290 | ret; }) | 296 | ret; }) |
| 291 | # define BN_UMULT_LOHI(low,high,a,b) \ | 297 | # define BN_UMULT_LOHI(low,high,a,b)\ |
| 292 | asm ("dmultu %2,%3" \ | 298 | asm ("dmultu %2,%3" \ |
| 293 | : "=l"(low),"=h"(high) \ | 299 | : "=l"(low),"=h"(high) \ |
| 294 | : "r"(a), "r"(b)); | 300 | : "r"(a), "r"(b)); |
| 301 | # endif | ||
| 295 | # endif | 302 | # endif |
| 296 | # endif /* cpu */ | 303 | # endif /* cpu */ |
| 297 | #endif /* OPENSSL_NO_ASM */ | 304 | #endif /* OPENSSL_NO_ASM */ |
diff --git a/src/lib/libssl/src/crypto/bn/bn_lib.c b/src/lib/libssl/src/crypto/bn/bn_lib.c index 7a5676de69..5461e6ee7d 100644 --- a/src/lib/libssl/src/crypto/bn/bn_lib.c +++ b/src/lib/libssl/src/crypto/bn/bn_lib.c | |||
| @@ -824,3 +824,55 @@ int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b, | |||
| 824 | } | 824 | } |
| 825 | return bn_cmp_words(a,b,cl); | 825 | return bn_cmp_words(a,b,cl); |
| 826 | } | 826 | } |
| 827 | |||
| 828 | /* | ||
| 829 | * Constant-time conditional swap of a and b. | ||
| 830 | * a and b are swapped if condition is not 0. The code assumes that at most one bit of condition is set. | ||
| 831 | * nwords is the number of words to swap. The code assumes that at least nwords are allocated in both a and b, | ||
| 832 | * and that no more than nwords are used by either a or b. | ||
| 833 | * a and b cannot be the same number | ||
| 834 | */ | ||
| 835 | void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) | ||
| 836 | { | ||
| 837 | BN_ULONG t; | ||
| 838 | int i; | ||
| 839 | |||
| 840 | bn_wcheck_size(a, nwords); | ||
| 841 | bn_wcheck_size(b, nwords); | ||
| 842 | |||
| 843 | assert(a != b); | ||
| 844 | assert((condition & (condition - 1)) == 0); | ||
| 845 | assert(sizeof(BN_ULONG) >= sizeof(int)); | ||
| 846 | |||
| 847 | condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1; | ||
| 848 | |||
| 849 | t = (a->top^b->top) & condition; | ||
| 850 | a->top ^= t; | ||
| 851 | b->top ^= t; | ||
| 852 | |||
| 853 | #define BN_CONSTTIME_SWAP(ind) \ | ||
| 854 | do { \ | ||
| 855 | t = (a->d[ind] ^ b->d[ind]) & condition; \ | ||
| 856 | a->d[ind] ^= t; \ | ||
| 857 | b->d[ind] ^= t; \ | ||
| 858 | } while (0) | ||
| 859 | |||
| 860 | |||
| 861 | switch (nwords) { | ||
| 862 | default: | ||
| 863 | for (i = 10; i < nwords; i++) | ||
| 864 | BN_CONSTTIME_SWAP(i); | ||
| 865 | /* Fallthrough */ | ||
| 866 | case 10: BN_CONSTTIME_SWAP(9); /* Fallthrough */ | ||
| 867 | case 9: BN_CONSTTIME_SWAP(8); /* Fallthrough */ | ||
| 868 | case 8: BN_CONSTTIME_SWAP(7); /* Fallthrough */ | ||
| 869 | case 7: BN_CONSTTIME_SWAP(6); /* Fallthrough */ | ||
| 870 | case 6: BN_CONSTTIME_SWAP(5); /* Fallthrough */ | ||
| 871 | case 5: BN_CONSTTIME_SWAP(4); /* Fallthrough */ | ||
| 872 | case 4: BN_CONSTTIME_SWAP(3); /* Fallthrough */ | ||
| 873 | case 3: BN_CONSTTIME_SWAP(2); /* Fallthrough */ | ||
| 874 | case 2: BN_CONSTTIME_SWAP(1); /* Fallthrough */ | ||
| 875 | case 1: BN_CONSTTIME_SWAP(0); | ||
| 876 | } | ||
| 877 | #undef BN_CONSTTIME_SWAP | ||
| 878 | } | ||
diff --git a/src/lib/libssl/src/crypto/bn/bn_word.c b/src/lib/libssl/src/crypto/bn/bn_word.c index ee7b87c45c..de83a15b99 100644 --- a/src/lib/libssl/src/crypto/bn/bn_word.c +++ b/src/lib/libssl/src/crypto/bn/bn_word.c | |||
| @@ -144,26 +144,17 @@ int BN_add_word(BIGNUM *a, BN_ULONG w) | |||
| 144 | a->neg=!(a->neg); | 144 | a->neg=!(a->neg); |
| 145 | return(i); | 145 | return(i); |
| 146 | } | 146 | } |
| 147 | /* Only expand (and risk failing) if it's possibly necessary */ | 147 | for (i=0;w!=0 && i<a->top;i++) |
| 148 | if (((BN_ULONG)(a->d[a->top - 1] + 1) == 0) && | ||
| 149 | (bn_wexpand(a,a->top+1) == NULL)) | ||
| 150 | return(0); | ||
| 151 | i=0; | ||
| 152 | for (;;) | ||
| 153 | { | 148 | { |
| 154 | if (i >= a->top) | 149 | a->d[i] = l = (a->d[i]+w)&BN_MASK2; |
| 155 | l=w; | 150 | w = (w>l)?1:0; |
| 156 | else | ||
| 157 | l=(a->d[i]+w)&BN_MASK2; | ||
| 158 | a->d[i]=l; | ||
| 159 | if (w > l) | ||
| 160 | w=1; | ||
| 161 | else | ||
| 162 | break; | ||
| 163 | i++; | ||
| 164 | } | 151 | } |
| 165 | if (i >= a->top) | 152 | if (w && i==a->top) |
| 153 | { | ||
| 154 | if (bn_wexpand(a,a->top+1) == NULL) return 0; | ||
| 166 | a->top++; | 155 | a->top++; |
| 156 | a->d[i]=w; | ||
| 157 | } | ||
| 167 | bn_check_top(a); | 158 | bn_check_top(a); |
| 168 | return(1); | 159 | return(1); |
| 169 | } | 160 | } |
diff --git a/src/lib/libssl/src/crypto/buffer/buffer.c b/src/lib/libssl/src/crypto/buffer/buffer.c index d7aa79ad7f..d4a4ce43b3 100644 --- a/src/lib/libssl/src/crypto/buffer/buffer.c +++ b/src/lib/libssl/src/crypto/buffer/buffer.c | |||
| @@ -179,14 +179,14 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) | |||
| 179 | return(len); | 179 | return(len); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | void BUF_reverse(unsigned char *out, unsigned char *in, size_t size) | 182 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size) |
| 183 | { | 183 | { |
| 184 | size_t i; | 184 | size_t i; |
| 185 | if (in) | 185 | if (in) |
| 186 | { | 186 | { |
| 187 | out += size - 1; | 187 | out += size - 1; |
| 188 | for (i = 0; i < size; i++) | 188 | for (i = 0; i < size; i++) |
| 189 | *in++ = *out--; | 189 | *out-- = *in++; |
| 190 | } | 190 | } |
| 191 | else | 191 | else |
| 192 | { | 192 | { |
diff --git a/src/lib/libssl/src/crypto/buffer/buffer.h b/src/lib/libssl/src/crypto/buffer/buffer.h index 178e418282..f8da32b485 100644 --- a/src/lib/libssl/src/crypto/buffer/buffer.h +++ b/src/lib/libssl/src/crypto/buffer/buffer.h | |||
| @@ -88,7 +88,7 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len); | |||
| 88 | char * BUF_strdup(const char *str); | 88 | char * BUF_strdup(const char *str); |
| 89 | char * BUF_strndup(const char *str, size_t siz); | 89 | char * BUF_strndup(const char *str, size_t siz); |
| 90 | void * BUF_memdup(const void *data, size_t siz); | 90 | void * BUF_memdup(const void *data, size_t siz); |
| 91 | void BUF_reverse(unsigned char *out, unsigned char *in, size_t siz); | 91 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); |
| 92 | 92 | ||
| 93 | /* safe string functions */ | 93 | /* safe string functions */ |
| 94 | size_t BUF_strlcpy(char *dst,const char *src,size_t siz); | 94 | size_t BUF_strlcpy(char *dst,const char *src,size_t siz); |
diff --git a/src/lib/libssl/src/crypto/conf/conf_mall.c b/src/lib/libssl/src/crypto/conf/conf_mall.c index c6f4cb2d55..213890e0c2 100644 --- a/src/lib/libssl/src/crypto/conf/conf_mall.c +++ b/src/lib/libssl/src/crypto/conf/conf_mall.c | |||
| @@ -76,5 +76,6 @@ void OPENSSL_load_builtin_modules(void) | |||
| 76 | #ifndef OPENSSL_NO_ENGINE | 76 | #ifndef OPENSSL_NO_ENGINE |
| 77 | ENGINE_add_conf_module(); | 77 | ENGINE_add_conf_module(); |
| 78 | #endif | 78 | #endif |
| 79 | EVP_add_alg_module(); | ||
| 79 | } | 80 | } |
| 80 | 81 | ||
diff --git a/src/lib/libssl/src/crypto/cryptlib.c b/src/lib/libssl/src/crypto/cryptlib.c index 766ea8cac7..0b77d8b7d0 100644 --- a/src/lib/libssl/src/crypto/cryptlib.c +++ b/src/lib/libssl/src/crypto/cryptlib.c | |||
| @@ -504,7 +504,7 @@ void CRYPTO_THREADID_current(CRYPTO_THREADID *id) | |||
| 504 | CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL)); | 504 | CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL)); |
| 505 | #else | 505 | #else |
| 506 | /* For everything else, default to using the address of 'errno' */ | 506 | /* For everything else, default to using the address of 'errno' */ |
| 507 | CRYPTO_THREADID_set_pointer(id, &errno); | 507 | CRYPTO_THREADID_set_pointer(id, (void*)&errno); |
| 508 | #endif | 508 | #endif |
| 509 | } | 509 | } |
| 510 | 510 | ||
| @@ -704,6 +704,7 @@ void OPENSSL_cpuid_setup(void) | |||
| 704 | } | 704 | } |
| 705 | else | 705 | else |
| 706 | vec = OPENSSL_ia32_cpuid(); | 706 | vec = OPENSSL_ia32_cpuid(); |
| 707 | |||
| 707 | /* | 708 | /* |
| 708 | * |(1<<10) sets a reserved bit to signal that variable | 709 | * |(1<<10) sets a reserved bit to signal that variable |
| 709 | * was initialized already... This is to avoid interference | 710 | * was initialized already... This is to avoid interference |
| @@ -888,7 +889,7 @@ void OPENSSL_showfatal (const char *fmta,...) | |||
| 888 | 889 | ||
| 889 | #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 | 890 | #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 |
| 890 | /* this -------------v--- guards NT-specific calls */ | 891 | /* this -------------v--- guards NT-specific calls */ |
| 891 | if (GetVersion() < 0x80000000 && OPENSSL_isservice() > 0) | 892 | if (check_winnt() && OPENSSL_isservice() > 0) |
| 892 | { HANDLE h = RegisterEventSource(0,_T("OPENSSL")); | 893 | { HANDLE h = RegisterEventSource(0,_T("OPENSSL")); |
| 893 | const TCHAR *pmsg=buf; | 894 | const TCHAR *pmsg=buf; |
| 894 | ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0); | 895 | ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0); |
| @@ -924,3 +925,16 @@ void OpenSSLDie(const char *file,int line,const char *assertion) | |||
| 924 | } | 925 | } |
| 925 | 926 | ||
| 926 | void *OPENSSL_stderr(void) { return stderr; } | 927 | void *OPENSSL_stderr(void) { return stderr; } |
| 928 | |||
| 929 | int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) | ||
| 930 | { | ||
| 931 | size_t i; | ||
| 932 | const unsigned char *a = in_a; | ||
| 933 | const unsigned char *b = in_b; | ||
| 934 | unsigned char x = 0; | ||
| 935 | |||
| 936 | for (i = 0; i < len; i++) | ||
| 937 | x |= a[i] ^ b[i]; | ||
| 938 | |||
| 939 | return x; | ||
| 940 | } | ||
diff --git a/src/lib/libssl/src/crypto/cryptlib.h b/src/lib/libssl/src/crypto/cryptlib.h index 1761f6b668..d26f9630ea 100644 --- a/src/lib/libssl/src/crypto/cryptlib.h +++ b/src/lib/libssl/src/crypto/cryptlib.h | |||
| @@ -100,7 +100,7 @@ extern "C" { | |||
| 100 | 100 | ||
| 101 | void OPENSSL_cpuid_setup(void); | 101 | void OPENSSL_cpuid_setup(void); |
| 102 | extern unsigned int OPENSSL_ia32cap_P[]; | 102 | extern unsigned int OPENSSL_ia32cap_P[]; |
| 103 | void OPENSSL_showfatal(const char *,...); | 103 | void OPENSSL_showfatal(const char *fmta,...); |
| 104 | void *OPENSSL_stderr(void); | 104 | void *OPENSSL_stderr(void); |
| 105 | extern int OPENSSL_NONPIC_relocated; | 105 | extern int OPENSSL_NONPIC_relocated; |
| 106 | 106 | ||
diff --git a/src/lib/libssl/src/crypto/crypto.h b/src/lib/libssl/src/crypto/crypto.h index 6aeda0a9ac..f92fc5182d 100644 --- a/src/lib/libssl/src/crypto/crypto.h +++ b/src/lib/libssl/src/crypto/crypto.h | |||
| @@ -488,10 +488,10 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), | |||
| 488 | long (**go)(void)); | 488 | long (**go)(void)); |
| 489 | 489 | ||
| 490 | void *CRYPTO_malloc_locked(int num, const char *file, int line); | 490 | void *CRYPTO_malloc_locked(int num, const char *file, int line); |
| 491 | void CRYPTO_free_locked(void *); | 491 | void CRYPTO_free_locked(void *ptr); |
| 492 | void *CRYPTO_malloc(int num, const char *file, int line); | 492 | void *CRYPTO_malloc(int num, const char *file, int line); |
| 493 | char *CRYPTO_strdup(const char *str, const char *file, int line); | 493 | char *CRYPTO_strdup(const char *str, const char *file, int line); |
| 494 | void CRYPTO_free(void *); | 494 | void CRYPTO_free(void *ptr); |
| 495 | void *CRYPTO_realloc(void *addr,int num, const char *file, int line); | 495 | void *CRYPTO_realloc(void *addr,int num, const char *file, int line); |
| 496 | void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, | 496 | void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, |
| 497 | int line); | 497 | int line); |
| @@ -574,6 +574,13 @@ void OPENSSL_init(void); | |||
| 574 | #define fips_cipher_abort(alg) while(0) | 574 | #define fips_cipher_abort(alg) while(0) |
| 575 | #endif | 575 | #endif |
| 576 | 576 | ||
| 577 | /* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It | ||
| 578 | * takes an amount of time dependent on |len|, but independent of the contents | ||
| 579 | * of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a | ||
| 580 | * defined order as the return value when a != b is undefined, other than to be | ||
| 581 | * non-zero. */ | ||
| 582 | int CRYPTO_memcmp(const void *a, const void *b, size_t len); | ||
| 583 | |||
| 577 | /* BEGIN ERROR CODES */ | 584 | /* BEGIN ERROR CODES */ |
| 578 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 585 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 579 | * made after this point may be overwritten when the script is next run. | 586 | * made after this point may be overwritten when the script is next run. |
diff --git a/src/lib/libssl/src/crypto/des/set_key.c b/src/lib/libssl/src/crypto/des/set_key.c index d3e69ca8b5..da4d62e112 100644 --- a/src/lib/libssl/src/crypto/des/set_key.c +++ b/src/lib/libssl/src/crypto/des/set_key.c | |||
| @@ -63,9 +63,8 @@ | |||
| 63 | * 1.1 added norm_expand_bits | 63 | * 1.1 added norm_expand_bits |
| 64 | * 1.0 First working version | 64 | * 1.0 First working version |
| 65 | */ | 65 | */ |
| 66 | #include "des_locl.h" | ||
| 67 | |||
| 68 | #include <openssl/crypto.h> | 66 | #include <openssl/crypto.h> |
| 67 | #include "des_locl.h" | ||
| 69 | 68 | ||
| 70 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */ | 69 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */ |
| 71 | 70 | ||
diff --git a/src/lib/libssl/src/crypto/des/str2key.c b/src/lib/libssl/src/crypto/des/str2key.c index 9c2054bda6..1077f99d1b 100644 --- a/src/lib/libssl/src/crypto/des/str2key.c +++ b/src/lib/libssl/src/crypto/des/str2key.c | |||
| @@ -56,8 +56,8 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include "des_locl.h" | ||
| 60 | #include <openssl/crypto.h> | 59 | #include <openssl/crypto.h> |
| 60 | #include "des_locl.h" | ||
| 61 | 61 | ||
| 62 | void DES_string_to_key(const char *str, DES_cblock *key) | 62 | void DES_string_to_key(const char *str, DES_cblock *key) |
| 63 | { | 63 | { |
diff --git a/src/lib/libssl/src/crypto/ec/ec.h b/src/lib/libssl/src/crypto/ec/ec.h index 9d01325af3..dfe8710d33 100644 --- a/src/lib/libssl/src/crypto/ec/ec.h +++ b/src/lib/libssl/src/crypto/ec/ec.h | |||
| @@ -274,10 +274,10 @@ int EC_GROUP_get_curve_name(const EC_GROUP *group); | |||
| 274 | void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); | 274 | void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); |
| 275 | int EC_GROUP_get_asn1_flag(const EC_GROUP *group); | 275 | int EC_GROUP_get_asn1_flag(const EC_GROUP *group); |
| 276 | 276 | ||
| 277 | void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t); | 277 | void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form); |
| 278 | point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); | 278 | point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); |
| 279 | 279 | ||
| 280 | unsigned char *EC_GROUP_get0_seed(const EC_GROUP *); | 280 | unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); |
| 281 | size_t EC_GROUP_get_seed_len(const EC_GROUP *); | 281 | size_t EC_GROUP_get_seed_len(const EC_GROUP *); |
| 282 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); | 282 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); |
| 283 | 283 | ||
| @@ -626,8 +626,8 @@ int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *c | |||
| 626 | */ | 626 | */ |
| 627 | int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); | 627 | int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); |
| 628 | 628 | ||
| 629 | int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *); | 629 | int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); |
| 630 | int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *); | 630 | int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx); |
| 631 | 631 | ||
| 632 | /** Computes r = generator * n sum_{i=0}^num p[i] * m[i] | 632 | /** Computes r = generator * n sum_{i=0}^num p[i] * m[i] |
| 633 | * \param group underlying EC_GROUP object | 633 | * \param group underlying EC_GROUP object |
| @@ -800,16 +800,24 @@ const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); | |||
| 800 | int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); | 800 | int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); |
| 801 | 801 | ||
| 802 | unsigned EC_KEY_get_enc_flags(const EC_KEY *key); | 802 | unsigned EC_KEY_get_enc_flags(const EC_KEY *key); |
| 803 | void EC_KEY_set_enc_flags(EC_KEY *, unsigned int); | 803 | void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); |
| 804 | point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *); | 804 | point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); |
| 805 | void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t); | 805 | void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); |
| 806 | /* functions to set/get method specific data */ | 806 | /* functions to set/get method specific data */ |
| 807 | void *EC_KEY_get_key_method_data(EC_KEY *, | 807 | void *EC_KEY_get_key_method_data(EC_KEY *key, |
| 808 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); | 808 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); |
| 809 | void EC_KEY_insert_key_method_data(EC_KEY *, void *data, | 809 | /** Sets the key method data of an EC_KEY object, if none has yet been set. |
| 810 | * \param key EC_KEY object | ||
| 811 | * \param data opaque data to install. | ||
| 812 | * \param dup_func a function that duplicates |data|. | ||
| 813 | * \param free_func a function that frees |data|. | ||
| 814 | * \param clear_free_func a function that wipes and frees |data|. | ||
| 815 | * \return the previously set data pointer, or NULL if |data| was inserted. | ||
| 816 | */ | ||
| 817 | void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data, | ||
| 810 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); | 818 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); |
| 811 | /* wrapper functions for the underlying EC_GROUP object */ | 819 | /* wrapper functions for the underlying EC_GROUP object */ |
| 812 | void EC_KEY_set_asn1_flag(EC_KEY *, int); | 820 | void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); |
| 813 | 821 | ||
| 814 | /** Creates a table of pre-computed multiples of the generator to | 822 | /** Creates a table of pre-computed multiples of the generator to |
| 815 | * accelerate further EC_KEY operations. | 823 | * accelerate further EC_KEY operations. |
diff --git a/src/lib/libssl/src/crypto/ec/ec_lib.c b/src/lib/libssl/src/crypto/ec/ec_lib.c index 25247b5803..de9a0cc2b3 100644 --- a/src/lib/libssl/src/crypto/ec/ec_lib.c +++ b/src/lib/libssl/src/crypto/ec/ec_lib.c | |||
| @@ -480,10 +480,10 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) | |||
| 480 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) != | 480 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) != |
| 481 | EC_METHOD_get_field_type(EC_GROUP_method_of(b))) | 481 | EC_METHOD_get_field_type(EC_GROUP_method_of(b))) |
| 482 | return 1; | 482 | return 1; |
| 483 | /* compare the curve name (if present) */ | 483 | /* compare the curve name (if present in both) */ |
| 484 | if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) && | 484 | if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) && |
| 485 | EC_GROUP_get_curve_name(a) == EC_GROUP_get_curve_name(b)) | 485 | EC_GROUP_get_curve_name(a) != EC_GROUP_get_curve_name(b)) |
| 486 | return 0; | 486 | return 1; |
| 487 | 487 | ||
| 488 | if (!ctx) | 488 | if (!ctx) |
| 489 | ctx_new = ctx = BN_CTX_new(); | 489 | ctx_new = ctx = BN_CTX_new(); |
| @@ -993,12 +993,12 @@ int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN | |||
| 993 | if (group->meth->point_cmp == 0) | 993 | if (group->meth->point_cmp == 0) |
| 994 | { | 994 | { |
| 995 | ECerr(EC_F_EC_POINT_CMP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 995 | ECerr(EC_F_EC_POINT_CMP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 996 | return 0; | 996 | return -1; |
| 997 | } | 997 | } |
| 998 | if ((group->meth != a->meth) || (a->meth != b->meth)) | 998 | if ((group->meth != a->meth) || (a->meth != b->meth)) |
| 999 | { | 999 | { |
| 1000 | ECerr(EC_F_EC_POINT_CMP, EC_R_INCOMPATIBLE_OBJECTS); | 1000 | ECerr(EC_F_EC_POINT_CMP, EC_R_INCOMPATIBLE_OBJECTS); |
| 1001 | return 0; | 1001 | return -1; |
| 1002 | } | 1002 | } |
| 1003 | return group->meth->point_cmp(group, a, b, ctx); | 1003 | return group->meth->point_cmp(group, a, b, ctx); |
| 1004 | } | 1004 | } |
diff --git a/src/lib/libssl/src/crypto/ec/ecp_mont.c b/src/lib/libssl/src/crypto/ec/ecp_mont.c index 079e47431b..f04f132c7a 100644 --- a/src/lib/libssl/src/crypto/ec/ecp_mont.c +++ b/src/lib/libssl/src/crypto/ec/ecp_mont.c | |||
| @@ -114,7 +114,6 @@ const EC_METHOD *EC_GFp_mont_method(void) | |||
| 114 | ec_GFp_mont_field_decode, | 114 | ec_GFp_mont_field_decode, |
| 115 | ec_GFp_mont_field_set_to_one }; | 115 | ec_GFp_mont_field_set_to_one }; |
| 116 | 116 | ||
| 117 | |||
| 118 | return &ret; | 117 | return &ret; |
| 119 | #endif | 118 | #endif |
| 120 | } | 119 | } |
diff --git a/src/lib/libssl/src/crypto/ec/ectest.c b/src/lib/libssl/src/crypto/ec/ectest.c index f107782de0..102eaa9b23 100644 --- a/src/lib/libssl/src/crypto/ec/ectest.c +++ b/src/lib/libssl/src/crypto/ec/ectest.c | |||
| @@ -236,7 +236,7 @@ static void group_order_tests(EC_GROUP *group) | |||
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | static void prime_field_tests(void) | 238 | static void prime_field_tests(void) |
| 239 | { | 239 | { |
| 240 | BN_CTX *ctx = NULL; | 240 | BN_CTX *ctx = NULL; |
| 241 | BIGNUM *p, *a, *b; | 241 | BIGNUM *p, *a, *b; |
| 242 | EC_GROUP *group; | 242 | EC_GROUP *group; |
diff --git a/src/lib/libssl/src/crypto/engine/eng_list.c b/src/lib/libssl/src/crypto/engine/eng_list.c index 27846edb1e..95c858960b 100644 --- a/src/lib/libssl/src/crypto/engine/eng_list.c +++ b/src/lib/libssl/src/crypto/engine/eng_list.c | |||
| @@ -408,6 +408,7 @@ ENGINE *ENGINE_by_id(const char *id) | |||
| 408 | !ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) || | 408 | !ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) || |
| 409 | !ENGINE_ctrl_cmd_string(iterator, "DIR_ADD", | 409 | !ENGINE_ctrl_cmd_string(iterator, "DIR_ADD", |
| 410 | load_dir, 0) || | 410 | load_dir, 0) || |
| 411 | !ENGINE_ctrl_cmd_string(iterator, "LIST_ADD", "1", 0) || | ||
| 411 | !ENGINE_ctrl_cmd_string(iterator, "LOAD", NULL, 0)) | 412 | !ENGINE_ctrl_cmd_string(iterator, "LOAD", NULL, 0)) |
| 412 | goto notfound; | 413 | goto notfound; |
| 413 | return iterator; | 414 | return iterator; |
diff --git a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c index 3e7fff1c1e..5a715aca4f 100644 --- a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c +++ b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c | |||
| @@ -29,14 +29,16 @@ | |||
| 29 | #include <openssl/objects.h> | 29 | #include <openssl/objects.h> |
| 30 | #include <openssl/engine.h> | 30 | #include <openssl/engine.h> |
| 31 | #include <openssl/evp.h> | 31 | #include <openssl/evp.h> |
| 32 | #include <openssl/bn.h> | ||
| 32 | 33 | ||
| 33 | #if (defined(__unix__) || defined(unix)) && !defined(USG) | 34 | #if (defined(__unix__) || defined(unix)) && !defined(USG) && \ |
| 35 | (defined(OpenBSD) || defined(__FreeBSD__)) | ||
| 34 | #include <sys/param.h> | 36 | #include <sys/param.h> |
| 35 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) | 37 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) |
| 36 | # define HAVE_CRYPTODEV | 38 | # define HAVE_CRYPTODEV |
| 37 | # endif | 39 | # endif |
| 38 | # if (OpenBSD >= 200110) | 40 | # if (OpenBSD >= 200110) |
| 39 | # define HAVE_SYSLOG_R | 41 | # define HAVE_SYSLOG_R |
| 40 | # endif | 42 | # endif |
| 41 | #endif | 43 | #endif |
| 42 | 44 | ||
| @@ -50,9 +52,13 @@ ENGINE_load_cryptodev(void) | |||
| 50 | } | 52 | } |
| 51 | 53 | ||
| 52 | #else | 54 | #else |
| 53 | 55 | ||
| 54 | #include <sys/types.h> | 56 | #include <sys/types.h> |
| 55 | #include <crypto/cryptodev.h> | 57 | #include <crypto/cryptodev.h> |
| 58 | #include <crypto/dh/dh.h> | ||
| 59 | #include <crypto/dsa/dsa.h> | ||
| 60 | #include <crypto/err/err.h> | ||
| 61 | #include <crypto/rsa/rsa.h> | ||
| 56 | #include <sys/ioctl.h> | 62 | #include <sys/ioctl.h> |
| 57 | #include <errno.h> | 63 | #include <errno.h> |
| 58 | #include <stdio.h> | 64 | #include <stdio.h> |
| @@ -66,6 +72,14 @@ ENGINE_load_cryptodev(void) | |||
| 66 | struct dev_crypto_state { | 72 | struct dev_crypto_state { |
| 67 | struct session_op d_sess; | 73 | struct session_op d_sess; |
| 68 | int d_fd; | 74 | int d_fd; |
| 75 | |||
| 76 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 77 | char dummy_mac_key[HASH_MAX_LEN]; | ||
| 78 | |||
| 79 | unsigned char digest_res[HASH_MAX_LEN]; | ||
| 80 | char *mac_data; | ||
| 81 | int mac_len; | ||
| 82 | #endif | ||
| 69 | }; | 83 | }; |
| 70 | 84 | ||
| 71 | static u_int32_t cryptodev_asymfeat = 0; | 85 | static u_int32_t cryptodev_asymfeat = 0; |
| @@ -73,15 +87,14 @@ static u_int32_t cryptodev_asymfeat = 0; | |||
| 73 | static int get_asym_dev_crypto(void); | 87 | static int get_asym_dev_crypto(void); |
| 74 | static int open_dev_crypto(void); | 88 | static int open_dev_crypto(void); |
| 75 | static int get_dev_crypto(void); | 89 | static int get_dev_crypto(void); |
| 76 | static int cryptodev_max_iv(int cipher); | ||
| 77 | static int cryptodev_key_length_valid(int cipher, int len); | ||
| 78 | static int cipher_nid_to_cryptodev(int nid); | ||
| 79 | static int get_cryptodev_ciphers(const int **cnids); | 90 | static int get_cryptodev_ciphers(const int **cnids); |
| 80 | /*static int get_cryptodev_digests(const int **cnids);*/ | 91 | #ifdef USE_CRYPTODEV_DIGESTS |
| 92 | static int get_cryptodev_digests(const int **cnids); | ||
| 93 | #endif | ||
| 81 | static int cryptodev_usable_ciphers(const int **nids); | 94 | static int cryptodev_usable_ciphers(const int **nids); |
| 82 | static int cryptodev_usable_digests(const int **nids); | 95 | static int cryptodev_usable_digests(const int **nids); |
| 83 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 96 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 84 | const unsigned char *in, unsigned int inl); | 97 | const unsigned char *in, size_t inl); |
| 85 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 98 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 86 | const unsigned char *iv, int enc); | 99 | const unsigned char *iv, int enc); |
| 87 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); | 100 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); |
| @@ -98,8 +111,8 @@ static int cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, | |||
| 98 | static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, | 111 | static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, |
| 99 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 112 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
| 100 | static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, | 113 | static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, |
| 101 | RSA *rsa); | 114 | RSA *rsa, BN_CTX *ctx); |
| 102 | static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); | 115 | static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx); |
| 103 | static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, | 116 | static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, |
| 104 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 117 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
| 105 | static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | 118 | static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, |
| @@ -115,7 +128,7 @@ static int cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | |||
| 115 | static int cryptodev_dh_compute_key(unsigned char *key, | 128 | static int cryptodev_dh_compute_key(unsigned char *key, |
| 116 | const BIGNUM *pub_key, DH *dh); | 129 | const BIGNUM *pub_key, DH *dh); |
| 117 | static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, | 130 | static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, |
| 118 | void (*f)()); | 131 | void (*f)(void)); |
| 119 | void ENGINE_load_cryptodev(void); | 132 | void ENGINE_load_cryptodev(void); |
| 120 | 133 | ||
| 121 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { | 134 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { |
| @@ -128,27 +141,32 @@ static struct { | |||
| 128 | int ivmax; | 141 | int ivmax; |
| 129 | int keylen; | 142 | int keylen; |
| 130 | } ciphers[] = { | 143 | } ciphers[] = { |
| 144 | { CRYPTO_ARC4, NID_rc4, 0, 16, }, | ||
| 131 | { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, }, | 145 | { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, }, |
| 132 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, | 146 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, |
| 133 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, | 147 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, |
| 148 | { CRYPTO_AES_CBC, NID_aes_192_cbc, 16, 24, }, | ||
| 149 | { CRYPTO_AES_CBC, NID_aes_256_cbc, 16, 32, }, | ||
| 134 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, | 150 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, |
| 135 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, | 151 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, |
| 136 | { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, }, | 152 | { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, }, |
| 137 | { 0, NID_undef, 0, 0, }, | 153 | { 0, NID_undef, 0, 0, }, |
| 138 | }; | 154 | }; |
| 139 | 155 | ||
| 140 | #if 0 /* UNUSED */ | 156 | #ifdef USE_CRYPTODEV_DIGESTS |
| 141 | static struct { | 157 | static struct { |
| 142 | int id; | 158 | int id; |
| 143 | int nid; | 159 | int nid; |
| 160 | int keylen; | ||
| 144 | } digests[] = { | 161 | } digests[] = { |
| 145 | { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, }, | 162 | { CRYPTO_MD5_HMAC, NID_hmacWithMD5, 16}, |
| 146 | { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, }, | 163 | { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, 20}, |
| 147 | { CRYPTO_MD5_KPDK, NID_undef, }, | 164 | { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, 16/*?*/}, |
| 148 | { CRYPTO_SHA1_KPDK, NID_undef, }, | 165 | { CRYPTO_MD5_KPDK, NID_undef, 0}, |
| 149 | { CRYPTO_MD5, NID_md5, }, | 166 | { CRYPTO_SHA1_KPDK, NID_undef, 0}, |
| 150 | { CRYPTO_SHA1, NID_undef, }, | 167 | { CRYPTO_MD5, NID_md5, 16}, |
| 151 | { 0, NID_undef, }, | 168 | { CRYPTO_SHA1, NID_sha1, 20}, |
| 169 | { 0, NID_undef, 0}, | ||
| 152 | }; | 170 | }; |
| 153 | #endif | 171 | #endif |
| 154 | 172 | ||
| @@ -180,6 +198,7 @@ get_dev_crypto(void) | |||
| 180 | 198 | ||
| 181 | if ((fd = open_dev_crypto()) == -1) | 199 | if ((fd = open_dev_crypto()) == -1) |
| 182 | return (-1); | 200 | return (-1); |
| 201 | #ifndef CRIOGET_NOT_NEEDED | ||
| 183 | if (ioctl(fd, CRIOGET, &retfd) == -1) | 202 | if (ioctl(fd, CRIOGET, &retfd) == -1) |
| 184 | return (-1); | 203 | return (-1); |
| 185 | 204 | ||
| @@ -188,9 +207,19 @@ get_dev_crypto(void) | |||
| 188 | close(retfd); | 207 | close(retfd); |
| 189 | return (-1); | 208 | return (-1); |
| 190 | } | 209 | } |
| 210 | #else | ||
| 211 | retfd = fd; | ||
| 212 | #endif | ||
| 191 | return (retfd); | 213 | return (retfd); |
| 192 | } | 214 | } |
| 193 | 215 | ||
| 216 | static void put_dev_crypto(int fd) | ||
| 217 | { | ||
| 218 | #ifndef CRIOGET_NOT_NEEDED | ||
| 219 | close(fd); | ||
| 220 | #endif | ||
| 221 | } | ||
| 222 | |||
| 194 | /* Caching version for asym operations */ | 223 | /* Caching version for asym operations */ |
| 195 | static int | 224 | static int |
| 196 | get_asym_dev_crypto(void) | 225 | get_asym_dev_crypto(void) |
| @@ -203,50 +232,6 @@ get_asym_dev_crypto(void) | |||
| 203 | } | 232 | } |
| 204 | 233 | ||
| 205 | /* | 234 | /* |
| 206 | * XXXX this needs to be set for each alg - and determined from | ||
| 207 | * a running card. | ||
| 208 | */ | ||
| 209 | static int | ||
| 210 | cryptodev_max_iv(int cipher) | ||
| 211 | { | ||
| 212 | int i; | ||
| 213 | |||
| 214 | for (i = 0; ciphers[i].id; i++) | ||
| 215 | if (ciphers[i].id == cipher) | ||
| 216 | return (ciphers[i].ivmax); | ||
| 217 | return (0); | ||
| 218 | } | ||
| 219 | |||
| 220 | /* | ||
| 221 | * XXXX this needs to be set for each alg - and determined from | ||
| 222 | * a running card. For now, fake it out - but most of these | ||
| 223 | * for real devices should return 1 for the supported key | ||
| 224 | * sizes the device can handle. | ||
| 225 | */ | ||
| 226 | static int | ||
| 227 | cryptodev_key_length_valid(int cipher, int len) | ||
| 228 | { | ||
| 229 | int i; | ||
| 230 | |||
| 231 | for (i = 0; ciphers[i].id; i++) | ||
| 232 | if (ciphers[i].id == cipher) | ||
| 233 | return (ciphers[i].keylen == len); | ||
| 234 | return (0); | ||
| 235 | } | ||
| 236 | |||
| 237 | /* convert libcrypto nids to cryptodev */ | ||
| 238 | static int | ||
| 239 | cipher_nid_to_cryptodev(int nid) | ||
| 240 | { | ||
| 241 | int i; | ||
| 242 | |||
| 243 | for (i = 0; ciphers[i].id; i++) | ||
| 244 | if (ciphers[i].nid == nid) | ||
| 245 | return (ciphers[i].id); | ||
| 246 | return (0); | ||
| 247 | } | ||
| 248 | |||
| 249 | /* | ||
| 250 | * Find out what ciphers /dev/crypto will let us have a session for. | 235 | * Find out what ciphers /dev/crypto will let us have a session for. |
| 251 | * XXX note, that some of these openssl doesn't deal with yet! | 236 | * XXX note, that some of these openssl doesn't deal with yet! |
| 252 | * returning them here is harmless, as long as we return NULL | 237 | * returning them here is harmless, as long as we return NULL |
| @@ -264,7 +249,7 @@ get_cryptodev_ciphers(const int **cnids) | |||
| 264 | return (0); | 249 | return (0); |
| 265 | } | 250 | } |
| 266 | memset(&sess, 0, sizeof(sess)); | 251 | memset(&sess, 0, sizeof(sess)); |
| 267 | sess.key = (caddr_t)"123456781234567812345678"; | 252 | sess.key = (caddr_t)"123456789abcdefghijklmno"; |
| 268 | 253 | ||
| 269 | for (i = 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { | 254 | for (i = 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { |
| 270 | if (ciphers[i].nid == NID_undef) | 255 | if (ciphers[i].nid == NID_undef) |
| @@ -276,7 +261,7 @@ get_cryptodev_ciphers(const int **cnids) | |||
| 276 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) | 261 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) |
| 277 | nids[count++] = ciphers[i].nid; | 262 | nids[count++] = ciphers[i].nid; |
| 278 | } | 263 | } |
| 279 | close(fd); | 264 | put_dev_crypto(fd); |
| 280 | 265 | ||
| 281 | if (count > 0) | 266 | if (count > 0) |
| 282 | *cnids = nids; | 267 | *cnids = nids; |
| @@ -285,13 +270,13 @@ get_cryptodev_ciphers(const int **cnids) | |||
| 285 | return (count); | 270 | return (count); |
| 286 | } | 271 | } |
| 287 | 272 | ||
| 273 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 288 | /* | 274 | /* |
| 289 | * Find out what digests /dev/crypto will let us have a session for. | 275 | * Find out what digests /dev/crypto will let us have a session for. |
| 290 | * XXX note, that some of these openssl doesn't deal with yet! | 276 | * XXX note, that some of these openssl doesn't deal with yet! |
| 291 | * returning them here is harmless, as long as we return NULL | 277 | * returning them here is harmless, as long as we return NULL |
| 292 | * when asked for a handler in the cryptodev_engine_digests routine | 278 | * when asked for a handler in the cryptodev_engine_digests routine |
| 293 | */ | 279 | */ |
| 294 | #if 0 /* UNUSED */ | ||
| 295 | static int | 280 | static int |
| 296 | get_cryptodev_digests(const int **cnids) | 281 | get_cryptodev_digests(const int **cnids) |
| 297 | { | 282 | { |
| @@ -304,16 +289,18 @@ get_cryptodev_digests(const int **cnids) | |||
| 304 | return (0); | 289 | return (0); |
| 305 | } | 290 | } |
| 306 | memset(&sess, 0, sizeof(sess)); | 291 | memset(&sess, 0, sizeof(sess)); |
| 292 | sess.mackey = (caddr_t)"123456789abcdefghijklmno"; | ||
| 307 | for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { | 293 | for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { |
| 308 | if (digests[i].nid == NID_undef) | 294 | if (digests[i].nid == NID_undef) |
| 309 | continue; | 295 | continue; |
| 310 | sess.mac = digests[i].id; | 296 | sess.mac = digests[i].id; |
| 297 | sess.mackeylen = digests[i].keylen; | ||
| 311 | sess.cipher = 0; | 298 | sess.cipher = 0; |
| 312 | if (ioctl(fd, CIOCGSESSION, &sess) != -1 && | 299 | if (ioctl(fd, CIOCGSESSION, &sess) != -1 && |
| 313 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) | 300 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) |
| 314 | nids[count++] = digests[i].nid; | 301 | nids[count++] = digests[i].nid; |
| 315 | } | 302 | } |
| 316 | close(fd); | 303 | put_dev_crypto(fd); |
| 317 | 304 | ||
| 318 | if (count > 0) | 305 | if (count > 0) |
| 319 | *cnids = nids; | 306 | *cnids = nids; |
| @@ -321,7 +308,7 @@ get_cryptodev_digests(const int **cnids) | |||
| 321 | *cnids = NULL; | 308 | *cnids = NULL; |
| 322 | return (count); | 309 | return (count); |
| 323 | } | 310 | } |
| 324 | #endif | 311 | #endif /* 0 */ |
| 325 | 312 | ||
| 326 | /* | 313 | /* |
| 327 | * Find the useable ciphers|digests from dev/crypto - this is the first | 314 | * Find the useable ciphers|digests from dev/crypto - this is the first |
| @@ -353,6 +340,9 @@ cryptodev_usable_ciphers(const int **nids) | |||
| 353 | static int | 340 | static int |
| 354 | cryptodev_usable_digests(const int **nids) | 341 | cryptodev_usable_digests(const int **nids) |
| 355 | { | 342 | { |
| 343 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 344 | return (get_cryptodev_digests(nids)); | ||
| 345 | #else | ||
| 356 | /* | 346 | /* |
| 357 | * XXXX just disable all digests for now, because it sucks. | 347 | * XXXX just disable all digests for now, because it sucks. |
| 358 | * we need a better way to decide this - i.e. I may not | 348 | * we need a better way to decide this - i.e. I may not |
| @@ -367,16 +357,17 @@ cryptodev_usable_digests(const int **nids) | |||
| 367 | */ | 357 | */ |
| 368 | *nids = NULL; | 358 | *nids = NULL; |
| 369 | return (0); | 359 | return (0); |
| 360 | #endif | ||
| 370 | } | 361 | } |
| 371 | 362 | ||
| 372 | static int | 363 | static int |
| 373 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 364 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 374 | const unsigned char *in, unsigned int inl) | 365 | const unsigned char *in, size_t inl) |
| 375 | { | 366 | { |
| 376 | struct crypt_op cryp; | 367 | struct crypt_op cryp; |
| 377 | struct dev_crypto_state *state = ctx->cipher_data; | 368 | struct dev_crypto_state *state = ctx->cipher_data; |
| 378 | struct session_op *sess = &state->d_sess; | 369 | struct session_op *sess = &state->d_sess; |
| 379 | void *iiv; | 370 | const void *iiv; |
| 380 | unsigned char save_iv[EVP_MAX_IV_LENGTH]; | 371 | unsigned char save_iv[EVP_MAX_IV_LENGTH]; |
| 381 | 372 | ||
| 382 | if (state->d_fd < 0) | 373 | if (state->d_fd < 0) |
| @@ -400,7 +391,7 @@ cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 400 | if (ctx->cipher->iv_len) { | 391 | if (ctx->cipher->iv_len) { |
| 401 | cryp.iv = (caddr_t) ctx->iv; | 392 | cryp.iv = (caddr_t) ctx->iv; |
| 402 | if (!ctx->encrypt) { | 393 | if (!ctx->encrypt) { |
| 403 | iiv = (void *) in + inl - ctx->cipher->iv_len; | 394 | iiv = in + inl - ctx->cipher->iv_len; |
| 404 | memcpy(save_iv, iiv, ctx->cipher->iv_len); | 395 | memcpy(save_iv, iiv, ctx->cipher->iv_len); |
| 405 | } | 396 | } |
| 406 | } else | 397 | } else |
| @@ -415,7 +406,7 @@ cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 415 | 406 | ||
| 416 | if (ctx->cipher->iv_len) { | 407 | if (ctx->cipher->iv_len) { |
| 417 | if (ctx->encrypt) | 408 | if (ctx->encrypt) |
| 418 | iiv = (void *) out + inl - ctx->cipher->iv_len; | 409 | iiv = out + inl - ctx->cipher->iv_len; |
| 419 | else | 410 | else |
| 420 | iiv = save_iv; | 411 | iiv = save_iv; |
| 421 | memcpy(ctx->iv, iiv, ctx->cipher->iv_len); | 412 | memcpy(ctx->iv, iiv, ctx->cipher->iv_len); |
| @@ -429,28 +420,32 @@ cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 429 | { | 420 | { |
| 430 | struct dev_crypto_state *state = ctx->cipher_data; | 421 | struct dev_crypto_state *state = ctx->cipher_data; |
| 431 | struct session_op *sess = &state->d_sess; | 422 | struct session_op *sess = &state->d_sess; |
| 432 | int cipher; | 423 | int cipher = -1, i; |
| 433 | 424 | ||
| 434 | if ((cipher = cipher_nid_to_cryptodev(ctx->cipher->nid)) == NID_undef) | 425 | for (i = 0; ciphers[i].id; i++) |
| 435 | return (0); | 426 | if (ctx->cipher->nid == ciphers[i].nid && |
| 436 | 427 | ctx->cipher->iv_len <= ciphers[i].ivmax && | |
| 437 | if (ctx->cipher->iv_len > cryptodev_max_iv(cipher)) | 428 | ctx->key_len == ciphers[i].keylen) { |
| 438 | return (0); | 429 | cipher = ciphers[i].id; |
| 430 | break; | ||
| 431 | } | ||
| 439 | 432 | ||
| 440 | if (!cryptodev_key_length_valid(cipher, ctx->key_len)) | 433 | if (!ciphers[i].id) { |
| 434 | state->d_fd = -1; | ||
| 441 | return (0); | 435 | return (0); |
| 436 | } | ||
| 442 | 437 | ||
| 443 | memset(sess, 0, sizeof(struct session_op)); | 438 | memset(sess, 0, sizeof(struct session_op)); |
| 444 | 439 | ||
| 445 | if ((state->d_fd = get_dev_crypto()) < 0) | 440 | if ((state->d_fd = get_dev_crypto()) < 0) |
| 446 | return (0); | 441 | return (0); |
| 447 | 442 | ||
| 448 | sess->key = (unsigned char *)key; | 443 | sess->key = (caddr_t)key; |
| 449 | sess->keylen = ctx->key_len; | 444 | sess->keylen = ctx->key_len; |
| 450 | sess->cipher = cipher; | 445 | sess->cipher = cipher; |
| 451 | 446 | ||
| 452 | if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) { | 447 | if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) { |
| 453 | close(state->d_fd); | 448 | put_dev_crypto(state->d_fd); |
| 454 | state->d_fd = -1; | 449 | state->d_fd = -1; |
| 455 | return (0); | 450 | return (0); |
| 456 | } | 451 | } |
| @@ -487,7 +482,7 @@ cryptodev_cleanup(EVP_CIPHER_CTX *ctx) | |||
| 487 | } else { | 482 | } else { |
| 488 | ret = 1; | 483 | ret = 1; |
| 489 | } | 484 | } |
| 490 | close(state->d_fd); | 485 | put_dev_crypto(state->d_fd); |
| 491 | state->d_fd = -1; | 486 | state->d_fd = -1; |
| 492 | 487 | ||
| 493 | return (ret); | 488 | return (ret); |
| @@ -498,6 +493,20 @@ cryptodev_cleanup(EVP_CIPHER_CTX *ctx) | |||
| 498 | * gets called when libcrypto requests a cipher NID. | 493 | * gets called when libcrypto requests a cipher NID. |
| 499 | */ | 494 | */ |
| 500 | 495 | ||
| 496 | /* RC4 */ | ||
| 497 | const EVP_CIPHER cryptodev_rc4 = { | ||
| 498 | NID_rc4, | ||
| 499 | 1, 16, 0, | ||
| 500 | EVP_CIPH_VARIABLE_LENGTH, | ||
| 501 | cryptodev_init_key, | ||
| 502 | cryptodev_cipher, | ||
| 503 | cryptodev_cleanup, | ||
| 504 | sizeof(struct dev_crypto_state), | ||
| 505 | NULL, | ||
| 506 | NULL, | ||
| 507 | NULL | ||
| 508 | }; | ||
| 509 | |||
| 501 | /* DES CBC EVP */ | 510 | /* DES CBC EVP */ |
| 502 | const EVP_CIPHER cryptodev_des_cbc = { | 511 | const EVP_CIPHER cryptodev_des_cbc = { |
| 503 | NID_des_cbc, | 512 | NID_des_cbc, |
| @@ -565,6 +574,32 @@ const EVP_CIPHER cryptodev_aes_cbc = { | |||
| 565 | NULL | 574 | NULL |
| 566 | }; | 575 | }; |
| 567 | 576 | ||
| 577 | const EVP_CIPHER cryptodev_aes_192_cbc = { | ||
| 578 | NID_aes_192_cbc, | ||
| 579 | 16, 24, 16, | ||
| 580 | EVP_CIPH_CBC_MODE, | ||
| 581 | cryptodev_init_key, | ||
| 582 | cryptodev_cipher, | ||
| 583 | cryptodev_cleanup, | ||
| 584 | sizeof(struct dev_crypto_state), | ||
| 585 | EVP_CIPHER_set_asn1_iv, | ||
| 586 | EVP_CIPHER_get_asn1_iv, | ||
| 587 | NULL | ||
| 588 | }; | ||
| 589 | |||
| 590 | const EVP_CIPHER cryptodev_aes_256_cbc = { | ||
| 591 | NID_aes_256_cbc, | ||
| 592 | 16, 32, 16, | ||
| 593 | EVP_CIPH_CBC_MODE, | ||
| 594 | cryptodev_init_key, | ||
| 595 | cryptodev_cipher, | ||
| 596 | cryptodev_cleanup, | ||
| 597 | sizeof(struct dev_crypto_state), | ||
| 598 | EVP_CIPHER_set_asn1_iv, | ||
| 599 | EVP_CIPHER_get_asn1_iv, | ||
| 600 | NULL | ||
| 601 | }; | ||
| 602 | |||
| 568 | /* | 603 | /* |
| 569 | * Registered by the ENGINE when used to find out how to deal with | 604 | * Registered by the ENGINE when used to find out how to deal with |
| 570 | * a particular NID in the ENGINE. this says what we'll do at the | 605 | * a particular NID in the ENGINE. this says what we'll do at the |
| @@ -578,6 +613,9 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | |||
| 578 | return (cryptodev_usable_ciphers(nids)); | 613 | return (cryptodev_usable_ciphers(nids)); |
| 579 | 614 | ||
| 580 | switch (nid) { | 615 | switch (nid) { |
| 616 | case NID_rc4: | ||
| 617 | *cipher = &cryptodev_rc4; | ||
| 618 | break; | ||
| 581 | case NID_des_ede3_cbc: | 619 | case NID_des_ede3_cbc: |
| 582 | *cipher = &cryptodev_3des_cbc; | 620 | *cipher = &cryptodev_3des_cbc; |
| 583 | break; | 621 | break; |
| @@ -593,6 +631,12 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | |||
| 593 | case NID_aes_128_cbc: | 631 | case NID_aes_128_cbc: |
| 594 | *cipher = &cryptodev_aes_cbc; | 632 | *cipher = &cryptodev_aes_cbc; |
| 595 | break; | 633 | break; |
| 634 | case NID_aes_192_cbc: | ||
| 635 | *cipher = &cryptodev_aes_192_cbc; | ||
| 636 | break; | ||
| 637 | case NID_aes_256_cbc: | ||
| 638 | *cipher = &cryptodev_aes_256_cbc; | ||
| 639 | break; | ||
| 596 | default: | 640 | default: |
| 597 | *cipher = NULL; | 641 | *cipher = NULL; |
| 598 | break; | 642 | break; |
| @@ -600,6 +644,256 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | |||
| 600 | return (*cipher != NULL); | 644 | return (*cipher != NULL); |
| 601 | } | 645 | } |
| 602 | 646 | ||
| 647 | |||
| 648 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 649 | |||
| 650 | /* convert digest type to cryptodev */ | ||
| 651 | static int | ||
| 652 | digest_nid_to_cryptodev(int nid) | ||
| 653 | { | ||
| 654 | int i; | ||
| 655 | |||
| 656 | for (i = 0; digests[i].id; i++) | ||
| 657 | if (digests[i].nid == nid) | ||
| 658 | return (digests[i].id); | ||
| 659 | return (0); | ||
| 660 | } | ||
| 661 | |||
| 662 | |||
| 663 | static int | ||
| 664 | digest_key_length(int nid) | ||
| 665 | { | ||
| 666 | int i; | ||
| 667 | |||
| 668 | for (i = 0; digests[i].id; i++) | ||
| 669 | if (digests[i].nid == nid) | ||
| 670 | return digests[i].keylen; | ||
| 671 | return (0); | ||
| 672 | } | ||
| 673 | |||
| 674 | |||
| 675 | static int cryptodev_digest_init(EVP_MD_CTX *ctx) | ||
| 676 | { | ||
| 677 | struct dev_crypto_state *state = ctx->md_data; | ||
| 678 | struct session_op *sess = &state->d_sess; | ||
| 679 | int digest; | ||
| 680 | |||
| 681 | if ((digest = digest_nid_to_cryptodev(ctx->digest->type)) == NID_undef){ | ||
| 682 | printf("cryptodev_digest_init: Can't get digest \n"); | ||
| 683 | return (0); | ||
| 684 | } | ||
| 685 | |||
| 686 | memset(state, 0, sizeof(struct dev_crypto_state)); | ||
| 687 | |||
| 688 | if ((state->d_fd = get_dev_crypto()) < 0) { | ||
| 689 | printf("cryptodev_digest_init: Can't get Dev \n"); | ||
| 690 | return (0); | ||
| 691 | } | ||
| 692 | |||
| 693 | sess->mackey = state->dummy_mac_key; | ||
| 694 | sess->mackeylen = digest_key_length(ctx->digest->type); | ||
| 695 | sess->mac = digest; | ||
| 696 | |||
| 697 | if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) { | ||
| 698 | put_dev_crypto(state->d_fd); | ||
| 699 | state->d_fd = -1; | ||
| 700 | printf("cryptodev_digest_init: Open session failed\n"); | ||
| 701 | return (0); | ||
| 702 | } | ||
| 703 | |||
| 704 | return (1); | ||
| 705 | } | ||
| 706 | |||
| 707 | static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data, | ||
| 708 | size_t count) | ||
| 709 | { | ||
| 710 | struct crypt_op cryp; | ||
| 711 | struct dev_crypto_state *state = ctx->md_data; | ||
| 712 | struct session_op *sess = &state->d_sess; | ||
| 713 | |||
| 714 | if (!data || state->d_fd < 0) { | ||
| 715 | printf("cryptodev_digest_update: illegal inputs \n"); | ||
| 716 | return (0); | ||
| 717 | } | ||
| 718 | |||
| 719 | if (!count) { | ||
| 720 | return (0); | ||
| 721 | } | ||
| 722 | |||
| 723 | if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) { | ||
| 724 | /* if application doesn't support one buffer */ | ||
| 725 | state->mac_data = OPENSSL_realloc(state->mac_data, state->mac_len + count); | ||
| 726 | |||
| 727 | if (!state->mac_data) { | ||
| 728 | printf("cryptodev_digest_update: realloc failed\n"); | ||
| 729 | return (0); | ||
| 730 | } | ||
| 731 | |||
| 732 | memcpy(state->mac_data + state->mac_len, data, count); | ||
| 733 | state->mac_len += count; | ||
| 734 | |||
| 735 | return (1); | ||
| 736 | } | ||
| 737 | |||
| 738 | memset(&cryp, 0, sizeof(cryp)); | ||
| 739 | |||
| 740 | cryp.ses = sess->ses; | ||
| 741 | cryp.flags = 0; | ||
| 742 | cryp.len = count; | ||
| 743 | cryp.src = (caddr_t) data; | ||
| 744 | cryp.dst = NULL; | ||
| 745 | cryp.mac = (caddr_t) state->digest_res; | ||
| 746 | if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { | ||
| 747 | printf("cryptodev_digest_update: digest failed\n"); | ||
| 748 | return (0); | ||
| 749 | } | ||
| 750 | return (1); | ||
| 751 | } | ||
| 752 | |||
| 753 | |||
| 754 | static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md) | ||
| 755 | { | ||
| 756 | struct crypt_op cryp; | ||
| 757 | struct dev_crypto_state *state = ctx->md_data; | ||
| 758 | struct session_op *sess = &state->d_sess; | ||
| 759 | |||
| 760 | int ret = 1; | ||
| 761 | |||
| 762 | if (!md || state->d_fd < 0) { | ||
| 763 | printf("cryptodev_digest_final: illegal input\n"); | ||
| 764 | return(0); | ||
| 765 | } | ||
| 766 | |||
| 767 | if (! (ctx->flags & EVP_MD_CTX_FLAG_ONESHOT) ) { | ||
| 768 | /* if application doesn't support one buffer */ | ||
| 769 | memset(&cryp, 0, sizeof(cryp)); | ||
| 770 | cryp.ses = sess->ses; | ||
| 771 | cryp.flags = 0; | ||
| 772 | cryp.len = state->mac_len; | ||
| 773 | cryp.src = state->mac_data; | ||
| 774 | cryp.dst = NULL; | ||
| 775 | cryp.mac = (caddr_t)md; | ||
| 776 | if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { | ||
| 777 | printf("cryptodev_digest_final: digest failed\n"); | ||
| 778 | return (0); | ||
| 779 | } | ||
| 780 | |||
| 781 | return 1; | ||
| 782 | } | ||
| 783 | |||
| 784 | memcpy(md, state->digest_res, ctx->digest->md_size); | ||
| 785 | |||
| 786 | return (ret); | ||
| 787 | } | ||
| 788 | |||
| 789 | |||
| 790 | static int cryptodev_digest_cleanup(EVP_MD_CTX *ctx) | ||
| 791 | { | ||
| 792 | int ret = 1; | ||
| 793 | struct dev_crypto_state *state = ctx->md_data; | ||
| 794 | struct session_op *sess = &state->d_sess; | ||
| 795 | |||
| 796 | if (state == NULL) | ||
| 797 | return 0; | ||
| 798 | |||
| 799 | if (state->d_fd < 0) { | ||
| 800 | printf("cryptodev_digest_cleanup: illegal input\n"); | ||
| 801 | return (0); | ||
| 802 | } | ||
| 803 | |||
| 804 | if (state->mac_data) { | ||
| 805 | OPENSSL_free(state->mac_data); | ||
| 806 | state->mac_data = NULL; | ||
| 807 | state->mac_len = 0; | ||
| 808 | } | ||
| 809 | |||
| 810 | if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) { | ||
| 811 | printf("cryptodev_digest_cleanup: failed to close session\n"); | ||
| 812 | ret = 0; | ||
| 813 | } else { | ||
| 814 | ret = 1; | ||
| 815 | } | ||
| 816 | put_dev_crypto(state->d_fd); | ||
| 817 | state->d_fd = -1; | ||
| 818 | |||
| 819 | return (ret); | ||
| 820 | } | ||
| 821 | |||
| 822 | static int cryptodev_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from) | ||
| 823 | { | ||
| 824 | struct dev_crypto_state *fstate = from->md_data; | ||
| 825 | struct dev_crypto_state *dstate = to->md_data; | ||
| 826 | struct session_op *sess; | ||
| 827 | int digest; | ||
| 828 | |||
| 829 | if (dstate == NULL || fstate == NULL) | ||
| 830 | return 1; | ||
| 831 | |||
| 832 | memcpy(dstate, fstate, sizeof(struct dev_crypto_state)); | ||
| 833 | |||
| 834 | sess = &dstate->d_sess; | ||
| 835 | |||
| 836 | digest = digest_nid_to_cryptodev(to->digest->type); | ||
| 837 | |||
| 838 | sess->mackey = dstate->dummy_mac_key; | ||
| 839 | sess->mackeylen = digest_key_length(to->digest->type); | ||
| 840 | sess->mac = digest; | ||
| 841 | |||
| 842 | dstate->d_fd = get_dev_crypto(); | ||
| 843 | |||
| 844 | if (ioctl(dstate->d_fd, CIOCGSESSION, sess) < 0) { | ||
| 845 | put_dev_crypto(dstate->d_fd); | ||
| 846 | dstate->d_fd = -1; | ||
| 847 | printf("cryptodev_digest_init: Open session failed\n"); | ||
| 848 | return (0); | ||
| 849 | } | ||
| 850 | |||
| 851 | if (fstate->mac_len != 0) { | ||
| 852 | if (fstate->mac_data != NULL) | ||
| 853 | { | ||
| 854 | dstate->mac_data = OPENSSL_malloc(fstate->mac_len); | ||
| 855 | memcpy(dstate->mac_data, fstate->mac_data, fstate->mac_len); | ||
| 856 | dstate->mac_len = fstate->mac_len; | ||
| 857 | } | ||
| 858 | } | ||
| 859 | |||
| 860 | return 1; | ||
| 861 | } | ||
| 862 | |||
| 863 | |||
| 864 | const EVP_MD cryptodev_sha1 = { | ||
| 865 | NID_sha1, | ||
| 866 | NID_undef, | ||
| 867 | SHA_DIGEST_LENGTH, | ||
| 868 | EVP_MD_FLAG_ONESHOT, | ||
| 869 | cryptodev_digest_init, | ||
| 870 | cryptodev_digest_update, | ||
| 871 | cryptodev_digest_final, | ||
| 872 | cryptodev_digest_copy, | ||
| 873 | cryptodev_digest_cleanup, | ||
| 874 | EVP_PKEY_NULL_method, | ||
| 875 | SHA_CBLOCK, | ||
| 876 | sizeof(struct dev_crypto_state), | ||
| 877 | }; | ||
| 878 | |||
| 879 | const EVP_MD cryptodev_md5 = { | ||
| 880 | NID_md5, | ||
| 881 | NID_undef, | ||
| 882 | 16 /* MD5_DIGEST_LENGTH */, | ||
| 883 | EVP_MD_FLAG_ONESHOT, | ||
| 884 | cryptodev_digest_init, | ||
| 885 | cryptodev_digest_update, | ||
| 886 | cryptodev_digest_final, | ||
| 887 | cryptodev_digest_copy, | ||
| 888 | cryptodev_digest_cleanup, | ||
| 889 | EVP_PKEY_NULL_method, | ||
| 890 | 64 /* MD5_CBLOCK */, | ||
| 891 | sizeof(struct dev_crypto_state), | ||
| 892 | }; | ||
| 893 | |||
| 894 | #endif /* USE_CRYPTODEV_DIGESTS */ | ||
| 895 | |||
| 896 | |||
| 603 | static int | 897 | static int |
| 604 | cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | 898 | cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, |
| 605 | const int **nids, int nid) | 899 | const int **nids, int nid) |
| @@ -608,10 +902,15 @@ cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | |||
| 608 | return (cryptodev_usable_digests(nids)); | 902 | return (cryptodev_usable_digests(nids)); |
| 609 | 903 | ||
| 610 | switch (nid) { | 904 | switch (nid) { |
| 905 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 611 | case NID_md5: | 906 | case NID_md5: |
| 612 | *digest = NULL; /* need to make a clean md5 critter */ | 907 | *digest = &cryptodev_md5; |
| 613 | break; | 908 | break; |
| 909 | case NID_sha1: | ||
| 910 | *digest = &cryptodev_sha1; | ||
| 911 | break; | ||
| 614 | default: | 912 | default: |
| 913 | #endif /* USE_CRYPTODEV_DIGESTS */ | ||
| 615 | *digest = NULL; | 914 | *digest = NULL; |
| 616 | break; | 915 | break; |
| 617 | } | 916 | } |
| @@ -639,8 +938,9 @@ bn2crparam(const BIGNUM *a, struct crparam *crp) | |||
| 639 | b = malloc(bytes); | 938 | b = malloc(bytes); |
| 640 | if (b == NULL) | 939 | if (b == NULL) |
| 641 | return (1); | 940 | return (1); |
| 941 | memset(b, 0, bytes); | ||
| 642 | 942 | ||
| 643 | crp->crp_p = b; | 943 | crp->crp_p = (caddr_t) b; |
| 644 | crp->crp_nbits = bits; | 944 | crp->crp_nbits = bits; |
| 645 | 945 | ||
| 646 | for (i = 0, j = 0; i < a->top; i++) { | 946 | for (i = 0, j = 0; i < a->top; i++) { |
| @@ -683,7 +983,7 @@ zapparams(struct crypt_kop *kop) | |||
| 683 | { | 983 | { |
| 684 | int i; | 984 | int i; |
| 685 | 985 | ||
| 686 | for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) { | 986 | for (i = 0; i < kop->crk_iparams + kop->crk_oparams; i++) { |
| 687 | if (kop->crk_param[i].crp_p) | 987 | if (kop->crk_param[i].crp_p) |
| 688 | free(kop->crk_param[i].crp_p); | 988 | free(kop->crk_param[i].crp_p); |
| 689 | kop->crk_param[i].crp_p = NULL; | 989 | kop->crk_param[i].crp_p = NULL; |
| @@ -748,21 +1048,27 @@ cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | |||
| 748 | goto err; | 1048 | goto err; |
| 749 | kop.crk_iparams = 3; | 1049 | kop.crk_iparams = 3; |
| 750 | 1050 | ||
| 751 | if (cryptodev_asym(&kop, BN_num_bytes(m), r, 0, NULL) == -1) { | 1051 | if (cryptodev_asym(&kop, BN_num_bytes(m), r, 0, NULL)) { |
| 1052 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 1053 | printf("OCF asym process failed, Running in software\n"); | ||
| 1054 | ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont); | ||
| 1055 | |||
| 1056 | } else if (ECANCELED == kop.crk_status) { | ||
| 752 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | 1057 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); |
| 1058 | printf("OCF hardware operation cancelled. Running in Software\n"); | ||
| 753 | ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont); | 1059 | ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont); |
| 754 | } | 1060 | } |
| 1061 | /* else cryptodev operation worked ok ==> ret = 1*/ | ||
| 1062 | |||
| 755 | err: | 1063 | err: |
| 756 | zapparams(&kop); | 1064 | zapparams(&kop); |
| 757 | return (ret); | 1065 | return (ret); |
| 758 | } | 1066 | } |
| 759 | 1067 | ||
| 760 | static int | 1068 | static int |
| 761 | cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | 1069 | cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) |
| 762 | { | 1070 | { |
| 763 | int r; | 1071 | int r; |
| 764 | BN_CTX *ctx; | ||
| 765 | |||
| 766 | ctx = BN_CTX_new(); | 1072 | ctx = BN_CTX_new(); |
| 767 | r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL); | 1073 | r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL); |
| 768 | BN_CTX_free(ctx); | 1074 | BN_CTX_free(ctx); |
| @@ -770,7 +1076,7 @@ cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | |||
| 770 | } | 1076 | } |
| 771 | 1077 | ||
| 772 | static int | 1078 | static int |
| 773 | cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | 1079 | cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) |
| 774 | { | 1080 | { |
| 775 | struct crypt_kop kop; | 1081 | struct crypt_kop kop; |
| 776 | int ret = 1; | 1082 | int ret = 1; |
| @@ -797,10 +1103,18 @@ cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | |||
| 797 | goto err; | 1103 | goto err; |
| 798 | kop.crk_iparams = 6; | 1104 | kop.crk_iparams = 6; |
| 799 | 1105 | ||
| 800 | if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL) == -1) { | 1106 | if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL)) { |
| 1107 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 1108 | printf("OCF asym process failed, running in Software\n"); | ||
| 1109 | ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx); | ||
| 1110 | |||
| 1111 | } else if (ECANCELED == kop.crk_status) { | ||
| 801 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | 1112 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); |
| 802 | ret = (*meth->rsa_mod_exp)(r0, I, rsa); | 1113 | printf("OCF hardware operation cancelled. Running in Software\n"); |
| 1114 | ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx); | ||
| 803 | } | 1115 | } |
| 1116 | /* else cryptodev operation worked ok ==> ret = 1*/ | ||
| 1117 | |||
| 804 | err: | 1118 | err: |
| 805 | zapparams(&kop); | 1119 | zapparams(&kop); |
| 806 | return (ret); | 1120 | return (ret); |
| @@ -936,7 +1250,8 @@ cryptodev_dsa_verify(const unsigned char *dgst, int dlen, | |||
| 936 | kop.crk_iparams = 7; | 1250 | kop.crk_iparams = 7; |
| 937 | 1251 | ||
| 938 | if (cryptodev_asym(&kop, 0, NULL, 0, NULL) == 0) { | 1252 | if (cryptodev_asym(&kop, 0, NULL, 0, NULL) == 0) { |
| 939 | dsaret = kop.crk_status; | 1253 | /*OCF success value is 0, if not zero, change dsaret to fail*/ |
| 1254 | if(0 != kop.crk_status) dsaret = 0; | ||
| 940 | } else { | 1255 | } else { |
| 941 | const DSA_METHOD *meth = DSA_OpenSSL(); | 1256 | const DSA_METHOD *meth = DSA_OpenSSL(); |
| 942 | 1257 | ||
| @@ -996,7 +1311,7 @@ cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) | |||
| 996 | goto err; | 1311 | goto err; |
| 997 | kop.crk_iparams = 3; | 1312 | kop.crk_iparams = 3; |
| 998 | 1313 | ||
| 999 | kop.crk_param[3].crp_p = key; | 1314 | kop.crk_param[3].crp_p = (caddr_t) key; |
| 1000 | kop.crk_param[3].crp_nbits = keylen * 8; | 1315 | kop.crk_param[3].crp_nbits = keylen * 8; |
| 1001 | kop.crk_oparams = 1; | 1316 | kop.crk_oparams = 1; |
| 1002 | 1317 | ||
| @@ -1027,7 +1342,7 @@ static DH_METHOD cryptodev_dh = { | |||
| 1027 | * but I expect we'll want some options soon. | 1342 | * but I expect we'll want some options soon. |
| 1028 | */ | 1343 | */ |
| 1029 | static int | 1344 | static int |
| 1030 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | 1345 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) |
| 1031 | { | 1346 | { |
| 1032 | #ifdef HAVE_SYSLOG_R | 1347 | #ifdef HAVE_SYSLOG_R |
| 1033 | struct syslog_data sd = SYSLOG_DATA_INIT; | 1348 | struct syslog_data sd = SYSLOG_DATA_INIT; |
| @@ -1063,11 +1378,11 @@ ENGINE_load_cryptodev(void) | |||
| 1063 | * find out what asymmetric crypto algorithms we support | 1378 | * find out what asymmetric crypto algorithms we support |
| 1064 | */ | 1379 | */ |
| 1065 | if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { | 1380 | if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { |
| 1066 | close(fd); | 1381 | put_dev_crypto(fd); |
| 1067 | ENGINE_free(engine); | 1382 | ENGINE_free(engine); |
| 1068 | return; | 1383 | return; |
| 1069 | } | 1384 | } |
| 1070 | close(fd); | 1385 | put_dev_crypto(fd); |
| 1071 | 1386 | ||
| 1072 | if (!ENGINE_set_id(engine, "cryptodev") || | 1387 | if (!ENGINE_set_id(engine, "cryptodev") || |
| 1073 | !ENGINE_set_name(engine, "BSD cryptodev engine") || | 1388 | !ENGINE_set_name(engine, "BSD cryptodev engine") || |
diff --git a/src/lib/libssl/src/crypto/err/err_all.c b/src/lib/libssl/src/crypto/err/err_all.c index bd8946d8ba..8eb547d98d 100644 --- a/src/lib/libssl/src/crypto/err/err_all.c +++ b/src/lib/libssl/src/crypto/err/err_all.c | |||
| @@ -64,7 +64,9 @@ | |||
| 64 | #endif | 64 | #endif |
| 65 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
| 66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
| 67 | #ifndef OPENSSL_NO_COMP | ||
| 67 | #include <openssl/comp.h> | 68 | #include <openssl/comp.h> |
| 69 | #endif | ||
| 68 | #ifndef OPENSSL_NO_RSA | 70 | #ifndef OPENSSL_NO_RSA |
| 69 | #include <openssl/rsa.h> | 71 | #include <openssl/rsa.h> |
| 70 | #endif | 72 | #endif |
| @@ -95,6 +97,9 @@ | |||
| 95 | #include <openssl/ui.h> | 97 | #include <openssl/ui.h> |
| 96 | #include <openssl/ocsp.h> | 98 | #include <openssl/ocsp.h> |
| 97 | #include <openssl/err.h> | 99 | #include <openssl/err.h> |
| 100 | #ifdef OPENSSL_FIPS | ||
| 101 | #include <openssl/fips.h> | ||
| 102 | #endif | ||
| 98 | #include <openssl/ts.h> | 103 | #include <openssl/ts.h> |
| 99 | #ifndef OPENSSL_NO_CMS | 104 | #ifndef OPENSSL_NO_CMS |
| 100 | #include <openssl/cms.h> | 105 | #include <openssl/cms.h> |
| @@ -102,11 +107,6 @@ | |||
| 102 | #ifndef OPENSSL_NO_JPAKE | 107 | #ifndef OPENSSL_NO_JPAKE |
| 103 | #include <openssl/jpake.h> | 108 | #include <openssl/jpake.h> |
| 104 | #endif | 109 | #endif |
| 105 | #include <openssl/comp.h> | ||
| 106 | |||
| 107 | #ifdef OPENSSL_FIPS | ||
| 108 | #include <openssl/fips.h> | ||
| 109 | #endif | ||
| 110 | 110 | ||
| 111 | void ERR_load_crypto_strings(void) | 111 | void ERR_load_crypto_strings(void) |
| 112 | { | 112 | { |
| @@ -130,7 +130,9 @@ void ERR_load_crypto_strings(void) | |||
| 130 | ERR_load_ASN1_strings(); | 130 | ERR_load_ASN1_strings(); |
| 131 | ERR_load_CONF_strings(); | 131 | ERR_load_CONF_strings(); |
| 132 | ERR_load_CRYPTO_strings(); | 132 | ERR_load_CRYPTO_strings(); |
| 133 | #ifndef OPENSSL_NO_COMP | ||
| 133 | ERR_load_COMP_strings(); | 134 | ERR_load_COMP_strings(); |
| 135 | #endif | ||
| 134 | #ifndef OPENSSL_NO_EC | 136 | #ifndef OPENSSL_NO_EC |
| 135 | ERR_load_EC_strings(); | 137 | ERR_load_EC_strings(); |
| 136 | #endif | 138 | #endif |
| @@ -153,15 +155,14 @@ void ERR_load_crypto_strings(void) | |||
| 153 | #endif | 155 | #endif |
| 154 | ERR_load_OCSP_strings(); | 156 | ERR_load_OCSP_strings(); |
| 155 | ERR_load_UI_strings(); | 157 | ERR_load_UI_strings(); |
| 158 | #ifdef OPENSSL_FIPS | ||
| 159 | ERR_load_FIPS_strings(); | ||
| 160 | #endif | ||
| 156 | #ifndef OPENSSL_NO_CMS | 161 | #ifndef OPENSSL_NO_CMS |
| 157 | ERR_load_CMS_strings(); | 162 | ERR_load_CMS_strings(); |
| 158 | #endif | 163 | #endif |
| 159 | #ifndef OPENSSL_NO_JPAKE | 164 | #ifndef OPENSSL_NO_JPAKE |
| 160 | ERR_load_JPAKE_strings(); | 165 | ERR_load_JPAKE_strings(); |
| 161 | #endif | 166 | #endif |
| 162 | ERR_load_COMP_strings(); | ||
| 163 | #endif | ||
| 164 | #ifdef OPENSSL_FIPS | ||
| 165 | ERR_load_FIPS_strings(); | ||
| 166 | #endif | 167 | #endif |
| 167 | } | 168 | } |
diff --git a/src/lib/libssl/src/crypto/evp/Makefile b/src/lib/libssl/src/crypto/evp/Makefile index 0fe1b96bff..5d0c6b7db4 100644 --- a/src/lib/libssl/src/crypto/evp/Makefile +++ b/src/lib/libssl/src/crypto/evp/Makefile | |||
| @@ -18,7 +18,7 @@ TESTDATA=evptests.txt | |||
| 18 | APPS= | 18 | APPS= |
| 19 | 19 | ||
| 20 | LIB=$(TOP)/libcrypto.a | 20 | LIB=$(TOP)/libcrypto.a |
| 21 | LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \ | 21 | LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c evp_cnf.c \ |
| 22 | e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\ | 22 | e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\ |
| 23 | e_rc4.c e_aes.c names.c e_seed.c \ | 23 | e_rc4.c e_aes.c names.c e_seed.c \ |
| 24 | e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ | 24 | e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ |
| @@ -31,7 +31,7 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \ | |||
| 31 | e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c evp_fips.c \ | 31 | e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c evp_fips.c \ |
| 32 | e_aes_cbc_hmac_sha1.c e_rc4_hmac_md5.c | 32 | e_aes_cbc_hmac_sha1.c e_rc4_hmac_md5.c |
| 33 | 33 | ||
| 34 | LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \ | 34 | LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o evp_cnf.o \ |
| 35 | e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\ | 35 | e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\ |
| 36 | e_rc4.o e_aes.o names.o e_seed.o \ | 36 | e_rc4.o e_aes.o names.o e_seed.o \ |
| 37 | e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \ | 37 | e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \ |
| @@ -67,7 +67,7 @@ files: | |||
| 67 | links: | 67 | links: |
| 68 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | 68 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) |
| 69 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | 69 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) |
| 70 | cp $(TESTDATA) ../../test | 70 | @[ -f $(TESTDATA) ] && cp $(TESTDATA) ../../test && echo "$(TESTDATA) -> ../../test/$(TESTDATA)" |
| 71 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | 71 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) |
| 72 | 72 | ||
| 73 | install: | 73 | install: |
| @@ -356,6 +356,20 @@ evp_acnf.o: ../../include/openssl/opensslconf.h | |||
| 356 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 356 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 357 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 357 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 358 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c | 358 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c |
| 359 | evp_cnf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 360 | evp_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 361 | evp_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 362 | evp_cnf.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 363 | evp_cnf.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 364 | evp_cnf.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 365 | evp_cnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 366 | evp_cnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 367 | evp_cnf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 368 | evp_cnf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 369 | evp_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 370 | evp_cnf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 371 | evp_cnf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 372 | evp_cnf.o: ../../include/openssl/x509v3.h ../cryptlib.h evp_cnf.c | ||
| 359 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h | 373 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h |
| 360 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 374 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 361 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 375 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| @@ -437,28 +451,22 @@ evp_pkey.o: ../asn1/asn1_locl.h ../cryptlib.h evp_pkey.c | |||
| 437 | m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 451 | m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 438 | m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 452 | m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 439 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 453 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 440 | m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 454 | m_dss.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 441 | m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 455 | m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 442 | m_dss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | 456 | m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 443 | m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 457 | m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 444 | m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 445 | m_dss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 446 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 458 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 447 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 459 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 448 | m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 449 | m_dss.o: ../cryptlib.h m_dss.c | 460 | m_dss.o: ../cryptlib.h m_dss.c |
| 450 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 461 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 451 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 462 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 452 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 463 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 453 | m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 464 | m_dss1.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 454 | m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 465 | m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 455 | m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | 466 | m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 456 | m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 467 | m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 457 | m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 458 | m_dss1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 459 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 468 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 460 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 469 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 461 | m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 462 | m_dss1.o: ../cryptlib.h m_dss1.c | 470 | m_dss1.o: ../cryptlib.h m_dss1.c |
| 463 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h | 471 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h |
| 464 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 472 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| @@ -563,16 +571,13 @@ m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | |||
| 563 | m_sha.o: ../cryptlib.h evp_locl.h m_sha.c | 571 | m_sha.o: ../cryptlib.h evp_locl.h m_sha.c |
| 564 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 572 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 565 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 573 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 566 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 574 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 567 | m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 575 | m_sha1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 568 | m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 576 | m_sha1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 569 | m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 577 | m_sha1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 570 | m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 578 | m_sha1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h |
| 571 | m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 572 | m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 573 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 579 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 574 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 580 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 575 | m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 576 | m_sha1.o: ../cryptlib.h m_sha1.c | 581 | m_sha1.o: ../cryptlib.h m_sha1.c |
| 577 | m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h | 582 | m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h |
| 578 | m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 583 | m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
diff --git a/src/lib/libssl/src/crypto/evp/bio_b64.c b/src/lib/libssl/src/crypto/evp/bio_b64.c index 72a2a67277..ac6d441aad 100644 --- a/src/lib/libssl/src/crypto/evp/bio_b64.c +++ b/src/lib/libssl/src/crypto/evp/bio_b64.c | |||
| @@ -264,7 +264,7 @@ static int b64_read(BIO *b, char *out, int outl) | |||
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | /* we fell off the end without starting */ | 266 | /* we fell off the end without starting */ |
| 267 | if (j == i) | 267 | if ((j == i) && (num == 0)) |
| 268 | { | 268 | { |
| 269 | /* Is this is one long chunk?, if so, keep on | 269 | /* Is this is one long chunk?, if so, keep on |
| 270 | * reading until a new line. */ | 270 | * reading until a new line. */ |
diff --git a/src/lib/libssl/src/crypto/evp/digest.c b/src/lib/libssl/src/crypto/evp/digest.c index 467e6b5ae9..d14e8e48d5 100644 --- a/src/lib/libssl/src/crypto/evp/digest.c +++ b/src/lib/libssl/src/crypto/evp/digest.c | |||
| @@ -267,6 +267,7 @@ int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | |||
| 267 | return FIPS_digestfinal(ctx, md, size); | 267 | return FIPS_digestfinal(ctx, md, size); |
| 268 | #else | 268 | #else |
| 269 | int ret; | 269 | int ret; |
| 270 | |||
| 270 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); | 271 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); |
| 271 | ret=ctx->digest->final(ctx,md); | 272 | ret=ctx->digest->final(ctx,md); |
| 272 | if (size != NULL) | 273 | if (size != NULL) |
| @@ -365,8 +366,11 @@ int EVP_Digest(const void *data, size_t count, | |||
| 365 | 366 | ||
| 366 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) | 367 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) |
| 367 | { | 368 | { |
| 368 | EVP_MD_CTX_cleanup(ctx); | 369 | if (ctx) |
| 369 | OPENSSL_free(ctx); | 370 | { |
| 371 | EVP_MD_CTX_cleanup(ctx); | ||
| 372 | OPENSSL_free(ctx); | ||
| 373 | } | ||
| 370 | } | 374 | } |
| 371 | 375 | ||
| 372 | /* This call frees resources associated with the context */ | 376 | /* This call frees resources associated with the context */ |
diff --git a/src/lib/libssl/src/crypto/evp/e_aes.c b/src/lib/libssl/src/crypto/evp/e_aes.c index 1e4af0cb75..c7869b69ef 100644 --- a/src/lib/libssl/src/crypto/evp/e_aes.c +++ b/src/lib/libssl/src/crypto/evp/e_aes.c | |||
| @@ -842,7 +842,10 @@ static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 842 | gctx->ctr = NULL; | 842 | gctx->ctr = NULL; |
| 843 | break; | 843 | break; |
| 844 | } | 844 | } |
| 845 | else | ||
| 845 | #endif | 846 | #endif |
| 847 | (void)0; /* terminate potentially open 'else' */ | ||
| 848 | |||
| 846 | AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks); | 849 | AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks); |
| 847 | CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f)AES_encrypt); | 850 | CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f)AES_encrypt); |
| 848 | #ifdef AES_CTR_ASM | 851 | #ifdef AES_CTR_ASM |
| @@ -969,8 +972,6 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 969 | 972 | ||
| 970 | if (!gctx->iv_set) | 973 | if (!gctx->iv_set) |
| 971 | return -1; | 974 | return -1; |
| 972 | if (!ctx->encrypt && gctx->taglen < 0) | ||
| 973 | return -1; | ||
| 974 | if (in) | 975 | if (in) |
| 975 | { | 976 | { |
| 976 | if (out == NULL) | 977 | if (out == NULL) |
| @@ -1012,6 +1013,8 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 1012 | { | 1013 | { |
| 1013 | if (!ctx->encrypt) | 1014 | if (!ctx->encrypt) |
| 1014 | { | 1015 | { |
| 1016 | if (gctx->taglen < 0) | ||
| 1017 | return -1; | ||
| 1015 | if (CRYPTO_gcm128_finish(&gctx->gcm, | 1018 | if (CRYPTO_gcm128_finish(&gctx->gcm, |
| 1016 | ctx->buf, gctx->taglen) != 0) | 1019 | ctx->buf, gctx->taglen) != 0) |
| 1017 | return -1; | 1020 | return -1; |
| @@ -1083,14 +1086,17 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 1083 | xctx->xts.block1 = (block128_f)vpaes_decrypt; | 1086 | xctx->xts.block1 = (block128_f)vpaes_decrypt; |
| 1084 | } | 1087 | } |
| 1085 | 1088 | ||
| 1086 | vpaes_set_encrypt_key(key + ctx->key_len/2, | 1089 | vpaes_set_encrypt_key(key + ctx->key_len/2, |
| 1087 | ctx->key_len * 4, &xctx->ks2); | 1090 | ctx->key_len * 4, &xctx->ks2); |
| 1088 | xctx->xts.block2 = (block128_f)vpaes_encrypt; | 1091 | xctx->xts.block2 = (block128_f)vpaes_encrypt; |
| 1089 | 1092 | ||
| 1090 | xctx->xts.key1 = &xctx->ks1; | 1093 | xctx->xts.key1 = &xctx->ks1; |
| 1091 | break; | 1094 | break; |
| 1092 | } | 1095 | } |
| 1096 | else | ||
| 1093 | #endif | 1097 | #endif |
| 1098 | (void)0; /* terminate potentially open 'else' */ | ||
| 1099 | |||
| 1094 | if (enc) | 1100 | if (enc) |
| 1095 | { | 1101 | { |
| 1096 | AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1); | 1102 | AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1); |
| @@ -1217,6 +1223,7 @@ static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 1217 | vpaes_set_encrypt_key(key, ctx->key_len*8, &cctx->ks); | 1223 | vpaes_set_encrypt_key(key, ctx->key_len*8, &cctx->ks); |
| 1218 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, | 1224 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, |
| 1219 | &cctx->ks, (block128_f)vpaes_encrypt); | 1225 | &cctx->ks, (block128_f)vpaes_encrypt); |
| 1226 | cctx->str = NULL; | ||
| 1220 | cctx->key_set = 1; | 1227 | cctx->key_set = 1; |
| 1221 | break; | 1228 | break; |
| 1222 | } | 1229 | } |
diff --git a/src/lib/libssl/src/crypto/evp/e_des3.c b/src/lib/libssl/src/crypto/evp/e_des3.c index 1e69972662..8d7b7de292 100644 --- a/src/lib/libssl/src/crypto/evp/e_des3.c +++ b/src/lib/libssl/src/crypto/evp/e_des3.c | |||
| @@ -101,7 +101,7 @@ static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 101 | static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 101 | static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 102 | const unsigned char *in, size_t inl) | 102 | const unsigned char *in, size_t inl) |
| 103 | { | 103 | { |
| 104 | if (inl>=EVP_MAXCHUNK) | 104 | while (inl>=EVP_MAXCHUNK) |
| 105 | { | 105 | { |
| 106 | DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, | 106 | DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, |
| 107 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | 107 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, |
| @@ -132,7 +132,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 132 | printf("\n"); | 132 | printf("\n"); |
| 133 | } | 133 | } |
| 134 | #endif /* KSSL_DEBUG */ | 134 | #endif /* KSSL_DEBUG */ |
| 135 | if (inl>=EVP_MAXCHUNK) | 135 | while (inl>=EVP_MAXCHUNK) |
| 136 | { | 136 | { |
| 137 | DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, | 137 | DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, |
| 138 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | 138 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, |
| @@ -151,7 +151,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 151 | static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 151 | static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 152 | const unsigned char *in, size_t inl) | 152 | const unsigned char *in, size_t inl) |
| 153 | { | 153 | { |
| 154 | if (inl>=EVP_MAXCHUNK) | 154 | while (inl>=EVP_MAXCHUNK) |
| 155 | { | 155 | { |
| 156 | DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, | 156 | DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, |
| 157 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | 157 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, |
diff --git a/src/lib/libssl/src/crypto/evp/evp.h b/src/lib/libssl/src/crypto/evp/evp.h index 0d1b20a7d3..faeb3c24e6 100644 --- a/src/lib/libssl/src/crypto/evp/evp.h +++ b/src/lib/libssl/src/crypto/evp/evp.h | |||
| @@ -402,7 +402,6 @@ struct evp_cipher_st | |||
| 402 | /* Length of tag for TLS */ | 402 | /* Length of tag for TLS */ |
| 403 | #define EVP_GCM_TLS_TAG_LEN 16 | 403 | #define EVP_GCM_TLS_TAG_LEN 16 |
| 404 | 404 | ||
| 405 | |||
| 406 | typedef struct evp_cipher_info_st | 405 | typedef struct evp_cipher_info_st |
| 407 | { | 406 | { |
| 408 | const EVP_CIPHER *cipher; | 407 | const EVP_CIPHER *cipher; |
| @@ -789,8 +788,8 @@ const EVP_CIPHER *EVP_aes_128_cfb128(void); | |||
| 789 | # define EVP_aes_128_cfb EVP_aes_128_cfb128 | 788 | # define EVP_aes_128_cfb EVP_aes_128_cfb128 |
| 790 | const EVP_CIPHER *EVP_aes_128_ofb(void); | 789 | const EVP_CIPHER *EVP_aes_128_ofb(void); |
| 791 | const EVP_CIPHER *EVP_aes_128_ctr(void); | 790 | const EVP_CIPHER *EVP_aes_128_ctr(void); |
| 792 | const EVP_CIPHER *EVP_aes_128_gcm(void); | ||
| 793 | const EVP_CIPHER *EVP_aes_128_ccm(void); | 791 | const EVP_CIPHER *EVP_aes_128_ccm(void); |
| 792 | const EVP_CIPHER *EVP_aes_128_gcm(void); | ||
| 794 | const EVP_CIPHER *EVP_aes_128_xts(void); | 793 | const EVP_CIPHER *EVP_aes_128_xts(void); |
| 795 | const EVP_CIPHER *EVP_aes_192_ecb(void); | 794 | const EVP_CIPHER *EVP_aes_192_ecb(void); |
| 796 | const EVP_CIPHER *EVP_aes_192_cbc(void); | 795 | const EVP_CIPHER *EVP_aes_192_cbc(void); |
| @@ -800,8 +799,8 @@ const EVP_CIPHER *EVP_aes_192_cfb128(void); | |||
| 800 | # define EVP_aes_192_cfb EVP_aes_192_cfb128 | 799 | # define EVP_aes_192_cfb EVP_aes_192_cfb128 |
| 801 | const EVP_CIPHER *EVP_aes_192_ofb(void); | 800 | const EVP_CIPHER *EVP_aes_192_ofb(void); |
| 802 | const EVP_CIPHER *EVP_aes_192_ctr(void); | 801 | const EVP_CIPHER *EVP_aes_192_ctr(void); |
| 803 | const EVP_CIPHER *EVP_aes_192_gcm(void); | ||
| 804 | const EVP_CIPHER *EVP_aes_192_ccm(void); | 802 | const EVP_CIPHER *EVP_aes_192_ccm(void); |
| 803 | const EVP_CIPHER *EVP_aes_192_gcm(void); | ||
| 805 | const EVP_CIPHER *EVP_aes_256_ecb(void); | 804 | const EVP_CIPHER *EVP_aes_256_ecb(void); |
| 806 | const EVP_CIPHER *EVP_aes_256_cbc(void); | 805 | const EVP_CIPHER *EVP_aes_256_cbc(void); |
| 807 | const EVP_CIPHER *EVP_aes_256_cfb1(void); | 806 | const EVP_CIPHER *EVP_aes_256_cfb1(void); |
| @@ -810,8 +809,8 @@ const EVP_CIPHER *EVP_aes_256_cfb128(void); | |||
| 810 | # define EVP_aes_256_cfb EVP_aes_256_cfb128 | 809 | # define EVP_aes_256_cfb EVP_aes_256_cfb128 |
| 811 | const EVP_CIPHER *EVP_aes_256_ofb(void); | 810 | const EVP_CIPHER *EVP_aes_256_ofb(void); |
| 812 | const EVP_CIPHER *EVP_aes_256_ctr(void); | 811 | const EVP_CIPHER *EVP_aes_256_ctr(void); |
| 813 | const EVP_CIPHER *EVP_aes_256_gcm(void); | ||
| 814 | const EVP_CIPHER *EVP_aes_256_ccm(void); | 812 | const EVP_CIPHER *EVP_aes_256_ccm(void); |
| 813 | const EVP_CIPHER *EVP_aes_256_gcm(void); | ||
| 815 | const EVP_CIPHER *EVP_aes_256_xts(void); | 814 | const EVP_CIPHER *EVP_aes_256_xts(void); |
| 816 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) | 815 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) |
| 817 | const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); | 816 | const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); |
| @@ -1243,6 +1242,8 @@ void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, | |||
| 1243 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, | 1242 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, |
| 1244 | const char *type, const char *value)); | 1243 | const char *type, const char *value)); |
| 1245 | 1244 | ||
| 1245 | void EVP_add_alg_module(void); | ||
| 1246 | |||
| 1246 | /* BEGIN ERROR CODES */ | 1247 | /* BEGIN ERROR CODES */ |
| 1247 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 1248 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 1248 | * made after this point may be overwritten when the script is next run. | 1249 | * made after this point may be overwritten when the script is next run. |
| @@ -1257,6 +1258,7 @@ void ERR_load_EVP_strings(void); | |||
| 1257 | #define EVP_F_AES_INIT_KEY 133 | 1258 | #define EVP_F_AES_INIT_KEY 133 |
| 1258 | #define EVP_F_AES_XTS 172 | 1259 | #define EVP_F_AES_XTS 172 |
| 1259 | #define EVP_F_AES_XTS_CIPHER 175 | 1260 | #define EVP_F_AES_XTS_CIPHER 175 |
| 1261 | #define EVP_F_ALG_MODULE_INIT 177 | ||
| 1260 | #define EVP_F_CAMELLIA_INIT_KEY 159 | 1262 | #define EVP_F_CAMELLIA_INIT_KEY 159 |
| 1261 | #define EVP_F_CMAC_INIT 173 | 1263 | #define EVP_F_CMAC_INIT 173 |
| 1262 | #define EVP_F_D2I_PKEY 100 | 1264 | #define EVP_F_D2I_PKEY 100 |
| @@ -1350,15 +1352,19 @@ void ERR_load_EVP_strings(void); | |||
| 1350 | #define EVP_R_DIFFERENT_PARAMETERS 153 | 1352 | #define EVP_R_DIFFERENT_PARAMETERS 153 |
| 1351 | #define EVP_R_DISABLED_FOR_FIPS 163 | 1353 | #define EVP_R_DISABLED_FOR_FIPS 163 |
| 1352 | #define EVP_R_ENCODE_ERROR 115 | 1354 | #define EVP_R_ENCODE_ERROR 115 |
| 1355 | #define EVP_R_ERROR_LOADING_SECTION 165 | ||
| 1356 | #define EVP_R_ERROR_SETTING_FIPS_MODE 166 | ||
| 1353 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 | 1357 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 |
| 1354 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 | 1358 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 |
| 1355 | #define EVP_R_EXPECTING_A_DH_KEY 128 | 1359 | #define EVP_R_EXPECTING_A_DH_KEY 128 |
| 1356 | #define EVP_R_EXPECTING_A_DSA_KEY 129 | 1360 | #define EVP_R_EXPECTING_A_DSA_KEY 129 |
| 1357 | #define EVP_R_EXPECTING_A_ECDSA_KEY 141 | 1361 | #define EVP_R_EXPECTING_A_ECDSA_KEY 141 |
| 1358 | #define EVP_R_EXPECTING_A_EC_KEY 142 | 1362 | #define EVP_R_EXPECTING_A_EC_KEY 142 |
| 1363 | #define EVP_R_FIPS_MODE_NOT_SUPPORTED 167 | ||
| 1359 | #define EVP_R_INITIALIZATION_ERROR 134 | 1364 | #define EVP_R_INITIALIZATION_ERROR 134 |
| 1360 | #define EVP_R_INPUT_NOT_INITIALIZED 111 | 1365 | #define EVP_R_INPUT_NOT_INITIALIZED 111 |
| 1361 | #define EVP_R_INVALID_DIGEST 152 | 1366 | #define EVP_R_INVALID_DIGEST 152 |
| 1367 | #define EVP_R_INVALID_FIPS_MODE 168 | ||
| 1362 | #define EVP_R_INVALID_KEY_LENGTH 130 | 1368 | #define EVP_R_INVALID_KEY_LENGTH 130 |
| 1363 | #define EVP_R_INVALID_OPERATION 148 | 1369 | #define EVP_R_INVALID_OPERATION 148 |
| 1364 | #define EVP_R_IV_TOO_LARGE 102 | 1370 | #define EVP_R_IV_TOO_LARGE 102 |
| @@ -1383,6 +1389,7 @@ void ERR_load_EVP_strings(void); | |||
| 1383 | #define EVP_R_TOO_LARGE 164 | 1389 | #define EVP_R_TOO_LARGE 164 |
| 1384 | #define EVP_R_UNKNOWN_CIPHER 160 | 1390 | #define EVP_R_UNKNOWN_CIPHER 160 |
| 1385 | #define EVP_R_UNKNOWN_DIGEST 161 | 1391 | #define EVP_R_UNKNOWN_DIGEST 161 |
| 1392 | #define EVP_R_UNKNOWN_OPTION 169 | ||
| 1386 | #define EVP_R_UNKNOWN_PBE_ALGORITHM 121 | 1393 | #define EVP_R_UNKNOWN_PBE_ALGORITHM 121 |
| 1387 | #define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 | 1394 | #define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 |
| 1388 | #define EVP_R_UNSUPPORTED_ALGORITHM 156 | 1395 | #define EVP_R_UNSUPPORTED_ALGORITHM 156 |
diff --git a/src/lib/libssl/src/crypto/evp/evp_err.c b/src/lib/libssl/src/crypto/evp/evp_err.c index db0f76d59b..08eab9882f 100644 --- a/src/lib/libssl/src/crypto/evp/evp_err.c +++ b/src/lib/libssl/src/crypto/evp/evp_err.c | |||
| @@ -75,6 +75,7 @@ static ERR_STRING_DATA EVP_str_functs[]= | |||
| 75 | {ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, | 75 | {ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, |
| 76 | {ERR_FUNC(EVP_F_AES_XTS), "AES_XTS"}, | 76 | {ERR_FUNC(EVP_F_AES_XTS), "AES_XTS"}, |
| 77 | {ERR_FUNC(EVP_F_AES_XTS_CIPHER), "AES_XTS_CIPHER"}, | 77 | {ERR_FUNC(EVP_F_AES_XTS_CIPHER), "AES_XTS_CIPHER"}, |
| 78 | {ERR_FUNC(EVP_F_ALG_MODULE_INIT), "ALG_MODULE_INIT"}, | ||
| 78 | {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, | 79 | {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, |
| 79 | {ERR_FUNC(EVP_F_CMAC_INIT), "CMAC_INIT"}, | 80 | {ERR_FUNC(EVP_F_CMAC_INIT), "CMAC_INIT"}, |
| 80 | {ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, | 81 | {ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, |
| @@ -171,15 +172,19 @@ static ERR_STRING_DATA EVP_str_reasons[]= | |||
| 171 | {ERR_REASON(EVP_R_DIFFERENT_PARAMETERS) ,"different parameters"}, | 172 | {ERR_REASON(EVP_R_DIFFERENT_PARAMETERS) ,"different parameters"}, |
| 172 | {ERR_REASON(EVP_R_DISABLED_FOR_FIPS) ,"disabled for fips"}, | 173 | {ERR_REASON(EVP_R_DISABLED_FOR_FIPS) ,"disabled for fips"}, |
| 173 | {ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"}, | 174 | {ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"}, |
| 175 | {ERR_REASON(EVP_R_ERROR_LOADING_SECTION) ,"error loading section"}, | ||
| 176 | {ERR_REASON(EVP_R_ERROR_SETTING_FIPS_MODE),"error setting fips mode"}, | ||
| 174 | {ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"}, | 177 | {ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"}, |
| 175 | {ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"}, | 178 | {ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"}, |
| 176 | {ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"}, | 179 | {ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"}, |
| 177 | {ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"}, | 180 | {ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"}, |
| 178 | {ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"}, | 181 | {ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"}, |
| 179 | {ERR_REASON(EVP_R_EXPECTING_A_EC_KEY) ,"expecting a ec key"}, | 182 | {ERR_REASON(EVP_R_EXPECTING_A_EC_KEY) ,"expecting a ec key"}, |
| 183 | {ERR_REASON(EVP_R_FIPS_MODE_NOT_SUPPORTED),"fips mode not supported"}, | ||
| 180 | {ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"}, | 184 | {ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"}, |
| 181 | {ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"}, | 185 | {ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"}, |
| 182 | {ERR_REASON(EVP_R_INVALID_DIGEST) ,"invalid digest"}, | 186 | {ERR_REASON(EVP_R_INVALID_DIGEST) ,"invalid digest"}, |
| 187 | {ERR_REASON(EVP_R_INVALID_FIPS_MODE) ,"invalid fips mode"}, | ||
| 183 | {ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"}, | 188 | {ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"}, |
| 184 | {ERR_REASON(EVP_R_INVALID_OPERATION) ,"invalid operation"}, | 189 | {ERR_REASON(EVP_R_INVALID_OPERATION) ,"invalid operation"}, |
| 185 | {ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"}, | 190 | {ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"}, |
| @@ -204,6 +209,7 @@ static ERR_STRING_DATA EVP_str_reasons[]= | |||
| 204 | {ERR_REASON(EVP_R_TOO_LARGE) ,"too large"}, | 209 | {ERR_REASON(EVP_R_TOO_LARGE) ,"too large"}, |
| 205 | {ERR_REASON(EVP_R_UNKNOWN_CIPHER) ,"unknown cipher"}, | 210 | {ERR_REASON(EVP_R_UNKNOWN_CIPHER) ,"unknown cipher"}, |
| 206 | {ERR_REASON(EVP_R_UNKNOWN_DIGEST) ,"unknown digest"}, | 211 | {ERR_REASON(EVP_R_UNKNOWN_DIGEST) ,"unknown digest"}, |
| 212 | {ERR_REASON(EVP_R_UNKNOWN_OPTION) ,"unknown option"}, | ||
| 207 | {ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, | 213 | {ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, |
| 208 | {ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, | 214 | {ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, |
| 209 | {ERR_REASON(EVP_R_UNSUPPORTED_ALGORITHM) ,"unsupported algorithm"}, | 215 | {ERR_REASON(EVP_R_UNSUPPORTED_ALGORITHM) ,"unsupported algorithm"}, |
diff --git a/src/lib/libssl/src/crypto/evp/m_dss.c b/src/lib/libssl/src/crypto/evp/m_dss.c index 4ad63ada6f..6fb7e9a861 100644 --- a/src/lib/libssl/src/crypto/evp/m_dss.c +++ b/src/lib/libssl/src/crypto/evp/m_dss.c | |||
| @@ -60,7 +60,7 @@ | |||
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 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/sha.h> |
| 64 | #ifndef OPENSSL_NO_DSA | 64 | #ifndef OPENSSL_NO_DSA |
| 65 | #include <openssl/dsa.h> | 65 | #include <openssl/dsa.h> |
| 66 | #endif | 66 | #endif |
diff --git a/src/lib/libssl/src/crypto/evp/m_dss1.c b/src/lib/libssl/src/crypto/evp/m_dss1.c index f80170efeb..2df362a670 100644 --- a/src/lib/libssl/src/crypto/evp/m_dss1.c +++ b/src/lib/libssl/src/crypto/evp/m_dss1.c | |||
| @@ -63,7 +63,7 @@ | |||
| 63 | 63 | ||
| 64 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 65 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 66 | #include <openssl/x509.h> | 66 | #include <openssl/sha.h> |
| 67 | #ifndef OPENSSL_NO_DSA | 67 | #ifndef OPENSSL_NO_DSA |
| 68 | #include <openssl/dsa.h> | 68 | #include <openssl/dsa.h> |
| 69 | #endif | 69 | #endif |
diff --git a/src/lib/libssl/src/crypto/evp/m_sha1.c b/src/lib/libssl/src/crypto/evp/m_sha1.c index 3cb11f1ebb..bd0c01ad3c 100644 --- a/src/lib/libssl/src/crypto/evp/m_sha1.c +++ b/src/lib/libssl/src/crypto/evp/m_sha1.c | |||
| @@ -65,7 +65,7 @@ | |||
| 65 | 65 | ||
| 66 | #include <openssl/evp.h> | 66 | #include <openssl/evp.h> |
| 67 | #include <openssl/objects.h> | 67 | #include <openssl/objects.h> |
| 68 | #include <openssl/x509.h> | 68 | #include <openssl/sha.h> |
| 69 | #ifndef OPENSSL_NO_RSA | 69 | #ifndef OPENSSL_NO_RSA |
| 70 | #include <openssl/rsa.h> | 70 | #include <openssl/rsa.h> |
| 71 | #endif | 71 | #endif |
diff --git a/src/lib/libssl/src/crypto/evp/p5_crpt2.c b/src/lib/libssl/src/crypto/evp/p5_crpt2.c index 975d004df4..fe3c6c8813 100644 --- a/src/lib/libssl/src/crypto/evp/p5_crpt2.c +++ b/src/lib/libssl/src/crypto/evp/p5_crpt2.c | |||
| @@ -85,19 +85,24 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, | |||
| 85 | unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4]; | 85 | unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4]; |
| 86 | int cplen, j, k, tkeylen, mdlen; | 86 | int cplen, j, k, tkeylen, mdlen; |
| 87 | unsigned long i = 1; | 87 | unsigned long i = 1; |
| 88 | HMAC_CTX hctx; | 88 | HMAC_CTX hctx_tpl, hctx; |
| 89 | 89 | ||
| 90 | mdlen = EVP_MD_size(digest); | 90 | mdlen = EVP_MD_size(digest); |
| 91 | if (mdlen < 0) | 91 | if (mdlen < 0) |
| 92 | return 0; | 92 | return 0; |
| 93 | 93 | ||
| 94 | HMAC_CTX_init(&hctx); | 94 | HMAC_CTX_init(&hctx_tpl); |
| 95 | p = out; | 95 | p = out; |
| 96 | tkeylen = keylen; | 96 | tkeylen = keylen; |
| 97 | if(!pass) | 97 | if(!pass) |
| 98 | passlen = 0; | 98 | passlen = 0; |
| 99 | else if(passlen == -1) | 99 | else if(passlen == -1) |
| 100 | passlen = strlen(pass); | 100 | passlen = strlen(pass); |
| 101 | if (!HMAC_Init_ex(&hctx_tpl, pass, passlen, digest, NULL)) | ||
| 102 | { | ||
| 103 | HMAC_CTX_cleanup(&hctx_tpl); | ||
| 104 | return 0; | ||
| 105 | } | ||
| 101 | while(tkeylen) | 106 | while(tkeylen) |
| 102 | { | 107 | { |
| 103 | if(tkeylen > mdlen) | 108 | if(tkeylen > mdlen) |
| @@ -111,19 +116,36 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, | |||
| 111 | itmp[1] = (unsigned char)((i >> 16) & 0xff); | 116 | itmp[1] = (unsigned char)((i >> 16) & 0xff); |
| 112 | itmp[2] = (unsigned char)((i >> 8) & 0xff); | 117 | itmp[2] = (unsigned char)((i >> 8) & 0xff); |
| 113 | itmp[3] = (unsigned char)(i & 0xff); | 118 | itmp[3] = (unsigned char)(i & 0xff); |
| 114 | if (!HMAC_Init_ex(&hctx, pass, passlen, digest, NULL) | 119 | if (!HMAC_CTX_copy(&hctx, &hctx_tpl)) |
| 115 | || !HMAC_Update(&hctx, salt, saltlen) | ||
| 116 | || !HMAC_Update(&hctx, itmp, 4) | ||
| 117 | || !HMAC_Final(&hctx, digtmp, NULL)) | ||
| 118 | { | 120 | { |
| 121 | HMAC_CTX_cleanup(&hctx_tpl); | ||
| 122 | return 0; | ||
| 123 | } | ||
| 124 | if (!HMAC_Update(&hctx, salt, saltlen) | ||
| 125 | || !HMAC_Update(&hctx, itmp, 4) | ||
| 126 | || !HMAC_Final(&hctx, digtmp, NULL)) | ||
| 127 | { | ||
| 128 | HMAC_CTX_cleanup(&hctx_tpl); | ||
| 119 | HMAC_CTX_cleanup(&hctx); | 129 | HMAC_CTX_cleanup(&hctx); |
| 120 | return 0; | 130 | return 0; |
| 121 | } | 131 | } |
| 132 | HMAC_CTX_cleanup(&hctx); | ||
| 122 | memcpy(p, digtmp, cplen); | 133 | memcpy(p, digtmp, cplen); |
| 123 | for(j = 1; j < iter; j++) | 134 | for(j = 1; j < iter; j++) |
| 124 | { | 135 | { |
| 125 | HMAC(digest, pass, passlen, | 136 | if (!HMAC_CTX_copy(&hctx, &hctx_tpl)) |
| 126 | digtmp, mdlen, digtmp, NULL); | 137 | { |
| 138 | HMAC_CTX_cleanup(&hctx_tpl); | ||
| 139 | return 0; | ||
| 140 | } | ||
| 141 | if (!HMAC_Update(&hctx, digtmp, mdlen) | ||
| 142 | || !HMAC_Final(&hctx, digtmp, NULL)) | ||
| 143 | { | ||
| 144 | HMAC_CTX_cleanup(&hctx_tpl); | ||
| 145 | HMAC_CTX_cleanup(&hctx); | ||
| 146 | return 0; | ||
| 147 | } | ||
| 148 | HMAC_CTX_cleanup(&hctx); | ||
| 127 | for(k = 0; k < cplen; k++) | 149 | for(k = 0; k < cplen; k++) |
| 128 | p[k] ^= digtmp[k]; | 150 | p[k] ^= digtmp[k]; |
| 129 | } | 151 | } |
| @@ -131,7 +153,7 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, | |||
| 131 | i++; | 153 | i++; |
| 132 | p+= cplen; | 154 | p+= cplen; |
| 133 | } | 155 | } |
| 134 | HMAC_CTX_cleanup(&hctx); | 156 | HMAC_CTX_cleanup(&hctx_tpl); |
| 135 | #ifdef DEBUG_PKCS5V2 | 157 | #ifdef DEBUG_PKCS5V2 |
| 136 | fprintf(stderr, "Password:\n"); | 158 | fprintf(stderr, "Password:\n"); |
| 137 | h__dump (pass, passlen); | 159 | h__dump (pass, passlen); |
diff --git a/src/lib/libssl/src/crypto/evp/p_sign.c b/src/lib/libssl/src/crypto/evp/p_sign.c index dfa48c157c..8afb664306 100644 --- a/src/lib/libssl/src/crypto/evp/p_sign.c +++ b/src/lib/libssl/src/crypto/evp/p_sign.c | |||
| @@ -80,7 +80,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, | |||
| 80 | { | 80 | { |
| 81 | unsigned char m[EVP_MAX_MD_SIZE]; | 81 | unsigned char m[EVP_MAX_MD_SIZE]; |
| 82 | unsigned int m_len; | 82 | unsigned int m_len; |
| 83 | int i=0,ok=0,v; | 83 | int i = 0,ok = 0,v; |
| 84 | EVP_MD_CTX tmp_ctx; | 84 | EVP_MD_CTX tmp_ctx; |
| 85 | EVP_PKEY_CTX *pkctx = NULL; | 85 | EVP_PKEY_CTX *pkctx = NULL; |
| 86 | 86 | ||
diff --git a/src/lib/libssl/src/crypto/evp/p_verify.c b/src/lib/libssl/src/crypto/evp/p_verify.c index 5f5c409f45..c66d63ccf8 100644 --- a/src/lib/libssl/src/crypto/evp/p_verify.c +++ b/src/lib/libssl/src/crypto/evp/p_verify.c | |||
| @@ -67,7 +67,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, | |||
| 67 | { | 67 | { |
| 68 | unsigned char m[EVP_MAX_MD_SIZE]; | 68 | unsigned char m[EVP_MAX_MD_SIZE]; |
| 69 | unsigned int m_len; | 69 | unsigned int m_len; |
| 70 | int i=-1,ok=0,v; | 70 | int i = 0,ok = 0,v; |
| 71 | EVP_MD_CTX tmp_ctx; | 71 | EVP_MD_CTX tmp_ctx; |
| 72 | EVP_PKEY_CTX *pkctx = NULL; | 72 | EVP_PKEY_CTX *pkctx = NULL; |
| 73 | 73 | ||
diff --git a/src/lib/libssl/src/crypto/md4/md4_dgst.c b/src/lib/libssl/src/crypto/md4/md4_dgst.c index 82c2cb2d98..b5b165b052 100644 --- a/src/lib/libssl/src/crypto/md4/md4_dgst.c +++ b/src/lib/libssl/src/crypto/md4/md4_dgst.c | |||
| @@ -106,22 +106,23 @@ void md4_block_data_order (MD4_CTX *c, const void *data_, size_t num) | |||
| 106 | 106 | ||
| 107 | for (;num--;) | 107 | for (;num--;) |
| 108 | { | 108 | { |
| 109 | HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; | 109 | (void)HOST_c2l(data,l); X( 0)=l; |
| 110 | (void)HOST_c2l(data,l); X( 1)=l; | ||
| 110 | /* Round 0 */ | 111 | /* Round 0 */ |
| 111 | R0(A,B,C,D,X( 0), 3,0); HOST_c2l(data,l); X( 2)=l; | 112 | R0(A,B,C,D,X( 0), 3,0); (void)HOST_c2l(data,l); X( 2)=l; |
| 112 | R0(D,A,B,C,X( 1), 7,0); HOST_c2l(data,l); X( 3)=l; | 113 | R0(D,A,B,C,X( 1), 7,0); (void)HOST_c2l(data,l); X( 3)=l; |
| 113 | R0(C,D,A,B,X( 2),11,0); HOST_c2l(data,l); X( 4)=l; | 114 | R0(C,D,A,B,X( 2),11,0); (void)HOST_c2l(data,l); X( 4)=l; |
| 114 | R0(B,C,D,A,X( 3),19,0); HOST_c2l(data,l); X( 5)=l; | 115 | R0(B,C,D,A,X( 3),19,0); (void)HOST_c2l(data,l); X( 5)=l; |
| 115 | R0(A,B,C,D,X( 4), 3,0); HOST_c2l(data,l); X( 6)=l; | 116 | R0(A,B,C,D,X( 4), 3,0); (void)HOST_c2l(data,l); X( 6)=l; |
| 116 | R0(D,A,B,C,X( 5), 7,0); HOST_c2l(data,l); X( 7)=l; | 117 | R0(D,A,B,C,X( 5), 7,0); (void)HOST_c2l(data,l); X( 7)=l; |
| 117 | R0(C,D,A,B,X( 6),11,0); HOST_c2l(data,l); X( 8)=l; | 118 | R0(C,D,A,B,X( 6),11,0); (void)HOST_c2l(data,l); X( 8)=l; |
| 118 | R0(B,C,D,A,X( 7),19,0); HOST_c2l(data,l); X( 9)=l; | 119 | R0(B,C,D,A,X( 7),19,0); (void)HOST_c2l(data,l); X( 9)=l; |
| 119 | R0(A,B,C,D,X( 8), 3,0); HOST_c2l(data,l); X(10)=l; | 120 | R0(A,B,C,D,X( 8), 3,0); (void)HOST_c2l(data,l); X(10)=l; |
| 120 | R0(D,A,B,C,X( 9), 7,0); HOST_c2l(data,l); X(11)=l; | 121 | R0(D,A,B,C,X( 9), 7,0); (void)HOST_c2l(data,l); X(11)=l; |
| 121 | R0(C,D,A,B,X(10),11,0); HOST_c2l(data,l); X(12)=l; | 122 | R0(C,D,A,B,X(10),11,0); (void)HOST_c2l(data,l); X(12)=l; |
| 122 | R0(B,C,D,A,X(11),19,0); HOST_c2l(data,l); X(13)=l; | 123 | R0(B,C,D,A,X(11),19,0); (void)HOST_c2l(data,l); X(13)=l; |
| 123 | R0(A,B,C,D,X(12), 3,0); HOST_c2l(data,l); X(14)=l; | 124 | R0(A,B,C,D,X(12), 3,0); (void)HOST_c2l(data,l); X(14)=l; |
| 124 | R0(D,A,B,C,X(13), 7,0); HOST_c2l(data,l); X(15)=l; | 125 | R0(D,A,B,C,X(13), 7,0); (void)HOST_c2l(data,l); X(15)=l; |
| 125 | R0(C,D,A,B,X(14),11,0); | 126 | R0(C,D,A,B,X(14),11,0); |
| 126 | R0(B,C,D,A,X(15),19,0); | 127 | R0(B,C,D,A,X(15),19,0); |
| 127 | /* Round 1 */ | 128 | /* Round 1 */ |
diff --git a/src/lib/libssl/src/crypto/md4/md4_locl.h b/src/lib/libssl/src/crypto/md4/md4_locl.h index c8085b0ead..99c3e5004c 100644 --- a/src/lib/libssl/src/crypto/md4/md4_locl.h +++ b/src/lib/libssl/src/crypto/md4/md4_locl.h | |||
| @@ -77,10 +77,10 @@ void md4_block_data_order (MD4_CTX *c, const void *p,size_t num); | |||
| 77 | #define HASH_FINAL MD4_Final | 77 | #define HASH_FINAL MD4_Final |
| 78 | #define HASH_MAKE_STRING(c,s) do { \ | 78 | #define HASH_MAKE_STRING(c,s) do { \ |
| 79 | unsigned long ll; \ | 79 | unsigned long ll; \ |
| 80 | ll=(c)->A; HOST_l2c(ll,(s)); \ | 80 | ll=(c)->A; (void)HOST_l2c(ll,(s)); \ |
| 81 | ll=(c)->B; HOST_l2c(ll,(s)); \ | 81 | ll=(c)->B; (void)HOST_l2c(ll,(s)); \ |
| 82 | ll=(c)->C; HOST_l2c(ll,(s)); \ | 82 | ll=(c)->C; (void)HOST_l2c(ll,(s)); \ |
| 83 | ll=(c)->D; HOST_l2c(ll,(s)); \ | 83 | ll=(c)->D; (void)HOST_l2c(ll,(s)); \ |
| 84 | } while (0) | 84 | } while (0) |
| 85 | #define HASH_BLOCK_DATA_ORDER md4_block_data_order | 85 | #define HASH_BLOCK_DATA_ORDER md4_block_data_order |
| 86 | 86 | ||
diff --git a/src/lib/libssl/src/crypto/md5/md5_locl.h b/src/lib/libssl/src/crypto/md5/md5_locl.h index 968d577995..74d63d1f9c 100644 --- a/src/lib/libssl/src/crypto/md5/md5_locl.h +++ b/src/lib/libssl/src/crypto/md5/md5_locl.h | |||
| @@ -86,10 +86,10 @@ void md5_block_data_order (MD5_CTX *c, const void *p,size_t num); | |||
| 86 | #define HASH_FINAL MD5_Final | 86 | #define HASH_FINAL MD5_Final |
| 87 | #define HASH_MAKE_STRING(c,s) do { \ | 87 | #define HASH_MAKE_STRING(c,s) do { \ |
| 88 | unsigned long ll; \ | 88 | unsigned long ll; \ |
| 89 | ll=(c)->A; HOST_l2c(ll,(s)); \ | 89 | ll=(c)->A; (void)HOST_l2c(ll,(s)); \ |
| 90 | ll=(c)->B; HOST_l2c(ll,(s)); \ | 90 | ll=(c)->B; (void)HOST_l2c(ll,(s)); \ |
| 91 | ll=(c)->C; HOST_l2c(ll,(s)); \ | 91 | ll=(c)->C; (void)HOST_l2c(ll,(s)); \ |
| 92 | ll=(c)->D; HOST_l2c(ll,(s)); \ | 92 | ll=(c)->D; (void)HOST_l2c(ll,(s)); \ |
| 93 | } while (0) | 93 | } while (0) |
| 94 | #define HASH_BLOCK_DATA_ORDER md5_block_data_order | 94 | #define HASH_BLOCK_DATA_ORDER md5_block_data_order |
| 95 | 95 | ||
diff --git a/src/lib/libssl/src/crypto/mem.c b/src/lib/libssl/src/crypto/mem.c index 21c0011380..1cc62eafd1 100644 --- a/src/lib/libssl/src/crypto/mem.c +++ b/src/lib/libssl/src/crypto/mem.c | |||
| @@ -121,10 +121,10 @@ static void (*set_debug_options_func)(long) = NULL; | |||
| 121 | static long (*get_debug_options_func)(void) = NULL; | 121 | static long (*get_debug_options_func)(void) = NULL; |
| 122 | #endif | 122 | #endif |
| 123 | 123 | ||
| 124 | |||
| 125 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), | 124 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), |
| 126 | void (*f)(void *)) | 125 | void (*f)(void *)) |
| 127 | { | 126 | { |
| 127 | /* Dummy call just to ensure OPENSSL_init() gets linked in */ | ||
| 128 | OPENSSL_init(); | 128 | OPENSSL_init(); |
| 129 | if (!allow_customize) | 129 | if (!allow_customize) |
| 130 | return 0; | 130 | return 0; |
diff --git a/src/lib/libssl/src/crypto/objects/o_names.c b/src/lib/libssl/src/crypto/objects/o_names.c index 84380a96a9..4a548c2ed4 100644 --- a/src/lib/libssl/src/crypto/objects/o_names.c +++ b/src/lib/libssl/src/crypto/objects/o_names.c | |||
| @@ -73,7 +73,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), | |||
| 73 | name_funcs_stack=sk_NAME_FUNCS_new_null(); | 73 | name_funcs_stack=sk_NAME_FUNCS_new_null(); |
| 74 | MemCheck_on(); | 74 | MemCheck_on(); |
| 75 | } | 75 | } |
| 76 | if ((name_funcs_stack == NULL)) | 76 | if (name_funcs_stack == NULL) |
| 77 | { | 77 | { |
| 78 | /* ERROR */ | 78 | /* ERROR */ |
| 79 | return(0); | 79 | return(0); |
diff --git a/src/lib/libssl/src/crypto/ocsp/ocsp_vfy.c b/src/lib/libssl/src/crypto/ocsp/ocsp_vfy.c index 415d67e61c..276718304d 100644 --- a/src/lib/libssl/src/crypto/ocsp/ocsp_vfy.c +++ b/src/lib/libssl/src/crypto/ocsp/ocsp_vfy.c | |||
| @@ -91,9 +91,12 @@ int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, | |||
| 91 | { | 91 | { |
| 92 | EVP_PKEY *skey; | 92 | EVP_PKEY *skey; |
| 93 | skey = X509_get_pubkey(signer); | 93 | skey = X509_get_pubkey(signer); |
| 94 | ret = OCSP_BASICRESP_verify(bs, skey, 0); | 94 | if (skey) |
| 95 | EVP_PKEY_free(skey); | 95 | { |
| 96 | if(ret <= 0) | 96 | ret = OCSP_BASICRESP_verify(bs, skey, 0); |
| 97 | EVP_PKEY_free(skey); | ||
| 98 | } | ||
| 99 | if(!skey || ret <= 0) | ||
| 97 | { | 100 | { |
| 98 | OCSPerr(OCSP_F_OCSP_BASIC_VERIFY, OCSP_R_SIGNATURE_FAILURE); | 101 | OCSPerr(OCSP_F_OCSP_BASIC_VERIFY, OCSP_R_SIGNATURE_FAILURE); |
| 99 | goto end; | 102 | goto end; |
| @@ -108,6 +111,7 @@ int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, | |||
| 108 | init_res = X509_STORE_CTX_init(&ctx, st, signer, bs->certs); | 111 | init_res = X509_STORE_CTX_init(&ctx, st, signer, bs->certs); |
| 109 | if(!init_res) | 112 | if(!init_res) |
| 110 | { | 113 | { |
| 114 | ret = -1; | ||
| 111 | OCSPerr(OCSP_F_OCSP_BASIC_VERIFY,ERR_R_X509_LIB); | 115 | OCSPerr(OCSP_F_OCSP_BASIC_VERIFY,ERR_R_X509_LIB); |
| 112 | goto end; | 116 | goto end; |
| 113 | } | 117 | } |
diff --git a/src/lib/libssl/src/crypto/opensslv.h b/src/lib/libssl/src/crypto/opensslv.h index 71be3590af..ebe7180723 100644 --- a/src/lib/libssl/src/crypto/opensslv.h +++ b/src/lib/libssl/src/crypto/opensslv.h | |||
| @@ -25,11 +25,11 @@ | |||
| 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 0x1000103fL | 28 | #define OPENSSL_VERSION_NUMBER 0x1000107fL |
| 29 | #ifdef OPENSSL_FIPS | 29 | #ifdef OPENSSL_FIPS |
| 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c-fips 10 May 2012" | 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1g-fips 7 Apr 2014" |
| 31 | #else | 31 | #else |
| 32 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c 10 May 2012" | 32 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1g 7 Apr 2014" |
| 33 | #endif | 33 | #endif |
| 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT | 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT |
| 35 | 35 | ||
diff --git a/src/lib/libssl/src/crypto/pem/pem_all.c b/src/lib/libssl/src/crypto/pem/pem_all.c index 3e7a6093ad..eac0460e3e 100644 --- a/src/lib/libssl/src/crypto/pem/pem_all.c +++ b/src/lib/libssl/src/crypto/pem/pem_all.c | |||
| @@ -193,7 +193,61 @@ RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb, | |||
| 193 | 193 | ||
| 194 | #endif | 194 | #endif |
| 195 | 195 | ||
| 196 | #ifdef OPENSSL_FIPS | ||
| 197 | |||
| 198 | int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, | ||
| 199 | unsigned char *kstr, int klen, | ||
| 200 | pem_password_cb *cb, void *u) | ||
| 201 | { | ||
| 202 | if (FIPS_mode()) | ||
| 203 | { | ||
| 204 | EVP_PKEY *k; | ||
| 205 | int ret; | ||
| 206 | k = EVP_PKEY_new(); | ||
| 207 | if (!k) | ||
| 208 | return 0; | ||
| 209 | EVP_PKEY_set1_RSA(k, x); | ||
| 210 | |||
| 211 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
| 212 | EVP_PKEY_free(k); | ||
| 213 | return ret; | ||
| 214 | } | ||
| 215 | else | ||
| 216 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPrivateKey, | ||
| 217 | PEM_STRING_RSA,bp,x,enc,kstr,klen,cb,u); | ||
| 218 | } | ||
| 219 | |||
| 220 | #ifndef OPENSSL_NO_FP_API | ||
| 221 | int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, | ||
| 222 | unsigned char *kstr, int klen, | ||
| 223 | pem_password_cb *cb, void *u) | ||
| 224 | { | ||
| 225 | if (FIPS_mode()) | ||
| 226 | { | ||
| 227 | EVP_PKEY *k; | ||
| 228 | int ret; | ||
| 229 | k = EVP_PKEY_new(); | ||
| 230 | if (!k) | ||
| 231 | return 0; | ||
| 232 | |||
| 233 | EVP_PKEY_set1_RSA(k, x); | ||
| 234 | |||
| 235 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
| 236 | EVP_PKEY_free(k); | ||
| 237 | return ret; | ||
| 238 | } | ||
| 239 | else | ||
| 240 | return PEM_ASN1_write((i2d_of_void *)i2d_RSAPrivateKey, | ||
| 241 | PEM_STRING_RSA,fp,x,enc,kstr,klen,cb,u); | ||
| 242 | } | ||
| 243 | #endif | ||
| 244 | |||
| 245 | #else | ||
| 246 | |||
| 196 | IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) | 247 | IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) |
| 248 | |||
| 249 | #endif | ||
| 250 | |||
| 197 | IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) | 251 | IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) |
| 198 | IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) | 252 | IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) |
| 199 | 253 | ||
| @@ -223,7 +277,59 @@ DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb, | |||
| 223 | return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ | 277 | return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ |
| 224 | } | 278 | } |
| 225 | 279 | ||
| 280 | #ifdef OPENSSL_FIPS | ||
| 281 | |||
| 282 | int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, | ||
| 283 | unsigned char *kstr, int klen, | ||
| 284 | pem_password_cb *cb, void *u) | ||
| 285 | { | ||
| 286 | if (FIPS_mode()) | ||
| 287 | { | ||
| 288 | EVP_PKEY *k; | ||
| 289 | int ret; | ||
| 290 | k = EVP_PKEY_new(); | ||
| 291 | if (!k) | ||
| 292 | return 0; | ||
| 293 | EVP_PKEY_set1_DSA(k, x); | ||
| 294 | |||
| 295 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
| 296 | EVP_PKEY_free(k); | ||
| 297 | return ret; | ||
| 298 | } | ||
| 299 | else | ||
| 300 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAPrivateKey, | ||
| 301 | PEM_STRING_DSA,bp,x,enc,kstr,klen,cb,u); | ||
| 302 | } | ||
| 303 | |||
| 304 | #ifndef OPENSSL_NO_FP_API | ||
| 305 | int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, | ||
| 306 | unsigned char *kstr, int klen, | ||
| 307 | pem_password_cb *cb, void *u) | ||
| 308 | { | ||
| 309 | if (FIPS_mode()) | ||
| 310 | { | ||
| 311 | EVP_PKEY *k; | ||
| 312 | int ret; | ||
| 313 | k = EVP_PKEY_new(); | ||
| 314 | if (!k) | ||
| 315 | return 0; | ||
| 316 | EVP_PKEY_set1_DSA(k, x); | ||
| 317 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
| 318 | EVP_PKEY_free(k); | ||
| 319 | return ret; | ||
| 320 | } | ||
| 321 | else | ||
| 322 | return PEM_ASN1_write((i2d_of_void *)i2d_DSAPrivateKey, | ||
| 323 | PEM_STRING_DSA,fp,x,enc,kstr,klen,cb,u); | ||
| 324 | } | ||
| 325 | #endif | ||
| 326 | |||
| 327 | #else | ||
| 328 | |||
| 226 | IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) | 329 | IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) |
| 330 | |||
| 331 | #endif | ||
| 332 | |||
| 227 | IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) | 333 | IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) |
| 228 | 334 | ||
| 229 | #ifndef OPENSSL_NO_FP_API | 335 | #ifndef OPENSSL_NO_FP_API |
| @@ -269,8 +375,63 @@ EC_KEY *PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **key, pem_password_cb *cb, | |||
| 269 | 375 | ||
| 270 | IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters) | 376 | IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters) |
| 271 | 377 | ||
| 378 | |||
| 379 | |||
| 380 | #ifdef OPENSSL_FIPS | ||
| 381 | |||
| 382 | int PEM_write_bio_ECPrivateKey(BIO *bp, EC_KEY *x, const EVP_CIPHER *enc, | ||
| 383 | unsigned char *kstr, int klen, | ||
| 384 | pem_password_cb *cb, void *u) | ||
| 385 | { | ||
| 386 | if (FIPS_mode()) | ||
| 387 | { | ||
| 388 | EVP_PKEY *k; | ||
| 389 | int ret; | ||
| 390 | k = EVP_PKEY_new(); | ||
| 391 | if (!k) | ||
| 392 | return 0; | ||
| 393 | EVP_PKEY_set1_EC_KEY(k, x); | ||
| 394 | |||
| 395 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
| 396 | EVP_PKEY_free(k); | ||
| 397 | return ret; | ||
| 398 | } | ||
| 399 | else | ||
| 400 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPrivateKey, | ||
| 401 | PEM_STRING_ECPRIVATEKEY, | ||
| 402 | bp,x,enc,kstr,klen,cb,u); | ||
| 403 | } | ||
| 404 | |||
| 405 | #ifndef OPENSSL_NO_FP_API | ||
| 406 | int PEM_write_ECPrivateKey(FILE *fp, EC_KEY *x, const EVP_CIPHER *enc, | ||
| 407 | unsigned char *kstr, int klen, | ||
| 408 | pem_password_cb *cb, void *u) | ||
| 409 | { | ||
| 410 | if (FIPS_mode()) | ||
| 411 | { | ||
| 412 | EVP_PKEY *k; | ||
| 413 | int ret; | ||
| 414 | k = EVP_PKEY_new(); | ||
| 415 | if (!k) | ||
| 416 | return 0; | ||
| 417 | EVP_PKEY_set1_EC_KEY(k, x); | ||
| 418 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
| 419 | EVP_PKEY_free(k); | ||
| 420 | return ret; | ||
| 421 | } | ||
| 422 | else | ||
| 423 | return PEM_ASN1_write((i2d_of_void *)i2d_ECPrivateKey, | ||
| 424 | PEM_STRING_ECPRIVATEKEY, | ||
| 425 | fp,x,enc,kstr,klen,cb,u); | ||
| 426 | } | ||
| 427 | #endif | ||
| 428 | |||
| 429 | #else | ||
| 430 | |||
| 272 | IMPLEMENT_PEM_write_cb(ECPrivateKey, EC_KEY, PEM_STRING_ECPRIVATEKEY, ECPrivateKey) | 431 | IMPLEMENT_PEM_write_cb(ECPrivateKey, EC_KEY, PEM_STRING_ECPRIVATEKEY, ECPrivateKey) |
| 273 | 432 | ||
| 433 | #endif | ||
| 434 | |||
| 274 | IMPLEMENT_PEM_rw(EC_PUBKEY, EC_KEY, PEM_STRING_PUBLIC, EC_PUBKEY) | 435 | IMPLEMENT_PEM_rw(EC_PUBKEY, EC_KEY, PEM_STRING_PUBLIC, EC_PUBKEY) |
| 275 | 436 | ||
| 276 | #ifndef OPENSSL_NO_FP_API | 437 | #ifndef OPENSSL_NO_FP_API |
diff --git a/src/lib/libssl/src/crypto/pem/pem_info.c b/src/lib/libssl/src/crypto/pem/pem_info.c index 1b2be527ed..cc7f24a9c1 100644 --- a/src/lib/libssl/src/crypto/pem/pem_info.c +++ b/src/lib/libssl/src/crypto/pem/pem_info.c | |||
| @@ -167,6 +167,7 @@ start: | |||
| 167 | #ifndef OPENSSL_NO_RSA | 167 | #ifndef OPENSSL_NO_RSA |
| 168 | if (strcmp(name,PEM_STRING_RSA) == 0) | 168 | if (strcmp(name,PEM_STRING_RSA) == 0) |
| 169 | { | 169 | { |
| 170 | d2i=(D2I_OF(void))d2i_RSAPrivateKey; | ||
| 170 | if (xi->x_pkey != NULL) | 171 | if (xi->x_pkey != NULL) |
| 171 | { | 172 | { |
| 172 | if (!sk_X509_INFO_push(ret,xi)) goto err; | 173 | if (!sk_X509_INFO_push(ret,xi)) goto err; |
diff --git a/src/lib/libssl/src/crypto/pem/pem_lib.c b/src/lib/libssl/src/crypto/pem/pem_lib.c index cfc89a9921..5a421fc4b6 100644 --- a/src/lib/libssl/src/crypto/pem/pem_lib.c +++ b/src/lib/libssl/src/crypto/pem/pem_lib.c | |||
| @@ -394,7 +394,8 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, | |||
| 394 | goto err; | 394 | goto err; |
| 395 | /* The 'iv' is used as the iv and as a salt. It is | 395 | /* The 'iv' is used as the iv and as a salt. It is |
| 396 | * NOT taken from the BytesToKey function */ | 396 | * NOT taken from the BytesToKey function */ |
| 397 | EVP_BytesToKey(enc,EVP_md5(),iv,kstr,klen,1,key,NULL); | 397 | if (!EVP_BytesToKey(enc,EVP_md5(),iv,kstr,klen,1,key,NULL)) |
| 398 | goto err; | ||
| 398 | 399 | ||
| 399 | if (kstr == (unsigned char *)buf) OPENSSL_cleanse(buf,PEM_BUFSIZE); | 400 | if (kstr == (unsigned char *)buf) OPENSSL_cleanse(buf,PEM_BUFSIZE); |
| 400 | 401 | ||
| @@ -406,12 +407,15 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, | |||
| 406 | /* k=strlen(buf); */ | 407 | /* k=strlen(buf); */ |
| 407 | 408 | ||
| 408 | EVP_CIPHER_CTX_init(&ctx); | 409 | EVP_CIPHER_CTX_init(&ctx); |
| 409 | EVP_EncryptInit_ex(&ctx,enc,NULL,key,iv); | 410 | ret = 1; |
| 410 | EVP_EncryptUpdate(&ctx,data,&j,data,i); | 411 | if (!EVP_EncryptInit_ex(&ctx,enc,NULL,key,iv) |
| 411 | EVP_EncryptFinal_ex(&ctx,&(data[j]),&i); | 412 | || !EVP_EncryptUpdate(&ctx,data,&j,data,i) |
| 413 | || !EVP_EncryptFinal_ex(&ctx,&(data[j]),&i)) | ||
| 414 | ret = 0; | ||
| 412 | EVP_CIPHER_CTX_cleanup(&ctx); | 415 | EVP_CIPHER_CTX_cleanup(&ctx); |
| 416 | if (ret == 0) | ||
| 417 | goto err; | ||
| 413 | i+=j; | 418 | i+=j; |
| 414 | ret=1; | ||
| 415 | } | 419 | } |
| 416 | else | 420 | else |
| 417 | { | 421 | { |
| @@ -459,14 +463,17 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen, | |||
| 459 | ebcdic2ascii(buf, buf, klen); | 463 | ebcdic2ascii(buf, buf, klen); |
| 460 | #endif | 464 | #endif |
| 461 | 465 | ||
| 462 | EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]), | 466 | if (!EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]), |
| 463 | (unsigned char *)buf,klen,1,key,NULL); | 467 | (unsigned char *)buf,klen,1,key,NULL)) |
| 468 | return 0; | ||
| 464 | 469 | ||
| 465 | j=(int)len; | 470 | j=(int)len; |
| 466 | EVP_CIPHER_CTX_init(&ctx); | 471 | EVP_CIPHER_CTX_init(&ctx); |
| 467 | EVP_DecryptInit_ex(&ctx,cipher->cipher,NULL, key,&(cipher->iv[0])); | 472 | o = EVP_DecryptInit_ex(&ctx,cipher->cipher,NULL, key,&(cipher->iv[0])); |
| 468 | EVP_DecryptUpdate(&ctx,data,&i,data,j); | 473 | if (o) |
| 469 | o=EVP_DecryptFinal_ex(&ctx,&(data[i]),&j); | 474 | o = EVP_DecryptUpdate(&ctx,data,&i,data,j); |
| 475 | if (o) | ||
| 476 | o = EVP_DecryptFinal_ex(&ctx,&(data[i]),&j); | ||
| 470 | EVP_CIPHER_CTX_cleanup(&ctx); | 477 | EVP_CIPHER_CTX_cleanup(&ctx); |
| 471 | OPENSSL_cleanse((char *)buf,sizeof(buf)); | 478 | OPENSSL_cleanse((char *)buf,sizeof(buf)); |
| 472 | OPENSSL_cleanse((char *)key,sizeof(key)); | 479 | OPENSSL_cleanse((char *)key,sizeof(key)); |
diff --git a/src/lib/libssl/src/crypto/pem/pem_seal.c b/src/lib/libssl/src/crypto/pem/pem_seal.c index 59690b56ae..b6b4e13498 100644 --- a/src/lib/libssl/src/crypto/pem/pem_seal.c +++ b/src/lib/libssl/src/crypto/pem/pem_seal.c | |||
| @@ -96,7 +96,8 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, | |||
| 96 | EVP_EncodeInit(&ctx->encode); | 96 | EVP_EncodeInit(&ctx->encode); |
| 97 | 97 | ||
| 98 | EVP_MD_CTX_init(&ctx->md); | 98 | EVP_MD_CTX_init(&ctx->md); |
| 99 | EVP_SignInit(&ctx->md,md_type); | 99 | if (!EVP_SignInit(&ctx->md,md_type)) |
| 100 | goto err; | ||
| 100 | 101 | ||
| 101 | EVP_CIPHER_CTX_init(&ctx->cipher); | 102 | EVP_CIPHER_CTX_init(&ctx->cipher); |
| 102 | ret=EVP_SealInit(&ctx->cipher,type,ek,ekl,iv,pubk,npubk); | 103 | ret=EVP_SealInit(&ctx->cipher,type,ek,ekl,iv,pubk,npubk); |
| @@ -163,7 +164,8 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, | |||
| 163 | goto err; | 164 | goto err; |
| 164 | } | 165 | } |
| 165 | 166 | ||
| 166 | EVP_EncryptFinal_ex(&ctx->cipher,s,(int *)&i); | 167 | if (!EVP_EncryptFinal_ex(&ctx->cipher,s,(int *)&i)) |
| 168 | goto err; | ||
| 167 | EVP_EncodeUpdate(&ctx->encode,out,&j,s,i); | 169 | EVP_EncodeUpdate(&ctx->encode,out,&j,s,i); |
| 168 | *outl=j; | 170 | *outl=j; |
| 169 | out+=j; | 171 | out+=j; |
diff --git a/src/lib/libssl/src/crypto/perlasm/cbc.pl b/src/lib/libssl/src/crypto/perlasm/cbc.pl index 6fc2510905..24561e759a 100644 --- a/src/lib/libssl/src/crypto/perlasm/cbc.pl +++ b/src/lib/libssl/src/crypto/perlasm/cbc.pl | |||
| @@ -150,7 +150,7 @@ sub cbc | |||
| 150 | &set_label("PIC_point"); | 150 | &set_label("PIC_point"); |
| 151 | &blindpop("edx"); | 151 | &blindpop("edx"); |
| 152 | &lea("ecx",&DWP(&label("cbc_enc_jmp_table")."-".&label("PIC_point"),"edx")); | 152 | &lea("ecx",&DWP(&label("cbc_enc_jmp_table")."-".&label("PIC_point"),"edx")); |
| 153 | &mov($count,&DWP(0,"ecx",$count,4)) | 153 | &mov($count,&DWP(0,"ecx",$count,4)); |
| 154 | &add($count,"edx"); | 154 | &add($count,"edx"); |
| 155 | &xor("ecx","ecx"); | 155 | &xor("ecx","ecx"); |
| 156 | &xor("edx","edx"); | 156 | &xor("edx","edx"); |
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_crt.c b/src/lib/libssl/src/crypto/pkcs12/p12_crt.c index 96b131defa..a34915d02d 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_crt.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_crt.c | |||
| @@ -90,7 +90,14 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, | |||
| 90 | 90 | ||
| 91 | /* Set defaults */ | 91 | /* Set defaults */ |
| 92 | if (!nid_cert) | 92 | if (!nid_cert) |
| 93 | { | ||
| 94 | #ifdef OPENSSL_FIPS | ||
| 95 | if (FIPS_mode()) | ||
| 96 | nid_cert = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | ||
| 97 | else | ||
| 98 | #endif | ||
| 93 | nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC; | 99 | nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC; |
| 100 | } | ||
| 94 | if (!nid_key) | 101 | if (!nid_key) |
| 95 | nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | 102 | nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; |
| 96 | if (!iter) | 103 | if (!iter) |
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_key.c b/src/lib/libssl/src/crypto/pkcs12/p12_key.c index c55c7b60b3..61d58502fd 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_key.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_key.c | |||
| @@ -176,24 +176,32 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
| 176 | out += u; | 176 | out += u; |
| 177 | for (j = 0; j < v; j++) B[j] = Ai[j % u]; | 177 | for (j = 0; j < v; j++) B[j] = Ai[j % u]; |
| 178 | /* Work out B + 1 first then can use B as tmp space */ | 178 | /* Work out B + 1 first then can use B as tmp space */ |
| 179 | if (!BN_bin2bn (B, v, Bpl1)) goto err; | 179 | if (!BN_bin2bn (B, v, Bpl1)) |
| 180 | if (!BN_add_word (Bpl1, 1)) goto err; | 180 | goto err; |
| 181 | if (!BN_add_word (Bpl1, 1)) | ||
| 182 | goto err; | ||
| 181 | for (j = 0; j < Ilen ; j+=v) { | 183 | for (j = 0; j < Ilen ; j+=v) { |
| 182 | if (!BN_bin2bn (I + j, v, Ij)) goto err; | 184 | if (!BN_bin2bn(I + j, v, Ij)) |
| 183 | if (!BN_add (Ij, Ij, Bpl1)) goto err; | 185 | goto err; |
| 184 | BN_bn2bin (Ij, B); | 186 | if (!BN_add(Ij, Ij, Bpl1)) |
| 187 | goto err; | ||
| 188 | if (!BN_bn2bin(Ij, B)) | ||
| 189 | goto err; | ||
| 185 | Ijlen = BN_num_bytes (Ij); | 190 | Ijlen = BN_num_bytes (Ij); |
| 186 | /* If more than 2^(v*8) - 1 cut off MSB */ | 191 | /* If more than 2^(v*8) - 1 cut off MSB */ |
| 187 | if (Ijlen > v) { | 192 | if (Ijlen > v) { |
| 188 | BN_bn2bin (Ij, B); | 193 | if (!BN_bn2bin (Ij, B)) |
| 194 | goto err; | ||
| 189 | memcpy (I + j, B + 1, v); | 195 | memcpy (I + j, B + 1, v); |
| 190 | #ifndef PKCS12_BROKEN_KEYGEN | 196 | #ifndef PKCS12_BROKEN_KEYGEN |
| 191 | /* If less than v bytes pad with zeroes */ | 197 | /* If less than v bytes pad with zeroes */ |
| 192 | } else if (Ijlen < v) { | 198 | } else if (Ijlen < v) { |
| 193 | memset(I + j, 0, v - Ijlen); | 199 | memset(I + j, 0, v - Ijlen); |
| 194 | BN_bn2bin(Ij, I + j + v - Ijlen); | 200 | if (!BN_bn2bin(Ij, I + j + v - Ijlen)) |
| 201 | goto err; | ||
| 195 | #endif | 202 | #endif |
| 196 | } else BN_bn2bin (Ij, I + j); | 203 | } else if (!BN_bn2bin (Ij, I + j)) |
| 204 | goto err; | ||
| 197 | } | 205 | } |
| 198 | } | 206 | } |
| 199 | 207 | ||
diff --git a/src/lib/libssl/src/crypto/rand/md_rand.c b/src/lib/libssl/src/crypto/rand/md_rand.c index fcdd3f2a84..aee1c30b0a 100644 --- a/src/lib/libssl/src/crypto/rand/md_rand.c +++ b/src/lib/libssl/src/crypto/rand/md_rand.c | |||
| @@ -123,10 +123,10 @@ | |||
| 123 | 123 | ||
| 124 | #include "e_os.h" | 124 | #include "e_os.h" |
| 125 | 125 | ||
| 126 | #include <openssl/crypto.h> | ||
| 126 | #include <openssl/rand.h> | 127 | #include <openssl/rand.h> |
| 127 | #include "rand_lcl.h" | 128 | #include "rand_lcl.h" |
| 128 | 129 | ||
| 129 | #include <openssl/crypto.h> | ||
| 130 | #include <openssl/err.h> | 130 | #include <openssl/err.h> |
| 131 | 131 | ||
| 132 | #ifdef BN_DEBUG | 132 | #ifdef BN_DEBUG |
| @@ -198,6 +198,9 @@ static void ssleay_rand_add(const void *buf, int num, double add) | |||
| 198 | EVP_MD_CTX m; | 198 | EVP_MD_CTX m; |
| 199 | int do_not_lock; | 199 | int do_not_lock; |
| 200 | 200 | ||
| 201 | if (!num) | ||
| 202 | return; | ||
| 203 | |||
| 201 | /* | 204 | /* |
| 202 | * (Based on the rand(3) manpage) | 205 | * (Based on the rand(3) manpage) |
| 203 | * | 206 | * |
| @@ -380,8 +383,11 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo) | |||
| 380 | * are fed into the hash function and the results are kept in the | 383 | * are fed into the hash function and the results are kept in the |
| 381 | * global 'md'. | 384 | * global 'md'. |
| 382 | */ | 385 | */ |
| 383 | 386 | #ifdef OPENSSL_FIPS | |
| 384 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | 387 | /* NB: in FIPS mode we are already under a lock */ |
| 388 | if (!FIPS_mode()) | ||
| 389 | #endif | ||
| 390 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 385 | 391 | ||
| 386 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ | 392 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ |
| 387 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); | 393 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); |
| @@ -460,7 +466,10 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo) | |||
| 460 | 466 | ||
| 461 | /* before unlocking, we must clear 'crypto_lock_rand' */ | 467 | /* before unlocking, we must clear 'crypto_lock_rand' */ |
| 462 | crypto_lock_rand = 0; | 468 | crypto_lock_rand = 0; |
| 463 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | 469 | #ifdef OPENSSL_FIPS |
| 470 | if (!FIPS_mode()) | ||
| 471 | #endif | ||
| 472 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 464 | 473 | ||
| 465 | while (num > 0) | 474 | while (num > 0) |
| 466 | { | 475 | { |
| @@ -512,10 +521,16 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo) | |||
| 512 | MD_Init(&m); | 521 | MD_Init(&m); |
| 513 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); | 522 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); |
| 514 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); | 523 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); |
| 515 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | 524 | #ifdef OPENSSL_FIPS |
| 525 | if (!FIPS_mode()) | ||
| 526 | #endif | ||
| 527 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 516 | MD_Update(&m,md,MD_DIGEST_LENGTH); | 528 | MD_Update(&m,md,MD_DIGEST_LENGTH); |
| 517 | MD_Final(&m,md); | 529 | MD_Final(&m,md); |
| 518 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | 530 | #ifdef OPENSSL_FIPS |
| 531 | if (!FIPS_mode()) | ||
| 532 | #endif | ||
| 533 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 519 | 534 | ||
| 520 | EVP_MD_CTX_cleanup(&m); | 535 | EVP_MD_CTX_cleanup(&m); |
| 521 | if (ok) | 536 | if (ok) |
diff --git a/src/lib/libssl/src/crypto/rand/rand.h b/src/lib/libssl/src/crypto/rand/rand.h index dc8fcf94c5..bb5520e80a 100644 --- a/src/lib/libssl/src/crypto/rand/rand.h +++ b/src/lib/libssl/src/crypto/rand/rand.h | |||
| @@ -138,6 +138,7 @@ void ERR_load_RAND_strings(void); | |||
| 138 | #define RAND_F_SSLEAY_RAND_BYTES 100 | 138 | #define RAND_F_SSLEAY_RAND_BYTES 100 |
| 139 | 139 | ||
| 140 | /* Reason codes. */ | 140 | /* Reason codes. */ |
| 141 | #define RAND_R_DUAL_EC_DRBG_DISABLED 104 | ||
| 141 | #define RAND_R_ERROR_INITIALISING_DRBG 102 | 142 | #define RAND_R_ERROR_INITIALISING_DRBG 102 |
| 142 | #define RAND_R_ERROR_INSTANTIATING_DRBG 103 | 143 | #define RAND_R_ERROR_INSTANTIATING_DRBG 103 |
| 143 | #define RAND_R_NO_FIPS_RANDOM_METHOD_SET 101 | 144 | #define RAND_R_NO_FIPS_RANDOM_METHOD_SET 101 |
diff --git a/src/lib/libssl/src/crypto/rand/rand_err.c b/src/lib/libssl/src/crypto/rand/rand_err.c index b8586c8f4a..c4c80fc8cc 100644 --- a/src/lib/libssl/src/crypto/rand/rand_err.c +++ b/src/lib/libssl/src/crypto/rand/rand_err.c | |||
| @@ -78,6 +78,7 @@ static ERR_STRING_DATA RAND_str_functs[]= | |||
| 78 | 78 | ||
| 79 | static ERR_STRING_DATA RAND_str_reasons[]= | 79 | static ERR_STRING_DATA RAND_str_reasons[]= |
| 80 | { | 80 | { |
| 81 | {ERR_REASON(RAND_R_DUAL_EC_DRBG_DISABLED),"dual ec drbg disabled"}, | ||
| 81 | {ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG),"error initialising drbg"}, | 82 | {ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG),"error initialising drbg"}, |
| 82 | {ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG),"error instantiating drbg"}, | 83 | {ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG),"error instantiating drbg"}, |
| 83 | {ERR_REASON(RAND_R_NO_FIPS_RANDOM_METHOD_SET),"no fips random method set"}, | 84 | {ERR_REASON(RAND_R_NO_FIPS_RANDOM_METHOD_SET),"no fips random method set"}, |
diff --git a/src/lib/libssl/src/crypto/rand/rand_lib.c b/src/lib/libssl/src/crypto/rand/rand_lib.c index daf1dab973..5ac0e14caf 100644 --- a/src/lib/libssl/src/crypto/rand/rand_lib.c +++ b/src/lib/libssl/src/crypto/rand/rand_lib.c | |||
| @@ -210,8 +210,11 @@ static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char **pout, | |||
| 210 | 210 | ||
| 211 | static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char *out, size_t olen) | 211 | static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char *out, size_t olen) |
| 212 | { | 212 | { |
| 213 | OPENSSL_cleanse(out, olen); | 213 | if (out) |
| 214 | OPENSSL_free(out); | 214 | { |
| 215 | OPENSSL_cleanse(out, olen); | ||
| 216 | OPENSSL_free(out); | ||
| 217 | } | ||
| 215 | } | 218 | } |
| 216 | 219 | ||
| 217 | /* Set "additional input" when generating random data. This uses the | 220 | /* Set "additional input" when generating random data. This uses the |
| @@ -266,6 +269,14 @@ int RAND_init_fips(void) | |||
| 266 | DRBG_CTX *dctx; | 269 | DRBG_CTX *dctx; |
| 267 | size_t plen; | 270 | size_t plen; |
| 268 | unsigned char pers[32], *p; | 271 | unsigned char pers[32], *p; |
| 272 | #ifndef OPENSSL_ALLOW_DUAL_EC_DRBG | ||
| 273 | if (fips_drbg_type >> 16) | ||
| 274 | { | ||
| 275 | RANDerr(RAND_F_RAND_INIT_FIPS, RAND_R_DUAL_EC_DRBG_DISABLED); | ||
| 276 | return 0; | ||
| 277 | } | ||
| 278 | #endif | ||
| 279 | |||
| 269 | dctx = FIPS_get_default_drbg(); | 280 | dctx = FIPS_get_default_drbg(); |
| 270 | if (FIPS_drbg_init(dctx, fips_drbg_type, fips_drbg_flags) <= 0) | 281 | if (FIPS_drbg_init(dctx, fips_drbg_type, fips_drbg_flags) <= 0) |
| 271 | { | 282 | { |
diff --git a/src/lib/libssl/src/crypto/rand/rand_win.c b/src/lib/libssl/src/crypto/rand/rand_win.c index 5d134e186b..34ffcd23f9 100644 --- a/src/lib/libssl/src/crypto/rand/rand_win.c +++ b/src/lib/libssl/src/crypto/rand/rand_win.c | |||
| @@ -750,7 +750,7 @@ static void readscreen(void) | |||
| 750 | int y; /* y-coordinate of screen lines to grab */ | 750 | int y; /* y-coordinate of screen lines to grab */ |
| 751 | int n = 16; /* number of screen lines to grab at a time */ | 751 | int n = 16; /* number of screen lines to grab at a time */ |
| 752 | 752 | ||
| 753 | if (GetVersion() < 0x80000000 && OPENSSL_isservice()>0) | 753 | if (check_winnt() && OPENSSL_isservice()>0) |
| 754 | return; | 754 | return; |
| 755 | 755 | ||
| 756 | /* Create a screen DC and a memory DC compatible to screen DC */ | 756 | /* Create a screen DC and a memory DC compatible to screen DC */ |
diff --git a/src/lib/libssl/src/crypto/rand/randfile.c b/src/lib/libssl/src/crypto/rand/randfile.c index 030e07f418..7f1428072d 100644 --- a/src/lib/libssl/src/crypto/rand/randfile.c +++ b/src/lib/libssl/src/crypto/rand/randfile.c | |||
| @@ -57,7 +57,9 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | /* We need to define this to get macros like S_IFBLK and S_IFCHR */ | 59 | /* We need to define this to get macros like S_IFBLK and S_IFCHR */ |
| 60 | #if !defined(OPENSSL_SYS_VXWORKS) | ||
| 60 | #define _XOPEN_SOURCE 500 | 61 | #define _XOPEN_SOURCE 500 |
| 62 | #endif | ||
| 61 | 63 | ||
| 62 | #include <errno.h> | 64 | #include <errno.h> |
| 63 | #include <stdio.h> | 65 | #include <stdio.h> |
diff --git a/src/lib/libssl/src/crypto/ripemd/rmd_dgst.c b/src/lib/libssl/src/crypto/ripemd/rmd_dgst.c index 63f0d983f7..d8e72da51b 100644 --- a/src/lib/libssl/src/crypto/ripemd/rmd_dgst.c +++ b/src/lib/libssl/src/crypto/ripemd/rmd_dgst.c | |||
| @@ -105,21 +105,21 @@ void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num) | |||
| 105 | 105 | ||
| 106 | A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E; | 106 | A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E; |
| 107 | 107 | ||
| 108 | HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; | 108 | (void)HOST_c2l(data,l); X( 0)=l;(void)HOST_c2l(data,l); X( 1)=l; |
| 109 | RIP1(A,B,C,D,E,WL00,SL00); HOST_c2l(data,l); X( 2)=l; | 109 | RIP1(A,B,C,D,E,WL00,SL00); (void)HOST_c2l(data,l); X( 2)=l; |
| 110 | RIP1(E,A,B,C,D,WL01,SL01); HOST_c2l(data,l); X( 3)=l; | 110 | RIP1(E,A,B,C,D,WL01,SL01); (void)HOST_c2l(data,l); X( 3)=l; |
| 111 | RIP1(D,E,A,B,C,WL02,SL02); HOST_c2l(data,l); X( 4)=l; | 111 | RIP1(D,E,A,B,C,WL02,SL02); (void)HOST_c2l(data,l); X( 4)=l; |
| 112 | RIP1(C,D,E,A,B,WL03,SL03); HOST_c2l(data,l); X( 5)=l; | 112 | RIP1(C,D,E,A,B,WL03,SL03); (void)HOST_c2l(data,l); X( 5)=l; |
| 113 | RIP1(B,C,D,E,A,WL04,SL04); HOST_c2l(data,l); X( 6)=l; | 113 | RIP1(B,C,D,E,A,WL04,SL04); (void)HOST_c2l(data,l); X( 6)=l; |
| 114 | RIP1(A,B,C,D,E,WL05,SL05); HOST_c2l(data,l); X( 7)=l; | 114 | RIP1(A,B,C,D,E,WL05,SL05); (void)HOST_c2l(data,l); X( 7)=l; |
| 115 | RIP1(E,A,B,C,D,WL06,SL06); HOST_c2l(data,l); X( 8)=l; | 115 | RIP1(E,A,B,C,D,WL06,SL06); (void)HOST_c2l(data,l); X( 8)=l; |
| 116 | RIP1(D,E,A,B,C,WL07,SL07); HOST_c2l(data,l); X( 9)=l; | 116 | RIP1(D,E,A,B,C,WL07,SL07); (void)HOST_c2l(data,l); X( 9)=l; |
| 117 | RIP1(C,D,E,A,B,WL08,SL08); HOST_c2l(data,l); X(10)=l; | 117 | RIP1(C,D,E,A,B,WL08,SL08); (void)HOST_c2l(data,l); X(10)=l; |
| 118 | RIP1(B,C,D,E,A,WL09,SL09); HOST_c2l(data,l); X(11)=l; | 118 | RIP1(B,C,D,E,A,WL09,SL09); (void)HOST_c2l(data,l); X(11)=l; |
| 119 | RIP1(A,B,C,D,E,WL10,SL10); HOST_c2l(data,l); X(12)=l; | 119 | RIP1(A,B,C,D,E,WL10,SL10); (void)HOST_c2l(data,l); X(12)=l; |
| 120 | RIP1(E,A,B,C,D,WL11,SL11); HOST_c2l(data,l); X(13)=l; | 120 | RIP1(E,A,B,C,D,WL11,SL11); (void)HOST_c2l(data,l); X(13)=l; |
| 121 | RIP1(D,E,A,B,C,WL12,SL12); HOST_c2l(data,l); X(14)=l; | 121 | RIP1(D,E,A,B,C,WL12,SL12); (void)HOST_c2l(data,l); X(14)=l; |
| 122 | RIP1(C,D,E,A,B,WL13,SL13); HOST_c2l(data,l); X(15)=l; | 122 | RIP1(C,D,E,A,B,WL13,SL13); (void)HOST_c2l(data,l); X(15)=l; |
| 123 | RIP1(B,C,D,E,A,WL14,SL14); | 123 | RIP1(B,C,D,E,A,WL14,SL14); |
| 124 | RIP1(A,B,C,D,E,WL15,SL15); | 124 | RIP1(A,B,C,D,E,WL15,SL15); |
| 125 | 125 | ||
diff --git a/src/lib/libssl/src/crypto/ripemd/rmd_locl.h b/src/lib/libssl/src/crypto/ripemd/rmd_locl.h index f14b346e66..2bd8957d14 100644 --- a/src/lib/libssl/src/crypto/ripemd/rmd_locl.h +++ b/src/lib/libssl/src/crypto/ripemd/rmd_locl.h | |||
| @@ -88,11 +88,11 @@ void ripemd160_block_data_order (RIPEMD160_CTX *c, const void *p,size_t num); | |||
| 88 | #define HASH_FINAL RIPEMD160_Final | 88 | #define HASH_FINAL RIPEMD160_Final |
| 89 | #define HASH_MAKE_STRING(c,s) do { \ | 89 | #define HASH_MAKE_STRING(c,s) do { \ |
| 90 | unsigned long ll; \ | 90 | unsigned long ll; \ |
| 91 | ll=(c)->A; HOST_l2c(ll,(s)); \ | 91 | ll=(c)->A; (void)HOST_l2c(ll,(s)); \ |
| 92 | ll=(c)->B; HOST_l2c(ll,(s)); \ | 92 | ll=(c)->B; (void)HOST_l2c(ll,(s)); \ |
| 93 | ll=(c)->C; HOST_l2c(ll,(s)); \ | 93 | ll=(c)->C; (void)HOST_l2c(ll,(s)); \ |
| 94 | ll=(c)->D; HOST_l2c(ll,(s)); \ | 94 | ll=(c)->D; (void)HOST_l2c(ll,(s)); \ |
| 95 | ll=(c)->E; HOST_l2c(ll,(s)); \ | 95 | ll=(c)->E; (void)HOST_l2c(ll,(s)); \ |
| 96 | } while (0) | 96 | } while (0) |
| 97 | #define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order | 97 | #define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order |
| 98 | 98 | ||
diff --git a/src/lib/libssl/src/crypto/rsa/rsa.h b/src/lib/libssl/src/crypto/rsa/rsa.h index 4814a2fc15..5f269e577a 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa.h +++ b/src/lib/libssl/src/crypto/rsa/rsa.h | |||
| @@ -280,7 +280,7 @@ struct rsa_st | |||
| 280 | 280 | ||
| 281 | RSA * RSA_new(void); | 281 | RSA * RSA_new(void); |
| 282 | RSA * RSA_new_method(ENGINE *engine); | 282 | RSA * RSA_new_method(ENGINE *engine); |
| 283 | int RSA_size(const RSA *); | 283 | int RSA_size(const RSA *rsa); |
| 284 | 284 | ||
| 285 | /* Deprecated version */ | 285 | /* Deprecated version */ |
| 286 | #ifndef OPENSSL_NO_DEPRECATED | 286 | #ifndef OPENSSL_NO_DEPRECATED |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_chk.c b/src/lib/libssl/src/crypto/rsa/rsa_chk.c index 9d848db8c6..cc30e77132 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_chk.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_chk.c | |||
| @@ -59,6 +59,12 @@ int RSA_check_key(const RSA *key) | |||
| 59 | BN_CTX *ctx; | 59 | BN_CTX *ctx; |
| 60 | int r; | 60 | int r; |
| 61 | int ret=1; | 61 | int ret=1; |
| 62 | |||
| 63 | if (!key->p || !key->q || !key->n || !key->e || !key->d) | ||
| 64 | { | ||
| 65 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_VALUE_MISSING); | ||
| 66 | return 0; | ||
| 67 | } | ||
| 62 | 68 | ||
| 63 | i = BN_new(); | 69 | i = BN_new(); |
| 64 | j = BN_new(); | 70 | j = BN_new(); |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_eay.c b/src/lib/libssl/src/crypto/rsa/rsa_eay.c index 2e1ddd48d3..88ee2cb557 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_eay.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_eay.c | |||
| @@ -847,12 +847,12 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | |||
| 847 | if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err; | 847 | if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err; |
| 848 | 848 | ||
| 849 | /* If p < q it is occasionally possible for the correction of | 849 | /* If p < q it is occasionally possible for the correction of |
| 850 | * adding 'p' if r0 is negative above to leave the result still | 850 | * adding 'p' if r0 is negative above to leave the result still |
| 851 | * negative. This can break the private key operations: the following | 851 | * negative. This can break the private key operations: the following |
| 852 | * second correction should *always* correct this rare occurrence. | 852 | * second correction should *always* correct this rare occurrence. |
| 853 | * This will *never* happen with OpenSSL generated keys because | 853 | * This will *never* happen with OpenSSL generated keys because |
| 854 | * they ensure p > q [steve] | 854 | * they ensure p > q [steve] |
| 855 | */ | 855 | */ |
| 856 | if (BN_is_negative(r0)) | 856 | if (BN_is_negative(r0)) |
| 857 | if (!BN_add(r0,r0,rsa->p)) goto err; | 857 | if (!BN_add(r0,r0,rsa->p)) goto err; |
| 858 | if (!BN_mul(r1,r0,rsa->q,ctx)) goto err; | 858 | if (!BN_mul(r1,r0,rsa->q,ctx)) goto err; |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_oaep.c b/src/lib/libssl/src/crypto/rsa/rsa_oaep.c index 553d212ebe..af4d24a56e 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_oaep.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_oaep.c | |||
| @@ -149,7 +149,7 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
| 149 | if (!EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1(), NULL)) | 149 | if (!EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1(), NULL)) |
| 150 | return -1; | 150 | return -1; |
| 151 | 151 | ||
| 152 | if (memcmp(db, phash, SHA_DIGEST_LENGTH) != 0 || bad) | 152 | if (CRYPTO_memcmp(db, phash, SHA_DIGEST_LENGTH) != 0 || bad) |
| 153 | goto decoding_err; | 153 | goto decoding_err; |
| 154 | else | 154 | else |
| 155 | { | 155 | { |
diff --git a/src/lib/libssl/src/crypto/sha/Makefile b/src/lib/libssl/src/crypto/sha/Makefile index 6d191d3936..2eb2b7af99 100644 --- a/src/lib/libssl/src/crypto/sha/Makefile +++ b/src/lib/libssl/src/crypto/sha/Makefile | |||
| @@ -60,7 +60,9 @@ sha256-armv4.S: asm/sha256-armv4.pl | |||
| 60 | $(PERL) $< $(PERLASM_SCHEME) $@ | 60 | $(PERL) $< $(PERLASM_SCHEME) $@ |
| 61 | 61 | ||
| 62 | sha1-alpha.s: asm/sha1-alpha.pl | 62 | sha1-alpha.s: asm/sha1-alpha.pl |
| 63 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null | 63 | (preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \ |
| 64 | $(PERL) asm/sha1-alpha.pl > $$preproc && \ | ||
| 65 | $(CC) -E $$preproc > $@ && rm $$preproc) | ||
| 64 | 66 | ||
| 65 | # Solaris make has to be explicitly told | 67 | # Solaris make has to be explicitly told |
| 66 | sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $(PERLASM_SCHEME) > $@ | 68 | sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $(PERLASM_SCHEME) > $@ |
diff --git a/src/lib/libssl/src/crypto/sha/asm/sha1-ia64.pl b/src/lib/libssl/src/crypto/sha/asm/sha1-ia64.pl index db28f0805a..02d35d1614 100644 --- a/src/lib/libssl/src/crypto/sha/asm/sha1-ia64.pl +++ b/src/lib/libssl/src/crypto/sha/asm/sha1-ia64.pl | |||
| @@ -271,7 +271,8 @@ tmp6=loc13; | |||
| 271 | 271 | ||
| 272 | ___ | 272 | ___ |
| 273 | 273 | ||
| 274 | { my $i,@V=($A,$B,$C,$D,$E); | 274 | { my $i; |
| 275 | my @V=($A,$B,$C,$D,$E); | ||
| 275 | 276 | ||
| 276 | for($i=0;$i<16;$i++) { &BODY_00_15(\$code,$i,@V); unshift(@V,pop(@V)); } | 277 | for($i=0;$i<16;$i++) { &BODY_00_15(\$code,$i,@V); unshift(@V,pop(@V)); } |
| 277 | for(;$i<20;$i++) { &BODY_16_19(\$code,$i,@V); unshift(@V,pop(@V)); } | 278 | for(;$i<20;$i++) { &BODY_16_19(\$code,$i,@V); unshift(@V,pop(@V)); } |
diff --git a/src/lib/libssl/src/crypto/sha/sha1_one.c b/src/lib/libssl/src/crypto/sha/sha1_one.c index 7c65b60276..c56ec94020 100644 --- a/src/lib/libssl/src/crypto/sha/sha1_one.c +++ b/src/lib/libssl/src/crypto/sha/sha1_one.c | |||
| @@ -58,8 +58,8 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | #include <openssl/sha.h> | ||
| 62 | #include <openssl/crypto.h> | 61 | #include <openssl/crypto.h> |
| 62 | #include <openssl/sha.h> | ||
| 63 | 63 | ||
| 64 | #ifndef OPENSSL_NO_SHA1 | 64 | #ifndef OPENSSL_NO_SHA1 |
| 65 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) | 65 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) |
diff --git a/src/lib/libssl/src/crypto/sha/sha1dgst.c b/src/lib/libssl/src/crypto/sha/sha1dgst.c index 81219af088..a98690225f 100644 --- a/src/lib/libssl/src/crypto/sha/sha1dgst.c +++ b/src/lib/libssl/src/crypto/sha/sha1dgst.c | |||
| @@ -56,8 +56,8 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <openssl/opensslconf.h> | ||
| 60 | #include <openssl/crypto.h> | 59 | #include <openssl/crypto.h> |
| 60 | #include <openssl/opensslconf.h> | ||
| 61 | #if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) | 61 | #if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) |
| 62 | 62 | ||
| 63 | #undef SHA_0 | 63 | #undef SHA_0 |
diff --git a/src/lib/libssl/src/crypto/sha/sha_dgst.c b/src/lib/libssl/src/crypto/sha/sha_dgst.c index c946ad827d..fb63b17ff2 100644 --- a/src/lib/libssl/src/crypto/sha/sha_dgst.c +++ b/src/lib/libssl/src/crypto/sha/sha_dgst.c | |||
| @@ -56,8 +56,8 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <openssl/opensslconf.h> | ||
| 60 | #include <openssl/crypto.h> | 59 | #include <openssl/crypto.h> |
| 60 | #include <openssl/opensslconf.h> | ||
| 61 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) | 61 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) |
| 62 | 62 | ||
| 63 | #undef SHA_1 | 63 | #undef SHA_1 |
diff --git a/src/lib/libssl/src/crypto/sha/sha_locl.h b/src/lib/libssl/src/crypto/sha/sha_locl.h index 7a0c3ca8d8..d673255f78 100644 --- a/src/lib/libssl/src/crypto/sha/sha_locl.h +++ b/src/lib/libssl/src/crypto/sha/sha_locl.h | |||
| @@ -69,11 +69,11 @@ | |||
| 69 | #define HASH_CBLOCK SHA_CBLOCK | 69 | #define HASH_CBLOCK SHA_CBLOCK |
| 70 | #define HASH_MAKE_STRING(c,s) do { \ | 70 | #define HASH_MAKE_STRING(c,s) do { \ |
| 71 | unsigned long ll; \ | 71 | unsigned long ll; \ |
| 72 | ll=(c)->h0; HOST_l2c(ll,(s)); \ | 72 | ll=(c)->h0; (void)HOST_l2c(ll,(s)); \ |
| 73 | ll=(c)->h1; HOST_l2c(ll,(s)); \ | 73 | ll=(c)->h1; (void)HOST_l2c(ll,(s)); \ |
| 74 | ll=(c)->h2; HOST_l2c(ll,(s)); \ | 74 | ll=(c)->h2; (void)HOST_l2c(ll,(s)); \ |
| 75 | ll=(c)->h3; HOST_l2c(ll,(s)); \ | 75 | ll=(c)->h3; (void)HOST_l2c(ll,(s)); \ |
| 76 | ll=(c)->h4; HOST_l2c(ll,(s)); \ | 76 | ll=(c)->h4; (void)HOST_l2c(ll,(s)); \ |
| 77 | } while (0) | 77 | } while (0) |
| 78 | 78 | ||
| 79 | #if defined(SHA_0) | 79 | #if defined(SHA_0) |
| @@ -256,21 +256,21 @@ static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) | |||
| 256 | } | 256 | } |
| 257 | else | 257 | else |
| 258 | { | 258 | { |
| 259 | HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; | 259 | (void)HOST_c2l(data,l); X( 0)=l; (void)HOST_c2l(data,l); X( 1)=l; |
| 260 | BODY_00_15( 0,A,B,C,D,E,T,X( 0)); HOST_c2l(data,l); X( 2)=l; | 260 | BODY_00_15( 0,A,B,C,D,E,T,X( 0)); (void)HOST_c2l(data,l); X( 2)=l; |
| 261 | BODY_00_15( 1,T,A,B,C,D,E,X( 1)); HOST_c2l(data,l); X( 3)=l; | 261 | BODY_00_15( 1,T,A,B,C,D,E,X( 1)); (void)HOST_c2l(data,l); X( 3)=l; |
| 262 | BODY_00_15( 2,E,T,A,B,C,D,X( 2)); HOST_c2l(data,l); X( 4)=l; | 262 | BODY_00_15( 2,E,T,A,B,C,D,X( 2)); (void)HOST_c2l(data,l); X( 4)=l; |
| 263 | BODY_00_15( 3,D,E,T,A,B,C,X( 3)); HOST_c2l(data,l); X( 5)=l; | 263 | BODY_00_15( 3,D,E,T,A,B,C,X( 3)); (void)HOST_c2l(data,l); X( 5)=l; |
| 264 | BODY_00_15( 4,C,D,E,T,A,B,X( 4)); HOST_c2l(data,l); X( 6)=l; | 264 | BODY_00_15( 4,C,D,E,T,A,B,X( 4)); (void)HOST_c2l(data,l); X( 6)=l; |
| 265 | BODY_00_15( 5,B,C,D,E,T,A,X( 5)); HOST_c2l(data,l); X( 7)=l; | 265 | BODY_00_15( 5,B,C,D,E,T,A,X( 5)); (void)HOST_c2l(data,l); X( 7)=l; |
| 266 | BODY_00_15( 6,A,B,C,D,E,T,X( 6)); HOST_c2l(data,l); X( 8)=l; | 266 | BODY_00_15( 6,A,B,C,D,E,T,X( 6)); (void)HOST_c2l(data,l); X( 8)=l; |
| 267 | BODY_00_15( 7,T,A,B,C,D,E,X( 7)); HOST_c2l(data,l); X( 9)=l; | 267 | BODY_00_15( 7,T,A,B,C,D,E,X( 7)); (void)HOST_c2l(data,l); X( 9)=l; |
| 268 | BODY_00_15( 8,E,T,A,B,C,D,X( 8)); HOST_c2l(data,l); X(10)=l; | 268 | BODY_00_15( 8,E,T,A,B,C,D,X( 8)); (void)HOST_c2l(data,l); X(10)=l; |
| 269 | BODY_00_15( 9,D,E,T,A,B,C,X( 9)); HOST_c2l(data,l); X(11)=l; | 269 | BODY_00_15( 9,D,E,T,A,B,C,X( 9)); (void)HOST_c2l(data,l); X(11)=l; |
| 270 | BODY_00_15(10,C,D,E,T,A,B,X(10)); HOST_c2l(data,l); X(12)=l; | 270 | BODY_00_15(10,C,D,E,T,A,B,X(10)); (void)HOST_c2l(data,l); X(12)=l; |
| 271 | BODY_00_15(11,B,C,D,E,T,A,X(11)); HOST_c2l(data,l); X(13)=l; | 271 | BODY_00_15(11,B,C,D,E,T,A,X(11)); (void)HOST_c2l(data,l); X(13)=l; |
| 272 | BODY_00_15(12,A,B,C,D,E,T,X(12)); HOST_c2l(data,l); X(14)=l; | 272 | BODY_00_15(12,A,B,C,D,E,T,X(12)); (void)HOST_c2l(data,l); X(14)=l; |
| 273 | BODY_00_15(13,T,A,B,C,D,E,X(13)); HOST_c2l(data,l); X(15)=l; | 273 | BODY_00_15(13,T,A,B,C,D,E,X(13)); (void)HOST_c2l(data,l); X(15)=l; |
| 274 | BODY_00_15(14,E,T,A,B,C,D,X(14)); | 274 | BODY_00_15(14,E,T,A,B,C,D,X(14)); |
| 275 | BODY_00_15(15,D,E,T,A,B,C,X(15)); | 275 | BODY_00_15(15,D,E,T,A,B,C,X(15)); |
| 276 | } | 276 | } |
diff --git a/src/lib/libssl/src/crypto/symhacks.h b/src/lib/libssl/src/crypto/symhacks.h index 403f592dcd..bd2f000d59 100644 --- a/src/lib/libssl/src/crypto/symhacks.h +++ b/src/lib/libssl/src/crypto/symhacks.h | |||
| @@ -193,17 +193,23 @@ | |||
| 193 | #undef SSL_CTX_set_srp_username_callback | 193 | #undef SSL_CTX_set_srp_username_callback |
| 194 | #define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb | 194 | #define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb |
| 195 | #undef ssl_add_clienthello_use_srtp_ext | 195 | #undef ssl_add_clienthello_use_srtp_ext |
| 196 | #define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext | 196 | #define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext |
| 197 | #undef ssl_add_serverhello_use_srtp_ext | 197 | #undef ssl_add_serverhello_use_srtp_ext |
| 198 | #define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext | 198 | #define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext |
| 199 | #undef ssl_parse_clienthello_use_srtp_ext | 199 | #undef ssl_parse_clienthello_use_srtp_ext |
| 200 | #define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext | 200 | #define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext |
| 201 | #undef ssl_parse_serverhello_use_srtp_ext | 201 | #undef ssl_parse_serverhello_use_srtp_ext |
| 202 | #define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext | 202 | #define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext |
| 203 | #undef SSL_CTX_set_next_protos_advertised_cb | 203 | #undef SSL_CTX_set_next_protos_advertised_cb |
| 204 | #define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb | 204 | #define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb |
| 205 | #undef SSL_CTX_set_next_proto_select_cb | 205 | #undef SSL_CTX_set_next_proto_select_cb |
| 206 | #define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb | 206 | #define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb |
| 207 | #undef ssl3_cbc_record_digest_supported | ||
| 208 | #define ssl3_cbc_record_digest_supported ssl3_cbc_record_digest_support | ||
| 209 | #undef ssl_check_clienthello_tlsext_late | ||
| 210 | #define ssl_check_clienthello_tlsext_late ssl_check_clihello_tlsext_late | ||
| 211 | #undef ssl_check_clienthello_tlsext_early | ||
| 212 | #define ssl_check_clienthello_tlsext_early ssl_check_clihello_tlsext_early | ||
| 207 | 213 | ||
| 208 | /* Hack some long ENGINE names */ | 214 | /* Hack some long ENGINE names */ |
| 209 | #undef ENGINE_get_default_BN_mod_exp_crt | 215 | #undef ENGINE_get_default_BN_mod_exp_crt |
| @@ -316,8 +322,6 @@ | |||
| 316 | #define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf | 322 | #define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf |
| 317 | #undef ec_GFp_simple_points_make_affine | 323 | #undef ec_GFp_simple_points_make_affine |
| 318 | #define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine | 324 | #define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine |
| 319 | #undef ec_GFp_simple_group_get_curve_GFp | ||
| 320 | #define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp | ||
| 321 | #undef ec_GFp_simple_set_Jprojective_coordinates_GFp | 325 | #undef ec_GFp_simple_set_Jprojective_coordinates_GFp |
| 322 | #define ec_GFp_simple_set_Jprojective_coordinates_GFp \ | 326 | #define ec_GFp_simple_set_Jprojective_coordinates_GFp \ |
| 323 | ec_GFp_smp_set_Jproj_coords_GFp | 327 | ec_GFp_smp_set_Jproj_coords_GFp |
diff --git a/src/lib/libssl/src/crypto/ui/ui_openssl.c b/src/lib/libssl/src/crypto/ui/ui_openssl.c index 5832a73cf5..a38c7581e6 100644 --- a/src/lib/libssl/src/crypto/ui/ui_openssl.c +++ b/src/lib/libssl/src/crypto/ui/ui_openssl.c | |||
| @@ -122,9 +122,15 @@ | |||
| 122 | * sigaction and fileno included. -pedantic would be more appropriate for | 122 | * sigaction and fileno included. -pedantic would be more appropriate for |
| 123 | * the intended purposes, but we can't prevent users from adding -ansi. | 123 | * the intended purposes, but we can't prevent users from adding -ansi. |
| 124 | */ | 124 | */ |
| 125 | #if defined(OPENSSL_SYSNAME_VXWORKS) | ||
| 126 | #include <sys/types.h> | ||
| 127 | #endif | ||
| 128 | |||
| 125 | #if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS) | 129 | #if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS) |
| 130 | #ifndef _POSIX_C_SOURCE | ||
| 126 | #define _POSIX_C_SOURCE 2 | 131 | #define _POSIX_C_SOURCE 2 |
| 127 | #endif | 132 | #endif |
| 133 | #endif | ||
| 128 | #include <signal.h> | 134 | #include <signal.h> |
| 129 | #include <stdio.h> | 135 | #include <stdio.h> |
| 130 | #include <string.h> | 136 | #include <string.h> |
diff --git a/src/lib/libssl/src/crypto/x509/by_dir.c b/src/lib/libssl/src/crypto/x509/by_dir.c index 27ca5150c1..c6602dae4f 100644 --- a/src/lib/libssl/src/crypto/x509/by_dir.c +++ b/src/lib/libssl/src/crypto/x509/by_dir.c | |||
| @@ -218,7 +218,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
| 218 | 218 | ||
| 219 | s=dir; | 219 | s=dir; |
| 220 | p=s; | 220 | p=s; |
| 221 | for (;;p++) | 221 | do |
| 222 | { | 222 | { |
| 223 | if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) | 223 | if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) |
| 224 | { | 224 | { |
| @@ -264,9 +264,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
| 264 | return 0; | 264 | return 0; |
| 265 | } | 265 | } |
| 266 | } | 266 | } |
| 267 | if (*p == '\0') | 267 | } while (*p++ != '\0'); |
| 268 | break; | ||
| 269 | } | ||
| 270 | return 1; | 268 | return 1; |
| 271 | } | 269 | } |
| 272 | 270 | ||
diff --git a/src/lib/libssl/src/crypto/x509/x509_cmp.c b/src/lib/libssl/src/crypto/x509/x509_cmp.c index 7c2aaee2e9..352aa37434 100644 --- a/src/lib/libssl/src/crypto/x509/x509_cmp.c +++ b/src/lib/libssl/src/crypto/x509/x509_cmp.c | |||
| @@ -86,10 +86,9 @@ unsigned long X509_issuer_and_serial_hash(X509 *a) | |||
| 86 | 86 | ||
| 87 | EVP_MD_CTX_init(&ctx); | 87 | EVP_MD_CTX_init(&ctx); |
| 88 | f=X509_NAME_oneline(a->cert_info->issuer,NULL,0); | 88 | f=X509_NAME_oneline(a->cert_info->issuer,NULL,0); |
| 89 | ret=strlen(f); | ||
| 90 | if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL)) | 89 | if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL)) |
| 91 | goto err; | 90 | goto err; |
| 92 | if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,ret)) | 91 | if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,strlen(f))) |
| 93 | goto err; | 92 | goto err; |
| 94 | OPENSSL_free(f); | 93 | OPENSSL_free(f); |
| 95 | if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data, | 94 | if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data, |
| @@ -249,14 +248,14 @@ unsigned long X509_NAME_hash_old(X509_NAME *x) | |||
| 249 | i2d_X509_NAME(x,NULL); | 248 | i2d_X509_NAME(x,NULL); |
| 250 | EVP_MD_CTX_init(&md_ctx); | 249 | EVP_MD_CTX_init(&md_ctx); |
| 251 | EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | 250 | EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); |
| 252 | EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL); | 251 | if (EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL) |
| 253 | EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length); | 252 | && EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length) |
| 254 | EVP_DigestFinal_ex(&md_ctx,md,NULL); | 253 | && EVP_DigestFinal_ex(&md_ctx,md,NULL)) |
| 254 | ret=(((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| | ||
| 255 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) | ||
| 256 | )&0xffffffffL; | ||
| 255 | EVP_MD_CTX_cleanup(&md_ctx); | 257 | EVP_MD_CTX_cleanup(&md_ctx); |
| 256 | 258 | ||
| 257 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| | ||
| 258 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) | ||
| 259 | )&0xffffffffL; | ||
| 260 | return(ret); | 259 | return(ret); |
| 261 | } | 260 | } |
| 262 | #endif | 261 | #endif |
diff --git a/src/lib/libssl/src/crypto/x509/x509_vfy.c b/src/lib/libssl/src/crypto/x509/x509_vfy.c index b0779db023..920066aeba 100644 --- a/src/lib/libssl/src/crypto/x509/x509_vfy.c +++ b/src/lib/libssl/src/crypto/x509/x509_vfy.c | |||
| @@ -694,6 +694,7 @@ static int check_cert(X509_STORE_CTX *ctx) | |||
| 694 | X509_CRL *crl = NULL, *dcrl = NULL; | 694 | X509_CRL *crl = NULL, *dcrl = NULL; |
| 695 | X509 *x; | 695 | X509 *x; |
| 696 | int ok, cnum; | 696 | int ok, cnum; |
| 697 | unsigned int last_reasons; | ||
| 697 | cnum = ctx->error_depth; | 698 | cnum = ctx->error_depth; |
| 698 | x = sk_X509_value(ctx->chain, cnum); | 699 | x = sk_X509_value(ctx->chain, cnum); |
| 699 | ctx->current_cert = x; | 700 | ctx->current_cert = x; |
| @@ -702,6 +703,7 @@ static int check_cert(X509_STORE_CTX *ctx) | |||
| 702 | ctx->current_reasons = 0; | 703 | ctx->current_reasons = 0; |
| 703 | while (ctx->current_reasons != CRLDP_ALL_REASONS) | 704 | while (ctx->current_reasons != CRLDP_ALL_REASONS) |
| 704 | { | 705 | { |
| 706 | last_reasons = ctx->current_reasons; | ||
| 705 | /* Try to retrieve relevant CRL */ | 707 | /* Try to retrieve relevant CRL */ |
| 706 | if (ctx->get_crl) | 708 | if (ctx->get_crl) |
| 707 | ok = ctx->get_crl(ctx, &crl, x); | 709 | ok = ctx->get_crl(ctx, &crl, x); |
| @@ -745,6 +747,15 @@ static int check_cert(X509_STORE_CTX *ctx) | |||
| 745 | X509_CRL_free(dcrl); | 747 | X509_CRL_free(dcrl); |
| 746 | crl = NULL; | 748 | crl = NULL; |
| 747 | dcrl = NULL; | 749 | dcrl = NULL; |
| 750 | /* If reasons not updated we wont get anywhere by | ||
| 751 | * another iteration, so exit loop. | ||
| 752 | */ | ||
| 753 | if (last_reasons == ctx->current_reasons) | ||
| 754 | { | ||
| 755 | ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; | ||
| 756 | ok = ctx->verify_cb(0, ctx); | ||
| 757 | goto err; | ||
| 758 | } | ||
| 748 | } | 759 | } |
| 749 | err: | 760 | err: |
| 750 | X509_CRL_free(crl); | 761 | X509_CRL_free(crl); |
| @@ -872,7 +883,7 @@ static int crl_extension_match(X509_CRL *a, X509_CRL *b, int nid) | |||
| 872 | { | 883 | { |
| 873 | ASN1_OCTET_STRING *exta, *extb; | 884 | ASN1_OCTET_STRING *exta, *extb; |
| 874 | int i; | 885 | int i; |
| 875 | i = X509_CRL_get_ext_by_NID(a, nid, 0); | 886 | i = X509_CRL_get_ext_by_NID(a, nid, -1); |
| 876 | if (i >= 0) | 887 | if (i >= 0) |
| 877 | { | 888 | { |
| 878 | /* Can't have multiple occurrences */ | 889 | /* Can't have multiple occurrences */ |
| @@ -883,7 +894,7 @@ static int crl_extension_match(X509_CRL *a, X509_CRL *b, int nid) | |||
| 883 | else | 894 | else |
| 884 | exta = NULL; | 895 | exta = NULL; |
| 885 | 896 | ||
| 886 | i = X509_CRL_get_ext_by_NID(b, nid, 0); | 897 | i = X509_CRL_get_ext_by_NID(b, nid, -1); |
| 887 | 898 | ||
| 888 | if (i >= 0) | 899 | if (i >= 0) |
| 889 | { | 900 | { |
| @@ -1451,10 +1462,9 @@ static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x) | |||
| 1451 | * a certificate was revoked. This has since been changed since | 1462 | * a certificate was revoked. This has since been changed since |
| 1452 | * critical extension can change the meaning of CRL entries. | 1463 | * critical extension can change the meaning of CRL entries. |
| 1453 | */ | 1464 | */ |
| 1454 | if (crl->flags & EXFLAG_CRITICAL) | 1465 | if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) |
| 1466 | && (crl->flags & EXFLAG_CRITICAL)) | ||
| 1455 | { | 1467 | { |
| 1456 | if (ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) | ||
| 1457 | return 1; | ||
| 1458 | ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION; | 1468 | ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION; |
| 1459 | ok = ctx->verify_cb(0, ctx); | 1469 | ok = ctx->verify_cb(0, ctx); |
| 1460 | if(!ok) | 1470 | if(!ok) |
diff --git a/src/lib/libssl/src/crypto/x509/x_all.c b/src/lib/libssl/src/crypto/x509/x_all.c index b94aeeb873..e06602d65a 100644 --- a/src/lib/libssl/src/crypto/x509/x_all.c +++ b/src/lib/libssl/src/crypto/x509/x_all.c | |||
| @@ -97,6 +97,7 @@ int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md) | |||
| 97 | 97 | ||
| 98 | int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx) | 98 | int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx) |
| 99 | { | 99 | { |
| 100 | x->cert_info->enc.modified = 1; | ||
| 100 | return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CINF), | 101 | return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CINF), |
| 101 | x->cert_info->signature, | 102 | x->cert_info->signature, |
| 102 | x->sig_alg, x->signature, x->cert_info, ctx); | 103 | x->sig_alg, x->signature, x->cert_info, ctx); |
| @@ -123,6 +124,7 @@ int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md) | |||
| 123 | 124 | ||
| 124 | int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx) | 125 | int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx) |
| 125 | { | 126 | { |
| 127 | x->crl->enc.modified = 1; | ||
| 126 | return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CRL_INFO), | 128 | return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CRL_INFO), |
| 127 | x->crl->sig_alg, x->sig_alg, x->signature, x->crl, ctx); | 129 | x->crl->sig_alg, x->sig_alg, x->signature, x->crl, ctx); |
| 128 | } | 130 | } |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_purp.c b/src/lib/libssl/src/crypto/x509v3/v3_purp.c index 181bd34979..ad688657e0 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_purp.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_purp.c | |||
| @@ -474,11 +474,11 @@ static void x509v3_cache_extensions(X509 *x) | |||
| 474 | for (i = 0; i < X509_get_ext_count(x); i++) | 474 | for (i = 0; i < X509_get_ext_count(x); i++) |
| 475 | { | 475 | { |
| 476 | ex = X509_get_ext(x, i); | 476 | ex = X509_get_ext(x, i); |
| 477 | if (!X509_EXTENSION_get_critical(ex)) | ||
| 478 | continue; | ||
| 479 | if (OBJ_obj2nid(X509_EXTENSION_get_object(ex)) | 477 | if (OBJ_obj2nid(X509_EXTENSION_get_object(ex)) |
| 480 | == NID_freshest_crl) | 478 | == NID_freshest_crl) |
| 481 | x->ex_flags |= EXFLAG_FRESHEST; | 479 | x->ex_flags |= EXFLAG_FRESHEST; |
| 480 | if (!X509_EXTENSION_get_critical(ex)) | ||
| 481 | continue; | ||
| 482 | if (!X509_supported_extension(ex)) | 482 | if (!X509_supported_extension(ex)) |
| 483 | { | 483 | { |
| 484 | x->ex_flags |= EXFLAG_CRITICAL; | 484 | x->ex_flags |= EXFLAG_CRITICAL; |
diff --git a/src/lib/libssl/src/demos/x509/mkreq.c b/src/lib/libssl/src/demos/x509/mkreq.c index d17e4ade94..d1cba9dc5a 100644 --- a/src/lib/libssl/src/demos/x509/mkreq.c +++ b/src/lib/libssl/src/demos/x509/mkreq.c | |||
| @@ -7,13 +7,14 @@ | |||
| 7 | 7 | ||
| 8 | #include <openssl/pem.h> | 8 | #include <openssl/pem.h> |
| 9 | #include <openssl/conf.h> | 9 | #include <openssl/conf.h> |
| 10 | #include <openssl/x509.h> | ||
| 10 | #include <openssl/x509v3.h> | 11 | #include <openssl/x509v3.h> |
| 11 | #ifndef OPENSSL_NO_ENGINE | 12 | #ifndef OPENSSL_NO_ENGINE |
| 12 | #include <openssl/engine.h> | 13 | #include <openssl/engine.h> |
| 13 | #endif | 14 | #endif |
| 14 | 15 | ||
| 15 | int mkreq(X509_REQ **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days); | 16 | int mkreq(X509_REQ **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days); |
| 16 | int add_ext(STACK_OF(X509_REQUEST) *sk, int nid, char *value); | 17 | int add_ext(STACK_OF(X509_EXTENSION) *sk, int nid, char *value); |
| 17 | 18 | ||
| 18 | int main(int argc, char **argv) | 19 | int main(int argc, char **argv) |
| 19 | { | 20 | { |
| @@ -148,7 +149,7 @@ err: | |||
| 148 | * because we wont reference any other sections. | 149 | * because we wont reference any other sections. |
| 149 | */ | 150 | */ |
| 150 | 151 | ||
| 151 | int add_ext(STACK_OF(X509_REQUEST) *sk, int nid, char *value) | 152 | int add_ext(STACK_OF(X509_EXTENSION) *sk, int nid, char *value) |
| 152 | { | 153 | { |
| 153 | X509_EXTENSION *ex; | 154 | X509_EXTENSION *ex; |
| 154 | ex = X509V3_EXT_conf_nid(NULL, NULL, nid, value); | 155 | ex = X509V3_EXT_conf_nid(NULL, NULL, nid, value); |
diff --git a/src/lib/libssl/src/doc/apps/CA.pl.pod b/src/lib/libssl/src/doc/apps/CA.pl.pod index ed69952f37..d326101cde 100644 --- a/src/lib/libssl/src/doc/apps/CA.pl.pod +++ b/src/lib/libssl/src/doc/apps/CA.pl.pod | |||
| @@ -39,13 +39,13 @@ prints a usage message. | |||
| 39 | 39 | ||
| 40 | =item B<-newcert> | 40 | =item B<-newcert> |
| 41 | 41 | ||
| 42 | creates a new self signed certificate. The private key and certificate are | 42 | creates a new self signed certificate. The private key is written to the file |
| 43 | written to the file "newreq.pem". | 43 | "newkey.pem" and the request written to the file "newreq.pem". |
| 44 | 44 | ||
| 45 | =item B<-newreq> | 45 | =item B<-newreq> |
| 46 | 46 | ||
| 47 | creates a new certificate request. The private key and request are | 47 | creates a new certificate request. The private key is written to the file |
| 48 | written to the file "newreq.pem". | 48 | "newkey.pem" and the request written to the file "newreq.pem". |
| 49 | 49 | ||
| 50 | =item B<-newreq-nodes> | 50 | =item B<-newreq-nodes> |
| 51 | 51 | ||
diff --git a/src/lib/libssl/src/doc/apps/config.pod b/src/lib/libssl/src/doc/apps/config.pod index ace34b62bd..25c5381b9d 100644 --- a/src/lib/libssl/src/doc/apps/config.pod +++ b/src/lib/libssl/src/doc/apps/config.pod | |||
| @@ -119,7 +119,7 @@ variable points to a section containing further ENGINE configuration | |||
| 119 | information. | 119 | information. |
| 120 | 120 | ||
| 121 | The section pointed to by B<engines> is a table of engine names (though see | 121 | The section pointed to by B<engines> is a table of engine names (though see |
| 122 | B<engine_id> below) and further sections containing configuration informations | 122 | B<engine_id> below) and further sections containing configuration information |
| 123 | specific to each ENGINE. | 123 | specific to each ENGINE. |
| 124 | 124 | ||
| 125 | Each ENGINE specific section is used to set default algorithms, load | 125 | Each ENGINE specific section is used to set default algorithms, load |
diff --git a/src/lib/libssl/src/doc/apps/crl.pod b/src/lib/libssl/src/doc/apps/crl.pod index a40c873b95..1ad76a5f8c 100644 --- a/src/lib/libssl/src/doc/apps/crl.pod +++ b/src/lib/libssl/src/doc/apps/crl.pod | |||
| @@ -62,6 +62,11 @@ don't output the encoded version of the CRL. | |||
| 62 | output a hash of the issuer name. This can be use to lookup CRLs in | 62 | output a hash of the issuer name. This can be use to lookup CRLs in |
| 63 | a directory by issuer name. | 63 | a directory by issuer name. |
| 64 | 64 | ||
| 65 | =item B<-hash_old> | ||
| 66 | |||
| 67 | outputs the "hash" of the CRL issuer name using the older algorithm | ||
| 68 | as used by OpenSSL versions before 1.0.0. | ||
| 69 | |||
| 65 | =item B<-issuer> | 70 | =item B<-issuer> |
| 66 | 71 | ||
| 67 | output the issuer name. | 72 | output the issuer name. |
diff --git a/src/lib/libssl/src/doc/apps/pkcs12.pod b/src/lib/libssl/src/doc/apps/pkcs12.pod index f69a5c5a4c..8e0d91798a 100644 --- a/src/lib/libssl/src/doc/apps/pkcs12.pod +++ b/src/lib/libssl/src/doc/apps/pkcs12.pod | |||
| @@ -67,7 +67,7 @@ by default. | |||
| 67 | The filename to write certificates and private keys to, standard output by | 67 | The filename to write certificates and private keys to, standard output by |
| 68 | default. They are all written in PEM format. | 68 | default. They are all written in PEM format. |
| 69 | 69 | ||
| 70 | =item B<-pass arg>, B<-passin arg> | 70 | =item B<-passin arg> |
| 71 | 71 | ||
| 72 | the PKCS#12 file (i.e. input file) password source. For more information about | 72 | the PKCS#12 file (i.e. input file) password source. For more information about |
| 73 | the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in | 73 | the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in |
| @@ -75,10 +75,15 @@ L<openssl(1)|openssl(1)>. | |||
| 75 | 75 | ||
| 76 | =item B<-passout arg> | 76 | =item B<-passout arg> |
| 77 | 77 | ||
| 78 | pass phrase source to encrypt any outputed private keys with. For more | 78 | pass phrase source to encrypt any outputted private keys with. For more |
| 79 | information about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section | 79 | information about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section |
| 80 | in L<openssl(1)|openssl(1)>. | 80 | in L<openssl(1)|openssl(1)>. |
| 81 | 81 | ||
| 82 | =item B<-password arg> | ||
| 83 | |||
| 84 | With -export, -password is equivalent to -passout. | ||
| 85 | Otherwise, -password is equivalent to -passin. | ||
| 86 | |||
| 82 | =item B<-noout> | 87 | =item B<-noout> |
| 83 | 88 | ||
| 84 | this option inhibits output of the keys and certificates to the output file | 89 | this option inhibits output of the keys and certificates to the output file |
diff --git a/src/lib/libssl/src/doc/apps/req.pod b/src/lib/libssl/src/doc/apps/req.pod index ff48bbdf28..0730d117b3 100644 --- a/src/lib/libssl/src/doc/apps/req.pod +++ b/src/lib/libssl/src/doc/apps/req.pod | |||
| @@ -303,7 +303,7 @@ Reverses effect of B<-asn1-kludge> | |||
| 303 | 303 | ||
| 304 | =item B<-newhdr> | 304 | =item B<-newhdr> |
| 305 | 305 | ||
| 306 | Adds the word B<NEW> to the PEM file header and footer lines on the outputed | 306 | Adds the word B<NEW> to the PEM file header and footer lines on the outputted |
| 307 | request. Some software (Netscape certificate server) and some CAs need this. | 307 | request. Some software (Netscape certificate server) and some CAs need this. |
| 308 | 308 | ||
| 309 | =item B<-batch> | 309 | =item B<-batch> |
diff --git a/src/lib/libssl/src/doc/apps/rsa.pod b/src/lib/libssl/src/doc/apps/rsa.pod index 69b2bef82c..d7d784d52b 100644 --- a/src/lib/libssl/src/doc/apps/rsa.pod +++ b/src/lib/libssl/src/doc/apps/rsa.pod | |||
| @@ -24,6 +24,8 @@ B<openssl> B<rsa> | |||
| 24 | [B<-check>] | 24 | [B<-check>] |
| 25 | [B<-pubin>] | 25 | [B<-pubin>] |
| 26 | [B<-pubout>] | 26 | [B<-pubout>] |
| 27 | [B<-RSAPublicKey_in>] | ||
| 28 | [B<-RSAPublicKey_out>] | ||
| 27 | [B<-engine id>] | 29 | [B<-engine id>] |
| 28 | 30 | ||
| 29 | =head1 DESCRIPTION | 31 | =head1 DESCRIPTION |
| @@ -118,6 +120,10 @@ by default a private key is output: with this option a public | |||
| 118 | key will be output instead. This option is automatically set if | 120 | key will be output instead. This option is automatically set if |
| 119 | the input is a public key. | 121 | the input is a public key. |
| 120 | 122 | ||
| 123 | =item B<-RSAPublicKey_in>, B<-RSAPublicKey_out> | ||
| 124 | |||
| 125 | like B<-pubin> and B<-pubout> except B<RSAPublicKey> format is used instead. | ||
| 126 | |||
| 121 | =item B<-engine id> | 127 | =item B<-engine id> |
| 122 | 128 | ||
| 123 | specifying an engine (by its unique B<id> string) will cause B<rsa> | 129 | specifying an engine (by its unique B<id> string) will cause B<rsa> |
| @@ -139,6 +145,11 @@ The PEM public key format uses the header and footer lines: | |||
| 139 | -----BEGIN PUBLIC KEY----- | 145 | -----BEGIN PUBLIC KEY----- |
| 140 | -----END PUBLIC KEY----- | 146 | -----END PUBLIC KEY----- |
| 141 | 147 | ||
| 148 | The PEM B<RSAPublicKey> format uses the header and footer lines: | ||
| 149 | |||
| 150 | -----BEGIN RSA PUBLIC KEY----- | ||
| 151 | -----END RSA PUBLIC KEY----- | ||
| 152 | |||
| 142 | The B<NET> form is a format compatible with older Netscape servers | 153 | The B<NET> form is a format compatible with older Netscape servers |
| 143 | and Microsoft IIS .key files, this uses unsalted RC4 for its encryption. | 154 | and Microsoft IIS .key files, this uses unsalted RC4 for its encryption. |
| 144 | It is not very secure and so should only be used when necessary. | 155 | It is not very secure and so should only be used when necessary. |
| @@ -173,6 +184,10 @@ To just output the public part of a private key: | |||
| 173 | 184 | ||
| 174 | openssl rsa -in key.pem -pubout -out pubkey.pem | 185 | openssl rsa -in key.pem -pubout -out pubkey.pem |
| 175 | 186 | ||
| 187 | Output the public part of a private key in B<RSAPublicKey> format: | ||
| 188 | |||
| 189 | openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem | ||
| 190 | |||
| 176 | =head1 BUGS | 191 | =head1 BUGS |
| 177 | 192 | ||
| 178 | The command line password arguments don't currently work with | 193 | The command line password arguments don't currently work with |
diff --git a/src/lib/libssl/src/doc/apps/s_client.pod b/src/lib/libssl/src/doc/apps/s_client.pod index 4ebf7b5854..3215b2e8c9 100644 --- a/src/lib/libssl/src/doc/apps/s_client.pod +++ b/src/lib/libssl/src/doc/apps/s_client.pod | |||
| @@ -10,6 +10,7 @@ s_client - SSL/TLS client program | |||
| 10 | B<openssl> B<s_client> | 10 | B<openssl> B<s_client> |
| 11 | [B<-connect host:port>] | 11 | [B<-connect host:port>] |
| 12 | [B<-verify depth>] | 12 | [B<-verify depth>] |
| 13 | [B<-verify_return_error>] | ||
| 13 | [B<-cert filename>] | 14 | [B<-cert filename>] |
| 14 | [B<-certform DER|PEM>] | 15 | [B<-certform DER|PEM>] |
| 15 | [B<-key filename>] | 16 | [B<-key filename>] |
| @@ -90,6 +91,11 @@ Currently the verify operation continues after errors so all the problems | |||
| 90 | with a certificate chain can be seen. As a side effect the connection | 91 | with a certificate chain can be seen. As a side effect the connection |
| 91 | will never fail due to a server certificate verify failure. | 92 | will never fail due to a server certificate verify failure. |
| 92 | 93 | ||
| 94 | =item B<-verify_return_error> | ||
| 95 | |||
| 96 | Return verification errors instead of continuing. This will typically | ||
| 97 | abort the handshake with a fatal error. | ||
| 98 | |||
| 93 | =item B<-CApath directory> | 99 | =item B<-CApath directory> |
| 94 | 100 | ||
| 95 | The directory to use for server certificate verification. This directory | 101 | The directory to use for server certificate verification. This directory |
| @@ -286,6 +292,13 @@ Since the SSLv23 client hello cannot include compression methods or extensions | |||
| 286 | these will only be supported if its use is disabled, for example by using the | 292 | these will only be supported if its use is disabled, for example by using the |
| 287 | B<-no_sslv2> option. | 293 | B<-no_sslv2> option. |
| 288 | 294 | ||
| 295 | The B<s_client> utility is a test tool and is designed to continue the | ||
| 296 | handshake after any certificate verification errors. As a result it will | ||
| 297 | accept any certificate chain (trusted or not) sent by the peer. None test | ||
| 298 | applications should B<not> do this as it makes them vulnerable to a MITM | ||
| 299 | attack. This behaviour can be changed by with the B<-verify_return_error> | ||
| 300 | option: any verify errors are then returned aborting the handshake. | ||
| 301 | |||
| 289 | =head1 BUGS | 302 | =head1 BUGS |
| 290 | 303 | ||
| 291 | Because this program has a lot of options and also because some of | 304 | Because this program has a lot of options and also because some of |
| @@ -293,9 +306,6 @@ the techniques used are rather old, the C source of s_client is rather | |||
| 293 | hard to read and not a model of how things should be done. A typical | 306 | hard to read and not a model of how things should be done. A typical |
| 294 | SSL client program would be much simpler. | 307 | SSL client program would be much simpler. |
| 295 | 308 | ||
| 296 | The B<-verify> option should really exit if the server verification | ||
| 297 | fails. | ||
| 298 | |||
| 299 | The B<-prexit> option is a bit of a hack. We should really report | 309 | The B<-prexit> option is a bit of a hack. We should really report |
| 300 | information whenever a session is renegotiated. | 310 | information whenever a session is renegotiated. |
| 301 | 311 | ||
diff --git a/src/lib/libssl/src/doc/apps/s_server.pod b/src/lib/libssl/src/doc/apps/s_server.pod index 3e503e17e1..6758ba3080 100644 --- a/src/lib/libssl/src/doc/apps/s_server.pod +++ b/src/lib/libssl/src/doc/apps/s_server.pod | |||
| @@ -111,7 +111,7 @@ by using an appropriate certificate. | |||
| 111 | 111 | ||
| 112 | =item B<-dcertform format>, B<-dkeyform format>, B<-dpass arg> | 112 | =item B<-dcertform format>, B<-dkeyform format>, B<-dpass arg> |
| 113 | 113 | ||
| 114 | addtional certificate and private key format and passphrase respectively. | 114 | additional certificate and private key format and passphrase respectively. |
| 115 | 115 | ||
| 116 | =item B<-nocert> | 116 | =item B<-nocert> |
| 117 | 117 | ||
diff --git a/src/lib/libssl/src/doc/apps/verify.pod b/src/lib/libssl/src/doc/apps/verify.pod index 336098f1e3..da683004bd 100644 --- a/src/lib/libssl/src/doc/apps/verify.pod +++ b/src/lib/libssl/src/doc/apps/verify.pod | |||
| @@ -54,35 +54,37 @@ in PEM format concatenated together. | |||
| 54 | =item B<-untrusted file> | 54 | =item B<-untrusted file> |
| 55 | 55 | ||
| 56 | A file of untrusted certificates. The file should contain multiple certificates | 56 | A file of untrusted certificates. The file should contain multiple certificates |
| 57 | in PEM format concatenated together. | ||
| 57 | 58 | ||
| 58 | =item B<-purpose purpose> | 59 | =item B<-purpose purpose> |
| 59 | 60 | ||
| 60 | the intended use for the certificate. Without this option no chain verification | 61 | The intended use for the certificate. If this option is not specified, |
| 61 | will be done. Currently accepted uses are B<sslclient>, B<sslserver>, | 62 | B<verify> will not consider certificate purpose during chain verification. |
| 62 | B<nssslserver>, B<smimesign>, B<smimeencrypt>. See the B<VERIFY OPERATION> | 63 | Currently accepted uses are B<sslclient>, B<sslserver>, B<nssslserver>, |
| 63 | section for more information. | 64 | B<smimesign>, B<smimeencrypt>. See the B<VERIFY OPERATION> section for more |
| 65 | information. | ||
| 64 | 66 | ||
| 65 | =item B<-help> | 67 | =item B<-help> |
| 66 | 68 | ||
| 67 | prints out a usage message. | 69 | Print out a usage message. |
| 68 | 70 | ||
| 69 | =item B<-verbose> | 71 | =item B<-verbose> |
| 70 | 72 | ||
| 71 | print extra information about the operations being performed. | 73 | Print extra information about the operations being performed. |
| 72 | 74 | ||
| 73 | =item B<-issuer_checks> | 75 | =item B<-issuer_checks> |
| 74 | 76 | ||
| 75 | print out diagnostics relating to searches for the issuer certificate | 77 | Print out diagnostics relating to searches for the issuer certificate of the |
| 76 | of the current certificate. This shows why each candidate issuer | 78 | current certificate. This shows why each candidate issuer certificate was |
| 77 | certificate was rejected. However the presence of rejection messages | 79 | rejected. The presence of rejection messages does not itself imply that |
| 78 | does not itself imply that anything is wrong: during the normal | 80 | anything is wrong; during the normal verification process, several |
| 79 | verify process several rejections may take place. | 81 | rejections may take place. |
| 80 | 82 | ||
| 81 | =item B<-policy arg> | 83 | =item B<-policy arg> |
| 82 | 84 | ||
| 83 | Enable policy processing and add B<arg> to the user-initial-policy-set | 85 | Enable policy processing and add B<arg> to the user-initial-policy-set (see |
| 84 | (see RFC3280 et al). The policy B<arg> can be an object name an OID in numeric | 86 | RFC5280). The policy B<arg> can be an object name an OID in numeric form. |
| 85 | form. This argument can appear more than once. | 87 | This argument can appear more than once. |
| 86 | 88 | ||
| 87 | =item B<-policy_check> | 89 | =item B<-policy_check> |
| 88 | 90 | ||
| @@ -90,41 +92,40 @@ Enables certificate policy processing. | |||
| 90 | 92 | ||
| 91 | =item B<-explicit_policy> | 93 | =item B<-explicit_policy> |
| 92 | 94 | ||
| 93 | Set policy variable require-explicit-policy (see RFC3280 et al). | 95 | Set policy variable require-explicit-policy (see RFC5280). |
| 94 | 96 | ||
| 95 | =item B<-inhibit_any> | 97 | =item B<-inhibit_any> |
| 96 | 98 | ||
| 97 | Set policy variable inhibit-any-policy (see RFC3280 et al). | 99 | Set policy variable inhibit-any-policy (see RFC5280). |
| 98 | 100 | ||
| 99 | =item B<-inhibit_map> | 101 | =item B<-inhibit_map> |
| 100 | 102 | ||
| 101 | Set policy variable inhibit-policy-mapping (see RFC3280 et al). | 103 | Set policy variable inhibit-policy-mapping (see RFC5280). |
| 102 | 104 | ||
| 103 | =item B<-policy_print> | 105 | =item B<-policy_print> |
| 104 | 106 | ||
| 105 | Print out diagnostics, related to policy checking | 107 | Print out diagnostics related to policy processing. |
| 106 | 108 | ||
| 107 | =item B<-crl_check> | 109 | =item B<-crl_check> |
| 108 | 110 | ||
| 109 | Checks end entity certificate validity by attempting to lookup a valid CRL. | 111 | Checks end entity certificate validity by attempting to look up a valid CRL. |
| 110 | If a valid CRL cannot be found an error occurs. | 112 | If a valid CRL cannot be found an error occurs. |
| 111 | 113 | ||
| 112 | =item B<-crl_check_all> | 114 | =item B<-crl_check_all> |
| 113 | 115 | ||
| 114 | Checks the validity of B<all> certificates in the chain by attempting | 116 | Checks the validity of B<all> certificates in the chain by attempting |
| 115 | to lookup valid CRLs. | 117 | to look up valid CRLs. |
| 116 | 118 | ||
| 117 | =item B<-ignore_critical> | 119 | =item B<-ignore_critical> |
| 118 | 120 | ||
| 119 | Normally if an unhandled critical extension is present which is not | 121 | Normally if an unhandled critical extension is present which is not |
| 120 | supported by OpenSSL the certificate is rejected (as required by | 122 | supported by OpenSSL the certificate is rejected (as required by RFC5280). |
| 121 | RFC3280 et al). If this option is set critical extensions are | 123 | If this option is set critical extensions are ignored. |
| 122 | ignored. | ||
| 123 | 124 | ||
| 124 | =item B<-x509_strict> | 125 | =item B<-x509_strict> |
| 125 | 126 | ||
| 126 | Disable workarounds for broken certificates which have to be disabled | 127 | For strict X.509 compliance, disable non-compliant workarounds for broken |
| 127 | for strict X.509 compliance. | 128 | certificates. |
| 128 | 129 | ||
| 129 | =item B<-extended_crl> | 130 | =item B<-extended_crl> |
| 130 | 131 | ||
| @@ -142,16 +143,15 @@ because it doesn't add any security. | |||
| 142 | 143 | ||
| 143 | =item B<-> | 144 | =item B<-> |
| 144 | 145 | ||
| 145 | marks the last option. All arguments following this are assumed to be | 146 | Indicates the last option. All arguments following this are assumed to be |
| 146 | certificate files. This is useful if the first certificate filename begins | 147 | certificate files. This is useful if the first certificate filename begins |
| 147 | with a B<->. | 148 | with a B<->. |
| 148 | 149 | ||
| 149 | =item B<certificates> | 150 | =item B<certificates> |
| 150 | 151 | ||
| 151 | one or more certificates to verify. If no certificate filenames are included | 152 | One or more certificates to verify. If no certificates are given, B<verify> |
| 152 | then an attempt is made to read a certificate from standard input. They should | 153 | will attempt to read a certificate from standard input. Certificates must be |
| 153 | all be in PEM format. | 154 | in PEM format. |
| 154 | |||
| 155 | 155 | ||
| 156 | =back | 156 | =back |
| 157 | 157 | ||
diff --git a/src/lib/libssl/src/doc/apps/x509.pod b/src/lib/libssl/src/doc/apps/x509.pod index 3002b08123..d2d9eb812a 100644 --- a/src/lib/libssl/src/doc/apps/x509.pod +++ b/src/lib/libssl/src/doc/apps/x509.pod | |||
| @@ -29,6 +29,7 @@ B<openssl> B<x509> | |||
| 29 | [B<-purpose>] | 29 | [B<-purpose>] |
| 30 | [B<-dates>] | 30 | [B<-dates>] |
| 31 | [B<-modulus>] | 31 | [B<-modulus>] |
| 32 | [B<-pubkey>] | ||
| 32 | [B<-fingerprint>] | 33 | [B<-fingerprint>] |
| 33 | [B<-alias>] | 34 | [B<-alias>] |
| 34 | [B<-noout>] | 35 | [B<-noout>] |
| @@ -135,6 +136,10 @@ section for more information. | |||
| 135 | 136 | ||
| 136 | this option prevents output of the encoded version of the request. | 137 | this option prevents output of the encoded version of the request. |
| 137 | 138 | ||
| 139 | =item B<-pubkey> | ||
| 140 | |||
| 141 | outputs the the certificate's SubjectPublicKeyInfo block in PEM format. | ||
| 142 | |||
| 138 | =item B<-modulus> | 143 | =item B<-modulus> |
| 139 | 144 | ||
| 140 | this option prints out the value of the modulus of the public key | 145 | this option prints out the value of the modulus of the public key |
diff --git a/src/lib/libssl/src/doc/crypto/ERR_get_error.pod b/src/lib/libssl/src/doc/crypto/ERR_get_error.pod index 34443045fc..828ecf529b 100644 --- a/src/lib/libssl/src/doc/crypto/ERR_get_error.pod +++ b/src/lib/libssl/src/doc/crypto/ERR_get_error.pod | |||
| @@ -52,8 +52,11 @@ ERR_get_error_line_data(), ERR_peek_error_line_data() and | |||
| 52 | ERR_get_last_error_line_data() store additional data and flags | 52 | ERR_get_last_error_line_data() store additional data and flags |
| 53 | associated with the error code in *B<data> | 53 | associated with the error code in *B<data> |
| 54 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string | 54 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string |
| 55 | if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by OPENSSL_malloc(), | 55 | if *B<flags>&B<ERR_TXT_STRING> is true. |
| 56 | *B<flags>&B<ERR_TXT_MALLOCED> is true. | 56 | |
| 57 | An application B<MUST NOT> free the *B<data> pointer (or any other pointers | ||
| 58 | returned by these functions) with OPENSSL_free() as freeing is handled | ||
| 59 | automatically by the error library. | ||
| 57 | 60 | ||
| 58 | =head1 RETURN VALUES | 61 | =head1 RETURN VALUES |
| 59 | 62 | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_BytesToKey.pod b/src/lib/libssl/src/doc/crypto/EVP_BytesToKey.pod index d375c46e03..0ea7d55c0f 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_BytesToKey.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_BytesToKey.pod | |||
| @@ -17,7 +17,7 @@ EVP_BytesToKey - password based encryption routine | |||
| 17 | 17 | ||
| 18 | EVP_BytesToKey() derives a key and IV from various parameters. B<type> is | 18 | EVP_BytesToKey() derives a key and IV from various parameters. B<type> is |
| 19 | the cipher to derive the key and IV for. B<md> is the message digest to use. | 19 | the cipher to derive the key and IV for. B<md> is the message digest to use. |
| 20 | The B<salt> paramter is used as a salt in the derivation: it should point to | 20 | The B<salt> parameter is used as a salt in the derivation: it should point to |
| 21 | an 8 byte buffer or NULL if no salt is used. B<data> is a buffer containing | 21 | an 8 byte buffer or NULL if no salt is used. B<data> is a buffer containing |
| 22 | B<datal> bytes which is used to derive the keying data. B<count> is the | 22 | B<datal> bytes which is used to derive the keying data. B<count> is the |
| 23 | iteration count to use. The derived key and IV will be written to B<key> | 23 | iteration count to use. The derived key and IV will be written to B<key> |
diff --git a/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod b/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod index 8271d3dfc4..1c4bf184a1 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod | |||
| @@ -152,7 +152,7 @@ does not remain in memory. | |||
| 152 | 152 | ||
| 153 | EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit() behave in a | 153 | EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit() behave in a |
| 154 | similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex and | 154 | similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex and |
| 155 | EVP_CipherInit_ex() except the B<ctx> paramter does not need to be | 155 | EVP_CipherInit_ex() except the B<ctx> parameter does not need to be |
| 156 | initialized and they always use the default cipher implementation. | 156 | initialized and they always use the default cipher implementation. |
| 157 | 157 | ||
| 158 | EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal() behave in a | 158 | EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal() behave in a |
diff --git a/src/lib/libssl/src/doc/crypto/pem.pod b/src/lib/libssl/src/doc/crypto/pem.pod index d5b1896119..54414a3f6f 100644 --- a/src/lib/libssl/src/doc/crypto/pem.pod +++ b/src/lib/libssl/src/doc/crypto/pem.pod | |||
| @@ -201,7 +201,7 @@ handle PKCS#8 format encrypted and unencrypted keys too. | |||
| 201 | PEM_write_bio_PKCS8PrivateKey() and PEM_write_PKCS8PrivateKey() | 201 | PEM_write_bio_PKCS8PrivateKey() and PEM_write_PKCS8PrivateKey() |
| 202 | write a private key in an EVP_PKEY structure in PKCS#8 | 202 | write a private key in an EVP_PKEY structure in PKCS#8 |
| 203 | EncryptedPrivateKeyInfo format using PKCS#5 v2.0 password based encryption | 203 | EncryptedPrivateKeyInfo format using PKCS#5 v2.0 password based encryption |
| 204 | algorithms. The B<cipher> argument specifies the encryption algoritm to | 204 | algorithms. The B<cipher> argument specifies the encryption algorithm to |
| 205 | use: unlike all other PEM routines the encryption is applied at the | 205 | use: unlike all other PEM routines the encryption is applied at the |
| 206 | PKCS#8 level and not in the PEM headers. If B<cipher> is NULL then no | 206 | PKCS#8 level and not in the PEM headers. If B<cipher> is NULL then no |
| 207 | encryption is used and a PKCS#8 PrivateKeyInfo structure is used instead. | 207 | encryption is used and a PKCS#8 PrivateKeyInfo structure is used instead. |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_CA_list.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_CA_list.pod index 632b556d12..5e6613335c 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_CA_list.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_CA_list.pod | |||
| @@ -66,16 +66,16 @@ values: | |||
| 66 | 66 | ||
| 67 | =over 4 | 67 | =over 4 |
| 68 | 68 | ||
| 69 | =item 1 | ||
| 70 | |||
| 71 | The operation succeeded. | ||
| 72 | |||
| 73 | =item 0 | 69 | =item 0 |
| 74 | 70 | ||
| 75 | A failure while manipulating the STACK_OF(X509_NAME) object occurred or | 71 | A failure while manipulating the STACK_OF(X509_NAME) object occurred or |
| 76 | the X509_NAME could not be extracted from B<cacert>. Check the error stack | 72 | the X509_NAME could not be extracted from B<cacert>. Check the error stack |
| 77 | to find out the reason. | 73 | to find out the reason. |
| 78 | 74 | ||
| 75 | =item 1 | ||
| 76 | |||
| 77 | The operation succeeded. | ||
| 78 | |||
| 79 | =back | 79 | =back |
| 80 | 80 | ||
| 81 | =head1 EXAMPLES | 81 | =head1 EXAMPLES |
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 cc588f3a78..fded0601b5 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 | |||
| @@ -88,9 +88,10 @@ As of OpenSSL 0.9.8q and 1.0.0c, this option has no effect. | |||
| 88 | 88 | ||
| 89 | ... | 89 | ... |
| 90 | 90 | ||
| 91 | =item SSL_OP_MSIE_SSLV2_RSA_PADDING | 91 | =item SSL_OP_SAFARI_ECDHE_ECDSA_BUG |
| 92 | 92 | ||
| 93 | As of OpenSSL 0.9.7h and 0.9.8a, this option has no effect. | 93 | Don't prefer ECDHE-ECDSA ciphers when the client appears to be Safari on OS X. |
| 94 | OS X 10.8..10.8.3 has broken support for ECDHE-ECDSA ciphers. | ||
| 94 | 95 | ||
| 95 | =item SSL_OP_SSLEAY_080_CLIENT_DH_BUG | 96 | =item SSL_OP_SSLEAY_080_CLIENT_DH_BUG |
| 96 | 97 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod index 81566839d3..6fd6c03215 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod | |||
| @@ -169,8 +169,8 @@ that will always continue the TLS/SSL handshake regardless of verification | |||
| 169 | failure, if wished. The callback realizes a verification depth limit with | 169 | failure, if wished. The callback realizes a verification depth limit with |
| 170 | more informational output. | 170 | more informational output. |
| 171 | 171 | ||
| 172 | All verification errors are printed, informations about the certificate chain | 172 | All verification errors are printed; information about the certificate chain |
| 173 | are printed on request. | 173 | is printed on request. |
| 174 | The example is realized for a server that does allow but not require client | 174 | The example is realized for a server that does allow but not require client |
| 175 | certificates. | 175 | certificates. |
| 176 | 176 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_accept.pod b/src/lib/libssl/src/doc/ssl/SSL_accept.pod index cc724c0d56..b1c34d15b6 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_accept.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_accept.pod | |||
| @@ -44,17 +44,17 @@ The following return values can occur: | |||
| 44 | 44 | ||
| 45 | =over 4 | 45 | =over 4 |
| 46 | 46 | ||
| 47 | =item 1 | ||
| 48 | |||
| 49 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
| 50 | established. | ||
| 51 | |||
| 52 | =item 0 | 47 | =item 0 |
| 53 | 48 | ||
| 54 | The TLS/SSL handshake was not successful but was shut down controlled and | 49 | The TLS/SSL handshake was not successful but was shut down controlled and |
| 55 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the | 50 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the |
| 56 | return value B<ret> to find out the reason. | 51 | return value B<ret> to find out the reason. |
| 57 | 52 | ||
| 53 | =item 1 | ||
| 54 | |||
| 55 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
| 56 | established. | ||
| 57 | |||
| 58 | =item E<lt>0 | 58 | =item E<lt>0 |
| 59 | 59 | ||
| 60 | The TLS/SSL handshake was not successful because a fatal error occurred either | 60 | The TLS/SSL handshake was not successful because a fatal error occurred either |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_connect.pod b/src/lib/libssl/src/doc/ssl/SSL_connect.pod index cc56ebb75f..946ca89d7b 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_connect.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_connect.pod | |||
| @@ -41,17 +41,17 @@ The following return values can occur: | |||
| 41 | 41 | ||
| 42 | =over 4 | 42 | =over 4 |
| 43 | 43 | ||
| 44 | =item 1 | ||
| 45 | |||
| 46 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
| 47 | established. | ||
| 48 | |||
| 49 | =item 0 | 44 | =item 0 |
| 50 | 45 | ||
| 51 | The TLS/SSL handshake was not successful but was shut down controlled and | 46 | The TLS/SSL handshake was not successful but was shut down controlled and |
| 52 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the | 47 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the |
| 53 | return value B<ret> to find out the reason. | 48 | return value B<ret> to find out the reason. |
| 54 | 49 | ||
| 50 | =item 1 | ||
| 51 | |||
| 52 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
| 53 | established. | ||
| 54 | |||
| 55 | =item E<lt>0 | 55 | =item E<lt>0 |
| 56 | 56 | ||
| 57 | The TLS/SSL handshake was not successful, because a fatal error occurred either | 57 | The TLS/SSL handshake was not successful, because a fatal error occurred either |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_do_handshake.pod b/src/lib/libssl/src/doc/ssl/SSL_do_handshake.pod index 243576451b..7f8cf249ec 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_do_handshake.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_do_handshake.pod | |||
| @@ -45,17 +45,17 @@ The following return values can occur: | |||
| 45 | 45 | ||
| 46 | =over 4 | 46 | =over 4 |
| 47 | 47 | ||
| 48 | =item 1 | ||
| 49 | |||
| 50 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
| 51 | established. | ||
| 52 | |||
| 53 | =item 0 | 48 | =item 0 |
| 54 | 49 | ||
| 55 | The TLS/SSL handshake was not successful but was shut down controlled and | 50 | The TLS/SSL handshake was not successful but was shut down controlled and |
| 56 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the | 51 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the |
| 57 | return value B<ret> to find out the reason. | 52 | return value B<ret> to find out the reason. |
| 58 | 53 | ||
| 54 | =item 1 | ||
| 55 | |||
| 56 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
| 57 | established. | ||
| 58 | |||
| 59 | =item E<lt>0 | 59 | =item E<lt>0 |
| 60 | 60 | ||
| 61 | The TLS/SSL handshake was not successful because a fatal error occurred either | 61 | The TLS/SSL handshake was not successful because a fatal error occurred either |
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 011a022a12..fe013085d3 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod | |||
| @@ -24,7 +24,7 @@ The shutdown state of an ssl connection is a bitmask of: | |||
| 24 | 24 | ||
| 25 | =over 4 | 25 | =over 4 |
| 26 | 26 | ||
| 27 | =item 0 | 27 | =item Z<>0 |
| 28 | 28 | ||
| 29 | No shutdown setting, yet. | 29 | No shutdown setting, yet. |
| 30 | 30 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod index 89911acbca..42a89b7c6b 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod | |||
| @@ -92,11 +92,6 @@ The following return values can occur: | |||
| 92 | 92 | ||
| 93 | =over 4 | 93 | =over 4 |
| 94 | 94 | ||
| 95 | =item 1 | ||
| 96 | |||
| 97 | The shutdown was successfully completed. The "close notify" alert was sent | ||
| 98 | and the peer's "close notify" alert was received. | ||
| 99 | |||
| 100 | =item 0 | 95 | =item 0 |
| 101 | 96 | ||
| 102 | The shutdown is not yet finished. Call SSL_shutdown() for a second time, | 97 | The shutdown is not yet finished. Call SSL_shutdown() for a second time, |
| @@ -104,6 +99,11 @@ if a bidirectional shutdown shall be performed. | |||
| 104 | The output of L<SSL_get_error(3)|SSL_get_error(3)> may be misleading, as an | 99 | The output of L<SSL_get_error(3)|SSL_get_error(3)> may be misleading, as an |
| 105 | erroneous SSL_ERROR_SYSCALL may be flagged even though no error occurred. | 100 | erroneous SSL_ERROR_SYSCALL may be flagged even though no error occurred. |
| 106 | 101 | ||
| 102 | =item 1 | ||
| 103 | |||
| 104 | The shutdown was successfully completed. The "close notify" alert was sent | ||
| 105 | and the peer's "close notify" alert was received. | ||
| 106 | |||
| 107 | =item -1 | 107 | =item -1 |
| 108 | 108 | ||
| 109 | The shutdown was not successful because a fatal error occurred either | 109 | The shutdown was not successful because a fatal error occurred either |
diff --git a/src/lib/libssl/src/e_os.h b/src/lib/libssl/src/e_os.h index 79c1392573..6a0aad1de7 100644 --- a/src/lib/libssl/src/e_os.h +++ b/src/lib/libssl/src/e_os.h | |||
| @@ -368,6 +368,13 @@ static unsigned int _strlen31(const char *str) | |||
| 368 | # define DEFAULT_HOME "C:" | 368 | # define DEFAULT_HOME "C:" |
| 369 | # endif | 369 | # endif |
| 370 | 370 | ||
| 371 | /* Avoid Windows 8 SDK GetVersion deprecated problems */ | ||
| 372 | #if defined(_MSC_VER) && _MSC_VER>=1800 | ||
| 373 | # define check_winnt() (1) | ||
| 374 | #else | ||
| 375 | # define check_winnt() (GetVersion() < 0x80000000) | ||
| 376 | #endif | ||
| 377 | |||
| 371 | #else /* The non-microsoft world */ | 378 | #else /* The non-microsoft world */ |
| 372 | 379 | ||
| 373 | # ifdef OPENSSL_SYS_VMS | 380 | # ifdef OPENSSL_SYS_VMS |
diff --git a/src/lib/libssl/src/openssl.spec b/src/lib/libssl/src/openssl.spec index 0d86222e43..44147ce64a 100644 --- a/src/lib/libssl/src/openssl.spec +++ b/src/lib/libssl/src/openssl.spec | |||
| @@ -1,8 +1,5 @@ | |||
| 1 | %define _unpackaged_files_terminate_build 0 | 1 | %define _unpackaged_files_terminate_build 0 |
| 2 | %define libmaj 1 | 2 | |
| 3 | %define libmin 0 | ||
| 4 | %define librel 1 | ||
| 5 | %define librev c | ||
| 6 | Release: 1 | 3 | Release: 1 |
| 7 | 4 | ||
| 8 | %define openssldir /var/ssl | 5 | %define openssldir /var/ssl |
| @@ -10,9 +7,9 @@ Release: 1 | |||
| 10 | Summary: Secure Sockets Layer and cryptography libraries and tools | 7 | Summary: Secure Sockets Layer and cryptography libraries and tools |
| 11 | Name: openssl | 8 | Name: openssl |
| 12 | #Version: %{libmaj}.%{libmin}.%{librel} | 9 | #Version: %{libmaj}.%{libmin}.%{librel} |
| 13 | Version: %{libmaj}.%{libmin}.%{librel}%{librev} | 10 | Version: 1.0.1g |
| 14 | Source0: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz | 11 | Source0: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz |
| 15 | Copyright: Freely distributable | 12 | License: OpenSSL |
| 16 | Group: System Environment/Libraries | 13 | Group: System Environment/Libraries |
| 17 | Provides: SSL | 14 | Provides: SSL |
| 18 | URL: http://www.openssl.org/ | 15 | URL: http://www.openssl.org/ |
diff --git a/src/lib/libssl/src/ssl/Makefile b/src/lib/libssl/src/ssl/Makefile index feaf3e358a..debe07405b 100644 --- a/src/lib/libssl/src/ssl/Makefile +++ b/src/lib/libssl/src/ssl/Makefile | |||
| @@ -22,7 +22,7 @@ LIB=$(TOP)/libssl.a | |||
| 22 | SHARED_LIB= libssl$(SHLIB_EXT) | 22 | SHARED_LIB= libssl$(SHLIB_EXT) |
| 23 | LIBSRC= \ | 23 | LIBSRC= \ |
| 24 | s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c \ | 24 | s2_meth.c s2_srvr.c s2_clnt.c s2_lib.c s2_enc.c s2_pkt.c \ |
| 25 | s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c \ | 25 | s3_meth.c s3_srvr.c s3_clnt.c s3_lib.c s3_enc.c s3_pkt.c s3_both.c s3_cbc.c \ |
| 26 | s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c \ | 26 | s23_meth.c s23_srvr.c s23_clnt.c s23_lib.c s23_pkt.c \ |
| 27 | t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c \ | 27 | t1_meth.c t1_srvr.c t1_clnt.c t1_lib.c t1_enc.c \ |
| 28 | d1_meth.c d1_srvr.c d1_clnt.c d1_lib.c d1_pkt.c \ | 28 | d1_meth.c d1_srvr.c d1_clnt.c d1_lib.c d1_pkt.c \ |
| @@ -33,7 +33,7 @@ LIBSRC= \ | |||
| 33 | bio_ssl.c ssl_err.c kssl.c tls_srp.c t1_reneg.c | 33 | bio_ssl.c ssl_err.c kssl.c tls_srp.c t1_reneg.c |
| 34 | LIBOBJ= \ | 34 | LIBOBJ= \ |
| 35 | s2_meth.o s2_srvr.o s2_clnt.o s2_lib.o s2_enc.o s2_pkt.o \ | 35 | s2_meth.o s2_srvr.o s2_clnt.o s2_lib.o s2_enc.o s2_pkt.o \ |
| 36 | s3_meth.o s3_srvr.o s3_clnt.o s3_lib.o s3_enc.o s3_pkt.o s3_both.o \ | 36 | s3_meth.o s3_srvr.o s3_clnt.o s3_lib.o s3_enc.o s3_pkt.o s3_both.o s3_cbc.o \ |
| 37 | s23_meth.o s23_srvr.o s23_clnt.o s23_lib.o s23_pkt.o \ | 37 | s23_meth.o s23_srvr.o s23_clnt.o s23_lib.o s23_pkt.o \ |
| 38 | t1_meth.o t1_srvr.o t1_clnt.o t1_lib.o t1_enc.o \ | 38 | t1_meth.o t1_srvr.o t1_clnt.o t1_lib.o t1_enc.o \ |
| 39 | d1_meth.o d1_srvr.o d1_clnt.o d1_lib.o d1_pkt.o \ | 39 | d1_meth.o d1_srvr.o d1_clnt.o d1_lib.o d1_pkt.o \ |
| @@ -547,6 +547,26 @@ s3_both.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h | |||
| 547 | s3_both.o: ../include/openssl/stack.h ../include/openssl/symhacks.h | 547 | s3_both.o: ../include/openssl/stack.h ../include/openssl/symhacks.h |
| 548 | s3_both.o: ../include/openssl/tls1.h ../include/openssl/x509.h | 548 | s3_both.o: ../include/openssl/tls1.h ../include/openssl/x509.h |
| 549 | s3_both.o: ../include/openssl/x509_vfy.h s3_both.c ssl_locl.h | 549 | s3_both.o: ../include/openssl/x509_vfy.h s3_both.c ssl_locl.h |
| 550 | s3_cbc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h | ||
| 551 | s3_cbc.o: ../include/openssl/buffer.h ../include/openssl/comp.h | ||
| 552 | s3_cbc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h | ||
| 553 | s3_cbc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h | ||
| 554 | s3_cbc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h | ||
| 555 | s3_cbc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h | ||
| 556 | s3_cbc.o: ../include/openssl/evp.h ../include/openssl/hmac.h | ||
| 557 | s3_cbc.o: ../include/openssl/kssl.h ../include/openssl/lhash.h | ||
| 558 | s3_cbc.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h | ||
| 559 | s3_cbc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h | ||
| 560 | s3_cbc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h | ||
| 561 | s3_cbc.o: ../include/openssl/pem.h ../include/openssl/pem2.h | ||
| 562 | s3_cbc.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h | ||
| 563 | s3_cbc.o: ../include/openssl/rsa.h ../include/openssl/safestack.h | ||
| 564 | s3_cbc.o: ../include/openssl/sha.h ../include/openssl/srtp.h | ||
| 565 | s3_cbc.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h | ||
| 566 | s3_cbc.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h | ||
| 567 | s3_cbc.o: ../include/openssl/stack.h ../include/openssl/symhacks.h | ||
| 568 | s3_cbc.o: ../include/openssl/tls1.h ../include/openssl/x509.h | ||
| 569 | s3_cbc.o: ../include/openssl/x509_vfy.h s3_cbc.c ssl_locl.h | ||
| 550 | s3_clnt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h | 570 | s3_clnt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h |
| 551 | s3_clnt.o: ../include/openssl/bn.h ../include/openssl/buffer.h | 571 | s3_clnt.o: ../include/openssl/bn.h ../include/openssl/buffer.h |
| 552 | s3_clnt.o: ../include/openssl/comp.h ../include/openssl/crypto.h | 572 | s3_clnt.o: ../include/openssl/comp.h ../include/openssl/crypto.h |
diff --git a/src/lib/libssl/src/ssl/kssl.h b/src/lib/libssl/src/ssl/kssl.h index 8242fd5eeb..e4df843073 100644 --- a/src/lib/libssl/src/ssl/kssl.h +++ b/src/lib/libssl/src/ssl/kssl.h | |||
| @@ -70,6 +70,15 @@ | |||
| 70 | #include <stdio.h> | 70 | #include <stdio.h> |
| 71 | #include <ctype.h> | 71 | #include <ctype.h> |
| 72 | #include <krb5.h> | 72 | #include <krb5.h> |
| 73 | #ifdef OPENSSL_SYS_WIN32 | ||
| 74 | /* These can sometimes get redefined indirectly by krb5 header files | ||
| 75 | * after they get undefed in ossl_typ.h | ||
| 76 | */ | ||
| 77 | #undef X509_NAME | ||
| 78 | #undef X509_EXTENSIONS | ||
| 79 | #undef OCSP_REQUEST | ||
| 80 | #undef OCSP_RESPONSE | ||
| 81 | #endif | ||
| 73 | 82 | ||
| 74 | #ifdef __cplusplus | 83 | #ifdef __cplusplus |
| 75 | extern "C" { | 84 | extern "C" { |
diff --git a/src/lib/libssl/src/ssl/s23_clnt.c b/src/lib/libssl/src/ssl/s23_clnt.c index 47673e740a..2b93c639dd 100644 --- a/src/lib/libssl/src/ssl/s23_clnt.c +++ b/src/lib/libssl/src/ssl/s23_clnt.c | |||
| @@ -269,12 +269,35 @@ static int ssl23_no_ssl2_ciphers(SSL *s) | |||
| 269 | return 1; | 269 | return 1; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | /* Fill a ClientRandom or ServerRandom field of length len. Returns <= 0 | ||
| 273 | * on failure, 1 on success. */ | ||
| 274 | int ssl_fill_hello_random(SSL *s, int server, unsigned char *result, int len) | ||
| 275 | { | ||
| 276 | int send_time = 0; | ||
| 277 | |||
| 278 | if (len < 4) | ||
| 279 | return 0; | ||
| 280 | if (server) | ||
| 281 | send_time = (s->mode & SSL_MODE_SEND_SERVERHELLO_TIME) != 0; | ||
| 282 | else | ||
| 283 | send_time = (s->mode & SSL_MODE_SEND_CLIENTHELLO_TIME) != 0; | ||
| 284 | if (send_time) | ||
| 285 | { | ||
| 286 | unsigned long Time = (unsigned long)time(NULL); | ||
| 287 | unsigned char *p = result; | ||
| 288 | l2n(Time, p); | ||
| 289 | return RAND_pseudo_bytes(p, len-4); | ||
| 290 | } | ||
| 291 | else | ||
| 292 | return RAND_pseudo_bytes(result, len); | ||
| 293 | } | ||
| 294 | |||
| 272 | static int ssl23_client_hello(SSL *s) | 295 | static int ssl23_client_hello(SSL *s) |
| 273 | { | 296 | { |
| 274 | unsigned char *buf; | 297 | unsigned char *buf; |
| 275 | unsigned char *p,*d; | 298 | unsigned char *p,*d; |
| 276 | int i,ch_len; | 299 | int i,ch_len; |
| 277 | unsigned long Time,l; | 300 | unsigned long l; |
| 278 | int ssl2_compat; | 301 | int ssl2_compat; |
| 279 | int version = 0, version_major, version_minor; | 302 | int version = 0, version_major, version_minor; |
| 280 | #ifndef OPENSSL_NO_COMP | 303 | #ifndef OPENSSL_NO_COMP |
| @@ -355,9 +378,7 @@ static int ssl23_client_hello(SSL *s) | |||
| 355 | #endif | 378 | #endif |
| 356 | 379 | ||
| 357 | p=s->s3->client_random; | 380 | p=s->s3->client_random; |
| 358 | Time=(unsigned long)time(NULL); /* Time */ | 381 | if (ssl_fill_hello_random(s, 0, p, SSL3_RANDOM_SIZE) <= 0) |
| 359 | l2n(Time,p); | ||
| 360 | if (RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0) | ||
| 361 | return -1; | 382 | return -1; |
| 362 | 383 | ||
| 363 | if (version == TLS1_2_VERSION) | 384 | if (version == TLS1_2_VERSION) |
diff --git a/src/lib/libssl/src/ssl/s2_clnt.c b/src/lib/libssl/src/ssl/s2_clnt.c index 00ac158f9b..03b6cf9673 100644 --- a/src/lib/libssl/src/ssl/s2_clnt.c +++ b/src/lib/libssl/src/ssl/s2_clnt.c | |||
| @@ -359,12 +359,14 @@ static int get_server_hello(SSL *s) | |||
| 359 | SSL_R_PEER_ERROR); | 359 | SSL_R_PEER_ERROR); |
| 360 | return(-1); | 360 | return(-1); |
| 361 | } | 361 | } |
| 362 | #ifdef __APPLE_CC__ | 362 | #if 0 |
| 363 | /* The Rhapsody 5.5 (a.k.a. MacOS X) compiler bug | ||
| 364 | * workaround. <appro@fy.chalmers.se> */ | ||
| 365 | s->hit=(i=*(p++))?1:0; | ||
| 366 | #else | ||
| 367 | s->hit=(*(p++))?1:0; | 363 | s->hit=(*(p++))?1:0; |
| 364 | /* Some [PPC?] compilers fail to increment p in above | ||
| 365 | statement, e.g. one provided with Rhapsody 5.5, but | ||
| 366 | most recent example XL C 11.1 for AIX, even without | ||
| 367 | optimization flag... */ | ||
| 368 | #else | ||
| 369 | s->hit=(*p)?1:0; p++; | ||
| 368 | #endif | 370 | #endif |
| 369 | s->s2->tmp.cert_type= *(p++); | 371 | s->s2->tmp.cert_type= *(p++); |
| 370 | n2s(p,i); | 372 | n2s(p,i); |
| @@ -937,7 +939,7 @@ static int get_server_verify(SSL *s) | |||
| 937 | s->msg_callback(0, s->version, 0, p, len, s, s->msg_callback_arg); /* SERVER-VERIFY */ | 939 | s->msg_callback(0, s->version, 0, p, len, s, s->msg_callback_arg); /* SERVER-VERIFY */ |
| 938 | p += 1; | 940 | p += 1; |
| 939 | 941 | ||
| 940 | if (memcmp(p,s->s2->challenge,s->s2->challenge_length) != 0) | 942 | if (CRYPTO_memcmp(p,s->s2->challenge,s->s2->challenge_length) != 0) |
| 941 | { | 943 | { |
| 942 | ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR); | 944 | ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR); |
| 943 | SSLerr(SSL_F_GET_SERVER_VERIFY,SSL_R_CHALLENGE_IS_DIFFERENT); | 945 | SSLerr(SSL_F_GET_SERVER_VERIFY,SSL_R_CHALLENGE_IS_DIFFERENT); |
diff --git a/src/lib/libssl/src/ssl/s2_pkt.c b/src/lib/libssl/src/ssl/s2_pkt.c index ac963b2d47..8bb6ab8baa 100644 --- a/src/lib/libssl/src/ssl/s2_pkt.c +++ b/src/lib/libssl/src/ssl/s2_pkt.c | |||
| @@ -269,8 +269,7 @@ static int ssl2_read_internal(SSL *s, void *buf, int len, int peek) | |||
| 269 | s->s2->ract_data_length-=mac_size; | 269 | s->s2->ract_data_length-=mac_size; |
| 270 | ssl2_mac(s,mac,0); | 270 | ssl2_mac(s,mac,0); |
| 271 | s->s2->ract_data_length-=s->s2->padding; | 271 | s->s2->ract_data_length-=s->s2->padding; |
| 272 | if ( (memcmp(mac,s->s2->mac_data, | 272 | if ( (CRYPTO_memcmp(mac,s->s2->mac_data,mac_size) != 0) || |
| 273 | (unsigned int)mac_size) != 0) || | ||
| 274 | (s->s2->rlength%EVP_CIPHER_CTX_block_size(s->enc_read_ctx) != 0)) | 273 | (s->s2->rlength%EVP_CIPHER_CTX_block_size(s->enc_read_ctx) != 0)) |
| 275 | { | 274 | { |
| 276 | SSLerr(SSL_F_SSL2_READ_INTERNAL,SSL_R_BAD_MAC_DECODE); | 275 | SSLerr(SSL_F_SSL2_READ_INTERNAL,SSL_R_BAD_MAC_DECODE); |
diff --git a/src/lib/libssl/src/ssl/s2_srvr.c b/src/lib/libssl/src/ssl/s2_srvr.c index bc885e8e7f..2cba426bb7 100644 --- a/src/lib/libssl/src/ssl/s2_srvr.c +++ b/src/lib/libssl/src/ssl/s2_srvr.c | |||
| @@ -1059,10 +1059,12 @@ static int request_certificate(SSL *s) | |||
| 1059 | EVP_PKEY *pkey=NULL; | 1059 | EVP_PKEY *pkey=NULL; |
| 1060 | 1060 | ||
| 1061 | EVP_MD_CTX_init(&ctx); | 1061 | EVP_MD_CTX_init(&ctx); |
| 1062 | EVP_VerifyInit_ex(&ctx,s->ctx->rsa_md5, NULL); | 1062 | if (!EVP_VerifyInit_ex(&ctx,s->ctx->rsa_md5, NULL) |
| 1063 | EVP_VerifyUpdate(&ctx,s->s2->key_material, | 1063 | || !EVP_VerifyUpdate(&ctx,s->s2->key_material, |
| 1064 | s->s2->key_material_length); | 1064 | s->s2->key_material_length) |
| 1065 | EVP_VerifyUpdate(&ctx,ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH); | 1065 | || !EVP_VerifyUpdate(&ctx,ccd, |
| 1066 | SSL2_MIN_CERT_CHALLENGE_LENGTH)) | ||
| 1067 | goto msg_end; | ||
| 1066 | 1068 | ||
| 1067 | i=i2d_X509(s->cert->pkeys[SSL_PKEY_RSA_ENC].x509,NULL); | 1069 | i=i2d_X509(s->cert->pkeys[SSL_PKEY_RSA_ENC].x509,NULL); |
| 1068 | buf2=OPENSSL_malloc((unsigned int)i); | 1070 | buf2=OPENSSL_malloc((unsigned int)i); |
| @@ -1073,7 +1075,11 @@ static int request_certificate(SSL *s) | |||
| 1073 | } | 1075 | } |
| 1074 | p2=buf2; | 1076 | p2=buf2; |
| 1075 | i=i2d_X509(s->cert->pkeys[SSL_PKEY_RSA_ENC].x509,&p2); | 1077 | i=i2d_X509(s->cert->pkeys[SSL_PKEY_RSA_ENC].x509,&p2); |
| 1076 | EVP_VerifyUpdate(&ctx,buf2,(unsigned int)i); | 1078 | if (!EVP_VerifyUpdate(&ctx,buf2,(unsigned int)i)) |
| 1079 | { | ||
| 1080 | OPENSSL_free(buf2); | ||
| 1081 | goto msg_end; | ||
| 1082 | } | ||
| 1077 | OPENSSL_free(buf2); | 1083 | OPENSSL_free(buf2); |
| 1078 | 1084 | ||
| 1079 | pkey=X509_get_pubkey(x509); | 1085 | pkey=X509_get_pubkey(x509); |
diff --git a/src/lib/libssl/src/ssl/s3_both.c b/src/lib/libssl/src/ssl/s3_both.c index b63460a56d..53b9390fdd 100644 --- a/src/lib/libssl/src/ssl/s3_both.c +++ b/src/lib/libssl/src/ssl/s3_both.c | |||
| @@ -161,6 +161,8 @@ int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen) | |||
| 161 | 161 | ||
| 162 | i=s->method->ssl3_enc->final_finish_mac(s, | 162 | i=s->method->ssl3_enc->final_finish_mac(s, |
| 163 | sender,slen,s->s3->tmp.finish_md); | 163 | sender,slen,s->s3->tmp.finish_md); |
| 164 | if (i == 0) | ||
| 165 | return 0; | ||
| 164 | s->s3->tmp.finish_md_len = i; | 166 | s->s3->tmp.finish_md_len = i; |
| 165 | memcpy(p, s->s3->tmp.finish_md, i); | 167 | memcpy(p, s->s3->tmp.finish_md, i); |
| 166 | p+=i; | 168 | p+=i; |
| @@ -204,10 +206,15 @@ int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen) | |||
| 204 | 206 | ||
| 205 | #ifndef OPENSSL_NO_NEXTPROTONEG | 207 | #ifndef OPENSSL_NO_NEXTPROTONEG |
| 206 | /* ssl3_take_mac calculates the Finished MAC for the handshakes messages seen to far. */ | 208 | /* ssl3_take_mac calculates the Finished MAC for the handshakes messages seen to far. */ |
| 207 | static void ssl3_take_mac(SSL *s) { | 209 | static void ssl3_take_mac(SSL *s) |
| 210 | { | ||
| 208 | const char *sender; | 211 | const char *sender; |
| 209 | int slen; | 212 | int slen; |
| 210 | 213 | /* If no new cipher setup return immediately: other functions will | |
| 214 | * set the appropriate error. | ||
| 215 | */ | ||
| 216 | if (s->s3->tmp.new_cipher == NULL) | ||
| 217 | return; | ||
| 211 | if (s->state & SSL_ST_CONNECT) | 218 | if (s->state & SSL_ST_CONNECT) |
| 212 | { | 219 | { |
| 213 | sender=s->method->ssl3_enc->server_finished_label; | 220 | sender=s->method->ssl3_enc->server_finished_label; |
| @@ -221,7 +228,7 @@ static void ssl3_take_mac(SSL *s) { | |||
| 221 | 228 | ||
| 222 | s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s, | 229 | s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s, |
| 223 | sender,slen,s->s3->tmp.peer_finish_md); | 230 | sender,slen,s->s3->tmp.peer_finish_md); |
| 224 | } | 231 | } |
| 225 | #endif | 232 | #endif |
| 226 | 233 | ||
| 227 | int ssl3_get_finished(SSL *s, int a, int b) | 234 | int ssl3_get_finished(SSL *s, int a, int b) |
| @@ -231,8 +238,9 @@ int ssl3_get_finished(SSL *s, int a, int b) | |||
| 231 | unsigned char *p; | 238 | unsigned char *p; |
| 232 | 239 | ||
| 233 | #ifdef OPENSSL_NO_NEXTPROTONEG | 240 | #ifdef OPENSSL_NO_NEXTPROTONEG |
| 234 | /* the mac has already been generated when we received the change | 241 | /* the mac has already been generated when we received the |
| 235 | * cipher spec message and is in s->s3->tmp.peer_finish_md. */ | 242 | * change cipher spec message and is in s->s3->tmp.peer_finish_md. |
| 243 | */ | ||
| 236 | #endif | 244 | #endif |
| 237 | 245 | ||
| 238 | n=s->method->ssl_get_message(s, | 246 | n=s->method->ssl_get_message(s, |
| @@ -263,7 +271,7 @@ int ssl3_get_finished(SSL *s, int a, int b) | |||
| 263 | goto f_err; | 271 | goto f_err; |
| 264 | } | 272 | } |
| 265 | 273 | ||
| 266 | if (memcmp(p, s->s3->tmp.peer_finish_md, i) != 0) | 274 | if (CRYPTO_memcmp(p, s->s3->tmp.peer_finish_md, i) != 0) |
| 267 | { | 275 | { |
| 268 | al=SSL_AD_DECRYPT_ERROR; | 276 | al=SSL_AD_DECRYPT_ERROR; |
| 269 | SSLerr(SSL_F_SSL3_GET_FINISHED,SSL_R_DIGEST_CHECK_FAILED); | 277 | SSLerr(SSL_F_SSL3_GET_FINISHED,SSL_R_DIGEST_CHECK_FAILED); |
| @@ -537,12 +545,14 @@ long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) | |||
| 537 | s->init_num += i; | 545 | s->init_num += i; |
| 538 | n -= i; | 546 | n -= i; |
| 539 | } | 547 | } |
| 548 | |||
| 540 | #ifndef OPENSSL_NO_NEXTPROTONEG | 549 | #ifndef OPENSSL_NO_NEXTPROTONEG |
| 541 | /* If receiving Finished, record MAC of prior handshake messages for | 550 | /* If receiving Finished, record MAC of prior handshake messages for |
| 542 | * Finished verification. */ | 551 | * Finished verification. */ |
| 543 | if (*s->init_buf->data == SSL3_MT_FINISHED) | 552 | if (*s->init_buf->data == SSL3_MT_FINISHED) |
| 544 | ssl3_take_mac(s); | 553 | ssl3_take_mac(s); |
| 545 | #endif | 554 | #endif |
| 555 | |||
| 546 | /* Feed this message into MAC computation. */ | 556 | /* Feed this message into MAC computation. */ |
| 547 | ssl3_finish_mac(s, (unsigned char *)s->init_buf->data, s->init_num + 4); | 557 | ssl3_finish_mac(s, (unsigned char *)s->init_buf->data, s->init_num + 4); |
| 548 | if (s->msg_callback) | 558 | if (s->msg_callback) |
diff --git a/src/lib/libssl/src/ssl/s3_clnt.c b/src/lib/libssl/src/ssl/s3_clnt.c index b80d052e1f..a6b3c01afa 100644 --- a/src/lib/libssl/src/ssl/s3_clnt.c +++ b/src/lib/libssl/src/ssl/s3_clnt.c | |||
| @@ -459,7 +459,6 @@ int ssl3_connect(SSL *s) | |||
| 459 | SSL3_ST_CW_CHANGE_A,SSL3_ST_CW_CHANGE_B); | 459 | SSL3_ST_CW_CHANGE_A,SSL3_ST_CW_CHANGE_B); |
| 460 | if (ret <= 0) goto end; | 460 | if (ret <= 0) goto end; |
| 461 | 461 | ||
| 462 | |||
| 463 | #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) | 462 | #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) |
| 464 | s->state=SSL3_ST_CW_FINISHED_A; | 463 | s->state=SSL3_ST_CW_FINISHED_A; |
| 465 | #else | 464 | #else |
| @@ -656,7 +655,7 @@ int ssl3_client_hello(SSL *s) | |||
| 656 | unsigned char *buf; | 655 | unsigned char *buf; |
| 657 | unsigned char *p,*d; | 656 | unsigned char *p,*d; |
| 658 | int i; | 657 | int i; |
| 659 | unsigned long Time,l; | 658 | unsigned long l; |
| 660 | #ifndef OPENSSL_NO_COMP | 659 | #ifndef OPENSSL_NO_COMP |
| 661 | int j; | 660 | int j; |
| 662 | SSL_COMP *comp; | 661 | SSL_COMP *comp; |
| @@ -681,9 +680,8 @@ int ssl3_client_hello(SSL *s) | |||
| 681 | /* else use the pre-loaded session */ | 680 | /* else use the pre-loaded session */ |
| 682 | 681 | ||
| 683 | p=s->s3->client_random; | 682 | p=s->s3->client_random; |
| 684 | Time=(unsigned long)time(NULL); /* Time */ | 683 | |
| 685 | l2n(Time,p); | 684 | if (ssl_fill_hello_random(s, 0, p, SSL3_RANDOM_SIZE) <= 0) |
| 686 | if (RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0) | ||
| 687 | goto err; | 685 | goto err; |
| 688 | 686 | ||
| 689 | /* Do the message type and length last */ | 687 | /* Do the message type and length last */ |
| @@ -987,7 +985,10 @@ int ssl3_get_server_hello(SSL *s) | |||
| 987 | * client authentication. | 985 | * client authentication. |
| 988 | */ | 986 | */ |
| 989 | if (TLS1_get_version(s) < TLS1_2_VERSION && !ssl3_digest_cached_records(s)) | 987 | if (TLS1_get_version(s) < TLS1_2_VERSION && !ssl3_digest_cached_records(s)) |
| 988 | { | ||
| 989 | al = SSL_AD_INTERNAL_ERROR; | ||
| 990 | goto f_err; | 990 | goto f_err; |
| 991 | } | ||
| 991 | /* lets get the compression algorithm */ | 992 | /* lets get the compression algorithm */ |
| 992 | /* COMPRESSION */ | 993 | /* COMPRESSION */ |
| 993 | #ifdef OPENSSL_NO_COMP | 994 | #ifdef OPENSSL_NO_COMP |
diff --git a/src/lib/libssl/src/ssl/s3_enc.c b/src/lib/libssl/src/ssl/s3_enc.c index c5df2cb90a..e3cd4f062c 100644 --- a/src/lib/libssl/src/ssl/s3_enc.c +++ b/src/lib/libssl/src/ssl/s3_enc.c | |||
| @@ -466,12 +466,21 @@ void ssl3_cleanup_key_block(SSL *s) | |||
| 466 | s->s3->tmp.key_block_length=0; | 466 | s->s3->tmp.key_block_length=0; |
| 467 | } | 467 | } |
| 468 | 468 | ||
| 469 | /* ssl3_enc encrypts/decrypts the record in |s->wrec| / |s->rrec|, respectively. | ||
| 470 | * | ||
| 471 | * Returns: | ||
| 472 | * 0: (in non-constant time) if the record is publically invalid (i.e. too | ||
| 473 | * short etc). | ||
| 474 | * 1: if the record's padding is valid / the encryption was successful. | ||
| 475 | * -1: if the record's padding is invalid or, if sending, an internal error | ||
| 476 | * occured. | ||
| 477 | */ | ||
| 469 | int ssl3_enc(SSL *s, int send) | 478 | int ssl3_enc(SSL *s, int send) |
| 470 | { | 479 | { |
| 471 | SSL3_RECORD *rec; | 480 | SSL3_RECORD *rec; |
| 472 | EVP_CIPHER_CTX *ds; | 481 | EVP_CIPHER_CTX *ds; |
| 473 | unsigned long l; | 482 | unsigned long l; |
| 474 | int bs,i; | 483 | int bs,i,mac_size=0; |
| 475 | const EVP_CIPHER *enc; | 484 | const EVP_CIPHER *enc; |
| 476 | 485 | ||
| 477 | if (send) | 486 | if (send) |
| @@ -522,32 +531,16 @@ int ssl3_enc(SSL *s, int send) | |||
| 522 | if (!send) | 531 | if (!send) |
| 523 | { | 532 | { |
| 524 | if (l == 0 || l%bs != 0) | 533 | if (l == 0 || l%bs != 0) |
| 525 | { | ||
| 526 | SSLerr(SSL_F_SSL3_ENC,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG); | ||
| 527 | ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECRYPTION_FAILED); | ||
| 528 | return 0; | 534 | return 0; |
| 529 | } | ||
| 530 | /* otherwise, rec->length >= bs */ | 535 | /* otherwise, rec->length >= bs */ |
| 531 | } | 536 | } |
| 532 | 537 | ||
| 533 | EVP_Cipher(ds,rec->data,rec->input,l); | 538 | EVP_Cipher(ds,rec->data,rec->input,l); |
| 534 | 539 | ||
| 540 | if (EVP_MD_CTX_md(s->read_hash) != NULL) | ||
| 541 | mac_size = EVP_MD_CTX_size(s->read_hash); | ||
| 535 | if ((bs != 1) && !send) | 542 | if ((bs != 1) && !send) |
| 536 | { | 543 | return ssl3_cbc_remove_padding(s, rec, bs, mac_size); |
| 537 | i=rec->data[l-1]+1; | ||
| 538 | /* SSL 3.0 bounds the number of padding bytes by the block size; | ||
| 539 | * padding bytes (except the last one) are arbitrary */ | ||
| 540 | if (i > bs) | ||
| 541 | { | ||
| 542 | /* Incorrect padding. SSLerr() and ssl3_alert are done | ||
| 543 | * by caller: we don't want to reveal whether this is | ||
| 544 | * a decryption error or a MAC verification failure | ||
| 545 | * (see http://www.openssl.org/~bodo/tls-cbc.txt) */ | ||
| 546 | return -1; | ||
| 547 | } | ||
| 548 | /* now i <= bs <= rec->length */ | ||
| 549 | rec->length-=i; | ||
| 550 | } | ||
| 551 | } | 544 | } |
| 552 | return(1); | 545 | return(1); |
| 553 | } | 546 | } |
| @@ -716,7 +709,7 @@ int n_ssl3_mac(SSL *ssl, unsigned char *md, int send) | |||
| 716 | EVP_MD_CTX md_ctx; | 709 | EVP_MD_CTX md_ctx; |
| 717 | const EVP_MD_CTX *hash; | 710 | const EVP_MD_CTX *hash; |
| 718 | unsigned char *p,rec_char; | 711 | unsigned char *p,rec_char; |
| 719 | unsigned int md_size; | 712 | size_t md_size, orig_len; |
| 720 | int npad; | 713 | int npad; |
| 721 | int t; | 714 | int t; |
| 722 | 715 | ||
| @@ -741,28 +734,72 @@ int n_ssl3_mac(SSL *ssl, unsigned char *md, int send) | |||
| 741 | md_size=t; | 734 | md_size=t; |
| 742 | npad=(48/md_size)*md_size; | 735 | npad=(48/md_size)*md_size; |
| 743 | 736 | ||
| 744 | /* Chop the digest off the end :-) */ | 737 | /* kludge: ssl3_cbc_remove_padding passes padding length in rec->type */ |
| 745 | EVP_MD_CTX_init(&md_ctx); | 738 | orig_len = rec->length+md_size+((unsigned int)rec->type>>8); |
| 746 | 739 | rec->type &= 0xff; | |
| 747 | EVP_MD_CTX_copy_ex( &md_ctx,hash); | 740 | |
| 748 | EVP_DigestUpdate(&md_ctx,mac_sec,md_size); | 741 | if (!send && |
| 749 | EVP_DigestUpdate(&md_ctx,ssl3_pad_1,npad); | 742 | EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE && |
| 750 | EVP_DigestUpdate(&md_ctx,seq,8); | 743 | ssl3_cbc_record_digest_supported(hash)) |
| 751 | rec_char=rec->type; | 744 | { |
| 752 | EVP_DigestUpdate(&md_ctx,&rec_char,1); | 745 | /* This is a CBC-encrypted record. We must avoid leaking any |
| 753 | p=md; | 746 | * timing-side channel information about how many blocks of |
| 754 | s2n(rec->length,p); | 747 | * data we are hashing because that gives an attacker a |
| 755 | EVP_DigestUpdate(&md_ctx,md,2); | 748 | * timing-oracle. */ |
| 756 | EVP_DigestUpdate(&md_ctx,rec->input,rec->length); | 749 | |
| 757 | EVP_DigestFinal_ex( &md_ctx,md,NULL); | 750 | /* npad is, at most, 48 bytes and that's with MD5: |
| 758 | 751 | * 16 + 48 + 8 (sequence bytes) + 1 + 2 = 75. | |
| 759 | EVP_MD_CTX_copy_ex( &md_ctx,hash); | 752 | * |
| 760 | EVP_DigestUpdate(&md_ctx,mac_sec,md_size); | 753 | * With SHA-1 (the largest hash speced for SSLv3) the hash size |
| 761 | EVP_DigestUpdate(&md_ctx,ssl3_pad_2,npad); | 754 | * goes up 4, but npad goes down by 8, resulting in a smaller |
| 762 | EVP_DigestUpdate(&md_ctx,md,md_size); | 755 | * total size. */ |
| 763 | EVP_DigestFinal_ex( &md_ctx,md,&md_size); | 756 | unsigned char header[75]; |
| 764 | 757 | unsigned j = 0; | |
| 765 | EVP_MD_CTX_cleanup(&md_ctx); | 758 | memcpy(header+j, mac_sec, md_size); |
| 759 | j += md_size; | ||
| 760 | memcpy(header+j, ssl3_pad_1, npad); | ||
| 761 | j += npad; | ||
| 762 | memcpy(header+j, seq, 8); | ||
| 763 | j += 8; | ||
| 764 | header[j++] = rec->type; | ||
| 765 | header[j++] = rec->length >> 8; | ||
| 766 | header[j++] = rec->length & 0xff; | ||
| 767 | |||
| 768 | ssl3_cbc_digest_record( | ||
| 769 | hash, | ||
| 770 | md, &md_size, | ||
| 771 | header, rec->input, | ||
| 772 | rec->length + md_size, orig_len, | ||
| 773 | mac_sec, md_size, | ||
| 774 | 1 /* is SSLv3 */); | ||
| 775 | } | ||
| 776 | else | ||
| 777 | { | ||
| 778 | unsigned int md_size_u; | ||
| 779 | /* Chop the digest off the end :-) */ | ||
| 780 | EVP_MD_CTX_init(&md_ctx); | ||
| 781 | |||
| 782 | EVP_MD_CTX_copy_ex( &md_ctx,hash); | ||
| 783 | EVP_DigestUpdate(&md_ctx,mac_sec,md_size); | ||
| 784 | EVP_DigestUpdate(&md_ctx,ssl3_pad_1,npad); | ||
| 785 | EVP_DigestUpdate(&md_ctx,seq,8); | ||
| 786 | rec_char=rec->type; | ||
| 787 | EVP_DigestUpdate(&md_ctx,&rec_char,1); | ||
| 788 | p=md; | ||
| 789 | s2n(rec->length,p); | ||
| 790 | EVP_DigestUpdate(&md_ctx,md,2); | ||
| 791 | EVP_DigestUpdate(&md_ctx,rec->input,rec->length); | ||
| 792 | EVP_DigestFinal_ex( &md_ctx,md,NULL); | ||
| 793 | |||
| 794 | EVP_MD_CTX_copy_ex( &md_ctx,hash); | ||
| 795 | EVP_DigestUpdate(&md_ctx,mac_sec,md_size); | ||
| 796 | EVP_DigestUpdate(&md_ctx,ssl3_pad_2,npad); | ||
| 797 | EVP_DigestUpdate(&md_ctx,md,md_size); | ||
| 798 | EVP_DigestFinal_ex( &md_ctx,md,&md_size_u); | ||
| 799 | md_size = md_size_u; | ||
| 800 | |||
| 801 | EVP_MD_CTX_cleanup(&md_ctx); | ||
| 802 | } | ||
| 766 | 803 | ||
| 767 | ssl3_record_sequence_update(seq); | 804 | ssl3_record_sequence_update(seq); |
| 768 | return(md_size); | 805 | return(md_size); |
diff --git a/src/lib/libssl/src/ssl/s3_lib.c b/src/lib/libssl/src/ssl/s3_lib.c index fb60cde8ee..c4ef2738d7 100644 --- a/src/lib/libssl/src/ssl/s3_lib.c +++ b/src/lib/libssl/src/ssl/s3_lib.c | |||
| @@ -1125,7 +1125,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 1125 | 0, /* not implemented (non-ephemeral DH) */ | 1125 | 0, /* not implemented (non-ephemeral DH) */ |
| 1126 | TLS1_TXT_DH_DSS_WITH_AES_128_SHA256, | 1126 | TLS1_TXT_DH_DSS_WITH_AES_128_SHA256, |
| 1127 | TLS1_CK_DH_DSS_WITH_AES_128_SHA256, | 1127 | TLS1_CK_DH_DSS_WITH_AES_128_SHA256, |
| 1128 | SSL_kDHr, | 1128 | SSL_kDHd, |
| 1129 | SSL_aDH, | 1129 | SSL_aDH, |
| 1130 | SSL_AES128, | 1130 | SSL_AES128, |
| 1131 | SSL_SHA256, | 1131 | SSL_SHA256, |
| @@ -1407,7 +1407,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 1407 | 0, /* not implemented (non-ephemeral DH) */ | 1407 | 0, /* not implemented (non-ephemeral DH) */ |
| 1408 | TLS1_TXT_DH_DSS_WITH_AES_256_SHA256, | 1408 | TLS1_TXT_DH_DSS_WITH_AES_256_SHA256, |
| 1409 | TLS1_CK_DH_DSS_WITH_AES_256_SHA256, | 1409 | TLS1_CK_DH_DSS_WITH_AES_256_SHA256, |
| 1410 | SSL_kDHr, | 1410 | SSL_kDHd, |
| 1411 | SSL_aDH, | 1411 | SSL_aDH, |
| 1412 | SSL_AES256, | 1412 | SSL_AES256, |
| 1413 | SSL_SHA256, | 1413 | SSL_SHA256, |
| @@ -1683,7 +1683,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 1683 | SSL_3DES, | 1683 | SSL_3DES, |
| 1684 | SSL_SHA1, | 1684 | SSL_SHA1, |
| 1685 | SSL_TLSV1, | 1685 | SSL_TLSV1, |
| 1686 | SSL_NOT_EXP|SSL_HIGH, | 1686 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
| 1687 | SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF, | 1687 | SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF, |
| 1688 | 168, | 1688 | 168, |
| 1689 | 168, | 1689 | 168, |
| @@ -1699,7 +1699,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 1699 | SSL_AES128, | 1699 | SSL_AES128, |
| 1700 | SSL_SHA1, | 1700 | SSL_SHA1, |
| 1701 | SSL_TLSV1, | 1701 | SSL_TLSV1, |
| 1702 | SSL_NOT_EXP|SSL_HIGH, | 1702 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
| 1703 | SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF, | 1703 | SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF, |
| 1704 | 128, | 1704 | 128, |
| 1705 | 128, | 1705 | 128, |
| @@ -1715,7 +1715,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 1715 | SSL_AES256, | 1715 | SSL_AES256, |
| 1716 | SSL_SHA1, | 1716 | SSL_SHA1, |
| 1717 | SSL_TLSV1, | 1717 | SSL_TLSV1, |
| 1718 | SSL_NOT_EXP|SSL_HIGH, | 1718 | SSL_NOT_EXP|SSL_HIGH|SSL_FIPS, |
| 1719 | SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF, | 1719 | SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF, |
| 1720 | 256, | 1720 | 256, |
| 1721 | 256, | 1721 | 256, |
| @@ -1958,7 +1958,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 1958 | 0, | 1958 | 0, |
| 1959 | TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256, | 1959 | TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256, |
| 1960 | TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256, | 1960 | TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256, |
| 1961 | SSL_kDHr, | 1961 | SSL_kDHd, |
| 1962 | SSL_aDH, | 1962 | SSL_aDH, |
| 1963 | SSL_AES128GCM, | 1963 | SSL_AES128GCM, |
| 1964 | SSL_AEAD, | 1964 | SSL_AEAD, |
| @@ -1974,7 +1974,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 1974 | 0, | 1974 | 0, |
| 1975 | TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384, | 1975 | TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384, |
| 1976 | TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384, | 1976 | TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384, |
| 1977 | SSL_kDHr, | 1977 | SSL_kDHd, |
| 1978 | SSL_aDH, | 1978 | SSL_aDH, |
| 1979 | SSL_AES256GCM, | 1979 | SSL_AES256GCM, |
| 1980 | SSL_AEAD, | 1980 | SSL_AEAD, |
| @@ -2669,7 +2669,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 2669 | 1, | 2669 | 1, |
| 2670 | TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256, | 2670 | TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256, |
| 2671 | TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256, | 2671 | TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256, |
| 2672 | SSL_kECDHe, | 2672 | SSL_kECDHr, |
| 2673 | SSL_aECDH, | 2673 | SSL_aECDH, |
| 2674 | SSL_AES128, | 2674 | SSL_AES128, |
| 2675 | SSL_SHA256, | 2675 | SSL_SHA256, |
| @@ -2685,7 +2685,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 2685 | 1, | 2685 | 1, |
| 2686 | TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384, | 2686 | TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384, |
| 2687 | TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384, | 2687 | TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384, |
| 2688 | SSL_kECDHe, | 2688 | SSL_kECDHr, |
| 2689 | SSL_aECDH, | 2689 | SSL_aECDH, |
| 2690 | SSL_AES256, | 2690 | SSL_AES256, |
| 2691 | SSL_SHA384, | 2691 | SSL_SHA384, |
| @@ -2799,7 +2799,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 2799 | 1, | 2799 | 1, |
| 2800 | TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256, | 2800 | TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256, |
| 2801 | TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256, | 2801 | TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256, |
| 2802 | SSL_kECDHe, | 2802 | SSL_kECDHr, |
| 2803 | SSL_aECDH, | 2803 | SSL_aECDH, |
| 2804 | SSL_AES128GCM, | 2804 | SSL_AES128GCM, |
| 2805 | SSL_AEAD, | 2805 | SSL_AEAD, |
| @@ -2815,7 +2815,7 @@ OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={ | |||
| 2815 | 1, | 2815 | 1, |
| 2816 | TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384, | 2816 | TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384, |
| 2817 | TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384, | 2817 | TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384, |
| 2818 | SSL_kECDHe, | 2818 | SSL_kECDHr, |
| 2819 | SSL_aECDH, | 2819 | SSL_aECDH, |
| 2820 | SSL_AES256GCM, | 2820 | SSL_AES256GCM, |
| 2821 | SSL_AEAD, | 2821 | SSL_AEAD, |
| @@ -3037,6 +3037,11 @@ void ssl3_clear(SSL *s) | |||
| 3037 | s->s3->tmp.ecdh = NULL; | 3037 | s->s3->tmp.ecdh = NULL; |
| 3038 | } | 3038 | } |
| 3039 | #endif | 3039 | #endif |
| 3040 | #ifndef OPENSSL_NO_TLSEXT | ||
| 3041 | #ifndef OPENSSL_NO_EC | ||
| 3042 | s->s3->is_probably_safari = 0; | ||
| 3043 | #endif /* !OPENSSL_NO_EC */ | ||
| 3044 | #endif /* !OPENSSL_NO_TLSEXT */ | ||
| 3040 | 3045 | ||
| 3041 | rp = s->s3->rbuf.buf; | 3046 | rp = s->s3->rbuf.buf; |
| 3042 | wp = s->s3->wbuf.buf; | 3047 | wp = s->s3->wbuf.buf; |
| @@ -4016,6 +4021,13 @@ SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt, | |||
| 4016 | ii=sk_SSL_CIPHER_find(allow,c); | 4021 | ii=sk_SSL_CIPHER_find(allow,c); |
| 4017 | if (ii >= 0) | 4022 | if (ii >= 0) |
| 4018 | { | 4023 | { |
| 4024 | #if !defined(OPENSSL_NO_EC) && !defined(OPENSSL_NO_TLSEXT) | ||
| 4025 | if ((alg_k & SSL_kEECDH) && (alg_a & SSL_aECDSA) && s->s3->is_probably_safari) | ||
| 4026 | { | ||
| 4027 | if (!ret) ret=sk_SSL_CIPHER_value(allow,ii); | ||
| 4028 | continue; | ||
| 4029 | } | ||
| 4030 | #endif | ||
| 4019 | ret=sk_SSL_CIPHER_value(allow,ii); | 4031 | ret=sk_SSL_CIPHER_value(allow,ii); |
| 4020 | break; | 4032 | break; |
| 4021 | } | 4033 | } |
| @@ -4274,7 +4286,7 @@ need to go to SSL_ST_ACCEPT. | |||
| 4274 | long ssl_get_algorithm2(SSL *s) | 4286 | long ssl_get_algorithm2(SSL *s) |
| 4275 | { | 4287 | { |
| 4276 | long alg2 = s->s3->tmp.new_cipher->algorithm2; | 4288 | long alg2 = s->s3->tmp.new_cipher->algorithm2; |
| 4277 | if (TLS1_get_version(s) >= TLS1_2_VERSION && | 4289 | if (s->method->version == TLS1_2_VERSION && |
| 4278 | alg2 == (SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF)) | 4290 | alg2 == (SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF)) |
| 4279 | return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256; | 4291 | return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256; |
| 4280 | return alg2; | 4292 | return alg2; |
diff --git a/src/lib/libssl/src/ssl/s3_pkt.c b/src/lib/libssl/src/ssl/s3_pkt.c index adf8c387cc..96ba63262e 100644 --- a/src/lib/libssl/src/ssl/s3_pkt.c +++ b/src/lib/libssl/src/ssl/s3_pkt.c | |||
| @@ -290,11 +290,8 @@ static int ssl3_get_record(SSL *s) | |||
| 290 | unsigned char *p; | 290 | unsigned char *p; |
| 291 | unsigned char md[EVP_MAX_MD_SIZE]; | 291 | unsigned char md[EVP_MAX_MD_SIZE]; |
| 292 | short version; | 292 | short version; |
| 293 | int mac_size; | 293 | unsigned mac_size, orig_len; |
| 294 | int clear=0; | ||
| 295 | size_t extra; | 294 | size_t extra; |
| 296 | int decryption_failed_or_bad_record_mac = 0; | ||
| 297 | unsigned char *mac = NULL; | ||
| 298 | 295 | ||
| 299 | rr= &(s->s3->rrec); | 296 | rr= &(s->s3->rrec); |
| 300 | sess=s->session; | 297 | sess=s->session; |
| @@ -338,7 +335,7 @@ fprintf(stderr, "Record type=%d, Length=%d\n", rr->type, rr->length); | |||
| 338 | if (version != s->version) | 335 | if (version != s->version) |
| 339 | { | 336 | { |
| 340 | SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); | 337 | SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); |
| 341 | if ((s->version & 0xFF00) == (version & 0xFF00)) | 338 | if ((s->version & 0xFF00) == (version & 0xFF00) && !s->enc_write_ctx && !s->write_hash) |
| 342 | /* Send back error using their minor version number :-) */ | 339 | /* Send back error using their minor version number :-) */ |
| 343 | s->version = (unsigned short)version; | 340 | s->version = (unsigned short)version; |
| 344 | al=SSL_AD_PROTOCOL_VERSION; | 341 | al=SSL_AD_PROTOCOL_VERSION; |
| @@ -403,17 +400,15 @@ fprintf(stderr, "Record type=%d, Length=%d\n", rr->type, rr->length); | |||
| 403 | rr->data=rr->input; | 400 | rr->data=rr->input; |
| 404 | 401 | ||
| 405 | enc_err = s->method->ssl3_enc->enc(s,0); | 402 | enc_err = s->method->ssl3_enc->enc(s,0); |
| 406 | if (enc_err <= 0) | 403 | /* enc_err is: |
| 404 | * 0: (in non-constant time) if the record is publically invalid. | ||
| 405 | * 1: if the padding is valid | ||
| 406 | * -1: if the padding is invalid */ | ||
| 407 | if (enc_err == 0) | ||
| 407 | { | 408 | { |
| 408 | if (enc_err == 0) | 409 | al=SSL_AD_DECRYPTION_FAILED; |
| 409 | /* SSLerr() and ssl3_send_alert() have been called */ | 410 | SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG); |
| 410 | goto err; | 411 | goto f_err; |
| 411 | |||
| 412 | /* Otherwise enc_err == -1, which indicates bad padding | ||
| 413 | * (rec->length has not been changed in this case). | ||
| 414 | * To minimize information leaked via timing, we will perform | ||
| 415 | * the MAC computation anyway. */ | ||
| 416 | decryption_failed_or_bad_record_mac = 1; | ||
| 417 | } | 412 | } |
| 418 | 413 | ||
| 419 | #ifdef TLS_DEBUG | 414 | #ifdef TLS_DEBUG |
| @@ -423,53 +418,62 @@ printf("\n"); | |||
| 423 | #endif | 418 | #endif |
| 424 | 419 | ||
| 425 | /* r->length is now the compressed data plus mac */ | 420 | /* r->length is now the compressed data plus mac */ |
| 426 | if ( (sess == NULL) || | 421 | if ((sess != NULL) && |
| 427 | (s->enc_read_ctx == NULL) || | 422 | (s->enc_read_ctx != NULL) && |
| 428 | (EVP_MD_CTX_md(s->read_hash) == NULL)) | 423 | (EVP_MD_CTX_md(s->read_hash) != NULL)) |
| 429 | clear=1; | ||
| 430 | |||
| 431 | if (!clear) | ||
| 432 | { | 424 | { |
| 433 | /* !clear => s->read_hash != NULL => mac_size != -1 */ | 425 | /* s->read_hash != NULL => mac_size != -1 */ |
| 426 | unsigned char *mac = NULL; | ||
| 427 | unsigned char mac_tmp[EVP_MAX_MD_SIZE]; | ||
| 434 | mac_size=EVP_MD_CTX_size(s->read_hash); | 428 | mac_size=EVP_MD_CTX_size(s->read_hash); |
| 435 | OPENSSL_assert(mac_size >= 0); | 429 | OPENSSL_assert(mac_size <= EVP_MAX_MD_SIZE); |
| 436 | 430 | ||
| 437 | if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra+mac_size) | 431 | /* kludge: *_cbc_remove_padding passes padding length in rr->type */ |
| 432 | orig_len = rr->length+((unsigned int)rr->type>>8); | ||
| 433 | |||
| 434 | /* orig_len is the length of the record before any padding was | ||
| 435 | * removed. This is public information, as is the MAC in use, | ||
| 436 | * therefore we can safely process the record in a different | ||
| 437 | * amount of time if it's too short to possibly contain a MAC. | ||
| 438 | */ | ||
| 439 | if (orig_len < mac_size || | ||
| 440 | /* CBC records must have a padding length byte too. */ | ||
| 441 | (EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE && | ||
| 442 | orig_len < mac_size+1)) | ||
| 438 | { | 443 | { |
| 439 | #if 0 /* OK only for stream ciphers (then rr->length is visible from ciphertext anyway) */ | 444 | al=SSL_AD_DECODE_ERROR; |
| 440 | al=SSL_AD_RECORD_OVERFLOW; | 445 | SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_LENGTH_TOO_SHORT); |
| 441 | SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PRE_MAC_LENGTH_TOO_LONG); | ||
| 442 | goto f_err; | 446 | goto f_err; |
| 443 | #else | ||
| 444 | decryption_failed_or_bad_record_mac = 1; | ||
| 445 | #endif | ||
| 446 | } | 447 | } |
| 447 | /* check the MAC for rr->input (it's in mac_size bytes at the tail) */ | 448 | |
| 448 | if (rr->length >= (unsigned int)mac_size) | 449 | if (EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE) |
| 449 | { | 450 | { |
| 451 | /* We update the length so that the TLS header bytes | ||
| 452 | * can be constructed correctly but we need to extract | ||
| 453 | * the MAC in constant time from within the record, | ||
| 454 | * without leaking the contents of the padding bytes. | ||
| 455 | * */ | ||
| 456 | mac = mac_tmp; | ||
| 457 | ssl3_cbc_copy_mac(mac_tmp, rr, mac_size, orig_len); | ||
| 450 | rr->length -= mac_size; | 458 | rr->length -= mac_size; |
| 451 | mac = &rr->data[rr->length]; | ||
| 452 | } | 459 | } |
| 453 | else | 460 | else |
| 454 | { | 461 | { |
| 455 | /* record (minus padding) is too short to contain a MAC */ | 462 | /* In this case there's no padding, so |orig_len| |
| 456 | #if 0 /* OK only for stream ciphers */ | 463 | * equals |rec->length| and we checked that there's |
| 457 | al=SSL_AD_DECODE_ERROR; | 464 | * enough bytes for |mac_size| above. */ |
| 458 | SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_LENGTH_TOO_SHORT); | 465 | rr->length -= mac_size; |
| 459 | goto f_err; | 466 | mac = &rr->data[rr->length]; |
| 460 | #else | ||
| 461 | decryption_failed_or_bad_record_mac = 1; | ||
| 462 | rr->length = 0; | ||
| 463 | #endif | ||
| 464 | } | ||
| 465 | i=s->method->ssl3_enc->mac(s,md,0); | ||
| 466 | if (i < 0 || mac == NULL || memcmp(md, mac, (size_t)mac_size) != 0) | ||
| 467 | { | ||
| 468 | decryption_failed_or_bad_record_mac = 1; | ||
| 469 | } | 467 | } |
| 468 | |||
| 469 | i=s->method->ssl3_enc->mac(s,md,0 /* not send */); | ||
| 470 | if (i < 0 || mac == NULL || CRYPTO_memcmp(md, mac, (size_t)mac_size) != 0) | ||
| 471 | enc_err = -1; | ||
| 472 | if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra+mac_size) | ||
| 473 | enc_err = -1; | ||
| 470 | } | 474 | } |
| 471 | 475 | ||
| 472 | if (decryption_failed_or_bad_record_mac) | 476 | if (enc_err < 0) |
| 473 | { | 477 | { |
| 474 | /* A separate 'decryption_failed' alert was introduced with TLS 1.0, | 478 | /* A separate 'decryption_failed' alert was introduced with TLS 1.0, |
| 475 | * SSL 3.0 only has 'bad_record_mac'. But unless a decryption | 479 | * SSL 3.0 only has 'bad_record_mac'. But unless a decryption |
| @@ -744,6 +748,7 @@ static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, | |||
| 744 | * bytes and record version number > TLS 1.0 | 748 | * bytes and record version number > TLS 1.0 |
| 745 | */ | 749 | */ |
| 746 | if (s->state == SSL3_ST_CW_CLNT_HELLO_B | 750 | if (s->state == SSL3_ST_CW_CLNT_HELLO_B |
| 751 | && !s->renegotiate | ||
| 747 | && TLS1_get_version(s) > TLS1_VERSION) | 752 | && TLS1_get_version(s) > TLS1_VERSION) |
| 748 | *(p++) = 0x1; | 753 | *(p++) = 0x1; |
| 749 | else | 754 | else |
| @@ -1238,7 +1243,7 @@ start: | |||
| 1238 | goto f_err; | 1243 | goto f_err; |
| 1239 | } | 1244 | } |
| 1240 | #ifdef SSL_AD_MISSING_SRP_USERNAME | 1245 | #ifdef SSL_AD_MISSING_SRP_USERNAME |
| 1241 | if (alert_descr == SSL_AD_MISSING_SRP_USERNAME) | 1246 | else if (alert_descr == SSL_AD_MISSING_SRP_USERNAME) |
| 1242 | return(0); | 1247 | return(0); |
| 1243 | #endif | 1248 | #endif |
| 1244 | } | 1249 | } |
| @@ -1454,8 +1459,14 @@ int ssl3_do_change_cipher_spec(SSL *s) | |||
| 1454 | slen=s->method->ssl3_enc->client_finished_label_len; | 1459 | slen=s->method->ssl3_enc->client_finished_label_len; |
| 1455 | } | 1460 | } |
| 1456 | 1461 | ||
| 1457 | s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s, | 1462 | i = s->method->ssl3_enc->final_finish_mac(s, |
| 1458 | sender,slen,s->s3->tmp.peer_finish_md); | 1463 | sender,slen,s->s3->tmp.peer_finish_md); |
| 1464 | if (i == 0) | ||
| 1465 | { | ||
| 1466 | SSLerr(SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC, ERR_R_INTERNAL_ERROR); | ||
| 1467 | return 0; | ||
| 1468 | } | ||
| 1469 | s->s3->tmp.peer_finish_md_len = i; | ||
| 1459 | 1470 | ||
| 1460 | return(1); | 1471 | return(1); |
| 1461 | } | 1472 | } |
diff --git a/src/lib/libssl/src/ssl/s3_srvr.c b/src/lib/libssl/src/ssl/s3_srvr.c index 118939fabb..9ac19c05f2 100644 --- a/src/lib/libssl/src/ssl/s3_srvr.c +++ b/src/lib/libssl/src/ssl/s3_srvr.c | |||
| @@ -191,7 +191,8 @@ static int ssl_check_srp_ext_ClientHello(SSL *s, int *al) | |||
| 191 | { | 191 | { |
| 192 | if(s->srp_ctx.login == NULL) | 192 | if(s->srp_ctx.login == NULL) |
| 193 | { | 193 | { |
| 194 | /* There isn't any srp login extension !!! */ | 194 | /* RFC 5054 says SHOULD reject, |
| 195 | we do so if There is no srp login name */ | ||
| 195 | ret = SSL3_AL_FATAL; | 196 | ret = SSL3_AL_FATAL; |
| 196 | *al = SSL_AD_UNKNOWN_PSK_IDENTITY; | 197 | *al = SSL_AD_UNKNOWN_PSK_IDENTITY; |
| 197 | } | 198 | } |
| @@ -378,6 +379,7 @@ int ssl3_accept(SSL *s) | |||
| 378 | } | 379 | } |
| 379 | } | 380 | } |
| 380 | #endif | 381 | #endif |
| 382 | |||
| 381 | s->renegotiate = 2; | 383 | s->renegotiate = 2; |
| 382 | s->state=SSL3_ST_SW_SRVR_HELLO_A; | 384 | s->state=SSL3_ST_SW_SRVR_HELLO_A; |
| 383 | s->init_num=0; | 385 | s->init_num=0; |
| @@ -956,7 +958,8 @@ int ssl3_get_client_hello(SSL *s) | |||
| 956 | (s->version != DTLS1_VERSION && s->client_version < s->version)) | 958 | (s->version != DTLS1_VERSION && s->client_version < s->version)) |
| 957 | { | 959 | { |
| 958 | SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_WRONG_VERSION_NUMBER); | 960 | SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_WRONG_VERSION_NUMBER); |
| 959 | if ((s->client_version>>8) == SSL3_VERSION_MAJOR) | 961 | if ((s->client_version>>8) == SSL3_VERSION_MAJOR && |
| 962 | !s->enc_write_ctx && !s->write_hash) | ||
| 960 | { | 963 | { |
| 961 | /* similar to ssl3_get_record, send alert using remote version number */ | 964 | /* similar to ssl3_get_record, send alert using remote version number */ |
| 962 | s->version = s->client_version; | 965 | s->version = s->client_version; |
| @@ -1181,7 +1184,7 @@ int ssl3_get_client_hello(SSL *s) | |||
| 1181 | goto f_err; | 1184 | goto f_err; |
| 1182 | } | 1185 | } |
| 1183 | } | 1186 | } |
| 1184 | if (ssl_check_clienthello_tlsext(s) <= 0) { | 1187 | if (ssl_check_clienthello_tlsext_early(s) <= 0) { |
| 1185 | SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT); | 1188 | SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT); |
| 1186 | goto err; | 1189 | goto err; |
| 1187 | } | 1190 | } |
| @@ -1191,12 +1194,9 @@ int ssl3_get_client_hello(SSL *s) | |||
| 1191 | * server_random before calling tls_session_secret_cb in order to allow | 1194 | * server_random before calling tls_session_secret_cb in order to allow |
| 1192 | * SessionTicket processing to use it in key derivation. */ | 1195 | * SessionTicket processing to use it in key derivation. */ |
| 1193 | { | 1196 | { |
| 1194 | unsigned long Time; | ||
| 1195 | unsigned char *pos; | 1197 | unsigned char *pos; |
| 1196 | Time=(unsigned long)time(NULL); /* Time */ | ||
| 1197 | pos=s->s3->server_random; | 1198 | pos=s->s3->server_random; |
| 1198 | l2n(Time,pos); | 1199 | if (ssl_fill_hello_random(s, 1, pos, SSL3_RANDOM_SIZE) <= 0) |
| 1199 | if (RAND_pseudo_bytes(pos,SSL3_RANDOM_SIZE-4) <= 0) | ||
| 1200 | { | 1200 | { |
| 1201 | al=SSL_AD_INTERNAL_ERROR; | 1201 | al=SSL_AD_INTERNAL_ERROR; |
| 1202 | goto f_err; | 1202 | goto f_err; |
| @@ -1389,7 +1389,10 @@ int ssl3_get_client_hello(SSL *s) | |||
| 1389 | if (TLS1_get_version(s) < TLS1_2_VERSION || !(s->verify_mode & SSL_VERIFY_PEER)) | 1389 | if (TLS1_get_version(s) < TLS1_2_VERSION || !(s->verify_mode & SSL_VERIFY_PEER)) |
| 1390 | { | 1390 | { |
| 1391 | if (!ssl3_digest_cached_records(s)) | 1391 | if (!ssl3_digest_cached_records(s)) |
| 1392 | { | ||
| 1393 | al = SSL_AD_INTERNAL_ERROR; | ||
| 1392 | goto f_err; | 1394 | goto f_err; |
| 1395 | } | ||
| 1393 | } | 1396 | } |
| 1394 | 1397 | ||
| 1395 | /* we now have the following setup. | 1398 | /* we now have the following setup. |
| @@ -1403,6 +1406,16 @@ int ssl3_get_client_hello(SSL *s) | |||
| 1403 | * s->tmp.new_cipher - the new cipher to use. | 1406 | * s->tmp.new_cipher - the new cipher to use. |
| 1404 | */ | 1407 | */ |
| 1405 | 1408 | ||
| 1409 | /* Handles TLS extensions that we couldn't check earlier */ | ||
| 1410 | if (s->version >= SSL3_VERSION) | ||
| 1411 | { | ||
| 1412 | if (ssl_check_clienthello_tlsext_late(s) <= 0) | ||
| 1413 | { | ||
| 1414 | SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT); | ||
| 1415 | goto err; | ||
| 1416 | } | ||
| 1417 | } | ||
| 1418 | |||
| 1406 | if (ret < 0) ret=1; | 1419 | if (ret < 0) ret=1; |
| 1407 | if (0) | 1420 | if (0) |
| 1408 | { | 1421 | { |
| @@ -1420,19 +1433,13 @@ int ssl3_send_server_hello(SSL *s) | |||
| 1420 | unsigned char *p,*d; | 1433 | unsigned char *p,*d; |
| 1421 | int i,sl; | 1434 | int i,sl; |
| 1422 | unsigned long l; | 1435 | unsigned long l; |
| 1423 | #ifdef OPENSSL_NO_TLSEXT | ||
| 1424 | unsigned long Time; | ||
| 1425 | #endif | ||
| 1426 | 1436 | ||
| 1427 | if (s->state == SSL3_ST_SW_SRVR_HELLO_A) | 1437 | if (s->state == SSL3_ST_SW_SRVR_HELLO_A) |
| 1428 | { | 1438 | { |
| 1429 | buf=(unsigned char *)s->init_buf->data; | 1439 | buf=(unsigned char *)s->init_buf->data; |
| 1430 | #ifdef OPENSSL_NO_TLSEXT | 1440 | #ifdef OPENSSL_NO_TLSEXT |
| 1431 | p=s->s3->server_random; | 1441 | p=s->s3->server_random; |
| 1432 | /* Generate server_random if it was not needed previously */ | 1442 | if (ssl_fill_hello_random(s, 1, p, SSL3_RANDOM_SIZE) <= 0) |
| 1433 | Time=(unsigned long)time(NULL); /* Time */ | ||
| 1434 | l2n(Time,p); | ||
| 1435 | if (RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0) | ||
| 1436 | return -1; | 1443 | return -1; |
| 1437 | #endif | 1444 | #endif |
| 1438 | /* Do the message type and length last */ | 1445 | /* Do the message type and length last */ |
| @@ -1823,7 +1830,7 @@ int ssl3_send_server_key_exchange(SSL *s) | |||
| 1823 | SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE); | 1830 | SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE); |
| 1824 | goto f_err; | 1831 | goto f_err; |
| 1825 | } | 1832 | } |
| 1826 | for (i=0; r[i] != NULL && i<4; i++) | 1833 | for (i=0; i < 4 && r[i] != NULL; i++) |
| 1827 | { | 1834 | { |
| 1828 | nr[i]=BN_num_bytes(r[i]); | 1835 | nr[i]=BN_num_bytes(r[i]); |
| 1829 | #ifndef OPENSSL_NO_SRP | 1836 | #ifndef OPENSSL_NO_SRP |
| @@ -1859,7 +1866,7 @@ int ssl3_send_server_key_exchange(SSL *s) | |||
| 1859 | d=(unsigned char *)s->init_buf->data; | 1866 | d=(unsigned char *)s->init_buf->data; |
| 1860 | p= &(d[4]); | 1867 | p= &(d[4]); |
| 1861 | 1868 | ||
| 1862 | for (i=0; r[i] != NULL && i<4; i++) | 1869 | for (i=0; i < 4 && r[i] != NULL; i++) |
| 1863 | { | 1870 | { |
| 1864 | #ifndef OPENSSL_NO_SRP | 1871 | #ifndef OPENSSL_NO_SRP |
| 1865 | if ((i == 2) && (type & SSL_kSRP)) | 1872 | if ((i == 2) && (type & SSL_kSRP)) |
diff --git a/src/lib/libssl/src/ssl/ssl.h b/src/lib/libssl/src/ssl/ssl.h index 8b0c2a2dac..7219a0e64b 100644 --- a/src/lib/libssl/src/ssl/ssl.h +++ b/src/lib/libssl/src/ssl/ssl.h | |||
| @@ -493,6 +493,9 @@ struct ssl_session_st | |||
| 493 | char *psk_identity_hint; | 493 | char *psk_identity_hint; |
| 494 | char *psk_identity; | 494 | char *psk_identity; |
| 495 | #endif | 495 | #endif |
| 496 | /* Used to indicate that session resumption is not allowed. | ||
| 497 | * Applications can also set this bit for a new session via | ||
| 498 | * not_resumable_session_cb to disable session caching and tickets. */ | ||
| 496 | int not_resumable; | 499 | int not_resumable; |
| 497 | 500 | ||
| 498 | /* The cert is the certificate used to establish this connection */ | 501 | /* The cert is the certificate used to establish this connection */ |
| @@ -535,7 +538,7 @@ struct ssl_session_st | |||
| 535 | #endif /* OPENSSL_NO_EC */ | 538 | #endif /* OPENSSL_NO_EC */ |
| 536 | /* RFC4507 info */ | 539 | /* RFC4507 info */ |
| 537 | unsigned char *tlsext_tick; /* Session ticket */ | 540 | unsigned char *tlsext_tick; /* Session ticket */ |
| 538 | size_t tlsext_ticklen; /* Session ticket length */ | 541 | size_t tlsext_ticklen; /* Session ticket length */ |
| 539 | long tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */ | 542 | long tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */ |
| 540 | #endif | 543 | #endif |
| 541 | #ifndef OPENSSL_NO_SRP | 544 | #ifndef OPENSSL_NO_SRP |
| @@ -552,11 +555,14 @@ struct ssl_session_st | |||
| 552 | #define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L | 555 | #define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L |
| 553 | #define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x00000010L | 556 | #define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x00000010L |
| 554 | #define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L | 557 | #define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L |
| 555 | #define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x00000040L /* no effect since 0.9.7h and 0.9.8b */ | 558 | #define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040L |
| 556 | #define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L | 559 | #define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L |
| 557 | #define SSL_OP_TLS_D5_BUG 0x00000100L | 560 | #define SSL_OP_TLS_D5_BUG 0x00000100L |
| 558 | #define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L | 561 | #define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L |
| 559 | 562 | ||
| 563 | /* Hasn't done anything since OpenSSL 0.9.7h, retained for compatibility */ | ||
| 564 | #define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 | ||
| 565 | |||
| 560 | /* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added | 566 | /* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added |
| 561 | * in OpenSSL 0.9.6d. Usually (depending on the application protocol) | 567 | * in OpenSSL 0.9.6d. Usually (depending on the application protocol) |
| 562 | * the workaround is not needed. Unfortunately some broken SSL/TLS | 568 | * the workaround is not needed. Unfortunately some broken SSL/TLS |
| @@ -638,6 +644,12 @@ struct ssl_session_st | |||
| 638 | * TLS only.) "Released" buffers are put onto a free-list in the context | 644 | * TLS only.) "Released" buffers are put onto a free-list in the context |
| 639 | * or just freed (depending on the context's setting for freelist_max_len). */ | 645 | * or just freed (depending on the context's setting for freelist_max_len). */ |
| 640 | #define SSL_MODE_RELEASE_BUFFERS 0x00000010L | 646 | #define SSL_MODE_RELEASE_BUFFERS 0x00000010L |
| 647 | /* Send the current time in the Random fields of the ClientHello and | ||
| 648 | * ServerHello records for compatibility with hypothetical implementations | ||
| 649 | * that require it. | ||
| 650 | */ | ||
| 651 | #define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020L | ||
| 652 | #define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040L | ||
| 641 | 653 | ||
| 642 | /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, | 654 | /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, |
| 643 | * they cannot be used to clear bits. */ | 655 | * they cannot be used to clear bits. */ |
| @@ -903,7 +915,7 @@ struct ssl_ctx_st | |||
| 903 | */ | 915 | */ |
| 904 | unsigned int max_send_fragment; | 916 | unsigned int max_send_fragment; |
| 905 | 917 | ||
| 906 | #ifndef OPENSSL_ENGINE | 918 | #ifndef OPENSSL_NO_ENGINE |
| 907 | /* Engine to pass requests for client certs to | 919 | /* Engine to pass requests for client certs to |
| 908 | */ | 920 | */ |
| 909 | ENGINE *client_cert_engine; | 921 | ENGINE *client_cert_engine; |
| @@ -927,6 +939,7 @@ struct ssl_ctx_st | |||
| 927 | /* Callback for status request */ | 939 | /* Callback for status request */ |
| 928 | int (*tlsext_status_cb)(SSL *ssl, void *arg); | 940 | int (*tlsext_status_cb)(SSL *ssl, void *arg); |
| 929 | void *tlsext_status_arg; | 941 | void *tlsext_status_arg; |
| 942 | |||
| 930 | /* draft-rescorla-tls-opaque-prf-input-00.txt information */ | 943 | /* draft-rescorla-tls-opaque-prf-input-00.txt information */ |
| 931 | int (*tlsext_opaque_prf_input_callback)(SSL *, void *peerinput, size_t len, void *arg); | 944 | int (*tlsext_opaque_prf_input_callback)(SSL *, void *peerinput, size_t len, void *arg); |
| 932 | void *tlsext_opaque_prf_input_callback_arg; | 945 | void *tlsext_opaque_prf_input_callback_arg; |
| @@ -952,6 +965,7 @@ struct ssl_ctx_st | |||
| 952 | #endif | 965 | #endif |
| 953 | 966 | ||
| 954 | #ifndef OPENSSL_NO_TLSEXT | 967 | #ifndef OPENSSL_NO_TLSEXT |
| 968 | |||
| 955 | # ifndef OPENSSL_NO_NEXTPROTONEG | 969 | # ifndef OPENSSL_NO_NEXTPROTONEG |
| 956 | /* Next protocol negotiation information */ | 970 | /* Next protocol negotiation information */ |
| 957 | /* (for experimental NPN extension). */ | 971 | /* (for experimental NPN extension). */ |
| @@ -2206,6 +2220,7 @@ void ERR_load_SSL_strings(void); | |||
| 2206 | #define SSL_F_SSL_GET_NEW_SESSION 181 | 2220 | #define SSL_F_SSL_GET_NEW_SESSION 181 |
| 2207 | #define SSL_F_SSL_GET_PREV_SESSION 217 | 2221 | #define SSL_F_SSL_GET_PREV_SESSION 217 |
| 2208 | #define SSL_F_SSL_GET_SERVER_SEND_CERT 182 | 2222 | #define SSL_F_SSL_GET_SERVER_SEND_CERT 182 |
| 2223 | #define SSL_F_SSL_GET_SERVER_SEND_PKEY 317 | ||
| 2209 | #define SSL_F_SSL_GET_SIGN_PKEY 183 | 2224 | #define SSL_F_SSL_GET_SIGN_PKEY 183 |
| 2210 | #define SSL_F_SSL_INIT_WBIO_BUFFER 184 | 2225 | #define SSL_F_SSL_INIT_WBIO_BUFFER 184 |
| 2211 | #define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 | 2226 | #define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 |
diff --git a/src/lib/libssl/src/ssl/ssl3.h b/src/lib/libssl/src/ssl/ssl3.h index 112e627de0..cb8b2492ec 100644 --- a/src/lib/libssl/src/ssl/ssl3.h +++ b/src/lib/libssl/src/ssl/ssl3.h | |||
| @@ -539,6 +539,15 @@ typedef struct ssl3_state_st | |||
| 539 | /* Set if we saw the Next Protocol Negotiation extension from our peer. */ | 539 | /* Set if we saw the Next Protocol Negotiation extension from our peer. */ |
| 540 | int next_proto_neg_seen; | 540 | int next_proto_neg_seen; |
| 541 | #endif | 541 | #endif |
| 542 | |||
| 543 | #ifndef OPENSSL_NO_TLSEXT | ||
| 544 | #ifndef OPENSSL_NO_EC | ||
| 545 | /* This is set to true if we believe that this is a version of Safari | ||
| 546 | * running on OS X 10.6 or newer. We wish to know this because Safari | ||
| 547 | * on 10.8 .. 10.8.3 has broken ECDHE-ECDSA support. */ | ||
| 548 | char is_probably_safari; | ||
| 549 | #endif /* !OPENSSL_NO_EC */ | ||
| 550 | #endif /* !OPENSSL_NO_TLSEXT */ | ||
| 542 | } SSL3_STATE; | 551 | } SSL3_STATE; |
| 543 | 552 | ||
| 544 | #endif | 553 | #endif |
| @@ -578,8 +587,10 @@ typedef struct ssl3_state_st | |||
| 578 | #define SSL3_ST_CW_CERT_VRFY_B (0x191|SSL_ST_CONNECT) | 587 | #define SSL3_ST_CW_CERT_VRFY_B (0x191|SSL_ST_CONNECT) |
| 579 | #define SSL3_ST_CW_CHANGE_A (0x1A0|SSL_ST_CONNECT) | 588 | #define SSL3_ST_CW_CHANGE_A (0x1A0|SSL_ST_CONNECT) |
| 580 | #define SSL3_ST_CW_CHANGE_B (0x1A1|SSL_ST_CONNECT) | 589 | #define SSL3_ST_CW_CHANGE_B (0x1A1|SSL_ST_CONNECT) |
| 590 | #ifndef OPENSSL_NO_NEXTPROTONEG | ||
| 581 | #define SSL3_ST_CW_NEXT_PROTO_A (0x200|SSL_ST_CONNECT) | 591 | #define SSL3_ST_CW_NEXT_PROTO_A (0x200|SSL_ST_CONNECT) |
| 582 | #define SSL3_ST_CW_NEXT_PROTO_B (0x201|SSL_ST_CONNECT) | 592 | #define SSL3_ST_CW_NEXT_PROTO_B (0x201|SSL_ST_CONNECT) |
| 593 | #endif | ||
| 583 | #define SSL3_ST_CW_FINISHED_A (0x1B0|SSL_ST_CONNECT) | 594 | #define SSL3_ST_CW_FINISHED_A (0x1B0|SSL_ST_CONNECT) |
| 584 | #define SSL3_ST_CW_FINISHED_B (0x1B1|SSL_ST_CONNECT) | 595 | #define SSL3_ST_CW_FINISHED_B (0x1B1|SSL_ST_CONNECT) |
| 585 | /* read from server */ | 596 | /* read from server */ |
| @@ -629,8 +640,10 @@ typedef struct ssl3_state_st | |||
| 629 | #define SSL3_ST_SR_CERT_VRFY_B (0x1A1|SSL_ST_ACCEPT) | 640 | #define SSL3_ST_SR_CERT_VRFY_B (0x1A1|SSL_ST_ACCEPT) |
| 630 | #define SSL3_ST_SR_CHANGE_A (0x1B0|SSL_ST_ACCEPT) | 641 | #define SSL3_ST_SR_CHANGE_A (0x1B0|SSL_ST_ACCEPT) |
| 631 | #define SSL3_ST_SR_CHANGE_B (0x1B1|SSL_ST_ACCEPT) | 642 | #define SSL3_ST_SR_CHANGE_B (0x1B1|SSL_ST_ACCEPT) |
| 643 | #ifndef OPENSSL_NO_NEXTPROTONEG | ||
| 632 | #define SSL3_ST_SR_NEXT_PROTO_A (0x210|SSL_ST_ACCEPT) | 644 | #define SSL3_ST_SR_NEXT_PROTO_A (0x210|SSL_ST_ACCEPT) |
| 633 | #define SSL3_ST_SR_NEXT_PROTO_B (0x211|SSL_ST_ACCEPT) | 645 | #define SSL3_ST_SR_NEXT_PROTO_B (0x211|SSL_ST_ACCEPT) |
| 646 | #endif | ||
| 634 | #define SSL3_ST_SR_FINISHED_A (0x1C0|SSL_ST_ACCEPT) | 647 | #define SSL3_ST_SR_FINISHED_A (0x1C0|SSL_ST_ACCEPT) |
| 635 | #define SSL3_ST_SR_FINISHED_B (0x1C1|SSL_ST_ACCEPT) | 648 | #define SSL3_ST_SR_FINISHED_B (0x1C1|SSL_ST_ACCEPT) |
| 636 | /* write to client */ | 649 | /* write to client */ |
| @@ -655,7 +668,9 @@ typedef struct ssl3_state_st | |||
| 655 | #define SSL3_MT_CLIENT_KEY_EXCHANGE 16 | 668 | #define SSL3_MT_CLIENT_KEY_EXCHANGE 16 |
| 656 | #define SSL3_MT_FINISHED 20 | 669 | #define SSL3_MT_FINISHED 20 |
| 657 | #define SSL3_MT_CERTIFICATE_STATUS 22 | 670 | #define SSL3_MT_CERTIFICATE_STATUS 22 |
| 671 | #ifndef OPENSSL_NO_NEXTPROTONEG | ||
| 658 | #define SSL3_MT_NEXT_PROTO 67 | 672 | #define SSL3_MT_NEXT_PROTO 67 |
| 673 | #endif | ||
| 659 | #define DTLS1_MT_HELLO_VERIFY_REQUEST 3 | 674 | #define DTLS1_MT_HELLO_VERIFY_REQUEST 3 |
| 660 | 675 | ||
| 661 | 676 | ||
diff --git a/src/lib/libssl/src/ssl/ssl_algs.c b/src/lib/libssl/src/ssl/ssl_algs.c index d443143c59..9c34d19725 100644 --- a/src/lib/libssl/src/ssl/ssl_algs.c +++ b/src/lib/libssl/src/ssl/ssl_algs.c | |||
| @@ -94,6 +94,7 @@ int SSL_library_init(void) | |||
| 94 | EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1()); | 94 | EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1()); |
| 95 | EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1()); | 95 | EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1()); |
| 96 | #endif | 96 | #endif |
| 97 | |||
| 97 | #endif | 98 | #endif |
| 98 | #ifndef OPENSSL_NO_CAMELLIA | 99 | #ifndef OPENSSL_NO_CAMELLIA |
| 99 | EVP_add_cipher(EVP_camellia_128_cbc()); | 100 | EVP_add_cipher(EVP_camellia_128_cbc()); |
diff --git a/src/lib/libssl/src/ssl/ssl_cert.c b/src/lib/libssl/src/ssl/ssl_cert.c index 917be31876..5123a89182 100644 --- a/src/lib/libssl/src/ssl/ssl_cert.c +++ b/src/lib/libssl/src/ssl/ssl_cert.c | |||
| @@ -164,14 +164,14 @@ static void ssl_cert_set_default_md(CERT *cert) | |||
| 164 | { | 164 | { |
| 165 | /* Set digest values to defaults */ | 165 | /* Set digest values to defaults */ |
| 166 | #ifndef OPENSSL_NO_DSA | 166 | #ifndef OPENSSL_NO_DSA |
| 167 | cert->pkeys[SSL_PKEY_DSA_SIGN].digest = EVP_dss1(); | 167 | cert->pkeys[SSL_PKEY_DSA_SIGN].digest = EVP_sha1(); |
| 168 | #endif | 168 | #endif |
| 169 | #ifndef OPENSSL_NO_RSA | 169 | #ifndef OPENSSL_NO_RSA |
| 170 | cert->pkeys[SSL_PKEY_RSA_SIGN].digest = EVP_sha1(); | 170 | cert->pkeys[SSL_PKEY_RSA_SIGN].digest = EVP_sha1(); |
| 171 | cert->pkeys[SSL_PKEY_RSA_ENC].digest = EVP_sha1(); | 171 | cert->pkeys[SSL_PKEY_RSA_ENC].digest = EVP_sha1(); |
| 172 | #endif | 172 | #endif |
| 173 | #ifndef OPENSSL_NO_ECDSA | 173 | #ifndef OPENSSL_NO_ECDSA |
| 174 | cert->pkeys[SSL_PKEY_ECC].digest = EVP_ecdsa(); | 174 | cert->pkeys[SSL_PKEY_ECC].digest = EVP_sha1(); |
| 175 | #endif | 175 | #endif |
| 176 | } | 176 | } |
| 177 | 177 | ||
diff --git a/src/lib/libssl/src/ssl/ssl_ciph.c b/src/lib/libssl/src/ssl/ssl_ciph.c index 92d1e94d6a..0aba8e048c 100644 --- a/src/lib/libssl/src/ssl/ssl_ciph.c +++ b/src/lib/libssl/src/ssl/ssl_ciph.c | |||
| @@ -312,6 +312,7 @@ static const SSL_CIPHER cipher_aliases[]={ | |||
| 312 | {0,SSL_TXT_SSLV2,0, 0,0,0,0,SSL_SSLV2, 0,0,0,0}, | 312 | {0,SSL_TXT_SSLV2,0, 0,0,0,0,SSL_SSLV2, 0,0,0,0}, |
| 313 | {0,SSL_TXT_SSLV3,0, 0,0,0,0,SSL_SSLV3, 0,0,0,0}, | 313 | {0,SSL_TXT_SSLV3,0, 0,0,0,0,SSL_SSLV3, 0,0,0,0}, |
| 314 | {0,SSL_TXT_TLSV1,0, 0,0,0,0,SSL_TLSV1, 0,0,0,0}, | 314 | {0,SSL_TXT_TLSV1,0, 0,0,0,0,SSL_TLSV1, 0,0,0,0}, |
| 315 | {0,SSL_TXT_TLSV1_2,0, 0,0,0,0,SSL_TLSV1_2, 0,0,0,0}, | ||
| 315 | 316 | ||
| 316 | /* export flag */ | 317 | /* export flag */ |
| 317 | {0,SSL_TXT_EXP,0, 0,0,0,0,0,SSL_EXPORT,0,0,0}, | 318 | {0,SSL_TXT_EXP,0, 0,0,0,0,0,SSL_EXPORT,0,0,0}, |
| @@ -1150,9 +1151,9 @@ static int ssl_cipher_process_rulestr(const char *rule_str, | |||
| 1150 | while ( ((ch >= 'A') && (ch <= 'Z')) || | 1151 | while ( ((ch >= 'A') && (ch <= 'Z')) || |
| 1151 | ((ch >= '0') && (ch <= '9')) || | 1152 | ((ch >= '0') && (ch <= '9')) || |
| 1152 | ((ch >= 'a') && (ch <= 'z')) || | 1153 | ((ch >= 'a') && (ch <= 'z')) || |
| 1153 | (ch == '-')) | 1154 | (ch == '-') || (ch == '.')) |
| 1154 | #else | 1155 | #else |
| 1155 | while ( isalnum(ch) || (ch == '-')) | 1156 | while ( isalnum(ch) || (ch == '-') || (ch == '.')) |
| 1156 | #endif | 1157 | #endif |
| 1157 | { | 1158 | { |
| 1158 | ch = *(++l); | 1159 | ch = *(++l); |
diff --git a/src/lib/libssl/src/ssl/ssl_err.c b/src/lib/libssl/src/ssl/ssl_err.c index 2577c6895a..370fb57e3b 100644 --- a/src/lib/libssl/src/ssl/ssl_err.c +++ b/src/lib/libssl/src/ssl/ssl_err.c | |||
| @@ -228,6 +228,7 @@ static ERR_STRING_DATA SSL_str_functs[]= | |||
| 228 | {ERR_FUNC(SSL_F_SSL_GET_NEW_SESSION), "SSL_GET_NEW_SESSION"}, | 228 | {ERR_FUNC(SSL_F_SSL_GET_NEW_SESSION), "SSL_GET_NEW_SESSION"}, |
| 229 | {ERR_FUNC(SSL_F_SSL_GET_PREV_SESSION), "SSL_GET_PREV_SESSION"}, | 229 | {ERR_FUNC(SSL_F_SSL_GET_PREV_SESSION), "SSL_GET_PREV_SESSION"}, |
| 230 | {ERR_FUNC(SSL_F_SSL_GET_SERVER_SEND_CERT), "SSL_GET_SERVER_SEND_CERT"}, | 230 | {ERR_FUNC(SSL_F_SSL_GET_SERVER_SEND_CERT), "SSL_GET_SERVER_SEND_CERT"}, |
| 231 | {ERR_FUNC(SSL_F_SSL_GET_SERVER_SEND_PKEY), "SSL_GET_SERVER_SEND_PKEY"}, | ||
| 231 | {ERR_FUNC(SSL_F_SSL_GET_SIGN_PKEY), "SSL_GET_SIGN_PKEY"}, | 232 | {ERR_FUNC(SSL_F_SSL_GET_SIGN_PKEY), "SSL_GET_SIGN_PKEY"}, |
| 232 | {ERR_FUNC(SSL_F_SSL_INIT_WBIO_BUFFER), "SSL_INIT_WBIO_BUFFER"}, | 233 | {ERR_FUNC(SSL_F_SSL_INIT_WBIO_BUFFER), "SSL_INIT_WBIO_BUFFER"}, |
| 233 | {ERR_FUNC(SSL_F_SSL_LOAD_CLIENT_CA_FILE), "SSL_load_client_CA_file"}, | 234 | {ERR_FUNC(SSL_F_SSL_LOAD_CLIENT_CA_FILE), "SSL_load_client_CA_file"}, |
diff --git a/src/lib/libssl/src/ssl/ssl_lib.c b/src/lib/libssl/src/ssl/ssl_lib.c index f82d071d6e..6dbc3c1f7d 100644 --- a/src/lib/libssl/src/ssl/ssl_lib.c +++ b/src/lib/libssl/src/ssl/ssl_lib.c | |||
| @@ -597,8 +597,10 @@ void SSL_free(SSL *s) | |||
| 597 | OPENSSL_free(s->next_proto_negotiated); | 597 | OPENSSL_free(s->next_proto_negotiated); |
| 598 | #endif | 598 | #endif |
| 599 | 599 | ||
| 600 | #ifndef OPENSSL_NO_SRTP | ||
| 600 | if (s->srtp_profiles) | 601 | if (s->srtp_profiles) |
| 601 | sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles); | 602 | sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles); |
| 603 | #endif | ||
| 602 | 604 | ||
| 603 | OPENSSL_free(s); | 605 | OPENSSL_free(s); |
| 604 | } | 606 | } |
| @@ -1795,7 +1797,9 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth) | |||
| 1795 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_CTX, ret, &ret->ex_data); | 1797 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_CTX, ret, &ret->ex_data); |
| 1796 | 1798 | ||
| 1797 | ret->extra_certs=NULL; | 1799 | ret->extra_certs=NULL; |
| 1798 | ret->comp_methods=SSL_COMP_get_compression_methods(); | 1800 | /* No compression for DTLS */ |
| 1801 | if (meth->version != DTLS1_VERSION) | ||
| 1802 | ret->comp_methods=SSL_COMP_get_compression_methods(); | ||
| 1799 | 1803 | ||
| 1800 | ret->max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH; | 1804 | ret->max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH; |
| 1801 | 1805 | ||
| @@ -1952,8 +1956,10 @@ void SSL_CTX_free(SSL_CTX *a) | |||
| 1952 | a->comp_methods = NULL; | 1956 | a->comp_methods = NULL; |
| 1953 | #endif | 1957 | #endif |
| 1954 | 1958 | ||
| 1959 | #ifndef OPENSSL_NO_SRTP | ||
| 1955 | if (a->srtp_profiles) | 1960 | if (a->srtp_profiles) |
| 1956 | sk_SRTP_PROTECTION_PROFILE_free(a->srtp_profiles); | 1961 | sk_SRTP_PROTECTION_PROFILE_free(a->srtp_profiles); |
| 1962 | #endif | ||
| 1957 | 1963 | ||
| 1958 | #ifndef OPENSSL_NO_PSK | 1964 | #ifndef OPENSSL_NO_PSK |
| 1959 | if (a->psk_identity_hint) | 1965 | if (a->psk_identity_hint) |
| @@ -2287,7 +2293,7 @@ int ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL *s) | |||
| 2287 | #endif | 2293 | #endif |
| 2288 | 2294 | ||
| 2289 | /* THIS NEEDS CLEANING UP */ | 2295 | /* THIS NEEDS CLEANING UP */ |
| 2290 | X509 *ssl_get_server_send_cert(SSL *s) | 2296 | CERT_PKEY *ssl_get_server_send_pkey(const SSL *s) |
| 2291 | { | 2297 | { |
| 2292 | unsigned long alg_k,alg_a; | 2298 | unsigned long alg_k,alg_a; |
| 2293 | CERT *c; | 2299 | CERT *c; |
| @@ -2342,12 +2348,20 @@ X509 *ssl_get_server_send_cert(SSL *s) | |||
| 2342 | i=SSL_PKEY_GOST01; | 2348 | i=SSL_PKEY_GOST01; |
| 2343 | else /* if (alg_a & SSL_aNULL) */ | 2349 | else /* if (alg_a & SSL_aNULL) */ |
| 2344 | { | 2350 | { |
| 2345 | SSLerr(SSL_F_SSL_GET_SERVER_SEND_CERT,ERR_R_INTERNAL_ERROR); | 2351 | SSLerr(SSL_F_SSL_GET_SERVER_SEND_PKEY,ERR_R_INTERNAL_ERROR); |
| 2346 | return(NULL); | 2352 | return(NULL); |
| 2347 | } | 2353 | } |
| 2348 | if (c->pkeys[i].x509 == NULL) return(NULL); | ||
| 2349 | 2354 | ||
| 2350 | return(c->pkeys[i].x509); | 2355 | return c->pkeys + i; |
| 2356 | } | ||
| 2357 | |||
| 2358 | X509 *ssl_get_server_send_cert(const SSL *s) | ||
| 2359 | { | ||
| 2360 | CERT_PKEY *cpk; | ||
| 2361 | cpk = ssl_get_server_send_pkey(s); | ||
| 2362 | if (!cpk) | ||
| 2363 | return NULL; | ||
| 2364 | return cpk->x509; | ||
| 2351 | } | 2365 | } |
| 2352 | 2366 | ||
| 2353 | EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *cipher, const EVP_MD **pmd) | 2367 | EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *cipher, const EVP_MD **pmd) |
| @@ -2608,7 +2622,7 @@ const char *SSL_get_version(const SSL *s) | |||
| 2608 | return("TLSv1.2"); | 2622 | return("TLSv1.2"); |
| 2609 | else if (s->version == TLS1_1_VERSION) | 2623 | else if (s->version == TLS1_1_VERSION) |
| 2610 | return("TLSv1.1"); | 2624 | return("TLSv1.1"); |
| 2611 | if (s->version == TLS1_VERSION) | 2625 | else if (s->version == TLS1_VERSION) |
| 2612 | return("TLSv1"); | 2626 | return("TLSv1"); |
| 2613 | else if (s->version == SSL3_VERSION) | 2627 | else if (s->version == SSL3_VERSION) |
| 2614 | return("SSLv3"); | 2628 | return("SSLv3"); |
diff --git a/src/lib/libssl/src/ssl/ssl_locl.h b/src/lib/libssl/src/ssl/ssl_locl.h index d87fd51cfa..e485907748 100644 --- a/src/lib/libssl/src/ssl/ssl_locl.h +++ b/src/lib/libssl/src/ssl/ssl_locl.h | |||
| @@ -215,6 +215,15 @@ | |||
| 215 | *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ | 215 | *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ |
| 216 | *((c)++)=(unsigned char)(((l) )&0xff)) | 216 | *((c)++)=(unsigned char)(((l) )&0xff)) |
| 217 | 217 | ||
| 218 | #define l2n8(l,c) (*((c)++)=(unsigned char)(((l)>>56)&0xff), \ | ||
| 219 | *((c)++)=(unsigned char)(((l)>>48)&0xff), \ | ||
| 220 | *((c)++)=(unsigned char)(((l)>>40)&0xff), \ | ||
| 221 | *((c)++)=(unsigned char)(((l)>>32)&0xff), \ | ||
| 222 | *((c)++)=(unsigned char)(((l)>>24)&0xff), \ | ||
| 223 | *((c)++)=(unsigned char)(((l)>>16)&0xff), \ | ||
| 224 | *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ | ||
| 225 | *((c)++)=(unsigned char)(((l) )&0xff)) | ||
| 226 | |||
| 218 | #define n2l6(c,l) (l =((BN_ULLONG)(*((c)++)))<<40, \ | 227 | #define n2l6(c,l) (l =((BN_ULLONG)(*((c)++)))<<40, \ |
| 219 | l|=((BN_ULLONG)(*((c)++)))<<32, \ | 228 | l|=((BN_ULLONG)(*((c)++)))<<32, \ |
| 220 | l|=((BN_ULLONG)(*((c)++)))<<24, \ | 229 | l|=((BN_ULLONG)(*((c)++)))<<24, \ |
| @@ -612,6 +621,8 @@ extern SSL3_ENC_METHOD TLSv1_enc_data; | |||
| 612 | extern SSL3_ENC_METHOD SSLv3_enc_data; | 621 | extern SSL3_ENC_METHOD SSLv3_enc_data; |
| 613 | extern SSL3_ENC_METHOD DTLSv1_enc_data; | 622 | extern SSL3_ENC_METHOD DTLSv1_enc_data; |
| 614 | 623 | ||
| 624 | #define SSL_IS_DTLS(s) (s->method->version == DTLS1_VERSION) | ||
| 625 | |||
| 615 | #define IMPLEMENT_tls_meth_func(version, func_name, s_accept, s_connect, \ | 626 | #define IMPLEMENT_tls_meth_func(version, func_name, s_accept, s_connect, \ |
| 616 | s_get_meth) \ | 627 | s_get_meth) \ |
| 617 | const SSL_METHOD *func_name(void) \ | 628 | const SSL_METHOD *func_name(void) \ |
| @@ -830,13 +841,15 @@ int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); | |||
| 830 | int ssl_undefined_function(SSL *s); | 841 | int ssl_undefined_function(SSL *s); |
| 831 | int ssl_undefined_void_function(void); | 842 | int ssl_undefined_void_function(void); |
| 832 | int ssl_undefined_const_function(const SSL *s); | 843 | int ssl_undefined_const_function(const SSL *s); |
| 833 | X509 *ssl_get_server_send_cert(SSL *); | 844 | CERT_PKEY *ssl_get_server_send_pkey(const SSL *s); |
| 845 | X509 *ssl_get_server_send_cert(const SSL *); | ||
| 834 | EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *c, const EVP_MD **pmd); | 846 | EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *c, const EVP_MD **pmd); |
| 835 | int ssl_cert_type(X509 *x,EVP_PKEY *pkey); | 847 | int ssl_cert_type(X509 *x,EVP_PKEY *pkey); |
| 836 | void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); | 848 | void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); |
| 837 | STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); | 849 | STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); |
| 838 | int ssl_verify_alarm_type(long type); | 850 | int ssl_verify_alarm_type(long type); |
| 839 | void ssl_load_ciphers(void); | 851 | void ssl_load_ciphers(void); |
| 852 | int ssl_fill_hello_random(SSL *s, int server, unsigned char *field, int len); | ||
| 840 | 853 | ||
| 841 | int ssl2_enc_init(SSL *s, int client); | 854 | int ssl2_enc_init(SSL *s, int client); |
| 842 | int ssl2_generate_key_material(SSL *s); | 855 | int ssl2_generate_key_material(SSL *s); |
| @@ -1088,7 +1101,8 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data, unsigned char *d, | |||
| 1088 | int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al); | 1101 | int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al); |
| 1089 | int ssl_prepare_clienthello_tlsext(SSL *s); | 1102 | int ssl_prepare_clienthello_tlsext(SSL *s); |
| 1090 | int ssl_prepare_serverhello_tlsext(SSL *s); | 1103 | int ssl_prepare_serverhello_tlsext(SSL *s); |
| 1091 | int ssl_check_clienthello_tlsext(SSL *s); | 1104 | int ssl_check_clienthello_tlsext_early(SSL *s); |
| 1105 | int ssl_check_clienthello_tlsext_late(SSL *s); | ||
| 1092 | int ssl_check_serverhello_tlsext(SSL *s); | 1106 | int ssl_check_serverhello_tlsext(SSL *s); |
| 1093 | 1107 | ||
| 1094 | #ifndef OPENSSL_NO_HEARTBEATS | 1108 | #ifndef OPENSSL_NO_HEARTBEATS |
| @@ -1131,4 +1145,33 @@ int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al | |||
| 1131 | int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); | 1145 | int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); |
| 1132 | int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); | 1146 | int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); |
| 1133 | 1147 | ||
| 1148 | /* s3_cbc.c */ | ||
| 1149 | void ssl3_cbc_copy_mac(unsigned char* out, | ||
| 1150 | const SSL3_RECORD *rec, | ||
| 1151 | unsigned md_size,unsigned orig_len); | ||
| 1152 | int ssl3_cbc_remove_padding(const SSL* s, | ||
| 1153 | SSL3_RECORD *rec, | ||
| 1154 | unsigned block_size, | ||
| 1155 | unsigned mac_size); | ||
| 1156 | int tls1_cbc_remove_padding(const SSL* s, | ||
| 1157 | SSL3_RECORD *rec, | ||
| 1158 | unsigned block_size, | ||
| 1159 | unsigned mac_size); | ||
| 1160 | char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx); | ||
| 1161 | void ssl3_cbc_digest_record( | ||
| 1162 | const EVP_MD_CTX *ctx, | ||
| 1163 | unsigned char* md_out, | ||
| 1164 | size_t* md_out_size, | ||
| 1165 | const unsigned char header[13], | ||
| 1166 | const unsigned char *data, | ||
| 1167 | size_t data_plus_mac_size, | ||
| 1168 | size_t data_plus_mac_plus_padding_size, | ||
| 1169 | const unsigned char *mac_secret, | ||
| 1170 | unsigned mac_secret_length, | ||
| 1171 | char is_sslv3); | ||
| 1172 | |||
| 1173 | void tls_fips_digest_extra( | ||
| 1174 | const EVP_CIPHER_CTX *cipher_ctx, EVP_MD_CTX *mac_ctx, | ||
| 1175 | const unsigned char *data, size_t data_len, size_t orig_len); | ||
| 1176 | |||
| 1134 | #endif | 1177 | #endif |
diff --git a/src/lib/libssl/src/ssl/ssl_rsa.c b/src/lib/libssl/src/ssl/ssl_rsa.c index c0960b5712..60e7b66859 100644 --- a/src/lib/libssl/src/ssl/ssl_rsa.c +++ b/src/lib/libssl/src/ssl/ssl_rsa.c | |||
| @@ -710,7 +710,7 @@ int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file) | |||
| 710 | 710 | ||
| 711 | ERR_clear_error(); /* clear error stack for SSL_CTX_use_certificate() */ | 711 | ERR_clear_error(); /* clear error stack for SSL_CTX_use_certificate() */ |
| 712 | 712 | ||
| 713 | in=BIO_new(BIO_s_file_internal()); | 713 | in = BIO_new(BIO_s_file_internal()); |
| 714 | if (in == NULL) | 714 | if (in == NULL) |
| 715 | { | 715 | { |
| 716 | SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE,ERR_R_BUF_LIB); | 716 | SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE,ERR_R_BUF_LIB); |
| @@ -723,14 +723,16 @@ int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file) | |||
| 723 | goto end; | 723 | goto end; |
| 724 | } | 724 | } |
| 725 | 725 | ||
| 726 | x=PEM_read_bio_X509_AUX(in,NULL,ctx->default_passwd_callback,ctx->default_passwd_callback_userdata); | 726 | x=PEM_read_bio_X509_AUX(in,NULL,ctx->default_passwd_callback, |
| 727 | ctx->default_passwd_callback_userdata); | ||
| 727 | if (x == NULL) | 728 | if (x == NULL) |
| 728 | { | 729 | { |
| 729 | SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE,ERR_R_PEM_LIB); | 730 | SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE,ERR_R_PEM_LIB); |
| 730 | goto end; | 731 | goto end; |
| 731 | } | 732 | } |
| 732 | 733 | ||
| 733 | ret=SSL_CTX_use_certificate(ctx,x); | 734 | ret = SSL_CTX_use_certificate(ctx, x); |
| 735 | |||
| 734 | if (ERR_peek_error() != 0) | 736 | if (ERR_peek_error() != 0) |
| 735 | ret = 0; /* Key/certificate mismatch doesn't imply ret==0 ... */ | 737 | ret = 0; /* Key/certificate mismatch doesn't imply ret==0 ... */ |
| 736 | if (ret) | 738 | if (ret) |
| @@ -742,13 +744,15 @@ int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file) | |||
| 742 | int r; | 744 | int r; |
| 743 | unsigned long err; | 745 | unsigned long err; |
| 744 | 746 | ||
| 745 | if (ctx->extra_certs != NULL) | 747 | if (ctx->extra_certs != NULL) |
| 746 | { | 748 | { |
| 747 | sk_X509_pop_free(ctx->extra_certs, X509_free); | 749 | sk_X509_pop_free(ctx->extra_certs, X509_free); |
| 748 | ctx->extra_certs = NULL; | 750 | ctx->extra_certs = NULL; |
| 749 | } | 751 | } |
| 750 | 752 | ||
| 751 | while ((ca = PEM_read_bio_X509(in,NULL,ctx->default_passwd_callback,ctx->default_passwd_callback_userdata)) | 753 | while ((ca = PEM_read_bio_X509(in, NULL, |
| 754 | ctx->default_passwd_callback, | ||
| 755 | ctx->default_passwd_callback_userdata)) | ||
| 752 | != NULL) | 756 | != NULL) |
| 753 | { | 757 | { |
| 754 | r = SSL_CTX_add_extra_chain_cert(ctx, ca); | 758 | r = SSL_CTX_add_extra_chain_cert(ctx, ca); |
diff --git a/src/lib/libssl/src/ssl/ssltest.c b/src/lib/libssl/src/ssl/ssltest.c index 0f8fd3902d..4f80be8ee4 100644 --- a/src/lib/libssl/src/ssl/ssltest.c +++ b/src/lib/libssl/src/ssl/ssltest.c | |||
| @@ -543,8 +543,8 @@ int main(int argc, char *argv[]) | |||
| 543 | int comp = 0; | 543 | int comp = 0; |
| 544 | #ifndef OPENSSL_NO_COMP | 544 | #ifndef OPENSSL_NO_COMP |
| 545 | COMP_METHOD *cm = NULL; | 545 | COMP_METHOD *cm = NULL; |
| 546 | #endif | ||
| 547 | STACK_OF(SSL_COMP) *ssl_comp_methods = NULL; | 546 | STACK_OF(SSL_COMP) *ssl_comp_methods = NULL; |
| 547 | #endif | ||
| 548 | int test_cipherlist = 0; | 548 | int test_cipherlist = 0; |
| 549 | #ifdef OPENSSL_FIPS | 549 | #ifdef OPENSSL_FIPS |
| 550 | int fips_mode=0; | 550 | int fips_mode=0; |
| @@ -881,7 +881,13 @@ bad: | |||
| 881 | meth=SSLv23_method(); | 881 | meth=SSLv23_method(); |
| 882 | #else | 882 | #else |
| 883 | #ifdef OPENSSL_NO_SSL2 | 883 | #ifdef OPENSSL_NO_SSL2 |
| 884 | meth=SSLv3_method(); | 884 | if (tls1) |
| 885 | meth=TLSv1_method(); | ||
| 886 | else | ||
| 887 | if (ssl3) | ||
| 888 | meth=SSLv3_method(); | ||
| 889 | else | ||
| 890 | meth=SSLv23_method(); | ||
| 885 | #else | 891 | #else |
| 886 | meth=SSLv2_method(); | 892 | meth=SSLv2_method(); |
| 887 | #endif | 893 | #endif |
diff --git a/src/lib/libssl/src/ssl/t1_enc.c b/src/lib/libssl/src/ssl/t1_enc.c index f7bdeb3b9d..0c4cddedf8 100644 --- a/src/lib/libssl/src/ssl/t1_enc.c +++ b/src/lib/libssl/src/ssl/t1_enc.c | |||
| @@ -361,7 +361,7 @@ int tls1_change_cipher_state(SSL *s, int which) | |||
| 361 | { | 361 | { |
| 362 | int i; | 362 | int i; |
| 363 | for (i=0; i<s->s3->tmp.key_block_length; i++) | 363 | for (i=0; i<s->s3->tmp.key_block_length; i++) |
| 364 | printf("%02x", key_block[i]); printf("\n"); | 364 | printf("%02x", s->s3->tmp.key_block[i]); printf("\n"); |
| 365 | } | 365 | } |
| 366 | #endif /* KSSL_DEBUG */ | 366 | #endif /* KSSL_DEBUG */ |
| 367 | 367 | ||
| @@ -414,15 +414,20 @@ int tls1_change_cipher_state(SSL *s, int which) | |||
| 414 | s->mac_flags |= SSL_MAC_FLAG_WRITE_MAC_STREAM; | 414 | s->mac_flags |= SSL_MAC_FLAG_WRITE_MAC_STREAM; |
| 415 | else | 415 | else |
| 416 | s->mac_flags &= ~SSL_MAC_FLAG_WRITE_MAC_STREAM; | 416 | s->mac_flags &= ~SSL_MAC_FLAG_WRITE_MAC_STREAM; |
| 417 | if (s->enc_write_ctx != NULL) | 417 | if (s->enc_write_ctx != NULL && !SSL_IS_DTLS(s)) |
| 418 | reuse_dd = 1; | 418 | reuse_dd = 1; |
| 419 | else if ((s->enc_write_ctx=OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL) | 419 | else if ((s->enc_write_ctx=EVP_CIPHER_CTX_new()) == NULL) |
| 420 | goto err; | 420 | goto err; |
| 421 | else | ||
| 422 | /* make sure it's intialized in case we exit later with an error */ | ||
| 423 | EVP_CIPHER_CTX_init(s->enc_write_ctx); | ||
| 424 | dd= s->enc_write_ctx; | 421 | dd= s->enc_write_ctx; |
| 425 | mac_ctx = ssl_replace_hash(&s->write_hash,NULL); | 422 | if (SSL_IS_DTLS(s)) |
| 423 | { | ||
| 424 | mac_ctx = EVP_MD_CTX_create(); | ||
| 425 | if (!mac_ctx) | ||
| 426 | goto err; | ||
| 427 | s->write_hash = mac_ctx; | ||
| 428 | } | ||
| 429 | else | ||
| 430 | mac_ctx = ssl_replace_hash(&s->write_hash,NULL); | ||
| 426 | #ifndef OPENSSL_NO_COMP | 431 | #ifndef OPENSSL_NO_COMP |
| 427 | if (s->compress != NULL) | 432 | if (s->compress != NULL) |
| 428 | { | 433 | { |
| @@ -667,12 +672,21 @@ err: | |||
| 667 | return(ret); | 672 | return(ret); |
| 668 | } | 673 | } |
| 669 | 674 | ||
| 675 | /* tls1_enc encrypts/decrypts the record in |s->wrec| / |s->rrec|, respectively. | ||
| 676 | * | ||
| 677 | * Returns: | ||
| 678 | * 0: (in non-constant time) if the record is publically invalid (i.e. too | ||
| 679 | * short etc). | ||
| 680 | * 1: if the record's padding is valid / the encryption was successful. | ||
| 681 | * -1: if the record's padding/AEAD-authenticator is invalid or, if sending, | ||
| 682 | * an internal error occured. | ||
| 683 | */ | ||
| 670 | int tls1_enc(SSL *s, int send) | 684 | int tls1_enc(SSL *s, int send) |
| 671 | { | 685 | { |
| 672 | SSL3_RECORD *rec; | 686 | SSL3_RECORD *rec; |
| 673 | EVP_CIPHER_CTX *ds; | 687 | EVP_CIPHER_CTX *ds; |
| 674 | unsigned long l; | 688 | unsigned long l; |
| 675 | int bs,i,ii,j,k,pad=0; | 689 | int bs,i,j,k,pad=0,ret,mac_size=0; |
| 676 | const EVP_CIPHER *enc; | 690 | const EVP_CIPHER *enc; |
| 677 | 691 | ||
| 678 | if (send) | 692 | if (send) |
| @@ -729,11 +743,11 @@ int tls1_enc(SSL *s, int send) | |||
| 729 | printf("tls1_enc(%d)\n", send); | 743 | printf("tls1_enc(%d)\n", send); |
| 730 | #endif /* KSSL_DEBUG */ | 744 | #endif /* KSSL_DEBUG */ |
| 731 | 745 | ||
| 732 | if ((s->session == NULL) || (ds == NULL) || | 746 | if ((s->session == NULL) || (ds == NULL) || (enc == NULL)) |
| 733 | (enc == NULL)) | ||
| 734 | { | 747 | { |
| 735 | memmove(rec->data,rec->input,rec->length); | 748 | memmove(rec->data,rec->input,rec->length); |
| 736 | rec->input=rec->data; | 749 | rec->input=rec->data; |
| 750 | ret = 1; | ||
| 737 | } | 751 | } |
| 738 | else | 752 | else |
| 739 | { | 753 | { |
| @@ -797,13 +811,13 @@ int tls1_enc(SSL *s, int send) | |||
| 797 | 811 | ||
| 798 | #ifdef KSSL_DEBUG | 812 | #ifdef KSSL_DEBUG |
| 799 | { | 813 | { |
| 800 | unsigned long ui; | 814 | unsigned long ui; |
| 801 | printf("EVP_Cipher(ds=%p,rec->data=%p,rec->input=%p,l=%ld) ==>\n", | 815 | printf("EVP_Cipher(ds=%p,rec->data=%p,rec->input=%p,l=%ld) ==>\n", |
| 802 | ds,rec->data,rec->input,l); | 816 | ds,rec->data,rec->input,l); |
| 803 | printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%d %d], %d iv_len\n", | 817 | printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%d %d], %d iv_len\n", |
| 804 | ds->buf_len, ds->cipher->key_len, | 818 | ds->buf_len, ds->cipher->key_len, |
| 805 | DES_KEY_SZ, DES_SCHEDULE_SZ, | 819 | DES_KEY_SZ, DES_SCHEDULE_SZ, |
| 806 | ds->cipher->iv_len); | 820 | ds->cipher->iv_len); |
| 807 | printf("\t\tIV: "); | 821 | printf("\t\tIV: "); |
| 808 | for (i=0; i<ds->cipher->iv_len; i++) printf("%02X", ds->iv[i]); | 822 | for (i=0; i<ds->cipher->iv_len; i++) printf("%02X", ds->iv[i]); |
| 809 | printf("\n"); | 823 | printf("\n"); |
| @@ -816,13 +830,7 @@ int tls1_enc(SSL *s, int send) | |||
| 816 | if (!send) | 830 | if (!send) |
| 817 | { | 831 | { |
| 818 | if (l == 0 || l%bs != 0) | 832 | if (l == 0 || l%bs != 0) |
| 819 | { | ||
| 820 | if (s->version >= TLS1_1_VERSION) | ||
| 821 | return -1; | ||
| 822 | SSLerr(SSL_F_TLS1_ENC,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG); | ||
| 823 | ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECRYPTION_FAILED); | ||
| 824 | return 0; | 833 | return 0; |
| 825 | } | ||
| 826 | } | 834 | } |
| 827 | 835 | ||
| 828 | i = EVP_Cipher(ds,rec->data,rec->input,l); | 836 | i = EVP_Cipher(ds,rec->data,rec->input,l); |
| @@ -839,68 +847,24 @@ int tls1_enc(SSL *s, int send) | |||
| 839 | 847 | ||
| 840 | #ifdef KSSL_DEBUG | 848 | #ifdef KSSL_DEBUG |
| 841 | { | 849 | { |
| 842 | unsigned long i; | 850 | unsigned long i; |
| 843 | printf("\trec->data="); | 851 | printf("\trec->data="); |
| 844 | for (i=0; i<l; i++) | 852 | for (i=0; i<l; i++) |
| 845 | printf(" %02x", rec->data[i]); printf("\n"); | 853 | printf(" %02x", rec->data[i]); printf("\n"); |
| 846 | } | 854 | } |
| 847 | #endif /* KSSL_DEBUG */ | 855 | #endif /* KSSL_DEBUG */ |
| 848 | 856 | ||
| 857 | ret = 1; | ||
| 858 | if (EVP_MD_CTX_md(s->read_hash) != NULL) | ||
| 859 | mac_size = EVP_MD_CTX_size(s->read_hash); | ||
| 849 | if ((bs != 1) && !send) | 860 | if ((bs != 1) && !send) |
| 850 | { | 861 | ret = tls1_cbc_remove_padding(s, rec, bs, mac_size); |
| 851 | ii=i=rec->data[l-1]; /* padding_length */ | ||
| 852 | i++; | ||
| 853 | /* NB: if compression is in operation the first packet | ||
| 854 | * may not be of even length so the padding bug check | ||
| 855 | * cannot be performed. This bug workaround has been | ||
| 856 | * around since SSLeay so hopefully it is either fixed | ||
| 857 | * now or no buggy implementation supports compression | ||
| 858 | * [steve] | ||
| 859 | */ | ||
| 860 | if ( (s->options&SSL_OP_TLS_BLOCK_PADDING_BUG) | ||
| 861 | && !s->expand) | ||
| 862 | { | ||
| 863 | /* First packet is even in size, so check */ | ||
| 864 | if ((memcmp(s->s3->read_sequence, | ||
| 865 | "\0\0\0\0\0\0\0\0",8) == 0) && !(ii & 1)) | ||
| 866 | s->s3->flags|=TLS1_FLAGS_TLS_PADDING_BUG; | ||
| 867 | if (s->s3->flags & TLS1_FLAGS_TLS_PADDING_BUG) | ||
| 868 | i--; | ||
| 869 | } | ||
| 870 | /* TLS 1.0 does not bound the number of padding bytes by the block size. | ||
| 871 | * All of them must have value 'padding_length'. */ | ||
| 872 | if (i > (int)rec->length) | ||
| 873 | { | ||
| 874 | /* Incorrect padding. SSLerr() and ssl3_alert are done | ||
| 875 | * by caller: we don't want to reveal whether this is | ||
| 876 | * a decryption error or a MAC verification failure | ||
| 877 | * (see http://www.openssl.org/~bodo/tls-cbc.txt) */ | ||
| 878 | return -1; | ||
| 879 | } | ||
| 880 | for (j=(int)(l-i); j<(int)l; j++) | ||
| 881 | { | ||
| 882 | if (rec->data[j] != ii) | ||
| 883 | { | ||
| 884 | /* Incorrect padding */ | ||
| 885 | return -1; | ||
| 886 | } | ||
| 887 | } | ||
| 888 | rec->length -=i; | ||
| 889 | if (s->version >= TLS1_1_VERSION | ||
| 890 | && EVP_CIPHER_CTX_mode(ds) == EVP_CIPH_CBC_MODE) | ||
| 891 | { | ||
| 892 | if (bs > (int)rec->length) | ||
| 893 | return -1; | ||
| 894 | rec->data += bs; /* skip the explicit IV */ | ||
| 895 | rec->input += bs; | ||
| 896 | rec->length -= bs; | ||
| 897 | } | ||
| 898 | } | ||
| 899 | if (pad && !send) | 862 | if (pad && !send) |
| 900 | rec->length -= pad; | 863 | rec->length -= pad; |
| 901 | } | 864 | } |
| 902 | return(1); | 865 | return ret; |
| 903 | } | 866 | } |
| 867 | |||
| 904 | int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *out) | 868 | int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *out) |
| 905 | { | 869 | { |
| 906 | unsigned int ret; | 870 | unsigned int ret; |
| @@ -956,18 +920,19 @@ int tls1_final_finish_mac(SSL *s, | |||
| 956 | if (mask & ssl_get_algorithm2(s)) | 920 | if (mask & ssl_get_algorithm2(s)) |
| 957 | { | 921 | { |
| 958 | int hashsize = EVP_MD_size(md); | 922 | int hashsize = EVP_MD_size(md); |
| 959 | if (hashsize < 0 || hashsize > (int)(sizeof buf - (size_t)(q-buf))) | 923 | EVP_MD_CTX *hdgst = s->s3->handshake_dgst[idx]; |
| 924 | if (!hdgst || hashsize < 0 || hashsize > (int)(sizeof buf - (size_t)(q-buf))) | ||
| 960 | { | 925 | { |
| 961 | /* internal error: 'buf' is too small for this cipersuite! */ | 926 | /* internal error: 'buf' is too small for this cipersuite! */ |
| 962 | err = 1; | 927 | err = 1; |
| 963 | } | 928 | } |
| 964 | else | 929 | else |
| 965 | { | 930 | { |
| 966 | EVP_MD_CTX_copy_ex(&ctx,s->s3->handshake_dgst[idx]); | 931 | if (!EVP_MD_CTX_copy_ex(&ctx, hdgst) || |
| 967 | EVP_DigestFinal_ex(&ctx,q,&i); | 932 | !EVP_DigestFinal_ex(&ctx,q,&i) || |
| 968 | if (i != (unsigned int)hashsize) /* can't really happen */ | 933 | (i != (unsigned int)hashsize)) |
| 969 | err = 1; | 934 | err = 1; |
| 970 | q+=i; | 935 | q+=hashsize; |
| 971 | } | 936 | } |
| 972 | } | 937 | } |
| 973 | } | 938 | } |
| @@ -990,10 +955,10 @@ int tls1_mac(SSL *ssl, unsigned char *md, int send) | |||
| 990 | SSL3_RECORD *rec; | 955 | SSL3_RECORD *rec; |
| 991 | unsigned char *seq; | 956 | unsigned char *seq; |
| 992 | EVP_MD_CTX *hash; | 957 | EVP_MD_CTX *hash; |
| 993 | size_t md_size; | 958 | size_t md_size, orig_len; |
| 994 | int i; | 959 | int i; |
| 995 | EVP_MD_CTX hmac, *mac_ctx; | 960 | EVP_MD_CTX hmac, *mac_ctx; |
| 996 | unsigned char buf[5]; | 961 | unsigned char header[13]; |
| 997 | int stream_mac = (send?(ssl->mac_flags & SSL_MAC_FLAG_WRITE_MAC_STREAM):(ssl->mac_flags&SSL_MAC_FLAG_READ_MAC_STREAM)); | 962 | int stream_mac = (send?(ssl->mac_flags & SSL_MAC_FLAG_WRITE_MAC_STREAM):(ssl->mac_flags&SSL_MAC_FLAG_READ_MAC_STREAM)); |
| 998 | int t; | 963 | int t; |
| 999 | 964 | ||
| @@ -1014,12 +979,6 @@ int tls1_mac(SSL *ssl, unsigned char *md, int send) | |||
| 1014 | OPENSSL_assert(t >= 0); | 979 | OPENSSL_assert(t >= 0); |
| 1015 | md_size=t; | 980 | md_size=t; |
| 1016 | 981 | ||
| 1017 | buf[0]=rec->type; | ||
| 1018 | buf[1]=(unsigned char)(ssl->version>>8); | ||
| 1019 | buf[2]=(unsigned char)(ssl->version); | ||
| 1020 | buf[3]=rec->length>>8; | ||
| 1021 | buf[4]=rec->length&0xff; | ||
| 1022 | |||
| 1023 | /* I should fix this up TLS TLS TLS TLS TLS XXXXXXXX */ | 982 | /* I should fix this up TLS TLS TLS TLS TLS XXXXXXXX */ |
| 1024 | if (stream_mac) | 983 | if (stream_mac) |
| 1025 | { | 984 | { |
| @@ -1027,7 +986,8 @@ int tls1_mac(SSL *ssl, unsigned char *md, int send) | |||
| 1027 | } | 986 | } |
| 1028 | else | 987 | else |
| 1029 | { | 988 | { |
| 1030 | EVP_MD_CTX_copy(&hmac,hash); | 989 | if (!EVP_MD_CTX_copy(&hmac,hash)) |
| 990 | return -1; | ||
| 1031 | mac_ctx = &hmac; | 991 | mac_ctx = &hmac; |
| 1032 | } | 992 | } |
| 1033 | 993 | ||
| @@ -1038,17 +998,55 @@ int tls1_mac(SSL *ssl, unsigned char *md, int send) | |||
| 1038 | s2n(send?ssl->d1->w_epoch:ssl->d1->r_epoch, p); | 998 | s2n(send?ssl->d1->w_epoch:ssl->d1->r_epoch, p); |
| 1039 | memcpy (p,&seq[2],6); | 999 | memcpy (p,&seq[2],6); |
| 1040 | 1000 | ||
| 1041 | EVP_DigestSignUpdate(mac_ctx,dtlsseq,8); | 1001 | memcpy(header, dtlsseq, 8); |
| 1042 | } | 1002 | } |
| 1043 | else | 1003 | else |
| 1044 | EVP_DigestSignUpdate(mac_ctx,seq,8); | 1004 | memcpy(header, seq, 8); |
| 1005 | |||
| 1006 | /* kludge: tls1_cbc_remove_padding passes padding length in rec->type */ | ||
| 1007 | orig_len = rec->length+md_size+((unsigned int)rec->type>>8); | ||
| 1008 | rec->type &= 0xff; | ||
| 1045 | 1009 | ||
| 1046 | EVP_DigestSignUpdate(mac_ctx,buf,5); | 1010 | header[8]=rec->type; |
| 1047 | EVP_DigestSignUpdate(mac_ctx,rec->input,rec->length); | 1011 | header[9]=(unsigned char)(ssl->version>>8); |
| 1048 | t=EVP_DigestSignFinal(mac_ctx,md,&md_size); | 1012 | header[10]=(unsigned char)(ssl->version); |
| 1049 | OPENSSL_assert(t > 0); | 1013 | header[11]=(rec->length)>>8; |
| 1014 | header[12]=(rec->length)&0xff; | ||
| 1015 | |||
| 1016 | if (!send && | ||
| 1017 | EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE && | ||
| 1018 | ssl3_cbc_record_digest_supported(mac_ctx)) | ||
| 1019 | { | ||
| 1020 | /* This is a CBC-encrypted record. We must avoid leaking any | ||
| 1021 | * timing-side channel information about how many blocks of | ||
| 1022 | * data we are hashing because that gives an attacker a | ||
| 1023 | * timing-oracle. */ | ||
| 1024 | ssl3_cbc_digest_record( | ||
| 1025 | mac_ctx, | ||
| 1026 | md, &md_size, | ||
| 1027 | header, rec->input, | ||
| 1028 | rec->length + md_size, orig_len, | ||
| 1029 | ssl->s3->read_mac_secret, | ||
| 1030 | ssl->s3->read_mac_secret_size, | ||
| 1031 | 0 /* not SSLv3 */); | ||
| 1032 | } | ||
| 1033 | else | ||
| 1034 | { | ||
| 1035 | EVP_DigestSignUpdate(mac_ctx,header,sizeof(header)); | ||
| 1036 | EVP_DigestSignUpdate(mac_ctx,rec->input,rec->length); | ||
| 1037 | t=EVP_DigestSignFinal(mac_ctx,md,&md_size); | ||
| 1038 | OPENSSL_assert(t > 0); | ||
| 1039 | #ifdef OPENSSL_FIPS | ||
| 1040 | if (!send && FIPS_mode()) | ||
| 1041 | tls_fips_digest_extra( | ||
| 1042 | ssl->enc_read_ctx, | ||
| 1043 | mac_ctx, rec->input, | ||
| 1044 | rec->length, orig_len); | ||
| 1045 | #endif | ||
| 1046 | } | ||
| 1050 | 1047 | ||
| 1051 | if (!stream_mac) EVP_MD_CTX_cleanup(&hmac); | 1048 | if (!stream_mac) |
| 1049 | EVP_MD_CTX_cleanup(&hmac); | ||
| 1052 | #ifdef TLS_DEBUG | 1050 | #ifdef TLS_DEBUG |
| 1053 | printf("sec="); | 1051 | printf("sec="); |
| 1054 | {unsigned int z; for (z=0; z<md_size; z++) printf("%02X ",mac_sec[z]); printf("\n"); } | 1052 | {unsigned int z; for (z=0; z<md_size; z++) printf("%02X ",mac_sec[z]); printf("\n"); } |
diff --git a/src/lib/libssl/src/ssl/t1_lib.c b/src/lib/libssl/src/ssl/t1_lib.c index 27c8e3460d..bddffd92cc 100644 --- a/src/lib/libssl/src/ssl/t1_lib.c +++ b/src/lib/libssl/src/ssl/t1_lib.c | |||
| @@ -342,19 +342,11 @@ static unsigned char tls12_sigalgs[] = { | |||
| 342 | #ifndef OPENSSL_NO_SHA | 342 | #ifndef OPENSSL_NO_SHA |
| 343 | tlsext_sigalg(TLSEXT_hash_sha1) | 343 | tlsext_sigalg(TLSEXT_hash_sha1) |
| 344 | #endif | 344 | #endif |
| 345 | #ifndef OPENSSL_NO_MD5 | ||
| 346 | tlsext_sigalg_rsa(TLSEXT_hash_md5) | ||
| 347 | #endif | ||
| 348 | }; | 345 | }; |
| 349 | 346 | ||
| 350 | int tls12_get_req_sig_algs(SSL *s, unsigned char *p) | 347 | int tls12_get_req_sig_algs(SSL *s, unsigned char *p) |
| 351 | { | 348 | { |
| 352 | size_t slen = sizeof(tls12_sigalgs); | 349 | size_t slen = sizeof(tls12_sigalgs); |
| 353 | #ifdef OPENSSL_FIPS | ||
| 354 | /* If FIPS mode don't include MD5 which is last */ | ||
| 355 | if (FIPS_mode()) | ||
| 356 | slen -= 2; | ||
| 357 | #endif | ||
| 358 | if (p) | 350 | if (p) |
| 359 | memcpy(p, tls12_sigalgs, slen); | 351 | memcpy(p, tls12_sigalgs, slen); |
| 360 | return (int)slen; | 352 | return (int)slen; |
| @@ -649,6 +641,7 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha | |||
| 649 | } | 641 | } |
| 650 | #endif | 642 | #endif |
| 651 | 643 | ||
| 644 | #ifndef OPENSSL_NO_SRTP | ||
| 652 | if(SSL_get_srtp_profiles(s)) | 645 | if(SSL_get_srtp_profiles(s)) |
| 653 | { | 646 | { |
| 654 | int el; | 647 | int el; |
| @@ -667,6 +660,37 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha | |||
| 667 | } | 660 | } |
| 668 | ret += el; | 661 | ret += el; |
| 669 | } | 662 | } |
| 663 | #endif | ||
| 664 | |||
| 665 | #ifdef TLSEXT_TYPE_padding | ||
| 666 | /* Add padding to workaround bugs in F5 terminators. | ||
| 667 | * See https://tools.ietf.org/html/draft-agl-tls-padding-03 | ||
| 668 | * | ||
| 669 | * NB: because this code works out the length of all existing | ||
| 670 | * extensions it MUST always appear last. | ||
| 671 | */ | ||
| 672 | { | ||
| 673 | int hlen = ret - (unsigned char *)s->init_buf->data; | ||
| 674 | /* The code in s23_clnt.c to build ClientHello messages includes the | ||
| 675 | * 5-byte record header in the buffer, while the code in s3_clnt.c does | ||
| 676 | * not. */ | ||
| 677 | if (s->state == SSL23_ST_CW_CLNT_HELLO_A) | ||
| 678 | hlen -= 5; | ||
| 679 | if (hlen > 0xff && hlen < 0x200) | ||
| 680 | { | ||
| 681 | hlen = 0x200 - hlen; | ||
| 682 | if (hlen >= 4) | ||
| 683 | hlen -= 4; | ||
| 684 | else | ||
| 685 | hlen = 0; | ||
| 686 | |||
| 687 | s2n(TLSEXT_TYPE_padding, ret); | ||
| 688 | s2n(hlen, ret); | ||
| 689 | memset(ret, 0, hlen); | ||
| 690 | ret += hlen; | ||
| 691 | } | ||
| 692 | } | ||
| 693 | #endif | ||
| 670 | 694 | ||
| 671 | if ((extdatalen = ret-p-2)== 0) | 695 | if ((extdatalen = ret-p-2)== 0) |
| 672 | return p; | 696 | return p; |
| @@ -781,6 +805,7 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned cha | |||
| 781 | } | 805 | } |
| 782 | #endif | 806 | #endif |
| 783 | 807 | ||
| 808 | #ifndef OPENSSL_NO_SRTP | ||
| 784 | if(s->srtp_profile) | 809 | if(s->srtp_profile) |
| 785 | { | 810 | { |
| 786 | int el; | 811 | int el; |
| @@ -799,6 +824,7 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned cha | |||
| 799 | } | 824 | } |
| 800 | ret+=el; | 825 | ret+=el; |
| 801 | } | 826 | } |
| 827 | #endif | ||
| 802 | 828 | ||
| 803 | if (((s->s3->tmp.new_cipher->id & 0xFFFF)==0x80 || (s->s3->tmp.new_cipher->id & 0xFFFF)==0x81) | 829 | if (((s->s3->tmp.new_cipher->id & 0xFFFF)==0x80 || (s->s3->tmp.new_cipher->id & 0xFFFF)==0x81) |
| 804 | && (SSL_get_options(s) & SSL_OP_CRYPTOPRO_TLSEXT_BUG)) | 830 | && (SSL_get_options(s) & SSL_OP_CRYPTOPRO_TLSEXT_BUG)) |
| @@ -862,6 +888,89 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned cha | |||
| 862 | return ret; | 888 | return ret; |
| 863 | } | 889 | } |
| 864 | 890 | ||
| 891 | #ifndef OPENSSL_NO_EC | ||
| 892 | /* ssl_check_for_safari attempts to fingerprint Safari using OS X | ||
| 893 | * SecureTransport using the TLS extension block in |d|, of length |n|. | ||
| 894 | * Safari, since 10.6, sends exactly these extensions, in this order: | ||
| 895 | * SNI, | ||
| 896 | * elliptic_curves | ||
| 897 | * ec_point_formats | ||
| 898 | * | ||
| 899 | * We wish to fingerprint Safari because they broke ECDHE-ECDSA support in 10.8, | ||
| 900 | * but they advertise support. So enabling ECDHE-ECDSA ciphers breaks them. | ||
| 901 | * Sadly we cannot differentiate 10.6, 10.7 and 10.8.4 (which work), from | ||
| 902 | * 10.8..10.8.3 (which don't work). | ||
| 903 | */ | ||
| 904 | static void ssl_check_for_safari(SSL *s, const unsigned char *data, const unsigned char *d, int n) { | ||
| 905 | unsigned short type, size; | ||
| 906 | static const unsigned char kSafariExtensionsBlock[] = { | ||
| 907 | 0x00, 0x0a, /* elliptic_curves extension */ | ||
| 908 | 0x00, 0x08, /* 8 bytes */ | ||
| 909 | 0x00, 0x06, /* 6 bytes of curve ids */ | ||
| 910 | 0x00, 0x17, /* P-256 */ | ||
| 911 | 0x00, 0x18, /* P-384 */ | ||
| 912 | 0x00, 0x19, /* P-521 */ | ||
| 913 | |||
| 914 | 0x00, 0x0b, /* ec_point_formats */ | ||
| 915 | 0x00, 0x02, /* 2 bytes */ | ||
| 916 | 0x01, /* 1 point format */ | ||
| 917 | 0x00, /* uncompressed */ | ||
| 918 | }; | ||
| 919 | |||
| 920 | /* The following is only present in TLS 1.2 */ | ||
| 921 | static const unsigned char kSafariTLS12ExtensionsBlock[] = { | ||
| 922 | 0x00, 0x0d, /* signature_algorithms */ | ||
| 923 | 0x00, 0x0c, /* 12 bytes */ | ||
| 924 | 0x00, 0x0a, /* 10 bytes */ | ||
| 925 | 0x05, 0x01, /* SHA-384/RSA */ | ||
| 926 | 0x04, 0x01, /* SHA-256/RSA */ | ||
| 927 | 0x02, 0x01, /* SHA-1/RSA */ | ||
| 928 | 0x04, 0x03, /* SHA-256/ECDSA */ | ||
| 929 | 0x02, 0x03, /* SHA-1/ECDSA */ | ||
| 930 | }; | ||
| 931 | |||
| 932 | if (data >= (d+n-2)) | ||
| 933 | return; | ||
| 934 | data += 2; | ||
| 935 | |||
| 936 | if (data > (d+n-4)) | ||
| 937 | return; | ||
| 938 | n2s(data,type); | ||
| 939 | n2s(data,size); | ||
| 940 | |||
| 941 | if (type != TLSEXT_TYPE_server_name) | ||
| 942 | return; | ||
| 943 | |||
| 944 | if (data+size > d+n) | ||
| 945 | return; | ||
| 946 | data += size; | ||
| 947 | |||
| 948 | if (TLS1_get_client_version(s) >= TLS1_2_VERSION) | ||
| 949 | { | ||
| 950 | const size_t len1 = sizeof(kSafariExtensionsBlock); | ||
| 951 | const size_t len2 = sizeof(kSafariTLS12ExtensionsBlock); | ||
| 952 | |||
| 953 | if (data + len1 + len2 != d+n) | ||
| 954 | return; | ||
| 955 | if (memcmp(data, kSafariExtensionsBlock, len1) != 0) | ||
| 956 | return; | ||
| 957 | if (memcmp(data + len1, kSafariTLS12ExtensionsBlock, len2) != 0) | ||
| 958 | return; | ||
| 959 | } | ||
| 960 | else | ||
| 961 | { | ||
| 962 | const size_t len = sizeof(kSafariExtensionsBlock); | ||
| 963 | |||
| 964 | if (data + len != d+n) | ||
| 965 | return; | ||
| 966 | if (memcmp(data, kSafariExtensionsBlock, len) != 0) | ||
| 967 | return; | ||
| 968 | } | ||
| 969 | |||
| 970 | s->s3->is_probably_safari = 1; | ||
| 971 | } | ||
| 972 | #endif /* !OPENSSL_NO_EC */ | ||
| 973 | |||
| 865 | int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, int *al) | 974 | int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, int *al) |
| 866 | { | 975 | { |
| 867 | unsigned short type; | 976 | unsigned short type; |
| @@ -882,6 +991,11 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in | |||
| 882 | SSL_TLSEXT_HB_DONT_SEND_REQUESTS); | 991 | SSL_TLSEXT_HB_DONT_SEND_REQUESTS); |
| 883 | #endif | 992 | #endif |
| 884 | 993 | ||
| 994 | #ifndef OPENSSL_NO_EC | ||
| 995 | if (s->options & SSL_OP_SAFARI_ECDHE_ECDSA_BUG) | ||
| 996 | ssl_check_for_safari(s, data, d, n); | ||
| 997 | #endif /* !OPENSSL_NO_EC */ | ||
| 998 | |||
| 885 | if (data >= (d+n-2)) | 999 | if (data >= (d+n-2)) |
| 886 | goto ri_check; | 1000 | goto ri_check; |
| 887 | n2s(data,len); | 1001 | n2s(data,len); |
| @@ -1077,7 +1191,8 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in | |||
| 1077 | int ellipticcurvelist_length = (*(sdata++) << 8); | 1191 | int ellipticcurvelist_length = (*(sdata++) << 8); |
| 1078 | ellipticcurvelist_length += (*(sdata++)); | 1192 | ellipticcurvelist_length += (*(sdata++)); |
| 1079 | 1193 | ||
| 1080 | if (ellipticcurvelist_length != size - 2) | 1194 | if (ellipticcurvelist_length != size - 2 || |
| 1195 | ellipticcurvelist_length < 1) | ||
| 1081 | { | 1196 | { |
| 1082 | *al = TLS1_AD_DECODE_ERROR; | 1197 | *al = TLS1_AD_DECODE_ERROR; |
| 1083 | return 0; | 1198 | return 0; |
| @@ -1176,7 +1291,7 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in | |||
| 1176 | } | 1291 | } |
| 1177 | } | 1292 | } |
| 1178 | else if (type == TLSEXT_TYPE_status_request && | 1293 | else if (type == TLSEXT_TYPE_status_request && |
| 1179 | s->version != DTLS1_VERSION && s->ctx->tlsext_status_cb) | 1294 | s->version != DTLS1_VERSION) |
| 1180 | { | 1295 | { |
| 1181 | 1296 | ||
| 1182 | if (size < 5) | 1297 | if (size < 5) |
| @@ -1328,12 +1443,14 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in | |||
| 1328 | #endif | 1443 | #endif |
| 1329 | 1444 | ||
| 1330 | /* session ticket processed earlier */ | 1445 | /* session ticket processed earlier */ |
| 1446 | #ifndef OPENSSL_NO_SRTP | ||
| 1331 | else if (type == TLSEXT_TYPE_use_srtp) | 1447 | else if (type == TLSEXT_TYPE_use_srtp) |
| 1332 | { | 1448 | { |
| 1333 | if(ssl_parse_clienthello_use_srtp_ext(s, data, size, | 1449 | if(ssl_parse_clienthello_use_srtp_ext(s, data, size, |
| 1334 | al)) | 1450 | al)) |
| 1335 | return 0; | 1451 | return 0; |
| 1336 | } | 1452 | } |
| 1453 | #endif | ||
| 1337 | 1454 | ||
| 1338 | data+=size; | 1455 | data+=size; |
| 1339 | } | 1456 | } |
| @@ -1433,7 +1550,8 @@ int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in | |||
| 1433 | unsigned char *sdata = data; | 1550 | unsigned char *sdata = data; |
| 1434 | int ecpointformatlist_length = *(sdata++); | 1551 | int ecpointformatlist_length = *(sdata++); |
| 1435 | 1552 | ||
| 1436 | if (ecpointformatlist_length != size - 1) | 1553 | if (ecpointformatlist_length != size - 1 || |
| 1554 | ecpointformatlist_length < 1) | ||
| 1437 | { | 1555 | { |
| 1438 | *al = TLS1_AD_DECODE_ERROR; | 1556 | *al = TLS1_AD_DECODE_ERROR; |
| 1439 | return 0; | 1557 | return 0; |
| @@ -1527,7 +1645,7 @@ int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in | |||
| 1527 | unsigned char selected_len; | 1645 | unsigned char selected_len; |
| 1528 | 1646 | ||
| 1529 | /* We must have requested it. */ | 1647 | /* We must have requested it. */ |
| 1530 | if ((s->ctx->next_proto_select_cb == NULL)) | 1648 | if (s->ctx->next_proto_select_cb == NULL) |
| 1531 | { | 1649 | { |
| 1532 | *al = TLS1_AD_UNSUPPORTED_EXTENSION; | 1650 | *al = TLS1_AD_UNSUPPORTED_EXTENSION; |
| 1533 | return 0; | 1651 | return 0; |
| @@ -1577,12 +1695,14 @@ int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in | |||
| 1577 | } | 1695 | } |
| 1578 | } | 1696 | } |
| 1579 | #endif | 1697 | #endif |
| 1698 | #ifndef OPENSSL_NO_SRTP | ||
| 1580 | else if (type == TLSEXT_TYPE_use_srtp) | 1699 | else if (type == TLSEXT_TYPE_use_srtp) |
| 1581 | { | 1700 | { |
| 1582 | if(ssl_parse_serverhello_use_srtp_ext(s, data, size, | 1701 | if(ssl_parse_serverhello_use_srtp_ext(s, data, size, |
| 1583 | al)) | 1702 | al)) |
| 1584 | return 0; | 1703 | return 0; |
| 1585 | } | 1704 | } |
| 1705 | #endif | ||
| 1586 | 1706 | ||
| 1587 | data+=size; | 1707 | data+=size; |
| 1588 | } | 1708 | } |
| @@ -1763,7 +1883,7 @@ int ssl_prepare_serverhello_tlsext(SSL *s) | |||
| 1763 | return 1; | 1883 | return 1; |
| 1764 | } | 1884 | } |
| 1765 | 1885 | ||
| 1766 | int ssl_check_clienthello_tlsext(SSL *s) | 1886 | int ssl_check_clienthello_tlsext_early(SSL *s) |
| 1767 | { | 1887 | { |
| 1768 | int ret=SSL_TLSEXT_ERR_NOACK; | 1888 | int ret=SSL_TLSEXT_ERR_NOACK; |
| 1769 | int al = SSL_AD_UNRECOGNIZED_NAME; | 1889 | int al = SSL_AD_UNRECOGNIZED_NAME; |
| @@ -1782,42 +1902,12 @@ int ssl_check_clienthello_tlsext(SSL *s) | |||
| 1782 | else if (s->initial_ctx != NULL && s->initial_ctx->tlsext_servername_callback != 0) | 1902 | else if (s->initial_ctx != NULL && s->initial_ctx->tlsext_servername_callback != 0) |
| 1783 | ret = s->initial_ctx->tlsext_servername_callback(s, &al, s->initial_ctx->tlsext_servername_arg); | 1903 | ret = s->initial_ctx->tlsext_servername_callback(s, &al, s->initial_ctx->tlsext_servername_arg); |
| 1784 | 1904 | ||
| 1785 | /* If status request then ask callback what to do. | ||
| 1786 | * Note: this must be called after servername callbacks in case | ||
| 1787 | * the certificate has changed. | ||
| 1788 | */ | ||
| 1789 | if ((s->tlsext_status_type != -1) && s->ctx && s->ctx->tlsext_status_cb) | ||
| 1790 | { | ||
| 1791 | int r; | ||
| 1792 | r = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg); | ||
| 1793 | switch (r) | ||
| 1794 | { | ||
| 1795 | /* We don't want to send a status request response */ | ||
| 1796 | case SSL_TLSEXT_ERR_NOACK: | ||
| 1797 | s->tlsext_status_expected = 0; | ||
| 1798 | break; | ||
| 1799 | /* status request response should be sent */ | ||
| 1800 | case SSL_TLSEXT_ERR_OK: | ||
| 1801 | if (s->tlsext_ocsp_resp) | ||
| 1802 | s->tlsext_status_expected = 1; | ||
| 1803 | else | ||
| 1804 | s->tlsext_status_expected = 0; | ||
| 1805 | break; | ||
| 1806 | /* something bad happened */ | ||
| 1807 | case SSL_TLSEXT_ERR_ALERT_FATAL: | ||
| 1808 | ret = SSL_TLSEXT_ERR_ALERT_FATAL; | ||
| 1809 | al = SSL_AD_INTERNAL_ERROR; | ||
| 1810 | goto err; | ||
| 1811 | } | ||
| 1812 | } | ||
| 1813 | else | ||
| 1814 | s->tlsext_status_expected = 0; | ||
| 1815 | |||
| 1816 | #ifdef TLSEXT_TYPE_opaque_prf_input | 1905 | #ifdef TLSEXT_TYPE_opaque_prf_input |
| 1817 | { | 1906 | { |
| 1818 | /* This sort of belongs into ssl_prepare_serverhello_tlsext(), | 1907 | /* This sort of belongs into ssl_prepare_serverhello_tlsext(), |
| 1819 | * but we might be sending an alert in response to the client hello, | 1908 | * but we might be sending an alert in response to the client hello, |
| 1820 | * so this has to happen here in ssl_check_clienthello_tlsext(). */ | 1909 | * so this has to happen here in |
| 1910 | * ssl_check_clienthello_tlsext_early(). */ | ||
| 1821 | 1911 | ||
| 1822 | int r = 1; | 1912 | int r = 1; |
| 1823 | 1913 | ||
| @@ -1869,8 +1959,8 @@ int ssl_check_clienthello_tlsext(SSL *s) | |||
| 1869 | } | 1959 | } |
| 1870 | } | 1960 | } |
| 1871 | 1961 | ||
| 1872 | #endif | ||
| 1873 | err: | 1962 | err: |
| 1963 | #endif | ||
| 1874 | switch (ret) | 1964 | switch (ret) |
| 1875 | { | 1965 | { |
| 1876 | case SSL_TLSEXT_ERR_ALERT_FATAL: | 1966 | case SSL_TLSEXT_ERR_ALERT_FATAL: |
| @@ -1888,6 +1978,71 @@ int ssl_check_clienthello_tlsext(SSL *s) | |||
| 1888 | } | 1978 | } |
| 1889 | } | 1979 | } |
| 1890 | 1980 | ||
| 1981 | int ssl_check_clienthello_tlsext_late(SSL *s) | ||
| 1982 | { | ||
| 1983 | int ret = SSL_TLSEXT_ERR_OK; | ||
| 1984 | int al; | ||
| 1985 | |||
| 1986 | /* If status request then ask callback what to do. | ||
| 1987 | * Note: this must be called after servername callbacks in case | ||
| 1988 | * the certificate has changed, and must be called after the cipher | ||
| 1989 | * has been chosen because this may influence which certificate is sent | ||
| 1990 | */ | ||
| 1991 | if ((s->tlsext_status_type != -1) && s->ctx && s->ctx->tlsext_status_cb) | ||
| 1992 | { | ||
| 1993 | int r; | ||
| 1994 | CERT_PKEY *certpkey; | ||
| 1995 | certpkey = ssl_get_server_send_pkey(s); | ||
| 1996 | /* If no certificate can't return certificate status */ | ||
| 1997 | if (certpkey == NULL) | ||
| 1998 | { | ||
| 1999 | s->tlsext_status_expected = 0; | ||
| 2000 | return 1; | ||
| 2001 | } | ||
| 2002 | /* Set current certificate to one we will use so | ||
| 2003 | * SSL_get_certificate et al can pick it up. | ||
| 2004 | */ | ||
| 2005 | s->cert->key = certpkey; | ||
| 2006 | r = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg); | ||
| 2007 | switch (r) | ||
| 2008 | { | ||
| 2009 | /* We don't want to send a status request response */ | ||
| 2010 | case SSL_TLSEXT_ERR_NOACK: | ||
| 2011 | s->tlsext_status_expected = 0; | ||
| 2012 | break; | ||
| 2013 | /* status request response should be sent */ | ||
| 2014 | case SSL_TLSEXT_ERR_OK: | ||
| 2015 | if (s->tlsext_ocsp_resp) | ||
| 2016 | s->tlsext_status_expected = 1; | ||
| 2017 | else | ||
| 2018 | s->tlsext_status_expected = 0; | ||
| 2019 | break; | ||
| 2020 | /* something bad happened */ | ||
| 2021 | case SSL_TLSEXT_ERR_ALERT_FATAL: | ||
| 2022 | ret = SSL_TLSEXT_ERR_ALERT_FATAL; | ||
| 2023 | al = SSL_AD_INTERNAL_ERROR; | ||
| 2024 | goto err; | ||
| 2025 | } | ||
| 2026 | } | ||
| 2027 | else | ||
| 2028 | s->tlsext_status_expected = 0; | ||
| 2029 | |||
| 2030 | err: | ||
| 2031 | switch (ret) | ||
| 2032 | { | ||
| 2033 | case SSL_TLSEXT_ERR_ALERT_FATAL: | ||
| 2034 | ssl3_send_alert(s,SSL3_AL_FATAL,al); | ||
| 2035 | return -1; | ||
| 2036 | |||
| 2037 | case SSL_TLSEXT_ERR_ALERT_WARNING: | ||
| 2038 | ssl3_send_alert(s,SSL3_AL_WARNING,al); | ||
| 2039 | return 1; | ||
| 2040 | |||
| 2041 | default: | ||
| 2042 | return 1; | ||
| 2043 | } | ||
| 2044 | } | ||
| 2045 | |||
| 1891 | int ssl_check_serverhello_tlsext(SSL *s) | 2046 | int ssl_check_serverhello_tlsext(SSL *s) |
| 1892 | { | 2047 | { |
| 1893 | int ret=SSL_TLSEXT_ERR_NOACK; | 2048 | int ret=SSL_TLSEXT_ERR_NOACK; |
| @@ -2189,7 +2344,7 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, | |||
| 2189 | HMAC_Update(&hctx, etick, eticklen); | 2344 | HMAC_Update(&hctx, etick, eticklen); |
| 2190 | HMAC_Final(&hctx, tick_hmac, NULL); | 2345 | HMAC_Final(&hctx, tick_hmac, NULL); |
| 2191 | HMAC_CTX_cleanup(&hctx); | 2346 | HMAC_CTX_cleanup(&hctx); |
| 2192 | if (memcmp(tick_hmac, etick + eticklen, mlen)) | 2347 | if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) |
| 2193 | return 2; | 2348 | return 2; |
| 2194 | /* Attempt to decrypt session data */ | 2349 | /* Attempt to decrypt session data */ |
| 2195 | /* Move p after IV to start of encrypted ticket, update length */ | 2350 | /* Move p after IV to start of encrypted ticket, update length */ |
| @@ -2319,14 +2474,6 @@ const EVP_MD *tls12_get_hash(unsigned char hash_alg) | |||
| 2319 | { | 2474 | { |
| 2320 | switch(hash_alg) | 2475 | switch(hash_alg) |
| 2321 | { | 2476 | { |
| 2322 | #ifndef OPENSSL_NO_MD5 | ||
| 2323 | case TLSEXT_hash_md5: | ||
| 2324 | #ifdef OPENSSL_FIPS | ||
| 2325 | if (FIPS_mode()) | ||
| 2326 | return NULL; | ||
| 2327 | #endif | ||
| 2328 | return EVP_md5(); | ||
| 2329 | #endif | ||
| 2330 | #ifndef OPENSSL_NO_SHA | 2477 | #ifndef OPENSSL_NO_SHA |
| 2331 | case TLSEXT_hash_sha1: | 2478 | case TLSEXT_hash_sha1: |
| 2332 | return EVP_sha1(); | 2479 | return EVP_sha1(); |
| @@ -2414,7 +2561,7 @@ int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize) | |||
| 2414 | */ | 2561 | */ |
| 2415 | #ifndef OPENSSL_NO_DSA | 2562 | #ifndef OPENSSL_NO_DSA |
| 2416 | if (!c->pkeys[SSL_PKEY_DSA_SIGN].digest) | 2563 | if (!c->pkeys[SSL_PKEY_DSA_SIGN].digest) |
| 2417 | c->pkeys[SSL_PKEY_DSA_SIGN].digest = EVP_dss1(); | 2564 | c->pkeys[SSL_PKEY_DSA_SIGN].digest = EVP_sha1(); |
| 2418 | #endif | 2565 | #endif |
| 2419 | #ifndef OPENSSL_NO_RSA | 2566 | #ifndef OPENSSL_NO_RSA |
| 2420 | if (!c->pkeys[SSL_PKEY_RSA_SIGN].digest) | 2567 | if (!c->pkeys[SSL_PKEY_RSA_SIGN].digest) |
| @@ -2425,7 +2572,7 @@ int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize) | |||
| 2425 | #endif | 2572 | #endif |
| 2426 | #ifndef OPENSSL_NO_ECDSA | 2573 | #ifndef OPENSSL_NO_ECDSA |
| 2427 | if (!c->pkeys[SSL_PKEY_ECC].digest) | 2574 | if (!c->pkeys[SSL_PKEY_ECC].digest) |
| 2428 | c->pkeys[SSL_PKEY_ECC].digest = EVP_ecdsa(); | 2575 | c->pkeys[SSL_PKEY_ECC].digest = EVP_sha1(); |
| 2429 | #endif | 2576 | #endif |
| 2430 | return 1; | 2577 | return 1; |
| 2431 | } | 2578 | } |
| @@ -2441,16 +2588,20 @@ tls1_process_heartbeat(SSL *s) | |||
| 2441 | unsigned int payload; | 2588 | unsigned int payload; |
| 2442 | unsigned int padding = 16; /* Use minimum padding */ | 2589 | unsigned int padding = 16; /* Use minimum padding */ |
| 2443 | 2590 | ||
| 2444 | /* Read type and payload length first */ | ||
| 2445 | hbtype = *p++; | ||
| 2446 | n2s(p, payload); | ||
| 2447 | pl = p; | ||
| 2448 | |||
| 2449 | if (s->msg_callback) | 2591 | if (s->msg_callback) |
| 2450 | s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT, | 2592 | s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT, |
| 2451 | &s->s3->rrec.data[0], s->s3->rrec.length, | 2593 | &s->s3->rrec.data[0], s->s3->rrec.length, |
| 2452 | s, s->msg_callback_arg); | 2594 | s, s->msg_callback_arg); |
| 2453 | 2595 | ||
| 2596 | /* Read type and payload length first */ | ||
| 2597 | if (1 + 2 + 16 > s->s3->rrec.length) | ||
| 2598 | return 0; /* silently discard */ | ||
| 2599 | hbtype = *p++; | ||
| 2600 | n2s(p, payload); | ||
| 2601 | if (1 + 2 + payload + 16 > s->s3->rrec.length) | ||
| 2602 | return 0; /* silently discard per RFC 6520 sec. 4 */ | ||
| 2603 | pl = p; | ||
| 2604 | |||
| 2454 | if (hbtype == TLS1_HB_REQUEST) | 2605 | if (hbtype == TLS1_HB_REQUEST) |
| 2455 | { | 2606 | { |
| 2456 | unsigned char *buffer, *bp; | 2607 | unsigned char *buffer, *bp; |
diff --git a/src/lib/libssl/src/ssl/tls1.h b/src/lib/libssl/src/ssl/tls1.h index c39c267f0b..c992091e30 100644 --- a/src/lib/libssl/src/ssl/tls1.h +++ b/src/lib/libssl/src/ssl/tls1.h | |||
| @@ -230,6 +230,12 @@ extern "C" { | |||
| 230 | /* ExtensionType value from RFC5620 */ | 230 | /* ExtensionType value from RFC5620 */ |
| 231 | #define TLSEXT_TYPE_heartbeat 15 | 231 | #define TLSEXT_TYPE_heartbeat 15 |
| 232 | 232 | ||
| 233 | /* ExtensionType value for TLS padding extension. | ||
| 234 | * http://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml | ||
| 235 | * http://tools.ietf.org/html/draft-agl-tls-padding-03 | ||
| 236 | */ | ||
| 237 | #define TLSEXT_TYPE_padding 21 | ||
| 238 | |||
| 233 | /* ExtensionType value from RFC4507 */ | 239 | /* ExtensionType value from RFC4507 */ |
| 234 | #define TLSEXT_TYPE_session_ticket 35 | 240 | #define TLSEXT_TYPE_session_ticket 35 |
| 235 | 241 | ||
diff --git a/src/lib/libssl/src/test/Makefile b/src/lib/libssl/src/test/Makefile index 09e6848764..4c9eabcc21 100644 --- a/src/lib/libssl/src/test/Makefile +++ b/src/lib/libssl/src/test/Makefile | |||
| @@ -246,7 +246,7 @@ test_ecdh: | |||
| 246 | test_verify: | 246 | test_verify: |
| 247 | @echo "The following command should have some OK's and some failures" | 247 | @echo "The following command should have some OK's and some failures" |
| 248 | @echo "There are definitly a few expired certificates" | 248 | @echo "There are definitly a few expired certificates" |
| 249 | ../util/shlib_wrap.sh ../apps/openssl verify -CApath ../certs ../certs/*.pem | 249 | ../util/shlib_wrap.sh ../apps/openssl verify -CApath ../certs/demo ../certs/demo/*.pem |
| 250 | 250 | ||
| 251 | test_dh: | 251 | test_dh: |
| 252 | @echo "Generate a set of DH parameters" | 252 | @echo "Generate a set of DH parameters" |
diff --git a/src/lib/libssl/src/test/testssl b/src/lib/libssl/src/test/testssl index 5ae4dc8720..4e8542b556 100644 --- a/src/lib/libssl/src/test/testssl +++ b/src/lib/libssl/src/test/testssl | |||
| @@ -119,6 +119,23 @@ $ssltest -bio_pair -server_auth -client_auth $CA $extra || exit 1 | |||
| 119 | echo test sslv2/sslv3 with both client and server authentication via BIO pair and app verify | 119 | echo test sslv2/sslv3 with both client and server authentication via BIO pair and app verify |
| 120 | $ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exit 1 | 120 | $ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exit 1 |
| 121 | 121 | ||
| 122 | echo "Testing ciphersuites" | ||
| 123 | for protocol in TLSv1.2 SSLv3; do | ||
| 124 | echo "Testing ciphersuites for $protocol" | ||
| 125 | for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "RSA+$protocol" | tr ':' ' '`; do | ||
| 126 | echo "Testing $cipher" | ||
| 127 | prot="" | ||
| 128 | if [ $protocol = "SSLv3" ] ; then | ||
| 129 | prot="-ssl3" | ||
| 130 | fi | ||
| 131 | $ssltest -cipher $cipher $prot | ||
| 132 | if [ $? -ne 0 ] ; then | ||
| 133 | echo "Failed $cipher" | ||
| 134 | exit 1 | ||
| 135 | fi | ||
| 136 | done | ||
| 137 | done | ||
| 138 | |||
| 122 | ############################################################################# | 139 | ############################################################################# |
| 123 | 140 | ||
| 124 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then | 141 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then |
diff --git a/src/lib/libssl/src/util/libeay.num b/src/lib/libssl/src/util/libeay.num index 93f80ba0c6..aa86b2b8b1 100644 --- a/src/lib/libssl/src/util/libeay.num +++ b/src/lib/libssl/src/util/libeay.num | |||
| @@ -3510,6 +3510,8 @@ BIO_get_callback_arg 3902 EXIST::FUNCTION: | |||
| 3510 | BIO_set_callback 3903 EXIST::FUNCTION: | 3510 | BIO_set_callback 3903 EXIST::FUNCTION: |
| 3511 | d2i_ASIdOrRange 3904 EXIST::FUNCTION:RFC3779 | 3511 | d2i_ASIdOrRange 3904 EXIST::FUNCTION:RFC3779 |
| 3512 | i2d_ASIdentifiers 3905 EXIST::FUNCTION:RFC3779 | 3512 | i2d_ASIdentifiers 3905 EXIST::FUNCTION:RFC3779 |
| 3513 | CRYPTO_memcmp 3906 EXIST::FUNCTION: | ||
| 3514 | BN_consttime_swap 3907 EXIST::FUNCTION: | ||
| 3513 | SEED_decrypt 3908 EXIST::FUNCTION:SEED | 3515 | SEED_decrypt 3908 EXIST::FUNCTION:SEED |
| 3514 | SEED_encrypt 3909 EXIST::FUNCTION:SEED | 3516 | SEED_encrypt 3909 EXIST::FUNCTION:SEED |
| 3515 | SEED_cbc_encrypt 3910 EXIST::FUNCTION:SEED | 3517 | SEED_cbc_encrypt 3910 EXIST::FUNCTION:SEED |
| @@ -3687,7 +3689,7 @@ FIPS_dh_new 4073 NOEXIST::FUNCTION: | |||
| 3687 | FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION: | 3689 | FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION: |
| 3688 | FIPS_dh_free 4075 NOEXIST::FUNCTION: | 3690 | FIPS_dh_free 4075 NOEXIST::FUNCTION: |
| 3689 | fips_pkey_signature_test 4076 NOEXIST::FUNCTION: | 3691 | fips_pkey_signature_test 4076 NOEXIST::FUNCTION: |
| 3690 | EVP_add_alg_module 4077 NOEXIST::FUNCTION: | 3692 | EVP_add_alg_module 4077 EXIST::FUNCTION: |
| 3691 | int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION: | 3693 | int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION: |
| 3692 | int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION: | 3694 | int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION: |
| 3693 | int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION: | 3695 | int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION: |
diff --git a/src/lib/libssl/src/util/pl/BC-32.pl b/src/lib/libssl/src/util/pl/BC-32.pl index 1f1e13fb40..b41bb45e82 100644 --- a/src/lib/libssl/src/util/pl/BC-32.pl +++ b/src/lib/libssl/src/util/pl/BC-32.pl | |||
| @@ -18,7 +18,7 @@ $out_def="out32"; | |||
| 18 | $tmp_def="tmp32"; | 18 | $tmp_def="tmp32"; |
| 19 | $inc_def="inc32"; | 19 | $inc_def="inc32"; |
| 20 | #enable max error messages, disable most common warnings | 20 | #enable max error messages, disable most common warnings |
| 21 | $cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp "; | 21 | $cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp -D_timeb=timeb -D_ftime=ftime "; |
| 22 | if ($debug) | 22 | if ($debug) |
| 23 | { | 23 | { |
| 24 | $cflags.="-Od -y -v -vi- -D_DEBUG"; | 24 | $cflags.="-Od -y -v -vi- -D_DEBUG"; |
| @@ -38,7 +38,7 @@ $efile=""; | |||
| 38 | $exep='.exe'; | 38 | $exep='.exe'; |
| 39 | if ($no_sock) | 39 | if ($no_sock) |
| 40 | { $ex_libs=""; } | 40 | { $ex_libs=""; } |
| 41 | else { $ex_libs="cw32mt.lib import32.lib"; } | 41 | else { $ex_libs="cw32mt.lib import32.lib crypt32.lib ws2_32.lib"; } |
| 42 | 42 | ||
| 43 | # static library stuff | 43 | # static library stuff |
| 44 | $mklib='tlib /P64'; | 44 | $mklib='tlib /P64'; |
| @@ -51,8 +51,8 @@ $lfile=''; | |||
| 51 | $shlib_ex_obj=""; | 51 | $shlib_ex_obj=""; |
| 52 | $app_ex_obj="c0x32.obj"; | 52 | $app_ex_obj="c0x32.obj"; |
| 53 | 53 | ||
| 54 | $asm='nasmw -f obj -d__omf__'; | 54 | $asm=(`nasm -v 2>NUL` ge `nasmw -v 2>NUL`?"nasm":"nasmw")." -f obj -d__omf__"; |
| 55 | $asm.=" /Zi" if $debug; | 55 | $asm.=" -g" if $debug; |
| 56 | $afile='-o'; | 56 | $afile='-o'; |
| 57 | 57 | ||
| 58 | $bn_mulw_obj=''; | 58 | $bn_mulw_obj=''; |
diff --git a/src/lib/libssl/src/util/pl/VC-32.pl b/src/lib/libssl/src/util/pl/VC-32.pl index c503bd52b9..3705fc73b7 100644 --- a/src/lib/libssl/src/util/pl/VC-32.pl +++ b/src/lib/libssl/src/util/pl/VC-32.pl | |||
| @@ -27,6 +27,8 @@ $zlib_lib="zlib1.lib"; | |||
| 27 | $l_flags =~ s/-L("\[^"]+")/\/libpath:$1/g; | 27 | $l_flags =~ s/-L("\[^"]+")/\/libpath:$1/g; |
| 28 | $l_flags =~ s/-L(\S+)/\/libpath:$1/g; | 28 | $l_flags =~ s/-L(\S+)/\/libpath:$1/g; |
| 29 | 29 | ||
| 30 | my $ff = ""; | ||
| 31 | |||
| 30 | # C compiler stuff | 32 | # C compiler stuff |
| 31 | $cc='cl'; | 33 | $cc='cl'; |
| 32 | if ($FLAVOR =~ /WIN64/) | 34 | if ($FLAVOR =~ /WIN64/) |
| @@ -118,7 +120,7 @@ elsif ($FLAVOR =~ /CE/) | |||
| 118 | $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'})); | 120 | $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'})); |
| 119 | $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'})); | 121 | $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'})); |
| 120 | $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... | 122 | $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... |
| 121 | $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG'; | 123 | $dbg_cflags=' /MC /Od -DDEBUG -D_DEBUG'; |
| 122 | $lflags="/nologo /opt:ref $wcelflag"; | 124 | $lflags="/nologo /opt:ref $wcelflag"; |
| 123 | } | 125 | } |
| 124 | else # Win32 | 126 | else # Win32 |
| @@ -126,6 +128,7 @@ else # Win32 | |||
| 126 | $base_cflags= " $mf_cflag"; | 128 | $base_cflags= " $mf_cflag"; |
| 127 | my $f = $shlib || $fips ?' /MD':' /MT'; | 129 | my $f = $shlib || $fips ?' /MD':' /MT'; |
| 128 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib | 130 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib |
| 131 | $ff = "/fixed"; | ||
| 129 | $opt_cflags=$f.' /Ox /O2 /Ob2'; | 132 | $opt_cflags=$f.' /Ox /O2 /Ob2'; |
| 130 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; | 133 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; |
| 131 | $lflags="/nologo /subsystem:console /opt:ref"; | 134 | $lflags="/nologo /subsystem:console /opt:ref"; |
| @@ -318,7 +321,7 @@ sub do_lib_rule | |||
| 318 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; | 321 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; |
| 319 | $ret.="\tSET FIPS_TARGET=$target\n"; | 322 | $ret.="\tSET FIPS_TARGET=$target\n"; |
| 320 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; | 323 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; |
| 321 | $ret.="\t\$(FIPSLINK) \$(MLFLAGS) /map $base_arg $efile$target "; | 324 | $ret.="\t\$(FIPSLINK) \$(MLFLAGS) $ff /map $base_arg $efile$target "; |
| 322 | $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs \$(EX_LIBS) "; | 325 | $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs \$(EX_LIBS) "; |
| 323 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n"; | 326 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n"; |
| 324 | } | 327 | } |
| @@ -355,7 +358,7 @@ sub do_link_rule | |||
| 355 | $ret.="\tSET FIPS_TARGET=$target\n"; | 358 | $ret.="\tSET FIPS_TARGET=$target\n"; |
| 356 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; | 359 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; |
| 357 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; | 360 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; |
| 358 | $ret.="\t\$(FIPSLINK) \$(LFLAGS) /map $efile$target @<<\n"; | 361 | $ret.="\t\$(FIPSLINK) \$(LFLAGS) $ff /map $efile$target @<<\n"; |
| 359 | $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n"; | 362 | $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n"; |
| 360 | } | 363 | } |
| 361 | else | 364 | else |
diff --git a/src/lib/libssl/src/util/shlib_wrap.sh b/src/lib/libssl/src/util/shlib_wrap.sh index 9416d593d2..8775cb5411 100755 --- a/src/lib/libssl/src/util/shlib_wrap.sh +++ b/src/lib/libssl/src/util/shlib_wrap.sh | |||
| @@ -90,4 +90,8 @@ fi | |||
| 90 | 90 | ||
| 91 | cmd="$1${EXE_EXT}" | 91 | cmd="$1${EXE_EXT}" |
| 92 | shift | 92 | shift |
| 93 | exec "$cmd" "$@" | 93 | if [ $# -eq 0 ]; then |
| 94 | exec "$cmd" # old sh, such as Tru64 4.x, fails to expand empty "$@" | ||
| 95 | else | ||
| 96 | exec "$cmd" "$@" | ||
| 97 | fi | ||
diff --git a/src/lib/libssl/test/Makefile b/src/lib/libssl/test/Makefile index 09e6848764..4c9eabcc21 100644 --- a/src/lib/libssl/test/Makefile +++ b/src/lib/libssl/test/Makefile | |||
| @@ -246,7 +246,7 @@ test_ecdh: | |||
| 246 | test_verify: | 246 | test_verify: |
| 247 | @echo "The following command should have some OK's and some failures" | 247 | @echo "The following command should have some OK's and some failures" |
| 248 | @echo "There are definitly a few expired certificates" | 248 | @echo "There are definitly a few expired certificates" |
| 249 | ../util/shlib_wrap.sh ../apps/openssl verify -CApath ../certs ../certs/*.pem | 249 | ../util/shlib_wrap.sh ../apps/openssl verify -CApath ../certs/demo ../certs/demo/*.pem |
| 250 | 250 | ||
| 251 | test_dh: | 251 | test_dh: |
| 252 | @echo "Generate a set of DH parameters" | 252 | @echo "Generate a set of DH parameters" |
