X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=providers%2Fimplementations%2Fdigests%2Fblake2_impl.h;h=e7c31474a364647f0fc62a4d5a1dbc288a842156;hp=52477a8fe260fbf3adf260c15820bc8ba3ca9500;hb=3469b388164775546022635d6695cae17104faa6;hpb=7c214f1092f7622a1c2fdc5cfe70ddc94918daa3 diff --git a/providers/implementations/digests/blake2_impl.h b/providers/implementations/digests/blake2_impl.h index 52477a8fe2..e7c31474a3 100644 --- a/providers/implementations/digests/blake2_impl.h +++ b/providers/implementations/digests/blake2_impl.h @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. * * 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 @@ -15,15 +15,13 @@ */ #include +#include "internal/endian.h" static ossl_inline uint32_t load32(const uint8_t *src) { - const union { - long one; - char little; - } is_endian = { 1 }; + DECLARE_IS_ENDIAN; - if (is_endian.little) { + if (IS_LITTLE_ENDIAN) { uint32_t w; memcpy(&w, src, sizeof(w)); return w; @@ -38,12 +36,9 @@ static ossl_inline uint32_t load32(const uint8_t *src) static ossl_inline uint64_t load64(const uint8_t *src) { - const union { - long one; - char little; - } is_endian = { 1 }; + DECLARE_IS_ENDIAN; - if (is_endian.little) { + if (IS_LITTLE_ENDIAN) { uint64_t w; memcpy(&w, src, sizeof(w)); return w; @@ -62,12 +57,9 @@ static ossl_inline uint64_t load64(const uint8_t *src) static ossl_inline void store32(uint8_t *dst, uint32_t w) { - const union { - long one; - char little; - } is_endian = { 1 }; + DECLARE_IS_ENDIAN; - if (is_endian.little) { + if (IS_LITTLE_ENDIAN) { memcpy(dst, &w, sizeof(w)); } else { uint8_t *p = (uint8_t *)dst; @@ -80,12 +72,9 @@ static ossl_inline void store32(uint8_t *dst, uint32_t w) static ossl_inline void store64(uint8_t *dst, uint64_t w) { - const union { - long one; - char little; - } is_endian = { 1 }; + DECLARE_IS_ENDIAN; - if (is_endian.little) { + if (IS_LITTLE_ENDIAN) { memcpy(dst, &w, sizeof(w)); } else { uint8_t *p = (uint8_t *)dst;