Commit 9d7cd530 authored by Niels Möller's avatar Niels Möller

New macro _NETTLE_ATTRIBUTE_PURE.

parent 71f68cc4
2018-08-09 Niels Möller <nisse@lysator.liu.se>
* nettle-types.h (_NETTLE_ATTRIBUTE_PURE): Define
_NETTLE_ATTRIBUTE_PURE for gcc and lookalikes.
* ecc-curve.h: Include nettle-types.h, and use
_NETTLE_ATTRIBUTE_PURE instead of local definition.
* nettle-meta.h: Use _NETTLE_ATTRIBUTE_PURE, instead of explicit
#ifdefs.
* nettle-internal.c (des_set_key_wrapper, des3_set_key_wrapper)
(blowfish128_set_key_wrapper): Wrapper functions, to avoid cast
between incompatible function types (which gcc-8 warns about).
......
......@@ -34,6 +34,8 @@
#ifndef NETTLE_ECC_CURVE_H_INCLUDED
#define NETTLE_ECC_CURVE_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
......@@ -41,19 +43,11 @@ extern "C" {
/* The contents of this struct is internal. */
struct ecc_curve;
#ifdef __GNUC__
#define NETTLE_PURE __attribute__((pure))
#else
#define NETTLE_PURE
#endif
const struct ecc_curve * NETTLE_PURE nettle_get_secp_192r1(void);
const struct ecc_curve * NETTLE_PURE nettle_get_secp_224r1(void);
const struct ecc_curve * NETTLE_PURE nettle_get_secp_256r1(void);
const struct ecc_curve * NETTLE_PURE nettle_get_secp_384r1(void);
const struct ecc_curve * NETTLE_PURE nettle_get_secp_521r1(void);
#undef NETTLE_PURE
const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_192r1(void);
const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_224r1(void);
const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_256r1(void);
const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_384r1(void);
const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_521r1(void);
#ifdef __cplusplus
}
......
......@@ -61,10 +61,7 @@ struct nettle_cipher
};
/* null-terminated list of ciphers implemented by this version of nettle */
const struct nettle_cipher * const *
#ifdef __GNUC__
__attribute__((pure))
#endif
const struct nettle_cipher * const * _NETTLE_ATTRIBUTE_PURE
nettle_get_ciphers (void);
#define nettle_ciphers (nettle_get_ciphers())
......@@ -121,10 +118,7 @@ struct nettle_hash
}
/* null-terminated list of digests implemented by this version of nettle */
const struct nettle_hash * const *
#ifdef __GNUC__
__attribute__((pure))
#endif
const struct nettle_hash * const * _NETTLE_ATTRIBUTE_PURE
nettle_get_hashes (void);
#define nettle_hashes (nettle_get_hashes())
......@@ -172,10 +166,7 @@ struct nettle_aead
/* null-terminated list of aead constructions implemented by this
version of nettle */
const struct nettle_aead * const *
#ifdef __GNUC__
__attribute__((pure))
#endif
const struct nettle_aead * const * _NETTLE_ATTRIBUTE_PURE
nettle_get_aeads (void);
#define nettle_aeads (nettle_get_aeads())
......@@ -238,10 +229,7 @@ struct nettle_armor
}
/* null-terminated list of armor schemes implemented by this version of nettle */
const struct nettle_armor * const *
#ifdef __GNUC__
__attribute__((pure))
#endif
const struct nettle_armor * const * _NETTLE_ATTRIBUTE_PURE
nettle_get_armors (void);
#define nettle_armors (nettle_get_armors())
......
......@@ -39,6 +39,13 @@
#define _STDINT_HAVE_INT_FAST32_T 1
#include "nettle-stdint.h"
/* Attributes we want to use in installed header files, and hence
can't rely on config.h. */
#ifdef __GNUC__
#define _NETTLE_ATTRIBUTE_PURE __attribute__((pure))
#else /* !__GNUC__ */
#define _NETTLE_ATTRIBUTE_PURE
#endif /* !__GNUC__ */
#ifdef __cplusplus
extern "C" {
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment