* Re: [PATCH] ecc: enforce strict length with l_ecc_point_from_data
@ 2022-01-21 18:33 James Prestwood
0 siblings, 0 replies; 3+ messages in thread
From: James Prestwood @ 2022-01-21 18:33 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 523 bytes --]
On Fri, 2022-01-21 at 10:51 -0600, Denis Kenzior wrote:
> Hi James,
>
> On 1/21/22 10:45, James Prestwood wrote:
> > 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(-)
> >
>
> This seems to break test-sae?
Yes patch coming. Every other use passed the exact bytes except SAE.
>
> Regards,
> -Denis
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ecc: enforce strict length with l_ecc_point_from_data
@ 2022-01-21 16:51 Denis Kenzior
0 siblings, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2022-01-21 16:51 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
Hi James,
On 1/21/22 10:45, James Prestwood wrote:
> 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(-)
>
This seems to break test-sae?
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ecc: enforce strict length with l_ecc_point_from_data
@ 2022-01-21 16:45 James Prestwood
0 siblings, 0 replies; 3+ messages in thread
From: James Prestwood @ 2022-01-21 16:45 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]
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(-)
diff --git a/ell/ecc.c b/ell/ecc.c
index a16b1c0..f1adcc4 100644
--- a/ell/ecc.c
+++ b/ell/ecc.c
@@ -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))
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-21 18:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 18:33 [PATCH] ecc: enforce strict length with l_ecc_point_from_data James Prestwood
-- strict thread matches above, loose matches on Subject: below --
2022-01-21 16:51 Denis Kenzior
2022-01-21 16:45 James Prestwood
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.