summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-07-16 22:16:49 +0000
committerDamien Miller <djm@mindrot.org>2019-07-17 11:04:25 +1000
commitf8829fe57fb0479d6103cfe1190095da3c032c6d (patch)
tree77135de31e9025dea74cf0e7a8cf79cdc120883d /regress
parent1254fcbb2f005f745f2265016ee9fa52e16d37b0 (diff)
upstream: adapt to sshbuf_dtob64() change
OpenBSD-Regress-ID: 82374a83edf0955fd1477169eee3f5d6467405a6
Diffstat (limited to 'regress')
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_misc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/regress/unittests/sshbuf/test_sshbuf_misc.c b/regress/unittests/sshbuf/test_sshbuf_misc.c
index 19c1f25bb..c53db937f 100644
--- a/regress/unittests/sshbuf/test_sshbuf_misc.c
+++ b/regress/unittests/sshbuf/test_sshbuf_misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_sshbuf_misc.c,v 1.3 2019/07/15 13:12:02 djm Exp $ */ 1/* $OpenBSD: test_sshbuf_misc.c,v 1.4 2019/07/16 22:16:49 djm Exp $ */
2/* 2/*
3 * Regress test for sshbuf.h buffer API 3 * Regress test for sshbuf.h buffer API
4 * 4 *
@@ -61,48 +61,48 @@ sshbuf_misc_tests(void)
61 sshbuf_free(p1); 61 sshbuf_free(p1);
62 TEST_DONE(); 62 TEST_DONE();
63 63
64 TEST_START("sshbuf_dtob64 len 1"); 64 TEST_START("sshbuf_dtob64_string len 1");
65 p1 = sshbuf_new(); 65 p1 = sshbuf_new();
66 ASSERT_PTR_NE(p1, NULL); 66 ASSERT_PTR_NE(p1, NULL);
67 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x11), 0); 67 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x11), 0);
68 p = sshbuf_dtob64(p1); 68 p = sshbuf_dtob64_string(p1, 0);
69 ASSERT_PTR_NE(p, NULL); 69 ASSERT_PTR_NE(p, NULL);
70 ASSERT_STRING_EQ(p, "EQ=="); 70 ASSERT_STRING_EQ(p, "EQ==");
71 free(p); 71 free(p);
72 sshbuf_free(p1); 72 sshbuf_free(p1);
73 TEST_DONE(); 73 TEST_DONE();
74 74
75 TEST_START("sshbuf_dtob64 len 2"); 75 TEST_START("sshbuf_dtob64_string len 2");
76 p1 = sshbuf_new(); 76 p1 = sshbuf_new();
77 ASSERT_PTR_NE(p1, NULL); 77 ASSERT_PTR_NE(p1, NULL);
78 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x11), 0); 78 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x11), 0);
79 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x22), 0); 79 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x22), 0);
80 p = sshbuf_dtob64(p1); 80 p = sshbuf_dtob64_string(p1, 0);
81 ASSERT_PTR_NE(p, NULL); 81 ASSERT_PTR_NE(p, NULL);
82 ASSERT_STRING_EQ(p, "ESI="); 82 ASSERT_STRING_EQ(p, "ESI=");
83 free(p); 83 free(p);
84 sshbuf_free(p1); 84 sshbuf_free(p1);
85 TEST_DONE(); 85 TEST_DONE();
86 86
87 TEST_START("sshbuf_dtob64 len 3"); 87 TEST_START("sshbuf_dtob64_string len 3");
88 p1 = sshbuf_new(); 88 p1 = sshbuf_new();
89 ASSERT_PTR_NE(p1, NULL); 89 ASSERT_PTR_NE(p1, NULL);
90 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x11), 0); 90 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x11), 0);
91 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x22), 0); 91 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x22), 0);
92 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x33), 0); 92 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x33), 0);
93 p = sshbuf_dtob64(p1); 93 p = sshbuf_dtob64_string(p1, 0);
94 ASSERT_PTR_NE(p, NULL); 94 ASSERT_PTR_NE(p, NULL);
95 ASSERT_STRING_EQ(p, "ESIz"); 95 ASSERT_STRING_EQ(p, "ESIz");
96 free(p); 96 free(p);
97 sshbuf_free(p1); 97 sshbuf_free(p1);
98 TEST_DONE(); 98 TEST_DONE();
99 99
100 TEST_START("sshbuf_dtob64 len 8191"); 100 TEST_START("sshbuf_dtob64_string len 8191");
101 p1 = sshbuf_new(); 101 p1 = sshbuf_new();
102 ASSERT_PTR_NE(p1, NULL); 102 ASSERT_PTR_NE(p1, NULL);
103 ASSERT_INT_EQ(sshbuf_reserve(p1, 8192, NULL), 0); 103 ASSERT_INT_EQ(sshbuf_reserve(p1, 8192, NULL), 0);
104 bzero(sshbuf_mutable_ptr(p1), 8192); 104 bzero(sshbuf_mutable_ptr(p1), 8192);
105 p = sshbuf_dtob64(p1); 105 p = sshbuf_dtob64_string(p1, 0);
106 ASSERT_PTR_NE(p, NULL); 106 ASSERT_PTR_NE(p, NULL);
107 ASSERT_SIZE_T_EQ(strlen(p), ((8191 + 2) / 3) * 4); 107 ASSERT_SIZE_T_EQ(strlen(p), ((8191 + 2) / 3) * 4);
108 free(p); 108 free(p);