summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libssl/tls13_client.c12
-rw-r--r--src/lib/libssl/tls13_internal.h13
-rw-r--r--src/lib/libssl/tls13_lib.c62
3 files changed, 47 insertions, 40 deletions
diff --git a/src/lib/libssl/tls13_client.c b/src/lib/libssl/tls13_client.c
index 5cd588875e..0da08f62c3 100644
--- a/src/lib/libssl/tls13_client.c
+++ b/src/lib/libssl/tls13_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_client.c,v 1.49 2020/04/17 17:16:53 jsing Exp $ */ 1/* $OpenBSD: tls13_client.c,v 1.50 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 * 4 *
@@ -251,16 +251,6 @@ tls13_client_hello_sent(struct tls13_ctx *ctx)
251 return 1; 251 return 1;
252} 252}
253 253
254/*
255 * HelloRetryRequest hash - RFC 8446 section 4.1.3.
256 */
257static const uint8_t tls13_hello_retry_request_hash[] = {
258 0xcf, 0x21, 0xad, 0x74, 0xe5, 0x9a, 0x61, 0x11,
259 0xbe, 0x1d, 0x8c, 0x02, 0x1e, 0x65, 0xb8, 0x91,
260 0xc2, 0xa2, 0x11, 0x16, 0x7a, 0xbb, 0x8c, 0x5e,
261 0x07, 0x9e, 0x09, 0xe2, 0xc8, 0xa8, 0x33, 0x9c,
262};
263
264static int 254static int
265tls13_server_hello_is_legacy(CBS *cbs) 255tls13_server_hello_is_legacy(CBS *cbs)
266{ 256{
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h
index 6f5f5197d0..c5b893bc16 100644
--- a/src/lib/libssl/tls13_internal.h
+++ b/src/lib/libssl/tls13_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_internal.h,v 1.63 2020/04/18 14:07:56 jsing Exp $ */ 1/* $OpenBSD: tls13_internal.h,v 1.64 2020/04/21 16:55:17 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
@@ -339,11 +339,12 @@ int tls13_error_setx(struct tls13_error *error, int code, int subcode,
339 tls13_error_setx(&(ctx)->error, (code), (subcode), __FILE__, __LINE__, \ 339 tls13_error_setx(&(ctx)->error, (code), (subcode), __FILE__, __LINE__, \
340 (fmt), __VA_ARGS__) 340 (fmt), __VA_ARGS__)
341 341
342extern uint8_t tls13_downgrade_12[8]; 342extern const uint8_t tls13_downgrade_12[8];
343extern uint8_t tls13_downgrade_11[8]; 343extern const uint8_t tls13_downgrade_11[8];
344extern uint8_t tls13_cert_verify_pad[64]; 344extern const uint8_t tls13_hello_retry_request_hash[32];
345extern uint8_t tls13_cert_client_verify_context[]; 345extern const uint8_t tls13_cert_verify_pad[64];
346extern uint8_t tls13_cert_server_verify_context[]; 346extern const uint8_t tls13_cert_client_verify_context[];
347extern const uint8_t tls13_cert_server_verify_context[];
347 348
348__END_HIDDEN_DECLS 349__END_HIDDEN_DECLS
349 350
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{