1 C nettle
, low-level cryptographics library
3 C Copyright
(C
) 2013 Niels Möller
5 C The nettle library is free software
; you can redistribute it and/or modify
6 C it under the terms of the GNU Lesser General
Public License as published by
7 C the Free Software Foundation
; either version 2.1 of the License, or (at your
8 C option
) any later version.
10 C The nettle library is distributed
in the hope that it will be useful
, but
11 C WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
12 C
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public
13 C License for more details.
15 C You should have received a copy of the GNU Lesser General
Public License
16 C along with the nettle library
; see the file COPYING.LIB. If not, write to
17 C the Free Software Foundation
, Inc.
, 51 Franklin Street
, Fifth Floor
, Boston
,
20 .file
"salsa20-core-internal.asm"
25 define
(<ROUNDS
>, <r2
>)
33 define
(<M0101
>, <q10
>)
34 define
(<M0110
>, <q11
>)
35 define
(<M0011
>, <q12
>)
73 C _salsa20_core
(uint32_t
*dst
, const uint32_t
*src
, unsigned rounds
)
75 PROLOGUE
(_nettle_salsa20_core
)
76 vldm SRC
, {X0,X1,X2,X3}
89 C
FIXME: Construct
in some other way
?
91 vldm r12
, {M0101, M0110, M0011}
97 C Swaps
in columns
1, 3:
109 C Swaps
in column
1, 2:
118 C Swaps
in columm
2,3:
128 QROUND
(X0
, X1
, X2
, X3
)
130 C Rotate rows
, to get
135 vext
.32 X1
, X1
, X1
, #
3
136 vext
.32 X2
, X2
, X2
, #
2
137 vext
.32 X3
, X3
, X3
, #
1
139 QROUND
(X0
, X3
, X2
, X1
)
141 subs ROUNDS
, ROUNDS
, #
2
143 vext
.32 X1
, X1
, X1
, #
1
144 vext
.32 X2
, X2
, X2
, #
2
145 vext
.32 X3
, X3
, X3
, #
3
171 vstm DST
, {X0,X1,X2,X3}
173 EPILOGUE
(_nettle_salsa20_core
)