summaryrefslogtreecommitdiff
path: root/fuzz/wrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/wrap.c')
-rw-r--r--fuzz/wrap.c132
1 files changed, 131 insertions, 1 deletions
diff --git a/fuzz/wrap.c b/fuzz/wrap.c
index 8ff7ee7..c030231 100644
--- a/fuzz/wrap.c
+++ b/fuzz/wrap.c
@@ -18,6 +18,8 @@
18 18
19#include "mutator_aux.h" 19#include "mutator_aux.h"
20 20
21extern int prng_up;
22
21/* 23/*
22 * Build wrappers around functions of interest, and have them fail 24 * Build wrappers around functions of interest, and have them fail
23 * in a pseudo-random manner. 25 * in a pseudo-random manner.
@@ -27,7 +29,7 @@
27extern type __wrap_##name args; \ 29extern type __wrap_##name args; \
28extern type __real_##name args; \ 30extern type __real_##name args; \
29type __wrap_##name args { \ 31type __wrap_##name args { \
30 if (uniform_random(400) < (prob)) { \ 32 if (prng_up && uniform_random(400) < (prob)) { \
31 return (retval); \ 33 return (retval); \
32 } \ 34 } \
33 \ 35 \
@@ -141,6 +143,22 @@ WRAP(RSA *,
141 1 143 1
142) 144)
143 145
146WRAP(EC_KEY *,
147 EVP_PKEY_get0_EC_KEY,
148 (EVP_PKEY *pkey),
149 NULL,
150 (pkey),
151 1
152)
153
154WRAP(int,
155 EVP_PKEY_get_raw_public_key,
156 (const EVP_PKEY *pkey, unsigned char *pub, size_t *len),
157 0,
158 (pkey, pub, len),
159 1
160)
161
144WRAP(EVP_MD_CTX *, 162WRAP(EVP_MD_CTX *,
145 EVP_MD_CTX_new, 163 EVP_MD_CTX_new,
146 (void), 164 (void),
@@ -166,6 +184,14 @@ WRAP(BIGNUM *,
166 1 184 1
167) 185)
168 186
187WRAP(int,
188 BN_bn2bin,
189 (const BIGNUM *a, unsigned char *to),
190 -1,
191 (a, to),
192 1
193)
194
169WRAP(BIGNUM *, 195WRAP(BIGNUM *,
170 BN_CTX_get, 196 BN_CTX_get,
171 (BN_CTX *ctx), 197 (BN_CTX *ctx),
@@ -214,6 +240,14 @@ WRAP(const EC_GROUP *,
214 1 240 1
215) 241)
216 242
243WRAP(const BIGNUM *,
244 EC_KEY_get0_private_key,
245 (const EC_KEY *key),
246 NULL,
247 (key),
248 1
249)
250
217WRAP(EC_POINT *, 251WRAP(EC_POINT *,
218 EC_POINT_new, 252 EC_POINT_new,
219 (const EC_GROUP *group), 253 (const EC_GROUP *group),
@@ -222,6 +256,14 @@ WRAP(EC_POINT *,
222 1 256 1
223) 257)
224 258
259WRAP(int,
260 EC_POINT_get_affine_coordinates_GFp,
261 (const EC_GROUP *group, const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx),
262 0,
263 (group, p, x, y, ctx),
264 1
265)
266
225WRAP(EVP_PKEY *, 267WRAP(EVP_PKEY *,
226 EVP_PKEY_new, 268 EVP_PKEY_new,
227 (void), 269 (void),
@@ -238,6 +280,38 @@ WRAP(int,
238 1 280 1
239) 281)
240 282
283WRAP(int,
284 EVP_PKEY_keygen_init,
285 (EVP_PKEY_CTX *ctx),
286 0,
287 (ctx),
288 1
289)
290
291WRAP(int,
292 EVP_PKEY_keygen,
293 (EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey),
294 0,
295 (ctx, ppkey),
296 1
297)
298
299WRAP(int,
300 EVP_PKEY_paramgen_init,
301 (EVP_PKEY_CTX *ctx),
302 0,
303 (ctx),
304 1
305)
306
307WRAP(int,
308 EVP_PKEY_paramgen,
309 (EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey),
310 0,
311 (ctx, ppkey),
312 1
313)
314
241WRAP(EVP_PKEY *, 315WRAP(EVP_PKEY *,
242 EVP_PKEY_new_raw_public_key, 316 EVP_PKEY_new_raw_public_key,
243 (int type, ENGINE *e, const unsigned char *key, size_t keylen), 317 (int type, ENGINE *e, const unsigned char *key, size_t keylen),
@@ -254,6 +328,14 @@ WRAP(EVP_PKEY_CTX *,
254 1 328 1
255) 329)
256 330
331WRAP(EVP_PKEY_CTX *,
332 EVP_PKEY_CTX_new_id,
333 (int id, ENGINE *e),
334 NULL,
335 (id, e),
336 1
337)
338
257WRAP(int, 339WRAP(int,
258 EVP_PKEY_derive_init, 340 EVP_PKEY_derive_init,
259 (EVP_PKEY_CTX *ctx), 341 (EVP_PKEY_CTX *ctx),
@@ -346,6 +428,30 @@ WRAP(cbor_item_t *,
346) 428)
347 429
348WRAP(cbor_item_t *, 430WRAP(cbor_item_t *,
431 cbor_build_bool,
432 (bool value),
433 NULL,
434 (value),
435 1
436)
437
438WRAP(cbor_item_t *,
439 cbor_build_negint8,
440 (uint8_t value),
441 NULL,
442 (value),
443 1
444)
445
446WRAP(cbor_item_t *,
447 cbor_build_negint16,
448 (uint16_t value),
449 NULL,
450 (value),
451 1
452)
453
454WRAP(cbor_item_t *,
349 cbor_load, 455 cbor_load,
350 (cbor_data source, size_t source_size, struct cbor_load_result *result), 456 (cbor_data source, size_t source_size, struct cbor_load_result *result),
351 NULL, 457 NULL,
@@ -361,6 +467,14 @@ WRAP(cbor_item_t *,
361 1 467 1
362) 468)
363 469
470WRAP(cbor_item_t *,
471 cbor_build_uint32,
472 (uint32_t value),
473 NULL,
474 (value),
475 1
476)
477
364WRAP(struct cbor_pair *, 478WRAP(struct cbor_pair *,
365 cbor_map_handle, 479 cbor_map_handle,
366 (const cbor_item_t *item), 480 (const cbor_item_t *item),
@@ -378,6 +492,14 @@ WRAP(cbor_item_t **,
378) 492)
379 493
380WRAP(bool, 494WRAP(bool,
495 cbor_array_push,
496 (cbor_item_t *array, cbor_item_t *pushee),
497 false,
498 (array, pushee),
499 1
500)
501
502WRAP(bool,
381 cbor_map_add, 503 cbor_map_add,
382 (cbor_item_t *item, struct cbor_pair pair), 504 (cbor_item_t *item, struct cbor_pair pair),
383 false, 505 false,
@@ -393,6 +515,14 @@ WRAP(cbor_item_t *,
393 1 515 1
394) 516)
395 517
518WRAP(cbor_item_t *,
519 cbor_new_definite_array,
520 (size_t size),
521 NULL,
522 (size),
523 1
524)
525
396WRAP(size_t, 526WRAP(size_t,
397 cbor_serialize_alloc, 527 cbor_serialize_alloc,
398 (const cbor_item_t *item, cbor_mutable_data *buffer, 528 (const cbor_item_t *item, cbor_mutable_data *buffer,