Fix bit shift function in attestation validation

This commit is contained in:
Paul Hauner 2018-09-25 22:10:12 +10:00
parent da1e0c8a59
commit 748b50c08c
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C

View File

@ -49,8 +49,8 @@ fn bytes_for_bits(bits: usize) -> usize {
}
fn any_of_last_n_bits_are_set(byte: &u8, n: usize) -> bool {
let shift = 8_u8.saturating_sub(n as u8);
((!0 >> shift) & byte) > 0
let shift = 8_u16.saturating_sub(n as u16);
((!0 << shift) & u16::from(*byte)) > 0
}
pub fn validate_attestation<T>(a: &AttestationRecord,