1 /* 2 * Copyright (c) 2001-2022, 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 rsa */ 8 #ifdef CC_IOT 9 #include "mbedtls/build_info.h" 10 #endif 11 12 #if !defined(CC_IOT) || ( defined(CC_IOT) && defined(MBEDTLS_RSA_C)) 13 14 #include "cc_rsa_local.h" 15 #include "cc_hash_defs.h" 16 #include "cc_rsa_types.h" 17 18 const RsaHash_t RsaHashInfo_t[CC_RSA_HASH_NumOfModes] = { 19 /*CC_RSA_HASH_MD5_mode */ {CC_HASH_MD5_DIGEST_SIZE_IN_WORDS, CC_HASH_MD5_mode}, 20 /*CC_RSA_HASH_SHA1_mode */ {CC_HASH_SHA1_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA1_mode}, 21 /*CC_RSA_HASH_SHA224_mode */ {CC_HASH_SHA224_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA224_mode}, 22 /*CC_RSA_HASH_SHA256_mode */ {CC_HASH_SHA256_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA256_mode}, 23 /*CC_RSA_HASH_SHA384_mode */ {CC_HASH_SHA384_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA384_mode}, 24 /*CC_RSA_HASH_SHA512_mode */ {CC_HASH_SHA512_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA512_mode}, 25 /*CC_RSA_After_MD5_mode */ {CC_HASH_MD5_DIGEST_SIZE_IN_WORDS, CC_HASH_MD5_mode}, 26 /*CC_RSA_After_SHA1_mode */ {CC_HASH_SHA1_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA1_mode}, 27 /*CC_RSA_After_SHA224_mode */ {CC_HASH_SHA224_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA224_mode}, 28 /*CC_RSA_After_SHA256_mode */ {CC_HASH_SHA256_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA256_mode}, 29 /*CC_RSA_After_SHA384_mode */ {CC_HASH_SHA384_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA384_mode}, 30 /*CC_RSA_After_SHA512_mode */ {CC_HASH_SHA512_DIGEST_SIZE_IN_WORDS, CC_HASH_SHA512_mode}, 31 /*CC_RSA_After_HASH_NOT_KNOWN_mode */ {0,CC_HASH_NumOfModes}, 32 /*CC_RSA_HASH_NO_HASH_mode */ {0,CC_HASH_NumOfModes}, 33 }; 34 35 #ifdef USE_MBEDTLS_CRYPTOCELL 36 const mbedtls_md_type_t RsaHash_CC_mbedtls_Info[CC_HASH_NumOfModes] = { 37 /* CC_HASH_SHA1_mode */ MBEDTLS_MD_SHA1, 38 /* CC_HASH_SHA224_mode */ MBEDTLS_MD_SHA224, 39 /* CC_HASH_SHA256_mode */ MBEDTLS_MD_SHA256, 40 /* CC_HASH_SHA384_mode */ MBEDTLS_MD_SHA384, 41 /* CC_HASH_SHA512_mode */ MBEDTLS_MD_SHA512, 42 /* CC_HASH_MD5_mode */ MBEDTLS_MD_MD5 43 }; 44 #endif 45 const uint8_t RsaSupportedHashModes_t[CC_RSA_HASH_NumOfModes] = { 46 47 /*CC_RSA_HASH_MD5_mode */ CC_FALSE, 48 /*CC_RSA_HASH_SHA1_mode */ CC_TRUE, 49 /*CC_RSA_HASH_SHA224_mode */ CC_TRUE, 50 /*CC_RSA_HASH_SHA256_mode */ CC_TRUE, 51 /*CC_RSA_HASH_SHA384_mode */ CC_TRUE, 52 /*CC_RSA_HASH_SHA512_mode */ CC_TRUE, 53 /*CC_RSA_After_MD5_mode */ CC_FALSE, 54 /*CC_RSA_After_SHA1_mode */ CC_TRUE, 55 /*CC_RSA_After_SHA224_mode */ CC_TRUE, 56 /*CC_RSA_After_SHA256_mode */ CC_TRUE, 57 /*CC_RSA_After_SHA384_mode */ CC_TRUE, 58 /*CC_RSA_After_SHA512_mode */ CC_TRUE, 59 /*CC_RSA_After_HASH_NOT_KNOWN_mode */ CC_FALSE, 60 /*CC_RSA_HASH_NO_HASH_mode */ CC_TRUE, 61 }; 62 63 #endif /* defined(CC_IOT) || ( defined(CC_IOT) && defined(MBEDTLS_RSA_C)) */ 64