Browse Source
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.36.0 to 0.37.0. - [Commits](https://github.com/golang/crypto/compare/v0.36.0...v0.37.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-version: 0.37.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>pull/3978/head
25 changed files with 650 additions and 104 deletions
@ -0,0 +1,123 @@ |
|||||||
|
// Copyright 2025 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 gc && !purego |
||||||
|
|
||||||
|
// func update(state *macState, msg []byte) |
||||||
|
TEXT ·update(SB), $0-32 |
||||||
|
MOVV state+0(FP), R4 |
||||||
|
MOVV msg_base+8(FP), R5 |
||||||
|
MOVV msg_len+16(FP), R6 |
||||||
|
|
||||||
|
MOVV $0x10, R7 |
||||||
|
|
||||||
|
MOVV (R4), R8 // h0 |
||||||
|
MOVV 8(R4), R9 // h1 |
||||||
|
MOVV 16(R4), R10 // h2 |
||||||
|
MOVV 24(R4), R11 // r0 |
||||||
|
MOVV 32(R4), R12 // r1 |
||||||
|
|
||||||
|
BLT R6, R7, bytes_between_0_and_15 |
||||||
|
|
||||||
|
loop: |
||||||
|
MOVV (R5), R14 // msg[0:8] |
||||||
|
MOVV 8(R5), R16 // msg[8:16] |
||||||
|
ADDV R14, R8, R8 // h0 (x1 + y1 = z1', if z1' < x1 then z1' overflow) |
||||||
|
ADDV R16, R9, R27 |
||||||
|
SGTU R14, R8, R24 // h0.carry |
||||||
|
SGTU R9, R27, R28 |
||||||
|
ADDV R27, R24, R9 // h1 |
||||||
|
SGTU R27, R9, R24 |
||||||
|
OR R24, R28, R24 // h1.carry |
||||||
|
ADDV $0x01, R24, R24 |
||||||
|
ADDV R10, R24, R10 // h2 |
||||||
|
|
||||||
|
ADDV $16, R5, R5 // msg = msg[16:] |
||||||
|
|
||||||
|
multiply: |
||||||
|
MULV R8, R11, R14 // h0r0.lo |
||||||
|
MULHVU R8, R11, R15 // h0r0.hi |
||||||
|
MULV R9, R11, R13 // h1r0.lo |
||||||
|
MULHVU R9, R11, R16 // h1r0.hi |
||||||
|
ADDV R13, R15, R15 |
||||||
|
SGTU R13, R15, R24 |
||||||
|
ADDV R24, R16, R16 |
||||||
|
MULV R10, R11, R25 |
||||||
|
ADDV R16, R25, R25 |
||||||
|
MULV R8, R12, R13 // h0r1.lo |
||||||
|
MULHVU R8, R12, R16 // h0r1.hi |
||||||
|
ADDV R13, R15, R15 |
||||||
|
SGTU R13, R15, R24 |
||||||
|
ADDV R24, R16, R16 |
||||||
|
MOVV R16, R8 |
||||||
|
MULV R10, R12, R26 // h2r1 |
||||||
|
MULV R9, R12, R13 // h1r1.lo |
||||||
|
MULHVU R9, R12, R16 // h1r1.hi |
||||||
|
ADDV R13, R25, R25 |
||||||
|
ADDV R16, R26, R27 |
||||||
|
SGTU R13, R25, R24 |
||||||
|
ADDV R27, R24, R26 |
||||||
|
ADDV R8, R25, R25 |
||||||
|
SGTU R8, R25, R24 |
||||||
|
ADDV R24, R26, R26 |
||||||
|
AND $3, R25, R10 |
||||||
|
AND $-4, R25, R17 |
||||||
|
ADDV R17, R14, R8 |
||||||
|
ADDV R26, R15, R27 |
||||||
|
SGTU R17, R8, R24 |
||||||
|
SGTU R26, R27, R28 |
||||||
|
ADDV R27, R24, R9 |
||||||
|
SGTU R27, R9, R24 |
||||||
|
OR R24, R28, R24 |
||||||
|
ADDV R24, R10, R10 |
||||||
|
SLLV $62, R26, R27 |
||||||
|
SRLV $2, R25, R28 |
||||||
|
SRLV $2, R26, R26 |
||||||
|
OR R27, R28, R25 |
||||||
|
ADDV R25, R8, R8 |
||||||
|
ADDV R26, R9, R27 |
||||||
|
SGTU R25, R8, R24 |
||||||
|
SGTU R26, R27, R28 |
||||||
|
ADDV R27, R24, R9 |
||||||
|
SGTU R27, R9, R24 |
||||||
|
OR R24, R28, R24 |
||||||
|
ADDV R24, R10, R10 |
||||||
|
|
||||||
|
SUBV $16, R6, R6 |
||||||
|
BGE R6, R7, loop |
||||||
|
|
||||||
|
bytes_between_0_and_15: |
||||||
|
BEQ R6, R0, done |
||||||
|
MOVV $1, R14 |
||||||
|
XOR R15, R15 |
||||||
|
ADDV R6, R5, R5 |
||||||
|
|
||||||
|
flush_buffer: |
||||||
|
MOVBU -1(R5), R25 |
||||||
|
SRLV $56, R14, R24 |
||||||
|
SLLV $8, R15, R28 |
||||||
|
SLLV $8, R14, R14 |
||||||
|
OR R24, R28, R15 |
||||||
|
XOR R25, R14, R14 |
||||||
|
SUBV $1, R6, R6 |
||||||
|
SUBV $1, R5, R5 |
||||||
|
BNE R6, R0, flush_buffer |
||||||
|
|
||||||
|
ADDV R14, R8, R8 |
||||||
|
SGTU R14, R8, R24 |
||||||
|
ADDV R15, R9, R27 |
||||||
|
SGTU R15, R27, R28 |
||||||
|
ADDV R27, R24, R9 |
||||||
|
SGTU R27, R9, R24 |
||||||
|
OR R24, R28, R24 |
||||||
|
ADDV R10, R24, R10 |
||||||
|
|
||||||
|
MOVV $16, R6 |
||||||
|
JMP multiply |
||||||
|
|
||||||
|
done: |
||||||
|
MOVV R8, (R4) |
||||||
|
MOVV R9, 8(R4) |
||||||
|
MOVV R10, 16(R4) |
||||||
|
RET |
||||||
@ -1,47 +0,0 @@ |
|||||||
// Copyright 2019 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 gc && !purego && (ppc64 || ppc64le)
|
|
||||||
|
|
||||||
package poly1305 |
|
||||||
|
|
||||||
//go:noescape
|
|
||||||
func update(state *macState, msg []byte) |
|
||||||
|
|
||||||
// mac is a wrapper for macGeneric that redirects calls that would have gone to
|
|
||||||
// updateGeneric to update.
|
|
||||||
//
|
|
||||||
// Its Write and Sum methods are otherwise identical to the macGeneric ones, but
|
|
||||||
// using function pointers would carry a major performance cost.
|
|
||||||
type mac struct{ macGeneric } |
|
||||||
|
|
||||||
func (h *mac) Write(p []byte) (int, error) { |
|
||||||
nn := len(p) |
|
||||||
if h.offset > 0 { |
|
||||||
n := copy(h.buffer[h.offset:], p) |
|
||||||
if h.offset+n < TagSize { |
|
||||||
h.offset += n |
|
||||||
return nn, nil |
|
||||||
} |
|
||||||
p = p[n:] |
|
||||||
h.offset = 0 |
|
||||||
update(&h.macState, h.buffer[:]) |
|
||||||
} |
|
||||||
if n := len(p) - (len(p) % TagSize); n > 0 { |
|
||||||
update(&h.macState, p[:n]) |
|
||||||
p = p[n:] |
|
||||||
} |
|
||||||
if len(p) > 0 { |
|
||||||
h.offset += copy(h.buffer[h.offset:], p) |
|
||||||
} |
|
||||||
return nn, nil |
|
||||||
} |
|
||||||
|
|
||||||
func (h *mac) Sum(out *[16]byte) { |
|
||||||
state := h.macState |
|
||||||
if h.offset > 0 { |
|
||||||
update(&state, h.buffer[:h.offset]) |
|
||||||
} |
|
||||||
finalize(out, &state.h, &state.s) |
|
||||||
} |
|
||||||
@ -0,0 +1,22 @@ |
|||||||
|
// Copyright 2025 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.
|
||||||
|
|
||||||
|
package cpu |
||||||
|
|
||||||
|
// HWCAP bits. These are exposed by the Linux kernel.
|
||||||
|
const ( |
||||||
|
hwcap_LOONGARCH_LSX = 1 << 4 |
||||||
|
hwcap_LOONGARCH_LASX = 1 << 5 |
||||||
|
) |
||||||
|
|
||||||
|
func doinit() { |
||||||
|
// TODO: Features that require kernel support like LSX and LASX can
|
||||||
|
// be detected here once needed in std library or by the compiler.
|
||||||
|
Loong64.HasLSX = hwcIsSet(hwCap, hwcap_LOONGARCH_LSX) |
||||||
|
Loong64.HasLASX = hwcIsSet(hwCap, hwcap_LOONGARCH_LASX) |
||||||
|
} |
||||||
|
|
||||||
|
func hwcIsSet(hwc uint, val uint) bool { |
||||||
|
return hwc&val != 0 |
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
// Copyright 2025 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. |
||||||
|
|
||||||
|
#include "textflag.h" |
||||||
|
|
||||||
|
// func get_cpucfg(reg uint32) uint32 |
||||||
|
TEXT ·get_cpucfg(SB), NOSPLIT|NOFRAME, $0 |
||||||
|
MOVW reg+0(FP), R5 |
||||||
|
// CPUCFG R5, R4 = 0x00006ca4 |
||||||
|
WORD $0x00006ca4 |
||||||
|
MOVW R4, ret+8(FP) |
||||||
|
RET |
||||||
Loading…
Reference in new issue