diff options
| author | jsing <> | 2026-05-07 15:40:33 +0000 |
|---|---|---|
| committer | jsing <> | 2026-05-07 15:40:33 +0000 |
| commit | 2588b52ab24cc6ccc35de60c695174eb8277a386 (patch) | |
| tree | fe04dba8ff85d0ae3a8b590f80cda8498dc2059f /src/lib | |
| parent | ccc4eae3de33ef320762657c4be6c9dfd9c2de82 (diff) | |
| download | openbsd-2588b52ab24cc6ccc35de60c695174eb8277a386.tar.gz openbsd-2588b52ab24cc6ccc35de60c695174eb8277a386.tar.bz2 openbsd-2588b52ab24cc6ccc35de60c695174eb8277a386.zip | |
Use defines for text and rodata section names in SHA assembly.
These vary between platforms.
ok kenjiro@ tb@
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/libcrypto/crypto_assembly.h | 12 | ||||
| -rw-r--r-- | src/lib/libcrypto/sha/sha1_aarch64_ce.S | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/sha/sha1_amd64_shani.S | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/sha/sha256_aarch64_ce.S | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/sha/sha256_amd64_generic.S | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/sha/sha256_amd64_shani.S | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/sha/sha512_aarch64_ce.S | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/sha/sha512_amd64_generic.S | 6 |
8 files changed, 31 insertions, 21 deletions
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 @@ | |||
| 1 | /* $OpenBSD: crypto_assembly.h,v 1.2 2026/05/07 15:38:03 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_assembly.h,v 1.3 2026/05/07 15:40:33 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2026 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2026 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -33,4 +33,14 @@ | |||
| 33 | #define CRYPTO_ASSEMBLY_SEPARATOR ; | 33 | #define CRYPTO_ASSEMBLY_SEPARATOR ; |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | #if defined(__APPLE__) | ||
| 37 | #define CRYPTO_ASSEMBLY_SECTION_TEXT __TEXT,__text | ||
| 38 | #define CRYPTO_ASSEMBLY_SECTION_RODATA __DATA,__const | ||
| 39 | |||
| 40 | #else | ||
| 41 | #define CRYPTO_ASSEMBLY_SECTION_TEXT .text | ||
| 42 | #define CRYPTO_ASSEMBLY_SECTION_RODATA .rodata | ||
| 43 | |||
| 44 | #endif | ||
| 45 | |||
| 36 | #endif | 46 | #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 @@ | |||
| 1 | /* $OpenBSD: sha1_aarch64_ce.S,v 1.6 2026/05/07 15:38:03 jsing Exp $ */ | 1 | /* $OpenBSD: sha1_aarch64_ce.S,v 1.7 2026/05/07 15:40:33 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -104,7 +104,7 @@ | |||
| 104 | 104 | ||
| 105 | .arch armv8-a+sha2 | 105 | .arch armv8-a+sha2 |
| 106 | 106 | ||
| 107 | .section .text | 107 | .section CRYPTO_ASSEMBLY_SECTION_TEXT |
| 108 | 108 | ||
| 109 | /* | 109 | /* |
| 110 | * void sha1_block_ce(SHA256_CTX *ctx, const void *in, size_t num); | 110 | * 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 @@ | |||
| 1 | /* $OpenBSD: sha1_amd64_shani.S,v 1.5 2026/05/07 15:38:03 jsing Exp $ */ | 1 | /* $OpenBSD: sha1_amd64_shani.S,v 1.6 2026/05/07 15:40:33 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -69,7 +69,7 @@ | |||
| 69 | sha1_shani_round(fn, xm0, xe, xe_next) | 69 | sha1_shani_round(fn, xm0, xe, xe_next) |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | .section .text | 72 | .section CRYPTO_ASSEMBLY_SECTION_TEXT |
| 73 | 73 | ||
| 74 | /* | 74 | /* |
| 75 | * void sha1_block_shani(SHA256_CTX *ctx, const void *in, size_t num); | 75 | * void sha1_block_shani(SHA256_CTX *ctx, const void *in, size_t num); |
| @@ -155,7 +155,7 @@ sha1_block_shani: | |||
| 155 | 155 | ||
| 156 | ret | 156 | ret |
| 157 | 157 | ||
| 158 | .section .rodata | 158 | .section CRYPTO_ASSEMBLY_SECTION_RODATA |
| 159 | 159 | ||
| 160 | /* | 160 | /* |
| 161 | * Shuffle mask - byte reversal for little endian to big endian word conversion, | 161 | * 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 @@ | |||
| 1 | /* $OpenBSD: sha256_aarch64_ce.S,v 1.7 2026/05/07 15:38:03 jsing Exp $ */ | 1 | /* $OpenBSD: sha256_aarch64_ce.S,v 1.8 2026/05/07 15:40:33 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -95,7 +95,7 @@ | |||
| 95 | 95 | ||
| 96 | .arch armv8-a+sha2 | 96 | .arch armv8-a+sha2 |
| 97 | 97 | ||
| 98 | .section .text | 98 | .section CRYPTO_ASSEMBLY_SECTION_TEXT |
| 99 | 99 | ||
| 100 | /* | 100 | /* |
| 101 | * void sha256_block_ce(SHA256_CTX *ctx, const void *in, size_t num); | 101 | * void sha256_block_ce(SHA256_CTX *ctx, const void *in, size_t num); |
| @@ -174,7 +174,7 @@ sha256_block_ce: | |||
| 174 | 174 | ||
| 175 | ret | 175 | ret |
| 176 | 176 | ||
| 177 | .section .rodata | 177 | .section CRYPTO_ASSEMBLY_SECTION_RODATA |
| 178 | 178 | ||
| 179 | /* | 179 | /* |
| 180 | * SHA-256 constants - see FIPS 180-4 section 4.2.3. | 180 | * 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 @@ | |||
| 1 | /* $OpenBSD: sha256_amd64_generic.S,v 1.7 2026/05/07 15:38:03 jsing Exp $ */ | 1 | /* $OpenBSD: sha256_amd64_generic.S,v 1.8 2026/05/07 15:40:33 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -141,7 +141,7 @@ | |||
| 141 | sha256_message_schedule_update(idx, %rsp, tmp0) _SEP \ | 141 | sha256_message_schedule_update(idx, %rsp, tmp0) _SEP \ |
| 142 | sha256_round(idx, a, b, c, d, e, f, g, h, k256, %rsp, tmp0) | 142 | sha256_round(idx, a, b, c, d, e, f, g, h, k256, %rsp, tmp0) |
| 143 | 143 | ||
| 144 | .section .text | 144 | .section CRYPTO_ASSEMBLY_SECTION_TEXT |
| 145 | 145 | ||
| 146 | /* | 146 | /* |
| 147 | * void sha256_block_generic(SHA256_CTX *ctx, const void *in, size_t num); | 147 | * void sha256_block_generic(SHA256_CTX *ctx, const void *in, size_t num); |
| @@ -274,7 +274,7 @@ sha256_block_generic: | |||
| 274 | 274 | ||
| 275 | ret | 275 | ret |
| 276 | 276 | ||
| 277 | .section .rodata | 277 | .section CRYPTO_ASSEMBLY_SECTION_RODATA |
| 278 | 278 | ||
| 279 | /* | 279 | /* |
| 280 | * SHA-256 constants - see FIPS 180-4 section 4.2.2. | 280 | * 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 @@ | |||
| 1 | /* $OpenBSD: sha256_amd64_shani.S,v 1.5 2026/05/07 15:38:03 jsing Exp $ */ | 1 | /* $OpenBSD: sha256_amd64_shani.S,v 1.6 2026/05/07 15:40:33 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -78,7 +78,7 @@ | |||
| 78 | movdqa xmt0, xmsg _SEP \ | 78 | movdqa xmt0, xmsg _SEP \ |
| 79 | sha256_shani_round(idx) | 79 | sha256_shani_round(idx) |
| 80 | 80 | ||
| 81 | .section .text | 81 | .section CRYPTO_ASSEMBLY_SECTION_TEXT |
| 82 | 82 | ||
| 83 | /* | 83 | /* |
| 84 | * void sha256_block_shani(SHA256_CTX *ctx, const void *in, size_t num); | 84 | * void sha256_block_shani(SHA256_CTX *ctx, const void *in, size_t num); |
| @@ -171,7 +171,7 @@ sha256_block_shani: | |||
| 171 | 171 | ||
| 172 | ret | 172 | ret |
| 173 | 173 | ||
| 174 | .section .rodata | 174 | .section CRYPTO_ASSEMBLY_SECTION_RODATA |
| 175 | 175 | ||
| 176 | /* | 176 | /* |
| 177 | * Shuffle mask - little endian to big endian word conversion. | 177 | * 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 @@ | |||
| 1 | /* $OpenBSD: sha512_aarch64_ce.S,v 1.5 2026/05/07 15:38:03 jsing Exp $ */ | 1 | /* $OpenBSD: sha512_aarch64_ce.S,v 1.6 2026/05/07 15:40:33 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023,2025 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -164,7 +164,7 @@ | |||
| 164 | 164 | ||
| 165 | .arch armv8-a+sha3 | 165 | .arch armv8-a+sha3 |
| 166 | 166 | ||
| 167 | .section .text | 167 | .section CRYPTO_ASSEMBLY_SECTION_TEXT |
| 168 | 168 | ||
| 169 | /* | 169 | /* |
| 170 | * void sha512_block_ce(SHA512_CTX *ctx, const void *in, size_t num); | 170 | * void sha512_block_ce(SHA512_CTX *ctx, const void *in, size_t num); |
| @@ -295,7 +295,7 @@ sha512_block_ce: | |||
| 295 | 295 | ||
| 296 | ret | 296 | ret |
| 297 | 297 | ||
| 298 | .section .rodata | 298 | .section CRYPTO_ASSEMBLY_SECTION_RODATA |
| 299 | 299 | ||
| 300 | /* | 300 | /* |
| 301 | * SHA-512 constants - see FIPS 180-4 section 4.2.3. | 301 | * 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 @@ | |||
| 1 | /* $OpenBSD: sha512_amd64_generic.S,v 1.5 2026/05/07 15:38:03 jsing Exp $ */ | 1 | /* $OpenBSD: sha512_amd64_generic.S,v 1.6 2026/05/07 15:40:33 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -142,7 +142,7 @@ | |||
| 142 | sha512_message_schedule_update(idx, %rsp, tmp0) _SEP \ | 142 | sha512_message_schedule_update(idx, %rsp, tmp0) _SEP \ |
| 143 | sha512_round(idx, a, b, c, d, e, f, g, h, k512, %rsp, tmp0) | 143 | sha512_round(idx, a, b, c, d, e, f, g, h, k512, %rsp, tmp0) |
| 144 | 144 | ||
| 145 | .section .text | 145 | .section CRYPTO_ASSEMBLY_SECTION_TEXT |
| 146 | 146 | ||
| 147 | /* | 147 | /* |
| 148 | * void sha512_block_generic(SHA512_CTX *ctx, const void *in, size_t num); | 148 | * void sha512_block_generic(SHA512_CTX *ctx, const void *in, size_t num); |
| @@ -275,7 +275,7 @@ sha512_block_generic: | |||
| 275 | 275 | ||
| 276 | ret | 276 | ret |
| 277 | 277 | ||
| 278 | .section .rodata | 278 | .section CRYPTO_ASSEMBLY_SECTION_RODATA |
| 279 | 279 | ||
| 280 | /* | 280 | /* |
| 281 | * SHA-512 constants - see FIPS 180-4 section 4.2.3. | 281 | * SHA-512 constants - see FIPS 180-4 section 4.2.3. |
