diff options
author | tb <> | 2022-01-14 09:12:15 +0000 |
---|---|---|
committer | tb <> | 2022-01-14 09:12:15 +0000 |
commit | 1bcac5c126c6b65375ad4d9e9a98d8b7b3398b79 (patch) | |
tree | 1f0b0741a18bee89f4d9dcd32502bbdbb2079dd8 /src | |
parent | 971bbef45c2d6baed8d7955cf82726f084fa8398 (diff) | |
download | openbsd-1bcac5c126c6b65375ad4d9e9a98d8b7b3398b79.tar.gz openbsd-1bcac5c126c6b65375ad4d9e9a98d8b7b3398b79.tar.bz2 openbsd-1bcac5c126c6b65375ad4d9e9a98d8b7b3398b79.zip |
Convert the new record layers to opaque EVP_AEAD_CTX
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/tls12_record_layer.c | 9 | ||||
-rw-r--r-- | src/lib/libssl/tls13_record_layer.c | 9 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/libssl/tls12_record_layer.c b/src/lib/libssl/tls12_record_layer.c index f7264a17c5..3568e1876a 100644 --- a/src/lib/libssl/tls12_record_layer.c +++ b/src/lib/libssl/tls12_record_layer.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls12_record_layer.c,v 1.35 2021/10/23 15:02:27 jsing Exp $ */ | 1 | /* $OpenBSD: tls12_record_layer.c,v 1.36 2022/01/14 09:12:15 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -61,10 +61,7 @@ tls12_record_protection_new(void) | |||
61 | static void | 61 | static void |
62 | tls12_record_protection_clear(struct tls12_record_protection *rp) | 62 | tls12_record_protection_clear(struct tls12_record_protection *rp) |
63 | { | 63 | { |
64 | if (rp->aead_ctx != NULL) { | 64 | EVP_AEAD_CTX_free(rp->aead_ctx); |
65 | EVP_AEAD_CTX_cleanup(rp->aead_ctx); | ||
66 | freezero(rp->aead_ctx, sizeof(*rp->aead_ctx)); | ||
67 | } | ||
68 | 65 | ||
69 | freezero(rp->aead_nonce, rp->aead_nonce_len); | 66 | freezero(rp->aead_nonce, rp->aead_nonce_len); |
70 | freezero(rp->aead_fixed_nonce, rp->aead_fixed_nonce_len); | 67 | freezero(rp->aead_fixed_nonce, rp->aead_fixed_nonce_len); |
@@ -422,7 +419,7 @@ tls12_record_layer_ccs_aead(struct tls12_record_layer *rl, | |||
422 | if (!tls12_record_protection_unused(rp)) | 419 | if (!tls12_record_protection_unused(rp)) |
423 | return 0; | 420 | return 0; |
424 | 421 | ||
425 | if ((rp->aead_ctx = calloc(1, sizeof(*rp->aead_ctx))) == NULL) | 422 | if ((rp->aead_ctx = EVP_AEAD_CTX_new()) == NULL) |
426 | return 0; | 423 | return 0; |
427 | 424 | ||
428 | /* AES GCM cipher suites use variable nonce in record. */ | 425 | /* AES GCM cipher suites use variable nonce in record. */ |
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c index b49d237951..c68ee3b3a5 100644 --- a/src/lib/libssl/tls13_record_layer.c +++ b/src/lib/libssl/tls13_record_layer.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_record_layer.c,v 1.66 2022/01/06 18:18:13 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_record_layer.c,v 1.67 2022/01/14 09:12:15 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -40,10 +40,7 @@ tls13_record_protection_new(void) | |||
40 | void | 40 | void |
41 | tls13_record_protection_clear(struct tls13_record_protection *rp) | 41 | tls13_record_protection_clear(struct tls13_record_protection *rp) |
42 | { | 42 | { |
43 | if (rp->aead_ctx != NULL) { | 43 | EVP_AEAD_CTX_free(rp->aead_ctx); |
44 | EVP_AEAD_CTX_cleanup(rp->aead_ctx); | ||
45 | freezero(rp->aead_ctx, sizeof(*rp->aead_ctx)); | ||
46 | } | ||
47 | 44 | ||
48 | tls13_secret_cleanup(&rp->iv); | 45 | tls13_secret_cleanup(&rp->iv); |
49 | tls13_secret_cleanup(&rp->nonce); | 46 | tls13_secret_cleanup(&rp->nonce); |
@@ -461,7 +458,7 @@ tls13_record_layer_set_traffic_key(const EVP_AEAD *aead, const EVP_MD *hash, | |||
461 | 458 | ||
462 | tls13_record_protection_clear(rp); | 459 | tls13_record_protection_clear(rp); |
463 | 460 | ||
464 | if ((rp->aead_ctx = calloc(1, sizeof(*rp->aead_ctx))) == NULL) | 461 | if ((rp->aead_ctx = EVP_AEAD_CTX_new()) == NULL) |
465 | return 0; | 462 | return 0; |
466 | 463 | ||
467 | if (!tls13_secret_init(&rp->iv, EVP_AEAD_nonce_length(aead))) | 464 | if (!tls13_secret_init(&rp->iv, EVP_AEAD_nonce_length(aead))) |