]> git.saurik.com Git - apple/xnu.git/blame - EXTERNAL_HEADERS/corecrypto/cc_fault_canary.h
xnu-7195.101.1.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / corecrypto / cc_fault_canary.h
CommitLineData
f427ee49
A
1/* Copyright (c) (2020) 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
13#ifndef corecrypto_cc_fault_canary_h
14#define corecrypto_cc_fault_canary_h
15
16#include "cc.h"
17
18#define CC_FAULT_CANARY_SIZE 16
19typedef uint8_t cc_fault_canary_t[CC_FAULT_CANARY_SIZE];
20
21extern const cc_fault_canary_t CCEC_FAULT_CANARY;
22extern const cc_fault_canary_t CCRSA_PKCS1_FAULT_CANARY;
23extern const cc_fault_canary_t CCRSA_PSS_FAULT_CANARY;
24
25#define CC_FAULT_CANARY_MEMCPY(_dst_, _src_) memcpy(_dst_, _src_, CC_FAULT_CANARY_SIZE)
26#define CC_FAULT_CANARY_CLEAR(_name_) memset(_name_, 0x00, CC_FAULT_CANARY_SIZE)
27
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 */