Commit Graph

610 Commits

Author SHA1 Message Date
Zhi Guan
fbad76e807 Update CMakeLists.txt 2024-04-17 15:47:28 +08:00
Zhi Guan
b01ad79475 Update sm9test.c 2024-04-17 15:44:56 +08:00
Zhi Guan
5d40024f14 Update SM9 to/from_hex API 2024-04-17 15:42:47 +08:00
Zhi Guan
c79084ad03 Remove sm9 modp to/from bytes/hex 2024-04-17 09:09:37 +08:00
Zhi Guan
c32cb0f8e4 Add sm3_pbkdf2 function
digest.h will be removed in the future.
2024-04-16 23:04:18 +08:00
Zhi Guan
f0e70bbb4d Rename SM2_Z256 to sm2_z256_t 2024-04-16 22:58:07 +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
e061dda71f Remove modp_to_bytes 2024-04-16 22:27:59 +08:00
Zhi Guan
b2a5885e23 Update sm9.h 2024-04-16 19:23:14 +08:00
Zhi Guan
9083a7a60b Rename SM2 file names 2024-04-16 19:20:35 +08:00
Zhi Guan
fea2b018dc Rename SM9 file names 2024-04-16 19:18:07 +08:00
Zhi Guan
b519f973b9 Delete sm2_uint128test.c 2024-04-16 19:04:17 +08:00
Zhi Guan
ddda806267 Change function names 2024-04-16 19:03:05 +08:00
Zhi Guan
1b69de3820 Update sm9_z256_alg.c 2024-04-16 11:22:35 +08:00
Zhi Guan
afed7a0ecb Make SDF/SKF optional in CMake 2024-04-15 08:49:16 +08:00
Zhi Guan
bd12c4ef50 Update tls.c 2024-04-15 08:48:40 +08:00
Zhi Guan
56f45c8dbf Remove warnings 2024-04-14 11:20:45 +08:00
Zhi Guan
ef03ddc680 Restore the original sm9 header file name. 2024-04-14 11:15:05 +08:00
Zhi Guan
771fe867ef Adjust SM9 API
不再将Fp, Fn上的元素视为一种类型,而是看做在sm9_z256_t类型上的特殊计算类型,同理Montgomery计算也是sm9_z256_t上的计算。通过函数名可以完全体现在sm9_z256_t上的计算类型。

于此不同的是,GF(p^2), GF(p^4), GF(p^12) 几个类型在内部完全采用Montgomery形式表示,因此sm9_z256_fp2_t等表示特殊的类型,不再区分mul和mont_mul,因为所有计算都是Montgomery上的计算。
2024-04-14 10:20:11 +08:00
Zhi Guan
28428de876 Remove fp_from_bytes and fn_from_bytes 2024-04-13 23:06:38 +08:00
Zhi Guan
3a46c4a499 Add suffix _t to array type names 2024-04-13 18:57:29 +08:00
Zhi Guan
9937b8dc6d Remove point_copy
use `*R = *P` instead
2024-04-13 18:51:33 +08:00
Zhi Guan
047ec4586a Remove macros 2024-04-13 18:48:11 +08:00
Zhi Guan
e9d61cb1f4 Remove unused macros
Remove fp_ fn_ macros can reduce the API size. Another reason is that some macros such as fp_equ, fn_equ, can not return correct result on `a` and `a + modulus`
2024-04-13 18:41:19 +08:00
Zhi Guan
0daba2e61d Generate compiler compatible assembly symbols
Typically when compiling a function `foo`,  GCC will add a prefix `_` to the symbol, i.e., generate `_foo`. But on some platforms, the compiler will not add prefix. option `ENABLE_ASM_UNDERSCORE_PREFIX` change the default name of global symbols in assembly code.
2024-04-13 17:37:47 +08:00
Zhi Guan
8e2c4ebd2f Update SM4 OpenCL implementation 2024-04-12 16:07:30 +08:00
Zhi Guan
9fd4464980 AES GCM depends on CTR 2024-04-12 10:27:08 +08:00
Zhi Guan
8c1c69e264 Implement SM4 GCM with CTR
So gcm can benefits from ctr optimizations.
2024-04-12 10:22:57 +08:00
Zhi Guan
8dd2e71a54 Remove old SM9 code 2024-04-11 23:30:01 +08:00
Zhi Guan
fb9a3108ae Delete sm9_lib.c 2024-04-11 23:27:51 +08:00
Zhi Guan
1bc218f4c2 Delete sm9_key.c 2024-04-11 23:27:48 +08:00
Zhi Guan
b43dc1233c Delete sm9_alg.c 2024-04-11 23:27:44 +08:00
Zhi Guan
1763074a32 Update gf128.c 2024-04-11 23:09:34 +08:00
Zhi Guan
5b7a9c1604 rename sm4 aesni+avx source 2024-04-11 23:09:30 +08:00
Zhi Guan
51f60061c5 Add SM4 AArch64 assembly 2024-04-11 22:45:07 +08:00
Zhi Guan
1ab7104749 Update GF(2^128) AVX implementation 2024-04-11 22:40:49 +08:00
Zhi Guan
23e6d9fb10 Delete gcm.c 2024-04-11 22:22:32 +08:00
Zhi Guan
b777fbafdb Re-organize SM4/GCM related source files 2024-04-11 22:19:50 +08:00
Zhi Guan
e4502ddd24 XTS use new GF(2^128) API 2024-04-11 18:02:46 +08:00
Zhi Guan
f9e9b20fa7 Change GF(2^128) API
from `r = op(a, b)` to `op(r, a, b)`
2024-04-11 17:57:41 +08:00
Zhi Guan
6a55fd1445 Update gf128_aarch64.S 2024-04-11 13:57:18 +08:00
Zhi Guan
b83ff15aae Update SM4 and GF128
Merge sm4_tbox.c into sm4.c, optimize GMUL for AAarch64
2024-04-11 13:55:19 +08:00
Zhi Guan
2d0378f3c7 Adjust SM4 source files 2024-04-10 16:07:44 +08:00
Zhi Guan
ccab5f168e Update SM4 build options 2024-04-10 11:33:57 +08:00
Zhi Guan
d752d66633 Add SM9 2-way mont mul 2024-04-06 11:11:09 +08:00
Zhi Guan
eabeeeeed0 Update CMakeLists.txt 2024-04-05 23:16:23 +08:00
Zhi Guan
d889a48b5d Add SM3 SSE 2024-04-05 23:08:31 +08:00
Zhi Guan
149e429d1c Add SM4 aarch64 asm support 2024-04-01 09:53:52 +08:00
Zhi Guan
89c6ec9838 Update sm4_cl.c 2024-03-31 16:54:47 +08:00