Fix export symbol on Windows

This commit is contained in:
Zhi Guan
2026-05-28 08:57:11 +08:00
parent 2aa476004b
commit a1257f5347
2 changed files with 9 additions and 5 deletions

View File

@@ -82,7 +82,8 @@ typedef struct {
secp256r1_t Z; secp256r1_t Z;
} SECP256R1_POINT; } SECP256R1_POINT;
extern const SECP256R1_POINT SECP256R1_POINT_G; const SECP256R1_POINT *secp256r1_generator(void);
#define SECP256R1_POINT_G (*secp256r1_generator())
void secp256r1_point_set_infinity(SECP256R1_POINT *R); void secp256r1_point_set_infinity(SECP256R1_POINT *R);
int secp256r1_point_is_at_infinity(const SECP256R1_POINT *P); int secp256r1_point_is_at_infinity(const SECP256R1_POINT *P);

View File

@@ -200,7 +200,7 @@ void secp256r1_modn_inv(secp256r1_t r, const secp256r1_t a) {
} }
const SECP256R1_POINT SECP256R1_POINT_G = { static const SECP256R1_POINT secp256r1_generator_point = {
{ 0xd898c296, 0xf4a13945, 0x2deb33a0, 0x77037d81, { 0xd898c296, 0xf4a13945, 0x2deb33a0, 0x77037d81,
0x63a440f2, 0xf8bce6e5, 0xe12c4247, 0x6b17d1f2, }, 0x63a440f2, 0xf8bce6e5, 0xe12c4247, 0x6b17d1f2, },
{ 0x37bf51f5, 0xcbb64068, 0x6b315ece, 0x2bce3357, { 0x37bf51f5, 0xcbb64068, 0x6b315ece, 0x2bce3357,
@@ -208,6 +208,11 @@ const SECP256R1_POINT SECP256R1_POINT_G = {
{ 1,0,0,0,0,0,0,0, }, { 1,0,0,0,0,0,0,0, },
}; };
const SECP256R1_POINT *secp256r1_generator(void)
{
return &secp256r1_generator_point;
}
void secp256r1_point_set_infinity(SECP256R1_POINT *R) void secp256r1_point_set_infinity(SECP256R1_POINT *R)
{ {
secp256r1_set_one(R->X); secp256r1_set_one(R->X);
@@ -526,7 +531,7 @@ void secp256r1_point_mul(SECP256R1_POINT *R, const secp256r1_t k, const SECP256R
void secp256r1_point_mul_generator(SECP256R1_POINT *R, const secp256r1_t k) void secp256r1_point_mul_generator(SECP256R1_POINT *R, const secp256r1_t k)
{ {
secp256r1_point_mul(R, k, &SECP256R1_POINT_G); secp256r1_point_mul(R, k, secp256r1_generator());
} }
int secp256r1_point_print(FILE *fp, int fmt, int ind, const char *label, const SECP256R1_POINT *P) int secp256r1_point_print(FILE *fp, int fmt, int ind, const char *label, const SECP256R1_POINT *P)
@@ -592,5 +597,3 @@ int secp256r1_point_equ(const SECP256R1_POINT *P, const SECP256R1_POINT *Q)
return 0; return 0;
} }
} }