libnx
v4.7.0
include
switch
crypto
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;
15
}
Aes128CbcContext
;
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;
23
}
Aes192CbcContext
;
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;
31
}
Aes256CbcContext
;
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);
aes.h
Hardware accelerated AES-ECB implementation.
aes192CbcContextCreate
void aes192CbcContextCreate(Aes192CbcContext *out, const void *key, const void *iv, bool is_encryptor)
192-bit CBC API.
aes128CbcContextCreate
void aes128CbcContextCreate(Aes128CbcContext *out, const void *key, const void *iv, bool is_encryptor)
128-bit CBC API.
aes256CbcContextCreate
void aes256CbcContextCreate(Aes256CbcContext *out, const void *key, const void *iv, bool is_encryptor)
256-bit CBC API.
Aes128CbcContext
Context for AES-128 CBC.
Definition:
aes_cbc.h:10
Aes128Context
Context for AES-128 operations.
Definition:
aes.h:41
Aes192CbcContext
Context for AES-192 CBC.
Definition:
aes_cbc.h:18
Aes192Context
Context for AES-192 operations.
Definition:
aes.h:46
Aes256CbcContext
Context for AES-256 CBC.
Definition:
aes_cbc.h:26
Aes256Context
Context for AES-256 operations.
Definition:
aes.h:51
u8
uint8_t u8
8-bit unsigned integer.
Definition:
types.h:19
Generated by
1.9.1