diff options
author | James Prestwood <prestwoj@gmail.com> | 2024-03-13 09:44:24 -0700 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2024-03-18 09:31:07 -0500 |
commit | f5e27f0085f9b51015d4cd5aa0891f2cfd37e426 (patch) | |
tree | 2557d683fcc68fe17779efbfbd3b740e9039e6d2 | |
parent | 0c9e9d69f97ae8b8eacabfd0cabe38ff6b74f5ee (diff) |
ecc: add l_ecc_scalar_clone
-rw-r--r-- | ell/ecc.c | 8 | ||||
-rw-r--r-- | ell/ecc.h | 1 | ||||
-rw-r--r-- | ell/ell.sym | 1 |
3 files changed, 10 insertions, 0 deletions
@@ -806,6 +806,14 @@ LIB_EXPORT struct l_ecc_scalar *l_ecc_scalar_new( return NULL; } +LIB_EXPORT struct l_ecc_scalar *l_ecc_scalar_clone(const struct l_ecc_scalar *s) +{ + if (!s) + return NULL; + + return l_memdup(s, sizeof(*s)); +} + /* * Build a scalar = value modulo p where p is the prime number for a given * curve. bytes can contain a number with up to 2x number of digits as the @@ -62,6 +62,7 @@ DEFINE_CLEANUP_FUNC(l_ecc_point_free); struct l_ecc_scalar *l_ecc_scalar_new(const struct l_ecc_curve *curve, const void *buf, size_t len); +struct l_ecc_scalar *l_ecc_scalar_clone(const struct l_ecc_scalar *s); struct l_ecc_scalar *l_ecc_scalar_new_random( const struct l_ecc_curve *curve); struct l_ecc_scalar *l_ecc_scalar_new_modp(const struct l_ecc_curve *curve, diff --git a/ell/ell.sym b/ell/ell.sym index 2c207d60..28b55d36 100644 --- a/ell/ell.sym +++ b/ell/ell.sym @@ -611,6 +611,7 @@ global: l_ecc_scalar_legendre; l_ecc_scalar_multiply; l_ecc_scalar_new; + l_ecc_scalar_clone; l_ecc_scalar_new_random; l_ecc_scalar_new_modp; l_ecc_scalar_new_modn; |