chiark / gitweb /
Have a small reformatting session.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 26 Jun 2016 11:17:25 +0000 (12:17 +0100)
  * Outdent `.macro' and `.endm' directives.  Firstly, this makes them
    more prominent, similar to `FUNC' and `ENDFUNC'.  Secondly, though,
    it has the effect of moving the macro name into the mnemonic column.

  * Remove the second `External definitions' banner from `symm/
    rijndael-x86ish-aesni.S'.

  * Reflow the various `CPU_DISPATCH' stanze.

base/asm-common.h
symm/chacha.c
symm/rijndael-base.c
symm/rijndael-x86ish-aesni.S
symm/rijndael.c
symm/salsa20.c

index 64d679f604a08581907b0d2c473fd05a597dbd28..bf42e4fe0d860931aa15e5f5e8459f6f164c8825 100644 (file)
@@ -38,7 +38,7 @@
 #define FUNC(name)                                                     \
        .globl  F(name);                                                \
        TYPE_FUNC(name);                                                \
-       .macro  ENDFUNC; _ENDFUNC(name); .endm;                         \
+       .macro ENDFUNC; _ENDFUNC(name); .endm;                          \
        FUNC_PREHOOK(name);                                             \
 F(name):                                                               \
        FUNC_POSTHOOK(name)
@@ -92,13 +92,13 @@ F(name):                                                            \
        .intel_syntax noprefix
 
 // Call external subroutine at ADDR, possibly via PLT.
-       .macro  callext addr
+.macro callext addr
 #if WANT_PIC
        call    \addr@PLT
 #else
        call    \addr
 #endif
-       .endm
+.endm
 
 // Do I need to arrange a spare GOT register?
 #if WANT_PIC && CPUFAM_X86
@@ -107,25 +107,25 @@ F(name):                                                          \
 #define GOTREG ebx                     // Not needed in AMD64 so don't care.
 
 // Maybe load GOT address into GOT.
-       .macro  ldgot got=GOTREG
+.macro ldgot got=GOTREG
 #if WANT_PIC && CPUFAM_X86
        call    _where_am_i.\got
        add     \got, offset _GLOBAL_OFFSET_TABLE_
 #endif
-       .endm
+.endm
 
 // Maybe build a helper subroutine for `ldgot GOT'.
-       .macro  gotaux got=GOTREG
+.macro gotaux got=GOTREG
 #if WANT_PIC && CPUFAM_X86
        .align  16
 _where_am_i.\got :
        mov     \got, [esp]
        ret
 #endif
-       .endm
+.endm
 
 // Load address of external symbol ADDR into REG, maybe using GOT.
-       .macro  leaext reg, addr, got=GOTREG
+.macro leaext reg, addr, got=GOTREG
 #if WANT_PIC
 #  if CPUFAM_X86
        mov     \reg, [\got + \addr@GOT]
@@ -141,7 +141,7 @@ _where_am_i.\got :
        lea     \reg, \addr[rip]
 #  endif
 #endif
-       .endm
+.endm
 
 // Address expression (possibly using a base register, and a displacement)
 // referring to ADDR, which is within our module, maybe using GOT.
@@ -172,13 +172,13 @@ _where_am_i.\got :
 #define ENDFUNC_HOOK(name) .ltorg
 
 // Call external subroutine at ADDR, possibly via PLT.
-       .macro  callext addr, cond=
+.macro callext addr, cond=
 #if WANT_PIC
        bl\cond \addr(PLT)
 #else
        bl\cond \addr
 #endif
-       .endm
+.endm
 
 // Do I need to arrange a spare GOT register?
 #if WANT_PIC
@@ -187,36 +187,36 @@ _where_am_i.\got :
 #define GOTREG r9
 
 // Maybe load GOT address into GOT.
-       .macro  ldgot   cond=, got=GOTREG
+.macro ldgot   cond=, got=GOTREG
 #if WANT_PIC
        ldr\cond \got, .L$_ldgot$\@
 .L$_ldgot_pc$\@:
        add\cond \got, pc, \got
-       _LIT
+  _LIT
        .balign 4
 .L$_ldgot$\@:
        .word   _GLOBAL_OFFSET_TABLE_ - .L$_ldgot_pc$\@ - .L$_pcoff
-       _ENDLIT
+  _ENDLIT
 #endif
-       .endm
+.endm
 
 // Load address of external symbol ADDR into REG, maybe using GOT.
-       .macro  leaext  reg, addr, cond=, got=GOTREG
+.macro leaext  reg, addr, cond=, got=GOTREG
 #if WANT_PIC
        ldr\cond \reg, .L$_leaext$\@
        ldr\cond \reg, [\got, \reg]
-       _LIT
+  _LIT
        .balign 4
 .L$_leaext$\@:
        .word   \addr(GOT)
-       _ENDLIT
+  _ENDLIT
 #else
        ldr\cond \reg, =\addr
 #endif
-       .endm
+.endm
 
 // Load address of external symbol ADDR into REG directly.
-       .macro  leaextq reg, addr, cond=
+.macro leaextq reg, addr, cond=
 #if WANT_PIC
        ldr\cond \reg, .L$_leaextq$\@
 .L$_leaextq_pc$\@:
@@ -226,15 +226,15 @@ _where_am_i.\got :
        add\cond \reg, pc
        ldr\cond \reg, [\reg]
        .endif
-       _LIT
+  _LIT
        .balign 4
 .L$_leaextq$\@:
        .word   \addr(GOT_PREL) + (. - .L$_leaextq_pc$\@ - .L$_pcoff)
-       _ENDLIT
+  _ENDLIT
 #else
        ldr\cond \reg, =\addr
 #endif
-       .endm
+.endm
 
 #endif
 
index cb879e3cfe41686bd2e96d3ec8a380fd5a524b81..abcc1bd4e56f028addd9d0e176405d888c9c1d63 100644 (file)
@@ -62,11 +62,9 @@ const octet chacha_keysz[] = { KSZ_SET, 32, 16, 10, 0 };
  *             the feedforward step.
  */
 
-CPU_DISPATCH(static, (void),
-            void, core, (unsigned r, const chacha_matrix src,
-                         chacha_matrix dest),
-            (r, src, dest),
-            pick_core, simple_core);
+CPU_DISPATCH(static, (void), void, core,
+            (unsigned r, const chacha_matrix src, chacha_matrix dest),
+            (r, src, dest), pick_core, simple_core);
 
 static void simple_core(unsigned r, const chacha_matrix src,
                        chacha_matrix dest)
index b0505a662bc29c2ae287d6c34f1f464dd6fc421d..b5490c1db8cf78171b7ec4f6cd1b5ef819b420c5 100644 (file)
@@ -112,8 +112,8 @@ static void simple_setup(rijndael_ctx *k, unsigned nb,
     k->wi[i] = k->w[j + jj++];
 }
 
-CPU_DISPATCH(static, EMPTY, void, setup, (rijndael_ctx *k, unsigned nb,
-                                         const void *buf, unsigned nk),
+CPU_DISPATCH(static, EMPTY, void, setup,
+            (rijndael_ctx *k, unsigned nb, const void *buf, unsigned nk),
             (k, nb, buf, nk), pick_setup, simple_setup)
 
 #if CPUFAM_X86 || CPUFAM_AMD64
index 09543172f47ee95a1b4e51512a01378552071c7b..520a72e4a21c8c43e26a7910242b7c04eb8d4514 100644 (file)
@@ -30,9 +30,6 @@
 #include "config.h"
 #include "asm-common.h"
 
-///--------------------------------------------------------------------------
-/// External definitions.
-
        .globl  F(abort)
        .globl  F(rijndael_rcon)
 
@@ -431,8 +428,8 @@ ENDFUNC
 ///--------------------------------------------------------------------------
 /// Encrypting and decrypting blocks.
 
-       .macro  encdec op, aes, koff
-FUNC(rijndael_\op\()_x86ish_aesni)
+.macro encdec  op, aes, koff
+  FUNC(rijndael_\op\()_x86ish_aesni)
 
        // Find the magic endianness-swapping table.
        ldgot   ecx
@@ -569,8 +566,8 @@ FUNC(rijndael_\op\()_x86ish_aesni)
 #undef DST
 #undef NR
 
-ENDFUNC
-       .endm
+  ENDFUNC
+.endm
 
        encdec  eblk, aesenc, w
        encdec  dblk, aesdec, wi
index 293f28da4601d6368a85fcdd7b71e65a6a48c9ee..58d896f92002ddfda6b10161031b878d6ec09119 100644 (file)
@@ -72,14 +72,12 @@ void rijndael_init(rijndael_ctx *k, const void *buf, size_t sz)
  * Use:                Low-level block encryption and decryption.
  */
 
-CPU_DISPATCH(EMPTY, EMPTY, void, rijndael_eblk, (const rijndael_ctx *k,
-                                                const uint32 s[4],
-                                                uint32 d[4]),
+CPU_DISPATCH(EMPTY, EMPTY, void, rijndael_eblk,
+            (const rijndael_ctx *k, const uint32 s[4], uint32 d[4]),
             (k, s, d), pick_eblk, simple_eblk)
 
-CPU_DISPATCH(EMPTY, EMPTY, void, rijndael_dblk, (const rijndael_ctx *k,
-                                                const uint32 s[4],
-                                                uint32 d[4]),
+CPU_DISPATCH(EMPTY, EMPTY, void, rijndael_dblk,
+            (const rijndael_ctx *k, const uint32 s[4], uint32 d[4]),
             (k, s, d), pick_dblk, simple_dblk)
 
 #if CPUFAM_X86 || CPUFAM_AMD64
index 0afad2cbad0c5efcc03873f0c4567e3cbc4d501e..29a43f0e8ac0b920987067f2bc5638d952c6cdd4 100644 (file)
@@ -42,11 +42,9 @@ const octet salsa20_keysz[] = { KSZ_SET, 32, 16, 10, 0 };
  *             the feedforward step.
  */
 
-CPU_DISPATCH(static, (void),
-            void, core, (unsigned r, const salsa20_matrix src,
-                         salsa20_matrix dest),
-            (r, src, dest),
-            pick_core, simple_core);
+CPU_DISPATCH(static, (void), void, core,
+            (unsigned r, const salsa20_matrix src, salsa20_matrix dest),
+            (r, src, dest), pick_core, simple_core);
 
 static void simple_core(unsigned r, const salsa20_matrix src,
                        salsa20_matrix dest)