blob: 6b0185775edcb35d109c69382812f96bb17132a9 [file] [log] [blame]
#ifndef __OSSL_ECIES_H__
#define __OSSL_ECIES_H__
#include "kal_general_types.h"
/* support scheme */
typedef enum {
ECIES_PROFILE_A = 1,
ECIES_PROFILE_B,
} sim_suci_scheme_enum;
/* ECIES error code */
typedef enum {
ECIES_ERROR_NONE,
ECIES_ERROR_SCHEME_NOT_SUPPORT,
ECIES_ERROR_PUBKEY_NOT_EXIST,
ECIES_ERROR_PUBKEY_LENGTH_WRONG,
ECIES_ERROR_PUBKEY_FORMAT_WRONG,
ECIES_ERROR_SUPI_NOT_EXIST,
ECIES_ERROR_OUTPUT_NOT_EXIST,
ECIES_ERROR_ECC_GENKEY_FAILED,
ECIES_ERROR_ECC_EXPORT_PUBKEY_FAILED,
ECIES_ERROR_ECC_GENSECRET_FAILED,
ECIES_ERROR_KDF,
ECIES_ERROR_AES_ENC,
ECIES_ERROR_CALCULATE_MAC
} ECIES_ERROR;
extern kal_uint8 g_ecies_dump_log;
/* ECIES encryption */
/*****************************************************************************
* FUNCTION
* sim_supi_enc
* DESCRIPTION
* This function is to get the scheme ouput (None null scheme) with specified key and plaintext.
* PARAMETERS
* scheme [IN]
* peer_pub_key_ptr [IN]
* peer_pub_keylen [IN]
* supi [IN]
* supi_len [IN]
* enc_out [OUT]
* enc_out_len [OUT]
* exported_public_key [OUT]
* exported_public_key_len [OUT]
* RETURNS
* 0 : successfully
* otherwise : failure (reference to enum ECIES_ERROR for error code)
*****************************************************************************/
kal_uint32 sim_supi_enc(sim_suci_scheme_enum scheme, const kal_uint8 *peer_pub_key_ptr, kal_uint16 peer_pub_keylen, const kal_uint8 *supi, kal_uint16 supi_len, kal_uint8 *enc_out, kal_uint16 *enc_out_len, kal_uint8 *exported_public_key, kal_uint8 *exported_public_key_len);
/*****************************************************************************
* FUNCTION
* sim_check_suci_enc_support
* DESCRIPTION
* This function is to check the ME support SUCI protection scheme.
* PARAMETERS
* scheme [IN] The scheme ID to be check, refer to 33.501 Annex C.1
* RETURNS
* TRUE - ME support the scheme
*****************************************************************************/
kal_bool sim_check_suci_enc_support(sim_suci_scheme_enum scheme);
void enable_ecies_dump_log();
#endif /* __OSSL_ECIES_H__ */