3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

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.
This commit is contained in:
James Prestwood 2023-10-10 06:57:02 -07:00 committed by Denis Kenzior
parent b7180d4d29
commit 2ba88f05e9

View File

@ -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;