summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls13_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/tls13_lib.c')
-rw-r--r--src/lib/libssl/tls13_lib.c62
1 files changed, 39 insertions, 23 deletions
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c
index bdf547c8d9..044a0c5634 100644
--- a/src/lib/libssl/tls13_lib.c
+++ b/src/lib/libssl/tls13_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_lib.c,v 1.34 2020/02/15 14:40:38 jsing Exp $ */ 1/* $OpenBSD: tls13_lib.c,v 1.35 2020/04/21 16:55:17 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2019 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2019 Bob Beck <beck@openbsd.org>
@@ -24,12 +24,45 @@
24#include "tls13_internal.h" 24#include "tls13_internal.h"
25 25
26/* 26/*
27 * RFC 8446 section 4.1.3, magic values which must be set by the 27 * Downgrade sentinels - RFC 8446 section 4.1.3, magic values which must be set
28 * server in server random if it is willing to downgrade but supports 28 * by the server in server random if it is willing to downgrade but supports
29 * tls v1.3 29 * TLSv1.3
30 */ 30 */
31uint8_t tls13_downgrade_12[8] = {0x44, 0x4f, 0x57, 0x4e, 0x47, 0x52, 0x44, 0x01}; 31const uint8_t tls13_downgrade_12[8] = {
32uint8_t tls13_downgrade_11[8] = {0x44, 0x4f, 0x57, 0x4e, 0x47, 0x52, 0x44, 0x00}; 32 0x44, 0x4f, 0x57, 0x4e, 0x47, 0x52, 0x44, 0x01,
33};
34const uint8_t tls13_downgrade_11[8] = {
35 0x44, 0x4f, 0x57, 0x4e, 0x47, 0x52, 0x44, 0x00,
36};
37
38/*
39 * HelloRetryRequest hash - RFC 8446 section 4.1.3.
40 */
41const uint8_t tls13_hello_retry_request_hash[32] = {
42 0xcf, 0x21, 0xad, 0x74, 0xe5, 0x9a, 0x61, 0x11,
43 0xbe, 0x1d, 0x8c, 0x02, 0x1e, 0x65, 0xb8, 0x91,
44 0xc2, 0xa2, 0x11, 0x16, 0x7a, 0xbb, 0x8c, 0x5e,
45 0x07, 0x9e, 0x09, 0xe2, 0xc8, 0xa8, 0x33, 0x9c,
46};
47
48/*
49 * Certificate Verify padding - RFC 8446 section 4.4.3.
50 */
51const uint8_t tls13_cert_verify_pad[64] = {
52 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
53 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
54 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
55 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
56 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
57 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
58 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
59 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
60};
61
62const uint8_t tls13_cert_client_verify_context[] =
63 "TLS 1.3, client CertificateVerify";
64const uint8_t tls13_cert_server_verify_context[] =
65 "TLS 1.3, server CertificateVerify";
33 66
34const EVP_AEAD * 67const EVP_AEAD *
35tls13_cipher_aead(const SSL_CIPHER *cipher) 68tls13_cipher_aead(const SSL_CIPHER *cipher)
@@ -311,23 +344,6 @@ tls13_ctx_free(struct tls13_ctx *ctx)
311 freezero(ctx, sizeof(struct tls13_ctx)); 344 freezero(ctx, sizeof(struct tls13_ctx));
312} 345}
313 346
314/*
315 * Certificate Verify padding - RFC 8446 section 4.4.3.
316 */
317uint8_t tls13_cert_verify_pad[64] = {
318 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
319 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
320 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
321 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
322 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
323 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
324 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
325 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
326};
327
328uint8_t tls13_cert_client_verify_context[] = "TLS 1.3, client CertificateVerify";
329uint8_t tls13_cert_server_verify_context[] = "TLS 1.3, server CertificateVerify";
330
331int 347int
332tls13_cert_add(CBB *cbb, X509 *cert) 348tls13_cert_add(CBB *cbb, X509 *cert)
333{ 349{