1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

Check that a zero blocksize returns -1

This commit is contained in:
Frank Denis 2017-08-17 21:00:02 +02:00
parent a27c18d0e8
commit 0850e55808

View File

@ -296,14 +296,16 @@ main(void)
blocksize, bin_padded_maxlen - 1U) == -1);
assert(sodium_pad(&bin_padded_len, bin_padded, bin_len,
blocksize, bin_padded_maxlen + 1U) == 0);
assert(sodium_pad(&bin_padded_len, bin_padded, bin_len,
0U, bin_padded_maxlen) == -1);
assert(sodium_pad(&bin_padded_len, bin_padded, bin_len,
blocksize, bin_padded_maxlen) == 0);
assert(bin_padded_len == bin_padded_maxlen);
assert(sodium_unpad(&bin_len2, bin_padded, bin_padded_len,
0U) == -1);
assert(sodium_unpad(&bin_len2, bin_padded, bin_padded_len,
bin_padded_len + 1U) == -1);
assert(sodium_unpad(&bin_len2, bin_padded, bin_padded_len,
0U) == -1);
assert(sodium_unpad(&bin_len2, bin_padded, bin_padded_len,
blocksize) == 0);
assert(bin_len2 == bin_len);