Latest update
This commit is contained in:
+19
-42
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "../ssl_locl.h"
|
||||
#include "internal/constant_time_locl.h"
|
||||
#include <openssl/trace.h>
|
||||
#include <openssl/rand.h>
|
||||
#include "record_locl.h"
|
||||
#include "internal/cryptlib.h"
|
||||
@@ -563,15 +564,10 @@ int ssl3_get_record(SSL *s)
|
||||
SSL_R_BLOCK_CIPHER_PAD_IS_WRONG);
|
||||
return -1;
|
||||
}
|
||||
#ifdef SSL_DEBUG
|
||||
printf("dec %lu\n", (unsigned long)rr[0].length);
|
||||
{
|
||||
size_t z;
|
||||
for (z = 0; z < rr[0].length; z++)
|
||||
printf("%02X%c", rr[0].data[z], ((z + 1) % 16) ? ' ' : '\n');
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS) {
|
||||
BIO_printf(trc_out, "dec %lu\n", (unsigned long)rr[0].length);
|
||||
BIO_dump_indent(trc_out, rr[0].data, rr[0].length, 4);
|
||||
} OSSL_TRACE_END(TLS);
|
||||
|
||||
/* r->length is now the compressed data plus mac */
|
||||
if ((sess != NULL) &&
|
||||
@@ -1361,22 +1357,12 @@ int tls1_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int sending)
|
||||
|
||||
EVP_MD_CTX_free(hmac);
|
||||
|
||||
#ifdef SSL_DEBUG
|
||||
fprintf(stderr, "seq=");
|
||||
{
|
||||
int z;
|
||||
for (z = 0; z < 8; z++)
|
||||
fprintf(stderr, "%02X ", seq[z]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
fprintf(stderr, "rec=");
|
||||
{
|
||||
size_t z;
|
||||
for (z = 0; z < rec->length; z++)
|
||||
fprintf(stderr, "%02X ", rec->data[z]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS) {
|
||||
BIO_printf(trc_out, "seq:\n");
|
||||
BIO_dump_indent(trc_out, seq, 8, 4);
|
||||
BIO_printf(trc_out, "rec:\n");
|
||||
BIO_dump_indent(trc_out, rec->data, rec->length, 4);
|
||||
} OSSL_TRACE_END(TLS);
|
||||
|
||||
if (!SSL_IS_DTLS(ssl)) {
|
||||
for (i = 7; i >= 0; i--) {
|
||||
@@ -1385,14 +1371,10 @@ int tls1_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int sending)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef SSL_DEBUG
|
||||
{
|
||||
unsigned int z;
|
||||
for (z = 0; z < md_size; z++)
|
||||
fprintf(stderr, "%02X ", md[z]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS) {
|
||||
BIO_printf(trc_out, "md:\n");
|
||||
BIO_dump_indent(trc_out, md, md_size, 4);
|
||||
} OSSL_TRACE_END(TLS);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1683,15 +1665,10 @@ int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap)
|
||||
RECORD_LAYER_reset_packet_length(&s->rlayer);
|
||||
return 0;
|
||||
}
|
||||
#ifdef SSL_DEBUG
|
||||
printf("dec %ld\n", rr->length);
|
||||
{
|
||||
size_t z;
|
||||
for (z = 0; z < rr->length; z++)
|
||||
printf("%02X%c", rr->data[z], ((z + 1) % 16) ? ' ' : '\n');
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS) {
|
||||
BIO_printf(trc_out, "dec %ld\n", rr->length);
|
||||
BIO_dump_indent(trc_out, rr->data, rr->length, 4);
|
||||
} OSSL_TRACE_END(TLS);
|
||||
|
||||
/* r->length is now the compressed data plus mac */
|
||||
if ((sess != NULL) && !SSL_READ_ETM(s) &&
|
||||
|
||||
+18
-18
@@ -16,6 +16,7 @@
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/trace.h>
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
#define TLS13_NUM_CIPHERS OSSL_NELEM(tls13_ciphers)
|
||||
@@ -4226,20 +4227,20 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
* pay with the price of sk_SSL_CIPHER_dup().
|
||||
*/
|
||||
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr, "Server has %d from %p:\n", sk_SSL_CIPHER_num(srvr),
|
||||
(void *)srvr);
|
||||
for (i = 0; i < sk_SSL_CIPHER_num(srvr); ++i) {
|
||||
c = sk_SSL_CIPHER_value(srvr, i);
|
||||
fprintf(stderr, "%p:%s\n", (void *)c, c->name);
|
||||
}
|
||||
fprintf(stderr, "Client sent %d from %p:\n", sk_SSL_CIPHER_num(clnt),
|
||||
(void *)clnt);
|
||||
for (i = 0; i < sk_SSL_CIPHER_num(clnt); ++i) {
|
||||
c = sk_SSL_CIPHER_value(clnt, i);
|
||||
fprintf(stderr, "%p:%s\n", (void *)c, c->name);
|
||||
}
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS_CIPHER) {
|
||||
BIO_printf(trc_out, "Server has %d from %p:\n",
|
||||
sk_SSL_CIPHER_num(srvr), (void *)srvr);
|
||||
for (i = 0; i < sk_SSL_CIPHER_num(srvr); ++i) {
|
||||
c = sk_SSL_CIPHER_value(srvr, i);
|
||||
BIO_printf(trc_out, "%p:%s\n", (void *)c, c->name);
|
||||
}
|
||||
BIO_printf(trc_out, "Client sent %d from %p:\n",
|
||||
sk_SSL_CIPHER_num(clnt), (void *)clnt);
|
||||
for (i = 0; i < sk_SSL_CIPHER_num(clnt); ++i) {
|
||||
c = sk_SSL_CIPHER_value(clnt, i);
|
||||
BIO_printf(trc_out, "%p:%s\n", (void *)c, c->name);
|
||||
}
|
||||
} OSSL_TRACE_END(TLS_CIPHER);
|
||||
|
||||
/* SUITE-B takes precedence over server preference and ChaCha priortiy */
|
||||
if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || tls1_suiteb(s)) {
|
||||
@@ -4314,10 +4315,9 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
#endif /* OPENSSL_NO_PSK */
|
||||
|
||||
ok = ok && (alg_k & mask_k) && (alg_a & mask_a);
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr, "%d:[%08lX:%08lX:%08lX:%08lX]%p:%s\n", ok, alg_k,
|
||||
alg_a, mask_k, mask_a, (void *)c, c->name);
|
||||
#endif
|
||||
OSSL_TRACE7(TLS_CIPHER,
|
||||
"%d:[%08lX:%08lX:%08lX:%08lX]%p:%s\n",
|
||||
ok, alg_k, alg_a, mask_k, mask_a, (void *)c, c->name);
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
/*
|
||||
|
||||
+5
-5
@@ -83,9 +83,9 @@ IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(SSL_SESSION_ASN1)
|
||||
/* Initialise OCTET STRING from buffer and length */
|
||||
|
||||
static void ssl_session_oinit(ASN1_OCTET_STRING **dest, ASN1_OCTET_STRING *os,
|
||||
unsigned char *data, size_t len)
|
||||
const unsigned char *data, size_t len)
|
||||
{
|
||||
os->data = data;
|
||||
os->data = (unsigned char *)data; /* justified cast: data is not modified */
|
||||
os->length = (int)len;
|
||||
os->flags = 0;
|
||||
*dest = os;
|
||||
@@ -93,15 +93,15 @@ static void ssl_session_oinit(ASN1_OCTET_STRING **dest, ASN1_OCTET_STRING *os,
|
||||
|
||||
/* Initialise OCTET STRING from string */
|
||||
static void ssl_session_sinit(ASN1_OCTET_STRING **dest, ASN1_OCTET_STRING *os,
|
||||
char *data)
|
||||
const char *data)
|
||||
{
|
||||
if (data != NULL)
|
||||
ssl_session_oinit(dest, os, (unsigned char *)data, strlen(data));
|
||||
ssl_session_oinit(dest, os, (const unsigned char *)data, strlen(data));
|
||||
else
|
||||
*dest = NULL;
|
||||
}
|
||||
|
||||
int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp)
|
||||
int i2d_SSL_SESSION(const SSL_SESSION *in, unsigned char **pp)
|
||||
{
|
||||
|
||||
SSL_SESSION_ASN1 as;
|
||||
|
||||
+31
-22
@@ -16,6 +16,7 @@
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/trace.h>
|
||||
#include "internal/nelem.h"
|
||||
#include "ssl_locl.h"
|
||||
#include "internal/thread_once.h"
|
||||
@@ -787,12 +788,12 @@ static void ssl_cipher_apply_rule(uint32_t cipher_id, uint32_t alg_mkey,
|
||||
const SSL_CIPHER *cp;
|
||||
int reverse = 0;
|
||||
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr,
|
||||
"Applying rule %d with %08x/%08x/%08x/%08x/%08x %08x (%d) g:%d\n",
|
||||
rule, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls,
|
||||
algo_strength, strength_bits, in_group);
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS_CIPHER){
|
||||
BIO_printf(trc_out,
|
||||
"Applying rule %d with %08x/%08x/%08x/%08x/%08x %08x (%d) g:%d\n",
|
||||
rule, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls,
|
||||
algo_strength, strength_bits, in_group);
|
||||
}
|
||||
|
||||
if (rule == CIPHER_DEL || rule == CIPHER_BUMP)
|
||||
reverse = 1; /* needed to maintain sorting between currently
|
||||
@@ -831,13 +832,14 @@ static void ssl_cipher_apply_rule(uint32_t cipher_id, uint32_t alg_mkey,
|
||||
if (strength_bits != cp->strength_bits)
|
||||
continue;
|
||||
} else {
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr,
|
||||
"\nName: %s:\nAlgo = %08x/%08x/%08x/%08x/%08x Algo_strength = %08x\n",
|
||||
cp->name, cp->algorithm_mkey, cp->algorithm_auth,
|
||||
cp->algorithm_enc, cp->algorithm_mac, cp->min_tls,
|
||||
cp->algo_strength);
|
||||
#endif
|
||||
if (trc_out != NULL) {
|
||||
BIO_printf(trc_out,
|
||||
"\nName: %s:"
|
||||
"\nAlgo = %08x/%08x/%08x/%08x/%08x Algo_strength = %08x\n",
|
||||
cp->name, cp->algorithm_mkey, cp->algorithm_auth,
|
||||
cp->algorithm_enc, cp->algorithm_mac, cp->min_tls,
|
||||
cp->algo_strength);
|
||||
}
|
||||
if (cipher_id != 0 && (cipher_id != cp->id))
|
||||
continue;
|
||||
if (alg_mkey && !(alg_mkey & cp->algorithm_mkey))
|
||||
@@ -858,9 +860,8 @@ static void ssl_cipher_apply_rule(uint32_t cipher_id, uint32_t alg_mkey,
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr, "Action = %d\n", rule);
|
||||
#endif
|
||||
if (trc_out != NULL)
|
||||
BIO_printf(trc_out, "Action = %d\n", rule);
|
||||
|
||||
/* add the cipher if it has not been added yet. */
|
||||
if (rule == CIPHER_ADD) {
|
||||
@@ -913,6 +914,8 @@ static void ssl_cipher_apply_rule(uint32_t cipher_id, uint32_t alg_mkey,
|
||||
|
||||
*head_p = head;
|
||||
*tail_p = tail;
|
||||
|
||||
OSSL_TRACE_END(TLS_CIPHER);
|
||||
}
|
||||
|
||||
static int ssl_cipher_strength_sort(CIPHER_ORDER **head_p,
|
||||
@@ -1663,23 +1666,26 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
if (!in_group_flags)
|
||||
goto err;
|
||||
|
||||
OSSL_TRACE_BEGIN(TLS_CIPHER) {
|
||||
BIO_printf(trc_out, "cipher selection:\n");
|
||||
}
|
||||
/*
|
||||
* The cipher selection for the list is done. The ciphers are added
|
||||
* to the resulting precedence to the STACK_OF(SSL_CIPHER).
|
||||
*/
|
||||
for (curr = head; curr != NULL; curr = curr->next) {
|
||||
if (curr->active) {
|
||||
if (!sk_SSL_CIPHER_push(cipherstack, curr->cipher))
|
||||
if (!sk_SSL_CIPHER_push(cipherstack, curr->cipher)) {
|
||||
OSSL_TRACE_CANCEL(TLS_CIPHER);
|
||||
goto err;
|
||||
}
|
||||
in_group_flags[num_in_group_flags++] = curr->in_group;
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr, "<%s>\n", curr->cipher->name);
|
||||
#endif
|
||||
if (trc_out != NULL)
|
||||
BIO_printf(trc_out, "<%s>\n", curr->cipher->name);
|
||||
}
|
||||
}
|
||||
|
||||
OPENSSL_free(co_list); /* Not needed any longer */
|
||||
co_list = NULL;
|
||||
OSSL_TRACE_END(TLS_CIPHER);
|
||||
|
||||
if (!update_cipher_list_by_id(cipher_list_by_id, cipherstack))
|
||||
goto err;
|
||||
@@ -1699,6 +1705,9 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
*cipher_list = pref_list;
|
||||
pref_list = NULL;
|
||||
|
||||
// sk_SSL_CIPHER_free(*cipher_list);
|
||||
// *cipher_list = cipherstack;
|
||||
|
||||
return cipherstack;
|
||||
|
||||
err:
|
||||
|
||||
+4
-3
@@ -965,11 +965,11 @@ static const ERR_STRING_DATA SSL_str_reasons[] = {
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_MISSING_TMP_DH_KEY), "missing tmp dh key"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_MISSING_TMP_ECDH_KEY),
|
||||
"missing tmp ecdh key"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA),
|
||||
"mixed handshake and non handshake data"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_MIXED_SPECIAL_OPERATOR_WITH_GROUPS),
|
||||
"mixed special operator with groups"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_NESTED_GROUP), "nested group"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA),
|
||||
"mixed handshake and non handshake data"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_NOT_ON_RECORD_BOUNDARY),
|
||||
"not on record boundary"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_NOT_REPLACING_CERTIFICATE),
|
||||
@@ -1204,11 +1204,12 @@ static const ERR_STRING_DATA SSL_str_reasons[] = {
|
||||
"unable to load ssl3 md5 routines"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES),
|
||||
"unable to load ssl3 sha1 routines"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_GROUP_CLOSE), "unexpected group close"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_CCS_MESSAGE),
|
||||
"unexpected ccs message"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_END_OF_EARLY_DATA),
|
||||
"unexpected end of early data"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_GROUP_CLOSE),
|
||||
"unexpected group close"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_MESSAGE), "unexpected message"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_OPERATOR_IN_GROUP),
|
||||
"unexpected operator in group"},
|
||||
|
||||
+9
-24
@@ -12,6 +12,7 @@
|
||||
#include "internal/err.h"
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/trace.h>
|
||||
#include "ssl_locl.h"
|
||||
#include "internal/thread_once.h"
|
||||
|
||||
@@ -23,10 +24,7 @@ static CRYPTO_ONCE ssl_base = CRYPTO_ONCE_STATIC_INIT;
|
||||
static int ssl_base_inited = 0;
|
||||
DEFINE_RUN_ONCE_STATIC(ossl_init_ssl_base)
|
||||
{
|
||||
#ifdef OPENSSL_INIT_DEBUG
|
||||
fprintf(stderr, "OPENSSL_INIT: ossl_init_ssl_base: "
|
||||
"Adding SSL ciphers and digests\n");
|
||||
#endif
|
||||
OSSL_TRACE(INIT, "ossl_init_ssl_base: adding SSL ciphers and digests\n");
|
||||
#ifndef OPENSSL_NO_DES
|
||||
EVP_add_cipher(EVP_des_cbc());
|
||||
EVP_add_cipher(EVP_des_ede3_cbc());
|
||||
@@ -88,10 +86,8 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_ssl_base)
|
||||
EVP_add_digest(EVP_sha384());
|
||||
EVP_add_digest(EVP_sha512());
|
||||
#ifndef OPENSSL_NO_COMP
|
||||
# ifdef OPENSSL_INIT_DEBUG
|
||||
fprintf(stderr, "OPENSSL_INIT: ossl_init_ssl_base: "
|
||||
"SSL_COMP_get_compression_methods()\n");
|
||||
# endif
|
||||
OSSL_TRACE(INIT, "ossl_init_ssl_base: "
|
||||
"SSL_COMP_get_compression_methods()\n");
|
||||
/*
|
||||
* This will initialise the built-in compression algorithms. The value
|
||||
* returned is a STACK_OF(SSL_COMP), but that can be discarded safely
|
||||
@@ -102,10 +98,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_ssl_base)
|
||||
if (!ssl_load_ciphers())
|
||||
return 0;
|
||||
|
||||
#ifdef OPENSSL_INIT_DEBUG
|
||||
fprintf(stderr, "OPENSSL_INIT: ossl_init_ssl_base: "
|
||||
"SSL_add_ssl_module()\n");
|
||||
#endif
|
||||
OSSL_TRACE(INIT,"ossl_init_ssl_base: SSL_add_ssl_module()\n");
|
||||
/*
|
||||
* We ignore an error return here. Not much we can do - but not that bad
|
||||
* either. We can still safely continue.
|
||||
@@ -124,10 +117,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_ssl_strings)
|
||||
* pulling in all the error strings during static linking
|
||||
*/
|
||||
#if !defined(OPENSSL_NO_ERR) && !defined(OPENSSL_NO_AUTOERRINIT)
|
||||
# ifdef OPENSSL_INIT_DEBUG
|
||||
fprintf(stderr, "OPENSSL_INIT: ossl_init_load_ssl_strings: "
|
||||
"ERR_load_SSL_strings()\n");
|
||||
# endif
|
||||
OSSL_TRACE(INIT, "ossl_init_load_ssl_strings: ERR_load_SSL_strings()\n");
|
||||
ERR_load_SSL_strings();
|
||||
ssl_strings_inited = 1;
|
||||
#endif
|
||||
@@ -150,19 +140,14 @@ static void ssl_library_stop(void)
|
||||
|
||||
if (ssl_base_inited) {
|
||||
#ifndef OPENSSL_NO_COMP
|
||||
# ifdef OPENSSL_INIT_DEBUG
|
||||
fprintf(stderr, "OPENSSL_INIT: ssl_library_stop: "
|
||||
"ssl_comp_free_compression_methods_int()\n");
|
||||
# endif
|
||||
OSSL_TRACE(INIT, "ssl_library_stop: "
|
||||
"ssl_comp_free_compression_methods_int()\n");
|
||||
ssl_comp_free_compression_methods_int();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ssl_strings_inited) {
|
||||
#ifdef OPENSSL_INIT_DEBUG
|
||||
fprintf(stderr, "OPENSSL_INIT: ssl_library_stop: "
|
||||
"err_free_strings_int()\n");
|
||||
#endif
|
||||
OSSL_TRACE(INIT, "ssl_library_stop: err_free_strings_int()\n");
|
||||
/*
|
||||
* If both crypto and ssl error strings are inited we will end up
|
||||
* calling err_free_strings_int() twice - but that's ok. The second
|
||||
|
||||
+3
-4
@@ -20,6 +20,7 @@
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/async.h>
|
||||
#include <openssl/ct.h>
|
||||
#include <openssl/trace.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include "internal/refcount.h"
|
||||
#include "internal/ktls.h"
|
||||
@@ -3395,10 +3396,8 @@ void ssl_set_masks(SSL *s)
|
||||
mask_k = 0;
|
||||
mask_a = 0;
|
||||
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr, "dht=%d re=%d rs=%d ds=%d\n",
|
||||
dh_tmp, rsa_enc, rsa_sign, dsa_sign);
|
||||
#endif
|
||||
OSSL_TRACE4(TLS_CIPHER, "dh_tmp=%d rsa_enc=%d rsa_sign=%d dsa_sign=%d\n",
|
||||
dh_tmp, rsa_enc, rsa_sign, dsa_sign);
|
||||
|
||||
#ifndef OPENSSL_NO_GOST
|
||||
if (ssl_has_cert(s, SSL_PKEY_GOST12_512)) {
|
||||
|
||||
+8
-7
@@ -579,7 +579,6 @@ struct ssl_session_st {
|
||||
/* Session lifetime hint in seconds */
|
||||
unsigned long tick_lifetime_hint;
|
||||
uint32_t tick_age_add;
|
||||
int tick_identity;
|
||||
/* Max number of bytes that can be sent as early data */
|
||||
uint32_t max_early_data;
|
||||
/* The ALPN protocol selected for this session */
|
||||
@@ -1216,8 +1215,6 @@ struct ssl_st {
|
||||
EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
|
||||
unsigned char write_iv[EVP_MAX_IV_LENGTH]; /* TLSv1.3 static write IV */
|
||||
EVP_MD_CTX *write_hash; /* used for mac generation */
|
||||
/* Count of how many KeyUpdate messages we have received */
|
||||
unsigned int key_update_count;
|
||||
/* session info */
|
||||
/* client cert? */
|
||||
/* This is used to hold the server certificate used */
|
||||
@@ -1404,6 +1401,13 @@ struct ssl_st {
|
||||
* as this extension is optional on server side.
|
||||
*/
|
||||
uint8_t max_fragment_len_mode;
|
||||
|
||||
/*
|
||||
* On the client side the number of ticket identities we sent in the
|
||||
* ClientHello. On the server side the identity of the ticket we
|
||||
* selected.
|
||||
*/
|
||||
int tick_identity;
|
||||
} ext;
|
||||
|
||||
/*
|
||||
@@ -2104,9 +2108,6 @@ typedef enum downgrade_en {
|
||||
#define TLSEXT_KEX_MODE_FLAG_KE 1
|
||||
#define TLSEXT_KEX_MODE_FLAG_KE_DHE 2
|
||||
|
||||
/* An invalid index into the TLSv1.3 PSK identities */
|
||||
#define TLSEXT_PSK_BAD_IDENTITY -1
|
||||
|
||||
#define SSL_USE_PSS(s) (s->s3->tmp.peer_sigalg != NULL && \
|
||||
s->s3->tmp.peer_sigalg->sig == EVP_PKEY_RSA_PSS)
|
||||
|
||||
@@ -2308,7 +2309,7 @@ __owur int ssl_get_new_session(SSL *s, int session);
|
||||
__owur SSL_SESSION *lookup_sess_in_cache(SSL *s, const unsigned char *sess_id,
|
||||
size_t sess_id_len);
|
||||
__owur int ssl_get_prev_session(SSL *s, CLIENTHELLO_MSG *hello);
|
||||
__owur SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket);
|
||||
__owur SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket);
|
||||
__owur int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b);
|
||||
DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id);
|
||||
__owur int ssl_cipher_ptr_id_cmp(const SSL_CIPHER *const *ap,
|
||||
|
||||
+2
-2
@@ -94,7 +94,7 @@ SSL_SESSION *SSL_SESSION_new(void)
|
||||
return ss;
|
||||
}
|
||||
|
||||
SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src)
|
||||
SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src)
|
||||
{
|
||||
return ssl_session_dup(src, 1);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src)
|
||||
* Create a new SSL_SESSION and duplicate the contents of |src| into it. If
|
||||
* ticket == 0 then no ticket information is duplicated, otherwise it is.
|
||||
*/
|
||||
SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket)
|
||||
SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket)
|
||||
{
|
||||
SSL_SESSION *dest;
|
||||
|
||||
|
||||
@@ -989,7 +989,6 @@ static int final_server_name(SSL *s, unsigned int context, int sent)
|
||||
ss->ext.ticklen = 0;
|
||||
ss->ext.tick_lifetime_hint = 0;
|
||||
ss->ext.tick_age_add = 0;
|
||||
ss->ext.tick_identity = 0;
|
||||
if (!ssl_generate_session_id(s, ss)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_FINAL_SERVER_NAME,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
@@ -1645,7 +1644,6 @@ static int final_early_data(SSL *s, unsigned int context, int sent)
|
||||
|
||||
if (s->max_early_data == 0
|
||||
|| !s->hit
|
||||
|| s->session->ext.tick_identity != 0
|
||||
|| s->early_data_state != SSL_EARLY_DATA_ACCEPTING
|
||||
|| !s->ext.early_data_ok
|
||||
|| s->hello_retry_request != SSL_HRR_NONE
|
||||
|
||||
@@ -996,7 +996,7 @@ EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
const EVP_MD *handmd = NULL, *mdres = NULL, *mdpsk = NULL;
|
||||
int dores = 0;
|
||||
|
||||
s->session->ext.tick_identity = TLSEXT_PSK_BAD_IDENTITY;
|
||||
s->ext.tick_identity = 0;
|
||||
|
||||
/*
|
||||
* Note: At this stage of the code we only support adding a single
|
||||
@@ -1086,6 +1086,7 @@ EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
agems += s->session->ext.tick_age_add;
|
||||
|
||||
reshashsize = EVP_MD_size(mdres);
|
||||
s->ext.tick_identity++;
|
||||
dores = 1;
|
||||
}
|
||||
|
||||
@@ -1145,6 +1146,7 @@ EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
s->ext.tick_identity++;
|
||||
}
|
||||
|
||||
if (!WPACKET_close(pkt)
|
||||
@@ -1183,11 +1185,6 @@ EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
|
||||
if (dores)
|
||||
s->session->ext.tick_identity = 0;
|
||||
if (s->psksession != NULL)
|
||||
s->psksession->ext.tick_identity = (dores ? 1 : 0);
|
||||
|
||||
return EXT_RETURN_SENT;
|
||||
#else
|
||||
return EXT_RETURN_NOT_SENT;
|
||||
@@ -1932,8 +1929,7 @@ int tls_parse_stoc_early_data(SSL *s, PACKET *pkt, unsigned int context,
|
||||
}
|
||||
|
||||
if (!s->ext.early_data_ok
|
||||
|| !s->hit
|
||||
|| s->session->ext.tick_identity != 0) {
|
||||
|| !s->hit) {
|
||||
/*
|
||||
* If we get here then we didn't send early data, or we didn't resume
|
||||
* using the first identity, or the SNI/ALPN is not consistent so the
|
||||
@@ -1961,17 +1957,28 @@ int tls_parse_stoc_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (s->session->ext.tick_identity == (int)identity) {
|
||||
if (identity >= (unsigned int)s->ext.tick_identity) {
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_PSK,
|
||||
SSL_R_BAD_PSK_IDENTITY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Session resumption tickets are always sent before PSK tickets. If the
|
||||
* ticket index is 0 then it must be for a session resumption ticket if we
|
||||
* sent two tickets, or if we didn't send a PSK ticket.
|
||||
*/
|
||||
if (identity == 0 && (s->psksession == NULL || s->ext.tick_identity == 2)) {
|
||||
s->hit = 1;
|
||||
SSL_SESSION_free(s->psksession);
|
||||
s->psksession = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (s->psksession == NULL
|
||||
|| s->psksession->ext.tick_identity != (int)identity) {
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_PSK,
|
||||
SSL_R_BAD_PSK_IDENTITY);
|
||||
if (s->psksession == NULL) {
|
||||
/* Should never happen */
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_PSK,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1990,6 +1997,9 @@ int tls_parse_stoc_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
s->session = s->psksession;
|
||||
s->psksession = NULL;
|
||||
s->hit = 1;
|
||||
/* Early data is only allowed if we used the first ticket */
|
||||
if (identity != 0)
|
||||
s->ext.early_data_ok = 0;
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -1277,7 +1277,7 @@ int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
goto err;
|
||||
}
|
||||
|
||||
sess->ext.tick_identity = id;
|
||||
s->ext.tick_identity = id;
|
||||
|
||||
SSL_SESSION_free(s->session);
|
||||
s->session = sess;
|
||||
@@ -1951,7 +1951,7 @@ EXT_RETURN tls_construct_stoc_psk(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
|
||||
if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_psk)
|
||||
|| !WPACKET_start_sub_packet_u16(pkt)
|
||||
|| !WPACKET_put_bytes_u16(pkt, s->session->ext.tick_identity)
|
||||
|| !WPACKET_put_bytes_u16(pkt, s->ext.tick_identity)
|
||||
|| !WPACKET_close(pkt)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_STOC_PSK, ERR_R_INTERNAL_ERROR);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/trace.h>
|
||||
#include <internal/cryptlib.h>
|
||||
|
||||
static MSG_PROCESS_RETURN tls_process_as_hello_retry_request(SSL *s, PACKET *pkt);
|
||||
@@ -1613,10 +1614,7 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt)
|
||||
* so the PAC-based session secret is always preserved. It'll be
|
||||
* overwritten if the server refuses resumption.
|
||||
*/
|
||||
if (s->session->session_id_length > 0
|
||||
|| (SSL_IS_TLS13(s)
|
||||
&& s->session->ext.tick_identity
|
||||
!= TLSEXT_PSK_BAD_IDENTITY)) {
|
||||
if (s->session->session_id_length > 0) {
|
||||
tsan_counter(&s->session_ctx->stats.sess_miss);
|
||||
if (!ssl_get_new_session(s, 0)) {
|
||||
/* SSLfatal() already called */
|
||||
@@ -2350,11 +2348,9 @@ MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt)
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
#ifdef SSL_DEBUG
|
||||
if (SSL_USE_SIGALGS(s))
|
||||
fprintf(stderr, "USING TLSv1.2 HASH %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
#endif
|
||||
OSSL_TRACE1(TLS, "USING TLSv1.2 HASH %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
|
||||
if (!PACKET_get_length_prefixed_2(pkt, &signature)
|
||||
|| PACKET_remaining(pkt) != 0) {
|
||||
|
||||
+6
-15
@@ -18,6 +18,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/trace.h>
|
||||
|
||||
/*
|
||||
* Map error codes to TLS/SSL alart types.
|
||||
@@ -394,11 +395,9 @@ MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef SSL_DEBUG
|
||||
if (SSL_USE_SIGALGS(s))
|
||||
fprintf(stderr, "USING TLSv1.2 HASH %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
#endif
|
||||
OSSL_TRACE1(TLS, "USING TLSv1.2 HASH %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
|
||||
/* Check for broken implementations of GOST ciphersuites */
|
||||
/*
|
||||
@@ -439,10 +438,9 @@ MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef SSL_DEBUG
|
||||
fprintf(stderr, "Using client verify alg %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
#endif
|
||||
OSSL_TRACE1(TLS, "Using client verify alg %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
|
||||
if (EVP_DigestVerifyInit(mctx, &pctx, md, NULL, pkey) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY,
|
||||
ERR_R_EVP_LIB);
|
||||
@@ -614,13 +612,6 @@ MSG_PROCESS_RETURN tls_process_key_update(SSL *s, PACKET *pkt)
|
||||
{
|
||||
unsigned int updatetype;
|
||||
|
||||
s->key_update_count++;
|
||||
if (s->key_update_count > MAX_KEY_UPDATE_MESSAGES) {
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PROCESS_KEY_UPDATE,
|
||||
SSL_R_TOO_MANY_KEY_UPDATES);
|
||||
return MSG_PROCESS_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* A KeyUpdate message signals a key change so the end of the message must
|
||||
* be on a record boundary.
|
||||
|
||||
@@ -29,9 +29,6 @@
|
||||
/* Max should actually be 36 but we are generous */
|
||||
#define FINISHED_MAX_LENGTH 64
|
||||
|
||||
/* The maximum number of incoming KeyUpdate messages we will accept */
|
||||
#define MAX_KEY_UPDATE_MESSAGES 32
|
||||
|
||||
/* Dummy message type */
|
||||
#define SSL3_MT_DUMMY -1
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/trace.h>
|
||||
|
||||
#define TICKET_NONCE_SIZE 8
|
||||
|
||||
@@ -1835,15 +1836,15 @@ static int tls_early_post_process_client_hello(SSL *s)
|
||||
j = 0;
|
||||
id = s->session->cipher->id;
|
||||
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr, "client sent %d ciphers\n", sk_SSL_CIPHER_num(ciphers));
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS_CIPHER) {
|
||||
BIO_printf(trc_out, "client sent %d ciphers\n",
|
||||
sk_SSL_CIPHER_num(ciphers));
|
||||
}
|
||||
for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
|
||||
c = sk_SSL_CIPHER_value(ciphers, i);
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr, "client [%2d of %2d]:%s\n",
|
||||
i, sk_SSL_CIPHER_num(ciphers), SSL_CIPHER_get_name(c));
|
||||
#endif
|
||||
if (trc_out != NULL)
|
||||
BIO_printf(trc_out, "client [%2d of %2d]:%s\n", i,
|
||||
sk_SSL_CIPHER_num(ciphers), SSL_CIPHER_get_name(c));
|
||||
if (c->id == id) {
|
||||
j = 1;
|
||||
break;
|
||||
@@ -1857,8 +1858,10 @@ static int tls_early_post_process_client_hello(SSL *s)
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER,
|
||||
SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO,
|
||||
SSL_R_REQUIRED_CIPHER_MISSING);
|
||||
OSSL_TRACE_CANCEL(TLS_CIPHER);
|
||||
goto err;
|
||||
}
|
||||
OSSL_TRACE_END(TLS_CIPHER);
|
||||
}
|
||||
|
||||
for (loop = 0; loop < clienthello->compressions_len; loop++) {
|
||||
|
||||
+45
-69
@@ -18,6 +18,7 @@
|
||||
#include <openssl/kdf.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <openssl/trace.h>
|
||||
|
||||
/* seed1 through seed5 are concatenated */
|
||||
static int tls1_PRF(SSL *s,
|
||||
@@ -276,14 +277,11 @@ int tls1_change_cipher_state(SSL *s, int which)
|
||||
}
|
||||
EVP_PKEY_free(mac_key);
|
||||
}
|
||||
#ifdef SSL_DEBUG
|
||||
printf("which = %04X\nmac key=", which);
|
||||
{
|
||||
size_t z;
|
||||
for (z = 0; z < i; z++)
|
||||
printf("%02X%c", ms[z], ((z + 1) % 16) ? ' ' : '\n');
|
||||
}
|
||||
#endif
|
||||
|
||||
OSSL_TRACE_BEGIN(TLS) {
|
||||
BIO_printf(trc_out, "which = %04X, mac key:\n", which);
|
||||
BIO_dump_indent(trc_out, ms, i, 4);
|
||||
} OSSL_TRACE_END(TLS);
|
||||
|
||||
if (EVP_CIPHER_mode(c) == EVP_CIPH_GCM_MODE) {
|
||||
if (!EVP_CipherInit_ex(dd, c, NULL, key, NULL, (which & SSL3_CC_WRITE))
|
||||
@@ -388,21 +386,12 @@ int tls1_change_cipher_state(SSL *s, int which)
|
||||
#endif /* OPENSSL_NO_KTLS */
|
||||
s->statem.enc_write_state = ENC_WRITE_STATE_VALID;
|
||||
|
||||
#ifdef SSL_DEBUG
|
||||
printf("which = %04X\nkey=", which);
|
||||
{
|
||||
int z;
|
||||
for (z = 0; z < EVP_CIPHER_key_length(c); z++)
|
||||
printf("%02X%c", key[z], ((z + 1) % 16) ? ' ' : '\n');
|
||||
}
|
||||
printf("\niv=");
|
||||
{
|
||||
size_t z;
|
||||
for (z = 0; z < k; z++)
|
||||
printf("%02X%c", iv[z], ((z + 1) % 16) ? ' ' : '\n');
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS) {
|
||||
BIO_printf(trc_out, "which = %04X, key:\n", which);
|
||||
BIO_dump_indent(trc_out, key, EVP_CIPHER_key_length(c), 4);
|
||||
BIO_printf(trc_out, "iv:\n");
|
||||
BIO_dump_indent(trc_out, iv, k, 4);
|
||||
} OSSL_TRACE_END(TLS);
|
||||
|
||||
return 1;
|
||||
err:
|
||||
@@ -447,41 +436,26 @@ int tls1_setup_key_block(SSL *s)
|
||||
s->s3->tmp.key_block_length = num;
|
||||
s->s3->tmp.key_block = p;
|
||||
|
||||
#ifdef SSL_DEBUG
|
||||
printf("client random\n");
|
||||
{
|
||||
int z;
|
||||
for (z = 0; z < SSL3_RANDOM_SIZE; z++)
|
||||
printf("%02X%c", s->s3->client_random[z],
|
||||
((z + 1) % 16) ? ' ' : '\n');
|
||||
}
|
||||
printf("server random\n");
|
||||
{
|
||||
int z;
|
||||
for (z = 0; z < SSL3_RANDOM_SIZE; z++)
|
||||
printf("%02X%c", s->s3->server_random[z],
|
||||
((z + 1) % 16) ? ' ' : '\n');
|
||||
}
|
||||
printf("master key\n");
|
||||
{
|
||||
size_t z;
|
||||
for (z = 0; z < s->session->master_key_length; z++)
|
||||
printf("%02X%c", s->session->master_key[z],
|
||||
((z + 1) % 16) ? ' ' : '\n');
|
||||
}
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS) {
|
||||
BIO_printf(trc_out, "client random\n");
|
||||
BIO_dump_indent(trc_out, s->s3->client_random, SSL3_RANDOM_SIZE, 4);
|
||||
BIO_printf(trc_out, "server random\n");
|
||||
BIO_dump_indent(trc_out, s->s3->server_random, SSL3_RANDOM_SIZE, 4);
|
||||
BIO_printf(trc_out, "master key\n");
|
||||
BIO_dump_indent(trc_out,
|
||||
s->session->master_key,
|
||||
s->session->master_key_length, 4);
|
||||
} OSSL_TRACE_END(TLS);
|
||||
|
||||
if (!tls1_generate_key_block(s, p, num)) {
|
||||
/* SSLfatal() already called */
|
||||
goto err;
|
||||
}
|
||||
#ifdef SSL_DEBUG
|
||||
printf("\nkey block\n");
|
||||
{
|
||||
size_t z;
|
||||
for (z = 0; z < num; z++)
|
||||
printf("%02X%c", p[z], ((z + 1) % 16) ? ' ' : '\n');
|
||||
}
|
||||
#endif
|
||||
|
||||
OSSL_TRACE_BEGIN(TLS) {
|
||||
BIO_printf(trc_out, "key block\n");
|
||||
BIO_dump_indent(trc_out, p, num, 4);
|
||||
} OSSL_TRACE_END(TLS);
|
||||
|
||||
if (!(s->options & SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS)
|
||||
&& s->method->version <= TLS1_VERSION) {
|
||||
@@ -549,10 +523,10 @@ int tls1_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
|
||||
/* SSLfatal() already called */
|
||||
return 0;
|
||||
}
|
||||
#ifdef SSL_DEBUG
|
||||
fprintf(stderr, "Handshake hashes:\n");
|
||||
BIO_dump_fp(stderr, (char *)hash, hashlen);
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS) {
|
||||
BIO_printf(trc_out, "Handshake hashes:\n");
|
||||
BIO_dump(trc_out, (char *)hash, hashlen);
|
||||
} OSSL_TRACE_END(TLS);
|
||||
if (!tls1_PRF(s,
|
||||
TLS_MD_EXTENDED_MASTER_SECRET_CONST,
|
||||
TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE,
|
||||
@@ -578,17 +552,19 @@ int tls1_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#ifdef SSL_DEBUG
|
||||
fprintf(stderr, "Premaster Secret:\n");
|
||||
BIO_dump_fp(stderr, (char *)p, len);
|
||||
fprintf(stderr, "Client Random:\n");
|
||||
BIO_dump_fp(stderr, (char *)s->s3->client_random, SSL3_RANDOM_SIZE);
|
||||
fprintf(stderr, "Server Random:\n");
|
||||
BIO_dump_fp(stderr, (char *)s->s3->server_random, SSL3_RANDOM_SIZE);
|
||||
fprintf(stderr, "Master Secret:\n");
|
||||
BIO_dump_fp(stderr, (char *)s->session->master_key,
|
||||
SSL3_MASTER_SECRET_SIZE);
|
||||
#endif
|
||||
|
||||
OSSL_TRACE_BEGIN(TLS) {
|
||||
BIO_printf(trc_out, "Premaster Secret:\n");
|
||||
BIO_dump_indent(trc_out, p, len, 4);
|
||||
BIO_printf(trc_out, "Client Random:\n");
|
||||
BIO_dump_indent(trc_out, s->s3->client_random, SSL3_RANDOM_SIZE, 4);
|
||||
BIO_printf(trc_out, "Server Random:\n");
|
||||
BIO_dump_indent(trc_out, s->s3->server_random, SSL3_RANDOM_SIZE, 4);
|
||||
BIO_printf(trc_out, "Master Secret:\n");
|
||||
BIO_dump_indent(trc_out,
|
||||
s->session->master_key,
|
||||
SSL3_MASTER_SECRET_SIZE, 4);
|
||||
} OSSL_TRACE_END(TLS);
|
||||
|
||||
*secret_size = SSL3_MASTER_SECRET_SIZE;
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user