diff options
Diffstat (limited to 'tools/cert_create/include/key.h')
-rw-r--r-- | tools/cert_create/include/key.h | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/tools/cert_create/include/key.h b/tools/cert_create/include/key.h index d96d9839a2..e0ecdaed2e 100644 --- a/tools/cert_create/include/key.h +++ b/tools/cert_create/include/key.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -22,7 +22,9 @@ enum { enum { KEY_ALG_RSA, /* RSA PSS as defined by PKCS#1 v2.1 (default) */ #ifndef OPENSSL_NO_EC - KEY_ALG_ECDSA, + KEY_ALG_ECDSA_NIST, + KEY_ALG_ECDSA_BRAINPOOL_R, + KEY_ALG_ECDSA_BRAINPOOL_T, #endif /* OPENSSL_NO_EC */ KEY_ALG_MAX_NUM }; @@ -42,7 +44,9 @@ enum{ static const unsigned int KEY_SIZES[KEY_ALG_MAX_NUM][KEY_SIZE_MAX_NUM] = { { 2048, 1024, 3072, 4096 }, /* KEY_ALG_RSA */ #ifndef OPENSSL_NO_EC - {} /* KEY_ALG_ECDSA */ + { 256, 384 }, /* KEY_ALG_ECDSA_NIST */ + {}, /* KEY_ALG_ECDSA_BRAINPOOL_R */ + {} /* KEY_ALG_ECDSA_BRAINPOOL_T */ #endif /* OPENSSL_NO_EC */ }; @@ -66,18 +70,30 @@ typedef struct key_s { /* Exported API */ int key_init(void); key_t *key_get_by_opt(const char *opt); +#if !USING_OPENSSL3 int key_new(key_t *key); +#endif int key_create(key_t *key, int type, int key_bits); -int key_load(key_t *key, unsigned int *err_code); +unsigned int key_load(key_t *key); int key_store(key_t *key); +void key_cleanup(void); /* Macro to register the keys used in the CoT */ #define REGISTER_KEYS(_keys) \ - key_t *keys = &_keys[0]; \ - const unsigned int num_keys = sizeof(_keys)/sizeof(_keys[0]) + key_t *def_keys = &_keys[0]; \ + const unsigned int num_def_keys = sizeof(_keys)/sizeof(_keys[0]) + +/* Macro to register the platform defined keys used in the CoT */ +#define PLAT_REGISTER_KEYS(_pdef_keys) \ + key_t *pdef_keys = &_pdef_keys[0]; \ + const unsigned int num_pdef_keys = sizeof(_pdef_keys)/sizeof(_pdef_keys[0]) /* Exported variables */ -extern key_t *keys; -extern const unsigned int num_keys; +extern key_t *def_keys; +extern const unsigned int num_def_keys; +extern key_t *pdef_keys; +extern const unsigned int num_pdef_keys; +extern key_t *keys; +extern unsigned int num_keys; #endif /* KEY_H */ |