Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Brian Smith
nettle
Commits
af80c9e7
Commit
af80c9e7
authored
19 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
(AES_ROUND, AES_FINAL_ROUND): New macros.
Rev: src/nettle/aes-internal.h:1.10
parent
b6c481da
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aes-internal.h
+28
-7
28 additions, 7 deletions
aes-internal.h
with
28 additions
and
7 deletions
aes-internal.h
+
28
−
7
View file @
af80c9e7
...
@@ -39,9 +39,6 @@
...
@@ -39,9 +39,6 @@
# define AES_TABLE_SIZE 4
# define AES_TABLE_SIZE 4
#endif
#endif
/* Name mangling */
#define _aes_crypt _nettle_aes_crypt
/* Assembler code using the table should get link errors if linked
/* Assembler code using the table should get link errors if linked
* against a small table. */
* against a small table. */
#if AES_SMALL
#if AES_SMALL
...
@@ -70,10 +67,16 @@ struct aes_table
...
@@ -70,10 +67,16 @@ struct aes_table
};
};
void
void
_aes_crypt
(
const
struct
aes_ctx
*
ctx
,
_nettle_aes_crypt
(
const
struct
aes_ctx
*
ctx
,
const
struct
aes_table
*
T
,
const
struct
aes_table
*
T
,
unsigned
length
,
uint8_t
*
dst
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
void
_nettle_aes_encrypt
(
const
struct
aes_ctx
*
ctx
,
const
struct
aes_table
*
T
,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
/* Macros */
/* Macros */
#define ROTBYTE(x) (((x) >> 8) | (((x) & 0xff) << 24))
#define ROTBYTE(x) (((x) >> 8) | (((x) & 0xff) << 24))
...
@@ -83,6 +86,24 @@ _aes_crypt(const struct aes_ctx *ctx,
...
@@ -83,6 +86,24 @@ _aes_crypt(const struct aes_ctx *ctx,
((box)[(((x) >> 16) & 0xff)] << 16) | \
((box)[(((x) >> 16) & 0xff)] << 16) | \
((box)[(((x) >> 24) & 0xff)] << 24))
((box)[(((x) >> 24) & 0xff)] << 24))
/* Get the byte with index 0, 1, 2 and 3 */
#define B0(x) ((x) & 0xff)
#define B1(x) (((x) >> 8) & 0xff)
#define B2(x) (((x) >> 16) & 0xff)
#define B3(x) (((x) >> 24) & 0xff)
#define AES_ROUND(T, w0, w1, w2, w3, k) \
(( T->table[0][ B0(w0) ] \
^ T->table[1][ B1(w1) ] \
^ T->table[2][ B2(w2) ] \
^ T->table[3][ B3(w3) ]) ^ (k))
#define AES_FINAL_ROUND(T, w0, w1, w2, w3, k) \
(( (uint32_t) T->sbox[ B0(w0) ] \
| ((uint32_t) T->sbox[ B1(w1) ] << 8) \
| ((uint32_t) T->sbox[ B2(w2) ] << 16) \
| ((uint32_t) T->sbox[ B3(w3) ] << 24)) ^ (k))
/* Internal tables */
/* Internal tables */
extern
const
struct
aes_table
_aes_encrypt_table
;
extern
const
struct
aes_table
_aes_encrypt_table
;
extern
const
struct
aes_table
_aes_decrypt_table
;
extern
const
struct
aes_table
_aes_decrypt_table
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment