-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support PowerPC architecture for sigv4 signature (#1847)
* Use hmac and sha2 instead of ring on powerpc * Enable aws-sig-auth in CI * Update CHANGELOG * Run tests against exotic platforms * Run tests only against aws rust runtime * PowerPC 32 and 64 bit should be fully testable now * Maybe this time build and test will work * Add licence header to hmac.rs * Properly use finalized_fixed * Revert leftover * Temporary disable crc32c test on powerpc * Temporary disable system_time_conversion_test on 32bit CPUs * Disable other 3 tests on 32bit * Temporarily disable last test * Update CHANGELOG and document TODOs with issues * Run aws-smithy-client tests in CI with crosscompiled local openssl * Simplify CI script * Use correct curl options * Use the right OS for i686 * Looks like I finally foung the right os type for i686 * Add `tcp` feature to `hyper` to get tests compiling. * Enable verbose logging to debug CI failure in cross. * Use pre-built openSSL on i686 * Fix empty spaces. * Set environment variables based on matrix.target * Remove all usages of `ring` from `aws-sigv4`. It ensures broader platform compatibility and higher performance. * Update changelog entries. * Remove redundant dev dependencies. Co-authored-by: Luca Palmieri <[email protected]>
- Loading branch information
1 parent
1d9aede
commit 7e666da
Showing
10 changed files
with
192 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use hmac::digest::FixedOutput; | ||
use hmac::{Hmac, Mac}; | ||
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] | ||
use ring::hmac::{sign, Context, Key, HMAC_SHA256}; | ||
use sha2::Sha256; | ||
|
||
pub fn hmac(c: &mut Criterion) { | ||
c.bench_function("hmac", |b| { | ||
b.iter(|| { | ||
let mut mac = Hmac::<Sha256>::new_from_slice(b"secret").unwrap(); | ||
|
||
mac.update(b"hello, world"); | ||
mac.finalize_fixed() | ||
}) | ||
}); | ||
} | ||
|
||
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] | ||
pub fn ring_multipart(c: &mut Criterion) { | ||
c.bench_function("ring_multipart", |b| { | ||
b.iter(|| { | ||
let k = Key::new(HMAC_SHA256, b"secret"); | ||
let mut ctx = Context::with_key(&k); | ||
|
||
for slice in ["hello", ", ", "world"] { | ||
ctx.update(slice.as_ref()); | ||
} | ||
|
||
ctx.sign() | ||
}) | ||
}); | ||
} | ||
|
||
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] | ||
pub fn ring_one_shot(c: &mut Criterion) { | ||
c.bench_function("ring_one_shot", |b| { | ||
b.iter(|| { | ||
let k = Key::new(HMAC_SHA256, b"secret"); | ||
|
||
sign(&k, b"hello, world") | ||
}) | ||
}); | ||
} | ||
|
||
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] | ||
criterion_group! { | ||
name = benches; | ||
|
||
config = Criterion::default(); | ||
|
||
targets = hmac, ring_multipart, ring_one_shot | ||
} | ||
|
||
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] | ||
criterion_group! { | ||
name = benches; | ||
|
||
config = Criterion::default(); | ||
|
||
targets = hmac | ||
} | ||
|
||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters