Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wim Lewis
nettle
Commits
b686476f
Commit
b686476f
authored
Jan 21, 2015
by
Niels Möller
Browse files
Fat functions for arm neon.
parent
d5cb83ea
Changes
7
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
b686476f
2015-01-21 Niels Möller <nisse@lysator.liu.se>
* fat-arm.c (fat_init): Setup for use of neon assembly functions.
* arm/fat/salsa20-core-internal-2.asm: New file.
* arm/fat/sha3-permute-2.asm: New file.
* arm/fat/sha512-compress-2.asm: New file.
* arm/fat/umac-nh-2.asm: New file.
* arm/fat/umac-nh-n-2.asm: New file.
* salsa20-core-internal.c: Prepare for fat build with C and
assembly implementations.
* sha512-compress.c: Likewise.
...
...
arm/fat/salsa20-core-internal-2.asm
0 → 100644
View file @
b686476f
C
arm
/
fat
/
salsa20
-
core
-
internal
-
2
.asm
ifelse
(
<
Copyright
(
C
)
2015
Niels
M
ö
ller
This
file
is
part
of
GNU
Nettle.
GNU
Nettle
is
free
software
:
you
can
redistribute
it
and
/
or
modify
it
under
the
terms
of
either
:
*
the
GNU
Lesser
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 3 of the License, or (at your
option
)
any
later
version.
or
*
the
GNU
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 2 of the License, or (at your
option
)
any
later
version.
or
both
in
parallel
,
as
here.
GNU
Nettle
is
di
stributed
in
the
hope
that
it
will
be
useful
,
but
WITHOUT
ANY
WARRANTY
; without even the implied warranty of
MERCHANTABILITY
or
FITNESS
FOR
A
PARTICULAR
PURPOSE.
See
the
GNU
General
Public
License
for
more
details.
You
should
have
received
copies
of
the
GNU
General
Public
License
and
the
GNU
Lesser
General
Public
License
al
ong
with
this
program.
If
not
,
see
http
:
//
www.gnu.org
/
licenses
/
.
>)
dnl
PROLOGUE
(
_nettle_salsa20_core
)
picked
up
by
configure
define
(
<
fat_transform
>
,
<
$
1
_neon
>
)
include_src
(
<
arm
/
neon
/
salsa20
-
core
-
internal.asm
>
)
arm/fat/sha3-permute-2.asm
0 → 100644
View file @
b686476f
C
arm
/
fat
/
sha3
-
permute
-
2
.asm
ifelse
(
<
Copyright
(
C
)
2015
Niels
M
ö
ller
This
file
is
part
of
GNU
Nettle.
GNU
Nettle
is
free
software
:
you
can
redistribute
it
and
/
or
modify
it
under
the
terms
of
either
:
*
the
GNU
Lesser
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 3 of the License, or (at your
option
)
any
later
version.
or
*
the
GNU
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 2 of the License, or (at your
option
)
any
later
version.
or
both
in
parallel
,
as
here.
GNU
Nettle
is
di
stributed
in
the
hope
that
it
will
be
useful
,
but
WITHOUT
ANY
WARRANTY
; without even the implied warranty of
MERCHANTABILITY
or
FITNESS
FOR
A
PARTICULAR
PURPOSE.
See
the
GNU
General
Public
License
for
more
details.
You
should
have
received
copies
of
the
GNU
General
Public
License
and
the
GNU
Lesser
General
Public
License
al
ong
with
this
program.
If
not
,
see
http
:
//
www.gnu.org
/
licenses
/
.
>)
dnl
PROLOGUE
(
_nettle_sha3_permute
)
picked
up
by
configure
define
(
<
fat_transform
>
,
<
_$1_neon
>
)
include_src
(
<
arm
/
neon
/
sha3
-
permute.asm
>
)
arm/fat/sha512-compress-2.asm
0 → 100644
View file @
b686476f
C
arm
/
fat
/
sha3
-
compress
-
2
.asm
ifelse
(
<
Copyright
(
C
)
2015
Niels
M
ö
ller
This
file
is
part
of
GNU
Nettle.
GNU
Nettle
is
free
software
:
you
can
redistribute
it
and
/
or
modify
it
under
the
terms
of
either
:
*
the
GNU
Lesser
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 3 of the License, or (at your
option
)
any
later
version.
or
*
the
GNU
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 2 of the License, or (at your
option
)
any
later
version.
or
both
in
parallel
,
as
here.
GNU
Nettle
is
di
stributed
in
the
hope
that
it
will
be
useful
,
but
WITHOUT
ANY
WARRANTY
; without even the implied warranty of
MERCHANTABILITY
or
FITNESS
FOR
A
PARTICULAR
PURPOSE.
See
the
GNU
General
Public
License
for
more
details.
You
should
have
received
copies
of
the
GNU
General
Public
License
and
the
GNU
Lesser
General
Public
License
al
ong
with
this
program.
If
not
,
see
http
:
//
www.gnu.org
/
licenses
/
.
>)
dnl
PROLOGUE
(
_nettle_sha512_compress
)
picked
up
by
configure
define
(
<
fat_transform
>
,
<
$
1
_neon
>
)
include_src
(
<
arm
/
neon
/
sha512
-
compress.asm
>
)
arm/fat/umac-nh-2.asm
0 → 100644
View file @
b686476f
C
arm
/
fat
/
umac
-
nh
-
2
.asm
ifelse
(
<
Copyright
(
C
)
2015
Niels
M
ö
ller
This
file
is
part
of
GNU
Nettle.
GNU
Nettle
is
free
software
:
you
can
redistribute
it
and
/
or
modify
it
under
the
terms
of
either
:
*
the
GNU
Lesser
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 3 of the License, or (at your
option
)
any
later
version.
or
*
the
GNU
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 2 of the License, or (at your
option
)
any
later
version.
or
both
in
parallel
,
as
here.
GNU
Nettle
is
di
stributed
in
the
hope
that
it
will
be
useful
,
but
WITHOUT
ANY
WARRANTY
; without even the implied warranty of
MERCHANTABILITY
or
FITNESS
FOR
A
PARTICULAR
PURPOSE.
See
the
GNU
General
Public
License
for
more
details.
You
should
have
received
copies
of
the
GNU
General
Public
License
and
the
GNU
Lesser
General
Public
License
al
ong
with
this
program.
If
not
,
see
http
:
//
www.gnu.org
/
licenses
/
.
>)
dnl
PROLOGUE
(
_nettle_umac_nh
)
picked
up
by
configure
define
(
<
fat_transform
>
,
<
$
1
_neon
>
)
include_src
(
<
arm
/
neon
/
umac
-
nh.asm
>
)
arm/fat/umac-nh-n-2.asm
0 → 100644
View file @
b686476f
C
arm
/
fat
/
umac
-
nh
-
n
-
2
.asm
ifelse
(
<
Copyright
(
C
)
2015
Niels
M
ö
ller
This
file
is
part
of
GNU
Nettle.
GNU
Nettle
is
free
software
:
you
can
redistribute
it
and
/
or
modify
it
under
the
terms
of
either
:
*
the
GNU
Lesser
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 3 of the License, or (at your
option
)
any
later
version.
or
*
the
GNU
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 2 of the License, or (at your
option
)
any
later
version.
or
both
in
parallel
,
as
here.
GNU
Nettle
is
di
stributed
in
the
hope
that
it
will
be
useful
,
but
WITHOUT
ANY
WARRANTY
; without even the implied warranty of
MERCHANTABILITY
or
FITNESS
FOR
A
PARTICULAR
PURPOSE.
See
the
GNU
General
Public
License
for
more
details.
You
should
have
received
copies
of
the
GNU
General
Public
License
and
the
GNU
Lesser
General
Public
License
al
ong
with
this
program.
If
not
,
see
http
:
//
www.gnu.org
/
licenses
/
.
>)
dnl
PROLOGUE
(
_nettle_umac_nh_n
)
picked
up
by
configure
define
(
<
fat_transform
>
,
<
$
1
_neon
>
)
include_src
(
<
arm
/
neon
/
umac
-
nh
-
n.asm
>
)
fat-arm.c
View file @
b686476f
...
...
@@ -141,6 +141,26 @@ DECLARE_FAT_FUNC(_nettle_aes_decrypt, aes_crypt_internal_func)
DECLARE_FAT_FUNC_VAR
(
aes_decrypt
,
aes_crypt_internal_func
,
arm
)
DECLARE_FAT_FUNC_VAR
(
aes_decrypt
,
aes_crypt_internal_func
,
armv6
)
DECLARE_FAT_FUNC
(
_nettle_salsa20_core
,
salsa20_core_func
)
DECLARE_FAT_FUNC_VAR
(
salsa20_core
,
salsa20_core_func
,
c
)
DECLARE_FAT_FUNC_VAR
(
salsa20_core
,
salsa20_core_func
,
neon
)
DECLARE_FAT_FUNC
(
_nettle_sha512_compress
,
sha512_compress_func
)
DECLARE_FAT_FUNC_VAR
(
sha512_compress
,
sha512_compress_func
,
c
)
DECLARE_FAT_FUNC_VAR
(
sha512_compress
,
sha512_compress_func
,
neon
)
DECLARE_FAT_FUNC
(
nettle_sha3_permute
,
sha3_permute_func
)
DECLARE_FAT_FUNC_VAR
(
sha3_permute
,
sha3_permute_func
,
c
)
DECLARE_FAT_FUNC_VAR
(
sha3_permute
,
sha3_permute_func
,
neon
)
DECLARE_FAT_FUNC
(
_nettle_umac_nh
,
umac_nh_func
)
DECLARE_FAT_FUNC_VAR
(
umac_nh
,
umac_nh_func
,
c
);
DECLARE_FAT_FUNC_VAR
(
umac_nh
,
umac_nh_func
,
neon
);
DECLARE_FAT_FUNC
(
_nettle_umac_nh_n
,
umac_nh_n_func
)
DECLARE_FAT_FUNC_VAR
(
umac_nh_n
,
umac_nh_n_func
,
c
);
DECLARE_FAT_FUNC_VAR
(
umac_nh_n
,
umac_nh_n_func
,
neon
);
static
void
CONSTRUCTOR
fat_init
(
void
)
{
...
...
@@ -173,6 +193,26 @@ fat_init (void)
_nettle_aes_encrypt_vec
=
_nettle_aes_encrypt_arm
;
_nettle_aes_decrypt_vec
=
_nettle_aes_decrypt_arm
;
}
if
(
features
.
have_neon
)
{
if
(
verbose
)
fprintf
(
stderr
,
"libnettle: enabling neon code.
\n
"
);
_nettle_salsa20_core_vec
=
_nettle_salsa20_core_neon
;
_nettle_sha512_compress_vec
=
_nettle_sha512_compress_neon
;
nettle_sha3_permute_vec
=
_nettle_sha3_permute_neon
;
_nettle_umac_nh_vec
=
_nettle_umac_nh_neon
;
_nettle_umac_nh_n_vec
=
_nettle_umac_nh_n_neon
;
}
else
{
if
(
verbose
)
fprintf
(
stderr
,
"libnettle: not enabling neon code.
\n
"
);
_nettle_salsa20_core_vec
=
_nettle_salsa20_core_c
;
_nettle_sha512_compress_vec
=
_nettle_sha512_compress_c
;
nettle_sha3_permute_vec
=
_nettle_sha3_permute_c
;
_nettle_umac_nh_vec
=
_nettle_umac_nh_c
;
_nettle_umac_nh_n_vec
=
_nettle_umac_nh_n_c
;
}
/* FIXME: Needs memory barrier, to enforce store ordering. */
initialized
=
1
;
}
...
...
@@ -190,3 +230,24 @@ DEFINE_FAT_FUNC(_nettle_aes_decrypt, void,
size_t
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
),
(
rounds
,
keys
,
T
,
length
,
dst
,
src
))
DEFINE_FAT_FUNC
(
_nettle_salsa20_core
,
void
,
(
uint32_t
*
dst
,
const
uint32_t
*
src
,
unsigned
rounds
),
(
dst
,
src
,
rounds
))
DEFINE_FAT_FUNC
(
_nettle_sha512_compress
,
void
,
(
uint64_t
*
state
,
const
uint8_t
*
input
,
const
uint64_t
*
k
),
(
state
,
input
,
k
))
DEFINE_FAT_FUNC
(
nettle_sha3_permute
,
void
,
(
struct
sha3_state
*
state
),
(
state
))
DEFINE_FAT_FUNC
(
_nettle_umac_nh
,
uint64_t
,
(
const
uint32_t
*
key
,
unsigned
length
,
const
uint8_t
*
msg
),
(
key
,
length
,
msg
))
DEFINE_FAT_FUNC
(
_nettle_umac_nh_n
,
void
,
(
uint64_t
*
out
,
unsigned
n
,
const
uint32_t
*
key
,
unsigned
length
,
const
uint8_t
*
msg
),
(
out
,
n
,
key
,
length
,
msg
))
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment