EC API#
Elliptic Curve Cryptography (ECC) is a type of public key cryptography that uses the mathematics of elliptic curves to secure information and protect sensitive data.
Data Structures#
-
struct alc_ec_info_t#
Store info about EC.
- Param ecCurveId:
Store info about curve id used for EC
- Param ecCurveType:
Store info about curve type used for EC
- Param ecPointFormat:
Store info about point format id used for EC
-
struct alc_ec_handle_t#
Handle for maintaining session.
- Param context:
pointer to the context of the EC
Functions#
-
Uint64 alcp_ec_context_size(const alc_ec_info_p p_ec_info)#
Returns the context size of the interaction.
This API can be called after alcp_ec_request only otherwise Context will be empty
Note
alcp_ec_supported() should be called first to know if the given curveType is valid.
- Parameters:
p_ec_info – [in] Description of the requested ec session
- Returns:
Size of Context
-
alc_error_t alcp_ec_supported(const alc_ec_info_p pEcInfo)#
Allows to check if a given algorithm is supported.
This API needs to be called before any other API is called to know if EC that is being requested is supported or not
Note
alcp_ec_supported() should be called know if the given curveType and configuration is valid.
- Parameters:
pEcInfo – [in] Description of the requested ec session
- Returns:
Error Code for the API called. If alc_error_t is not ALC_ERROR_NONE, an error has occurred and handle will be invalid for future operations
-
alc_error_t alcp_ec_request(const alc_ec_info_p pEcInfo, alc_ec_handle_p pEcHandle)#
Request a handle for ec for a configuration as pointed by p_ec_info_p.
This API can be called after alcp_ec_supported is called and before alcp_ec_finish
Note
alcp_ec_supported() should be called first to know if the given curveType is valid.
- Parameters:
pEcInfo – [in] Description of the requested ec session
pEcHandle – [out] Library populated session handle for future EC operations.
- Returns:
Error Code for the API called. If alc_error_t is not ALC_ERROR_NONE, an error has occurred and handle will be invalid for future operations
-
alc_error_t alcp_ec_set_privatekey(const alc_ec_handle_p pEcHandle, const Uint8 *pPrivKey)#
Function sets input privateKey.
This API can be called after alcp_ec_request and before alcp_ec_finish
- Parameters:
pEcHandle – [in] - Handler of the Context for the session
pPrivKey – [in] - pointer to Input privateKey
- Returns:
Error Code for the API called . if alc_error_t is not zero then an error has occurred and handle will be invalid for future operations
-
alc_error_t alcp_ec_get_publickey(const alc_ec_handle_p pEcHandle, Uint8 *pPublicKey, const Uint8 *pPrivKey)#
Function generates public key using input privateKey generated public key is shared with the peer.
This API can be called after alcp_ec_request and before alcp_ec_finish
- Parameters:
pEcHandle – [in] - Handler of the Context for the session
pPublicKey – [out] - pointer to Output Publickey generated
pPrivKey – [in] - pointer to Input privateKey used for generating publicKey
- Returns:
Error Code for the API called . if alc_error_t is not zero then an error has occurred and handle will be invalid for future operations
-
alc_error_t alcp_ec_get_secretkey(const alc_ec_handle_p pEcHandle, Uint8 *pSecretKey, const Uint8 *pPublicKey, Uint64 *pKeyLength)#
Function compute secret key with publicKey from remotePeer and local privatekey.
This API can be called after alcp_ec_request and before alcp_ec_finish
- Parameters:
pEcHandle – [in] - Handler of the Context for the session
pSecretKey – [out] - pointer to output secretKey
pPublicKey – [in] - pointer to Input privateKey used for generating publicKey
pKeyLength – [out] - pointer to keyLength
- Returns:
Error Code for the API called . if alc_error_t is not zero then an error has occurred and handle will be invalid for future operations
-
void alcp_ec_finish(const alc_ec_handle_p pEcHandle)#
Performs any cleanup actions.
This API is called to free resources so should be called to free the session
Note
Must be called to ensure memory allotted (if any) is cleaned.
- Parameters:
pEcHandle – [in] The handle that was returned as part of call together alcp_ec_request(), once this function is called. The handle will not be valid for future
- Returns:
None
Variables#
-
enum [anonymous] alc_ec_curve_id#
Store info about curve id used for EC.
-
enum [anonymous] alc_ec_curve_type#
Store info about curve type used for EC.
-
enum [anonymous] alc_ec_point_format_id#
Store info about point format id used for EC.
-
void alc_ec_context_t#
Store Context for the future operation of EC.