Make RustCrypto work on 32-bit machines

This commit is contained in:
bjoernQ 2023-05-05 16:26:32 +02:00
parent 3b091c2106
commit e6b95f9cc6
2 changed files with 2 additions and 2 deletions

View file

@ -155,7 +155,7 @@ impl CryptoKeyPair for KeyPair {
let bytes = key.to_bytes(); let bytes = key.to_bytes();
let slice = bytes.as_slice(); let slice = bytes.as_slice();
let len = slice.len(); let len = slice.len();
priv_key.copy_from_slice(slice); priv_key[..slice.len()].copy_from_slice(slice);
Ok(len) Ok(len)
} }
KeyType::Public(_) => Err(Error::Crypto), KeyType::Public(_) => Err(Error::Crypto),

View file

@ -226,7 +226,7 @@ impl CryptoSpake2 for CryptoRustCrypto {
impl CryptoRustCrypto { impl CryptoRustCrypto {
fn add_to_tt(tt: &mut sha2::Sha256, buf: &[u8]) -> Result<(), Error> { fn add_to_tt(tt: &mut sha2::Sha256, buf: &[u8]) -> Result<(), Error> {
tt.update(buf.len().to_le_bytes()); tt.update((buf.len() as u64).to_le_bytes());
if !buf.is_empty() { if !buf.is_empty() {
tt.update(buf); tt.update(buf);
} }