From 0850e55808c8ddeb81ec8045e82dff45c3570400 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 17 Aug 2017 21:00:02 +0200 Subject: [PATCH] Check that a zero blocksize returns -1 --- test/default/sodium_utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/default/sodium_utils.c b/test/default/sodium_utils.c index 5414fec5..444c17ea 100644 --- a/test/default/sodium_utils.c +++ b/test/default/sodium_utils.c @@ -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);