Add sm2_point_ functions

This commit is contained in:
Zhi Guan
2023-02-19 08:24:17 +08:00
parent 289a9677fe
commit 90c022c803
2 changed files with 10 additions and 1 deletions

View File

@@ -13,6 +13,7 @@
#include <string.h>
#include <assert.h>
#include <gmssl/sm2.h>
#include <gmssl/mem.h>
#include <gmssl/asn1.h>
#include <gmssl/rand.h>
#include <gmssl/error.h>
@@ -1088,6 +1089,11 @@ int sm2_point_is_on_curve(const SM2_POINT *P)
return sm2_jacobian_point_is_on_curve(&T);
}
int sm2_point_is_at_infinity(const SM2_POINT *P)
{
return mem_is_zero((uint8_t *)P, sizeof(SM2_POINT));
}
int sm2_point_from_x(SM2_POINT *P, const uint8_t x[32], int y)
{
SM2_BN _x, _y, _g, _z;