summaryrefslogtreecommitdiff
path: root/src/regress/lib/libssl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/regress/lib/libssl/pqueue/Makefile7
-rw-r--r--src/regress/lib/libssl/pqueue/expected.txt3
-rw-r--r--src/regress/lib/libssl/pqueue/pq_test.c95
-rw-r--r--src/regress/lib/libssl/tlsext/tlsexttest.c7
4 files changed, 63 insertions, 49 deletions
diff --git a/src/regress/lib/libssl/pqueue/Makefile b/src/regress/lib/libssl/pqueue/Makefile
index 48c2cb7e61..05fe9a268d 100644
--- a/src/regress/lib/libssl/pqueue/Makefile
+++ b/src/regress/lib/libssl/pqueue/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.1 2016/11/04 19:45:12 jsing Exp $ 1# $OpenBSD: Makefile,v 1.2 2025/05/04 11:04:02 tb Exp $
2 2
3PROG= pq_test 3PROG= pq_test
4SRC= ${.CURDIR}/../../../../lib/libssl 4SRC= ${.CURDIR}/../../../../lib/libssl
@@ -9,9 +9,4 @@ DPADD= ${LIBSSL} ${LIBCRYPTO}
9WARNINGS= Yes 9WARNINGS= Yes
10CFLAGS+= -DLIBRESSL_INTERNAL -Werror 10CFLAGS+= -DLIBRESSL_INTERNAL -Werror
11 11
12REGRESS_TARGETS= regress-pq_test
13
14regress-pq_test: ${PROG}
15 ${.OBJDIR}/pq_test | cmp -s ${.CURDIR}/expected.txt /dev/stdin
16
17.include <bsd.regress.mk> 12.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/pqueue/expected.txt b/src/regress/lib/libssl/pqueue/expected.txt
deleted file mode 100644
index c59d6cd838..0000000000
--- a/src/regress/lib/libssl/pqueue/expected.txt
+++ /dev/null
@@ -1,3 +0,0 @@
1item 6966726167696c69
2item 7374696365787069
3item 737570657263616c
diff --git a/src/regress/lib/libssl/pqueue/pq_test.c b/src/regress/lib/libssl/pqueue/pq_test.c
index a078ba5366..822fdea961 100644
--- a/src/regress/lib/libssl/pqueue/pq_test.c
+++ b/src/regress/lib/libssl/pqueue/pq_test.c
@@ -59,60 +59,77 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62
62#include "pqueue.h" 63#include "pqueue.h"
63 64
64/* remember to change expected.txt if you change these values */ 65static const unsigned char *pq_expected[3] = {
65unsigned char prio1[8] = "supercal"; 66 "ifragili",
66unsigned char prio2[8] = "ifragili"; 67 "sticexpi",
67unsigned char prio3[8] = "sticexpi"; 68 "supercal"
69};
68 70
69static void 71static int
70pqueue_print(pqueue pq) 72test_pqueue(void)
71{ 73{
72 pitem *iter, *item; 74 const unsigned char *prio1 = pq_expected[2];
73 75 const unsigned char *prio2 = pq_expected[0];
74 iter = pqueue_iterator(pq); 76 const unsigned char *prio3 = pq_expected[1];
75 for (item = pqueue_next(&iter); item != NULL; 77 pqueue pq = NULL;
76 item = pqueue_next(&iter)) { 78 pitem *item = NULL;
77 printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n", 79 pitem *iter = NULL;
78 item->priority[0], item->priority[1], 80 int i = 0;
79 item->priority[2], item->priority[3], 81 int failed = 1;
80 item->priority[4], item->priority[5],
81 item->priority[6], item->priority[7]);
82 }
83}
84 82
85int 83 if ((pq = pqueue_new()) == NULL)
86main(void) 84 goto failure;
87{
88 pitem *item;
89 pqueue pq;
90 85
91 pq = pqueue_new(); 86 if (!pqueue_insert(pq, pitem_new(prio3, NULL)))
87 goto failure;
88 if (!pqueue_insert(pq, pitem_new(prio1, NULL)))
89 goto failure;
90 if (!pqueue_insert(pq, pitem_new(prio2, NULL)))
91 goto failure;
92 92
93 item = pitem_new(prio3, NULL); 93 if (pqueue_size(pq) != 3)
94 pqueue_insert(pq, item); 94 goto failure;
95 95
96 item = pitem_new(prio1, NULL); 96 if ((item = pqueue_find(pq, prio1)) == NULL)
97 pqueue_insert(pq, item); 97 goto failure;
98 if ((item = pqueue_find(pq, prio2)) == NULL)
99 goto failure;
100 if ((item = pqueue_find(pq, prio3)) == NULL)
101 goto failure;
98 102
99 item = pitem_new(prio2, NULL); 103 if ((item = pqueue_peek(pq)) == NULL)
100 pqueue_insert(pq, item); 104 goto failure;
101 105
102 item = pqueue_find(pq, prio1); 106 if (memcmp(item->priority, pq_expected[0], 8))
103 fprintf(stderr, "found %p\n", item->priority); 107 goto failure;
104 108
105 item = pqueue_find(pq, prio2); 109 iter = pqueue_iterator(pq);
106 fprintf(stderr, "found %p\n", item->priority); 110 for (item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) {
111 if (memcmp(item->priority, pq_expected[i], 8) != 0)
112 goto failure;
113 i++;
114 }
107 115
108 item = pqueue_find(pq, prio3); 116 failed = (i != 3);
109 fprintf(stderr, "found %p\n", item ? item->priority: 0);
110 117
111 pqueue_print(pq); 118 failure:
112 119
113 for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq)) 120 for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq))
114 pitem_free(item); 121 pitem_free(item);
115
116 pqueue_free(pq); 122 pqueue_free(pq);
117 return 0; 123
124 return failed;
125}
126
127int
128main(void)
129{
130 int failed = 0;
131
132 failed |= test_pqueue();
133
134 return failed;
118} 135}
diff --git a/src/regress/lib/libssl/tlsext/tlsexttest.c b/src/regress/lib/libssl/tlsext/tlsexttest.c
index 32bad7ebc8..68584998ce 100644
--- a/src/regress/lib/libssl/tlsext/tlsexttest.c
+++ b/src/regress/lib/libssl/tlsext/tlsexttest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tlsexttest.c,v 1.93 2025/04/30 13:44:54 tb Exp $ */ 1/* $OpenBSD: tlsexttest.c,v 1.94 2025/05/03 08:37:28 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> 4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@@ -3740,6 +3740,11 @@ test_tlsext_keyshare_client(void)
3740 FAIL("Did not select a key share"); 3740 FAIL("Did not select a key share");
3741 goto done; 3741 goto done;
3742 } 3742 }
3743 if (tls_key_share_group(ssl->s3->hs.key_share) != 29) {
3744 FAIL("wrong key share group: got %d, expected 29\n",
3745 tls_key_share_group(ssl->s3->hs.key_share));
3746 goto done;
3747 }
3743 3748
3744 /* 3749 /*
3745 * Pretend the client did not send the supported groups extension. We 3750 * Pretend the client did not send the supported groups extension. We