Document a pair of panics requiring 256 GB of RAM/4 GB of a context

This commit is contained in:
Luke Parker 2023-04-24 23:49:06 -04:00
parent 7a8f8c2d3d
commit 09d96822ca
No known key found for this signature in database
3 changed files with 6 additions and 0 deletions

View file

@ -31,6 +31,8 @@ pub fn clone_without<K: Clone + std::cmp::Eq + std::hash::Hash, V: Clone>(
}
/// Recover the secret from a collection of keys.
///
/// This will panic if no keys, an insufficient amount of keys, or the wrong keys are provided.
pub fn recover_key<C: Ciphersuite>(keys: &HashMap<Participant, ThresholdKeys<C>>) -> C::F {
let first = keys.values().next().expect("no keys provided");
assert!(keys.len() >= first.params().t().into(), "not enough keys provided");

View file

@ -89,6 +89,8 @@ impl<C: Ciphersuite> SchnorrAggregate<C> {
}
/// Write a SchnorrAggregate to something implementing Write.
///
/// This will panic if more than 4 billion signatures were aggregated.
pub fn write<W: Write>(&self, writer: &mut W) -> io::Result<()> {
writer.write_all(
&u32::try_from(self.Rs.len())

View file

@ -60,6 +60,8 @@ pub struct Schnorrkel {
impl Schnorrkel {
/// Create a new algorithm with the specified context.
///
/// If the context is greater than or equal to 4 GB in size, this will panic.
pub fn new(context: &'static [u8]) -> Schnorrkel {
Schnorrkel {
context,