OpenSSL 1.1.1-pre2
This commit is contained in:
+72
-9
@@ -12,6 +12,7 @@
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/dh.h>
|
||||
#include "internal/nelem.h"
|
||||
|
||||
/*
|
||||
* structure holding name tables. This is used for permitted elements in lists
|
||||
@@ -202,17 +203,23 @@ static int cmd_ClientSignatureAlgorithms(SSL_CONF_CTX *cctx, const char *value)
|
||||
return rv > 0;
|
||||
}
|
||||
|
||||
static int cmd_Curves(SSL_CONF_CTX *cctx, const char *value)
|
||||
static int cmd_Groups(SSL_CONF_CTX *cctx, const char *value)
|
||||
{
|
||||
int rv;
|
||||
if (cctx->ssl)
|
||||
rv = SSL_set1_curves_list(cctx->ssl, value);
|
||||
rv = SSL_set1_groups_list(cctx->ssl, value);
|
||||
/* NB: ctx == NULL performs syntax checking only */
|
||||
else
|
||||
rv = SSL_CTX_set1_curves_list(cctx->ctx, value);
|
||||
rv = SSL_CTX_set1_groups_list(cctx->ctx, value);
|
||||
return rv > 0;
|
||||
}
|
||||
|
||||
/* This is the old name for cmd_Groups - retained for backwards compatibility */
|
||||
static int cmd_Curves(SSL_CONF_CTX *cctx, const char *value)
|
||||
{
|
||||
return cmd_Groups(cctx, value);
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
/* ECDH temporary parameters */
|
||||
static int cmd_ECDHParameters(SSL_CONF_CTX *cctx, const char *value)
|
||||
@@ -265,6 +272,7 @@ static int cmd_Protocol(SSL_CONF_CTX *cctx, const char *value)
|
||||
SSL_FLAG_TBL_INV("TLSv1", SSL_OP_NO_TLSv1),
|
||||
SSL_FLAG_TBL_INV("TLSv1.1", SSL_OP_NO_TLSv1_1),
|
||||
SSL_FLAG_TBL_INV("TLSv1.2", SSL_OP_NO_TLSv1_2),
|
||||
SSL_FLAG_TBL_INV("TLSv1.3", SSL_OP_NO_TLSv1_3),
|
||||
SSL_FLAG_TBL_INV("DTLSv1", SSL_OP_NO_DTLSv1),
|
||||
SSL_FLAG_TBL_INV("DTLSv1.2", SSL_OP_NO_DTLSv1_2)
|
||||
};
|
||||
@@ -290,6 +298,7 @@ static int protocol_from_string(const char *value)
|
||||
{"TLSv1", TLS1_VERSION},
|
||||
{"TLSv1.1", TLS1_1_VERSION},
|
||||
{"TLSv1.2", TLS1_2_VERSION},
|
||||
{"TLSv1.3", TLS1_3_VERSION},
|
||||
{"DTLSv1", DTLS1_VERSION},
|
||||
{"DTLSv1.2", DTLS1_2_VERSION}
|
||||
};
|
||||
@@ -359,6 +368,9 @@ static int cmd_Options(SSL_CONF_CTX *cctx, const char *value)
|
||||
SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION),
|
||||
SSL_FLAG_TBL_INV("EncryptThenMac", SSL_OP_NO_ENCRYPT_THEN_MAC),
|
||||
SSL_FLAG_TBL("NoRenegotiation", SSL_OP_NO_RENEGOTIATION),
|
||||
SSL_FLAG_TBL("AllowNoDHEKEX", SSL_OP_ALLOW_NO_DHE_KEX),
|
||||
SSL_FLAG_TBL("PrioritizeChaCha", SSL_OP_PRIORITIZE_CHACHA),
|
||||
SSL_FLAG_TBL("MiddleboxCompat", SSL_OP_ENABLE_MIDDLEBOX_COMPAT)
|
||||
};
|
||||
if (value == NULL)
|
||||
return -3;
|
||||
@@ -374,7 +386,12 @@ static int cmd_VerifyMode(SSL_CONF_CTX *cctx, const char *value)
|
||||
SSL_FLAG_VFY_SRV("Request", SSL_VERIFY_PEER),
|
||||
SSL_FLAG_VFY_SRV("Require",
|
||||
SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT),
|
||||
SSL_FLAG_VFY_SRV("Once", SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE)
|
||||
SSL_FLAG_VFY_SRV("Once", SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE),
|
||||
SSL_FLAG_VFY_SRV("RequestPostHandshake",
|
||||
SSL_VERIFY_PEER | SSL_VERIFY_POST_HANDSHAKE),
|
||||
SSL_FLAG_VFY_SRV("RequirePostHandshake",
|
||||
SSL_VERIFY_PEER | SSL_VERIFY_POST_HANDSHAKE |
|
||||
SSL_VERIFY_FAIL_IF_NO_PEER_CERT),
|
||||
};
|
||||
if (value == NULL)
|
||||
return -3;
|
||||
@@ -466,7 +483,7 @@ static int cmd_VerifyCAFile(SSL_CONF_CTX *cctx, const char *value)
|
||||
return do_store(cctx, value, NULL, 1);
|
||||
}
|
||||
|
||||
static int cmd_ClientCAFile(SSL_CONF_CTX *cctx, const char *value)
|
||||
static int cmd_RequestCAFile(SSL_CONF_CTX *cctx, const char *value)
|
||||
{
|
||||
if (cctx->canames == NULL)
|
||||
cctx->canames = sk_X509_NAME_new_null();
|
||||
@@ -475,7 +492,12 @@ static int cmd_ClientCAFile(SSL_CONF_CTX *cctx, const char *value)
|
||||
return SSL_add_file_cert_subjects_to_stack(cctx->canames, value);
|
||||
}
|
||||
|
||||
static int cmd_ClientCAPath(SSL_CONF_CTX *cctx, const char *value)
|
||||
static int cmd_ClientCAFile(SSL_CONF_CTX *cctx, const char *value)
|
||||
{
|
||||
return cmd_RequestCAFile(cctx, value);
|
||||
}
|
||||
|
||||
static int cmd_RequestCAPath(SSL_CONF_CTX *cctx, const char *value)
|
||||
{
|
||||
if (cctx->canames == NULL)
|
||||
cctx->canames = sk_X509_NAME_new_null();
|
||||
@@ -484,6 +506,11 @@ static int cmd_ClientCAPath(SSL_CONF_CTX *cctx, const char *value)
|
||||
return SSL_add_dir_cert_subjects_to_stack(cctx->canames, value);
|
||||
}
|
||||
|
||||
static int cmd_ClientCAPath(SSL_CONF_CTX *cctx, const char *value)
|
||||
{
|
||||
return cmd_RequestCAPath(cctx, value);
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_DH
|
||||
static int cmd_DHParameters(SSL_CONF_CTX *cctx, const char *value)
|
||||
{
|
||||
@@ -511,6 +538,25 @@ static int cmd_DHParameters(SSL_CONF_CTX *cctx, const char *value)
|
||||
return rv > 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int cmd_RecordPadding(SSL_CONF_CTX *cctx, const char *value)
|
||||
{
|
||||
int rv = 0;
|
||||
int block_size = atoi(value);
|
||||
|
||||
/*
|
||||
* All we care about is a non-negative value,
|
||||
* the setters check the range
|
||||
*/
|
||||
if (block_size >= 0) {
|
||||
if (cctx->ctx)
|
||||
rv = SSL_CTX_set_block_padding(cctx->ctx, block_size);
|
||||
if (cctx->ssl)
|
||||
rv = SSL_set_block_padding(cctx->ssl, block_size);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int (*cmd) (SSL_CONF_CTX *cctx, const char *value);
|
||||
const char *str_file;
|
||||
@@ -536,6 +582,7 @@ static const ssl_conf_cmd_tbl ssl_conf_cmds[] = {
|
||||
SSL_CONF_CMD_SWITCH("no_tls1", 0),
|
||||
SSL_CONF_CMD_SWITCH("no_tls1_1", 0),
|
||||
SSL_CONF_CMD_SWITCH("no_tls1_2", 0),
|
||||
SSL_CONF_CMD_SWITCH("no_tls1_3", 0),
|
||||
SSL_CONF_CMD_SWITCH("bugs", 0),
|
||||
SSL_CONF_CMD_SWITCH("no_comp", 0),
|
||||
SSL_CONF_CMD_SWITCH("comp", 0),
|
||||
@@ -547,10 +594,14 @@ static const ssl_conf_cmd_tbl ssl_conf_cmds[] = {
|
||||
SSL_CONF_CMD_SWITCH("no_renegotiation", 0),
|
||||
SSL_CONF_CMD_SWITCH("no_resumption_on_reneg", SSL_CONF_FLAG_SERVER),
|
||||
SSL_CONF_CMD_SWITCH("no_legacy_server_connect", SSL_CONF_FLAG_SERVER),
|
||||
SSL_CONF_CMD_SWITCH("allow_no_dhe_kex", 0),
|
||||
SSL_CONF_CMD_SWITCH("prioritize_chacha", SSL_CONF_FLAG_SERVER),
|
||||
SSL_CONF_CMD_SWITCH("strict", 0),
|
||||
SSL_CONF_CMD_SWITCH("no_middlebox", 0),
|
||||
SSL_CONF_CMD_STRING(SignatureAlgorithms, "sigalgs", 0),
|
||||
SSL_CONF_CMD_STRING(ClientSignatureAlgorithms, "client_sigalgs", 0),
|
||||
SSL_CONF_CMD_STRING(Curves, "curves", 0),
|
||||
SSL_CONF_CMD_STRING(Groups, "groups", 0),
|
||||
#ifndef OPENSSL_NO_EC
|
||||
SSL_CONF_CMD_STRING(ECDHParameters, "named_curve", SSL_CONF_FLAG_SERVER),
|
||||
#endif
|
||||
@@ -575,17 +626,22 @@ static const ssl_conf_cmd_tbl ssl_conf_cmds[] = {
|
||||
SSL_CONF_TYPE_DIR),
|
||||
SSL_CONF_CMD(VerifyCAFile, "verifyCAfile", SSL_CONF_FLAG_CERTIFICATE,
|
||||
SSL_CONF_TYPE_FILE),
|
||||
SSL_CONF_CMD(RequestCAFile, "requestCAFile", SSL_CONF_FLAG_CERTIFICATE,
|
||||
SSL_CONF_TYPE_FILE),
|
||||
SSL_CONF_CMD(ClientCAFile, NULL,
|
||||
SSL_CONF_FLAG_SERVER | SSL_CONF_FLAG_CERTIFICATE,
|
||||
SSL_CONF_TYPE_FILE),
|
||||
SSL_CONF_CMD(RequestCAPath, NULL, SSL_CONF_FLAG_CERTIFICATE,
|
||||
SSL_CONF_TYPE_DIR),
|
||||
SSL_CONF_CMD(ClientCAPath, NULL,
|
||||
SSL_CONF_FLAG_SERVER | SSL_CONF_FLAG_CERTIFICATE,
|
||||
SSL_CONF_TYPE_DIR),
|
||||
#ifndef OPENSSL_NO_DH
|
||||
SSL_CONF_CMD(DHParameters, "dhparam",
|
||||
SSL_CONF_FLAG_SERVER | SSL_CONF_FLAG_CERTIFICATE,
|
||||
SSL_CONF_TYPE_FILE)
|
||||
SSL_CONF_TYPE_FILE),
|
||||
#endif
|
||||
SSL_CONF_CMD_STRING(RecordPadding, "record_padding", 0)
|
||||
};
|
||||
|
||||
/* Supported switches: must match order of switches in ssl_conf_cmds */
|
||||
@@ -594,6 +650,7 @@ static const ssl_switch_tbl ssl_cmd_switches[] = {
|
||||
{SSL_OP_NO_TLSv1, 0}, /* no_tls1 */
|
||||
{SSL_OP_NO_TLSv1_1, 0}, /* no_tls1_1 */
|
||||
{SSL_OP_NO_TLSv1_2, 0}, /* no_tls1_2 */
|
||||
{SSL_OP_NO_TLSv1_3, 0}, /* no_tls1_3 */
|
||||
{SSL_OP_ALL, 0}, /* bugs */
|
||||
{SSL_OP_NO_COMPRESSION, 0}, /* no_comp */
|
||||
{SSL_OP_NO_COMPRESSION, SSL_TFLAG_INV}, /* comp */
|
||||
@@ -610,7 +667,13 @@ static const ssl_switch_tbl ssl_cmd_switches[] = {
|
||||
{SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION, 0},
|
||||
/* no_legacy_server_connect */
|
||||
{SSL_OP_LEGACY_SERVER_CONNECT, SSL_TFLAG_INV},
|
||||
/* allow_no_dhe_kex */
|
||||
{SSL_OP_ALLOW_NO_DHE_KEX, 0},
|
||||
/* chacha reprioritization */
|
||||
{SSL_OP_PRIORITIZE_CHACHA, 0},
|
||||
{SSL_CERT_FLAG_TLS_STRICT, SSL_TFLAG_CERT}, /* strict */
|
||||
/* no_middlebox */
|
||||
{SSL_OP_ENABLE_MIDDLEBOX_COMPAT, SSL_TFLAG_INV},
|
||||
};
|
||||
|
||||
static int ssl_conf_cmd_skip_prefix(SSL_CONF_CTX *cctx, const char **pcmd)
|
||||
@@ -803,9 +866,9 @@ int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx)
|
||||
}
|
||||
if (cctx->canames) {
|
||||
if (cctx->ssl)
|
||||
SSL_set_client_CA_list(cctx->ssl, cctx->canames);
|
||||
SSL_set0_CA_list(cctx->ssl, cctx->canames);
|
||||
else if (cctx->ctx)
|
||||
SSL_CTX_set_client_CA_list(cctx->ctx, cctx->canames);
|
||||
SSL_CTX_set0_CA_list(cctx->ctx, cctx->canames);
|
||||
else
|
||||
sk_X509_NAME_pop_free(cctx->canames, X509_NAME_free);
|
||||
cctx->canames = NULL;
|
||||
|
||||
Reference in New Issue
Block a user