BeeCrypt  4.2.1
aes.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002, 2003 Bob Deblier
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  */
19 
26 #ifndef _AES_H
27 #define _AES_H
28 
29 #include "beecrypt/beecrypt.h"
30 #include "beecrypt/aesopt.h"
31 
35 #ifdef __cplusplus
37 #else
38 struct _aesParam
39 #endif
40 {
44  uint32_t k[64];
48  uint32_t nr;
52  uint32_t fdback[4];
53 };
54 
55 #ifndef __cplusplus
56 typedef struct _aesParam aesParam;
57 #endif
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
66 extern const BEECRYPTAPI blockCipher aes;
67 
79 int aesSetup (aesParam* ap, const byte* key, size_t keybits, cipherOperation op);
80 
89 int aesSetIV (aesParam* ap, const byte* iv);
90 
100 int aesSetCTR (aesParam* ap, const byte* nivz, size_t counter);
101 
111 int aesEncrypt (aesParam* ap, uint32_t* dst, const uint32_t* src);
112 
122 int aesDecrypt (aesParam* ap, uint32_t* dst, const uint32_t* src);
123 
125 uint32_t* aesFeedback(aesParam* ap);
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif
cipherOperation
Specifies whether to perform encryption or decryption.
Definition: beecrypt.h:556
const blockCipher aes
Holds the full API description of the AES algorithm.
uint32_t nr
Number of rounds to be used in encryption/decryption.
Definition: aes.h:48
Holds information and pointers to code specific to each cipher.
Definition: beecrypt.h:644
AES block cipher, assembler-optimized routines, headers.
uint32_t * aesFeedback(aesParam *ap)
BeeCrypt API, headers.
int aesSetCTR(aesParam *ap, const byte *nivz, size_t counter)
This function sets the CTR mode counter.
uint8_t byte
Definition: api.h:72
#define BEECRYPTAPI
Definition: api.h:52
int aesSetup(aesParam *ap, const byte *key, size_t keybits, cipherOperation op)
This function performs the cipher's key expansion.
int aesSetIV(aesParam *ap, const byte *iv)
This function sets the Initialization Vector.
int aesEncrypt(aesParam *ap, uint32_t *dst, const uint32_t *src)
This function performs the raw AES encryption; it encrypts one block of 128 bits. ...
int aesDecrypt(aesParam *ap, uint32_t *dst, const uint32_t *src)
This function performs the raw AES decryption; it decrypts one block of 128 bits. ...
Holds all the parameters necessary for the AES cipher.
Definition: aes.h:36