Commit Graph

380 Commits

Author SHA1 Message Date
Sun Yimin
02258d2351
sm4: reduce slice checking internally 2024-03-27 13:08:27 +08:00
Sun Yimin
34dd5104ee
sm4: reduce slice checking internally 2024-03-27 09:36:56 +08:00
Sun Yimin
e4909bed2d
sm4: reduce allocations 2024-03-27 08:38:25 +08:00
Sun Yimin
5adc912824
refine build tags 2024-03-05 09:47:49 +08:00
Sun Yimin
267ff02783
cipher/ctr: add more test data 2024-02-07 13:41:52 +08:00
Sun Yimin
a2ce3f51d0
sm4: reduce bounds check 2024-01-31 14:48:46 +08:00
Sun Yimin
19636d09c1
sm4: code refactor for block 2024-01-31 13:08:51 +08:00
Sun Yimin
9a45c4101b
sm4: optimize constant value loading on arm64 2024-01-30 13:10:41 +08:00
Sun Yimin
515cabfd04
sm4: optimize constant loading on arm64 2024-01-30 13:04:03 +08:00
Sun Yimin
a01428eaf3
sm4: add env var FORCE_SM4BLOCK_AESNI & give up cbc asm implementation 2024-01-25 17:46:09 +08:00
Sun Yimin
29b6da1d37
sm4: change to use pure go for single block encryption/decryption 2024-01-25 09:02:28 +08:00
Sun Yimin
8198f2aa8e
fix darwin cpu feature detect issue 2024-01-24 13:11:09 +08:00
Sun Yimin
82125c00a4
cipher: align error message pattern 2023-12-08 17:42:16 +08:00
Sun Yimin
851d02b3ea
Change VMOV to VDUP #179 2023-11-09 10:31:08 +08:00
Sun Yimin
17a3dd8d4b
change interface{} to any, and remove "+build" build tag #77 2023-11-09 08:34:50 +08:00
Sun Yimin
80e88ea2b2
sm4: use new method to load global data 2023-11-08 13:23:04 +08:00
Sun Yimin
8f5e603f94
sm4: disable PXOR use m128 directly 2023-11-01 15:00:49 +08:00
Sun Yimin
2f163662b5
sm4: cbc enc, do not mem directly 2023-11-01 13:03:46 +08:00
Sun Yimin
5243d0fe91
sm4: code format 2023-10-18 08:07:19 +08:00
Sun Yimin
5b3dfb6fa7
sm4: amd64, reduce VBROADCASTI128 usage 2023-09-28 13:19:52 +08:00
Sun Yimin
15d1b57a23
Update asm_arm64.s 2023-09-28 12:04:45 +08:00
Sun Yimin
87041f3ad3
sm4: arm64 load const issue 2023-09-28 11:54:24 +08:00
Sun Yimin
218ce35c71
sm4: arm64, fix load const issue 2023-09-28 11:47:38 +08:00
Sun Yimin
eba2b736bd
sm4: arm64, simplify const loading 2023-09-28 11:44:48 +08:00
Sun Yimin
53e121c2b5
sm4: optimize TAO L1 #168 2023-09-28 10:11:31 +08:00
Sun Yimin
9a4cb2c34f
sm4: use POR, although it does not affect the correctness 2023-09-27 09:22:22 +08:00
Sun Yimin
75b153887e
sm4: gcm amd64, remove uselss code 2023-09-04 08:36:03 +08:00
Sun Yimin
8d5c6c4601
sm4: gcm amd64 optmization 2023-08-28 14:41:15 +08:00
emmansun
3f602061fc sm4: gcm amd64 reduce byte shuffling #152 2023-08-26 10:11:25 +08:00
Sun Yimin
d3c19c171a
sm4: xts sm4ni arm64, fix register confliction #151 2023-08-25 13:53:27 +08:00
Sun Yimin
d28883e2c7
sm4: xts sm4ni arm64, fix bug 2023-08-25 13:40:07 +08:00
Sun Yimin
9cc53170df
sm4: remove amd64 build flag 2023-08-25 13:24:11 +08:00
Sun Yimin
8253e1be8e
sm4: xts sm4ni arm64, fix duplicated name issue #151 2023-08-25 13:20:55 +08:00
Sun Yimin
1019226803
sm4: xts sm4ni arm64 #151 2023-08-25 13:13:43 +08:00
Sun Yimin
e6d27e8bae
sm4: xts asm arm64, fix dead loop bug 2023-08-24 16:42:33 +08:00
Sun Yimin
50ddb5347e
sm4: xts asm arm64 one by one 2023-08-24 16:35:08 +08:00
Sun Yimin
a8714d9782
sm4: xts asm arm64 test one by one 2023-08-24 16:28:43 +08:00
Sun Yimin
28a6939861
sm4: xts asm arm64 test 2023-08-24 16:22:38 +08:00
Sun Yimin
6d6339f06d
sm4: xts asm arm64 test 2023-08-24 16:14:58 +08:00
Sun Yimin
3a304ee8dd
sm4: xts asm arm64 test one func first 2023-08-24 16:07:37 +08:00
Sun Yimin
a3daf1f525
sm4: xts asm arm64 test 2023-08-24 15:03:14 +08:00
Sun Yimin
9ee8ee4529
sm4: xts asm amd64 2023-08-24 11:47:06 +08:00
Sun Yimin
feb76edda8
sm4: fix cbc iv issue 2023-08-08 13:07:10 +08:00
Sun Yimin
0fbc30f868
sm4: optimize cbc iv handling 2023-08-08 12:35:42 +08:00
Sun Yimin
cb47e82478
sm4: fix arm64 copy paste issue 2023-08-08 08:29:07 +08:00
Sun Yimin
29d7b25b95
sm4: cbc ecb asm rename 2023-08-08 08:22:17 +08:00
Sun Yimin
20ab2874fa
Update cbc_cipher_asm_arm64.s 2023-08-07 21:55:19 +08:00
Sun Yimin
90f0279cb2
sm4: arm64 fix 2023-08-07 17:10:14 +08:00
Sun Yimin
b65b01a6a4
sm4: arm64 fix 2023-08-07 16:58:13 +08:00
Sun Yimin
c7fc1431ba
sm4: arm64 fix 2023-08-07 16:53:59 +08:00
Sun Yimin
06dbc52e48
sm4: arm64 fix 2023-08-07 16:48:14 +08:00
Sun Yimin
4e50b3dd6b
sm4: cbc ecb mode enhancement 2023-08-07 16:43:29 +08:00
Sun Yimin
e00fbe696d
sm4: optimize avx2 implementation 2023-08-04 15:52:00 +08:00
Sun Yimin
71afa44b91
sm4: fix arm64 cbc 8 blocks decryption issue 2023-08-03 16:40:31 +08:00
Sun Yimin
dba47d3c14
sm4: fix arm64 SM4_8BLOCKS_ROUND issue #146 2023-08-03 16:18:56 +08:00
Sun Yimin
1e360021c4
sm4: fix amd64 avx2 decrypt 4 blocks issue #146 2023-08-03 16:13:05 +08:00
Sun Yimin
4bc3c5d27b
sm4: improve throughput #146 2023-08-03 15:17:01 +08:00
Sun Yimin
fe84641340
sm4: use simple inst. 2023-07-31 17:32:41 +08:00
Sun Yimin
fc2f105dd2
sm4: fix AVX version use AVX2 inst. issue 2023-07-13 08:47:05 +08:00
Sun Yimin
89f3b0f6d3
sm4: add some comments for asm code 2023-07-05 17:51:26 +08:00
Sun Yimin
8cfd82dc53
sm4: mistake 2023-07-04 10:04:15 +08:00
Sun Yimin
12ef9e0ef9
sm4: optimize amd64 sse, cbc decrypter 2023-07-04 08:38:53 +08:00
emmansun
a53659eb5b sm4: optimize sse version 2023-07-03 16:20:04 +08:00
emmansun
f10b09f5a2 sm4: gcm init use PALIGNR to reduce instructions 2023-07-03 15:41:05 +08:00
Sun Yimin
d3e6412258
sm4: Support AES-NI + AVX #135 2023-07-03 12:00:27 +08:00
Sun Yimin
ce489e2b4b
sm4: fix include order issue 2023-06-28 17:05:38 +08:00
Sun Yimin
39f75ac913
sm4: rename asm macros files 2023-06-28 16:52:40 +08:00
Sun Yimin
1d0e77388a
sm4: ctr mode fix issue and comments 2023-06-27 17:52:23 +08:00
Sun Yimin
72614b4d8b
sm4: cbc arm64 missing definition 2023-06-19 16:02:09 +08:00
Sun Yimin
f81bbd17df
sm4: improve arm64 single block performance & CBC decrypt performance 2023-06-19 15:51:49 +08:00
Sun Yimin
3cbabc3d1c
optimize purego sm3/sm4 and reduce bounds checking for sm9 2023-06-16 16:06:38 +08:00
Sun Yimin
0e667b152d
sm4: improve purego performance 2023-06-16 10:22:15 +08:00
Sun Yimin
83849d33cf
sm4: fix bug 2023-06-05 14:46:59 +08:00
Sun Yimin
57d800767b
sm4: finetune bounds check 2023-06-05 14:32:15 +08:00
Sun Yimin
9f7a0ac2b6
sm4: arm optimize rotateleft 2023-03-30 16:41:21 +08:00
Sun Yimin
01151be42e
sm4: fix gcm_sm4ni_arm64 dec bug 2023-03-30 15:46:37 +08:00
Sun Yimin
b2b56fae32
fix gcm sm4 ni bug 2023-03-30 11:46:19 +08:00
Sun Yimin
6b4c50e65a
try reduce one instr 2023-03-30 11:30:36 +08:00
Sun Yimin
3fed51e909
fix error 2023-03-30 11:26:34 +08:00
Sun Yimin
c52d700860
do not reverse byte order 2023-03-30 10:26:10 +08:00
Sun Yimin
0ec1d9cb40
do not reverse byte order 2023-03-30 10:06:56 +08:00
Sun Yimin
03e35209e8
retry not reverse byte order 2023-03-30 10:01:34 +08:00
Sun Yimin
818159283c
disable sm3 sm4 ni via env. variable 2023-03-08 15:39:48 +08:00
Sun Yimin
ebf9a74d77
sm9: support non-xor modes 2023-02-10 17:19:50 +08:00
Sun Yimin
a2d54159ad
add example test for sm3 sm4 pkcs8 2023-02-02 11:45:57 +08:00
Sun Yimin
e3db7656a6
add example test for sm2 sm4 2023-02-01 11:17:23 +08:00
Sun Yimin
edfb4febdd
sm: improve docs and add examples 2023-01-31 13:50:14 +08:00
Sun Yimin
200a785d29
change build tag generic to purego & import nat package 2022-11-22 11:02:37 +08:00
Sun Yimin
1710bdff4a
refactoring, rename internal packages 2022-08-18 14:49:35 +08:00
Sun Yimin
818cbc3757
misc: clean code 2022-07-28 10:01:30 +08:00
Sun Yimin
21859b7273
sm4: gcm data disable pass initial tag 2022-07-28 09:37:03 +08:00
Sun Yimin
5b075213c0
sm4: add cbcEncAble interface 2022-07-26 08:30:24 +08:00
Sun Yimin
206c8075c3
sm4: arm64 use VZIP1 VZIP2 to transpose matrix 2022-07-25 17:10:15 +08:00
Sun Yimin
fd34c2eff2
sm4: arm64 transpose matrix use VZIP1 VZIP2 2022-07-25 16:37:23 +08:00
Sun Yimin
9b364dca8b
sm4: reduce duplicated code and add comments 2022-07-25 13:20:58 +08:00
Sun Yimin
9204f1f4b2
sm4: encryptBlockAsm arm64 optimization 2022-07-22 15:17:05 +08:00
Sun Yimin
acffd83cc9
sm4: format asm code 2022-07-22 10:08:15 +08:00
Sun Yimin
ff434b7bd7
sm4: arm64 forget to load IV 2022-07-21 17:37:57 +08:00
Sun Yimin
42faebb588
sm4: cbc encryption improvement a little 2022-07-21 17:32:11 +08:00
Sun Yimin
8ddf1bc68f
sm4: reduce duplicated asm code 2022-07-21 13:41:56 +08:00
Sun Yimin
572bf6574e
sm4: improve cbc decrypt performance 2022-07-20 11:43:49 +08:00
Sun Yimin
af50b136e9
sm4: separate cipher_ni from cipher_asm 2022-07-19 13:29:21 +08:00
Sun Yimin
24765d0e35
supplement unit test cases 2022-07-18 10:13:53 +08:00
Emman
eb94980db3 run "gofmt -s -w" 2022-07-15 16:42:39 +08:00
Sun Yimin
87f6f6a736
sm4: fix test case issue 2022-07-12 10:08:23 +08:00
Sun Yimin
daa6853722
sm4: add test cases 2022-07-12 09:57:35 +08:00
Sun Yimin
f5bd2cabad
fix 1.17 error 2022-06-14 08:57:25 +08:00
Sun Yimin
8cb1e257dc
support build generic 2022-06-14 08:45:54 +08:00
Sun Yimin
92439288cb
fix #57 2022-06-06 13:45:46 +08:00
emmansun
57d899613d align format 2022-05-01 18:06:47 +08:00
Emman
c71d5ccd96 Fix compile error 2022-04-29 17:29:08 +08:00
Emman
37ab6d67f3 Fix amd64 bug 2022-04-29 13:01:34 +08:00
Emman
51b26c071d separate aes/sm4 ni implementation 2022-04-29 12:09:04 +08:00
Emman
f2c249b323 refactoring and fix bug 2022-04-29 09:10:16 +08:00
Emman
4c131bdeb6 refactoring and fix bug 2022-04-29 08:56:53 +08:00
Emman
0beb90aff8 enable sm4ni gcm 2022-04-28 17:53:04 +08:00
Emman
5744b64c56 sm4ni gcm 2022-04-28 17:52:11 +08:00
Emman
0450200249 sm4 use sm4e sm4ekey, without gcm integration part 2022-04-28 13:46:50 +08:00
Emman
7632ebf376 sm4 generic implementation optimization ref openssl 2022-04-25 11:02:33 +08:00
Emman
0a827de266 update package level comments 2022-04-20 08:36:44 +08:00
Emman
d79ab3d709 Change to use new {M1, C1, M2, C2}, do not know the old one's derivation process 2022-03-11 18:05:08 +08:00
Emman
535b9ab928 Add SM GM/T references 2022-02-09 10:11:45 +08:00
Emman
8e5c2951be reduce test times for short mode 2022-01-26 10:33:02 +08:00
Emman
1c45ccbffd [SM4] avx2 gcm dec tuning 2022-01-24 16:14:42 +08:00
Emman
7dec383b16 align format 2022-01-21 11:24:10 +08:00
Emman
4156eb1c07 align / change format 2022-01-21 08:33:01 +08:00
Emman
ec03b0c5b6 [SM4] optimize arm64 TRANSPOSE_MATRIX, reduce 2 instructions 2022-01-20 10:11:49 +08:00
Emman
b2da8599b3 [SM4] arm64, optimize PRE_TRANSPOSE_MATRIX 2022-01-19 17:57:16 +08:00
emmansun
f43de47d72 [SM4] unify arm64 amd64 gcm asm 2022-01-18 19:50:14 +08:00
emmansun
ae7501d61b [SM4] arm64 gcmSm4dec fix error 2022-01-18 19:42:29 +08:00
emmansun
88d9e01205 [SM4] ARM64 fix error 2022-01-18 19:32:57 +08:00
emmansun
252325c878 try it 2022-01-18 19:24:56 +08:00
Emman
bb54bbcc06 [SM4] arm64 transpose 4*4 matrix 2022-01-18 17:56:30 +08:00
Sun Yimin
e3cb95ec66
Update gcm_arm64.s 2022-01-18 17:11:26 +08:00
Emman
fdae8b06e6 [SM4] ARM64 transpose 4x4 matrix 2022-01-18 16:49:14 +08:00
Emman
129803a389 [SM4] try arm64 gcmSm4Enc gcmSm4Dec 2022-01-18 15:58:14 +08:00
Emman
067a12cb20 [SM4] code format 2022-01-18 11:40:59 +08:00
Emman
6dde984da4 [SM4] gcmSm4Enc & gcmSm4Dec 2022-01-18 10:31:53 +08:00
Emman
93df5651e9 Merge branch 'main' of https://github.com/emmansun/gmsm 2022-01-13 13:21:07 +08:00
Emman
c6292b9704 [SM4] do not use VMOVQ to support golang 1.15.x 2022-01-13 13:15:35 +08:00
Sun Yimin
a919f67dbb
Update gcm_arm64.s 2022-01-13 11:36:40 +08:00
Emman
efedf2654a [SM4] arm64, gcmSm4Init fix VMOVQ issue 2022-01-13 11:17:33 +08:00
Emman
ece5b0b66d [SM4] VMOVQ change constant order 2022-01-13 10:51:02 +08:00
Emman
d17b4e4b3b [SM4] arm64, use VMOVQ to load large constant 2022-01-13 10:43:43 +08:00
Emman
8420b1676d [SM4] arm64, further test VMOVQ 2022-01-13 10:16:53 +08:00
Emman
7914d29bcd [SM4] arm64, use VMOVQ 2022-01-13 10:06:37 +08:00
Emman
bb20b52bd1 [SM4] test VMOVQ 2022-01-13 09:49:43 +08:00
Emman
32da31b074 [SM4] refactoring 2022-01-13 09:37:48 +08:00
Emman
4ed467a7d4 [SM4] fallback again 2022-01-13 09:00:08 +08:00
Emman
a250ae8a31 [SM4] fix error 2022-01-13 08:44:20 +08:00