Zhi Guan
55027bfd4d
Merge pull request #1870 from shakespark/fix-sm2-neon-support
...
fix(sm2): fix ENABLE_SM2_NEON macro mismatch and add missing functions
2026-06-21 09:58:09 +08:00
libo
75bac76b90
fix(sm2): fix compressed point output writing y instead of x
...
In sm2_z256_point_to_compressed_octets(), the compressed point format
should be: [1-byte flag] + [32-byte x-coordinate]
The flag indicates y's parity (0x02=even, 0x03=odd), but the actual
coordinate stored should be x (since y can be recovered from x using
the curve equation).
The original code incorrectly wrote y-coordinate instead of x-coordinate.
2026-02-02 16:29:47 +08:00
libo
0299af5667
fix(sm2): fix ENABLE_SM2_NEON macro mismatch and add missing functions
...
Problems:
1. CMakeLists.txt defines -DENABLE_SM2_NEON but sm2_z256.c checks
for ENABLE_SM2_Z256_NEON, causing NEON code path never taken
2. When NEON is enabled, sm2_z256_modp_mont_sqr, sm2_z256_modp_from_mont,
and sm2_z256_modp_to_mont are missing due to #elif structure
Fixes:
1. Change add_definitions(-DENABLE_SM2_NEON) to
add_definitions(-DENABLE_SM2_Z256_NEON) in CMakeLists.txt
2. Add the three missing wrapper functions in NEON code block
2026-02-02 15:02:55 +08:00
Zhi Guan
d719ee4862
Conv from UTF-8 to ASCII
...
`file *.c` to see file types (ASCII or UTF-8), convert UTF-8 (with BOM) to ASCII
```sh
sed '1s/^\xEF\xBB\xBF//' sm4.c | iconv -f UTF-8 -t ASCII//TRANSLIT > temp.c
mv temp.c sm4.c
```
2024-05-25 18:06:16 +08:00
Zhi Guan
0d1ef16de0
Fix SM2_AMD64
2024-05-25 09:44:08 +08:00
Zhi Guan
1fd989303f
Add SM2 X86_64 asm
...
Not working yet
2024-05-24 20:04:53 +08:00
Zhi Guan
f3ceaa4e4e
Update sm2_z256.c
2024-05-23 16:43:05 +08:00
Zhi Guan
adc181fa91
Remove warnings
2024-05-23 16:28:54 +08:00
Zhi Guan
dc80b0c137
Change cpu suffix and other file names
2024-05-12 23:17:35 +08:00
Zhi Guan
bce16e1835
Update sm2_z256.c
2024-04-29 22:56:48 +08:00
Zhi Guan
8513857454
Update sm2_z256.c
2024-04-29 22:47:43 +08:00
Zhi Guan
f0859a1f04
Update sm2_z256_point_mul_pre_compute
2024-04-25 11:46:10 +08:00
Zhi Guan
f8fbeddd4f
Add SM2_VERIFY_CTX
2024-04-25 08:40:39 +08:00
Zhi Guan
242bbb3f6d
Add speed tests
2024-04-22 22:46:23 +08:00
Zhi Guan
afd9682254
Merge pull request #1660 from Gorachya/master
...
Add SM2_mont_mul_2_way for NEON
2024-04-20 12:53:52 +08:00
Zhi Guan
8cb306ad0b
Adjust SM3 SM4 API
...
Remove sm3_digest. Use more _gmssl_export
2024-04-19 18:32:06 +08:00
Gorachya
36f256913d
Update sm2_z256.c
2024-04-19 17:55:28 +08:00
Zhi Guan
ab7c9a7651
Adjust SM2 API and tests
2024-04-19 17:32:54 +08:00
Zhi Guan
725817add9
Use sm3_pbkdf2 without digest API
2024-04-19 13:21:52 +08:00
Zhi Guan
e9bbcf5490
Use z256 and jacobian coordinates as inner presentation of SM2 point
2024-04-18 21:27:00 +08:00
Zhi Guan
549c68d2df
Re-organize SM2 files
2024-04-17 22:43:04 +08:00
Zhi Guan
2a5dc640bd
Remove some modn functions
2024-04-17 20:55:20 +08:00
Zhi Guan
6028d1e10b
Rename POINT_AFFINE to AFFINE_POINT
2024-04-16 22:51:38 +08:00
Zhi Guan
4e66f911d0
Update rand_range functions
...
`rand_range` will stop and return 0 if the `range` is too small. Caller can call it again or stop. `rand_range` return -1 only if RNG failure.
2024-04-16 22:49:59 +08:00
Zhi Guan
ddda806267
Change function names
2024-04-16 19:03:05 +08:00
Zhi Guan
31440f9948
Update SM2
2024-03-19 21:37:36 +08:00
Zhi Guan
33baa3df92
Update SM2
2024-03-10 22:34:43 +08:00
Zhi Guan
4fa09e1f54
Update sm2 sign/enc with z256 implementation
2024-02-26 09:52:40 +08:00
Zhi Guan
c460766320
Update SM2 arithmetic implementations
...
Decouple API and implementations. SM2 arithmetic exposes 3 types: GF(p), GF(n), and Point.
2024-02-22 11:14:59 +08:00
Zhi Guan
326e7de416
Add SM2 Z256 implementation
2024-02-20 11:24:00 +08:00
Zhi Guan
87a4477ee9
Remove extra code
2023-10-12 15:06:35 +08:00
nntp4
b649589795
Fix bug not including sm2_z256.h
...
Signed-off-by: nntp4 <nntp4@proton.me >
2023-06-22 17:35:38 +08:00
Zhi Guan
5ca0d60781
Add sm2z256 c implementation
2023-04-22 10:23:57 +08:00