Coverage Report

Created: 2022-01-17 10:46

/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.85M
type __wrap_##name args {                               \
33
9.85M
        if (prng_up && uniform_random(400) < (prob)) {       \
34
25.5k
                return (retval);                        \
35
25.5k
        }                                                \
36
9.85M
                                                        \
37
9.85M
        return (__real_##name param);                       \
38
9.85M
}
__wrap_malloc
Line
Count
Source
32
520k
type __wrap_##name args {                               \
33
520k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1.58k
                return (retval);                        \
35
1.58k
        }                                                \
36
520k
                                                        \
37
520k
        return (__real_##name param);                       \
38
520k
}
__wrap_calloc
Line
Count
Source
32
6.06M
type __wrap_##name args {                               \
33
6.06M
        if (prng_up && uniform_random(400) < (prob)) {       \
34
15.4k
                return (retval);                        \
35
15.4k
        }                                                \
36
6.06M
                                                        \
37
6.06M
        return (__real_##name param);                       \
38
6.06M
}
__wrap_realloc
Line
Count
Source
32
625
type __wrap_##name args {                               \
33
625
        if (prng_up && uniform_random(400) < (prob)) {       \
34
4
                return (retval);                        \
35
4
        }                                                \
36
625
                                                        \
37
625
        return (__real_##name param);                       \
38
625
}
__wrap_strdup
Line
Count
Source
32
1.38M
type __wrap_##name args {                               \
33
1.38M
        if (prng_up && uniform_random(400) < (prob)) {       \
34
3.55k
                return (retval);                        \
35
3.55k
        }                                                \
36
1.38M
                                                        \
37
1.38M
        return (__real_##name param);                       \
38
1.38M
}
__wrap_EVP_Cipher
Line
Count
Source
32
8.78k
type __wrap_##name args {                               \
33
8.78k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
25
                return (retval);                        \
35
25
        }                                                \
36
8.78k
                                                        \
37
8.78k
        return (__real_##name param);                       \
38
8.78k
}
__wrap_EVP_CIPHER_CTX_ctrl
Line
Count
Source
32
863
type __wrap_##name args {                               \
33
863
        if (prng_up && uniform_random(400) < (prob)) {       \
34
7
                return (retval);                        \
35
7
        }                                                \
36
863
                                                        \
37
863
        return (__real_##name param);                       \
38
863
}
__wrap_EVP_CIPHER_CTX_new
Line
Count
Source
32
7.14k
type __wrap_##name args {                               \
33
7.14k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
27
                return (retval);                        \
35
27
        }                                                \
36
7.14k
                                                        \
37
7.14k
        return (__real_##name param);                       \
38
7.14k
}
__wrap_EVP_CipherInit
Line
Count
Source
32
7.09k
type __wrap_##name args {                               \
33
7.09k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
22
                return (retval);                        \
35
22
        }                                                \
36
7.09k
                                                        \
37
7.09k
        return (__real_##name param);                       \
38
7.09k
}
Unexecuted instantiation: __wrap_EVP_PKEY_get0_RSA
__wrap_EVP_PKEY_get0_EC_KEY
Line
Count
Source
32
8.70k
type __wrap_##name args {                               \
33
8.70k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
35
                return (retval);                        \
35
35
        }                                                \
36
8.70k
                                                        \
37
8.70k
        return (__real_##name param);                       \
38
8.70k
}
__wrap_EVP_PKEY_get_raw_public_key
Line
Count
Source
32
2.72k
type __wrap_##name args {                               \
33
2.72k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
12
                return (retval);                        \
35
12
        }                                                \
36
2.72k
                                                        \
37
2.72k
        return (__real_##name param);                       \
38
2.72k
}
__wrap_EVP_MD_CTX_new
Line
Count
Source
32
435
type __wrap_##name args {                               \
33
435
        if (prng_up && uniform_random(400) < (prob)) {       \
34
11
                return (retval);                        \
35
11
        }                                                \
36
435
                                                        \
37
435
        return (__real_##name param);                       \
38
435
}
__wrap_EVP_DigestVerifyInit
Line
Count
Source
32
89
type __wrap_##name args {                               \
33
89
        if (prng_up && uniform_random(400) < (prob)) {       \
34
4
                return (retval);                        \
35
4
        }                                                \
36
89
                                                        \
37
89
        return (__real_##name param);                       \
38
89
}
__wrap_EVP_DigestInit_ex
Line
Count
Source
32
335
type __wrap_##name args {                               \
33
335
        if (prng_up && uniform_random(400) < (prob)) {       \
34
9
                return (retval);                        \
35
9
        }                                                \
36
335
                                                        \
37
335
        return (__real_##name param);                       \
38
335
}
__wrap_EVP_DigestUpdate
Line
Count
Source
32
883
type __wrap_##name args {                               \
33
883
        if (prng_up && uniform_random(400) < (prob)) {       \
34
24
                return (retval);                        \
35
24
        }                                                \
36
883
                                                        \
37
883
        return (__real_##name param);                       \
38
883
}
__wrap_EVP_DigestFinal_ex
Line
Count
Source
32
302
type __wrap_##name args {                               \
33
302
        if (prng_up && uniform_random(400) < (prob)) {       \
34
6
                return (retval);                        \
35
6
        }                                                \
36
302
                                                        \
37
302
        return (__real_##name param);                       \
38
302
}
__wrap_BN_bin2bn
Line
Count
Source
32
24.1k
type __wrap_##name args {                               \
33
24.1k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
113
                return (retval);                        \
35
113
        }                                                \
36
24.1k
                                                        \
37
24.1k
        return (__real_##name param);                       \
38
24.1k
}
__wrap_BN_bn2bin
Line
Count
Source
32
25.1k
type __wrap_##name args {                               \
33
25.1k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
118
                return (retval);                        \
35
118
        }                                                \
36
25.1k
                                                        \
37
25.1k
        return (__real_##name param);                       \
38
25.1k
}
__wrap_BN_CTX_get
Line
Count
Source
32
31.2k
type __wrap_##name args {                               \
33
31.2k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
142
                return (retval);                        \
35
142
        }                                                \
36
31.2k
                                                        \
37
31.2k
        return (__real_##name param);                       \
38
31.2k
}
__wrap_BN_CTX_new
Line
Count
Source
32
17.8k
type __wrap_##name args {                               \
33
17.8k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
75
                return (retval);                        \
35
75
        }                                                \
36
17.8k
                                                        \
37
17.8k
        return (__real_##name param);                       \
38
17.8k
}
__wrap_BN_new
Line
Count
Source
32
1.17k
type __wrap_##name args {                               \
33
1.17k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
23
                return (retval);                        \
35
23
        }                                                \
36
1.17k
                                                        \
37
1.17k
        return (__real_##name param);                       \
38
1.17k
}
__wrap_RSA_new
Line
Count
Source
32
550
type __wrap_##name args {                               \
33
550
        if (prng_up && uniform_random(400) < (prob)) {       \
34
5
                return (retval);                        \
35
5
        }                                                \
36
550
                                                        \
37
550
        return (__real_##name param);                       \
38
550
}
__wrap_RSA_set0_key
Line
Count
Source
32
545
type __wrap_##name args {                               \
33
545
        if (prng_up && uniform_random(400) < (prob)) {       \
34
11
                return (retval);                        \
35
11
        }                                                \
36
545
                                                        \
37
545
        return (__real_##name param);                       \
38
545
}
__wrap_RSA_pkey_ctx_ctrl
Line
Count
Source
32
136
type __wrap_##name args {                               \
33
136
        if (prng_up && uniform_random(400) < (prob)) {       \
34
5
                return (retval);                        \
35
5
        }                                                \
36
136
                                                        \
37
136
        return (__real_##name param);                       \
38
136
}
__wrap_EC_KEY_new_by_curve_name
Line
Count
Source
32
17.8k
type __wrap_##name args {                               \
33
17.8k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
71
                return (retval);                        \
35
71
        }                                                \
36
17.8k
                                                        \
37
17.8k
        return (__real_##name param);                       \
38
17.8k
}
__wrap_EC_KEY_get0_group
Line
Count
Source
32
22.0k
type __wrap_##name args {                               \
33
22.0k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
105
                return (retval);                        \
35
105
        }                                                \
36
22.0k
                                                        \
37
22.0k
        return (__real_##name param);                       \
38
22.0k
}
__wrap_EC_KEY_get0_private_key
Line
Count
Source
32
8.67k
type __wrap_##name args {                               \
33
8.67k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
32
                return (retval);                        \
35
32
        }                                                \
36
8.67k
                                                        \
37
8.67k
        return (__real_##name param);                       \
38
8.67k
}
__wrap_EC_POINT_new
Line
Count
Source
32
13.5k
type __wrap_##name args {                               \
33
13.5k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
68
                return (retval);                        \
35
68
        }                                                \
36
13.5k
                                                        \
37
13.5k
        return (__real_##name param);                       \
38
13.5k
}
__wrap_EC_POINT_get_affine_coordinates_GFp
Line
Count
Source
32
8.30k
type __wrap_##name args {                               \
33
8.30k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
34
                return (retval);                        \
35
34
        }                                                \
36
8.30k
                                                        \
37
8.30k
        return (__real_##name param);                       \
38
8.30k
}
__wrap_EVP_PKEY_new
Line
Count
Source
32
9.04k
type __wrap_##name args {                               \
33
9.04k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
47
                return (retval);                        \
35
47
        }                                                \
36
9.04k
                                                        \
37
9.04k
        return (__real_##name param);                       \
38
9.04k
}
__wrap_EVP_PKEY_assign
Line
Count
Source
32
8.99k
type __wrap_##name args {                               \
33
8.99k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
42
                return (retval);                        \
35
42
        }                                                \
36
8.99k
                                                        \
37
8.99k
        return (__real_##name param);                       \
38
8.99k
}
__wrap_EVP_PKEY_keygen_init
Line
Count
Source
32
8.78k
type __wrap_##name args {                               \
33
8.78k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
36
                return (retval);                        \
35
36
        }                                                \
36
8.78k
                                                        \
37
8.78k
        return (__real_##name param);                       \
38
8.78k
}
__wrap_EVP_PKEY_keygen
Line
Count
Source
32
8.74k
type __wrap_##name args {                               \
33
8.74k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
39
                return (retval);                        \
35
39
        }                                                \
36
8.74k
                                                        \
37
8.74k
        return (__real_##name param);                       \
38
8.74k
}
__wrap_EVP_PKEY_paramgen_init
Line
Count
Source
32
8.92k
type __wrap_##name args {                               \
33
8.92k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
42
                return (retval);                        \
35
42
        }                                                \
36
8.92k
                                                        \
37
8.92k
        return (__real_##name param);                       \
38
8.92k
}
__wrap_EVP_PKEY_paramgen
Line
Count
Source
32
8.84k
type __wrap_##name args {                               \
33
8.84k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
31
                return (retval);                        \
35
31
        }                                                \
36
8.84k
                                                        \
37
8.84k
        return (__real_##name param);                       \
38
8.84k
}
__wrap_EVP_PKEY_new_raw_public_key
Line
Count
Source
32
1.48k
type __wrap_##name args {                               \
33
1.48k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
12
                return (retval);                        \
35
12
        }                                                \
36
1.48k
                                                        \
37
1.48k
        return (__real_##name param);                       \
38
1.48k
}
__wrap_EVP_PKEY_CTX_new
Line
Count
Source
32
13.1k
type __wrap_##name args {                               \
33
13.1k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
52
                return (retval);                        \
35
52
        }                                                \
36
13.1k
                                                        \
37
13.1k
        return (__real_##name param);                       \
38
13.1k
}
__wrap_EVP_PKEY_CTX_new_id
Line
Count
Source
32
10.0k
type __wrap_##name args {                               \
33
10.0k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
46
                return (retval);                        \
35
46
        }                                                \
36
10.0k
                                                        \
37
10.0k
        return (__real_##name param);                       \
38
10.0k
}
__wrap_EVP_PKEY_derive
Line
Count
Source
32
9.17k
type __wrap_##name args {                               \
33
9.17k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
36
                return (retval);                        \
35
36
        }                                                \
36
9.17k
                                                        \
37
9.17k
        return (__real_##name param);                       \
38
9.17k
}
__wrap_EVP_PKEY_derive_init
Line
Count
Source
32
5.18k
type __wrap_##name args {                               \
33
5.18k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
25
                return (retval);                        \
35
25
        }                                                \
36
5.18k
                                                        \
37
5.18k
        return (__real_##name param);                       \
38
5.18k
}
__wrap_EVP_PKEY_derive_set_peer
Line
Count
Source
32
4.12k
type __wrap_##name args {                               \
33
4.12k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
12
                return (retval);                        \
35
12
        }                                                \
36
4.12k
                                                        \
37
4.12k
        return (__real_##name param);                       \
38
4.12k
}
__wrap_EVP_PKEY_verify_init
Line
Count
Source
32
191
type __wrap_##name args {                               \
33
191
        if (prng_up && uniform_random(400) < (prob)) {       \
34
7
                return (retval);                        \
35
7
        }                                                \
36
191
                                                        \
37
191
        return (__real_##name param);                       \
38
191
}
__wrap_EVP_PKEY_CTX_ctrl
Line
Count
Source
32
13.0k
type __wrap_##name args {                               \
33
13.0k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
97
                return (retval);                        \
35
97
        }                                                \
36
13.0k
                                                        \
37
13.0k
        return (__real_##name param);                       \
38
13.0k
}
__wrap_EVP_sha1
Line
Count
Source
32
42
type __wrap_##name args {                               \
33
42
        if (prng_up && uniform_random(400) < (prob)) {       \
34
2
                return (retval);                        \
35
2
        }                                                \
36
42
                                                        \
37
42
        return (__real_##name param);                       \
38
42
}
__wrap_EVP_sha256
Line
Count
Source
32
4.37k
type __wrap_##name args {                               \
33
4.37k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
39
                return (retval);                        \
35
39
        }                                                \
36
4.37k
                                                        \
37
4.37k
        return (__real_##name param);                       \
38
4.37k
}
__wrap_EVP_aes_256_cbc
Line
Count
Source
32
6.23k
type __wrap_##name args {                               \
33
6.23k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
19
                return (retval);                        \
35
19
        }                                                \
36
6.23k
                                                        \
37
6.23k
        return (__real_##name param);                       \
38
6.23k
}
__wrap_EVP_aes_256_gcm
Line
Count
Source
32
875
type __wrap_##name args {                               \
33
875
        if (prng_up && uniform_random(400) < (prob)) {       \
34
3
                return (retval);                        \
35
3
        }                                                \
36
875
                                                        \
37
875
        return (__real_##name param);                       \
38
875
}
__wrap_HMAC
Line
Count
Source
32
2.79k
type __wrap_##name args {                               \
33
2.79k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
14
                return (retval);                        \
35
14
        }                                                \
36
2.79k
                                                        \
37
2.79k
        return (__real_##name param);                       \
38
2.79k
}
__wrap_HMAC_CTX_new
Line
Count
Source
32
40
type __wrap_##name args {                               \
33
40
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
40
                                                        \
37
40
        return (__real_##name param);                       \
38
40
}
__wrap_HMAC_Init_ex
Line
Count
Source
32
38
type __wrap_##name args {                               \
33
38
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
38
                                                        \
37
38
        return (__real_##name param);                       \
38
38
}
__wrap_HMAC_Update
Line
Count
Source
32
73
type __wrap_##name args {                               \
33
73
        if (prng_up && uniform_random(400) < (prob)) {       \
34
2
                return (retval);                        \
35
2
        }                                                \
36
73
                                                        \
37
73
        return (__real_##name param);                       \
38
73
}
__wrap_HMAC_Final
Line
Count
Source
32
35
type __wrap_##name args {                               \
33
35
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
35
                                                        \
37
35
        return (__real_##name param);                       \
38
35
}
__wrap_SHA1
Line
Count
Source
32
14
type __wrap_##name args {                               \
33
14
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
14
                                                        \
37
14
        return (__real_##name param);                       \
38
14
}
__wrap_SHA256
Line
Count
Source
32
16.5k
type __wrap_##name args {                               \
33
16.5k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
79
                return (retval);                        \
35
79
        }                                                \
36
16.5k
                                                        \
37
16.5k
        return (__real_##name param);                       \
38
16.5k
}
__wrap_cbor_build_string
Line
Count
Source
32
170k
type __wrap_##name args {                               \
33
170k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
145
                return (retval);                        \
35
145
        }                                                \
36
170k
                                                        \
37
170k
        return (__real_##name param);                       \
38
170k
}
__wrap_cbor_build_bytestring
Line
Count
Source
32
63.0k
type __wrap_##name args {                               \
33
63.0k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
115
                return (retval);                        \
35
115
        }                                                \
36
63.0k
                                                        \
37
63.0k
        return (__real_##name param);                       \
38
63.0k
}
__wrap_cbor_build_bool
Line
Count
Source
32
3.15k
type __wrap_##name args {                               \
33
3.15k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
6
                return (retval);                        \
35
6
        }                                                \
36
3.15k
                                                        \
37
3.15k
        return (__real_##name param);                       \
38
3.15k
}
__wrap_cbor_build_negint8
Line
Count
Source
32
15.3k
type __wrap_##name args {                               \
33
15.3k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
73
                return (retval);                        \
35
73
        }                                                \
36
15.3k
                                                        \
37
15.3k
        return (__real_##name param);                       \
38
15.3k
}
__wrap_cbor_build_negint16
Line
Count
Source
32
331
type __wrap_##name args {                               \
33
331
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1
                return (retval);                        \
35
1
        }                                                \
36
331
                                                        \
37
331
        return (__real_##name param);                       \
38
331
}
__wrap_cbor_load
Line
Count
Source
32
32.5k
type __wrap_##name args {                               \
33
32.5k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
79
                return (retval);                        \
35
79
        }                                                \
36
32.5k
                                                        \
37
32.5k
        return (__real_##name param);                       \
38
32.5k
}
__wrap_cbor_build_uint8
Line
Count
Source
32
113k
type __wrap_##name args {                               \
33
113k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
337
                return (retval);                        \
35
337
        }                                                \
36
113k
                                                        \
37
113k
        return (__real_##name param);                       \
38
113k
}
__wrap_cbor_build_uint16
Line
Count
Source
32
918
type __wrap_##name args {                               \
33
918
        if (prng_up && uniform_random(400) < (prob)) {       \
34
5
                return (retval);                        \
35
5
        }                                                \
36
918
                                                        \
37
918
        return (__real_##name param);                       \
38
918
}
__wrap_cbor_build_uint32
Line
Count
Source
32
497
type __wrap_##name args {                               \
33
497
        if (prng_up && uniform_random(400) < (prob)) {       \
34
4
                return (retval);                        \
35
4
        }                                                \
36
497
                                                        \
37
497
        return (__real_##name param);                       \
38
497
}
Unexecuted instantiation: __wrap_cbor_build_uint64
__wrap_cbor_map_handle
Line
Count
Source
32
61.3k
type __wrap_##name args {                               \
33
61.3k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
90
                return (retval);                        \
35
90
        }                                                \
36
61.3k
                                                        \
37
61.3k
        return (__real_##name param);                       \
38
61.3k
}
__wrap_cbor_array_handle
Line
Count
Source
32
37.5k
type __wrap_##name args {                               \
33
37.5k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
32
                return (retval);                        \
35
32
        }                                                \
36
37.5k
                                                        \
37
37.5k
        return (__real_##name param);                       \
38
37.5k
}
__wrap_cbor_array_push
Line
Count
Source
32
63.2k
type __wrap_##name args {                               \
33
63.2k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
79
                return (retval);                        \
35
79
        }                                                \
36
63.2k
                                                        \
37
63.2k
        return (__real_##name param);                       \
38
63.2k
}
__wrap_cbor_map_add
Line
Count
Source
32
175k
type __wrap_##name args {                               \
33
175k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
289
                return (retval);                        \
35
289
        }                                                \
36
175k
                                                        \
37
175k
        return (__real_##name param);                       \
38
175k
}
__wrap_cbor_new_definite_map
Line
Count
Source
32
77.7k
type __wrap_##name args {                               \
33
77.7k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
121
                return (retval);                        \
35
121
        }                                                \
36
77.7k
                                                        \
37
77.7k
        return (__real_##name param);                       \
38
77.7k
}
__wrap_cbor_new_definite_array
Line
Count
Source
32
4.32k
type __wrap_##name args {                               \
33
4.32k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
19
                return (retval);                        \
35
19
        }                                                \
36
4.32k
                                                        \
37
4.32k
        return (__real_##name param);                       \
38
4.32k
}
__wrap_cbor_new_definite_bytestring
Line
Count
Source
32
136
type __wrap_##name args {                               \
33
136
        if (prng_up && uniform_random(400) < (prob)) {       \
34
2
                return (retval);                        \
35
2
        }                                                \
36
136
                                                        \
37
136
        return (__real_##name param);                       \
38
136
}
__wrap_cbor_serialize_alloc
Line
Count
Source
32
26.0k
type __wrap_##name args {                               \
33
26.0k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
96
                return (retval);                        \
35
96
        }                                                \
36
26.0k
                                                        \
37
26.0k
        return (__real_##name param);                       \
38
26.0k
}
__wrap_fido_tx
Line
Count
Source
32
121k
type __wrap_##name args {                               \
33
121k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
363
                return (retval);                        \
35
363
        }                                                \
36
121k
                                                        \
37
121k
        return (__real_##name param);                       \
38
121k
}
__wrap_bind
Line
Count
Source
32
566k
type __wrap_##name args {                               \
33
566k
        if (prng_up && uniform_random(400) < (prob)) {       \
34
1.37k
                return (retval);                        \
35
1.37k
        }                                                \
36
566k
                                                        \
37
566k
        return (__real_##name param);                       \
38
566k
}
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
)