Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mldsa/internal/byteorder/byteorder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package byteorder

import "encoding/binary"

func LEPutUint16(b []byte, v uint16) {
binary.LittleEndian.PutUint16(b, v)
}
25 changes: 25 additions & 0 deletions mldsa/internal/constanttime/constant_time.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package constanttime

import "crypto/subtle"

// Select returns x if v == 1 and y if v == 0.
// Its behavior is undefined if v takes any other value.
func Select(v, x, y int) int {
return subtle.ConstantTimeSelect(v, x, y)
}

// ByteEq returns 1 if x == y and 0 otherwise.
func ByteEq(x, y uint8) int {
return subtle.ConstantTimeByteEq(x, y)
}

// Eq returns 1 if x == y and 0 otherwise.
func Eq(x, y int32) int {
return subtle.ConstantTimeEq(x, y)
}

// LessOrEq returns 1 if x <= y and 0 otherwise.
// Its behavior is undefined if x or y are negative or > 2**31 - 1.
func LessOrEq(x, y int) int {
return subtle.ConstantTimeLessOrEq(x, y)
}
5 changes: 5 additions & 0 deletions mldsa/internal/cryptotest/stubs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package cryptotest

import "testing"

func SkipTestAllocations(t *testing.T) {}
Loading
Loading