Commit Graph

238 Commits

Author SHA1 Message Date
Zhi Guan
6e8a36c738 Update SM4 CBC API 2024-04-28 17:27:41 +08:00
Zhi Guan
060930093f Update SM4 TBOX version 2024-04-28 17:11:57 +08:00
Zhi Guan
bc15f7a0c7 Update SM4 API 2024-04-27 12:08:35 +08:00
Zhi Guan
3f1fdc147a Add sm2_encrypt_pre_compute 2024-04-25 16:34:03 +08:00
Zhi Guan
f8fbeddd4f Add SM2_VERIFY_CTX 2024-04-25 08:40:39 +08:00
Zhi Guan
2e6cef2999 Change sm4_cl_encrypt to sm4_cl_ctr32_encrypt 2024-04-23 22:39:43 +08:00
Zhi Guan
e05fd9c1b9 Use Montgomery's Trick on sm2_fast_sign_pre_compute 2024-04-22 17:43:05 +08:00
Gorachya
797c7739f3 Update sm9_z256.h 2024-04-22 11:58:16 +08:00
Zhi Guan
506ab2711c Delete sha3.h 2024-04-21 23:58:05 +08:00
Zhi Guan
252c9e1765 Add more SM4 test vectors
SM4 pass openssl and other known test vectors. SM4-GCM and SM4-XTS only support the GB/T GF(2^128) encoding standard.
2024-04-21 10:10:46 +08:00
Zhi Guan
6f870889cf Adjust digest APIs 2024-04-19 21:14:10 +08:00
Zhi Guan
8cb306ad0b Adjust SM3 SM4 API
Remove sm3_digest. Use more _gmssl_export
2024-04-19 18:32:06 +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
356e618d99 Add sm2_key test 2024-04-18 22:01:50 +08:00
Zhi Guan
b2707a1f0e Adjust SM9 files 2024-04-18 21:41:17 +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
3a6bfbe03f Merge pull request #1655 from ohos-rs/master
fix(include): FILE deps on stdio header
2024-04-17 20:43:53 +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
b2a5885e23 Update sm9.h 2024-04-16 19:23:14 +08:00
Zhi Guan
ddda806267 Change function names 2024-04-16 19:03:05 +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
1ab7104749 Update GF(2^128) AVX implementation 2024-04-11 22:40:49 +08:00
Zhi Guan
b777fbafdb Re-organize SM4/GCM related source files 2024-04-11 22:19:50 +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
southorange0929
cf63ea9ae1 fix(include): FILE deps on stdio header 2024-04-11 09:56:13 +08:00
Zhi Guan
2d0378f3c7 Adjust SM4 source files 2024-04-10 16:07:44 +08:00
Zhi Guan
6b36c51cdf Add GMUL ASM 2024-03-31 16:54:24 +08:00
Zhi Guan
b476ef7528 Update SM9 2024-03-20 23:51:46 +08:00
Gorachya
ce7f9a281a Merge branch 'guanzhi:master' into master 2024-03-19 23:32:08 +08:00
Gorachya
ffb31eabc6 Add files via upload 2024-03-19 23:31:20 +08:00
Gorachya
bb2c86bcd8 Add files via upload 2024-03-19 23:28:59 +08:00
Zhi Guan
31440f9948 Update SM2 2024-03-19 21:37:36 +08:00
Gorachya
1d00270ae0 Add files via upload 2024-03-14 20:05:43 +08:00
Gorachya
ecb7cb3245 Add files via upload 2024-03-13 18:58:56 +08:00