|
0 |
Index: rust-sha1-asm-0.5.1/build.rs
|
|
1 |
===================================================================
|
|
2 |
--- rust-sha1-asm-0.5.1.orig/build.rs
|
|
3 |
+++ rust-sha1-asm-0.5.1/build.rs
|
|
4 |
@@ -11,12 +11,14 @@ fn main() {
|
|
5 |
} else if target_arch == "aarch64" {
|
|
6 |
"src/aarch64.S"
|
|
7 |
} else {
|
|
8 |
- panic!("Unsupported target architecture");
|
|
9 |
+ ""
|
|
10 |
};
|
|
11 |
let mut build = cc::Build::new();
|
|
12 |
if target_arch == "aarch64" {
|
|
13 |
build.flag("-march=armv8-a+crypto");
|
|
14 |
}
|
|
15 |
- build.flag("-c").file(asm_path).compile("libsha1.a");
|
|
16 |
+ if asm_path != "" {
|
|
17 |
+ build.flag("-c").file(asm_path).compile("libsha1.a");
|
|
18 |
+ }
|
|
19 |
println!("dh-cargo:deb-built-using=sha1=0={}", std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
|
20 |
}
|
|
21 |
Index: rust-sha1-asm-0.5.1/src/lib.rs
|
|
22 |
===================================================================
|
|
23 |
--- rust-sha1-asm-0.5.1.orig/src/lib.rs
|
|
24 |
+++ rust-sha1-asm-0.5.1/src/lib.rs
|
|
25 |
@@ -9,15 +9,15 @@
|
|
26 |
//! [`sha-1`]: https://crates.io/crates/sha-1
|
|
27 |
|
|
28 |
#![no_std]
|
|
29 |
-#[cfg(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")))]
|
|
30 |
-compile_error!("crate can only be used on x86, x86_64 and AArch64 architectures");
|
|
31 |
|
|
32 |
+#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))]
|
|
33 |
#[link(name = "sha1", kind = "static")]
|
|
34 |
extern "C" {
|
|
35 |
fn sha1_compress(state: &mut [u32; 5], block: &[u8; 64]);
|
|
36 |
}
|
|
37 |
|
|
38 |
/// Safe wrapper around assembly implementation of SHA-1 compression function
|
|
39 |
+#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))]
|
|
40 |
#[inline]
|
|
41 |
pub fn compress(state: &mut [u32; 5], blocks: &[[u8; 64]]) {
|
|
42 |
for block in blocks {
|