Home | History | Annotate | Download | only in test

Lines Matching refs:bio

12 #include <openssl/bio.h>
21 BIO *bio;
23 static const char str[] = "BIO test\n";
26 bio = BIO_new(BIO_s_mem());
27 if (!TEST_ptr(bio))
32 BIO_set_mem_buf(bio, &bufmem, BIO_NOCLOSE);
33 BIO_set_flags(bio, BIO_FLAGS_MEM_RDONLY);
34 if (!TEST_int_eq(BIO_read(bio, buf, sizeof(buf)), sizeof(str)))
41 BIO_free(bio);
48 BIO *bio = NULL;
51 bio = BIO_new(BIO_s_mem());
52 if (!TEST_ptr(bio))
54 if (!TEST_int_eq(BIO_puts(bio, "Hello World\n"), 12))
56 BIO_get_mem_ptr(bio, &bufmem);
59 if (!TEST_int_gt(BIO_set_close(bio, BIO_NOCLOSE), 0))
61 BIO_free(bio);
62 bio = NULL;
68 BIO_free(bio);
76 BIO *bio;
80 bio = BIO_new_mem_buf("Hello World\n", 12);
81 if (!TEST_ptr(bio))
83 if (!TEST_int_eq(BIO_read(bio, data, 5), 5))
87 if (!TEST_int_gt(BIO_get_mem_ptr(bio, &bufmem), 0))
89 if (!TEST_int_lt(BIO_write(bio, "test", 4), 0))
91 if (!TEST_int_eq(BIO_read(bio, data, 16), 7))
95 if (!TEST_int_gt(BIO_reset(bio), 0))
97 if (!TEST_int_eq(BIO_read(bio, data, 16), 12))
104 BIO_free(bio);
111 BIO *bio, *bio2 = NULL;
115 bio = BIO_new_mem_buf("Hello World\n", 12);
116 if (!TEST_ptr(bio))
118 if (!TEST_int_eq(BIO_read(bio, data, 5), 5))
122 if (!TEST_int_gt(BIO_get_mem_ptr(bio, &bufmem), 0))
124 (void)BIO_set_close(bio, BIO_NOCLOSE);
145 BIO_free(bio);
153 BIO *bio = NULL;
156 bio = BIO_new(BIO_s_mem());
157 if (!TEST_ptr(bio))
159 if (!TEST_int_eq(BIO_puts(bio, "Hello World\n"), 12))
162 BIO_set_flags(bio, BIO_FLAGS_MEM_RDONLY);
163 if (!TEST_int_eq(BIO_read(bio, data, 16), 12))
167 if (!TEST_int_gt(BIO_reset(bio), 0))
170 BIO_clear_flags(bio, BIO_FLAGS_MEM_RDONLY);
171 if (!TEST_int_eq(BIO_puts(bio, "Hi!\n"), 4))
173 if (!TEST_int_eq(BIO_read(bio, data, 16), 16))
182 BIO_free(bio);
189 BIO *bio = NULL;
192 bio = BIO_new(BIO_s_mem());
193 if (!TEST_ptr(bio))
195 if (!TEST_int_eq(BIO_puts(bio, "Hello World\n"), 12))
198 BIO_set_flags(bio, BIO_FLAGS_NONCLEAR_RST);
200 if (!TEST_int_eq(BIO_read(bio, data, 16), 12))
204 if (!TEST_int_gt(BIO_reset(bio), 0))
207 if (!TEST_int_eq(BIO_read(bio, data, 16), 12))
212 BIO_clear_flags(bio, BIO_FLAGS_NONCLEAR_RST);
213 if (!TEST_int_gt(BIO_reset(bio), 0))
216 if (!TEST_int_lt(BIO_read(bio, data, 16), 1))
222 BIO_free(bio);
227 static long BIO_error_callback(BIO *bio, int cmd, const char *argp,
233 ret = 0; /* fail for read operations to simulate error in input BIO */
238 /* Checks i2d_ASN1_bio_stream() is freeing all memory when input BIO ends unexpectedly. */
242 BIO *bio = NULL, *out = NULL;
244 static const char str[] = "BIO mime test\n";
247 if (!TEST_ptr(bio = BIO_new(BIO_s_mem())))
253 BIO_set_mem_buf(bio, &bufmem, BIO_NOCLOSE);
254 BIO_set_flags(bio, BIO_FLAGS_MEM_RDONLY);
255 BIO_set_callback_ex(bio, BIO_error_callback);
270 if (!TEST_true(i2d_ASN1_bio_stream(out, (ASN1_VALUE*) p7, bio,
281 BIO_free(bio);