Skip to content

Commit c5290f6

Browse files
dyroDylan Ross
andauthored
chore(sdk): enable asm optimizations for sha2 on aarch64 (#1350)
Co-authored-by: Dylan Ross <[email protected]>
1 parent f664f7f commit c5290f6

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/Cargo.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ serde_json = { version = "1.0.117", features = ["preserve_order"] }
177177
serde_with = "3.11.0"
178178
serde-transcode = "1.1.1"
179179
sha1 = "0.10.6"
180-
sha2 = "0.10.6"
181180
spki = { version = "0.7.3", optional = true }
182181
static-iref = "3.0"
183182
tempfile = "=3.15.0"
@@ -191,6 +190,19 @@ x509-parser = "0.16.0"
191190
zeroize = { version = "1.8", features = ["zeroize_derive"] }
192191
zip = { version = "3.0.0", default-features = false }
193192

193+
# Use the asm feature of sha2 on aarch64 for better performance. This nearly
194+
# halves hashing time for large assets (> 50gb mp4, for example).
195+
#
196+
# Note: This feature has been removed in later versions of sha2.
197+
# If upgrading, ensure sha2 has implemented equivalent optimizations for aarch64.
198+
#
199+
# See: https://github.com/RustCrypto/hashes/pull/542 and
200+
# https://github.com/RustCrypto/hashes/tree/master/sha2#backends (which hasn't been released yet).
201+
[target.'cfg(target_arch = "aarch64")'.dependencies]
202+
sha2 = { version = "0.10.6", features = ["asm"] }
203+
[target.'cfg(not(target_arch = "aarch64"))'.dependencies]
204+
sha2 = "0.10.6"
205+
194206
[target.'cfg(target_arch = "wasm32")'.dependencies]
195207
const-oid = "0.9.6"
196208
der = "0.7.9"

0 commit comments

Comments
 (0)