mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 12:16:20 +08:00
internal/subtle: s390x
This commit is contained in:
parent
1f2a93916b
commit
6925a64c6c
36
.github/workflows/test_s390x.yaml
vendored
Normal file
36
.github/workflows/test_s390x.yaml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# This workflow will build a golang project
|
||||||
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
|
||||||
|
|
||||||
|
name: s390x-qemu
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
test:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: [1.19.x]
|
||||||
|
arch: [s390x]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Test bigmod
|
||||||
|
run: go test -v -short ./internal/bigmod/...
|
||||||
|
|
||||||
|
- name: Test subtle
|
||||||
|
run: go test -v -short ./internal/subtle/...
|
@ -1,4 +1,4 @@
|
|||||||
//go:build (amd64 && !purego && !plugin) || (arm64 && !purego)
|
//go:build !purego && (amd64 || arm64)
|
||||||
|
|
||||||
package sm2ec
|
package sm2ec
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
//
|
//
|
||||||
//go:build purego || !(amd64 || arm64)
|
//go:build purego || !(amd64 || arm64 || s390x)
|
||||||
|
|
||||||
package subtle
|
package subtle
|
||||||
|
|
||||||
|
10
internal/subtle/xor_s390x.go
Normal file
10
internal/subtle/xor_s390x.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
//go:build !purego
|
||||||
|
|
||||||
|
package subtle
|
||||||
|
|
||||||
|
//go:noescape
|
||||||
|
func xorBytes(dst, a, b *byte, n int)
|
36
internal/subtle/xor_s390x.s
Normal file
36
internal/subtle/xor_s390x.s
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Copyright 2016 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !purego
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
// func xorBytes(dst, a, b *byte, n int)
|
||||||
|
TEXT ·xorBytes(SB),NOSPLIT,$0-32
|
||||||
|
MOVD dst+0(FP), R1
|
||||||
|
MOVD a+8(FP), R2
|
||||||
|
MOVD b+16(FP), R3
|
||||||
|
MOVD n+24(FP), R4
|
||||||
|
|
||||||
|
MOVD $0, R5
|
||||||
|
CMPBLT R4, $8, tail
|
||||||
|
loop:
|
||||||
|
MOVD 0(R2)(R5*1), R7
|
||||||
|
MOVD 0(R3)(R5*1), R8
|
||||||
|
XOR R7, R8
|
||||||
|
MOVD R8, 0(R1)(R5*1)
|
||||||
|
LAY 8(R5), R5
|
||||||
|
SUB $8, R4
|
||||||
|
CMPBGE R4, $8, loop
|
||||||
|
tail:
|
||||||
|
CMPBEQ R4, $0, done
|
||||||
|
MOVB 0(R2)(R5*1), R7
|
||||||
|
MOVB 0(R3)(R5*1), R8
|
||||||
|
XOR R7, R8
|
||||||
|
MOVB R8, 0(R1)(R5*1)
|
||||||
|
LAY 1(R5), R5
|
||||||
|
SUB $1, R4
|
||||||
|
BR tail
|
||||||
|
done:
|
||||||
|
RET
|
Loading…
x
Reference in New Issue
Block a user