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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Hoffmann
nettle
Commits
843dda13
Commit
843dda13
authored
Sep 13, 2008
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
* x86/aes.m4 (AES_ROUND): Use movzbl.
(AES_SUBST_BYTE): Likewise. Rev: nettle/x86/aes.m4:1.3
parent
435d50a2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
x86/aes.m4
+26
-32
26 additions, 32 deletions
x86/aes.m4
with
26 additions
and
32 deletions
x86/aes.m4
+
26
−
32
View file @
843dda13
dnl BYTEREG(reg) gives the 8-bit register corresponding to the given 32-bit register.
dnl Use in AES_SUBST_BYTE below, and is used by both the x86 and the x86_64 assembler.
define(<BYTEREG>,<ifelse(
$1, %eax, %al,
$1, %ebx, %bl,
$1, %ecx, %cl,
$1, %edx, %dl,
dnl The rest are x86_64 only
$1, %esi, %sil,
$1, %edi, %dil,
$1, %ebp, %bpl,
$1, %esp, %spl,
$1, %r8d, %r8b,
$1, %r9d, %r9b,
$1, %r10d, %r10b,
$1, %r11d, %r11b,
$1, %r12d, %r12b,
$1, %r13d, %r13b,
$1, %r14d, %r14b,
$1, %r15d, %r15b)>)dnl
dnl AES_LOAD(a, b, c, d, src, key)
dnl AES_LOAD(a, b, c, d, src, key)
dnl Loads the next block of data from src, and add the subkey pointed
dnl Loads the next block of data from src, and add the subkey pointed
dnl to by key.
dnl to by key.
...
@@ -33,8 +54,7 @@ define(<AES_STORE>, <
...
@@ -33,8 +54,7 @@ define(<AES_STORE>, <
dnl AES_ROUND(table,a,b,c,d,out,tmp)
dnl AES_ROUND(table,a,b,c,d,out,tmp)
dnl Computes one word of the AES round. Leaves result in $6.
dnl Computes one word of the AES round. Leaves result in $6.
define(<AES_ROUND>, <
define(<AES_ROUND>, <
movl $2, $7
movzbl BYTEREG($2), $7
andl <$>0xff, $7
movl AES_TABLE0 ($1, $7,4),$6
movl AES_TABLE0 ($1, $7,4),$6
movl $3, $7
movl $3, $7
shrl <$>8,$7
shrl <$>8,$7
...
@@ -46,7 +66,6 @@ define(<AES_ROUND>, <
...
@@ -46,7 +66,6 @@ define(<AES_ROUND>, <
xorl AES_TABLE2 ($1, $7, 4),$6
xorl AES_TABLE2 ($1, $7, 4),$6
movl $5,$7 C fourth one
movl $5,$7 C fourth one
shrl <$>24,$7
shrl <$>24,$7
andl <$>0xff,$7
xorl AES_TABLE3 ($1, $7, 4),$6>)dnl
xorl AES_TABLE3 ($1, $7, 4),$6>)dnl
dnl AES_FINAL_ROUND(a, b, c, d, out, tmp)
dnl AES_FINAL_ROUND(a, b, c, d, out, tmp)
...
@@ -67,49 +86,24 @@ define(<AES_FINAL_ROUND>, <
...
@@ -67,49 +86,24 @@ define(<AES_FINAL_ROUND>, <
andl <$>0xff000000,$6
andl <$>0xff000000,$6
orl $6, $5>)dnl
orl $6, $5>)dnl
dnl BYTEREG(reg) gives the 8-bit register corresponding to the given 32-bit register.
dnl Use in AES_SUBST_BYTE below, and is used by both the x86 and the x86_64 assembler.
define(<BYTEREG>,<ifelse(
$1, %eax, %al,
$1, %ebx, %bl,
$1, %ecx, %cl,
$1, %edx, %dl,
dnl The rest are x86_64 only
$1, %esi, %sil,
$1, %edi, %dil,
$1, %ebp, %bpl,
$1, %esp, %spl,
$1, %r8d, %r8b,
$1, %r9d, %r9b,
$1, %r10d, %r10b,
$1, %r11d, %r11b,
$1, %r12d, %r12b,
$1, %r13d, %r13b,
$1, %r14d, %r14b,
$1, %r15d, %r15b)>)dnl
dnl AES_SUBST_BYTE(A, B, C, D, table, tmp)
dnl AES_SUBST_BYTE(A, B, C, D, table, tmp)
dnl Substitutes the least significant byte of
dnl Substitutes the least significant byte of
dnl each of eax, ebx, ecx and edx, and also rotates
dnl each of eax, ebx, ecx and edx, and also rotates
dnl the words one byte to the left.
dnl the words one byte to the left.
dnl Uses that AES_SBOX == 0
dnl Uses that AES_SBOX == 0
define(<AES_SUBST_BYTE>, <
define(<AES_SUBST_BYTE>, <
movl $1,$6
movzbl BYTEREG($1),$6
andl <$>0x000000ff,$6
movb ($5, $6),BYTEREG($1)
movb ($5, $6),BYTEREG($1)
roll <$>8,$1
roll <$>8,$1
movl $2,$6
movzbl BYTEREG($2),$6
andl <$>0x000000ff,$6
movb ($5, $6),BYTEREG($2)
movb ($5, $6),BYTEREG($2)
roll <$>8,$2
roll <$>8,$2
movl $3,$6
movzbl BYTEREG($3),$6
andl <$>0x000000ff,$6
movb ($5, $6),BYTEREG($3)
movb ($5, $6),BYTEREG($3)
roll <$>8,$3
roll <$>8,$3
movl $4,$6
movzbl BYTEREG($4),$6
andl <$>0x000000ff,$6
movb ($5, $6),BYTEREG($4)
movb ($5, $6),BYTEREG($4)
roll <$>8,$4>)dnl
roll <$>8,$4>)dnl
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