1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/crypto/psa_riot_cipher/aes_common.h
2023-08-31 14:38:50 +02:00

60 lines
1.4 KiB
C

/*
* Copyright (C) 2022 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @cond
* @ingroup sys_crypto
* @{
*
* @brief Glue code translating between PSA Crypto and the RIOT Cipher module
*
* @author Lena Boeckmann <lena.boeckmann@haw-hamburg.de>
*
*/
#ifndef AES_COMMON_H
#define AES_COMMON_H
#ifdef __cplusplus
extern "C" {
#endif
#include "psa/crypto.h"
#include "crypto/modes/cbc.h"
/**
* @brief Converts errors of the RIOT cipher module to PSA status values
*
* @param error
* @return @ref psa_status_t
*/
psa_status_t cipher_to_psa_error(int error);
/**
* @brief Common AES CBC Encrypt function
*
* @return @ref psa_status_t
*/
psa_status_t cbc_aes_common_encrypt_decrypt(cipher_t *ctx,
const uint8_t *key_buffer,
size_t key_buffer_size,
const uint8_t *iv,
const uint8_t *input,
size_t input_length,
uint8_t *output,
size_t *output_length,
psa_encrypt_or_decrypt_t direction);
#ifdef __cplusplus
}
#endif
#endif /* AES_COMMON_H */
/** @} */
/** @endcond */