sodium_pad()
function adds padding data to a buffer buf
whose original size is unpadded_buflen
in order to extend its total length to a multiple of blocksize
.padded_buflen_p
.-1
if the padded buffer length would exceed max_buflen
, or if the block size is 0
. It returns 0
on success.sodium_unpad()
function computes the original, unpadded length of a message previously padded using sodium_pad()
. The original length is put into unpadded_buflen_p
.sodium_pad()
and sodium_unpad()
functions themselves try to minimize side channels for a given length & <block size mask>
value.