commit 2ba88f05e955f207c342ebca924e3ebddde18c78 parent b7180d4d2965f03470c100f76f1d02a0187b4a90 Author: James Prestwood <prestwoj@gmail.com> Date: Tue, 10 Oct 2023 06:57:02 -0700 dpp-util: fix incorrect ASN1 compressed public key encoding The prefix to the X coordinate was incorrect when using compressed points. This has been modified to match the ANSI X9.62 spec. Diffstat:
| M | src/dpp-util.c | | | 6 | +++--- |
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/dpp-util.c b/src/dpp-util.c @@ -751,11 +751,11 @@ uint8_t *dpp_point_to_asn1(const struct l_ecc_point *p, size_t *len_out) /* * Set the type to whatever avoids doing p - y when reading in the - * key. Working backwards from l_ecc_point_from_data if Y is odd and - * the type is BIT0 there is no subtraction. Similarly if Y is even + * key. Working backwards from l_ecc_point_from_data if Y is even and + * the type is BIT0 there is no subtraction. Similarly if Y is odd * and the type is BIT1. */ - if (l_ecc_point_y_isodd(p)) + if (!l_ecc_point_y_isodd(p)) point_type = L_ECC_POINT_TYPE_COMPRESSED_BIT0; else point_type = L_ECC_POINT_TYPE_COMPRESSED_BIT1;