Lines Matching +full:1 +full:p1
28 struct sshbuf *p1; in sshbuf_misc_tests() local
36 p1 = sshbuf_new(); in sshbuf_misc_tests()
37 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
38 ASSERT_INT_EQ(sshbuf_put_u32(p1, 0x12345678), 0); in sshbuf_misc_tests()
39 sshbuf_dump(p1, out); in sshbuf_misc_tests()
42 sz = fread(tmp, 1, sizeof(tmp), out); in sshbuf_misc_tests()
49 sshbuf_free(p1); in sshbuf_misc_tests()
53 p1 = sshbuf_new(); in sshbuf_misc_tests()
54 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
55 ASSERT_INT_EQ(sshbuf_put_u32(p1, 0x12345678), 0); in sshbuf_misc_tests()
56 p = sshbuf_dtob16(p1); in sshbuf_misc_tests()
60 sshbuf_free(p1); in sshbuf_misc_tests()
63 TEST_START("sshbuf_dtob64_string len 1"); in sshbuf_misc_tests()
64 p1 = sshbuf_new(); in sshbuf_misc_tests()
65 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
66 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x11), 0); in sshbuf_misc_tests()
67 p = sshbuf_dtob64_string(p1, 0); in sshbuf_misc_tests()
71 sshbuf_free(p1); in sshbuf_misc_tests()
75 p1 = sshbuf_new(); in sshbuf_misc_tests()
76 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
77 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x11), 0); in sshbuf_misc_tests()
78 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x22), 0); in sshbuf_misc_tests()
79 p = sshbuf_dtob64_string(p1, 0); in sshbuf_misc_tests()
83 sshbuf_free(p1); in sshbuf_misc_tests()
87 p1 = sshbuf_new(); in sshbuf_misc_tests()
88 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
89 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x11), 0); in sshbuf_misc_tests()
90 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x22), 0); in sshbuf_misc_tests()
91 ASSERT_INT_EQ(sshbuf_put_u8(p1, 0x33), 0); in sshbuf_misc_tests()
92 p = sshbuf_dtob64_string(p1, 0); in sshbuf_misc_tests()
96 sshbuf_free(p1); in sshbuf_misc_tests()
100 p1 = sshbuf_new(); in sshbuf_misc_tests()
101 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
102 ASSERT_INT_EQ(sshbuf_reserve(p1, 8192, NULL), 0); in sshbuf_misc_tests()
103 bzero(sshbuf_mutable_ptr(p1), 8192); in sshbuf_misc_tests()
104 p = sshbuf_dtob64_string(p1, 0); in sshbuf_misc_tests()
108 sshbuf_free(p1); in sshbuf_misc_tests()
111 TEST_START("sshbuf_b64tod len 1"); in sshbuf_misc_tests()
112 p1 = sshbuf_new(); in sshbuf_misc_tests()
113 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
114 ASSERT_INT_EQ(sshbuf_b64tod(p1, "0A=="), 0); in sshbuf_misc_tests()
115 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 1); in sshbuf_misc_tests()
116 ASSERT_U8_EQ(*sshbuf_ptr(p1), 0xd0); in sshbuf_misc_tests()
117 sshbuf_free(p1); in sshbuf_misc_tests()
121 p1 = sshbuf_new(); in sshbuf_misc_tests()
122 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
123 ASSERT_INT_EQ(sshbuf_b64tod(p1, "0A8="), 0); in sshbuf_misc_tests()
124 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 2); in sshbuf_misc_tests()
125 ASSERT_U16_EQ(PEEK_U16(sshbuf_ptr(p1)), 0xd00f); in sshbuf_misc_tests()
126 sshbuf_free(p1); in sshbuf_misc_tests()
130 p1 = sshbuf_new(); in sshbuf_misc_tests()
131 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
132 ASSERT_INT_EQ(sshbuf_b64tod(p1, "0A/QDw=="), 0); in sshbuf_misc_tests()
133 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 4); in sshbuf_misc_tests()
134 ASSERT_U32_EQ(PEEK_U32(sshbuf_ptr(p1)), 0xd00fd00f); in sshbuf_misc_tests()
135 sshbuf_free(p1); in sshbuf_misc_tests()
139 p1 = sshbuf_new(); in sshbuf_misc_tests()
140 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
142 p = sshbuf_dup_string(p1); in sshbuf_misc_tests()
147 ASSERT_INT_EQ(sshbuf_put(p1, "quad1", strlen("quad1")), 0); in sshbuf_misc_tests()
148 p = sshbuf_dup_string(p1); in sshbuf_misc_tests()
154 ASSERT_INT_EQ(sshbuf_put(p1, "\0", 1), 0); in sshbuf_misc_tests()
155 p = sshbuf_dup_string(p1); in sshbuf_misc_tests()
161 ASSERT_INT_EQ(sshbuf_put(p1, "quad2", strlen("quad2")), 0); in sshbuf_misc_tests()
162 p = sshbuf_dup_string(p1); in sshbuf_misc_tests()
164 sshbuf_free(p1); in sshbuf_misc_tests()
168 p1 = sshbuf_from(msg, sizeof(msg) - 1); in sshbuf_misc_tests()
169 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
170 ASSERT_INT_EQ(sshbuf_cmp(p1, 0, "i", 1), 0); in sshbuf_misc_tests()
171 ASSERT_INT_EQ(sshbuf_cmp(p1, 0, "j", 1), SSH_ERR_INVALID_FORMAT); in sshbuf_misc_tests()
172 ASSERT_INT_EQ(sshbuf_cmp(p1, 0, "imploring", 9), 0); in sshbuf_misc_tests()
173 ASSERT_INT_EQ(sshbuf_cmp(p1, 0, "implored", 9), SSH_ERR_INVALID_FORMAT); in sshbuf_misc_tests()
174 ASSERT_INT_EQ(sshbuf_cmp(p1, 10, "ping", 4), 0); in sshbuf_misc_tests()
175 ASSERT_INT_EQ(sshbuf_cmp(p1, 10, "ring", 4), SSH_ERR_INVALID_FORMAT); in sshbuf_misc_tests()
176 ASSERT_INT_EQ(sshbuf_cmp(p1, 28, "over", 4), 0); in sshbuf_misc_tests()
177 ASSERT_INT_EQ(sshbuf_cmp(p1, 28, "rove", 4), SSH_ERR_INVALID_FORMAT); in sshbuf_misc_tests()
178 ASSERT_INT_EQ(sshbuf_cmp(p1, 28, "overt", 5), in sshbuf_misc_tests()
180 ASSERT_INT_EQ(sshbuf_cmp(p1, 32, "ping", 4), in sshbuf_misc_tests()
182 ASSERT_INT_EQ(sshbuf_cmp(p1, 1000, "silence", 7), in sshbuf_misc_tests()
184 ASSERT_INT_EQ(sshbuf_cmp(p1, 0, msg, sizeof(msg) - 1), 0); in sshbuf_misc_tests()
188 p1 = sshbuf_from(msg, sizeof(msg) - 1); in sshbuf_misc_tests()
189 ASSERT_PTR_NE(p1, NULL); in sshbuf_misc_tests()
190 ASSERT_INT_EQ(sshbuf_find(p1, 0, "i", 1, &sz), 0); in sshbuf_misc_tests()
192 ASSERT_INT_EQ(sshbuf_find(p1, 0, "j", 1, &sz), SSH_ERR_INVALID_FORMAT); in sshbuf_misc_tests()
193 ASSERT_INT_EQ(sshbuf_find(p1, 0, "imploring", 9, &sz), 0); in sshbuf_misc_tests()
195 ASSERT_INT_EQ(sshbuf_find(p1, 0, "implored", 9, &sz), in sshbuf_misc_tests()
197 ASSERT_INT_EQ(sshbuf_find(p1, 3, "ping", 4, &sz), 0); in sshbuf_misc_tests()
199 ASSERT_INT_EQ(sshbuf_find(p1, 11, "ping", 4, &sz), 0); in sshbuf_misc_tests()
201 ASSERT_INT_EQ(sshbuf_find(p1, 20, "over", 4, &sz), 0); in sshbuf_misc_tests()
203 ASSERT_INT_EQ(sshbuf_find(p1, 28, "over", 4, &sz), 0); in sshbuf_misc_tests()
205 ASSERT_INT_EQ(sshbuf_find(p1, 28, "rove", 4, &sz), in sshbuf_misc_tests()
207 ASSERT_INT_EQ(sshbuf_find(p1, 28, "overt", 5, &sz), in sshbuf_misc_tests()
209 ASSERT_INT_EQ(sshbuf_find(p1, 32, "ping", 4, &sz), in sshbuf_misc_tests()
211 ASSERT_INT_EQ(sshbuf_find(p1, 1000, "silence", 7, &sz), in sshbuf_misc_tests()
213 ASSERT_INT_EQ(sshbuf_find(p1, 0, msg + 1, sizeof(msg) - 2, &sz), 0); in sshbuf_misc_tests()
214 ASSERT_SIZE_T_EQ(sz, 1); in sshbuf_misc_tests()