Coverage Report

Created: 2021-10-21 13:35

/libfido2/fuzz/wrap.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2019-2021 Yubico AB. All rights reserved.
3
 * Use of this source code is governed by a BSD-style
4
 * license that can be found in the LICENSE file.
5
 */
6
7
#include <sys/types.h>
8
#include <sys/socket.h>
9
10
#include <openssl/bn.h>
11
#include <openssl/evp.h>
12
#include <openssl/sha.h>
13
14
#include <cbor.h>
15
#include <stdbool.h>
16
#include <stdint.h>
17
#include <stdio.h>
18
#include <stdlib.h>
19
20
#include "mutator_aux.h"
21
22
extern int prng_up;
23
24
/*
25
 * Build wrappers around functions of interest, and have them fail
26
 * in a pseudo-random manner.
27
 */
28
29
#define WRAP(type, name, args, retval, param, prob)     \
30
extern type __wrap_##name args;                         \
31
extern type __real_##name args;                         \
32
9.38M
type __wrap_##name args {                               \
33
9.38M
        if (prng_up && uniform_random(400) < (prob)) {       \
34
24.0k
                return (retval);                        \
35
24.0k
        }                                                \
36
9.38M
                                                        \
37
9.38M
        return (__real_##name param);                       \
38
9.38M
}
__wrap_malloc
Line
Count
Source
32
489k
type __wrap_##name args {                               \
33
489k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1.52k
                return (retval);                        \
35
1.52k
        }                                                \
36
489k
                                                        \
37
489k
        return (__real_##name param);                       \
38
489k
}
__wrap_calloc
Line
Count
Source
32
5.79M
type __wrap_##name args {                               \
33
5.79M
        if (prng_up && uniform_random(400) < (prob)) {       \
34
14.6k
                return (retval);                        \
35
14.6k
        }                                                \
36
5.79M
                                                        \
37
5.79M
        return (__real_##name param);                       \
38
5.79M
}
__wrap_realloc
Line
Count
Source
32
506
type __wrap_##name args {                               \
33
506
        if (prng_up && uniform_random(400) < (prob)) {       \
34
3
                return (retval);                        \
35
3
        }                                                \
36
506
                                                        \
37
506
        return (__real_##name param);                       \
38
506
}
__wrap_strdup
Line
Count
Source
32
1.34M
type __wrap_##name args {                               \
33
1.34M
        if (prng_up && uniform_random(400) < (prob)) {       \
34
3.42k
                return (retval);                        \
35
3.42k
        }                                                \
36
1.34M
                                                        \
37
1.34M
        return (__real_##name param);                       \
38
1.34M
}
__wrap_EVP_Cipher
Line
Count
Source
32
8.16k
type __wrap_##name args {                               \
33
8.16k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
25
                return (retval);                        \
35
25
        }                                                \
36
8.16k
                                                        \
37
8.16k
        return (__real_##name param);                       \
38
8.16k
}
__wrap_EVP_CIPHER_CTX_ctrl
Line
Count
Source
32
838
type __wrap_##name args {                               \
33
838
        if (prng_up && uniform_random(400) < (prob)) {       \
34
4
                return (retval);                        \
35
4
        }                                                \
36
838
                                                        \
37
838
        return (__real_##name param);                       \
38
838
}
__wrap_EVP_CIPHER_CTX_new
Line
Count
Source
32
6.55k
type __wrap_##name args {                               \
33
6.55k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
24
                return (retval);                        \
35
24
        }                                                \
36
6.55k
                                                        \
37
6.55k
        return (__real_##name param);                       \
38
6.55k
}
__wrap_EVP_CipherInit
Line
Count
Source
32
6.51k
type __wrap_##name args {                               \
33
6.51k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
21
                return (retval);                        \
35
21
        }                                                \
36
6.51k
                                                        \
37
6.51k
        return (__real_##name param);                       \
38
6.51k
}
Unexecuted instantiation: __wrap_EVP_PKEY_get0_RSA
__wrap_EVP_PKEY_get0_EC_KEY
Line
Count
Source
32
7.94k
type __wrap_##name args {                               \
33
7.94k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
30
                return (retval);                        \
35
30
        }                                                \
36
7.94k
                                                        \
37
7.94k
        return (__real_##name param);                       \
38
7.94k
}
__wrap_EVP_PKEY_get_raw_public_key
Line
Count
Source
32
2.55k
type __wrap_##name args {                               \
33
2.55k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
12
                return (retval);                        \
35
12
        }                                                \
36
2.55k
                                                        \
37
2.55k
        return (__real_##name param);                       \
38
2.55k
}
__wrap_EVP_MD_CTX_new
Line
Count
Source
32
407
type __wrap_##name args {                               \
33
407
        if (prng_up && uniform_random(400) < (prob)) {       \
34
11
                return (retval);                        \
35
11
        }                                                \
36
407
                                                        \
37
407
        return (__real_##name param);                       \
38
407
}
__wrap_EVP_DigestVerifyInit
Line
Count
Source
32
81
type __wrap_##name args {                               \
33
81
        if (prng_up && uniform_random(400) < (prob)) {       \
34
2
                return (retval);                        \
35
2
        }                                                \
36
81
                                                        \
37
81
        return (__real_##name param);                       \
38
81
}
__wrap_EVP_DigestInit_ex
Line
Count
Source
32
315
type __wrap_##name args {                               \
33
315
        if (prng_up && uniform_random(400) < (prob)) {       \
34
6
                return (retval);                        \
35
6
        }                                                \
36
315
                                                        \
37
315
        return (__real_##name param);                       \
38
315
}
__wrap_EVP_DigestUpdate
Line
Count
Source
32
830
type __wrap_##name args {                               \
33
830
        if (prng_up && uniform_random(400) < (prob)) {       \
34
22
                return (retval);                        \
35
22
        }                                                \
36
830
                                                        \
37
830
        return (__real_##name param);                       \
38
830
}
__wrap_EVP_DigestFinal_ex
Line
Count
Source
32
287
type __wrap_##name args {                               \
33
287
        if (prng_up && uniform_random(400) < (prob)) {       \
34
6
                return (retval);                        \
35
6
        }                                                \
36
287
                                                        \
37
287
        return (__real_##name param);                       \
38
287
}
__wrap_BN_bin2bn
Line
Count
Source
32
21.5k
type __wrap_##name args {                               \
33
21.5k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
93
                return (retval);                        \
35
93
        }                                                \
36
21.5k
                                                        \
37
21.5k
        return (__real_##name param);                       \
38
21.5k
}
__wrap_BN_bn2bin
Line
Count
Source
32
23.0k
type __wrap_##name args {                               \
33
23.0k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
104
                return (retval);                        \
35
104
        }                                                \
36
23.0k
                                                        \
37
23.0k
        return (__real_##name param);                       \
38
23.0k
}
__wrap_BN_CTX_get
Line
Count
Source
32
28.0k
type __wrap_##name args {                               \
33
28.0k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
110
                return (retval);                        \
35
110
        }                                                \
36
28.0k
                                                        \
37
28.0k
        return (__real_##name param);                       \
38
28.0k
}
__wrap_BN_CTX_new
Line
Count
Source
32
15.9k
type __wrap_##name args {                               \
33
15.9k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
63
                return (retval);                        \
35
63
        }                                                \
36
15.9k
                                                        \
37
15.9k
        return (__real_##name param);                       \
38
15.9k
}
__wrap_BN_new
Line
Count
Source
32
1.10k
type __wrap_##name args {                               \
33
1.10k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
24
                return (retval);                        \
35
24
        }                                                \
36
1.10k
                                                        \
37
1.10k
        return (__real_##name param);                       \
38
1.10k
}
__wrap_RSA_new
Line
Count
Source
32
521
type __wrap_##name args {                               \
33
521
        if (prng_up && uniform_random(400) < (prob)) {       \
34
5
                return (retval);                        \
35
5
        }                                                \
36
521
                                                        \
37
521
        return (__real_##name param);                       \
38
521
}
__wrap_RSA_set0_key
Line
Count
Source
32
516
type __wrap_##name args {                               \
33
516
        if (prng_up && uniform_random(400) < (prob)) {       \
34
11
                return (retval);                        \
35
11
        }                                                \
36
516
                                                        \
37
516
        return (__real_##name param);                       \
38
516
}
__wrap_RSA_pkey_ctx_ctrl
Line
Count
Source
32
129
type __wrap_##name args {                               \
33
129
        if (prng_up && uniform_random(400) < (prob)) {       \
34
3
                return (retval);                        \
35
3
        }                                                \
36
129
                                                        \
37
129
        return (__real_##name param);                       \
38
129
}
__wrap_EC_KEY_new_by_curve_name
Line
Count
Source
32
15.9k
type __wrap_##name args {                               \
33
15.9k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
52
                return (retval);                        \
35
52
        }                                                \
36
15.9k
                                                        \
37
15.9k
        return (__real_##name param);                       \
38
15.9k
}
__wrap_EC_KEY_get0_group
Line
Count
Source
32
19.9k
type __wrap_##name args {                               \
33
19.9k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
87
                return (retval);                        \
35
87
        }                                                \
36
19.9k
                                                        \
37
19.9k
        return (__real_##name param);                       \
38
19.9k
}
__wrap_EC_KEY_get0_private_key
Line
Count
Source
32
7.91k
type __wrap_##name args {                               \
33
7.91k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
28
                return (retval);                        \
35
28
        }                                                \
36
7.91k
                                                        \
37
7.91k
        return (__real_##name param);                       \
38
7.91k
}
__wrap_EC_POINT_new
Line
Count
Source
32
12.1k
type __wrap_##name args {                               \
33
12.1k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
60
                return (retval);                        \
35
60
        }                                                \
36
12.1k
                                                        \
37
12.1k
        return (__real_##name param);                       \
38
12.1k
}
__wrap_EC_POINT_get_affine_coordinates_GFp
Line
Count
Source
32
7.60k
type __wrap_##name args {                               \
33
7.60k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
37
                return (retval);                        \
35
37
        }                                                \
36
7.60k
                                                        \
37
7.60k
        return (__real_##name param);                       \
38
7.60k
}
__wrap_EVP_PKEY_new
Line
Count
Source
32
8.01k
type __wrap_##name args {                               \
33
8.01k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
32
                return (retval);                        \
35
32
        }                                                \
36
8.01k
                                                        \
37
8.01k
        return (__real_##name param);                       \
38
8.01k
}
__wrap_EVP_PKEY_assign
Line
Count
Source
32
7.98k
type __wrap_##name args {                               \
33
7.98k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
29
                return (retval);                        \
35
29
        }                                                \
36
7.98k
                                                        \
37
7.98k
        return (__real_##name param);                       \
38
7.98k
}
__wrap_EVP_PKEY_keygen_init
Line
Count
Source
32
8.00k
type __wrap_##name args {                               \
33
8.00k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
27
                return (retval);                        \
35
27
        }                                                \
36
8.00k
                                                        \
37
8.00k
        return (__real_##name param);                       \
38
8.00k
}
__wrap_EVP_PKEY_keygen
Line
Count
Source
32
7.97k
type __wrap_##name args {                               \
33
7.97k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
32
                return (retval);                        \
35
32
        }                                                \
36
7.97k
                                                        \
37
7.97k
        return (__real_##name param);                       \
38
7.97k
}
__wrap_EVP_PKEY_paramgen_init
Line
Count
Source
32
8.12k
type __wrap_##name args {                               \
33
8.12k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
33
                return (retval);                        \
35
33
        }                                                \
36
8.12k
                                                        \
37
8.12k
        return (__real_##name param);                       \
38
8.12k
}
__wrap_EVP_PKEY_paramgen
Line
Count
Source
32
8.05k
type __wrap_##name args {                               \
33
8.05k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
24
                return (retval);                        \
35
24
        }                                                \
36
8.05k
                                                        \
37
8.05k
        return (__real_##name param);                       \
38
8.05k
}
__wrap_EVP_PKEY_new_raw_public_key
Line
Count
Source
32
1.38k
type __wrap_##name args {                               \
33
1.38k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
10
                return (retval);                        \
35
10
        }                                                \
36
1.38k
                                                        \
37
1.38k
        return (__real_##name param);                       \
38
1.38k
}
__wrap_EVP_PKEY_CTX_new
Line
Count
Source
32
11.9k
type __wrap_##name args {                               \
33
11.9k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
46
                return (retval);                        \
35
46
        }                                                \
36
11.9k
                                                        \
37
11.9k
        return (__real_##name param);                       \
38
11.9k
}
__wrap_EVP_PKEY_CTX_new_id
Line
Count
Source
32
8.92k
type __wrap_##name args {                               \
33
8.92k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
40
                return (retval);                        \
35
40
        }                                                \
36
8.92k
                                                        \
37
8.92k
        return (__real_##name param);                       \
38
8.92k
}
__wrap_EVP_PKEY_derive
Line
Count
Source
32
8.00k
type __wrap_##name args {                               \
33
8.00k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
30
                return (retval);                        \
35
30
        }                                                \
36
8.00k
                                                        \
37
8.00k
        return (__real_##name param);                       \
38
8.00k
}
__wrap_EVP_PKEY_derive_init
Line
Count
Source
32
4.43k
type __wrap_##name args {                               \
33
4.43k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
19
                return (retval);                        \
35
19
        }                                                \
36
4.43k
                                                        \
37
4.43k
        return (__real_##name param);                       \
38
4.43k
}
__wrap_EVP_PKEY_derive_set_peer
Line
Count
Source
32
3.66k
type __wrap_##name args {                               \
33
3.66k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
10
                return (retval);                        \
35
10
        }                                                \
36
3.66k
                                                        \
37
3.66k
        return (__real_##name param);                       \
38
3.66k
}
__wrap_EVP_PKEY_verify_init
Line
Count
Source
32
180
type __wrap_##name args {                               \
33
180
        if (prng_up && uniform_random(400) < (prob)) {       \
34
7
                return (retval);                        \
35
7
        }                                                \
36
180
                                                        \
37
180
        return (__real_##name param);                       \
38
180
}
__wrap_EVP_PKEY_CTX_ctrl
Line
Count
Source
32
11.1k
type __wrap_##name args {                               \
33
11.1k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
83
                return (retval);                        \
35
83
        }                                                \
36
11.1k
                                                        \
37
11.1k
        return (__real_##name param);                       \
38
11.1k
}
__wrap_EVP_sha1
Line
Count
Source
32
38
type __wrap_##name args {                               \
33
38
        if (prng_up && uniform_random(400) < (prob)) {       \
34
2
                return (retval);                        \
35
2
        }                                                \
36
38
                                                        \
37
38
        return (__real_##name param);                       \
38
38
}
__wrap_EVP_sha256
Line
Count
Source
32
3.85k
type __wrap_##name args {                               \
33
3.85k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
33
                return (retval);                        \
35
33
        }                                                \
36
3.85k
                                                        \
37
3.85k
        return (__real_##name param);                       \
38
3.85k
}
__wrap_EVP_aes_256_cbc
Line
Count
Source
32
5.67k
type __wrap_##name args {                               \
33
5.67k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
20
                return (retval);                        \
35
20
        }                                                \
36
5.67k
                                                        \
37
5.67k
        return (__real_##name param);                       \
38
5.67k
}
__wrap_EVP_aes_256_gcm
Line
Count
Source
32
855
type __wrap_##name args {                               \
33
855
        if (prng_up && uniform_random(400) < (prob)) {       \
34
3
                return (retval);                        \
35
3
        }                                                \
36
855
                                                        \
37
855
        return (__real_##name param);                       \
38
855
}
__wrap_HMAC
Line
Count
Source
32
2.59k
type __wrap_##name args {                               \
33
2.59k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
14
                return (retval);                        \
35
14
        }                                                \
36
2.59k
                                                        \
37
2.59k
        return (__real_##name param);                       \
38
2.59k
}
__wrap_HMAC_CTX_new
Line
Count
Source
32
26
type __wrap_##name args {                               \
33
26
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
26
                                                        \
37
26
        return (__real_##name param);                       \
38
26
}
__wrap_HMAC_Init_ex
Line
Count
Source
32
24
type __wrap_##name args {                               \
33
24
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
24
                                                        \
37
24
        return (__real_##name param);                       \
38
24
}
__wrap_HMAC_Update
Line
Count
Source
32
45
type __wrap_##name args {                               \
33
45
        if (prng_up && uniform_random(400) < (prob)) {       \
34
2
                return (retval);                        \
35
2
        }                                                \
36
45
                                                        \
37
45
        return (__real_##name param);                       \
38
45
}
__wrap_HMAC_Final
Line
Count
Source
32
21
type __wrap_##name args {                               \
33
21
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
21
                                                        \
37
21
        return (__real_##name param);                       \
38
21
}
__wrap_SHA1
Line
Count
Source
32
12
type __wrap_##name args {                               \
33
12
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
12
                                                        \
37
12
        return (__real_##name param);                       \
38
12
}
__wrap_SHA256
Line
Count
Source
32
15.1k
type __wrap_##name args {                               \
33
15.1k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
78
                return (retval);                        \
35
78
        }                                                \
36
15.1k
                                                        \
37
15.1k
        return (__real_##name param);                       \
38
15.1k
}
__wrap_cbor_build_string
Line
Count
Source
32
165k
type __wrap_##name args {                               \
33
165k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
143
                return (retval);                        \
35
143
        }                                                \
36
165k
                                                        \
37
165k
        return (__real_##name param);                       \
38
165k
}
__wrap_cbor_build_bytestring
Line
Count
Source
32
60.2k
type __wrap_##name args {                               \
33
60.2k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
103
                return (retval);                        \
35
103
        }                                                \
36
60.2k
                                                        \
37
60.2k
        return (__real_##name param);                       \
38
60.2k
}
__wrap_cbor_build_bool
Line
Count
Source
32
2.99k
type __wrap_##name args {                               \
33
2.99k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
6
                return (retval);                        \
35
6
        }                                                \
36
2.99k
                                                        \
37
2.99k
        return (__real_##name param);                       \
38
2.99k
}
__wrap_cbor_build_negint8
Line
Count
Source
32
13.9k
type __wrap_##name args {                               \
33
13.9k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
56
                return (retval);                        \
35
56
        }                                                \
36
13.9k
                                                        \
37
13.9k
        return (__real_##name param);                       \
38
13.9k
}
__wrap_cbor_build_negint16
Line
Count
Source
32
325
type __wrap_##name args {                               \
33
325
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
325
                                                        \
37
325
        return (__real_##name param);                       \
38
325
}
__wrap_cbor_load
Line
Count
Source
32
29.1k
type __wrap_##name args {                               \
33
29.1k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
78
                return (retval);                        \
35
78
        }                                                \
36
29.1k
                                                        \
37
29.1k
        return (__real_##name param);                       \
38
29.1k
}
__wrap_cbor_build_uint8
Line
Count
Source
32
103k
type __wrap_##name args {                               \
33
103k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
302
                return (retval);                        \
35
302
        }                                                \
36
103k
                                                        \
37
103k
        return (__real_##name param);                       \
38
103k
}
__wrap_cbor_build_uint16
Line
Count
Source
32
815
type __wrap_##name args {                               \
33
815
        if (prng_up && uniform_random(400) < (prob)) {       \
34
3
                return (retval);                        \
35
3
        }                                                \
36
815
                                                        \
37
815
        return (__real_##name param);                       \
38
815
}
__wrap_cbor_build_uint32
Line
Count
Source
32
464
type __wrap_##name args {                               \
33
464
        if (prng_up && uniform_random(400) < (prob)) {       \
34
4
                return (retval);                        \
35
4
        }                                                \
36
464
                                                        \
37
464
        return (__real_##name param);                       \
38
464
}
Unexecuted instantiation: __wrap_cbor_build_uint64
__wrap_cbor_map_handle
Line
Count
Source
32
55.4k
type __wrap_##name args {                               \
33
55.4k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
86
                return (retval);                        \
35
86
        }                                                \
36
55.4k
                                                        \
37
55.4k
        return (__real_##name param);                       \
38
55.4k
}
__wrap_cbor_array_handle
Line
Count
Source
32
34.0k
type __wrap_##name args {                               \
33
34.0k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
28
                return (retval);                        \
35
28
        }                                                \
36
34.0k
                                                        \
37
34.0k
        return (__real_##name param);                       \
38
34.0k
}
__wrap_cbor_array_push
Line
Count
Source
32
62.1k
type __wrap_##name args {                               \
33
62.1k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
69
                return (retval);                        \
35
69
        }                                                \
36
62.1k
                                                        \
37
62.1k
        return (__real_##name param);                       \
38
62.1k
}
__wrap_cbor_map_add
Line
Count
Source
32
165k
type __wrap_##name args {                               \
33
165k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
253
                return (retval);                        \
35
253
        }                                                \
36
165k
                                                        \
37
165k
        return (__real_##name param);                       \
38
165k
}
__wrap_cbor_new_definite_map
Line
Count
Source
32
73.4k
type __wrap_##name args {                               \
33
73.4k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
116
                return (retval);                        \
35
116
        }                                                \
36
73.4k
                                                        \
37
73.4k
        return (__real_##name param);                       \
38
73.4k
}
__wrap_cbor_new_definite_array
Line
Count
Source
32
4.06k
type __wrap_##name args {                               \
33
4.06k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
14
                return (retval);                        \
35
14
        }                                                \
36
4.06k
                                                        \
37
4.06k
        return (__real_##name param);                       \
38
4.06k
}
__wrap_cbor_new_definite_bytestring
Line
Count
Source
32
124
type __wrap_##name args {                               \
33
124
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
124
                                                        \
37
124
        return (__real_##name param);                       \
38
124
}
__wrap_cbor_serialize_alloc
Line
Count
Source
32
23.7k
type __wrap_##name args {                               \
33
23.7k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
74
                return (retval);                        \
35
74
        }                                                \
36
23.7k
                                                        \
37
23.7k
        return (__real_##name param);                       \
38
23.7k
}
__wrap_fido_tx
Line
Count
Source
32
111k
type __wrap_##name args {                               \
33
111k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
351
                return (retval);                        \
35
351
        }                                                \
36
111k
                                                        \
37
111k
        return (__real_##name param);                       \
38
111k
}
__wrap_bind
Line
Count
Source
32
537k
type __wrap_##name args {                               \
33
537k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1.37k
                return (retval);                        \
35
1.37k
        }                                                \
36
537k
                                                        \
37
537k
        return (__real_##name param);                       \
38
537k
}
39
40
WRAP(void *,
41
        malloc,
42
        (size_t size),
43
        NULL,
44
        (size),
45
        1
46
)
47
48
WRAP(void *,
49
        calloc,
50
        (size_t nmemb, size_t size),
51
        NULL,
52
        (nmemb, size),
53
        1
54
)
55
56
WRAP(void *,
57
        realloc,
58
        (void *ptr, size_t size),
59
        NULL,
60
        (ptr, size),
61
        1
62
)
63
64
WRAP(char *,
65
        strdup,
66
        (const char *s),
67
        NULL,
68
        (s),
69
        1
70
)
71
72
WRAP(int,
73
        EVP_Cipher,
74
        (EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in,
75
            unsigned int inl),
76
        -1,
77
        (ctx, out, in, inl),
78
        1
79
)
80
81
WRAP(int,
82
        EVP_CIPHER_CTX_ctrl,
83
        (EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr),
84
        0,
85
        (ctx, type, arg, ptr),
86
        1
87
)
88
89
WRAP(EVP_CIPHER_CTX *,
90
        EVP_CIPHER_CTX_new,
91
        (void),
92
        NULL,
93
        (),
94
        1
95
)
96
97
WRAP(int,
98
        EVP_CipherInit,
99
        (EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
100
            const unsigned char *key, const unsigned char *iv, int enc),
101
        0,
102
        (ctx, cipher, key, iv, enc),
103
        1
104
)
105
106
WRAP(RSA *,
107
        EVP_PKEY_get0_RSA,
108
        (EVP_PKEY *pkey),
109
        NULL,
110
        (pkey),
111
        1
112
)
113
114
WRAP(EC_KEY *,
115
        EVP_PKEY_get0_EC_KEY,
116
        (EVP_PKEY *pkey),
117
        NULL,
118
        (pkey),
119
        1
120
)
121
122
WRAP(int,
123
        EVP_PKEY_get_raw_public_key,
124
        (const EVP_PKEY *pkey, unsigned char *pub, size_t *len),
125
        0,
126
        (pkey, pub, len),
127
        1
128
)
129
130
WRAP(EVP_MD_CTX *,
131
        EVP_MD_CTX_new,
132
        (void),
133
        NULL,
134
        (),
135
        1
136
)
137
138
WRAP(int,
139
        EVP_DigestVerifyInit,
140
        (EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e,
141
            EVP_PKEY *pkey),
142
        0,
143
        (ctx, pctx, type, e, pkey),
144
        1
145
)
146
147
WRAP(int,
148
        EVP_DigestInit_ex,
149
        (EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl),
150
        0,
151
        (ctx, type, impl),
152
        1
153
)
154
155
WRAP(int,
156
        EVP_DigestUpdate,
157
        (EVP_MD_CTX *ctx, const void *data, size_t count),
158
        0,
159
        (ctx, data, count),
160
        1
161
)
162
163
WRAP(int,
164
        EVP_DigestFinal_ex,
165
        (EVP_MD_CTX *ctx, unsigned char *md, unsigned int *isize),
166
        0,
167
        (ctx, md, isize),
168
        1
169
)
170
171
WRAP(BIGNUM *,
172
        BN_bin2bn,
173
        (const unsigned char *s, int len, BIGNUM *ret),
174
        NULL,
175
        (s, len, ret),
176
        1
177
)
178
179
WRAP(int,
180
        BN_bn2bin,
181
        (const BIGNUM *a, unsigned char *to),
182
        -1,
183
        (a, to),
184
        1
185
)
186
187
WRAP(BIGNUM *,
188
        BN_CTX_get,
189
        (BN_CTX *ctx),
190
        NULL,
191
        (ctx),
192
        1
193
)
194
195
WRAP(BN_CTX *,
196
        BN_CTX_new,
197
        (void),
198
        NULL,
199
        (),
200
        1
201
)
202
203
WRAP(BIGNUM *,
204
        BN_new,
205
        (void),
206
        NULL,
207
        (),
208
        1
209
)
210
211
WRAP(RSA *,
212
        RSA_new,
213
        (void),
214
        NULL,
215
        (),
216
        1
217
)
218
219
WRAP(int,
220
        RSA_set0_key,
221
        (RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d),
222
        0,
223
        (r, n, e, d),
224
        1
225
)
226
227
WRAP(int,
228
        RSA_pkey_ctx_ctrl,
229
        (EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2),
230
        -1,
231
        (ctx, optype, cmd, p1, p2),
232
        1
233
)
234
235
WRAP(EC_KEY *,
236
        EC_KEY_new_by_curve_name,
237
        (int nid),
238
        NULL,
239
        (nid),
240
        1
241
)
242
243
WRAP(const EC_GROUP *,
244
        EC_KEY_get0_group,
245
        (const EC_KEY *key),
246
        NULL,
247
        (key),
248
        1
249
)
250
251
WRAP(const BIGNUM *,
252
        EC_KEY_get0_private_key,
253
        (const EC_KEY *key),
254
        NULL,
255
        (key),
256
        1
257
)
258
259
WRAP(EC_POINT *,
260
        EC_POINT_new,
261
        (const EC_GROUP *group),
262
        NULL,
263
        (group),
264
        1
265
)
266
267
WRAP(int,
268
        EC_POINT_get_affine_coordinates_GFp,
269
        (const EC_GROUP *group, const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx),
270
        0,
271
        (group, p, x, y, ctx),
272
        1
273
)
274
275
WRAP(EVP_PKEY *,
276
        EVP_PKEY_new,
277
        (void),
278
        NULL,
279
        (),
280
        1
281
)
282
283
WRAP(int,
284
        EVP_PKEY_assign,
285
        (EVP_PKEY *pkey, int type, void *key),
286
        0,
287
        (pkey, type, key),
288
        1
289
)
290
291
WRAP(int,
292
        EVP_PKEY_keygen_init,
293
        (EVP_PKEY_CTX *ctx),
294
        0,
295
        (ctx),
296
        1
297
)
298
299
WRAP(int,
300
        EVP_PKEY_keygen,
301
        (EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey),
302
        0,
303
        (ctx, ppkey),
304
        1
305
)
306
307
WRAP(int,
308
        EVP_PKEY_paramgen_init,
309
        (EVP_PKEY_CTX *ctx),
310
        0,
311
        (ctx),
312
        1
313
)
314
315
WRAP(int,
316
        EVP_PKEY_paramgen,
317
        (EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey),
318
        0,
319
        (ctx, ppkey),
320
        1
321
)
322
323
WRAP(EVP_PKEY *,
324
        EVP_PKEY_new_raw_public_key,
325
        (int type, ENGINE *e, const unsigned char *key, size_t keylen),
326
        NULL,
327
        (type, e, key, keylen),
328
        1
329
)
330
331
WRAP(EVP_PKEY_CTX *,
332
        EVP_PKEY_CTX_new,
333
        (EVP_PKEY *pkey, ENGINE *e),
334
        NULL,
335
        (pkey, e),
336
        1
337
)
338
339
WRAP(EVP_PKEY_CTX *,
340
        EVP_PKEY_CTX_new_id,
341
        (int id, ENGINE *e),
342
        NULL,
343
        (id, e),
344
        1
345
)
346
347
WRAP(int,
348
        EVP_PKEY_derive,
349
        (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *pkeylen),
350
        0,
351
        (ctx, key, pkeylen),
352
        1
353
)
354
355
WRAP(int,
356
        EVP_PKEY_derive_init,
357
        (EVP_PKEY_CTX *ctx),
358
        0,
359
        (ctx),
360
        1
361
)
362
363
WRAP(int,
364
        EVP_PKEY_derive_set_peer,
365
        (EVP_PKEY_CTX *ctx, EVP_PKEY *peer),
366
        0,
367
        (ctx, peer),
368
        1
369
)
370
371
WRAP(int,
372
        EVP_PKEY_verify_init,
373
        (EVP_PKEY_CTX *ctx),
374
        0,
375
        (ctx),
376
        1
377
)
378
379
WRAP(int,
380
        EVP_PKEY_CTX_ctrl,
381
        (EVP_PKEY_CTX *ctx, int keytype, int optype, int cmd, int p1, void *p2),
382
        -1,
383
        (ctx, keytype, optype, cmd, p1, p2),
384
        1
385
)
386
387
WRAP(const EVP_MD *,
388
        EVP_sha1,
389
        (void),
390
        NULL,
391
        (),
392
        1
393
)
394
395
WRAP(const EVP_MD *,
396
        EVP_sha256,
397
        (void),
398
        NULL,
399
        (),
400
        1
401
)
402
403
WRAP(const EVP_CIPHER *,
404
        EVP_aes_256_cbc,
405
        (void),
406
        NULL,
407
        (),
408
        1
409
)
410
411
WRAP(const EVP_CIPHER *,
412
        EVP_aes_256_gcm,
413
        (void),
414
        NULL,
415
        (),
416
        1
417
)
418
419
WRAP(unsigned char *,
420
        HMAC,
421
        (const EVP_MD *evp_md, const void *key, int key_len,
422
            const unsigned char *d, int n, unsigned char *md,
423
            unsigned int *md_len),
424
        NULL,
425
        (evp_md, key, key_len, d, n, md, md_len),
426
        1
427
)
428
429
WRAP(HMAC_CTX *,
430
        HMAC_CTX_new,
431
        (void),
432
        NULL,
433
        (),
434
        1
435
)
436
437
WRAP(int,
438
        HMAC_Init_ex,
439
        (HMAC_CTX *ctx, const void *key, int key_len, const EVP_MD *md,
440
            ENGINE *impl),
441
        0,
442
        (ctx, key, key_len, md, impl),
443
        1
444
)
445
446
WRAP(int,
447
        HMAC_Update,
448
        (HMAC_CTX *ctx, const unsigned char *data, int len),
449
        0,
450
        (ctx, data, len),
451
        1
452
)
453
454
WRAP(int,
455
        HMAC_Final,
456
        (HMAC_CTX *ctx, unsigned char *md, unsigned int *len),
457
        0,
458
        (ctx, md, len),
459
        1
460
)
461
462
WRAP(unsigned char *,
463
        SHA1,
464
        (const unsigned char *d, size_t n, unsigned char *md),
465
        NULL,
466
        (d, n, md),
467
        1
468
)
469
470
WRAP(unsigned char *,
471
        SHA256,
472
        (const unsigned char *d, size_t n, unsigned char *md),
473
        NULL,
474
        (d, n, md),
475
        1
476
)
477
478
WRAP(cbor_item_t *,
479
        cbor_build_string,
480
        (const char *val),
481
        NULL,
482
        (val),
483
        1
484
)
485
486
WRAP(cbor_item_t *,
487
        cbor_build_bytestring,
488
        (cbor_data handle, size_t length),
489
        NULL,
490
        (handle, length),
491
        1
492
)
493
494
WRAP(cbor_item_t *,
495
        cbor_build_bool,
496
        (bool value),
497
        NULL,
498
        (value),
499
        1
500
)
501
502
WRAP(cbor_item_t *,
503
        cbor_build_negint8,
504
        (uint8_t value),
505
        NULL,
506
        (value),
507
        1
508
)
509
510
WRAP(cbor_item_t *,
511
        cbor_build_negint16,
512
        (uint16_t value),
513
        NULL,
514
        (value),
515
        1
516
)
517
518
WRAP(cbor_item_t *,
519
        cbor_load,
520
        (cbor_data source, size_t source_size, struct cbor_load_result *result),
521
        NULL,
522
        (source, source_size, result),
523
        1
524
)
525
526
WRAP(cbor_item_t *,
527
        cbor_build_uint8,
528
        (uint8_t value),
529
        NULL,
530
        (value),
531
        1
532
)
533
534
WRAP(cbor_item_t *,
535
        cbor_build_uint16,
536
        (uint16_t value),
537
        NULL,
538
        (value),
539
        1
540
)
541
542
WRAP(cbor_item_t *,
543
        cbor_build_uint32,
544
        (uint32_t value),
545
        NULL,
546
        (value),
547
        1
548
)
549
550
WRAP(cbor_item_t *,
551
        cbor_build_uint64,
552
        (uint64_t value),
553
        NULL,
554
        (value),
555
        1
556
)
557
558
WRAP(struct cbor_pair *,
559
        cbor_map_handle,
560
        (const cbor_item_t *item),
561
        NULL,
562
        (item),
563
        1
564
)
565
566
WRAP(cbor_item_t **,
567
        cbor_array_handle,
568
        (const cbor_item_t *item),
569
        NULL,
570
        (item),
571
        1
572
)
573
574
WRAP(bool,
575
        cbor_array_push,
576
        (cbor_item_t *array, cbor_item_t *pushee),
577
        false,
578
        (array, pushee),
579
        1
580
)
581
582
WRAP(bool,
583
        cbor_map_add,
584
        (cbor_item_t *item, struct cbor_pair pair),
585
        false,
586
        (item, pair),
587
        1
588
)
589
590
WRAP(cbor_item_t *,
591
        cbor_new_definite_map,
592
        (size_t size),
593
        NULL,
594
        (size),
595
        1
596
)
597
598
WRAP(cbor_item_t *,
599
        cbor_new_definite_array,
600
        (size_t size),
601
        NULL,
602
        (size),
603
        1
604
)
605
606
WRAP(cbor_item_t *,
607
        cbor_new_definite_bytestring,
608
        (void),
609
        NULL,
610
        (),
611
        1
612
)
613
614
WRAP(size_t,
615
        cbor_serialize_alloc,
616
        (const cbor_item_t *item, cbor_mutable_data *buffer,
617
            size_t *buffer_size),
618
        0,
619
        (item, buffer, buffer_size),
620
        1
621
)
622
623
WRAP(int,
624
        fido_tx,
625
        (fido_dev_t *d, uint8_t cmd, const void *buf, size_t count, int *ms),
626
        -1,
627
        (d, cmd, buf, count, ms),
628
        1
629
)
630
631
WRAP(int,
632
        bind,
633
        (int sockfd, const struct sockaddr *addr, socklen_t addrlen),
634
        -1,
635
        (sockfd, addr, addrlen),
636
        1
637
)