Function nrfxlib_sys::ocrypto_rsa2048_pkcs1_v15_encrypt
source · pub unsafe extern "C" fn ocrypto_rsa2048_pkcs1_v15_encrypt(
c: *mut u8,
m: *const u8,
mlen: usize,
seed: *const u8,
slen: usize,
pk: *const ocrypto_rsa2048_pub_key
) -> c_int
Expand description
2048-bit RSA Functions.
This group of functions is used for 2048-bit RSA. / /@{*/ / 2048-bit RSA PKCS1 V1.5 encryption.
The message * m
- is encrypted to a ciphertext returned in * c
- .
c
- The generated 256-byte ciphertext.m
- The message to be encrypted.mlen
- Length of *m
- . 0 <= *mlen
- <= 245.seed
- The random seed to be used for the padding.slen
- Length of *seed
- . *slen
- >= 253 - *mlen
- .pk
- A valid 2048-bit RSA public key.
Returns -1 If the message is too long (mlen > 245). Returns -2 If the seed is too short (slen < 253 - mlen). Returns 0 On success.
@remark The key * pk
- should be initialized with * ocrypto_rsa2048_init_pub_key
- .
@remark The * seed
- should consist of non-zero random bytes.
@remark * c
- may be same as * m
- .