Accept a NULL pointer for the padded length in sodium_pad()

This commit is contained in:
Frank Denis 2017-08-24 15:49:50 +02:00
parent b503d75e43
commit be58b2e666

View File

@ -648,7 +648,9 @@ sodium_pad(size_t *padded_buflen_p, unsigned char *buf,
return -1;
}
tail = &buf[xpadded_len];
*padded_buflen_p = xpadded_len + 1U;
if (padded_buflen_p != NULL) {
*padded_buflen_p = xpadded_len + 1U;
}
mask = 0U;
for (i = 0; i < blocksize; i++) {
barrier_mask = (unsigned char) (((i ^ xpadlen) - 1U) >> 8);