Virgil IoT KIT
Data Structures | Typedefs | Enumerations | Functions
secmodule.h File Reference

Security Module implementations signatures. More...

#include <stdint.h>
#include <stddef.h>
#include <virgil/iot/status_code/status_code.h>
#include <virgil/iot/secmodule/devices/secmodule-soft.h>

Go to the source code of this file.

Data Structures

struct  vs_secmodule_sw_sha256_ctx
 SHA-256 context. More...
 
struct  vs_secmodule_impl_t
 Security Module implementation. More...
 

Typedefs

typedef vs_status_e(* vs_secmodule_slot_save_t) (vs_iot_secmodule_slot_e slot, const uint8_t *data, uint16_t data_sz)
 Save information to the slot. More...
 
typedef vs_status_e(* vs_secmodule_slot_load_t) (vs_iot_secmodule_slot_e slot, uint8_t *data, uint16_t buf_sz, uint16_t *out_sz)
 Load information to the slot. More...
 
typedef vs_status_e(* vs_secmodule_slot_delete_t) (vs_iot_secmodule_slot_e slot)
 Delete information from the slot. More...
 
typedef vs_status_e(* vs_secmodule_hash_create_t) (vs_secmodule_hash_type_e hash_type, const uint8_t *data, uint16_t data_sz, uint8_t *hash, uint16_t hash_buf_sz, uint16_t *hash_sz)
 Hash generation. More...
 
typedef vs_status_e(* vs_secmodule_keypair_create_t) (vs_iot_secmodule_slot_e slot, vs_secmodule_keypair_type_e keypair_type)
 Key pair generate. More...
 
typedef vs_status_e(* vs_secmodule_keypair_get_pubkey_t) (vs_iot_secmodule_slot_e slot, uint8_t *buf, uint16_t buf_sz, uint16_t *key_sz, vs_secmodule_keypair_type_e *keypair_type)
 Public key retrieval. More...
 
typedef vs_status_e(* vs_secmodule_ecdsa_sign_t) (vs_iot_secmodule_slot_e key_slot, vs_secmodule_hash_type_e hash_type, const uint8_t *hash, uint8_t *signature, uint16_t signature_buf_sz, uint16_t *signature_sz)
 Signature calculation based on ECDSA. More...
 
typedef vs_status_e(* vs_secmodule_ecdsa_verify_t) (vs_secmodule_keypair_type_e keypair_type, const uint8_t *public_key, uint16_t public_key_sz, vs_secmodule_hash_type_e hash_type, const uint8_t *hash, const uint8_t *signature, uint16_t signature_sz)
 Signature verification based on ECDSA. More...
 
typedef vs_status_e(* vs_secmodule_hmac_t) (vs_secmodule_hash_type_e hash_type, const uint8_t *key, uint16_t key_sz, const uint8_t *input, uint16_t input_sz, uint8_t *output, uint16_t output_buf_sz, uint16_t *output_sz)
 HMAC calculation. More...
 
typedef vs_status_e(* vs_secmodule_kdf_t) (vs_secmodule_kdf_type_e kdf_type, vs_secmodule_hash_type_e hash_type, const uint8_t *input, uint16_t input_sz, uint8_t *output, uint16_t output_sz)
 KDF calculation. More...
 
typedef vs_status_e(* vs_secmodule_hkdf_t) (vs_secmodule_hash_type_e hash_type, const uint8_t *input, uint16_t input_sz, const uint8_t *salt, uint16_t salt_sz, const uint8_t *info, uint16_t info_sz, uint8_t *output, uint16_t output_sz)
 HKDF calculation. More...
 
typedef vs_status_e(* vs_secmodule_random_t) (uint8_t *output, uint16_t output_sz)
 Random data generation. More...
 
typedef vs_status_e(* vs_secmodule_aes_encrypt_t) (vs_iot_aes_type_e aes_type, const uint8_t *key, uint16_t key_bitlen, const uint8_t *iv, uint16_t iv_len, const uint8_t *add, uint16_t add_len, uint16_t buf_len, const uint8_t *input, uint8_t *output, uint8_t *tag, uint16_t tag_len)
 Data encryption by AES algorithm. More...
 
typedef vs_status_e(* vs_secmodule_aes_decrypt_t) (vs_iot_aes_type_e aes_type, const uint8_t *key, uint16_t key_bitlen, const uint8_t *iv, uint16_t iv_len, const uint8_t *add, uint16_t add_len, uint16_t buf_len, const uint8_t *input, uint8_t *output, uint8_t *tag, uint16_t tag_len)
 Data decryption by AES algorithm. More...
 
typedef vs_status_e(* vs_secmodule_aes_auth_decrypt_t) (vs_iot_aes_type_e aes_type, const uint8_t *key, uint16_t key_bitlen, const uint8_t *iv, uint16_t iv_len, const uint8_t *add, uint16_t add_len, uint16_t buf_len, const uint8_t *input, uint8_t *output, const uint8_t *tag, uint16_t tag_len)
 Data decryption by AES algorithm with authentication check. More...
 
typedef vs_status_e(* vs_secmodule_ecdh_t) (vs_iot_secmodule_slot_e slot, vs_secmodule_keypair_type_e keypair_type, const uint8_t *public_key, uint16_t public_key_sz, uint8_t *shared_secret, uint16_t buf_sz, uint16_t *shared_secret_sz)
 ECDH algorithm. More...
 
typedef void(* vs_secmodule_sw_sha256_init_t) (vs_secmodule_sw_sha256_ctx *ctx)
 SHA-256 context initialization. More...
 
typedef vs_status_e(* vs_secmodule_sw_sha256_update_t) (vs_secmodule_sw_sha256_ctx *ctx, const uint8_t *message, uint32_t len)
 SHA-256 context update. More...
 
typedef vs_status_e(* vs_secmodule_sw_sha256_final_t) (vs_secmodule_sw_sha256_ctx *ctx, uint8_t *digest)
 SHA-256 context finalization. More...
 
typedef void(* vs_secmodule_deinit_t) (void)
 Security Module destruction. More...
 

Enumerations

enum  vs_secmodule_keypair_type_e {
  VS_KEYPAIR_INVALID = -1, VS_KEYPAIR_EC_SECP_MIN = 1, VS_KEYPAIR_EC_SECP192R1 = VS_KEYPAIR_EC_SECP_MIN, VS_KEYPAIR_EC_SECP224R1,
  VS_KEYPAIR_EC_SECP256R1, VS_KEYPAIR_EC_SECP384R1, VS_KEYPAIR_EC_SECP521R1, VS_KEYPAIR_EC_SECP192K1,
  VS_KEYPAIR_EC_SECP224K1, VS_KEYPAIR_EC_SECP256K1, VS_KEYPAIR_EC_SECP_MAX = VS_KEYPAIR_EC_SECP256K1, VS_KEYPAIR_EC_CURVE25519,
  VS_KEYPAIR_EC_ED25519, VS_KEYPAIR_MAX
}
 Keypair types. More...
 
enum  vs_secmodule_hash_type_e { VS_HASH_SHA_INVALID = -1, VS_HASH_SHA_256 = 0, VS_HASH_SHA_384, VS_HASH_SHA_512 }
 Hash types. More...
 
enum  vs_secmodule_kdf_type_e { VS_KDF_INVALID = -1, VS_KDF_2 = 0 }
 KDF type. More...
 
enum  vs_iot_aes_type_e { VS_AES_GCM, VS_AES_CBC }
 AES mode. More...
 

Functions

vs_status_e vs_secmodule_ecies_decrypt (const vs_secmodule_impl_t *secmodule_impl, const uint8_t *recipient_id, size_t recipient_id_sz, const uint8_t *cryptogram, size_t cryptogram_sz, uint8_t *decrypted_data, size_t buf_sz, size_t *decrypted_data_sz)
 ECIES decryption for AES-256 based on SHA-384. More...
 
vs_status_e vs_secmodule_ecies_encrypt (const vs_secmodule_impl_t *secmodule_impl, const uint8_t *recipient_id, size_t recipient_id_sz, const uint8_t *data, size_t data_sz, uint8_t *cryptogram, size_t buf_sz, size_t *cryptogram_sz)
 ECIES encryption for AES-256 based on SHA-384. More...
 

Detailed Description

Security Module implementations signatures.

This header contains vs_secmodule_impl_t structure that is used for crypto operations.

Warning
User needs to provide Security Module implementation. Library provides standard software implementation. See vs-secmodule-usage for example.
vs_secmodule_impl_t *secmodule_impl; // Security Module implementations
vs_storage_op_ctx_t slots_storage_impl; // Slots storage implementation
// Virgil IoT KIT provides Software Security Module that can be used instead of Hardware one :
secmodule_impl = vs_soft_secmodule_impl(&slots_storage_impl);
// ... Library usage

Software Security Module needs to have Slots Storage Implementation initialized. See Storage HAL Usage for details.

Typedef Documentation

◆ vs_secmodule_aes_auth_decrypt_t

typedef vs_status_e(* vs_secmodule_aes_auth_decrypt_t) (vs_iot_aes_type_e aes_type, const uint8_t *key, uint16_t key_bitlen, const uint8_t *iv, uint16_t iv_len, const uint8_t *add, uint16_t add_len, uint16_t buf_len, const uint8_t *input, uint8_t *output, const uint8_t *tag, uint16_t tag_len)

Data decryption by AES algorithm with authentication check.

Parameters
[in]aes_typeHash type. Cannot be VS_HASH_SHA_INVALID.
[in]keyKey. Cannot be NULL.
[in]key_bitlenKey size in bits. Cannot be zero.
[in]ivIV. Cannot be NULL.
[in]iv_lenIV size. Cannot be zero.
[in]addAdditional data. Cannot be NULL.
[in]add_lenAdditional data size. Cannot be NULL.
[in]buf_lenBuffer size. Cannot be zero.
[in]inputInput buffer. Cannot be zero.
[out]outputOutput buffer. Cannot be NULL.
[in]tagTag buffer. Cannot be NULL.
[in]tag_lenTag size. Cannot be zero.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_aes_decrypt_t

typedef vs_status_e(* vs_secmodule_aes_decrypt_t) (vs_iot_aes_type_e aes_type, const uint8_t *key, uint16_t key_bitlen, const uint8_t *iv, uint16_t iv_len, const uint8_t *add, uint16_t add_len, uint16_t buf_len, const uint8_t *input, uint8_t *output, uint8_t *tag, uint16_t tag_len)

Data decryption by AES algorithm.

Parameters
[in]aes_typeHash type. Cannot be VS_HASH_SHA_INVALID.
[in]keyKey. Cannot be NULL.
[in]key_bitlenKey size in bits. Cannot be zero.
[in]ivIV. Cannot be NULL.
[in]iv_lenIV size. Cannot be zero.
[in]addAdditional data. Cannot be NULL.
[in]add_lenAdditional data size. Cannot be NULL.
[in]buf_lenBuffer size. Cannot be zero.
[in]inputInput buffer. Cannot be zero.
[out]outputOutput buffer. Cannot be NULL.
[out]tagTag buffer. Cannot be NULL.
[in]tag_lenTag size. Cannot be zero.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_aes_encrypt_t

typedef vs_status_e(* vs_secmodule_aes_encrypt_t) (vs_iot_aes_type_e aes_type, const uint8_t *key, uint16_t key_bitlen, const uint8_t *iv, uint16_t iv_len, const uint8_t *add, uint16_t add_len, uint16_t buf_len, const uint8_t *input, uint8_t *output, uint8_t *tag, uint16_t tag_len)

Data encryption by AES algorithm.

Parameters
[in]aes_typeHash type. Cannot be VS_HASH_SHA_INVALID.
[in]keyKey. Cannot be NULL.
[in]key_bitlenKey size in bits. Cannot be zero.
[in]ivIV. Cannot be NULL.
[in]iv_lenIV size. Cannot be zero.
[in]addAdditional data. Cannot be NULL.
[in]add_lenAdditional data size. Cannot be NULL.
[in]buf_lenBuffer size. Cannot be zero.
[in]inputInput buffer. Cannot be zero.
[out]outputOutput buffer. Cannot be NULL.
[out]tagTag buffer. Cannot be NULL.
[in]tag_lenTag size. Cannot be zero.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_deinit_t

typedef void(* vs_secmodule_deinit_t) (void)

Security Module destruction.

◆ vs_secmodule_ecdh_t

typedef vs_status_e(* vs_secmodule_ecdh_t) (vs_iot_secmodule_slot_e slot, vs_secmodule_keypair_type_e keypair_type, const uint8_t *public_key, uint16_t public_key_sz, uint8_t *shared_secret, uint16_t buf_sz, uint16_t *shared_secret_sz)

ECDH algorithm.

Parameters
[in]key_slotSlot number.
[in]keypair_typeKey pair type. Cannot be VS_KEYPAIR_INVALID or VS_KEYPAIR_MAX.
[in]public_keyPublic key buffer. Cannot be NULL.
[in]public_key_szPublic key size. Cannot be zero.
[in,out]shared_secretShared secret buffer. Cannot be NULL.
[in]buf_szShared secret buffer size. Cannot be zero.
[out]shared_secret_szOutput buffer to store shared secret buffer size. Cannot be NULL.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_ecdsa_sign_t

typedef vs_status_e(* vs_secmodule_ecdsa_sign_t) (vs_iot_secmodule_slot_e key_slot, vs_secmodule_hash_type_e hash_type, const uint8_t *hash, uint8_t *signature, uint16_t signature_buf_sz, uint16_t *signature_sz)

Signature calculation based on ECDSA.

Parameters
[in]key_slotSlot number.
[in]hash_typeHash type. Cannot be VS_HASH_SHA_INVALID.
[in]hashHash source for signature calculation. Cannot be NULL.
[out]signatureOutput buffer to store signature. Cannot be NULL.
[in]signature_buf_szOutput buffer size. Cannot be NULL.
[out]signature_szOutput buffer to store signature size. Cannot be NULL.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_ecdsa_verify_t

typedef vs_status_e(* vs_secmodule_ecdsa_verify_t) (vs_secmodule_keypair_type_e keypair_type, const uint8_t *public_key, uint16_t public_key_sz, vs_secmodule_hash_type_e hash_type, const uint8_t *hash, const uint8_t *signature, uint16_t signature_sz)

Signature verification based on ECDSA.

Parameters
[in]keypair_typeKey pair type. Cannot be VS_KEYPAIR_INVALID or VS_KEYPAIR_MAX.
[in]public_keyPublic key buffer. Cannot be NULL.
[in]public_key_szPublic key size. Cannot be zero.
[in]hash_typeHash type. Cannot be VS_HASH_SHA_INVALID.
[in]hashHash source for signature calculation. Cannot be NULL.
[in]signatureOutput buffer to store signature. Cannot be NULL.
[in]signature_szOutput buffer to store signature size. Cannot be NULL.
Returns
VS_CODE_OK in case of successful verifying or error code.

◆ vs_secmodule_hash_create_t

typedef vs_status_e(* vs_secmodule_hash_create_t) (vs_secmodule_hash_type_e hash_type, const uint8_t *data, uint16_t data_sz, uint8_t *hash, uint16_t hash_buf_sz, uint16_t *hash_sz)

Hash generation.

Parameters
[in]hash_typeHash type. Cannot by VS_HASH_SHA_INVALID.
[in]dataData source for hash calculation. Cannot be NULL.
[in]data_szData size. Cannot be zero.
[out]hashOutput buffer to store hash. Cannot be NULL.
[in]hash_buf_szOutput buffer size. Cannot be NULL.
[out]hash_szOutput buffer to store hash size. Cannot be NULL.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_hkdf_t

typedef vs_status_e(* vs_secmodule_hkdf_t) (vs_secmodule_hash_type_e hash_type, const uint8_t *input, uint16_t input_sz, const uint8_t *salt, uint16_t salt_sz, const uint8_t *info, uint16_t info_sz, uint8_t *output, uint16_t output_sz)

HKDF calculation.

Parameters
[in]hash_typeHash type. Cannot be VS_HASH_SHA_INVALID.
[in]inputInput data. Cannot be NULL.
[in]input_szInput data size. Cannot be zero.
[in]saltSalt data. Cannot be NULL.
[in]salt_szSalt data size. Cannot be zero.
[in]infoInformation data. Cannot be NULL.
[in]info_szInformation data size. Cannot be zero.
[out]outputOutput key buffer. Cannot be NULL.
[in]output_szOutput key size. Cannot be zero.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_hmac_t

typedef vs_status_e(* vs_secmodule_hmac_t) (vs_secmodule_hash_type_e hash_type, const uint8_t *key, uint16_t key_sz, const uint8_t *input, uint16_t input_sz, uint8_t *output, uint16_t output_buf_sz, uint16_t *output_sz)

HMAC calculation.

Parameters
[in]hash_typeHash type. Cannot be VS_HASH_SHA_INVALID.
[in]keyKey buffer. Cannot be NULL.
[in]key_szKey size. Cannot be zero.
[in]inputInput data. Cannot be NULL.
[in]input_szInput data size. Cannot be zero.
[out]outputOutput buffer. Cannot be NULL.
[in]output_buf_szOutput buffer size. Cannot be NULL.
[out]output_szOutput buffer to store output data size. Cannot be NULL.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_kdf_t

typedef vs_status_e(* vs_secmodule_kdf_t) (vs_secmodule_kdf_type_e kdf_type, vs_secmodule_hash_type_e hash_type, const uint8_t *input, uint16_t input_sz, uint8_t *output, uint16_t output_sz)

KDF calculation.

Parameters
[in]kdf_typeKDF algorithm. Cannot be VS_KDF_INVALID.
[in]hash_typeHash type. Cannot be VS_HASH_SHA_INVALID.
[in]inputInput data. Cannot be NULL.
[in]input_szInput data size. Cannot be zero.
[out]outputOutput key buffer. Cannot be NULL.
[in]output_szOutput key size. Cannot be zero.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_keypair_create_t

typedef vs_status_e(* vs_secmodule_keypair_create_t) (vs_iot_secmodule_slot_e slot, vs_secmodule_keypair_type_e keypair_type)

Key pair generate.

Parameters
[in]slotSlot ID to save key pair.
[in]keypair_typeKey pair type. Cannot be VS_KEYPAIR_INVALID or VS_KEYPAIR_MAX.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_keypair_get_pubkey_t

typedef vs_status_e(* vs_secmodule_keypair_get_pubkey_t) (vs_iot_secmodule_slot_e slot, uint8_t *buf, uint16_t buf_sz, uint16_t *key_sz, vs_secmodule_keypair_type_e *keypair_type)

Public key retrieval.

Note
Before calling this function, you should call vs_secmodule_keypair_create_t implementation first and store public key in slot.
Parameters
[in]slotSlot number.
[out]bufOutput buffer to store public key. Cannot be NULL.
[in]buf_szOutput buffer size. Cannot be NULL.
[out]key_szOutput buffer to store public key size. Cannot be NULL.
[out]keypair_typeOutput buffer to store key pair type. Cannot be NULL.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_random_t

typedef vs_status_e(* vs_secmodule_random_t) (uint8_t *output, uint16_t output_sz)

Random data generation.

Parameters
[out]outputOutput buffer. Cannot be NULL.
[in]output_szOutput buffer size. Cannot be zero.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_slot_delete_t

typedef vs_status_e(* vs_secmodule_slot_delete_t) (vs_iot_secmodule_slot_e slot)

Delete information from the slot.

Parameters
[in]slotSlot ID.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_slot_load_t

typedef vs_status_e(* vs_secmodule_slot_load_t) (vs_iot_secmodule_slot_e slot, uint8_t *data, uint16_t buf_sz, uint16_t *out_sz)

Load information to the slot.

Parameters
[in]slotSlot ID.
[out]dataData buffer for loaded information. Cannot be NULL.
[in]buf_szBuffer size. Cannot be zero.
[out]out_szLoaded data size buffer. Cannot be NULL.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_slot_save_t

typedef vs_status_e(* vs_secmodule_slot_save_t) (vs_iot_secmodule_slot_e slot, const uint8_t *data, uint16_t data_sz)

Save information to the slot.

Parameters
[in]slotSlot ID.
[in]dataData to be saved. Cannot be NULL.
[in]data_szData size. Cannot be zero.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_sw_sha256_final_t

typedef vs_status_e(* vs_secmodule_sw_sha256_final_t) (vs_secmodule_sw_sha256_ctx *ctx, uint8_t *digest)

SHA-256 context finalization.

Parameters
[in,out]ctxContext.
[out]digestProduced digest. Cannot be NULL.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_sw_sha256_init_t

typedef void(* vs_secmodule_sw_sha256_init_t) (vs_secmodule_sw_sha256_ctx *ctx)

SHA-256 context initialization.

Parameters
[out]ctxContext. Cannot be NULL.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_sw_sha256_update_t

typedef vs_status_e(* vs_secmodule_sw_sha256_update_t) (vs_secmodule_sw_sha256_ctx *ctx, const uint8_t *message, uint32_t len)

SHA-256 context update.

Parameters
[in,out]ctxContext.
[in]messageMessage update SHA-256 context. Cannot be NULL.
[in]lenMessage size. Cannot be zero.
Returns
VS_CODE_OK in case of success or error code.

Enumeration Type Documentation

◆ vs_iot_aes_type_e

AES mode.

Enumerator
VS_AES_GCM 

AES-GCM.

VS_AES_CBC 

AES-CBC.

◆ vs_secmodule_hash_type_e

Hash types.

Enumerator
VS_HASH_SHA_INVALID 

Invalid hash type.

VS_HASH_SHA_256 

SHA-256.

VS_HASH_SHA_384 

SHA-384.

VS_HASH_SHA_512 

SHA-512.

◆ vs_secmodule_kdf_type_e

KDF type.

Enumerator
VS_KDF_INVALID 
VS_KDF_2 

◆ vs_secmodule_keypair_type_e

Keypair types.

Enumerator
VS_KEYPAIR_INVALID 

Invalid keypair.

VS_KEYPAIR_EC_SECP_MIN 
VS_KEYPAIR_EC_SECP192R1 

192-bits NIST curve

VS_KEYPAIR_EC_SECP224R1 

224-bits NIST curve

VS_KEYPAIR_EC_SECP256R1 

256-bits NIST curve

VS_KEYPAIR_EC_SECP384R1 

384-bits NIST curve

VS_KEYPAIR_EC_SECP521R1 

521-bits NIST curve

VS_KEYPAIR_EC_SECP192K1 

192-bits "Koblitz" curve

VS_KEYPAIR_EC_SECP224K1 

224-bits "Koblitz" curve

VS_KEYPAIR_EC_SECP256K1 

256-bits "Koblitz" curve

VS_KEYPAIR_EC_SECP_MAX 
VS_KEYPAIR_EC_CURVE25519 

Curve25519.

VS_KEYPAIR_EC_ED25519 

Ed25519.

VS_KEYPAIR_MAX 

Function Documentation

◆ vs_secmodule_ecies_decrypt()

vs_status_e vs_secmodule_ecies_decrypt ( const vs_secmodule_impl_t secmodule_impl,
const uint8_t *  recipient_id,
size_t  recipient_id_sz,
const uint8_t *  cryptogram,
size_t  cryptogram_sz,
uint8_t *  decrypted_data,
size_t  buf_sz,
size_t *  decrypted_data_sz 
)

ECIES decryption for AES-256 based on SHA-384.

Parameters
[in]secmodule_implSecmodule implementation. Cannot be NULL.
[in]recipient_idRecipient ID. Cannot be NULL.
[in]recipient_id_szRecipient ID size. Cannot be NULL.
[in]cryptogramCryptogram buffer. Cannot be NULL.
[in]cryptogram_szCryptogram buffer size. Cannot be NULL.
[out]decrypted_dataDecrypted data output buffer. Cannot be NULL.
[in]buf_szDecrypted data buffer size. Cannot be zero.
[out]decrypted_data_szDecrypted data size. Cannot be NULL.
Returns
VS_CODE_OK in case of success or error code.

◆ vs_secmodule_ecies_encrypt()

vs_status_e vs_secmodule_ecies_encrypt ( const vs_secmodule_impl_t secmodule_impl,
const uint8_t *  recipient_id,
size_t  recipient_id_sz,
const uint8_t *  data,
size_t  data_sz,
uint8_t *  cryptogram,
size_t  buf_sz,
size_t *  cryptogram_sz 
)

ECIES encryption for AES-256 based on SHA-384.

Parameters
[in]secmodule_implSecmodule implementation. Cannot be NULL.
[in]recipient_idRecipient ID. Cannot be NULL.
[in]recipient_id_szRecipient ID size. Cannot be NULL.
[in]cryptogramCryptogram buffer. Cannot be NULL.
[in]cryptogram_szCryptogram buffer size. Cannot be NULL.
[out]decrypted_dataDecrypted data output buffer. Cannot be NULL.
[in]buf_szDecrypted data buffer size. Cannot be zero.
[out]decrypted_data_szDecrypted data size. Cannot be NULL.
Returns
VS_CODE_OK in case of success or error code.
vs_secmodule_impl_t
Security Module implementation.
Definition: secmodule.h:458
vs_soft_secmodule_deinit
vs_status_e vs_soft_secmodule_deinit(void)
Destroy software crypto implementation.
vs_soft_secmodule_impl
vs_secmodule_impl_t * vs_soft_secmodule_impl(vs_storage_op_ctx_t *slots_storage_impl)
Initialize software crypto implementation.
vs_storage_op_ctx_t
Storage element context.
Definition: storage_hal.h:221