-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,008 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include <cx.h> | ||
#include <os_io.h> | ||
#include <signMsg.h> | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
uint8_t G_io_apdu_buffer[IO_APDU_BUFFER_SIZE]; | ||
|
||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { | ||
|
||
UX_INIT(); | ||
|
||
uint8_t *input = NULL; | ||
bool is_first = true; | ||
|
||
while (size > 5) { | ||
io_state = IO_EXPECT_NONE; | ||
uint8_t ins = data[0]; | ||
uint8_t p1 = data[1]; | ||
uint8_t p2 = data[2]; | ||
uint8_t lc = data[3]; | ||
|
||
data += sizeof(uint8_t) * 4; | ||
size -= sizeof(uint8_t) * 4; | ||
|
||
if (size < lc) { | ||
return 0; | ||
} | ||
|
||
uint8_t *input = malloc(lc); | ||
if (input == NULL) { | ||
return 0; | ||
} | ||
|
||
memcpy(input, data, lc); | ||
|
||
data += lc; | ||
size -= lc; | ||
|
||
BEGIN_TRY { | ||
TRY { signMsg_handleAPDU(p1, p2, input, lc, is_first); } | ||
CATCH_ALL {} | ||
FINALLY {} | ||
} | ||
END_TRY; | ||
|
||
is_first = false; | ||
free(input); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
#ifdef DEVEL | ||
|
||
#ifndef H_CARDANO_APP_RUN_TESTS | ||
#define H_CARDANO_APP_RUN_TESTS | ||
|
||
#ifdef DEVEL | ||
|
||
#include "handlers.h" | ||
|
||
handler_fn_t handleRunTests; | ||
|
||
#endif // H_CARDANO_APP_RUN_TESTS | ||
|
||
#endif // DEVEL | ||
|
||
#endif // H_CARDANO_APP_RUN_TESTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.