diff options
author | Niels Möller <nisse@lysator.liu.se> | 2002-05-15 00:44:05 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2002-05-15 00:44:05 +0200 |
commit | 88c9cdb3d5982c27f34737a95dc66b30b58f11ef (patch) | |
tree | 4a263959755646d867bf51b3c1182ff4da353ecd /x86 | |
parent | 9347699416096b37aa8401e068add28f02f97165 (diff) | |
download | nettle-88c9cdb3d5982c27f34737a95dc66b30b58f11ef.tar.gz |
(AES_SUBST_BYTE): New macro.
Rev: src/nettle/x86/machine.m4:1.6
Diffstat (limited to 'x86')
-rw-r--r-- | x86/machine.m4 | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/x86/machine.m4 b/x86/machine.m4 index d7bccade..91cc3eb9 100644 --- a/x86/machine.m4 +++ b/x86/machine.m4 @@ -54,6 +54,8 @@ dnl AES_LAST_ROUND(a, b, c, d) dnl Computes one word of the final round. Leaves result in %edi. dnl Note that we have to quote $ in constants. define(<AES_LAST_ROUND>, < + C FIXME: Perform substitution on least significant byte here, + C to save work later. movl %e<>$1<>x,%edi andl <$>0x000000ff,%edi movl %e<>$2<>x,%ebp @@ -66,3 +68,27 @@ define(<AES_LAST_ROUND>, < andl <$>0xff000000,%ebp orl %ebp,%edi>)dnl +dnl AES_SUBST_BYTE(table) +dnl Substitutes the least significant byte of +dnl each of eax, ebx, ecx and edx, and also rotates +dnl the words one byte to the left. +define(<AES_SUBST_BYTE>, < + movl %eax,%ebp + andl <$>0x000000ff,%ebp + movb AES_SBOX + $1 (%ebp),%al + roll <$>8,%eax + + movl %ebx,%ebp + andl <$>0x000000ff,%ebp + movb AES_SBOX + $1 (%ebp),%bl + roll <$>8,%ebx + + movl %ecx,%ebp + andl <$>0x000000ff,%ebp + movb AES_SBOX + $1 (%ebp),%cl + roll <$>8,%ecx + + movl %edx,%ebp + andl <$>0x000000ff,%ebp + movb AES_SBOX + $1 (%ebp),%dl + roll <$>8,%edx>)dnl |