diff options
Diffstat (limited to 'crypto/modes/ctr128.c')
| -rw-r--r-- | crypto/modes/ctr128.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/crypto/modes/ctr128.c b/crypto/modes/ctr128.c index 1ed7decedfd3..58014e76e275 100644 --- a/crypto/modes/ctr128.c +++ b/crypto/modes/ctr128.c @@ -1,15 +1,16 @@ /* - * Copyright 2008-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved. * - * Licensed under the OpenSSL license (the "License"). You may not use + * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ -#include <openssl/crypto.h> -#include "modes_local.h" #include <string.h> +#include <openssl/crypto.h> +#include "internal/endian.h" +#include "crypto/modes.h" #if defined(__GNUC__) && !defined(STRICT_ALIGNMENT) typedef size_t size_t_aX __attribute((__aligned__(1))); @@ -39,14 +40,9 @@ static void ctr128_inc(unsigned char *counter) static void ctr128_inc_aligned(unsigned char *counter) { size_t *data, c, d, n; - const union { - long one; - char little; - } is_endian = { - 1 - }; + DECLARE_IS_ENDIAN; - if (is_endian.little || ((size_t)counter % sizeof(size_t)) != 0) { + if (IS_LITTLE_ENDIAN || ((size_t)counter % sizeof(size_t)) != 0) { ctr128_inc(counter); return; } @@ -159,7 +155,7 @@ void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, { unsigned int n, ctr32; - n = *num; + n = *num; while (n && len) { *(out++) = *(in++) ^ ecount_buf[n]; |
