1 /* Copyright 2018 The ChromiumOS Authors 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 /* Fuzzer target config flags */ 7 8 #ifndef __FUZZ_FUZZ_CONFIG_H 9 #define __FUZZ_FUZZ_CONFIG_H 10 #ifdef TEST_FUZZ 11 12 /* Disable hibernate: We never want to exit while fuzzing. */ 13 #undef CONFIG_HIBERNATE 14 15 #ifdef TEST_PINWEAVER_FUZZ 16 #define CONFIG_DCRYPTO 17 #define CONFIG_PINWEAVER 18 #define CONFIG_UPTO_SHA512 19 #define SHA512_SUPPORT 20 #define CONFIG_MALLOC 21 22 /******************************************************************************/ 23 /* From chip/g/config_chip.h */ 24 25 #define CFG_FLASH_HALF (CONFIG_FLASH_SIZE >> 1) 26 #define CFG_TOP_SIZE 0x3000 27 #define CFG_TOP_A_OFF (CFG_FLASH_HALF - CFG_TOP_SIZE) 28 #define CFG_TOP_B_OFF (CONFIG_FLASH_SIZE - CFG_TOP_SIZE) 29 30 /******************************************************************************/ 31 /* From board/cr50/board.h */ 32 /* Non-volatile counter storage for U2F */ 33 #define CONFIG_CRC8 34 #define CONFIG_FLASH_ERASED_VALUE32 (-1U) 35 #define CONFIG_FLASH_LOG 36 #define CONFIG_FLASH_LOG_BASE CONFIG_PROGRAM_MEMORY_BASE 37 #define CONFIG_FLASH_LOG_SPACE 0x800 38 39 /* We're using TOP_A for partition 0, TOP_B for partition 1 */ 40 #define CONFIG_FLASH_NVMEM 41 /* Offset to start of NvMem area from base of flash */ 42 #define CONFIG_FLASH_NVMEM_OFFSET_A (CFG_TOP_A_OFF) 43 #define CONFIG_FLASH_NVMEM_OFFSET_B (CFG_TOP_B_OFF) 44 /* Address of start of Nvmem area */ 45 #define CONFIG_FLASH_NVMEM_BASE_A \ 46 (CONFIG_PROGRAM_MEMORY_BASE + CONFIG_FLASH_NVMEM_OFFSET_A) 47 #define CONFIG_FLASH_NVMEM_BASE_B \ 48 (CONFIG_PROGRAM_MEMORY_BASE + CONFIG_FLASH_NVMEM_OFFSET_B) 49 #define CONFIG_FLASH_NEW_NVMEM_BASE_A \ 50 (CONFIG_FLASH_NVMEM_BASE_A + CONFIG_FLASH_BANK_SIZE) 51 #define CONFIG_FLASH_NEW_NVMEM_BASE_B \ 52 (CONFIG_FLASH_NVMEM_BASE_B + CONFIG_FLASH_BANK_SIZE) 53 /* Size partition in NvMem */ 54 #define NVMEM_PARTITION_SIZE (CFG_TOP_SIZE) 55 /* Size in bytes of NvMem area */ 56 #define CONFIG_FLASH_NVMEM_SIZE (NVMEM_PARTITION_SIZE * NVMEM_NUM_PARTITIONS) 57 58 #define NEW_NVMEM_PARTITION_SIZE (NVMEM_PARTITION_SIZE - CONFIG_FLASH_BANK_SIZE) 59 #define NEW_NVMEM_TOTAL_PAGES \ 60 (2 * NEW_NVMEM_PARTITION_SIZE / CONFIG_FLASH_BANK_SIZE) 61 62 /* Enable <key, value> variable support. */ 63 #define CONFIG_FLASH_NVMEM_VARS 64 #define NVMEM_CR50_SIZE 272 65 #define CONFIG_FLASH_NVMEM_VARS_USER_SIZE NVMEM_CR50_SIZE 66 67 #ifndef __ASSEMBLER__ 68 enum nvmem_users { NVMEM_TPM = 0, NVMEM_CR50, NVMEM_NUM_USERS }; 69 #endif 70 71 #define NVMEM_TPM_SIZE \ 72 (sizeof(((nvmem_partition *)(0))->buffer) - NVMEM_CR50_SIZE) 73 74 #define CONFIG_FLASH_NVMEM_VARS_USER_NUM NVMEM_CR50 75 76 /******************************************************************************/ 77 #define CONFIG_SW_CRC 78 79 #endif /* TEST_PINWEAVER_FUZZ */ 80 81 #ifdef TEST_HOST_COMMAND_FUZZ 82 #undef CONFIG_HOSTCMD_DEBUG_MODE 83 84 /* Defining this makes fuzzing slower, but exercises additional code paths. */ 85 #define FUZZ_HOSTCMD_VERBOSE 86 87 #ifdef FUZZ_HOSTCMD_VERBOSE 88 #define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_PARAMS 89 #else 90 #define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF 91 #endif /* ! FUZZ_HOSTCMD_VERBOSE */ 92 93 /* The following are for fpsensor host commands. */ 94 #define CONFIG_AES 95 #define CONFIG_AES_GCM 96 #define CONFIG_ROLLBACK_SECRET_SIZE 32 97 #define CONFIG_SHA256 98 99 #endif /* TEST_HOST_COMMAND_FUZZ */ 100 101 #ifdef TEST_U2F_FUZZ 102 #define CONFIG_DCRYPTO 103 #define CONFIG_U2F 104 #define CC_EXTENSION CC_COMMAND 105 #endif /* TEST_U2F_FUZZ */ 106 107 #endif /* TEST_FUZZ */ 108 #endif /* __FUZZ_FUZZ_CONFIG_H */ 109