libnx  v4.8.0
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;
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;
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;
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);
Hardware accelerated AES-ECB implementation.
void aes192CtrContextCreate(Aes192CtrContext *out, const void *key, const void *ctr)
192-bit CTR API.
void aes256CtrContextCreate(Aes256CtrContext *out, const void *key, const void *ctr)
256-bit CTR API.
void aes128CtrContextCreate(Aes128CtrContext *out, const void *key, const void *ctr)
128-bit CTR API.
Context for AES-128 operations.
Definition: aes.h:41
Context for AES-128 CTR.
Definition: aes_ctr.h:10
Context for AES-192 operations.
Definition: aes.h:46
Context for AES-192 CTR.
Definition: aes_ctr.h:18
Context for AES-256 operations.
Definition: aes.h:51
Context for AES-256 CTR.
Definition: aes_ctr.h:26
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19