ecc: enforce strict length with l_ecc_point_from_data
James Prestwood
PATCH 1/1 ecc: enforce strict length with l_ecc_point_from_data
This add some extra convenience to users of l_ecc_point_from_data allowing the exact length to be verified in addition to creating the point.
--- ell/ecc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
ell/ecc.c +5 -5
@@ -538,8 +538,11 @@ LIB_EXPORT struct l_ecc_point *l_ecc_point_from_data(if (!data)return NULL ; -/* In all cases there should be an X coordinate in data */ -if (len < bytes) +/* Verify the data length matches a full point or X coordinate */ +if (type ==L_ECC_POINT_TYPE_FULL ) { +if (len != bytes *2 ) +return NULL ; + }else if (len != bytes)return NULL ; p =l_ecc_point_new (curve);
@@ -570,9 +573,6 @@ LIB_EXPORT struct l_ecc_point *l_ecc_point_from_data(break ;case L_ECC_POINT_TYPE_FULL : -if (len < bytes *2 ) - goto failed; -_ecc_be2native (p->y, (void *) data + bytes, curve->ndigits);if (!ecc_valid_point (p))
Signature · 1 line
2.31.1
Denis Kenzior
Hi James,
Quoted 7 lines · James Prestwood
This add some extra convenience to users of
l_ecc_point_from_dataallowing the exact length to be verified in addition to creating the point.--- ell/ecc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
This seems to break test-sae?
Regards,
-Denis
James Prestwood
Quoted 11 lines · Denis Kenzior
Hi James,
Quoted 7 lines · James Prestwood
This add some extra convenience to users of
l_ecc_point_from_dataallowing the exact length to be verified in addition to creating the point.
---
ell/ecc.c| 10 +++++-----1 file changed, 5 insertions(+), 5 deletions(-)
Quoted 1 line
This seems to break test-sae?
Yes patch coming. Every other use passed the exact bytes except SAE.
Quoted 4 lines
Regards,
-Denis