Closed
Description
Follow up from librespot-org/librespot#239
Seem to be having Bus errors running on aarch64 (32bit kernel).
Tested with this snippet.
extern crate aes_ctr;
use aes_ctr::stream_cipher::generic_array::GenericArray;
use aes_ctr::stream_cipher::{NewFixStreamCipher, StreamCipherCore};
use aes_ctr::Aes128Ctr;
const AUDIO_AESIV: [u8; 16] = [
0x72, 0xe0, 0x67, 0xfb, 0xdd, 0xcb, 0xcf, 0x77, 0xeb, 0xe8, 0xbc, 0x64, 0x3f, 0x63, 0x0d, 0x93,
];
#[inline(never)]
fn new_cipher(key: &[u8]) -> Aes128Ctr {
// println!("key {:?}", key);
// Will not error if this prints
Aes128Ctr::new(
GenericArray::from_slice(key),
GenericArray::from_slice(&AUDIO_AESIV),
)
}
#[inline(never)]
fn encrypt(cipher: &mut Aes128Ctr) -> [u8; 10] {
let mut data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
cipher.apply_keystream(&mut data);
data
}
fn main() {
let mut cipher = new_cipher(b"0123456789abcdef");
let data = encrypt(&mut cipher);
println!("{:?}", data);
}
Starting program: /home/ash/test_stream_ciphers
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Program received signal SIGBUS, Bus error.
0xaaab1d64 in _$LT$ctr..Ctr128$LT$C$GT$$u20$as$u20$stream_cipher..NewFixStreamCipher$GT$::new::h1cd20b0be966ea7c ()
(gdb) bt
#0 0xaaab1d64 in _$LT$ctr..Ctr128$LT$C$GT$$u20$as$u20$stream_cipher..NewFixStreamCipher$GT$::new::h1cd20b0be966ea7c ()
#1 0xaaab224c in test_stream_ciphers::new_cipher::h315560409baa366e ()
#2 0xaaab22e4 in test_stream_ciphers::main::h5cdcb843d2f82ea6 ()
#3 0xaaab1610 in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hb4152d57b6ff1750 ()
#4 0xaaab7984 in {{closure}} () at libstd/rt.rs:59
#5 std::panicking::try::do_call::h97d304993e5c755b () at libstd/panicking.rs:310
#6 0xaaac8ba0 in __rust_maybe_catch_panic () at libpanic_unwind/lib.rs:105
#7 0xaaab6bc4 in try<i32,closure> () at libstd/panicking.rs:289
#8 catch_unwind<closure,i32> () at libstd/panic.rs:392
#9 std::rt::lang_start_internal::h025c75f9b8aa9041 () at libstd/rt.rs:58
#10 0xaaab2388 in main ()
(gdb)
Cross compiled with:
/src# rustup show
Default host: x86_64-unknown-linux-gnu
installed targets for active toolchain
--------------------------------------
aarch64-unknown-linux-gnu
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
i686-unknown-linux-gnu
x86_64-unknown-linux-gnu
active toolchain
----------------
stable-x86_64-unknown-linux-gnu (default)
rustc 1.29.2 (17a9dc751 2018-10-05)
root@3cd916fde064:/src# arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Debian 6.3.0-18) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Metadata
Metadata
Assignees
Labels
No labels