Skip to content

Commit

Permalink
security/nettle: fix build on powerpc64*
Browse files Browse the repository at this point in the history
Due to the string "swap_mask" being replaced with the vector register,
the assembly label pointing at the local data variable .swap_mask was
being replaced as well, causing the local label to be named ".0", which
the clang integrated assembler treats as a syntax error.

Change the name to .swap_data.

Submitted by: bdragon
  • Loading branch information
pkubaj committed Apr 6, 2021
1 parent 2efdd7b commit 0be8c2b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions security/nettle/patch-powerpc64-p8-aes-decrypt-internal.asm
@@ -0,0 +1,19 @@
--- powerpc64/p8/aes-decrypt-internal.asm.orig 2021-04-03 16:33:37.883035000 -0500
+++ powerpc64/p8/aes-decrypt-internal.asm 2021-04-03 16:34:24.022307000 -0500
@@ -71,7 +71,7 @@ define(`FUNC_ALIGN', `5')
PROLOGUE(_nettle_aes_decrypt)
vxor ZERO,ZERO,ZERO

- DATA_LOAD_VEC(swap_mask,.swap_mask,r5)
+ DATA_LOAD_VEC(swap_mask,.swap_data,r5)

subi ROUNDS,ROUNDS,1
srdi LENGTH,LENGTH,4
@@ -351,6 +351,6 @@ EPILOGUE(_nettle_aes_decrypt)

.data
.align 4
-.swap_mask:
+.swap_data:
IF_LE(`.byte 8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7')
IF_BE(`.byte 3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12')
19 changes: 19 additions & 0 deletions security/nettle/patch-powerpc64-p8-aes-encrypt-internal.asm
@@ -0,0 +1,19 @@
--- powerpc64/p8/aes-encrypt-internal.asm.orig 2021-04-03 16:33:26.104735000 -0500
+++ powerpc64/p8/aes-encrypt-internal.asm 2021-04-03 16:34:43.805790000 -0500
@@ -63,7 +63,7 @@ define(`S7', `v9')

define(`FUNC_ALIGN', `5')
PROLOGUE(_nettle_aes_encrypt)
- DATA_LOAD_VEC(swap_mask,.swap_mask,r5)
+ DATA_LOAD_VEC(swap_mask,.swap_data,r5)

subi ROUNDS,ROUNDS,1
srdi LENGTH,LENGTH,4
@@ -328,6 +328,6 @@ EPILOGUE(_nettle_aes_encrypt)

.data
.align 4
-.swap_mask:
+.swap_data:
IF_LE(`.byte 8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7')
IF_BE(`.byte 3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12')

0 comments on commit 0be8c2b

Please sign in to comment.