Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 1 | From f86f5b42d853d2a65f6753362361bbb95aac1800 Mon Sep 17 00:00:00 2001 |
| 2 | From: Satish Kumar <satish.kumar01@arm.com> |
| 3 | Date: Sat, 11 Dec 2021 11:06:57 +0000 |
| 4 | Subject: [PATCH] corstone1000: port crypto config |
| 5 | |
| 6 | Upstream-Status: Pending [Not submitted to upstream yet] |
| 7 | Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com> |
| 8 | |
| 9 | Signed-off-by: Satish Kumar <satish.kumar01@arm.com> |
| 10 | |
| 11 | %% original patch: 0003-corstone1000-port-crypto-config.patch |
| 12 | --- |
| 13 | .../nspe/pal_crypto_config.h | 83 +++++++++++++++---- |
| 14 | 1 file changed, 66 insertions(+), 17 deletions(-) |
| 15 | |
| 16 | diff --git a/api-tests/platform/targets/tgt_dev_apis_linux/nspe/pal_crypto_config.h b/api-tests/platform/targets/tgt_dev_apis_linux/nspe/pal_crypto_config.h |
| 17 | index 844cd2e..c936bdd 100755 |
| 18 | --- a/api-tests/platform/targets/tgt_dev_apis_linux/nspe/pal_crypto_config.h |
| 19 | +++ b/api-tests/platform/targets/tgt_dev_apis_linux/nspe/pal_crypto_config.h |
| 20 | @@ -1,5 +1,5 @@ |
| 21 | /** @file |
| 22 | - * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved. |
| 23 | + * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved. |
| 24 | * SPDX-License-Identifier : Apache-2.0 |
| 25 | * |
| 26 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 27 | @@ -34,10 +34,14 @@ |
| 28 | * |
| 29 | * Comment macros to disable the types |
| 30 | */ |
| 31 | +#ifndef TF_M_PROFILE_SMALL |
| 32 | +#ifndef TF_M_PROFILE_MEDIUM |
| 33 | #define ARCH_TEST_RSA |
| 34 | #define ARCH_TEST_RSA_1024 |
| 35 | #define ARCH_TEST_RSA_2048 |
| 36 | #define ARCH_TEST_RSA_3072 |
| 37 | +#endif |
| 38 | +#endif |
| 39 | |
| 40 | /** |
| 41 | * \def ARCH_TEST_ECC |
| 42 | @@ -50,11 +54,17 @@ |
| 43 | * Requires: ARCH_TEST_ECC |
| 44 | * Comment macros to disable the curve |
| 45 | */ |
| 46 | +#ifndef TF_M_PROFILE_SMALL |
| 47 | #define ARCH_TEST_ECC |
| 48 | #define ARCH_TEST_ECC_CURVE_SECP192R1 |
| 49 | +#ifndef TF_M_PROFILE_MEDIUM |
| 50 | #define ARCH_TEST_ECC_CURVE_SECP224R1 |
| 51 | +#endif |
| 52 | #define ARCH_TEST_ECC_CURVE_SECP256R1 |
| 53 | +#ifndef TF_M_PROFILE_MEDIUM |
| 54 | #define ARCH_TEST_ECC_CURVE_SECP384R1 |
| 55 | +#endif |
| 56 | +#endif |
| 57 | |
| 58 | /** |
| 59 | * \def ARCH_TEST_AES |
| 60 | @@ -78,10 +88,10 @@ |
| 61 | * |
| 62 | * Comment macros to disable the types |
| 63 | */ |
| 64 | -#define ARCH_TEST_DES |
| 65 | -#define ARCH_TEST_DES_1KEY |
| 66 | -#define ARCH_TEST_DES_2KEY |
| 67 | -#define ARCH_TEST_DES_3KEY |
| 68 | +//#define ARCH_TEST_DES |
| 69 | +//#define ARCH_TEST_DES_1KEY |
| 70 | +//#define ARCH_TEST_DES_2KEY |
| 71 | +//#define ARCH_TEST_DES_3KEY |
| 72 | |
| 73 | /** |
| 74 | * \def ARCH_TEST_RAW |
| 75 | @@ -104,7 +114,7 @@ |
| 76 | * |
| 77 | * Enable the ARC4 key type. |
| 78 | */ |
| 79 | -#define ARCH_TEST_ARC4 |
| 80 | +//#define ARCH_TEST_ARC4 |
| 81 | |
| 82 | /** |
| 83 | * \def ARCH_TEST_CIPHER_MODE_CTR |
| 84 | @@ -113,7 +123,11 @@ |
| 85 | * |
| 86 | * Requires: ARCH_TEST_CIPHER |
| 87 | */ |
| 88 | +#ifndef TF_M_PROFILE_SMALL |
| 89 | +#ifndef TF_M_PROFILE_MEDIUM |
| 90 | #define ARCH_TEST_CIPHER_MODE_CTR |
| 91 | +#endif |
| 92 | +#endif |
| 93 | |
| 94 | /** |
| 95 | * \def ARCH_TEST_CIPHER_MODE_CFB |
| 96 | @@ -138,7 +152,11 @@ |
| 97 | * |
| 98 | * Requires: ARCH_TEST_CIPHER, ARCH_TEST_AES, ARCH_TEST_CIPHER_MODE_CTR |
| 99 | */ |
| 100 | +#ifndef TF_M_PROFILE_SMALL |
| 101 | +#ifndef TF_M_PROFILE_MEDIUM |
| 102 | #define ARCH_TEST_CTR_AES |
| 103 | +#endif |
| 104 | +#endif |
| 105 | |
| 106 | /** |
| 107 | * \def ARCH_TEST_CBC_AES |
| 108 | @@ -157,7 +175,11 @@ |
| 109 | * |
| 110 | * Comment macros to disable the types |
| 111 | */ |
| 112 | +#ifndef TF_M_PROFILE_SMALL |
| 113 | +#ifndef TF_M_PROFILE_MEDIUM |
| 114 | #define ARCH_TEST_CBC_NO_PADDING |
| 115 | +#endif |
| 116 | +#endif |
| 117 | |
| 118 | /** |
| 119 | * \def ARCH_TEST_CFB_AES |
| 120 | @@ -177,11 +199,15 @@ |
| 121 | * |
| 122 | * Comment macros to disable the types |
| 123 | */ |
| 124 | +#ifndef TF_M_PROFILE_SMALL |
| 125 | +#ifndef TF_M_PROFILE_MEDIUM |
| 126 | #define ARCH_TEST_PKCS1V15 |
| 127 | #define ARCH_TEST_RSA_PKCS1V15_SIGN |
| 128 | #define ARCH_TEST_RSA_PKCS1V15_SIGN_RAW |
| 129 | #define ARCH_TEST_RSA_PKCS1V15_CRYPT |
| 130 | #define ARCH_TEST_RSA_OAEP |
| 131 | +#endif |
| 132 | +#endif |
| 133 | |
| 134 | /** |
| 135 | * \def ARCH_TEST_CBC_PKCS7 |
| 136 | @@ -190,7 +216,11 @@ |
| 137 | * |
| 138 | * Comment macros to disable the types |
| 139 | */ |
| 140 | +#ifndef TF_M_PROFILE_SMALL |
| 141 | +#ifndef TF_M_PROFILE_MEDIUM |
| 142 | #define ARCH_TEST_CBC_PKCS7 |
| 143 | +#endif |
| 144 | +#endif |
| 145 | |
| 146 | /** |
| 147 | * \def ARCH_TEST_ASYMMETRIC_ENCRYPTION |
| 148 | @@ -227,21 +257,27 @@ |
| 149 | * |
| 150 | * Comment macros to disable the types |
| 151 | */ |
| 152 | -// #define ARCH_TEST_MD2 |
| 153 | -// #define ARCH_TEST_MD4 |
| 154 | -#define ARCH_TEST_MD5 |
| 155 | -#define ARCH_TEST_RIPEMD160 |
| 156 | -#define ARCH_TEST_SHA1 |
| 157 | +//#define ARCH_TEST_MD2 |
| 158 | +//#define ARCH_TEST_MD4 |
| 159 | +//#define ARCH_TEST_MD5 |
| 160 | +//#define ARCH_TEST_RIPEMD160 |
| 161 | +//#define ARCH_TEST_SHA1 |
| 162 | +#ifndef TF_M_PROFILE_SMALL |
| 163 | #define ARCH_TEST_SHA224 |
| 164 | +#endif |
| 165 | #define ARCH_TEST_SHA256 |
| 166 | +#ifndef TF_M_PROFILE_SMALL |
| 167 | +#ifndef TF_M_PROFILE_MEDIUM |
| 168 | #define ARCH_TEST_SHA384 |
| 169 | #define ARCH_TEST_SHA512 |
| 170 | -// #define ARCH_TEST_SHA512_224 |
| 171 | -// #define ARCH_TEST_SHA512_256 |
| 172 | -// #define ARCH_TEST_SHA3_224 |
| 173 | -// #define ARCH_TEST_SHA3_256 |
| 174 | -// #define ARCH_TEST_SHA3_384 |
| 175 | -// #define ARCH_TEST_SHA3_512 |
| 176 | +#endif |
| 177 | +#endif |
| 178 | +//#define ARCH_TEST_SHA512_224 |
| 179 | +//#define ARCH_TEST_SHA512_256 |
| 180 | +//#define ARCH_TEST_SHA3_224 |
| 181 | +//#define ARCH_TEST_SHA3_256 |
| 182 | +//#define ARCH_TEST_SHA3_384 |
| 183 | +//#define ARCH_TEST_SHA3_512 |
| 184 | |
| 185 | /** |
| 186 | * \def ARCH_TEST_HKDF |
| 187 | @@ -261,7 +297,12 @@ |
| 188 | * |
| 189 | * Comment macros to disable the types |
| 190 | */ |
| 191 | +#ifndef TF_M_PROFILE_SMALL |
| 192 | +#ifndef TF_M_PROFILE_MEDIUM |
| 193 | #define ARCH_TEST_CMAC |
| 194 | +#endif |
| 195 | +#endif |
| 196 | +//#define ARCH_TEST_GMAC |
| 197 | #define ARCH_TEST_HMAC |
| 198 | |
| 199 | /** |
| 200 | @@ -281,7 +322,11 @@ |
| 201 | * Requires: ARCH_TEST_AES |
| 202 | * |
| 203 | */ |
| 204 | +#ifndef TF_M_PROFILE_SMALL |
| 205 | +#ifndef TF_M_PROFILE_MEDIUM |
| 206 | #define ARCH_TEST_GCM |
| 207 | +#endif |
| 208 | +#endif |
| 209 | |
| 210 | /** |
| 211 | * \def ARCH_TEST_TRUNCATED_MAC |
| 212 | @@ -300,7 +345,9 @@ |
| 213 | * |
| 214 | * Requires: ARCH_TEST_ECC |
| 215 | */ |
| 216 | +#ifndef TF_M_PROFILE_SMALL |
| 217 | #define ARCH_TEST_ECDH |
| 218 | +#endif |
| 219 | |
| 220 | /** |
| 221 | * \def ARCH_TEST_ECDSA |
| 222 | @@ -308,7 +355,9 @@ |
| 223 | * Enable the elliptic curve DSA library. |
| 224 | * Requires: ARCH_TEST_ECC |
| 225 | */ |
| 226 | +#ifndef TF_M_PROFILE_SMALL |
| 227 | #define ARCH_TEST_ECDSA |
| 228 | +#endif |
| 229 | |
| 230 | /** |
| 231 | * \def ARCH_TEST_DETERMINISTIC_ECDSA |
| 232 | -- |
| 233 | 2.25.1 |
| 234 | |