summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinoguchi <>2020-05-02 00:31:54 +0000
committerinoguchi <>2020-05-02 00:31:54 +0000
commit1d3c89be75bbddb0d38a97088d71b1bb685bacad (patch)
treee418df734e6b79498d074d98da875feb7930e02a
parent829a3b5141fe5548704743974f88860479a8ed2b (diff)
downloadopenbsd-1d3c89be75bbddb0d38a97088d71b1bb685bacad.tar.gz
openbsd-1d3c89be75bbddb0d38a97088d71b1bb685bacad.tar.bz2
openbsd-1d3c89be75bbddb0d38a97088d71b1bb685bacad.zip
Add const to TLS1.3 internal vectors
ok tb@
-rw-r--r--src/lib/libssl/tls13_handshake.c24
-rw-r--r--src/lib/libssl/tls13_record_layer.c4
2 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/libssl/tls13_handshake.c b/src/lib/libssl/tls13_handshake.c
index 0d3e64dee8..d324a7f4ba 100644
--- a/src/lib/libssl/tls13_handshake.c
+++ b/src/lib/libssl/tls13_handshake.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_handshake.c,v 1.54 2020/04/29 01:16:49 inoguchi Exp $ */ 1/* $OpenBSD: tls13_handshake.c,v 1.55 2020/05/02 00:30:55 inoguchi Exp $ */
2/* 2/*
3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org>
4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
@@ -36,19 +36,19 @@ struct tls13_handshake_action {
36 int (*recv)(struct tls13_ctx *ctx, CBS *cbs); 36 int (*recv)(struct tls13_ctx *ctx, CBS *cbs);
37}; 37};
38 38
39static enum tls13_message_type 39static const enum tls13_message_type
40 tls13_handshake_active_state(struct tls13_ctx *ctx); 40 tls13_handshake_active_state(struct tls13_ctx *ctx);
41 41
42static struct tls13_handshake_action * 42static const struct tls13_handshake_action *
43 tls13_handshake_active_action(struct tls13_ctx *ctx); 43 tls13_handshake_active_action(struct tls13_ctx *ctx);
44static int tls13_handshake_advance_state_machine(struct tls13_ctx *ctx); 44static int tls13_handshake_advance_state_machine(struct tls13_ctx *ctx);
45 45
46static int tls13_handshake_send_action(struct tls13_ctx *ctx, 46static int tls13_handshake_send_action(struct tls13_ctx *ctx,
47 struct tls13_handshake_action *action); 47 const struct tls13_handshake_action *action);
48static int tls13_handshake_recv_action(struct tls13_ctx *ctx, 48static int tls13_handshake_recv_action(struct tls13_ctx *ctx,
49 struct tls13_handshake_action *action); 49 const struct tls13_handshake_action *action);
50 50
51struct tls13_handshake_action state_machine[] = { 51static const struct tls13_handshake_action state_machine[] = {
52 [CLIENT_HELLO] = { 52 [CLIENT_HELLO] = {
53 .handshake_type = TLS13_MT_CLIENT_HELLO, 53 .handshake_type = TLS13_MT_CLIENT_HELLO,
54 .sender = TLS13_HS_CLIENT, 54 .sender = TLS13_HS_CLIENT,
@@ -143,7 +143,7 @@ struct tls13_handshake_action state_machine[] = {
143 }, 143 },
144}; 144};
145 145
146enum tls13_message_type handshakes[][TLS13_NUM_MESSAGE_TYPES] = { 146const enum tls13_message_type handshakes[][TLS13_NUM_MESSAGE_TYPES] = {
147 [INITIAL] = { 147 [INITIAL] = {
148 CLIENT_HELLO, 148 CLIENT_HELLO,
149 SERVER_HELLO_RETRY_REQUEST, 149 SERVER_HELLO_RETRY_REQUEST,
@@ -248,7 +248,7 @@ enum tls13_message_type handshakes[][TLS13_NUM_MESSAGE_TYPES] = {
248 248
249const size_t handshake_count = sizeof(handshakes) / sizeof(handshakes[0]); 249const size_t handshake_count = sizeof(handshakes) / sizeof(handshakes[0]);
250 250
251static enum tls13_message_type 251static const enum tls13_message_type
252tls13_handshake_active_state(struct tls13_ctx *ctx) 252tls13_handshake_active_state(struct tls13_ctx *ctx)
253{ 253{
254 struct tls13_handshake_stage hs = ctx->handshake_stage; 254 struct tls13_handshake_stage hs = ctx->handshake_stage;
@@ -261,7 +261,7 @@ tls13_handshake_active_state(struct tls13_ctx *ctx)
261 return handshakes[hs.hs_type][hs.message_number]; 261 return handshakes[hs.hs_type][hs.message_number];
262} 262}
263 263
264static struct tls13_handshake_action * 264static const struct tls13_handshake_action *
265tls13_handshake_active_action(struct tls13_ctx *ctx) 265tls13_handshake_active_action(struct tls13_ctx *ctx)
266{ 266{
267 enum tls13_message_type mt = tls13_handshake_active_state(ctx); 267 enum tls13_message_type mt = tls13_handshake_active_state(ctx);
@@ -293,7 +293,7 @@ tls13_handshake_msg_record(struct tls13_ctx *ctx)
293int 293int
294tls13_handshake_perform(struct tls13_ctx *ctx) 294tls13_handshake_perform(struct tls13_ctx *ctx)
295{ 295{
296 struct tls13_handshake_action *action; 296 const struct tls13_handshake_action *action;
297 int ret; 297 int ret;
298 298
299 for (;;) { 299 for (;;) {
@@ -324,7 +324,7 @@ tls13_handshake_perform(struct tls13_ctx *ctx)
324 324
325static int 325static int
326tls13_handshake_send_action(struct tls13_ctx *ctx, 326tls13_handshake_send_action(struct tls13_ctx *ctx,
327 struct tls13_handshake_action *action) 327 const struct tls13_handshake_action *action)
328{ 328{
329 ssize_t ret; 329 ssize_t ret;
330 CBB cbb; 330 CBB cbb;
@@ -372,7 +372,7 @@ tls13_handshake_send_action(struct tls13_ctx *ctx,
372 372
373static int 373static int
374tls13_handshake_recv_action(struct tls13_ctx *ctx, 374tls13_handshake_recv_action(struct tls13_ctx *ctx,
375 struct tls13_handshake_action *action) 375 const struct tls13_handshake_action *action)
376{ 376{
377 uint8_t msg_type; 377 uint8_t msg_type;
378 ssize_t ret; 378 ssize_t ret;
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c
index dac8fe088d..0bf1d19d91 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.31 2020/04/29 01:22:28 inoguchi Exp $ */ 1/* $OpenBSD: tls13_record_layer.c,v 1.32 2020/05/02 00:31:54 inoguchi 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 *
@@ -166,7 +166,7 @@ tls13_record_layer_rbuf(struct tls13_record_layer *rl, CBS *cbs)
166 CBS_dup(&rl->rbuf_cbs, cbs); 166 CBS_dup(&rl->rbuf_cbs, cbs);
167} 167}
168 168
169uint8_t tls13_max_seq_num[TLS13_RECORD_SEQ_NUM_LEN] = { 169static const uint8_t tls13_max_seq_num[TLS13_RECORD_SEQ_NUM_LEN] = {
170 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 170 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
171}; 171};
172 172