diff options
author | Richard Levitte <levitte@openssl.org> | 2020-07-09 08:37:46 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-07-11 10:00:33 +0200 |
commit | e23d850ff3281220f33ed78d9ca4fcadfa279565 (patch) | |
tree | 4e7f73d978bb1a7986e0ac27ee61bdab23d66ed2 /providers/implementations/kdfs | |
parent | d685fc7a59699aeb17120aebd17a9175ce5930cd (diff) |
Add and use internal header that implements endianness check
This moves test/ossl_test_endian.h to include/internal/endian.h and
thereby makes the macros in there our standard way to check endianness
in run-time.
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/12390)
Diffstat (limited to 'providers/implementations/kdfs')
-rw-r--r-- | providers/implementations/kdfs/kbkdf.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/providers/implementations/kdfs/kbkdf.c b/providers/implementations/kdfs/kbkdf.c index f3f3d9a609..9cf18d84a2 100644 --- a/providers/implementations/kdfs/kbkdf.c +++ b/providers/implementations/kdfs/kbkdf.c @@ -37,6 +37,7 @@ #include "internal/cryptlib.h" #include "crypto/evp.h" #include "internal/numbers.h" +#include "internal/endian.h" #include "prov/implementations.h" #include "prov/provider_ctx.h" #include "prov/provider_util.h" @@ -80,12 +81,9 @@ static OSSL_FUNC_kdf_set_ctx_params_fn kbkdf_set_ctx_params; static uint32_t be32(uint32_t host) { uint32_t big = 0; - const union { - long one; - char little; - } is_endian = { 1 }; + DECLARE_IS_ENDIAN; - if (!is_endian.little) + if (!IS_LITTLE_ENDIAN) return host; big |= (host & 0xff000000) >> 24; |