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 /include/internal/endian.h | |
parent | DOC: install documentation without execution permissions. (diff) | |
download | openssl-e23d850ff3281220f33ed78d9ca4fcadfa279565.tar.xz openssl-e23d850ff3281220f33ed78d9ca4fcadfa279565.zip |
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 'include/internal/endian.h')
-rw-r--r-- | include/internal/endian.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/internal/endian.h b/include/internal/endian.h new file mode 100644 index 0000000000..6027bd65de --- /dev/null +++ b/include/internal/endian.h @@ -0,0 +1,22 @@ +/* + * Copyright 2019 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 + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OSSL_INTERNAL_ENDIAN_H +# define OSSL_INTERNAL_ENDIAN_H + +# define DECLARE_IS_ENDIAN \ + const union { \ + long one; \ + char little; \ + } ossl_is_endian = { 1 } + +# define IS_LITTLE_ENDIAN (ossl_is_endian.little != 0) +# define IS_BIG_ENDIAN (ossl_is_endian.little == 0) + +#endif |