Fix ARM build with OPENSSL_NO_ASM.

Change-Id: Id77fb7c904cbfe8172466dff20b6a715d90b806c
Reviewed-on: https://boringssl-review.googlesource.com/1710
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Adam Langley 2014-09-03 12:18:11 -07:00 committed by Adam Langley
parent df90a64483
commit 60d612fdcf
5 changed files with 14 additions and 11 deletions

View File

@ -47,7 +47,7 @@ static const char sigma[16] = "expand 32-byte k";
x[a] = PLUS(x[a],x[b]); x[d] = ROTATE(XOR(x[d],x[a]), 8); \
x[c] = PLUS(x[c],x[d]); x[b] = ROTATE(XOR(x[b],x[c]), 7);
#if defined(OPENSSL_ARM)
#if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
/* Defined in chacha_vec.c */
void CRYPTO_chacha_20_neon(uint8_t *out, const uint8_t *in, size_t in_len,
const uint8_t key[32], const uint8_t nonce[8],
@ -87,7 +87,7 @@ void CRYPTO_chacha_20(uint8_t *out, const uint8_t *in, size_t in_len,
uint8_t buf[64];
size_t todo, i;
#if defined(OPENSSL_ARM)
#if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
if (CRYPTO_is_NEON_capable() && ((intptr_t)in & 15) == 0 &&
((intptr_t)out & 15) == 0) {
CRYPTO_chacha_20_neon(out, in, in_len, key, nonce, counter);

View File

@ -21,6 +21,8 @@
#
# /opt/gcc-linaro-arm-linux-gnueabihf-4.7-2012.10-20121022_linux/bin/arm-linux-gnueabihf-gcc -O3 -mcpu=cortex-a8 -mfpu=neon -S chacha_vec.c -I ../../include -fpic -o chacha_vec_arm.S
#if !defined(OPENSSL_NO_ASM)
.syntax unified
.cpu cortex-a8
.eabi_attribute 27, 3
@ -884,3 +886,5 @@ CRYPTO_chacha_20_neon:
.word 1797285236
.ident "GCC: (crosstool-NG linaro-1.13.1-4.7-2012.10-20121022 - Linaro GCC 2012.10) 4.7.3 20121001 (prerelease)"
.section .note.GNU-stack,"",%progbits
#endif /* !OPENSSL_NO_ASM */

View File

@ -48,7 +48,7 @@ static void U32TO8_LE(uint8_t *m, uint32_t v) {
}
#endif
#if defined(OPENSSL_ARM)
#if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
void CRYPTO_poly1305_init_neon(poly1305_state *state, const uint8_t key[32]);
void CRYPTO_poly1305_update_neon(poly1305_state *state, const uint8_t *in,
@ -165,7 +165,7 @@ void CRYPTO_poly1305_init(poly1305_state *statep, const uint8_t key[32]) {
struct poly1305_state_st *state = (struct poly1305_state_st *)statep;
uint32_t t0, t1, t2, t3;
#if defined(OPENSSL_ARM)
#if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
if (CRYPTO_is_NEON_functional()) {
CRYPTO_poly1305_init_neon(statep, key);
return;
@ -212,7 +212,7 @@ void CRYPTO_poly1305_update(poly1305_state *statep, const uint8_t *in,
unsigned int i;
struct poly1305_state_st *state = (struct poly1305_state_st *)statep;
#if defined(OPENSSL_ARM)
#if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
if (CRYPTO_is_NEON_functional()) {
CRYPTO_poly1305_update_neon(statep, in, in_len);
return;
@ -255,7 +255,7 @@ void CRYPTO_poly1305_finish(poly1305_state *statep, uint8_t mac[16]) {
uint32_t g0, g1, g2, g3, g4;
uint32_t b, nb;
#if defined(OPENSSL_ARM)
#if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
if (CRYPTO_is_NEON_functional()) {
CRYPTO_poly1305_finish_neon(statep, mac);
return;

View File

@ -17,8 +17,7 @@
#include <openssl/poly1305.h>
#if defined(OPENSSL_ARM)
#if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
typedef struct {
uint32_t v[12]; /* for alignment; only using 10 */
@ -285,4 +284,4 @@ void CRYPTO_poly1305_finish_neon(poly1305_state *state, uint8_t mac[16]) {
fe1305x2_tobytearray(mac, h);
}
#endif /* OPENSSL_ARM */
#endif /* OPENSSL_ARM && !OPENSSL_NO_ASM */

View File

@ -1,4 +1,4 @@
#if defined(__arm__)
#if defined(__arm__) && !defined(OPENSSL_NO_ASM)
# This implementation was taken from the public domain, neon2 version in
# SUPERCOP by D. J. Bernstein and Peter Schwabe.
@ -2012,4 +2012,4 @@ vst1.8 d4,[r0,: 64]
add sp,sp,#0
bx lr
#endif
#endif /* __arm__ && !OPENSSL_NO_ASM */