| 1 |
// Copyright 2020 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
//go:build !purego |
| 6 |
|
| 7 |
#include "textflag.h" |
| 8 |
|
| 9 |
// func kdsa(fc uint64, params *[4096]byte) (errn uint64) |
| 10 |
TEXT ·kdsa(SB), NOSPLIT|NOFRAME, $0-24 |
| 11 |
MOVD fc+0(FP), R0 // function code |
| 12 |
MOVD params+8(FP), R1 // address parameter block |
| 13 |
|
| 14 |
loop: |
| 15 |
KDSA R0, R4 // compute digital signature authentication |
| 16 |
BVS loop // branch back if interrupted |
| 17 |
BGT retry // signing unsuccessful, but retry with new CSPRN |
| 18 |
BLT error // condition code of 1 indicates a failure |
| 19 |
|
| 20 |
success: |
| 21 |
MOVD $0, errn+16(FP) // return 0 - sign/verify was successful |
| 22 |
RET |
| 23 |
|
| 24 |
error: |
| 25 |
MOVD $1, errn+16(FP) // return 1 - sign/verify failed |
| 26 |
RET |
| 27 |
|
| 28 |
retry: |
| 29 |
MOVD $2, errn+16(FP) // return 2 - sign/verify was unsuccessful -- if sign, retry with new RN |
| 30 |
RET |