Skip to contentSkip to conversation

ecc: add l_ecc_point_y_isodd

PATCH Applied James Prestwood 2 participants 2 messages Jan 18, 2022

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/1 ecc: add l_ecc_point_y_isodd

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(+)
ell/ecc.c +5 -0
index 5830e01..c934da0 100644
@@ -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)
 {
ell/ecc.h +1 -0
index 84a16c2..0bddd0e 100644
@@ -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);
ell/ell.sym +1 -0
index 51db458..a65ee6d 100644
@@ -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;
Signature · 1 line
2.31.1
Applied
#1 lore raw

Hi James,

Quoted 8 lines · James Prestwood

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