summaryrefslogtreecommitdiff
path: root/ecc-curve.h
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2017-04-09 15:48:01 +0200
committerNiels Möller <nisse@lysator.liu.se>2017-04-09 15:48:01 +0200
commitb84dff15db04301e1858e0f80ca1c3bb874b88cc (patch)
treebab202e1b31e9e60ba52910abe191bb4ce3ef4c6 /ecc-curve.h
parent0143b03dc4b79b6ea6a22234bb4ac94b06ba60c7 (diff)
downloadnettle-b84dff15db04301e1858e0f80ca1c3bb874b88cc.tar.gz
Define accessor functions to get address of ecc curve structs.
Diffstat (limited to 'ecc-curve.h')
-rw-r--r--ecc-curve.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/ecc-curve.h b/ecc-curve.h
index 574c9f2e..f3fd63e4 100644
--- a/ecc-curve.h
+++ b/ecc-curve.h
@@ -41,11 +41,26 @@ extern "C" {
/* The contents of this struct is internal. */
struct ecc_curve;
-extern const struct ecc_curve nettle_secp_192r1;
-extern const struct ecc_curve nettle_secp_224r1;
-extern const struct ecc_curve nettle_secp_256r1;
-extern const struct ecc_curve nettle_secp_384r1;
-extern const struct ecc_curve nettle_secp_521r1;
+#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
+
+/* For backwards compatibility */
+#define nettle_secp_192r1 (*nettle_get_secp_192r1())
+#define nettle_secp_224r1 (*nettle_get_secp_224r1())
+#define nettle_secp_256r1 (*nettle_get_secp_256r1())
+#define nettle_secp_384r1 (*nettle_get_secp_384r1())
+#define nettle_secp_521r1 (*nettle_get_secp_521r1())
#ifdef __cplusplus
}