early-access version 2698
This commit is contained in:
30
externals/libressl/tls/tls_config.c
vendored
30
externals/libressl/tls/tls_config.c
vendored
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tls_config.c,v 1.58 2020/01/20 08:39:21 jsing Exp $ */
|
||||
/* $OpenBSD: tls_config.c,v 1.65 2022/01/25 21:51:24 eric Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
|
||||
*
|
||||
@@ -179,6 +179,8 @@ tls_config_free(struct tls_config *config)
|
||||
free((char *)config->crl_mem);
|
||||
free(config->ecdhecurves);
|
||||
|
||||
pthread_mutex_destroy(&config->mutex);
|
||||
|
||||
free(config);
|
||||
}
|
||||
|
||||
@@ -351,7 +353,8 @@ tls_config_add_keypair_file_internal(struct tls_config *config,
|
||||
return (-1);
|
||||
if (tls_keypair_set_cert_file(keypair, &config->error, cert_file) != 0)
|
||||
goto err;
|
||||
if (tls_keypair_set_key_file(keypair, &config->error, key_file) != 0)
|
||||
if (key_file != NULL &&
|
||||
tls_keypair_set_key_file(keypair, &config->error, key_file) != 0)
|
||||
goto err;
|
||||
if (ocsp_file != NULL &&
|
||||
tls_keypair_set_ocsp_staple_file(keypair, &config->error,
|
||||
@@ -378,7 +381,8 @@ tls_config_add_keypair_mem_internal(struct tls_config *config, const uint8_t *ce
|
||||
return (-1);
|
||||
if (tls_keypair_set_cert_mem(keypair, &config->error, cert, cert_len) != 0)
|
||||
goto err;
|
||||
if (tls_keypair_set_key_mem(keypair, &config->error, key, key_len) != 0)
|
||||
if (key != NULL &&
|
||||
tls_keypair_set_key_mem(keypair, &config->error, key, key_len) != 0)
|
||||
goto err;
|
||||
if (staple != NULL &&
|
||||
tls_keypair_set_ocsp_staple_mem(keypair, &config->error, staple,
|
||||
@@ -718,7 +722,7 @@ tls_config_set_session_fd(struct tls_config *config, int session_fd)
|
||||
|
||||
if (sb.st_uid != getuid()) {
|
||||
tls_config_set_errorx(config, "session file has incorrect "
|
||||
"owner (uid %i != %i)", sb.st_uid, getuid());
|
||||
"owner (uid %u != %u)", sb.st_uid, getuid());
|
||||
return (-1);
|
||||
}
|
||||
mugo = sb.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO);
|
||||
@@ -733,6 +737,17 @@ tls_config_set_session_fd(struct tls_config *config, int session_fd)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
tls_config_set_sign_cb(struct tls_config *config, tls_sign_cb cb, void *cb_arg)
|
||||
{
|
||||
config->use_fake_private_key = 1;
|
||||
config->skip_private_key_check = 1;
|
||||
config->sign_cb = cb;
|
||||
config->sign_cb_arg = cb_arg;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
tls_config_set_verify_depth(struct tls_config *config, int verify_depth)
|
||||
{
|
||||
@@ -803,6 +818,13 @@ tls_config_skip_private_key_check(struct tls_config *config)
|
||||
config->skip_private_key_check = 1;
|
||||
}
|
||||
|
||||
void
|
||||
tls_config_use_fake_private_key(struct tls_config *config)
|
||||
{
|
||||
config->use_fake_private_key = 1;
|
||||
config->skip_private_key_check = 1;
|
||||
}
|
||||
|
||||
int
|
||||
tls_config_set_ocsp_staple_file(struct tls_config *config, const char *staple_file)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user