Type Definition bearssl::br_rsa_public [] [src]

type br_rsa_public = Option<unsafe extern "C" fn(_: *mut c_uchar, _: usize, _: *const br_rsa_public_key) -> u32>;

\brief Type for a RSA public key engine.

The public key engine performs the modular exponentiation of the provided value with the public exponent. The value is modified in place.

The value length (xlen) is verified to have exactly the same length as the modulus (actual modulus length, without extra leading zeros in the modulus representation in memory). If the length does not match, then this function returns 0 and x[] is unmodified.

It xlen is correct, then x[] is modified. Returned value is 1 on success, 0 on error. Error conditions include an oversized x[] (the array has the same length as the modulus, but the numerical value is not lower than the modulus) and an invalid modulus (e.g. an even integer). If an error is reported, then the new contents of x[] are unspecified.

\param x operand to exponentiate. \param xlen length of the operand (in bytes). \param pk RSA public key. \return 1 on success, 0 on error.