@@ -61767,6 +61767,7 @@ static int test_wolfSSL_EC_POINT(void)
6176761767 EC_POINT* Gxy = NULL;
6176861768 EC_POINT* new_point = NULL;
6176961769 EC_POINT* set_point = NULL;
61770+ EC_POINT* get_point = NULL;
6177061771 EC_POINT* infinity = NULL;
6177161772 BIGNUM* k = NULL;
6177261773 BIGNUM* Gx = NULL;
@@ -61784,6 +61785,14 @@ static int test_wolfSSL_EC_POINT(void)
6178461785 "77037D812DEB33A0F4A13945D898C296";
6178561786 const char* kGy = "4FE342E2FE1A7F9B8EE7EB4A7C0F9E16"
6178661787 "2BCE33576B315ECECBB6406837BF51F5";
61788+ const char* uncompG
61789+ = "046B17D1F2E12C4247F8BCE6E563A440F2"
61790+ "77037D812DEB33A0F4A13945D898C296"
61791+ "4FE342E2FE1A7F9B8EE7EB4A7C0F9E16"
61792+ "2BCE33576B315ECECBB6406837BF51F5";
61793+ const char* compG
61794+ = "036B17D1F2E12C4247F8BCE6E563A440F2"
61795+ "77037D812DEB33A0F4A13945D898C296";
6178761796
6178861797#ifndef HAVE_SELFTEST
6178961798 EC_POINT *tmp = NULL;
@@ -61792,10 +61801,6 @@ static int test_wolfSSL_EC_POINT(void)
6179261801 unsigned char* buf = NULL;
6179361802 unsigned char bufInf[1] = { 0x00 };
6179461803
61795- const char* uncompG = "046B17D1F2E12C4247F8BCE6E563A440F2"
61796- "77037D812DEB33A0F4A13945D898C296"
61797- "4FE342E2FE1A7F9B8EE7EB4A7C0F9E16"
61798- "2BCE33576B315ECECBB6406837BF51F5";
6179961804 const unsigned char binUncompG[] = {
6180061805 0x04, 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc,
6180161806 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81, 0x2d,
@@ -61813,8 +61818,6 @@ static int test_wolfSSL_EC_POINT(void)
6181361818 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, 0x51, 0xf5,
6181461819 };
6181561820
61816- const char* compG = "036B17D1F2E12C4247F8BCE6E563A440F2"
61817- "77037D812DEB33A0F4A13945D898C296";
6181861821#ifdef HAVE_COMP_KEY
6181961822 const unsigned char binCompG[] = {
6182061823 0x03, 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc,
@@ -62039,7 +62042,6 @@ static int test_wolfSSL_EC_POINT(void)
6203962042#endif
6204062043 XFREE(hexStr, NULL, DYNAMIC_TYPE_ECC);
6204162044
62042- #ifndef HAVE_SELFTEST
6204362045 /* Test point to hex */
6204462046 ExpectNull(EC_POINT_point2hex(NULL, NULL, POINT_CONVERSION_UNCOMPRESSED,
6204562047 ctx));
@@ -62056,13 +62058,22 @@ static int test_wolfSSL_EC_POINT(void)
6205662058 hexStr = EC_POINT_point2hex(group, Gxy, POINT_CONVERSION_UNCOMPRESSED, ctx);
6205762059 ExpectNotNull(hexStr);
6205862060 ExpectStrEQ(hexStr, uncompG);
62061+ AssertNotNull(get_point = EC_POINT_hex2point(group, hexStr, NULL, ctx));
62062+ AssertIntEQ(EC_POINT_cmp(group, Gxy, get_point, ctx), 0);
6205962063 XFREE(hexStr, NULL, DYNAMIC_TYPE_ECC);
6206062064
6206162065 hexStr = EC_POINT_point2hex(group, Gxy, POINT_CONVERSION_COMPRESSED, ctx);
6206262066 ExpectNotNull(hexStr);
6206362067 ExpectStrEQ(hexStr, compG);
62068+ #ifdef HAVE_COMP_KEY
62069+ AssertNotNull(get_point = EC_POINT_hex2point
62070+ (group, hexStr, get_point, ctx));
62071+ AssertIntEQ(EC_POINT_cmp(group, Gxy, get_point, ctx), 0);
62072+ #endif
6206462073 XFREE(hexStr, NULL, DYNAMIC_TYPE_ECC);
62074+ EC_POINT_free(get_point);
6206562075
62076+ #ifndef HAVE_SELFTEST
6206662077 /* Test point to oct */
6206762078 ExpectIntEQ(EC_POINT_point2oct(NULL, NULL, POINT_CONVERSION_UNCOMPRESSED,
6206862079 NULL, 0, ctx), 0);
0 commit comments