-/* $OpenBSD: tls13_internal.h,v 1.97 2022/06/03 13:11:04 tb Exp $ */
+/* $OpenBSD: tls13_internal.h,v 1.98 2022/07/17 15:49:20 jsing Exp $ */
/*
* Copyright (c) 2018 Bob Beck <beck@openbsd.org>
* Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
#define TLS13_PHH_LIMIT 100
#endif
-struct tls13_ctx *tls13_ctx_new(int mode);
+struct tls13_ctx *tls13_ctx_new(int mode, SSL *ssl);
void tls13_ctx_free(struct tls13_ctx *ctx);
const EVP_AEAD *tls13_cipher_aead(const SSL_CIPHER *cipher);
-/* $OpenBSD: tls13_legacy.c,v 1.37 2022/02/06 16:08:14 jsing Exp $ */
+/* $OpenBSD: tls13_legacy.c,v 1.38 2022/07/17 15:49:20 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
*
int ret;
if (ctx == NULL) {
- if ((ctx = tls13_ctx_new(TLS13_HS_SERVER)) == NULL) {
+ if ((ctx = tls13_ctx_new(TLS13_HS_SERVER, ssl)) == NULL) {
SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
return -1;
}
- ssl->internal->tls13 = ctx;
- ctx->ssl = ssl;
- ctx->hs = &ssl->s3->hs;
-
if (!tls13_server_init(ctx)) {
if (ERR_peek_error() == 0)
SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
int ret;
if (ctx == NULL) {
- if ((ctx = tls13_ctx_new(TLS13_HS_CLIENT)) == NULL) {
+ if ((ctx = tls13_ctx_new(TLS13_HS_CLIENT, ssl)) == NULL) {
SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
return -1;
}
- ssl->internal->tls13 = ctx;
- ctx->ssl = ssl;
- ctx->hs = &ssl->s3->hs;
-
if (!tls13_client_init(ctx)) {
if (ERR_peek_error() == 0)
SSLerror(ssl, ERR_R_INTERNAL_ERROR); /* XXX */
-/* $OpenBSD: tls13_lib.c,v 1.63 2022/02/05 14:54:10 jsing Exp $ */
+/* $OpenBSD: tls13_lib.c,v 1.64 2022/07/17 15:49:20 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2019 Bob Beck <beck@openbsd.org>
};
struct tls13_ctx *
-tls13_ctx_new(int mode)
+tls13_ctx_new(int mode, SSL *ssl)
{
struct tls13_ctx *ctx = NULL;
if ((ctx = calloc(sizeof(struct tls13_ctx), 1)) == NULL)
goto err;
+ ctx->hs = &ssl->s3->hs;
ctx->mode = mode;
+ ctx->ssl = ssl;
if ((ctx->rl = tls13_record_layer_new(&rl_callbacks, ctx)) == NULL)
goto err;
ctx->middlebox_compat = 1;
+ ssl->internal->tls13 = ctx;
+
return ctx;
err: