libnx  v4.8.0
aes_cbc.h
Go to the documentation of this file.
1 /**
2  * @file aes_cbc.h
3  * @brief Hardware accelerated AES-CBC implementation.
4  * @copyright libnx Authors
5  */
6 #pragma once
7 #include "aes.h"
8 
9 /// Context for AES-128 CBC.
10 typedef struct {
11  Aes128Context aes_ctx;
12  u8 iv[AES_BLOCK_SIZE];
13  u8 buffer[AES_BLOCK_SIZE];
14  size_t num_buffered;
16 
17 /// Context for AES-192 CBC.
18 typedef struct {
19  Aes192Context aes_ctx;
20  u8 iv[AES_BLOCK_SIZE];
21  u8 buffer[AES_BLOCK_SIZE];
22  size_t num_buffered;
24 
25 /// Context for AES-256 CBC.
26 typedef struct {
27  Aes256Context aes_ctx;
28  u8 iv[AES_BLOCK_SIZE];
29  u8 buffer[AES_BLOCK_SIZE];
30  size_t num_buffered;
32 
33 /// 128-bit CBC API.
34 void aes128CbcContextCreate(Aes128CbcContext *out, const void *key, const void *iv, bool is_encryptor);
35 void aes128CbcContextResetIv(Aes128CbcContext *ctx, const void *iv);
36 size_t aes128CbcEncrypt(Aes128CbcContext *ctx, void *dst, const void *src, size_t size);
37 size_t aes128CbcDecrypt(Aes128CbcContext *ctx, void *dst, const void *src, size_t size);
38 
39 /// 192-bit CBC API.
40 void aes192CbcContextCreate(Aes192CbcContext *out, const void *key, const void *iv, bool is_encryptor);
41 void aes192CbcContextResetIv(Aes192CbcContext *ctx, const void *iv);
42 size_t aes192CbcEncrypt(Aes192CbcContext *ctx, void *dst, const void *src, size_t size);
43 size_t aes192CbcDecrypt(Aes192CbcContext *ctx, void *dst, const void *src, size_t size);
44 
45 /// 256-bit CBC API.
46 void aes256CbcContextCreate(Aes256CbcContext *out, const void *key, const void *iv, bool is_encryptor);
47 void aes256CbcContextResetIv(Aes256CbcContext *ctx, const void *iv);
48 size_t aes256CbcEncrypt(Aes256CbcContext *ctx, void *dst, const void *src, size_t size);
49 size_t aes256CbcDecrypt(Aes256CbcContext *ctx, void *dst, const void *src, size_t size);
Hardware accelerated AES-ECB implementation.
void aes192CbcContextCreate(Aes192CbcContext *out, const void *key, const void *iv, bool is_encryptor)
192-bit CBC API.
void aes128CbcContextCreate(Aes128CbcContext *out, const void *key, const void *iv, bool is_encryptor)
128-bit CBC API.
void aes256CbcContextCreate(Aes256CbcContext *out, const void *key, const void *iv, bool is_encryptor)
256-bit CBC API.
Context for AES-128 CBC.
Definition: aes_cbc.h:10
Context for AES-128 operations.
Definition: aes.h:41
Context for AES-192 CBC.
Definition: aes_cbc.h:18
Context for AES-192 operations.
Definition: aes.h:46
Context for AES-256 CBC.
Definition: aes_cbc.h:26
Context for AES-256 operations.
Definition: aes.h:51
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19