diff options
Diffstat (limited to 'rpc_api.c')
-rw-r--r-- | rpc_api.c | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -35,6 +35,7 @@ #include "hal.h" #include "hal_internal.h" +#include "hashsig.h" const hal_hash_handle_t hal_hash_handle_none = {HAL_HANDLE_NONE}; @@ -64,6 +65,10 @@ static inline int check_pkey_type(const hal_key_type_t type) case HAL_KEY_TYPE_RSA_PUBLIC: case HAL_KEY_TYPE_EC_PRIVATE: case HAL_KEY_TYPE_EC_PUBLIC: + case HAL_KEY_TYPE_HASHSIG_PRIVATE: + case HAL_KEY_TYPE_HASHSIG_PUBLIC: + case HAL_KEY_TYPE_HASHSIG_LMS: + case HAL_KEY_TYPE_HASHSIG_LMOTS: return 1; default: return 0; @@ -91,6 +96,10 @@ static inline int check_pkey_type_curve_flags(const hal_key_type_t type, case HAL_KEY_TYPE_RSA_PRIVATE: case HAL_KEY_TYPE_RSA_PUBLIC: + case HAL_KEY_TYPE_HASHSIG_PRIVATE: + case HAL_KEY_TYPE_HASHSIG_PUBLIC: + case HAL_KEY_TYPE_HASHSIG_LMS: + case HAL_KEY_TYPE_HASHSIG_LMOTS: return curve == HAL_CURVE_NONE; case HAL_KEY_TYPE_EC_PRIVATE: @@ -264,6 +273,20 @@ hal_error_t hal_rpc_pkey_generate_ec(const hal_client_handle_t client, return hal_rpc_pkey_dispatch->generate_ec(client, session, pkey, name, curve, flags); } +hal_error_t hal_rpc_pkey_generate_hashsig(const hal_client_handle_t client, + const hal_session_handle_t session, + hal_pkey_handle_t *pkey, + hal_uuid_t *name, + const size_t hss_levels, + const lms_algorithm_t lms_type, + const lmots_algorithm_t lmots_type, + const hal_key_flags_t flags) +{ + if (pkey == NULL || name == NULL || !check_pkey_flags(flags)) + return HAL_ERROR_BAD_ARGUMENTS; + return hal_rpc_pkey_dispatch->generate_hashsig(client, session, pkey, name, hss_levels, lms_type, lmots_type, flags); +} + hal_error_t hal_rpc_pkey_close(const hal_pkey_handle_t pkey) { return hal_rpc_pkey_dispatch->close(pkey); @@ -352,7 +375,7 @@ hal_error_t hal_rpc_pkey_match(const hal_client_handle_t client, return HAL_ERROR_BAD_ARGUMENTS; if (attributes != NULL) - for (int i = 0; i < attributes_len; i++) + for (size_t i = 0; i < attributes_len; i++) if (attributes[i].value == NULL) return HAL_ERROR_BAD_ARGUMENTS; |