From 2588b52ab24cc6ccc35de60c695174eb8277a386 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Thu, 7 May 2026 15:40:33 +0000 Subject: Use defines for text and rodata section names in SHA assembly. These vary between platforms. ok kenjiro@ tb@ --- src/lib/libcrypto/crypto_assembly.h | 12 +++++++++++- src/lib/libcrypto/sha/sha1_aarch64_ce.S | 4 ++-- src/lib/libcrypto/sha/sha1_amd64_shani.S | 6 +++--- src/lib/libcrypto/sha/sha256_aarch64_ce.S | 6 +++--- src/lib/libcrypto/sha/sha256_amd64_generic.S | 6 +++--- src/lib/libcrypto/sha/sha256_amd64_shani.S | 6 +++--- src/lib/libcrypto/sha/sha512_aarch64_ce.S | 6 +++--- src/lib/libcrypto/sha/sha512_amd64_generic.S | 6 +++--- 8 files changed, 31 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/crypto_assembly.h b/src/lib/libcrypto/crypto_assembly.h index 8f53ea51b6..b291de4f17 100644 --- a/src/lib/libcrypto/crypto_assembly.h +++ b/src/lib/libcrypto/crypto_assembly.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto_assembly.h,v 1.2 2026/05/07 15:38:03 jsing Exp $ */ +/* $OpenBSD: crypto_assembly.h,v 1.3 2026/05/07 15:40:33 jsing Exp $ */ /* * Copyright (c) 2026 Joel Sing * @@ -33,4 +33,14 @@ #define CRYPTO_ASSEMBLY_SEPARATOR ; #endif +#if defined(__APPLE__) +#define CRYPTO_ASSEMBLY_SECTION_TEXT __TEXT,__text +#define CRYPTO_ASSEMBLY_SECTION_RODATA __DATA,__const + +#else +#define CRYPTO_ASSEMBLY_SECTION_TEXT .text +#define CRYPTO_ASSEMBLY_SECTION_RODATA .rodata + +#endif + #endif diff --git a/src/lib/libcrypto/sha/sha1_aarch64_ce.S b/src/lib/libcrypto/sha/sha1_aarch64_ce.S index e6b1a33018..53dcd46fda 100644 --- a/src/lib/libcrypto/sha/sha1_aarch64_ce.S +++ b/src/lib/libcrypto/sha/sha1_aarch64_ce.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sha1_aarch64_ce.S,v 1.6 2026/05/07 15:38:03 jsing Exp $ */ +/* $OpenBSD: sha1_aarch64_ce.S,v 1.7 2026/05/07 15:40:33 jsing Exp $ */ /* * Copyright (c) 2023,2025 Joel Sing * @@ -104,7 +104,7 @@ .arch armv8-a+sha2 -.section .text +.section CRYPTO_ASSEMBLY_SECTION_TEXT /* * void sha1_block_ce(SHA256_CTX *ctx, const void *in, size_t num); diff --git a/src/lib/libcrypto/sha/sha1_amd64_shani.S b/src/lib/libcrypto/sha/sha1_amd64_shani.S index 201688785c..f957238f80 100644 --- a/src/lib/libcrypto/sha/sha1_amd64_shani.S +++ b/src/lib/libcrypto/sha/sha1_amd64_shani.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sha1_amd64_shani.S,v 1.5 2026/05/07 15:38:03 jsing Exp $ */ +/* $OpenBSD: sha1_amd64_shani.S,v 1.6 2026/05/07 15:40:33 jsing Exp $ */ /* * Copyright (c) 2024 Joel Sing * @@ -69,7 +69,7 @@ sha1_shani_round(fn, xm0, xe, xe_next) -.section .text +.section CRYPTO_ASSEMBLY_SECTION_TEXT /* * void sha1_block_shani(SHA256_CTX *ctx, const void *in, size_t num); @@ -155,7 +155,7 @@ sha1_block_shani: ret -.section .rodata +.section CRYPTO_ASSEMBLY_SECTION_RODATA /* * Shuffle mask - byte reversal for little endian to big endian word conversion, diff --git a/src/lib/libcrypto/sha/sha256_aarch64_ce.S b/src/lib/libcrypto/sha/sha256_aarch64_ce.S index d96ee7ebff..aef164ebe9 100644 --- a/src/lib/libcrypto/sha/sha256_aarch64_ce.S +++ b/src/lib/libcrypto/sha/sha256_aarch64_ce.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sha256_aarch64_ce.S,v 1.7 2026/05/07 15:38:03 jsing Exp $ */ +/* $OpenBSD: sha256_aarch64_ce.S,v 1.8 2026/05/07 15:40:33 jsing Exp $ */ /* * Copyright (c) 2023,2025 Joel Sing * @@ -95,7 +95,7 @@ .arch armv8-a+sha2 -.section .text +.section CRYPTO_ASSEMBLY_SECTION_TEXT /* * void sha256_block_ce(SHA256_CTX *ctx, const void *in, size_t num); @@ -174,7 +174,7 @@ sha256_block_ce: ret -.section .rodata +.section CRYPTO_ASSEMBLY_SECTION_RODATA /* * SHA-256 constants - see FIPS 180-4 section 4.2.3. diff --git a/src/lib/libcrypto/sha/sha256_amd64_generic.S b/src/lib/libcrypto/sha/sha256_amd64_generic.S index f74af0b145..aa098a0991 100644 --- a/src/lib/libcrypto/sha/sha256_amd64_generic.S +++ b/src/lib/libcrypto/sha/sha256_amd64_generic.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sha256_amd64_generic.S,v 1.7 2026/05/07 15:38:03 jsing Exp $ */ +/* $OpenBSD: sha256_amd64_generic.S,v 1.8 2026/05/07 15:40:33 jsing Exp $ */ /* * Copyright (c) 2024 Joel Sing * @@ -141,7 +141,7 @@ sha256_message_schedule_update(idx, %rsp, tmp0) _SEP \ sha256_round(idx, a, b, c, d, e, f, g, h, k256, %rsp, tmp0) -.section .text +.section CRYPTO_ASSEMBLY_SECTION_TEXT /* * void sha256_block_generic(SHA256_CTX *ctx, const void *in, size_t num); @@ -274,7 +274,7 @@ sha256_block_generic: ret -.section .rodata +.section CRYPTO_ASSEMBLY_SECTION_RODATA /* * SHA-256 constants - see FIPS 180-4 section 4.2.2. diff --git a/src/lib/libcrypto/sha/sha256_amd64_shani.S b/src/lib/libcrypto/sha/sha256_amd64_shani.S index 2684c809ba..10861ee7b6 100644 --- a/src/lib/libcrypto/sha/sha256_amd64_shani.S +++ b/src/lib/libcrypto/sha/sha256_amd64_shani.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sha256_amd64_shani.S,v 1.5 2026/05/07 15:38:03 jsing Exp $ */ +/* $OpenBSD: sha256_amd64_shani.S,v 1.6 2026/05/07 15:40:33 jsing Exp $ */ /* * Copyright (c) 2024 Joel Sing * @@ -78,7 +78,7 @@ movdqa xmt0, xmsg _SEP \ sha256_shani_round(idx) -.section .text +.section CRYPTO_ASSEMBLY_SECTION_TEXT /* * void sha256_block_shani(SHA256_CTX *ctx, const void *in, size_t num); @@ -171,7 +171,7 @@ sha256_block_shani: ret -.section .rodata +.section CRYPTO_ASSEMBLY_SECTION_RODATA /* * Shuffle mask - little endian to big endian word conversion. diff --git a/src/lib/libcrypto/sha/sha512_aarch64_ce.S b/src/lib/libcrypto/sha/sha512_aarch64_ce.S index 71d18fbcd4..a5adae1b38 100644 --- a/src/lib/libcrypto/sha/sha512_aarch64_ce.S +++ b/src/lib/libcrypto/sha/sha512_aarch64_ce.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sha512_aarch64_ce.S,v 1.5 2026/05/07 15:38:03 jsing Exp $ */ +/* $OpenBSD: sha512_aarch64_ce.S,v 1.6 2026/05/07 15:40:33 jsing Exp $ */ /* * Copyright (c) 2023,2025 Joel Sing * @@ -164,7 +164,7 @@ .arch armv8-a+sha3 -.section .text +.section CRYPTO_ASSEMBLY_SECTION_TEXT /* * void sha512_block_ce(SHA512_CTX *ctx, const void *in, size_t num); @@ -295,7 +295,7 @@ sha512_block_ce: ret -.section .rodata +.section CRYPTO_ASSEMBLY_SECTION_RODATA /* * SHA-512 constants - see FIPS 180-4 section 4.2.3. diff --git a/src/lib/libcrypto/sha/sha512_amd64_generic.S b/src/lib/libcrypto/sha/sha512_amd64_generic.S index fac9d95655..d4b6ebc0ff 100644 --- a/src/lib/libcrypto/sha/sha512_amd64_generic.S +++ b/src/lib/libcrypto/sha/sha512_amd64_generic.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sha512_amd64_generic.S,v 1.5 2026/05/07 15:38:03 jsing Exp $ */ +/* $OpenBSD: sha512_amd64_generic.S,v 1.6 2026/05/07 15:40:33 jsing Exp $ */ /* * Copyright (c) 2024 Joel Sing * @@ -142,7 +142,7 @@ sha512_message_schedule_update(idx, %rsp, tmp0) _SEP \ sha512_round(idx, a, b, c, d, e, f, g, h, k512, %rsp, tmp0) -.section .text +.section CRYPTO_ASSEMBLY_SECTION_TEXT /* * void sha512_block_generic(SHA512_CTX *ctx, const void *in, size_t num); @@ -275,7 +275,7 @@ sha512_block_generic: ret -.section .rodata +.section CRYPTO_ASSEMBLY_SECTION_RODATA /* * SHA-512 constants - see FIPS 180-4 section 4.2.3. -- cgit v1.2.3-55-g6feb