int kcapi_pad_iv(struct kcapi_handle * handle, const uint8_t * iv, uint32_t ivlen, uint8_t ** newiv, uint32_t * newivlen);
[in] cipher handle
[in] current IV buffer
[in] length of IV buffer
[out] buffer of aligned IV
[out] length of newly aligned IV
The function pads the least significant bits of the provided IV up to the block size of the cipher with zeros. In case the provided IV is longer than the block size, the least significant bits are truncated to the block size.
The function allocates memory for newiv in case the return code indicates success. The consumer must free the memory after use.
return 0 for success; a negative errno-style error code if an error occurred
Stephan Mueller <firstname.lastname@example.org>