Go to the documentation of this file.
61 #ifndef VS_SECMODULE_INTERFACE_API_H
62 #define VS_SECMODULE_INTERFACE_API_H
71 namespace VirgilIoTKit {
117 unsigned char buffer[64];
167 uint16_t hash_buf_sz,
214 uint16_t signature_buf_sz,
215 uint16_t *signature_sz);
230 const uint8_t *public_key,
231 uint16_t public_key_sz,
234 const uint8_t *signature,
235 uint16_t signature_sz);
253 const uint8_t *input,
256 uint16_t output_buf_sz,
257 uint16_t *output_sz);
272 const uint8_t *input,
292 const uint8_t *input,
335 const uint8_t *input,
365 const uint8_t *input,
395 const uint8_t *input,
414 const uint8_t *public_key,
415 uint16_t public_key_sz,
416 uint8_t *shared_secret,
418 uint16_t *shared_secret_sz);
437 const uint8_t *message,
518 const uint8_t *recipient_id,
519 size_t recipient_id_sz,
520 const uint8_t *cryptogram,
521 size_t cryptogram_sz,
522 uint8_t *decrypted_data,
524 size_t *decrypted_data_sz);
541 const uint8_t *recipient_id,
542 size_t recipient_id_sz,
547 size_t *cryptogram_sz);
554 #endif // VS_SECMODULE_INTERFACE_API_H
@ VS_KEYPAIR_EC_SECP192K1
192-bits "Koblitz" curve
Definition: secmodule.h:84
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.
Definition: secmodule.h:291
@ VS_KEYPAIR_EC_ED25519
Ed25519.
Definition: secmodule.h:89
vs_status_e(* vs_secmodule_keypair_create_t)(vs_iot_secmodule_slot_e slot, vs_secmodule_keypair_type_e keypair_type)
Key pair generate.
Definition: secmodule.h:177
@ VS_KEYPAIR_EC_SECP_MIN
Definition: secmodule.h:78
void(* vs_secmodule_sw_sha256_init_t)(vs_secmodule_sw_sha256_ctx *ctx)
SHA-256 context initialization.
Definition: secmodule.h:426
vs_secmodule_sw_sha256_update_t hash_update
SHA-256 update.
Definition: secmodule.h:488
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.
Definition: secmodule.h:229
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.
Definition: secmodule.h:387
vs_secmodule_hmac_t hmac
HMAC calculate.
Definition: secmodule.h:493
SHA-256 context.
Definition: secmodule.h:114
Security Module implementation.
Definition: secmodule.h:458
@ VS_HASH_SHA_512
SHA-512.
Definition: secmodule.h:98
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.
Definition: secmodule.h:128
vs_secmodule_sw_sha256_final_t hash_finish
SHA-256 finalization.
Definition: secmodule.h:489
vs_status_e(* vs_secmodule_sw_sha256_final_t)(vs_secmodule_sw_sha256_ctx *ctx, uint8_t *digest)
SHA-256 context finalization.
Definition: secmodule.h:447
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.
Definition: secmodule.h:163
vs_secmodule_kdf_t kdf
KDF calculate.
Definition: secmodule.h:496
void(* vs_secmodule_deinit_t)(void)
Security Module destruction.
Definition: secmodule.h:450
vs_status_e
Status code.
Definition: status_code.h:77
vs_status_e(* vs_secmodule_slot_delete_t)(vs_iot_secmodule_slot_e slot)
Delete information from the slot.
Definition: secmodule.h:150
vs_secmodule_ecdsa_sign_t ecdsa_sign
ECDSA sign.
Definition: secmodule.h:475
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.
Definition: secmodule.h:436
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.
Definition: secmodule.h:412
@ VS_HASH_SHA_INVALID
Invalid hash type.
Definition: secmodule.h:95
vs_secmodule_aes_encrypt_t aes_encrypt
AES encrypt.
Definition: secmodule.h:482
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.
Definition: secmodule.h:210
vs_secmodule_aes_auth_decrypt_t aes_auth_decrypt
AES decrypt with authentication.
Definition: secmodule.h:484
@ VS_KDF_2
Definition: secmodule.h:104
vs_iot_aes_type_e
AES mode.
Definition: secmodule.h:108
vs_secmodule_keypair_get_pubkey_t get_pubkey
Get public key.
Definition: secmodule.h:472
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.
@ VS_KEYPAIR_EC_SECP224R1
224-bits NIST curve
Definition: secmodule.h:80
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.
Definition: secmodule.h:193
@ VS_KEYPAIR_EC_SECP384R1
384-bits NIST curve
Definition: secmodule.h:82
vs_secmodule_sw_sha256_init_t hash_init
SHA-256 hash initialize.
Definition: secmodule.h:487
vs_secmodule_hash_create_t hash
Create hash.
Definition: secmodule.h:490
@ VS_KEYPAIR_EC_SECP256R1
256-bits NIST curve
Definition: secmodule.h:81
@ VS_KEYPAIR_EC_SECP_MAX
Definition: secmodule.h:87
@ VS_KDF_INVALID
Definition: secmodule.h:103
Status codes and macroses.
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.
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.
Definition: secmodule.h:250
@ VS_HASH_SHA_256
SHA-256.
Definition: secmodule.h:96
@ VS_AES_GCM
AES-GCM.
Definition: secmodule.h:109
Software Security Module constants.
vs_secmodule_hash_type_e
Hash types.
Definition: secmodule.h:94
@ VS_KEYPAIR_EC_SECP521R1
521-bits NIST curve
Definition: secmodule.h:83
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.
Definition: secmodule.h:357
@ VS_KEYPAIR_EC_SECP256K1
256-bits "Koblitz" curve
Definition: secmodule.h:86
@ VS_KEYPAIR_MAX
Definition: secmodule.h:90
vs_iot_secmodule_slot_e
Slots identifiers.
Definition: secmodule-soft.h:59
vs_secmodule_keypair_create_t create_keypair
Key pair generation.
Definition: secmodule.h:471
@ VS_KEYPAIR_EC_SECP224K1
224-bits "Koblitz" curve
Definition: secmodule.h:85
@ VS_AES_CBC
AES-CBC.
Definition: secmodule.h:110
vs_secmodule_keypair_type_e
Keypair types.
Definition: secmodule.h:76
vs_secmodule_deinit_t deinit
Security module destruction.
Definition: secmodule.h:460
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.
Definition: secmodule.h:327
@ VS_KEYPAIR_EC_SECP192R1
192-bits NIST curve
Definition: secmodule.h:79
vs_secmodule_kdf_type_e
KDF type.
Definition: secmodule.h:102
@ VS_HASH_SHA_384
SHA-384.
Definition: secmodule.h:97
vs_secmodule_random_t random
Get random data.
Definition: secmodule.h:468
vs_secmodule_slot_save_t slot_save
Slot save information.
Definition: secmodule.h:463
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.
Definition: secmodule.h:139
@ VS_KEYPAIR_EC_CURVE25519
Curve25519.
Definition: secmodule.h:88
vs_secmodule_slot_delete_t slot_clean
Slot delete.
Definition: secmodule.h:465
vs_secmodule_ecdsa_verify_t ecdsa_verify
ECDSA verify.
Definition: secmodule.h:476
vs_secmodule_hkdf_t hkdf
HKDF calculate.
Definition: secmodule.h:499
vs_secmodule_ecdh_t ecdh
ECDH.
Definition: secmodule.h:479
vs_secmodule_aes_decrypt_t aes_decrypt
AES decrypt.
Definition: secmodule.h:483
vs_secmodule_slot_load_t slot_load
Slot load information.
Definition: secmodule.h:464
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.
Definition: secmodule.h:270
@ VS_KEYPAIR_INVALID
Invalid keypair.
Definition: secmodule.h:77
vs_status_e(* vs_secmodule_random_t)(uint8_t *output, uint16_t output_sz)
Random data generation.
Definition: secmodule.h:308