mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
internal/sm2ec: fix s390x p256FromMont
This commit is contained in:
parent
bf891d841e
commit
495f8ae7a4
@ -328,7 +328,6 @@ loop_select:
|
|||||||
|
|
||||||
#define ZER V6
|
#define ZER V6
|
||||||
#define SEL1 V7
|
#define SEL1 V7
|
||||||
#define SEL2 V8
|
|
||||||
#define CAR1 V9
|
#define CAR1 V9
|
||||||
#define CAR2 V10
|
#define CAR2 V10
|
||||||
#define RED1 V11
|
#define RED1 V11
|
||||||
@ -345,8 +344,7 @@ TEXT ·p256FromMont(SB), NOSPLIT, $0
|
|||||||
MOVD $p256<>+0x00(SB), CPOOL
|
MOVD $p256<>+0x00(SB), CPOOL
|
||||||
VL 16(CPOOL), PL
|
VL 16(CPOOL), PL
|
||||||
VL 0(CPOOL), PH
|
VL 0(CPOOL), PH
|
||||||
VL 48(CPOOL), SEL2
|
VL 48(CPOOL), SEL1
|
||||||
VL 64(CPOOL), SEL1
|
|
||||||
|
|
||||||
VL (0*16)(x_ptr), T0
|
VL (0*16)(x_ptr), T0
|
||||||
VPDI $0x4, T0, T0, T0
|
VPDI $0x4, T0, T0, T0
|
||||||
@ -449,7 +447,6 @@ TEXT ·p256FromMont(SB), NOSPLIT, $0
|
|||||||
#undef TT1
|
#undef TT1
|
||||||
#undef ZER
|
#undef ZER
|
||||||
#undef SEL1
|
#undef SEL1
|
||||||
#undef SEL2
|
|
||||||
#undef CAR1
|
#undef CAR1
|
||||||
#undef CAR2
|
#undef CAR2
|
||||||
#undef RED1
|
#undef RED1
|
||||||
|
@ -66,7 +66,7 @@ func testP256OrderReduce(v, expected *big.Int, t *testing.T) {
|
|||||||
fromBig((*[4]uint64)(val), v)
|
fromBig((*[4]uint64)(val), v)
|
||||||
p256OrdReduce(val)
|
p256OrdReduce(val)
|
||||||
if ordElmToBigInt(val).Cmp(expected) != 0 {
|
if ordElmToBigInt(val).Cmp(expected) != 0 {
|
||||||
t.Errorf("p256OrdReduce failed for %x", v.Bytes())
|
t.Errorf("p256OrdReduce failed for %x, expected %x", v.Bytes(), expected.Bytes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,9 +75,12 @@ func TestP256OrderReduce(t *testing.T) {
|
|||||||
for i := 0; i < 20; i++ {
|
for i := 0; i < 20; i++ {
|
||||||
bigVal := big.NewInt(int64(i))
|
bigVal := big.NewInt(int64(i))
|
||||||
testP256OrderReduce(bigVal, bigVal, t)
|
testP256OrderReduce(bigVal, bigVal, t)
|
||||||
bigVal = new(big.Int).Sub(p, big.NewInt(int64(i)))
|
|
||||||
testP256OrderReduce(bigVal, bigVal, t)
|
|
||||||
bigVal = new(big.Int).Add(p, big.NewInt(int64(i)))
|
bigVal = new(big.Int).Add(p, big.NewInt(int64(i)))
|
||||||
testP256OrderReduce(bigVal, big.NewInt(int64(i)), t)
|
testP256OrderReduce(bigVal, big.NewInt(int64(i)), t)
|
||||||
}
|
}
|
||||||
|
testP256OrderReduce(p, big.NewInt(0), t)
|
||||||
|
for i := 1; i < 20; i++ {
|
||||||
|
bigVal := new(big.Int).Sub(p, big.NewInt(int64(i)))
|
||||||
|
testP256OrderReduce(bigVal, bigVal, t)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user