Skip to content

Commit 158aa4f

Browse files
Merge pull request #955 from LedgerHQ/fix/apa/fuzzing
Added missing fuzzing mocks to prevent false positives
2 parents bf4177a + 329195d commit 158aa4f

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/fuzzing/mock/mock.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,30 @@ cx_err_t cx_ecdomain_parameters_length(cx_curve_t cv, size_t *length) {
6262
return CX_OK;
6363
}
6464

65+
cx_err_t cx_ecdomain_size(cx_curve_t curve, size_t *length) {
66+
(void) curve;
67+
if (length) *length = 32;
68+
return CX_OK;
69+
}
70+
6571
// So cx_bn_t variables don't go uninitialised (in functions like cx_ecdsa_verify_no_throw)
6672
cx_err_t cx_bn_alloc(cx_bn_t *x, size_t nbytes) {
6773
(void) nbytes;
6874
if (x) *x = 0;
6975
return CX_OK;
7076
}
77+
78+
cx_err_t cx_bn_alloc_init(cx_bn_t *x, size_t nbytes, const uint8_t *value, size_t value_nbytes) {
79+
(void) nbytes;
80+
(void) value;
81+
(void) value_nbytes;
82+
if (x) *x = 0;
83+
return CX_OK;
84+
}
85+
86+
cx_err_t cx_bn_cmp(const cx_bn_t a, const cx_bn_t b, int *diff) {
87+
(void) a;
88+
(void) b;
89+
if (diff) *diff = 0;
90+
return CX_OK;
91+
}

0 commit comments

Comments
 (0)