Virgil IoT KIT
|
Security module helper functions. More...
#include <virgil/iot/secmodule/secmodule.h>
Go to the source code of this file.
Macros | |
#define | VS_PUBKEY_SECP192_LEN (49) |
#define | VS_PUBKEY_SECP224_LEN (57) |
#define | VS_PUBKEY_SECP256_LEN (65) |
#define | VS_PUBKEY_SECP384_LEN (97) |
#define | VS_PUBKEY_SECP521_LEN (133) |
#define | VS_PUBKEY_25519_LEN (32) |
#define | VS_SIGNATURE_SECP192_LEN (48) |
#define | VS_SIGNATURE_SECP224_LEN (56) |
#define | VS_SIGNATURE_SECP256_LEN (64) |
#define | VS_SIGNATURE_SECP384_LEN (96) |
#define | VS_SIGNATURE_SECP521_LEN (132) |
#define | VS_SIGNATURE_25519_LEN (64) |
#define | VS_HASH_SHA256_LEN (32) |
#define | VS_HASH_SHA384_LEN (48) |
#define | VS_HASH_SHA512_LEN (64) |
#define | VS_AES_256_KEY_SIZE (32) |
#define | VS_AES_256_KEY_BITLEN (VS_AES_256_KEY_SIZE * 8) |
#define | VS_AES_256_BLOCK_SIZE (16) |
#define | VS_AES_256_GCM_IV_SIZE (12) |
#define | VS_AES_256_GCM_AUTH_TAG_SIZE (16) |
#define | VS_AES_256_CBC_IV_SIZE (16) |
Functions | |
int | vs_secmodule_get_pubkey_len (vs_secmodule_keypair_type_e keypair_type) |
Get public key length. More... | |
int | vs_secmodule_get_signature_len (vs_secmodule_keypair_type_e keypair_type) |
Get signature length. More... | |
int | vs_secmodule_get_hash_len (vs_secmodule_hash_type_e hash_type) |
Get hash length. More... | |
const char * | vs_secmodule_keypair_type_descr (vs_secmodule_keypair_type_e type) |
Get key pair type description. More... | |
const char * | vs_secmodule_hash_type_descr (vs_secmodule_hash_type_e type) |
Get hash type description. More... | |
vs_status_e | vs_secmodule_virgil_secp256_signature_to_tiny (const uint8_t *virgil_sign, uint16_t virgil_sign_sz, uint8_t *raw_signature, uint16_t buf_sz) |
Convert a NIST256 signature from a Virgil format to raw. More... | |
vs_status_e | vs_secmodule_tiny_secp256_signature_to_virgil (const uint8_t raw_signature[VS_SIGNATURE_SECP256_LEN], uint8_t *virgil_sign, uint16_t buf_sz, uint16_t *virgil_sign_sz) |
Convert a NIST-256 signature from raw format to Virgil format. More... | |
Security module helper functions.
This header contains different helper functions for performing cryptographic operations
#define VS_AES_256_BLOCK_SIZE (16) |
#define VS_AES_256_CBC_IV_SIZE (16) |
#define VS_AES_256_GCM_AUTH_TAG_SIZE (16) |
#define VS_AES_256_GCM_IV_SIZE (12) |
#define VS_AES_256_KEY_BITLEN (VS_AES_256_KEY_SIZE * 8) |
#define VS_AES_256_KEY_SIZE (32) |
#define VS_HASH_SHA256_LEN (32) |
#define VS_HASH_SHA384_LEN (48) |
#define VS_HASH_SHA512_LEN (64) |
#define VS_PUBKEY_25519_LEN (32) |
#define VS_PUBKEY_SECP192_LEN (49) |
#define VS_PUBKEY_SECP224_LEN (57) |
#define VS_PUBKEY_SECP256_LEN (65) |
#define VS_PUBKEY_SECP384_LEN (97) |
#define VS_PUBKEY_SECP521_LEN (133) |
#define VS_SIGNATURE_25519_LEN (64) |
#define VS_SIGNATURE_SECP192_LEN (48) |
#define VS_SIGNATURE_SECP224_LEN (56) |
#define VS_SIGNATURE_SECP256_LEN (64) |
#define VS_SIGNATURE_SECP384_LEN (96) |
#define VS_SIGNATURE_SECP521_LEN (132) |
int vs_secmodule_get_hash_len | ( | vs_secmodule_hash_type_e | hash_type | ) |
Get hash length.
This function returns hash length for supported and enabled hash types.
[in] | hash_type | Hash type. Cannot be VS_HASH_SHA_INVALID. |
int vs_secmodule_get_pubkey_len | ( | vs_secmodule_keypair_type_e | keypair_type | ) |
Get public key length.
This function returns public key length for supported and enabled key pair types.
[in] | keypair_type | Key pair type. Cannot be VS_KEYPAIR_INVALID or VS_KEYPAIR_MAX. |
int vs_secmodule_get_signature_len | ( | vs_secmodule_keypair_type_e | keypair_type | ) |
Get signature length.
This function returns signature length for supported and enabled signature types.
[in] | keypair_type | Key pair type. Cannot be VS_KEYPAIR_INVALID or VS_KEYPAIR_MAX. |
const char* vs_secmodule_hash_type_descr | ( | vs_secmodule_hash_type_e | type | ) |
Get hash type description.
This function returns hash ASCIIZ description for supported and enable hash types
[in] | hash_type | Hash type. Cannot be VS_HASH_SHA_INVALID. |
const char* vs_secmodule_keypair_type_descr | ( | vs_secmodule_keypair_type_e | type | ) |
Get key pair type description.
This function returns key pair ASCIIZ description for supported and enable key pair types
[in] | type | Key pair type. Cannot be VS_KEYPAIR_INVALID or VS_KEYPAIR_MAX. |
vs_status_e vs_secmodule_tiny_secp256_signature_to_virgil | ( | const uint8_t | raw_signature[VS_SIGNATURE_SECP256_LEN], |
uint8_t * | virgil_sign, | ||
uint16_t | buf_sz, | ||
uint16_t * | virgil_sign_sz | ||
) |
Convert a NIST-256 signature from raw format to Virgil format.
[in] | raw_signature | Pointer to the signature in raw format. Cannot be NULL. |
[in] | virgil_sign | Pointer to the signature in Virgil format. Cannot be NULL. |
[in] | buf_sz | Size of buffer for raw signature |
[out] | virgil_sign_sz | Pointer to size of the signature in Virgil format. Cannot be NULL. |
vs_status_e vs_secmodule_virgil_secp256_signature_to_tiny | ( | const uint8_t * | virgil_sign, |
uint16_t | virgil_sign_sz, | ||
uint8_t * | raw_signature, | ||
uint16_t | buf_sz | ||
) |
Convert a NIST256 signature from a Virgil format to raw.
[in] | virgil_sign | Pointer to the signature in Virgil format. Cannot be NULL. |
[in] | virgil_sign_sz | Size of the signature in Virgil format. |
[out] | raw_signature | Pointer to the signature in raw format. Cannot be NULL. |
[in] | buf_sz | Size of buffer for raw signature |