RetroArch
aes.h
Go to the documentation of this file.
1 
23 #ifndef MBEDTLS_AES_H
24 #define MBEDTLS_AES_H
25 
26 #if !defined(MBEDTLS_CONFIG_FILE)
27 #include "config.h"
28 #else
29 #include MBEDTLS_CONFIG_FILE
30 #endif
31 
32 #include <stddef.h>
33 #include <stdint.h>
34 
35 /* padlock.c and aesni.c rely on these values! */
36 #define MBEDTLS_AES_ENCRYPT 1
37 #define MBEDTLS_AES_DECRYPT 0
38 
39 #define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH -0x0020
40 #define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH -0x0022
42 #if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
43  !defined(inline) && !defined(__cplusplus)
44 #define inline __inline
45 #endif
46 
47 #if !defined(MBEDTLS_AES_ALT)
48 /* Regular implementation */
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
62 typedef struct
63 {
64  int nr;
66  uint32_t buf[68];
67 }
69 
76 
83 
93 int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
94  unsigned int keybits );
95 
105 int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
106  unsigned int keybits );
107 
119  int mode,
120  const unsigned char input[16],
121  unsigned char output[16] );
122 
123 #if defined(MBEDTLS_CIPHER_MODE_CBC)
124 
147  int mode,
148  size_t length,
149  unsigned char iv[16],
150  const unsigned char *input,
151  unsigned char *output );
152 #endif /* MBEDTLS_CIPHER_MODE_CBC */
153 
154 #if defined(MBEDTLS_CIPHER_MODE_CFB)
155 
181  int mode,
182  size_t length,
183  size_t *iv_off,
184  unsigned char iv[16],
185  const unsigned char *input,
186  unsigned char *output );
187 
213  int mode,
214  size_t length,
215  unsigned char iv[16],
216  const unsigned char *input,
217  unsigned char *output );
218 #endif /*MBEDTLS_CIPHER_MODE_CFB */
219 
220 #if defined(MBEDTLS_CIPHER_MODE_CTR)
221 
244  size_t length,
245  size_t *nc_off,
246  unsigned char nonce_counter[16],
247  unsigned char stream_block[16],
248  const unsigned char *input,
249  unsigned char *output );
250 #endif /* MBEDTLS_CIPHER_MODE_CTR */
251 
264  const unsigned char input[16],
265  unsigned char output[16] );
266 
279  const unsigned char input[16],
280  unsigned char output[16] );
281 
282 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
283 #if defined(MBEDTLS_DEPRECATED_WARNING)
284 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
285 #else
286 #define MBEDTLS_DEPRECATED
287 #endif
288 
299  const unsigned char input[16],
300  unsigned char output[16] );
301 
313  const unsigned char input[16],
314  unsigned char output[16] );
315 
316 #undef MBEDTLS_DEPRECATED
317 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
318 
319 #ifdef __cplusplus
320 }
321 #endif
322 
323 #else /* MBEDTLS_AES_ALT */
324 #include "aes_alt.h"
325 #endif /* MBEDTLS_AES_ALT */
326 
327 #ifdef __cplusplus
328 extern "C" {
329 #endif
330 
336 int mbedtls_aes_self_test( int verbose );
337 
338 #ifdef __cplusplus
339 }
340 #endif
341 
342 #endif /* aes.h */
int mbedtls_aes_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits)
AES key schedule (decryption)
Definition: aes.c:595
void mbedtls_aes_free(mbedtls_aes_context *ctx)
Clear AES context.
Definition: aes.c:469
GLenum mode
Definition: glext.h:6857
Configuration options (set of defines)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
int mbedtls_aes_crypt_ctr(mbedtls_aes_context *ctx, size_t length, size_t *nc_off, unsigned char nonce_counter[16], unsigned char stream_block[16], const unsigned char *input, unsigned char *output)
AES-CTR buffer encryption/decryption.
Definition: aes.c:1019
MBEDTLS_DEPRECATED void mbedtls_aes_decrypt(mbedtls_aes_context *ctx, const unsigned char input[16], unsigned char output[16])
Deprecated internal AES block decryption function without return value.
Definition: aes.c:831
int mbedtls_internal_aes_decrypt(mbedtls_aes_context *ctx, const unsigned char input[16], unsigned char output[16])
Internal AES block decryption function (Only exposed to allow overriding it, see MBEDTLS_AES_DECRYPT_...
Definition: aes.c:776
GLenum GLenum GLenum input
Definition: glext.h:9938
uint32_t * rk
Definition: aes.h:65
int mbedtls_internal_aes_encrypt(mbedtls_aes_context *ctx, const unsigned char input[16], unsigned char output[16])
Internal AES block encryption function (Only exposed to allow overriding it, see MBEDTLS_AES_ENCRYPT_...
Definition: aes.c:710
int mbedtls_aes_crypt_cfb8(mbedtls_aes_context *ctx, int mode, size_t length, unsigned char iv[16], const unsigned char *input, unsigned char *output)
AES-CFB8 buffer encryption/decryption.
Definition: aes.c:985
AVFormatContext * ctx
Definition: record_ffmpeg.c:247
static const unsigned char iv[]
Definition: ccm.c:364
int mbedtls_aes_crypt_cfb128(mbedtls_aes_context *ctx, int mode, size_t length, size_t *iv_off, unsigned char iv[16], const unsigned char *input, unsigned char *output)
AES-CFB128 buffer encryption/decryption.
Definition: aes.c:939
int mbedtls_aes_self_test(int verbose)
Checkup routine.
Definition: aes.c:1233
#define MBEDTLS_DEPRECATED
Definition: aes.h:286
MBEDTLS_DEPRECATED void mbedtls_aes_encrypt(mbedtls_aes_context *ctx, const unsigned char input[16], unsigned char output[16])
Deprecated internal AES block encryption function without return value.
Definition: aes.c:765
void mbedtls_aes_init(mbedtls_aes_context *ctx)
Initialize AES context.
Definition: aes.c:464
std::string output
Definition: Config.FromFile.cpp:44
AES context structure.
Definition: aes.h:62
int mbedtls_aes_crypt_cbc(mbedtls_aes_context *ctx, int mode, size_t length, unsigned char iv[16], const unsigned char *input, unsigned char *output)
AES-CBC buffer encryption/decryption Length should be a multiple of the block size (16 bytes)
Definition: aes.c:873
int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx, int mode, const unsigned char input[16], unsigned char output[16])
AES-ECB block encryption/decryption.
Definition: aes.c:841
int nr
Definition: aes.h:64
int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits)
AES key schedule (encryption)
Definition: aes.c:481
GLenum GLuint GLenum GLsizei length
Definition: glext.h:6233
unsigned int uint32_t
Definition: stdint.h:126