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>
This commit is contained in:
David Benjamin
2025-02-03 14:12:33 -08:00
committed by Boringssl LUCI CQ
parent 2b19cd39ba
commit b0256708a7
6 changed files with 42 additions and 42 deletions
+4 -4
View File
@@ -826,8 +826,8 @@ TEST(ChaChaPoly1305Test, ABI) {
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 @@ TEST(ChaChaPoly1305Test, ABI) {
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);
@@ -440,10 +440,10 @@ poly_hash_ad_internal:
# 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 @@ $code.="
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 @@ $code.="
# 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 @@ $code.="
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";
}
+6 -6
View File
@@ -146,7 +146,7 @@ inline int chacha20_poly1305_asm_capable(void) {
// 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 @@ inline void chacha20_poly1305_open(uint8_t *out_plaintext,
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 @@ extern void chacha20_poly1305_open(uint8_t *out_plaintext,
// 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 @@ inline void chacha20_poly1305_seal(uint8_t *out_ciphertext,
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
+6 -6
View File
@@ -212,11 +212,11 @@ L$hash_ad_done:
.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 @@ L$open_sse_128_xor_hash:
.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
+10 -10
View File
@@ -212,11 +212,11 @@ poly_hash_ad_internal:
.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 @@ _CET_ENDBR
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 @@ _CET_ENDBR
.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 @@ process_extra_in_trailer:
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
+8 -8
View File
@@ -220,14 +220,14 @@ $L$hash_ad_done:
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 @@ $L$open_sse_128_xor_hash:
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 @@ $L$SEH_end_chacha20_poly1305_open_nohw:
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 @@ DB 102,69,15,58,15,246,4
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: