style fix
This commit is contained in:
@@ -31,8 +31,7 @@ use cbor::cbor_array_vec;
|
|||||||
use core::cmp;
|
use core::cmp;
|
||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
use crypto::rng256::Rng256;
|
use crypto::rng256::Rng256;
|
||||||
use persistent_store::fragment::{read_range, write};
|
use persistent_store::{fragment, StoreUpdate};
|
||||||
use persistent_store::StoreUpdate;
|
|
||||||
|
|
||||||
// Those constants may be modified before compilation to tune the behavior of the key.
|
// Those constants may be modified before compilation to tune the behavior of the key.
|
||||||
//
|
//
|
||||||
@@ -485,14 +484,14 @@ impl PersistentStore {
|
|||||||
byte_count: usize,
|
byte_count: usize,
|
||||||
) -> Result<Vec<u8>, Ctap2StatusCode> {
|
) -> Result<Vec<u8>, Ctap2StatusCode> {
|
||||||
let byte_range = offset..offset + byte_count;
|
let byte_range = offset..offset + byte_count;
|
||||||
let output = read_range(&self.store, &key::LARGE_BLOB_SHARDS, byte_range)?;
|
let output = fragment::read_range(&self.store, &key::LARGE_BLOB_SHARDS, byte_range)?;
|
||||||
Ok(output.unwrap_or_else(|| {
|
Ok(output.unwrap_or_else(|| {
|
||||||
let empty_large_blob = vec![
|
const EMPTY_LARGE_BLOB: [u8; 17] = [
|
||||||
0x80, 0x76, 0xBE, 0x8B, 0x52, 0x8D, 0x00, 0x75, 0xF7, 0xAA, 0xE9, 0x8D, 0x6F, 0xA5,
|
0x80, 0x76, 0xBE, 0x8B, 0x52, 0x8D, 0x00, 0x75, 0xF7, 0xAA, 0xE9, 0x8D, 0x6F, 0xA5,
|
||||||
0x7A, 0x6D, 0x3C,
|
0x7A, 0x6D, 0x3C,
|
||||||
];
|
];
|
||||||
let last_index = cmp::min(empty_large_blob.len(), offset + byte_count);
|
let last_index = cmp::min(EMPTY_LARGE_BLOB.len(), offset + byte_count);
|
||||||
empty_large_blob
|
EMPTY_LARGE_BLOB
|
||||||
.get(offset..last_index)
|
.get(offset..last_index)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.to_vec()
|
.to_vec()
|
||||||
@@ -508,7 +507,7 @@ impl PersistentStore {
|
|||||||
if large_blob_array.len() > MAX_LARGE_BLOB_ARRAY_SIZE {
|
if large_blob_array.len() > MAX_LARGE_BLOB_ARRAY_SIZE {
|
||||||
return Err(Ctap2StatusCode::CTAP2_ERR_VENDOR_INTERNAL_ERROR);
|
return Err(Ctap2StatusCode::CTAP2_ERR_VENDOR_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
Ok(write(
|
Ok(fragment::write(
|
||||||
&mut self.store,
|
&mut self.store,
|
||||||
&key::LARGE_BLOB_SHARDS,
|
&key::LARGE_BLOB_SHARDS,
|
||||||
large_blob_array,
|
large_blob_array,
|
||||||
|
|||||||
Reference in New Issue
Block a user