Rename chacha20_poly1305_*_nohw to chacha20_poly1305_*_sse41
Brian Smith points out that the functions actually require SSE 4.1. I
just didn't notice because that check was inside the
chacha20_poly1305_asm_capable check.
Change-Id: Ib7a0b876cb760411dd0fc0011fc7d18b1984e39a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/75847
Reviewed-by: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
diff --git a/crypto/cipher/aead_test.cc b/crypto/cipher/aead_test.cc
index a68bf53..a2e5635 100644
--- a/crypto/cipher/aead_test.cc
+++ b/crypto/cipher/aead_test.cc
@@ -826,8 +826,8 @@
SCOPED_TRACE(len);
union chacha20_poly1305_open_data open_ctx = {};
#if defined(OPENSSL_X86_64)
- CHECK_ABI(chacha20_poly1305_open_nohw, buf.get(), buf.get(), len, buf.get(),
- len % 128, &open_ctx);
+ CHECK_ABI(chacha20_poly1305_open_sse41, buf.get(), buf.get(), len,
+ buf.get(), len % 128, &open_ctx);
if (CRYPTO_is_AVX2_capable() && CRYPTO_is_BMI2_capable()) {
CHECK_ABI(chacha20_poly1305_open_avx2, buf.get(), buf.get(), len,
buf.get(), len % 128, &open_ctx);
@@ -842,8 +842,8 @@
SCOPED_TRACE(len);
union chacha20_poly1305_seal_data seal_ctx = {};
#if defined(OPENSSL_X86_64)
- CHECK_ABI(chacha20_poly1305_seal_nohw, buf.get(), buf.get(), len, buf.get(),
- len % 128, &seal_ctx);
+ CHECK_ABI(chacha20_poly1305_seal_sse41, buf.get(), buf.get(), len,
+ buf.get(), len % 128, &seal_ctx);
if (CRYPTO_is_AVX2_capable() && CRYPTO_is_BMI2_capable()) {
CHECK_ABI(chacha20_poly1305_seal_avx2, buf.get(), buf.get(), len,
buf.get(), len % 128, &seal_ctx);
diff --git a/crypto/cipher/asm/chacha20_poly1305_x86_64.pl b/crypto/cipher/asm/chacha20_poly1305_x86_64.pl
index 9297052..7c25943 100644
--- a/crypto/cipher/asm/chacha20_poly1305_x86_64.pl
+++ b/crypto/cipher/asm/chacha20_poly1305_x86_64.pl
@@ -440,10 +440,10 @@
# union chacha20_poly1305_open_data *aead_data)
#
$code.="
-.globl chacha20_poly1305_open_nohw
-.type chacha20_poly1305_open_nohw,\@function,6
+.globl chacha20_poly1305_open_sse41
+.type chacha20_poly1305_open_sse41,\@function,6
.align 64
-chacha20_poly1305_open_nohw:
+chacha20_poly1305_open_sse41:
.cfi_startproc
_CET_ENDBR
push %rbp
@@ -849,7 +849,7 @@
movdqa $C2, $B2
movdqa $D2, $C2
jmp .Lopen_sse_128_xor_hash
-.size chacha20_poly1305_open_nohw, .-chacha20_poly1305_open_nohw
+.size chacha20_poly1305_open_sse41, .-chacha20_poly1305_open_sse41
.cfi_endproc
################################################################################
@@ -858,10 +858,10 @@
# size_t plaintext_len, const uint8_t *ad,
# size_t ad_len,
# union chacha20_poly1305_seal_data *data);
-.globl chacha20_poly1305_seal_nohw
-.type chacha20_poly1305_seal_nohw,\@function,6
+.globl chacha20_poly1305_seal_sse41
+.type chacha20_poly1305_seal_sse41,\@function,6
.align 64
-chacha20_poly1305_seal_nohw:
+chacha20_poly1305_seal_sse41:
.cfi_startproc
_CET_ENDBR
push %rbp
@@ -1357,7 +1357,7 @@
mov %r8, $itr2
call poly_hash_ad_internal
jmp .Lseal_sse_128_tail_xor
-.size chacha20_poly1305_seal_nohw, .-chacha20_poly1305_seal_nohw
+.size chacha20_poly1305_seal_sse41, .-chacha20_poly1305_seal_sse41
.cfi_endproc\n";
}
diff --git a/crypto/cipher/internal.h b/crypto/cipher/internal.h
index c10766d..58d10e0 100644
--- a/crypto/cipher/internal.h
+++ b/crypto/cipher/internal.h
@@ -146,7 +146,7 @@
// write calculated tag value to |aead_data->out.tag|, which the caller must
// check.
#if defined(OPENSSL_X86_64)
-extern void chacha20_poly1305_open_nohw(
+extern void chacha20_poly1305_open_sse41(
uint8_t *out_plaintext, const uint8_t *ciphertext, size_t plaintext_len,
const uint8_t *ad, size_t ad_len, union chacha20_poly1305_open_data *data);
extern void chacha20_poly1305_open_avx2(
@@ -161,8 +161,8 @@
chacha20_poly1305_open_avx2(out_plaintext, ciphertext, plaintext_len, ad,
ad_len, data);
} else {
- chacha20_poly1305_open_nohw(out_plaintext, ciphertext, plaintext_len, ad,
- ad_len, data);
+ chacha20_poly1305_open_sse41(out_plaintext, ciphertext, plaintext_len, ad,
+ ad_len, data);
}
}
#else
@@ -179,7 +179,7 @@
// value is over the computed ciphertext concatenated with |extra_ciphertext|
// and written to |aead_data->out.tag|.
#if defined(OPENSSL_X86_64)
-extern void chacha20_poly1305_seal_nohw(
+extern void chacha20_poly1305_seal_sse41(
uint8_t *out_ciphertext, const uint8_t *plaintext, size_t plaintext_len,
const uint8_t *ad, size_t ad_len, union chacha20_poly1305_seal_data *data);
extern void chacha20_poly1305_seal_avx2(
@@ -194,8 +194,8 @@
chacha20_poly1305_seal_avx2(out_ciphertext, plaintext, plaintext_len, ad,
ad_len, data);
} else {
- chacha20_poly1305_seal_nohw(out_ciphertext, plaintext, plaintext_len, ad,
- ad_len, data);
+ chacha20_poly1305_seal_sse41(out_ciphertext, plaintext, plaintext_len, ad,
+ ad_len, data);
}
}
#else
diff --git a/gen/crypto/chacha20_poly1305_x86_64-apple.S b/gen/crypto/chacha20_poly1305_x86_64-apple.S
index 5ae5849..a261463 100644
--- a/gen/crypto/chacha20_poly1305_x86_64-apple.S
+++ b/gen/crypto/chacha20_poly1305_x86_64-apple.S
@@ -212,11 +212,11 @@
-.globl _chacha20_poly1305_open_nohw
-.private_extern _chacha20_poly1305_open_nohw
+.globl _chacha20_poly1305_open_sse41
+.private_extern _chacha20_poly1305_open_sse41
.p2align 6
-_chacha20_poly1305_open_nohw:
+_chacha20_poly1305_open_sse41:
_CET_ENDBR
pushq %rbp
@@ -2079,11 +2079,11 @@
-.globl _chacha20_poly1305_seal_nohw
-.private_extern _chacha20_poly1305_seal_nohw
+.globl _chacha20_poly1305_seal_sse41
+.private_extern _chacha20_poly1305_seal_sse41
.p2align 6
-_chacha20_poly1305_seal_nohw:
+_chacha20_poly1305_seal_sse41:
_CET_ENDBR
pushq %rbp
diff --git a/gen/crypto/chacha20_poly1305_x86_64-linux.S b/gen/crypto/chacha20_poly1305_x86_64-linux.S
index 22123ee..180b41e 100644
--- a/gen/crypto/chacha20_poly1305_x86_64-linux.S
+++ b/gen/crypto/chacha20_poly1305_x86_64-linux.S
@@ -212,11 +212,11 @@
.cfi_endproc
.size poly_hash_ad_internal, .-poly_hash_ad_internal
-.globl chacha20_poly1305_open_nohw
-.hidden chacha20_poly1305_open_nohw
-.type chacha20_poly1305_open_nohw,@function
+.globl chacha20_poly1305_open_sse41
+.hidden chacha20_poly1305_open_sse41
+.type chacha20_poly1305_open_sse41,@function
.align 64
-chacha20_poly1305_open_nohw:
+chacha20_poly1305_open_sse41:
.cfi_startproc
_CET_ENDBR
pushq %rbp
@@ -2084,7 +2084,7 @@
movdqa %xmm10,%xmm6
movdqa %xmm14,%xmm10
jmp .Lopen_sse_128_xor_hash
-.size chacha20_poly1305_open_nohw, .-chacha20_poly1305_open_nohw
+.size chacha20_poly1305_open_sse41, .-chacha20_poly1305_open_sse41
.cfi_endproc
@@ -2093,11 +2093,11 @@
-.globl chacha20_poly1305_seal_nohw
-.hidden chacha20_poly1305_seal_nohw
-.type chacha20_poly1305_seal_nohw,@function
+.globl chacha20_poly1305_seal_sse41
+.hidden chacha20_poly1305_seal_sse41
+.type chacha20_poly1305_seal_sse41,@function
.align 64
-chacha20_poly1305_seal_nohw:
+chacha20_poly1305_seal_sse41:
.cfi_startproc
_CET_ENDBR
pushq %rbp
@@ -4085,7 +4085,7 @@
movq %r8,%r8
call poly_hash_ad_internal
jmp .Lseal_sse_128_tail_xor
-.size chacha20_poly1305_seal_nohw, .-chacha20_poly1305_seal_nohw
+.size chacha20_poly1305_seal_sse41, .-chacha20_poly1305_seal_sse41
.cfi_endproc
diff --git a/gen/crypto/chacha20_poly1305_x86_64-win.asm b/gen/crypto/chacha20_poly1305_x86_64-win.asm
index 22dbdfe..25c69ef 100644
--- a/gen/crypto/chacha20_poly1305_x86_64-win.asm
+++ b/gen/crypto/chacha20_poly1305_x86_64-win.asm
@@ -220,14 +220,14 @@
-global chacha20_poly1305_open_nohw
+global chacha20_poly1305_open_sse41
ALIGN 64
-chacha20_poly1305_open_nohw:
+chacha20_poly1305_open_sse41:
mov QWORD[8+rsp],rdi ;WIN64 prologue
mov QWORD[16+rsp],rsi
mov rax,rsp
-$L$SEH_begin_chacha20_poly1305_open_nohw:
+$L$SEH_begin_chacha20_poly1305_open_sse41:
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
@@ -2113,7 +2113,7 @@
movdqa xmm6,xmm10
movdqa xmm10,xmm14
jmp NEAR $L$open_sse_128_xor_hash
-$L$SEH_end_chacha20_poly1305_open_nohw:
+$L$SEH_end_chacha20_poly1305_open_sse41:
@@ -2122,14 +2122,14 @@
-global chacha20_poly1305_seal_nohw
+global chacha20_poly1305_seal_sse41
ALIGN 64
-chacha20_poly1305_seal_nohw:
+chacha20_poly1305_seal_sse41:
mov QWORD[8+rsp],rdi ;WIN64 prologue
mov QWORD[16+rsp],rsi
mov rax,rsp
-$L$SEH_begin_chacha20_poly1305_seal_nohw:
+$L$SEH_begin_chacha20_poly1305_seal_sse41:
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
@@ -4135,7 +4135,7 @@
mov r8,r8
call poly_hash_ad_internal
jmp NEAR $L$seal_sse_128_tail_xor
-$L$SEH_end_chacha20_poly1305_seal_nohw:
+$L$SEH_end_chacha20_poly1305_seal_sse41: