1 /* 2 * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /* this file contains the definitions of the hashes used in the ecpki */ 8 9 #include "cc_ecpki_local.h" 10 #include "cc_hash_defs.h" 11 #include "cc_ecpki_types.h" 12 #include "cc_ecpki_domains_defs.h" 13 #include "cc_ecpki_domain_secp192r1.h" 14 #include "cc_ecpki_domain_secp224r1.h" 15 #include "cc_ecpki_domain_secp256r1.h" 16 #include "cc_ecpki_domain_secp521r1.h" 17 #include "cc_ecpki_domain_secp192k1.h" 18 #include "cc_ecpki_domain_secp224k1.h" 19 #include "cc_ecpki_domain_secp256k1.h" 20 #include "cc_ecpki_domain_secp384r1.h" 21 22 const CCEcpkiHash_t ecpki_hash_info[CC_ECPKI_HASH_NumOfModes] = { 23 /*CC_ECPKI_HASH_SHA1_mode */ {CC_HASH_SHA1_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA1_mode}, 24 /*CC_ECPKI_HASH_SHA224_mode */ {CC_HASH_SHA224_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA224_mode}, 25 /*CC_ECPKI_HASH_SHA256_mode */ {CC_HASH_SHA256_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA256_mode}, 26 /*CC_ECPKI_HASH_SHA384_mode */ {CC_HASH_SHA384_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA384_mode}, 27 /*CC_ECPKI_HASH_SHA512_mode */ {CC_HASH_SHA512_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA512_mode}, 28 /*CC_ECPKI_AFTER_HASH_SHA1_mode */ {CC_HASH_SHA1_DIGEST_SIZE_IN_WORDS, CC_HASH_NumOfModes}, 29 /*CC_ECPKI_AFTER_HASH_SHA224_mode */ {CC_HASH_SHA224_DIGEST_SIZE_IN_WORDS, CC_HASH_NumOfModes}, 30 /*CC_ECPKI_AFTER_HASH_SHA256_mode */ {CC_HASH_SHA256_DIGEST_SIZE_IN_WORDS, CC_HASH_NumOfModes}, 31 /*CC_ECPKI_AFTER_HASH_SHA384_mode */ {CC_HASH_SHA384_DIGEST_SIZE_IN_WORDS, CC_HASH_NumOfModes}, 32 /*CC_ECPKI_AFTER_HASH_SHA512_mode */ {CC_HASH_SHA512_DIGEST_SIZE_IN_WORDS, CC_HASH_NumOfModes}, 33 }; 34 35 const uint8_t ecpki_supported_hash_modes[CC_ECPKI_HASH_NumOfModes] = { 36 /*CC_ECPKI_HASH_SHA1_mode */ CC_TRUE, 37 /*CC_ECPKI_HASH_SHA224_mode */ CC_TRUE, 38 /*CC_ECPKI_HASH_SHA256_mode */ CC_TRUE, 39 /*CC_ECPKI_HASH_SHA384_mode */ CC_FALSE, 40 /*CC_ECPKI_HASH_SHA512_mode */ CC_TRUE, 41 /*CC_ECPKI_AFTER_HASH_SHA1_mode */ CC_TRUE, 42 /*CC_ECPKI_AFTER_HASH_SHA224_mode */ CC_TRUE, 43 /*CC_ECPKI_AFTER_HASH_SHA256_mode */ CC_TRUE, 44 /*CC_ECPKI_AFTER_HASH_SHA384_mode */ CC_TRUE, 45 /*CC_ECPKI_AFTER_HASH_SHA512_mode */ CC_TRUE 46 }; 47 48 49 const getDomainFuncP ecDomainsFuncP[CC_ECPKI_DomainID_OffMode] = { 50 (&CC_EcpkiGetSecp192k1DomainP), 51 (&CC_EcpkiGetSecp192r1DomainP), 52 (&CC_EcpkiGetSecp224k1DomainP), 53 (&CC_EcpkiGetSecp224r1DomainP), 54 (&CC_EcpkiGetSecp256k1DomainP), 55 (&CC_EcpkiGetSecp256r1DomainP), 56 (&CC_EcpkiGetSecp384r1DomainP), 57 (&CC_EcpkiGetSecp521r1DomainP) 58 }; 59 60