mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
internal/sm2ec: s390x try VLM/VSTM
This commit is contained in:
parent
6852a2c51f
commit
383d74ed93
10
.github/workflows/test_s390x.yaml
vendored
10
.github/workflows/test_s390x.yaml
vendored
@ -34,11 +34,11 @@ jobs:
|
||||
env:
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
|
||||
- name: Test
|
||||
run: go test -v -short ./...
|
||||
env:
|
||||
GODEBUG: x509sha1=1
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
# - name: Test
|
||||
# run: go test -v -short ./...
|
||||
# env:
|
||||
# GODEBUG: x509sha1=1
|
||||
# GOARCH: ${{ matrix.arch }}
|
||||
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ English | [简体中文](README.md)
|
||||
ShangMi (SM) cipher suites for Golang, referred to as **GMSM**, is a secure, high-performance, easy-to-use Golang ShangMi (SM) cipher suites library, covering public algorithms SM2/SM3/SM4/SM9/ZUC.
|
||||
|
||||
## Packages
|
||||
- **SM2** - This is a SM2 sm2p256v1 implementation whose performance is similar like golang native NIST P256 under **amd64** and **arm64**, for implementation detail, please refer [SM2实现细节](https://github.com/emmansun/gmsm/wiki/SM2%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96). It supports ShangMi sm2 digital signature, public key encryption algorithm and also key exchange.
|
||||
- **SM2** - This is a SM2 sm2p256v1 implementation whose performance is similar like golang native NIST P256 under **amd64**, **arm64** and **s390x**, for implementation detail, please refer [SM2实现细节](https://github.com/emmansun/gmsm/wiki/SM2%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96). It supports ShangMi sm2 digital signature, public key encryption algorithm and also key exchange.
|
||||
|
||||
- **SM3** - This is also a SM3 implementation whose performance is similar like golang native SHA 256 with SIMD under **amd64** and **arm64**, for implementation detail, please refer [SM3性能优化](https://github.com/emmansun/gmsm/wiki/SM3%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96). It also provides A64 cryptographic instructions SM3 tested with QEMU.
|
||||
|
||||
|
@ -24,7 +24,7 @@ Go语言商用密码软件,简称**GMSM**,一个安全、高性能、易于
|
||||
- [PKCS12应用指南](./docs/pkcs12.md)
|
||||
|
||||
## 包结构
|
||||
- **SM2** - SM2椭圆曲线公钥密码算法,曲线的具体实现位于[internal/sm2ec](https://github.com/emmansun/gmsm/tree/main/internal/sm2ec) package中。SM2曲线实现性能和Golang SDK中的NIST P256椭圆曲线原生实现(非BoringCrypto)类似,也对**amd64** 和 **arm64**架构做了专门汇编优化实现,您也可以参考[SM2实现细节](https://github.com/emmansun/gmsm/wiki/SM2%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96)及相关Wiki和代码,以获得更多实现细节。SM2包实现了SM2椭圆曲线公钥密码算法的数字签名算法、公钥加密算法、密钥交换算法,以及《GB/T 35276-2017信息安全技术 SM2密码算法使用规范》中的密钥对保护数据格式。
|
||||
- **SM2** - SM2椭圆曲线公钥密码算法,曲线的具体实现位于[internal/sm2ec](https://github.com/emmansun/gmsm/tree/main/internal/sm2ec) package中。SM2曲线实现性能和Golang SDK中的NIST P256椭圆曲线原生实现(非BoringCrypto)类似,也对**amd64**,**arm64**和**s390x**架构做了专门汇编优化实现,您也可以参考[SM2实现细节](https://github.com/emmansun/gmsm/wiki/SM2%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96)及相关Wiki和代码,以获得更多实现细节。SM2包实现了SM2椭圆曲线公钥密码算法的数字签名算法、公钥加密算法、密钥交换算法,以及《GB/T 35276-2017信息安全技术 SM2密码算法使用规范》中的密钥对保护数据格式。
|
||||
|
||||
- **SM3** - SM3密码杂凑算法实现。**amd64**下分别针对**AVX2+BMI2、AVX、SSE2+SSSE3**做了消息扩展部分的SIMD实现; **arm64**下使用NEON指令做了消息扩展部分的SIMD实现,同时也提供了基于**A64扩展密码指令**的汇编实现。您也可以参考[SM3性能优化](https://github.com/emmansun/gmsm/wiki/SM3%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96)及相关Wiki和代码,以获得更多实现细节。
|
||||
|
||||
|
@ -165,19 +165,21 @@ TEXT ·p256MovCond(SB), NOSPLIT, $0
|
||||
VZERO ZER
|
||||
VCEQG SEL1, ZER, SEL1
|
||||
|
||||
VL 0(P1ptr), X1H
|
||||
VL 16(P1ptr), X1L
|
||||
VL 32(P1ptr), Y1H
|
||||
VL 48(P1ptr), Y1L
|
||||
VL 64(P1ptr), Z1H
|
||||
VL 80(P1ptr), Z1L
|
||||
VLM (P1ptr), X1H, Z1L
|
||||
// VL 0(P1ptr), X1H
|
||||
// VL 16(P1ptr), X1L
|
||||
// VL 32(P1ptr), Y1H
|
||||
// VL 48(P1ptr), Y1L
|
||||
// VL 64(P1ptr), Z1H
|
||||
// VL 80(P1ptr), Z1L
|
||||
|
||||
VL 0(P2ptr), X2H
|
||||
VL 16(P2ptr), X2L
|
||||
VL 32(P2ptr), Y2H
|
||||
VL 48(P2ptr), Y2L
|
||||
VL 64(P2ptr), Z2H
|
||||
VL 80(P2ptr), Z2L
|
||||
VLM (P2ptr), X2H, Z2L
|
||||
// VL 0(P2ptr), X2H
|
||||
// VL 16(P2ptr), X2L
|
||||
// VL 32(P2ptr), Y2H
|
||||
// VL 48(P2ptr), Y2L
|
||||
// VL 64(P2ptr), Z2H
|
||||
// VL 80(P2ptr), Z2L
|
||||
|
||||
VSEL X2L, X1L, SEL1, X1L
|
||||
VSEL X2H, X1H, SEL1, X1H
|
||||
@ -186,12 +188,13 @@ TEXT ·p256MovCond(SB), NOSPLIT, $0
|
||||
VSEL Z2L, Z1L, SEL1, Z1L
|
||||
VSEL Z2H, Z1H, SEL1, Z1H
|
||||
|
||||
VST X1H, 0(P3ptr)
|
||||
VST X1L, 16(P3ptr)
|
||||
VST Y1H, 32(P3ptr)
|
||||
VST Y1L, 48(P3ptr)
|
||||
VST Z1H, 64(P3ptr)
|
||||
VST Z1L, 80(P3ptr)
|
||||
VSTM X1H, Z1L, (P3ptr)
|
||||
// VST X1H, 0(P3ptr)
|
||||
// VST X1L, 16(P3ptr)
|
||||
// VST Y1H, 32(P3ptr)
|
||||
// VST Y1L, 48(P3ptr)
|
||||
// VST Z1H, 64(P3ptr)
|
||||
// VST Z1L, 80(P3ptr)
|
||||
|
||||
RET
|
||||
|
||||
@ -473,7 +476,6 @@ TEXT ·p256FromMont(SB), NOSPLIT, $0
|
||||
#define Y2H V9
|
||||
#define Z2L V10
|
||||
#define Z2H V11
|
||||
#define LE2BE V12
|
||||
|
||||
#define ONE V18
|
||||
#define IDX V19
|
||||
@ -488,7 +490,6 @@ TEXT ·p256SelectAffine(SB), NOSPLIT, $0
|
||||
VREPIB $1, ONE
|
||||
VREPIB $1, SEL2
|
||||
MOVD $1, COUNT
|
||||
VL 48(CPOOL), LE2BE
|
||||
|
||||
VZERO X1H
|
||||
VZERO X1L
|
||||
|
Loading…
x
Reference in New Issue
Block a user