From: jsing Date: Sun, 27 Jun 2021 16:33:30 +0000 (+0000) Subject: Tweak some data types and sprinkle some const. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5d0fde75fd87e4dfdd9fc04ea59e58d505806f96;p=openbsd Tweak some data types and sprinkle some const. --- diff --git a/regress/lib/libssl/client/clienttest.c b/regress/lib/libssl/client/clienttest.c index a58019a2b6a..17c678b1cce 100644 --- a/regress/lib/libssl/client/clienttest.c +++ b/regress/lib/libssl/client/clienttest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clienttest.c,v 1.28 2021/02/08 17:21:50 jsing Exp $ */ +/* $OpenBSD: clienttest.c,v 1.29 2021/06/27 16:33:30 jsing Exp $ */ /* * Copyright (c) 2015 Joel Sing * @@ -32,7 +32,7 @@ #define SSL3_RANDOM_OFFSET (SSL3_HM_OFFSET + 2) #define SSL3_CIPHER_OFFSET (SSL3_HM_OFFSET + 37) -static unsigned char cipher_list_dtls1[] = { +static const uint8_t cipher_list_dtls1[] = { 0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85, 0x00, 0x88, 0x00, 0x81, 0x00, 0x35, 0x00, 0x84, 0xc0, 0x13, 0xc0, 0x09, 0x00, 0x33, 0x00, 0x45, @@ -40,7 +40,7 @@ static unsigned char cipher_list_dtls1[] = { 0x00, 0x16, 0x00, 0x0a, 0x00, 0xff, }; -static unsigned char client_hello_dtls1[] = { +static const uint8_t client_hello_dtls1[] = { 0x16, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -60,7 +60,7 @@ static unsigned char client_hello_dtls1[] = { 0x00, }; -static unsigned char cipher_list_tls10[] = { +static const uint8_t cipher_list_tls10[] = { 0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85, 0x00, 0x88, 0x00, 0x81, 0x00, 0x35, 0x00, 0x84, 0xc0, 0x13, 0xc0, 0x09, 0x00, 0x33, 0x00, 0x45, @@ -69,7 +69,7 @@ static unsigned char cipher_list_tls10[] = { 0x00, 0x16, 0x00, 0x0a, 0x00, 0xff, }; -static unsigned char client_hello_tls10[] = { +static const uint8_t client_hello_tls10[] = { 0x16, 0x03, 0x01, 0x00, 0x73, 0x01, 0x00, 0x00, 0x6f, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -87,7 +87,7 @@ static unsigned char client_hello_tls10[] = { 0x00, 0x18, 0x00, 0x19, 0x00, 0x23, 0x00, 0x00, }; -static unsigned char cipher_list_tls11[] = { +static const uint8_t cipher_list_tls11[] = { 0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x39, 0xff, 0x85, 0x00, 0x88, 0x00, 0x81, 0x00, 0x35, 0x00, 0x84, 0xc0, 0x13, 0xc0, 0x09, 0x00, 0x33, 0x00, 0x45, @@ -96,7 +96,7 @@ static unsigned char cipher_list_tls11[] = { 0x00, 0x16, 0x00, 0x0a, 0x00, 0xff, }; -static unsigned char client_hello_tls11[] = { +static const uint8_t client_hello_tls11[] = { 0x16, 0x03, 0x01, 0x00, 0x73, 0x01, 0x00, 0x00, 0x6f, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -114,7 +114,7 @@ static unsigned char client_hello_tls11[] = { 0x00, 0x18, 0x00, 0x19, 0x00, 0x23, 0x00, 0x00, }; -static unsigned char cipher_list_tls12_aes[] = { +static const uint8_t cipher_list_tls12_aes[] = { 0xc0, 0x30, 0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x9f, 0x00, 0x6b, 0x00, 0x39, 0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa, @@ -129,7 +129,7 @@ static unsigned char cipher_list_tls12_aes[] = { 0x00, 0x0a, 0x00, 0xff, }; -static unsigned char cipher_list_tls12_chacha[] = { +static const uint8_t cipher_list_tls12_chacha[] = { 0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa, 0xc0, 0x30, 0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x9f, 0x00, 0x6b, 0x00, 0x39, @@ -144,7 +144,7 @@ static unsigned char cipher_list_tls12_chacha[] = { 0x00, 0x0a, 0x00, 0xff, }; -static unsigned char client_hello_tls12[] = { +static const uint8_t client_hello_tls12[] = { 0x16, 0x03, 0x01, 0x00, 0xbd, 0x01, 0x00, 0x00, 0xb9, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -173,14 +173,14 @@ static unsigned char client_hello_tls12[] = { }; struct client_hello_test { - const unsigned char *desc; + const uint8_t *desc; const int protocol; const size_t random_start; const SSL_METHOD *(*ssl_method)(void); const long ssl_options; }; -static struct client_hello_test client_hello_tests[] = { +static const struct client_hello_test client_hello_tests[] = { { .desc = "DTLSv1 client", .protocol = DTLS1_VERSION, @@ -289,7 +289,7 @@ static struct client_hello_test client_hello_tests[] = { (sizeof(client_hello_tests) / sizeof(*client_hello_tests)) static void -hexdump(const unsigned char *buf, size_t len) +hexdump(const uint8_t *buf, size_t len) { size_t i; @@ -313,7 +313,7 @@ static int make_client_hello(int protocol, char **out, size_t *outlen) { size_t client_hello_len, cipher_list_len, cipher_list_offset; - const char *client_hello, *cipher_list; + const uint8_t *client_hello, *cipher_list; char *p; *out = NULL; @@ -372,7 +372,7 @@ make_client_hello(int protocol, char **out, size_t *outlen) } static int -client_hello_test(int testno, struct client_hello_test *cht) +client_hello_test(int testno, const struct client_hello_test *cht) { BIO *rbio = NULL, *wbio = NULL; SSL_CTX *ssl_ctx = NULL;