1/* Copyright (c) (2019-2023) Apple Inc. All rights reserved.
2 *
3 * corecrypto is licensed under Apple Inc.’s Internal Use License Agreement (which
4 * is contained in the License.txt file distributed with corecrypto) and only to
5 * people who accept that license. IMPORTANT: Any license rights granted to you by
6 * Apple Inc. (if any) are limited to internal use within your organization only on
7 * devices and computers you own or control, for the sole purpose of verifying the
8 * security characteristics and correct functioning of the Apple Software. You may
9 * not, directly or indirectly, redistribute the Apple Software or any portions thereof.
10 */
11
12#ifndef _CORECRYPTO_CC_FAULT_CANARY_H_
13#define _CORECRYPTO_CC_FAULT_CANARY_H_
14
15#include "cc.h"
16
17CC_PTRCHECK_CAPABLE_HEADER()
18
19#define CC_FAULT_CANARY_SIZE 16
20typedef uint8_t cc_fault_canary_t[CC_FAULT_CANARY_SIZE];
21
22extern const cc_fault_canary_t CCEC_FAULT_CANARY;
23extern const cc_fault_canary_t CCRSA_PKCS1_FAULT_CANARY;
24extern const cc_fault_canary_t CCRSA_PSS_FAULT_CANARY;
25
26#define CC_FAULT_CANARY_MEMCPY(_dst_, _src_) cc_memcpy(_dst_, _src_, CC_FAULT_CANARY_SIZE)
27#define CC_FAULT_CANARY_CLEAR(_name_) cc_memset(_name_, 0x00, CC_FAULT_CANARY_SIZE)
28#define CC_FAULT_CANARY_EQUAL(_a_, _b_) (cc_cmp_safe(CC_FAULT_CANARY_SIZE, _a_, _b_) == 0)
29
30#endif // _CORECRYPTO_CC_FAULT_CANARY_H_
31