Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Nettle
nettle
Commits
b84dff15
Commit
b84dff15
authored
Apr 09, 2017
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define accessor functions to get address of ecc curve structs.
parent
0143b03d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
72 additions
and
20 deletions
+72
-20
ChangeLog
ChangeLog
+8
-0
ecc-192.c
ecc-192.c
+5
-1
ecc-224.c
ecc-224.c
+6
-1
ecc-256.c
ecc-256.c
+6
-1
ecc-384.c
ecc-384.c
+6
-1
ecc-521.c
ecc-521.c
+5
-1
ecc-curve.h
ecc-curve.h
+20
-5
ecc-internal.h
ecc-internal.h
+6
-0
examples/ecc-benchmark.c
examples/ecc-benchmark.c
+5
-5
testsuite/testutils.c
testsuite/testutils.c
+5
-5
No files found.
ChangeLog
View file @
b84dff15
2017-04-09 Niels Möller <nisse@lysator.liu.se>
* ecc-curve.h (nettle_get_secp_192r1, nettle_get_secp_224r1)
(nettle_get_secp_256r1, nettle_get_secp_384r1)
(nettle_get_secp_521r1): New functions, returning a pointer to
corresponding structure.
(nettle_secp_192r1, nettle_secp_224r1, nettle_secp_256r1)
(nettle_secp_384r1, nettle_secp_521r1): Redefined as macros,
calling the corresponding function.
* nettle-meta.h (nettle_ciphers, nettle_aeads, nettle_armors): New
macros, analogous to below change to nettle_hashes.
...
...
ecc-192.c
View file @
b84dff15
...
...
@@ -110,7 +110,7 @@ ecc_192_modp (const struct ecc_modulo *m UNUSED, mp_limb_t *rp)
#define ecc_192_modp ecc_mod
#endif
const
struct
ecc_curve
nettle_secp_192r1
=
const
struct
ecc_curve
_
nettle_secp_192r1
=
{
{
192
,
...
...
@@ -172,3 +172,7 @@ const struct ecc_curve nettle_secp_192r1 =
ecc_table
};
const
struct
ecc_curve
*
nettle_get_secp_192r1
(
void
)
{
return
&
_nettle_secp_192r1
;
}
ecc-224.c
View file @
b84dff15
...
...
@@ -62,7 +62,7 @@ ecc_224_modp (const struct ecc_modulo *m, mp_limb_t *rp);
# error Configuration error
#endif
const
struct
ecc_curve
nettle_secp_224r1
=
const
struct
ecc_curve
_
nettle_secp_224r1
=
{
{
224
,
...
...
@@ -123,3 +123,8 @@ const struct ecc_curve nettle_secp_224r1 =
ecc_unit
,
ecc_table
};
const
struct
ecc_curve
*
nettle_get_secp_224r1
(
void
)
{
return
&
_nettle_secp_224r1
;
}
ecc-256.c
View file @
b84dff15
...
...
@@ -239,7 +239,7 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp)
#error Unsupported parameters
#endif
const
struct
ecc_curve
nettle_secp_256r1
=
const
struct
ecc_curve
_
nettle_secp_256r1
=
{
{
256
,
...
...
@@ -300,3 +300,8 @@ const struct ecc_curve nettle_secp_256r1 =
ecc_unit
,
ecc_table
};
const
struct
ecc_curve
*
nettle_get_secp_256r1
(
void
)
{
return
&
_nettle_secp_256r1
;
}
ecc-384.c
View file @
b84dff15
...
...
@@ -147,7 +147,7 @@ ecc_384_modp (const struct ecc_modulo *p, mp_limb_t *rp)
#define ecc_384_modp ecc_mod
#endif
const
struct
ecc_curve
nettle_secp_384r1
=
const
struct
ecc_curve
_
nettle_secp_384r1
=
{
{
384
,
...
...
@@ -208,3 +208,8 @@ const struct ecc_curve nettle_secp_384r1 =
ecc_unit
,
ecc_table
};
const
struct
ecc_curve
*
nettle_get_secp_384r1
(
void
)
{
return
&
_nettle_secp_384r1
;
}
ecc-521.c
View file @
b84dff15
...
...
@@ -75,7 +75,7 @@ ecc_521_modp (const struct ecc_modulo *m UNUSED, mp_limb_t *rp)
}
#endif
const
struct
ecc_curve
nettle_secp_521r1
=
const
struct
ecc_curve
_
nettle_secp_521r1
=
{
{
521
,
...
...
@@ -137,3 +137,7 @@ const struct ecc_curve nettle_secp_521r1 =
ecc_table
};
const
struct
ecc_curve
*
nettle_get_secp_521r1
(
void
)
{
return
&
_nettle_secp_521r1
;
}
ecc-curve.h
View file @
b84dff15
...
...
@@ -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
}
...
...
ecc-internal.h
View file @
b84dff15
...
...
@@ -73,6 +73,12 @@
#define sec_modinv _nettle_sec_modinv
#define curve25519_eh_to_x _nettle_curve25519_eh_to_x
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
;
/* Keep this structure internal for now. It's misnamed (since it's
really implementing the equivalent twisted Edwards curve, with
different coordinates). And we're not quite ready to provide
...
...
examples/ecc-benchmark.c
View file @
b84dff15
...
...
@@ -330,12 +330,12 @@ bench_curve (const struct ecc_curve *ecc)
}
const
struct
ecc_curve
*
const
curves
[]
=
{
&
nettle_secp_192r1
,
&
nettle_secp_224r1
,
&
_
nettle_secp_192r1
,
&
_
nettle_secp_224r1
,
&
_nettle_curve25519
,
&
nettle_secp_256r1
,
&
nettle_secp_384r1
,
&
nettle_secp_521r1
,
&
_
nettle_secp_256r1
,
&
_
nettle_secp_384r1
,
&
_
nettle_secp_521r1
,
};
#define numberof(x) (sizeof (x) / sizeof ((x)[0]))
...
...
testsuite/testutils.c
View file @
b84dff15
...
...
@@ -1212,11 +1212,11 @@ test_dsa_key(const struct dsa_params *params,
}
const
struct
ecc_curve
*
const
ecc_curves
[]
=
{
&
nettle_secp_192r1
,
&
nettle_secp_224r1
,
&
nettle_secp_256r1
,
&
nettle_secp_384r1
,
&
nettle_secp_521r1
,
&
_
nettle_secp_192r1
,
&
_
nettle_secp_224r1
,
&
_
nettle_secp_256r1
,
&
_
nettle_secp_384r1
,
&
_
nettle_secp_521r1
,
&
_nettle_curve25519
,
NULL
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment