-/* $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 <jsing@openbsd.org>
*
#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,
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,
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,
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,
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,
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,
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,
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,
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,
};
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,
(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;
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;
}
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;