libnx
v4.7.0
include
switch
crypto
aes_ctr.h
Go to the documentation of this file.
1
/**
2
* @file aes_ctr.h
3
* @brief Hardware accelerated AES-CTR implementation.
4
* @copyright libnx Authors
5
*/
6
#pragma once
7
#include "
aes.h
"
8
9
/// Context for AES-128 CTR.
10
typedef
struct
{
11
Aes128Context
aes_ctx;
12
u8
ctr[AES_BLOCK_SIZE];
13
u8
enc_ctr_buffer[AES_BLOCK_SIZE];
14
size_t
buffer_offset;
15
}
Aes128CtrContext
;
16
17
/// Context for AES-192 CTR.
18
typedef
struct
{
19
Aes192Context
aes_ctx;
20
u8
ctr[AES_BLOCK_SIZE];
21
u8
enc_ctr_buffer[AES_BLOCK_SIZE];
22
size_t
buffer_offset;
23
}
Aes192CtrContext
;
24
25
/// Context for AES-256 CTR.
26
typedef
struct
{
27
Aes256Context
aes_ctx;
28
u8
ctr[AES_BLOCK_SIZE];
29
u8
enc_ctr_buffer[AES_BLOCK_SIZE];
30
size_t
buffer_offset;
31
}
Aes256CtrContext
;
32
33
/// 128-bit CTR API.
34
void
aes128CtrContextCreate
(
Aes128CtrContext
*out,
const
void
*key,
const
void
*ctr);
35
void
aes128CtrContextResetCtr(
Aes128CtrContext
*ctx,
const
void
*ctr);
36
void
aes128CtrCrypt(
Aes128CtrContext
*ctx,
void
*dst,
const
void
*src,
size_t
size);
37
38
/// 192-bit CTR API.
39
void
aes192CtrContextCreate
(
Aes192CtrContext
*out,
const
void
*key,
const
void
*ctr);
40
void
aes192CtrContextResetCtr(
Aes192CtrContext
*ctx,
const
void
*ctr);
41
void
aes192CtrCrypt(
Aes192CtrContext
*ctx,
void
*dst,
const
void
*src,
size_t
size);
42
43
/// 256-bit CTR API.
44
void
aes256CtrContextCreate
(
Aes256CtrContext
*out,
const
void
*key,
const
void
*ctr);
45
void
aes256CtrContextResetCtr(
Aes256CtrContext
*ctx,
const
void
*ctr);
46
void
aes256CtrCrypt(
Aes256CtrContext
*ctx,
void
*dst,
const
void
*src,
size_t
size);
aes.h
Hardware accelerated AES-ECB implementation.
aes192CtrContextCreate
void aes192CtrContextCreate(Aes192CtrContext *out, const void *key, const void *ctr)
192-bit CTR API.
aes256CtrContextCreate
void aes256CtrContextCreate(Aes256CtrContext *out, const void *key, const void *ctr)
256-bit CTR API.
aes128CtrContextCreate
void aes128CtrContextCreate(Aes128CtrContext *out, const void *key, const void *ctr)
128-bit CTR API.
Aes128Context
Context for AES-128 operations.
Definition:
aes.h:41
Aes128CtrContext
Context for AES-128 CTR.
Definition:
aes_ctr.h:10
Aes192Context
Context for AES-192 operations.
Definition:
aes.h:46
Aes192CtrContext
Context for AES-192 CTR.
Definition:
aes_ctr.h:18
Aes256Context
Context for AES-256 operations.
Definition:
aes.h:51
Aes256CtrContext
Context for AES-256 CTR.
Definition:
aes_ctr.h:26
u8
uint8_t u8
8-bit unsigned integer.
Definition:
types.h:19
Generated by
1.9.1