diff options
author | Matt Braithwaite <mab@google.com> | 2015-10-01 01:24:05 +0300 |
---|---|---|
committer | Adam Langley <alangley@gmail.com> | 2015-10-27 00:07:31 +0300 |
commit | e564a5ba6e68c2eed56df2701ba3dd7a662be3ca (patch) | |
tree | 28fcb975a6b716e829e258ebe69ecab5b2b1e1d1 /crypto/modes | |
parent | 29d8adbdc6dbe8663e25c3bde68e3014d443454a (diff) |
|assert| → |OPENSSL_STATIC_ASSERT| where possible.
Change-Id: If8643c7308e6c3666de4104d097458187dbe268c
Reviewed-on: https://boringssl-review.googlesource.com/6057
Reviewed-by: Adam Langley <alangley@gmail.com>
Diffstat (limited to 'crypto/modes')
-rw-r--r-- | crypto/modes/cfb.c | 4 | ||||
-rw-r--r-- | crypto/modes/ctr.c | 4 | ||||
-rw-r--r-- | crypto/modes/ofb.c | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/crypto/modes/cfb.c b/crypto/modes/cfb.c index 738a4380..5af7c378 100644 --- a/crypto/modes/cfb.c +++ b/crypto/modes/cfb.c @@ -47,6 +47,7 @@ * ==================================================================== */ #include <openssl/modes.h> +#include <openssl/type_check.h> #include <assert.h> #include <string.h> @@ -54,6 +55,8 @@ #include "internal.h" +OPENSSL_COMPILE_ASSERT((16 % sizeof(size_t)) == 0, bad_size_t_size); + void CRYPTO_cfb128_encrypt(const uint8_t *in, uint8_t *out, size_t len, const void *key, uint8_t ivec[16], int *num, int enc, block128_f block) { @@ -61,7 +64,6 @@ void CRYPTO_cfb128_encrypt(const uint8_t *in, uint8_t *out, size_t len, size_t l = 0; assert(in && out && key && ivec && num); - assert((16 % sizeof(size_t)) == 0); n = *num; diff --git a/crypto/modes/ctr.c b/crypto/modes/ctr.c index 64062b27..dfb0b681 100644 --- a/crypto/modes/ctr.c +++ b/crypto/modes/ctr.c @@ -46,6 +46,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== */ #include <openssl/modes.h> +#include <openssl/type_check.h> #include <assert.h> #include <string.h> @@ -72,6 +73,8 @@ static void ctr128_inc(uint8_t *counter) { } while (n); } +OPENSSL_COMPILE_ASSERT((16 % sizeof(size_t)) == 0, bad_size_t_size); + /* The input encrypted as though 128bit counter mode is being used. The extra * state information to record how much of the 128bit block we have used is * contained in *num, and the encrypted counter is kept in ecount_buf. Both @@ -91,7 +94,6 @@ void CRYPTO_ctr128_encrypt(const uint8_t *in, uint8_t *out, size_t len, assert(key && ecount_buf && num); assert(len == 0 || (in && out)); assert(*num < 16); - assert((16 % sizeof(size_t)) == 0); n = *num; diff --git a/crypto/modes/ofb.c b/crypto/modes/ofb.c index 5836a9f4..2da6a3d7 100644 --- a/crypto/modes/ofb.c +++ b/crypto/modes/ofb.c @@ -47,19 +47,21 @@ * ==================================================================== */ #include <openssl/modes.h> +#include <openssl/type_check.h> #include <assert.h> #include "internal.h" +OPENSSL_COMPILE_ASSERT((16 % sizeof(size_t)) == 0, bad_size_t_size); + void CRYPTO_ofb128_encrypt(const uint8_t *in, uint8_t *out, size_t len, const void *key, uint8_t ivec[16], int *num, block128_f block) { unsigned int n; assert(in && out && key && ivec && num); - assert((16 % sizeof(size_t)) == 0); n = *num; |