context,
aes_ctr_algo,
sha256_hash,
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_PKCS7,
key_id,
key_pwd_iv_tag,
data,
context,
aes_ctr_algo,
sha256_hash,
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_PKCS7,
key_id,
key_pwd_iv_tag,
*(encrypted.Get()),
context,
aes_ctr_algo,
sha256_hash,
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_PKCS7,
encapsulated_key_id,
encapsulated_key_pwd_iv_tag,
data,
context,
aes_ctr_algo,
sha256_hash,
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_PKCS7,
decapsulated_key_id,
decapsulated_key_pwd_iv_tag,
*(encrypted.Get()),
context,
aes_ctr_algo,
sha256_hash,
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_PKCS7,
key_to_wrap_id,
key_to_wrap_pwd_iv_tag,
data,
context,
aes_ctr_algo,
sha256_hash,
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_PKCS7,
import_key_id,
imported_key_pwd_iv_tag,
*(encrypted.Get()),
int (*encrypt_data)(const hal_security_keys_context_s context,
const hal_security_keys_algo_type_e algo,
const hal_security_keys_hash_algorithm_e hash,
+ const hal_security_keys_padding_algorithm_e padding,
const hal_security_keys_data_s key_id,
const hal_security_keys_password_iv_tag_s key_pwd,
const hal_security_keys_data_s data,
int (*decrypt_data)(const hal_security_keys_context_s context,
const hal_security_keys_algo_type_e algo,
const hal_security_keys_hash_algorithm_e hash,
+ const hal_security_keys_padding_algorithm_e padding,
const hal_security_keys_data_s key_id,
const hal_security_keys_password_iv_tag_s key_pwd,
const hal_security_keys_data_s data,
HAL_SECURITY_KEYS_HASH_ALGORITHM_SHA512, /**< SHA512 */
} hal_security_keys_hash_algorithm_e;
+/**
+ * @brief Enumeration for padding algorithm.
+ * @since HAL_MODULE_SECURITY_KEYS 1.0
+ */
+typedef enum {
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_NONE, /**< None */
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_PKCS7, /**< PKCS#7 */
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_ISO9797_M2, /**< ISO9797 method 2 padding */
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_PKCS1, /**< PKCS#1 */
+ HAL_SECURITY_KEYS_PADDING_ALGORITHM_X931, /**< X391 */
+} hal_security_keys_padding_algorithm_e;
+
/**
* @brief Enumeration for KDF PRF type.
* @since HAL_MODULE_SECURITY_KEYS 1.0
int hal_security_keys_encrypt_data(const hal_security_keys_context_s context,
const hal_security_keys_algo_type_e algo,
const hal_security_keys_hash_algorithm_e hash,
+ const hal_security_keys_padding_algorithm_e padding,
const hal_security_keys_data_s key_id,
const hal_security_keys_password_iv_tag_s key_pwd,
const hal_security_keys_data_s data,
int hal_security_keys_decrypt_data(const hal_security_keys_context_s context,
const hal_security_keys_algo_type_e algo,
const hal_security_keys_hash_algorithm_e hash,
+ const hal_security_keys_padding_algorithm_e padding,
const hal_security_keys_data_s key_id,
const hal_security_keys_password_iv_tag_s key_pwd,
const hal_security_keys_data_s data,
EXPORT int hal_security_keys_encrypt_data(const hal_security_keys_context_s context,
const hal_security_keys_algo_type_e algo,
const hal_security_keys_hash_algorithm_e hash,
+ const hal_security_keys_padding_algorithm_e padding,
const hal_security_keys_data_s key_id,
const hal_security_keys_password_iv_tag_s key_pwd,
const hal_security_keys_data_s data,
{
if (!g_security_keys_funcs)
return HAL_SECURITY_KEYS_ERROR_NOT_SUPPORTED;
- return g_security_keys_funcs->encrypt_data(context, algo, hash, key_id, key_pwd, data, iv, out);
+ return g_security_keys_funcs->encrypt_data(context, algo, hash, padding, key_id, key_pwd, data, iv, out);
}
EXPORT int hal_security_keys_decrypt_data(const hal_security_keys_context_s context,
const hal_security_keys_algo_type_e algo,
const hal_security_keys_hash_algorithm_e hash,
+ const hal_security_keys_padding_algorithm_e padding,
const hal_security_keys_data_s key_id,
const hal_security_keys_password_iv_tag_s key_pwd,
const hal_security_keys_data_s data,
{
if (!g_security_keys_funcs)
return HAL_SECURITY_KEYS_ERROR_NOT_SUPPORTED;
- return g_security_keys_funcs->decrypt_data(context, algo, hash, key_id, key_pwd, data, iv, out);
+ return g_security_keys_funcs->decrypt_data(context, algo, hash, padding, key_id, key_pwd, data, iv, out);
}
EXPORT int hal_security_keys_destroy_data(const hal_security_keys_context_s context,