All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ecc: add l_ecc_point_y_isodd
@ 2022-01-18 16:56 James Prestwood
  0 siblings, 0 replies; 2+ messages in thread
From: James Prestwood @ 2022-01-18 16:56 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1607 bytes --]

This is required to know how a compressed point will be interpreted
after sending the raw (compressed) X coordiate.
---
 ell/ecc.c   | 5 +++++
 ell/ecc.h   | 1 +
 ell/ell.sym | 1 +
 3 files changed, 7 insertions(+)

diff --git a/ell/ecc.c b/ell/ecc.c
index 5830e01..c934da0 100644
--- a/ell/ecc.c
+++ b/ell/ecc.c
@@ -735,6 +735,11 @@ LIB_EXPORT ssize_t l_ecc_point_get_y(const struct l_ecc_point *p, void *y,
 	return p->curve->ndigits * 8;
 }
 
+LIB_EXPORT bool l_ecc_point_y_isodd(const struct l_ecc_point *p)
+{
+	return p->y[0] & 1;
+}
+
 LIB_EXPORT ssize_t l_ecc_point_get_data(const struct l_ecc_point *p, void *buf,
 					size_t len)
 {
diff --git a/ell/ecc.h b/ell/ecc.h
index 84a16c2..0bddd0e 100644
--- a/ell/ecc.h
+++ b/ell/ecc.h
@@ -69,6 +69,7 @@ struct l_ecc_point *l_ecc_point_clone(const struct l_ecc_point *p);
 const struct l_ecc_curve *l_ecc_point_get_curve(const struct l_ecc_point *p);
 ssize_t l_ecc_point_get_x(const struct l_ecc_point *p, void *x, size_t xlen);
 ssize_t l_ecc_point_get_y(const struct l_ecc_point *p, void *y, size_t ylen);
+bool l_ecc_point_y_isodd(const struct l_ecc_point *p);
 
 ssize_t l_ecc_point_get_data(const struct l_ecc_point *p, void *buf, size_t len);
 void l_ecc_point_free(struct l_ecc_point *p);
diff --git a/ell/ell.sym b/ell/ell.sym
index 51db458..a65ee6d 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -572,6 +572,7 @@ global:
 	l_ecc_point_from_data;
 	l_ecc_point_get_x;
 	l_ecc_point_get_y;
+	l_ecc_point_y_isodd;
 	l_ecc_point_get_data;
 	l_ecc_point_inverse;
 	l_ecc_point_multiply;
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ecc: add l_ecc_point_y_isodd
@ 2022-01-18 19:53 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2022-01-18 19:53 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

Hi James,

On 1/18/22 10:56, James Prestwood wrote:
> This is required to know how a compressed point will be interpreted
> after sending the raw (compressed) X coordiate.
> ---
>   ell/ecc.c   | 5 +++++
>   ell/ecc.h   | 1 +
>   ell/ell.sym | 1 +
>   3 files changed, 7 insertions(+)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-18 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 16:56 [PATCH] ecc: add l_ecc_point_y_isodd James Prestwood
2022-01-18 19:53 Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.