Skip to main content

os2ip_zeroizing

Function os2ip_zeroizing 

Source
pub(crate) fn os2ip_zeroizing(
    input: Zeroizing<Vec<u8>>,
    bits_precision: u32,
) -> Result<Zeroizing<BoxedUint>>
Expand description

Computes os2ip (Octet-String-to-Integer Primitive) with zeroization of the input and output buffers.

Takes ownership of the input buffer, which is zeroized on drop, including on error. The returned integer is also zeroized on drop. The same storage-width precondition and errors as os2ip apply.

draft-irtf-cfrg-rsa-guidance-10 §6.1 requires operations on secret values to be constant-time. Decoding in this function depends only on input.len() and bits_precision. To satisfy that requirement, callers must ensure that both widths are independent of the input’s value.