profile
viewpoint
Michael McLoughlin mmcloughlin @uber-atg San Francisco, CA https://mmcloughlin.com

mmcloughlin/globe 1504

Globe wireframe visualizations in Golang

mmcloughlin/avo 1336

Generate x86 Assembly with Go

mmcloughlin/geohash 334

Golang geohash library

mmcloughlin/addchain 90

Cryptographic Addition Chain Generation in Go

mmcloughlin/cryptofuzz 73

Fuzzing Go crypto

mmcloughlin/finsky 48

Google Play API for Python

mmcloughlin/geohashbench 10

Benchmarks to compare golang geohash implementations

mmcloughlin/databundler 9

Embed CSV data in a Golang package

mmcloughlin/garble 9

Randomize your data

mmcloughlin/cpudb 8

CPUID database derived from InstLatx64

startedcontainerd/containerd

started time in a day

startedCardsAgainstCryptography/CAC

started time in a day

startedjedisct1/zig-25519

started time in a day

pull request commentmmcloughlin/avo

Expose Instruction method on global context

Thanks for the contribution!

I should really get to work on AVX-512, but I hope this helps you hack around it for now 😬

lukechampine

comment created time in 9 days

push eventmmcloughlin/avo

Luke Champine

commit sha 443f81d771042b019379ae4bfcd0a591cb47c88a

build: expose Instruction method on global context (#155)

view details

push time in 9 days

PR merged mmcloughlin/avo

Expose Instruction method on global context

Full disclosure: my motivation here is to hack AVX-512 into my avo codegen by defining custom ir.Instructions... 😬

+4 -0

0 comment

1 changed file

lukechampine

pr closed time in 9 days

startedarminbiere/kissat

started time in 13 days

startedGaloisInc/what4

started time in 13 days

Pull request review commentcloudflare/circl

[WIP] signature API

+package api_test++import (+	"crypto"+	"fmt"+	"testing"++	"github.com/cloudflare/circl/sign"+	"github.com/cloudflare/circl/sign/api"+)++func TestApi(t *testing.T) {+	allSchemes := api.AllSchemes()+	for _, scheme := range allSchemes {

Consider subtests?

bwesterb

comment created time in 14 days

Pull request review commentcloudflare/circl

[WIP] signature API

+package ed25519

Nearly identical to the other signapi.go files (I know there are some differences). Is it generated? If so it needs a generated comment.

bwesterb

comment created time in 14 days

Pull request review commentcloudflare/circl

[WIP] signature API

+// Package sign provides unified interfaces for signature schemes.+package sign++import (+	"crypto"+	"encoding"+	"errors"+)++// SchemeID is an identifier of a signature scheme.+type SchemeID uint8++const (+	Ed25519 SchemeID = iota+	Ed448+	// EdDilithium3 is+	EdDilithium3+	// EdDilithium4 is+	EdDilithium4+	// SchemeCount is the number of supported signature algorithms.+	SchemeCount+)++type SignatureOpts struct {+	crypto.Hash+	// If non-empty, includes the given context in the signature if supported+	// and will cause an error during signing otherwise.+	Context string+}++// A public key is used to verify a signature set by the corresponding private+// key.+type PublicKey interface {+	// Returns the signature scheme for this public key.+	Scheme() Scheme+	Equal(crypto.PublicKey) bool+	encoding.BinaryMarshaler+	crypto.PublicKey+}++// A private key allows one to create signatures.+type PrivateKey interface {+	// Returns the signature scheme for this private key.+	Scheme() Scheme++	Equal(crypto.PrivateKey) bool+	// For compatibility with Go standard library+	crypto.Signer+	crypto.PrivateKey+	encoding.BinaryMarshaler+}++// A Scheme represents a specific instance of a signature scheme.+type Scheme interface {+	// Name of the scheme+	Name() string++	// ID of the scheme+	ID() SchemeID++	// GenerateKey creates a new key-pair.+	GenerateKey() (PublicKey, PrivateKey, error)++	// Creates a signature using the PrivateKey on the given message and+	// returns the signature. opts are additional options which can be nil.+	Sign(sk PrivateKey, message []byte, opts *SignatureOpts) []byte++	// Checks whether the given signature is a valid signature set by+	// the private key corresponding to the given public key on the+	// given message. opts are additional options which can be nil.+	Verify(pk PublicKey, message []byte, signature []byte, opts *SignatureOpts) bool++	// Deterministically derives a keypair from a seed.  If you're unsure,+	// you're better off using GenerateKey().+	//+	// Panics if seed is not of length SeedSize().+	DeriveKey(seed []byte) (PublicKey, PrivateKey)++	// Unmarshals a PublicKey from the provided buffer.+	UnmarshalBinaryPublicKey([]byte) (PublicKey, error)++	// Unmarshals a PublicKey from the provided buffer.+	UnmarshalBinaryPrivateKey([]byte) (PrivateKey, error)++	// Size of binary marshalled public keys+	PublicKeySize() int++	// Size of binary marshalled public keys+	PrivateKeySize() int++	// Size of signatures+	SignatureSize() int++	// Size of seeds+	SeedSize() int+}++var (+	// ErrType is

FYI, if you don't want to document these individually, I think the linter accepts just a comment on the entire var block.

bwesterb

comment created time in 14 days

Pull request review commentcloudflare/circl

[WIP] signature API

+// Package sign provides unified interfaces for signature schemes.+package sign++import (+	"crypto"+	"encoding"+	"errors"+)++// SchemeID is an identifier of a signature scheme.+type SchemeID uint8++const (+	Ed25519 SchemeID = iota+	Ed448+	// EdDilithium3 is+	EdDilithium3+	// EdDilithium4 is+	EdDilithium4+	// SchemeCount is the number of supported signature algorithms.+	SchemeCount+)++type SignatureOpts struct {+	crypto.Hash+	// If non-empty, includes the given context in the signature if supported+	// and will cause an error during signing otherwise.+	Context string+}++// A public key is used to verify a signature set by the corresponding private+// key.+type PublicKey interface {+	// Returns the signature scheme for this public key.+	Scheme() Scheme+	Equal(crypto.PublicKey) bool+	encoding.BinaryMarshaler+	crypto.PublicKey+}++// A private key allows one to create signatures.+type PrivateKey interface {+	// Returns the signature scheme for this private key.+	Scheme() Scheme++	Equal(crypto.PrivateKey) bool+	// For compatibility with Go standard library+	crypto.Signer+	crypto.PrivateKey+	encoding.BinaryMarshaler+}++// A Scheme represents a specific instance of a signature scheme.+type Scheme interface {+	// Name of the scheme+	Name() string++	// ID of the scheme+	ID() SchemeID++	// GenerateKey creates a new key-pair.+	GenerateKey() (PublicKey, PrivateKey, error)++	// Creates a signature using the PrivateKey on the given message and+	// returns the signature. opts are additional options which can be nil.+	Sign(sk PrivateKey, message []byte, opts *SignatureOpts) []byte++	// Checks whether the given signature is a valid signature set by+	// the private key corresponding to the given public key on the+	// given message. opts are additional options which can be nil.+	Verify(pk PublicKey, message []byte, signature []byte, opts *SignatureOpts) bool++	// Deterministically derives a keypair from a seed.  If you're unsure,+	// you're better off using GenerateKey().+	//+	// Panics if seed is not of length SeedSize().+	DeriveKey(seed []byte) (PublicKey, PrivateKey)++	// Unmarshals a PublicKey from the provided buffer.+	UnmarshalBinaryPublicKey([]byte) (PublicKey, error)++	// Unmarshals a PublicKey from the provided buffer.+	UnmarshalBinaryPrivateKey([]byte) (PrivateKey, error)++	// Size of binary marshalled public keys+	PublicKeySize() int++	// Size of binary marshalled public keys+	PrivateKeySize() int++	// Size of signatures+	SignatureSize() int++	// Size of seeds+	SeedSize() int+}++var (+	// ErrType is+	ErrType = errors.New("types mismatch")

nit: ErrTypeMismatch?

bwesterb

comment created time in 14 days

Pull request review commentcloudflare/circl

[WIP] signature API

+package ed25519++import (+	"crypto/rand"+	"encoding/asn1"++	"github.com/cloudflare/circl/sign"+)++// Scheme is+const Scheme = scheme(sign.Ed25519)++type scheme sign.SchemeID++func (scheme) ID() sign.SchemeID   { return sign.SchemeID(Scheme) }+func (scheme) Name() string        { return "Ed25519" }+func (scheme) PublicKeySize() int  { return PublicKeySize }+func (scheme) PrivateKeySize() int { return PrivateKeySize }+func (scheme) SignatureSize() int  { return SignatureSize }+func (scheme) SeedSize() int       { return SeedSize }+func (scheme) TLSIdentifier() uint { return 0x0807 }+func (scheme) Oid() asn1.ObjectIdentifier {+	return asn1.ObjectIdentifier{1, 3, 101, 112}+}++func (scheme) GenerateKey() (sign.PublicKey, sign.PrivateKey, error) {+	return GenerateKey(rand.Reader)+}++func (scheme) Sign(+	sk sign.PrivateKey,+	message []byte,+	opts *sign.SignatureOpts) []byte {

nit: my preference would be to use a trailing comma in multi-line signatures.

bwesterb

comment created time in 14 days

Pull request review commentcloudflare/circl

[WIP] signature API

 func TestMalleability(t *testing.T) { 	} } +func TestPublic(t *testing.T) {+	var zero zeroReader+	pub, priv, err := ed25519.GenerateKey(zero)+	if !priv.Equal(priv) {+		t.Fatal()+	}+	if !pub.Equal(pub) {+		t.Fatal()

Why no message with Fatal? If you intend to use no message, just use FailNow() directly.

https://golang.org/pkg/testing/#T.Fatal

bwesterb

comment created time in 14 days

Pull request review commentcloudflare/circl

[WIP] signature API

 func TestMalleability(t *testing.T) { 	} } +func TestPublic(t *testing.T) {+	var zero zeroReader+	pub, priv, err := ed25519.GenerateKey(zero)+	if !priv.Equal(priv) {+		t.Fatal()+	}+	if !pub.Equal(pub) {+		t.Fatal()+	}+	if err != nil {

Why is the error check not the first assertion?

bwesterb

comment created time in 14 days

Pull request review commentcloudflare/circl

[WIP] signature API

+package pki_test++import (+	"testing"++	"github.com/cloudflare/circl/pki"+	"github.com/cloudflare/circl/sign/api"+)++func TestPEM(t *testing.T) {+	for _, scheme := range api.AllSchemes() {

This seems like an appropriate use for subtests.

func TestPEM(t *testing.T) {
	for _, scheme := range api.AllSchemes() {
		t.Run(scheme.Name(), func(t *testing.T) {
			// ...
		}
	}
}
bwesterb

comment created time in 14 days

Pull request review commentcloudflare/circl

[WIP] signature API

+package pki++import (+	"crypto/x509/pkix"+	"encoding/asn1"+	"encoding/pem"+	"errors"+	"fmt"++	"github.com/cloudflare/circl/sign"+	"github.com/cloudflare/circl/sign/api"+)++var allSchemesByOID map[string]sign.Scheme+var allSchemesByTLS map[uint]sign.Scheme++func init() {+	allSchemesByOID = make(map[string]sign.Scheme)+	for _, scheme := range api.AllSchemes() {

If a package has imports, the imported packages are initialized before initializing the package itself.

https://golang.org/ref/spec#Package_initialization

bwesterb

comment created time in 14 days

issue commentmmcloughlin/avo

Fails to build under architectures other than amd64

@rogers0 Thanks for reaching out. As @dgryski says we may be able to fix this with build tags, however I also wonder if it's possible for you to simply not build avo for those other architectures?

The purpose of avo is a developer tool to assist with code generation for amd64 platforms. I guess someone might work on a different architecture and write assembly for amd64, but that's likely not the common use case.

Ticket https://bugs.debian.org/965065 mentions that avo is required because it's a circl dependency. Not sure if it makes a difference, but avo is a developer dependency for circl, not a runtime dependency. I actually worked with them to ensure that avo did not appear in their main go.mod. Instead, avo only appears in the go.mod files for their keccak and dilithium assembly generators.

https://github.com/cloudflare/circl/blob/d004263612c5ecc3f650012406c253276fb78585/simd/keccakf1600/internal/asm/go.mod https://github.com/cloudflare/circl/tree/b8e907cafa61319bb0cbb3987cb5ace52c9c25a4/sign/dilithium/internal/common/asm

If it's still important for avo to build on those other platforms, let me know and I'll see what I can do.

rogers0

comment created time in 18 days

startedholiman/uint256

started time in 19 days

startedbitdefender/bddisasm

started time in 20 days

starteddgryski/awesome-go-style

started time in 21 days

startedtidwall/pkg.sh

started time in 24 days

Pull request review commentcloudflare/circl

Make ed448 compatible with new ed25519 API

 jobs:     runs-on: ubuntu-18.04     strategy:       matrix:-        GOVER: ['1.14', '1.13', '1.12']+        GOVER: ['1.14', '1.13']

Go support policy is the last two major releases, so I tend to think it's reasonable for libraries to follow the same rules.

https://golang.org/doc/devel/release.html#policy

As far as I am concerned Debian/Ubuntu are too far behind, and library authors should not have to accommodate them. People should be installing Go some other way on those platforms.

armfazh

comment created time in a month

startedcontainerd/cgroups

started time in a month

startedfacebookresearch/Private-ID

started time in a month

startedcirct/circt

started time in a month

startedbifurcation/mint

started time in a month

startedFStarLang/FStar

started time in a month

startedtidwall/hashmap.c

started time in a month

startedtidwall/btree.c

started time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"

Regardless of collisions, there is an argument for using cryptorand alias anyway, to avoid any accidental use of math/rand instead of crypto/rand.

This always makes me nervous... if you call rand.Read(...) then goimports could give you the wrong one, and you have to double-check it did the right thing.

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"+	"errors"+	"io"++	"github.com/cloudflare/circl/internal/shake"+	"github.com/cloudflare/circl/sign/dilithium/mode3"+	"github.com/cloudflare/circl/sign/ed25519"+)++const (+	// Size of seed for NewKeyFromSeed+	SeedSize = mode3.SeedSize // = ed25519.SeedSize = 32++	// Size of a packed PublicKey+	PublicKeySize = mode3.PublicKeySize + ed25519.PublicKeySize++	// Size of a packed PrivateKey+	PrivateKeySize = mode3.PrivateKeySize + ed25519.PrivateKeySize++	// Size of a signature+	SignatureSize = mode3.SignatureSize + ed25519.SignatureSize+)++// PublicKey is the type of an EdDilithium3 public key.+type PublicKey struct {+	e ed25519.PublicKey+	d mode3.PublicKey+}++// PrivateKey is the type of an EdDilithium3 private key.+type PrivateKey struct {+	e ed25519.KeyPair+	d mode3.PrivateKey+}++// GenerateKey generates a public/private key pair using entropy from rand.+// If rand is nil, crypto/rand.Reader will be used.+func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error) {+	var seed [SeedSize]byte+	if rand == nil {+		rand = cryptoRand.Reader+	}+	_, err := io.ReadFull(rand, seed[:])+	if err != nil {+		return nil, nil, err+	}++	pk, sk := NewKeyFromSeed(&seed)+	return pk, sk, nil+}++// NewKeyFromSeed derives a public/private key pair using the given seed.+func NewKeyFromSeed(seed *[SeedSize]byte) (*PublicKey, *PrivateKey) {+	var seed1 [32]byte+	var seed2 [32]byte++	h := shake.NewShake256()+	_, _ = h.Write(seed[:])+	_, _ = h.Read(seed1[:])+	_, _ = h.Read(seed2[:])+	dpk, dsk := mode3.NewKeyFromSeed(&seed1)+	epair := ed25519.NewKeyFromSeed(seed2[:])++	return &PublicKey{epair.GetPublic(), *dpk}, &PrivateKey{*epair, *dsk}+}++// SignTo signs the given message and writes the signature into signature.+// It will panic if signature is not of length at least SignatureSize.+func SignTo(sk *PrivateKey, msg []byte, signature []byte) {+	mode3.SignTo(+		&sk.d,+		msg,+		signature[:mode3.SignatureSize],+	)+	esig, _ := sk.e.SignPure(+		msg,+	)+	copy(signature[mode3.SignatureSize:], esig[:])+}++// Verify checks whether the given signature by pk on msg is valid.+func Verify(pk *PublicKey, msg []byte, signature []byte) bool {+	if !mode3.Verify(+		&pk.d,+		msg,+		signature[:mode3.SignatureSize],+	) {+		return false+	}+	if !ed25519.Verify(+		pk.e,+		msg,+		signature[mode3.SignatureSize:],+	) {+		return false+	}+	return true+}++// Unpack unpacks pk to the public key encoded in buf.

In the other example, at least write is actually a different word :joy:

Anyway, the suggested edit I made is what I do in this annoying situation. I'll leave it up to you now, I don't want to bother you endlessly with small comments.

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"+	"errors"+	"io"++	"github.com/cloudflare/circl/internal/shake"+	"github.com/cloudflare/circl/sign/dilithium/mode3"+	"github.com/cloudflare/circl/sign/ed25519"+)++const (+	// Size of seed for NewKeyFromSeed+	SeedSize = mode3.SeedSize // = ed25519.SeedSize = 32++	// Size of a packed PublicKey+	PublicKeySize = mode3.PublicKeySize + ed25519.PublicKeySize++	// Size of a packed PrivateKey+	PrivateKeySize = mode3.PrivateKeySize + ed25519.PrivateKeySize++	// Size of a signature+	SignatureSize = mode3.SignatureSize + ed25519.SignatureSize+)++// PublicKey is the type of an EdDilithium3 public key.+type PublicKey struct {+	e ed25519.PublicKey+	d mode3.PublicKey+}++// PrivateKey is the type of an EdDilithium3 private key.+type PrivateKey struct {+	e ed25519.KeyPair+	d mode3.PrivateKey+}++// GenerateKey generates a public/private key pair using entropy from rand.+// If rand is nil, crypto/rand.Reader will be used.+func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error) {+	var seed [SeedSize]byte+	if rand == nil {+		rand = cryptoRand.Reader+	}+	_, err := io.ReadFull(rand, seed[:])+	if err != nil {+		return nil, nil, err+	}++	pk, sk := NewKeyFromSeed(&seed)+	return pk, sk, nil+}++// NewKeyFromSeed derives a public/private key pair using the given seed.+func NewKeyFromSeed(seed *[SeedSize]byte) (*PublicKey, *PrivateKey) {+	var seed1 [32]byte+	var seed2 [32]byte++	h := shake.NewShake256()+	_, _ = h.Write(seed[:])+	_, _ = h.Read(seed1[:])+	_, _ = h.Read(seed2[:])+	dpk, dsk := mode3.NewKeyFromSeed(&seed1)+	epair := ed25519.NewKeyFromSeed(seed2[:])++	return &PublicKey{epair.GetPublic(), *dpk}, &PrivateKey{*epair, *dsk}+}++// SignTo signs the given message and writes the signature into signature.+// It will panic if signature is not of length at least SignatureSize.+func SignTo(sk *PrivateKey, msg []byte, signature []byte) {+	mode3.SignTo(+		&sk.d,+		msg,+		signature[:mode3.SignatureSize],+	)+	esig, _ := sk.e.SignPure(+		msg,+	)+	copy(signature[mode3.SignatureSize:], esig[:])+}++// Verify checks whether the given signature by pk on msg is valid.+func Verify(pk *PublicKey, msg []byte, signature []byte) bool {+	if !mode3.Verify(+		&pk.d,+		msg,+		signature[:mode3.SignatureSize],+	) {+		return false+	}+	if !ed25519.Verify(+		pk.e,+		msg,+		signature[mode3.SignatureSize:],+	) {+		return false+	}+	return true+}++// Unpack unpacks pk to the public key encoded in buf.

First word has to be Unpack, and it just doesn't read well to use unpack twice.

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"+	"errors"+	"io"++	"github.com/cloudflare/circl/internal/shake"+	"github.com/cloudflare/circl/sign/dilithium/mode3"+	"github.com/cloudflare/circl/sign/ed25519"+)++const (+	// Size of seed for NewKeyFromSeed+	SeedSize = mode3.SeedSize // = ed25519.SeedSize = 32++	// Size of a packed PublicKey+	PublicKeySize = mode3.PublicKeySize + ed25519.PublicKeySize++	// Size of a packed PrivateKey+	PrivateKeySize = mode3.PrivateKeySize + ed25519.PrivateKeySize++	// Size of a signature+	SignatureSize = mode3.SignatureSize + ed25519.SignatureSize+)++// PublicKey is the type of an EdDilithium3 public key.+type PublicKey struct {+	e ed25519.PublicKey+	d mode3.PublicKey+}++// PrivateKey is the type of an EdDilithium3 private key.+type PrivateKey struct {+	e ed25519.KeyPair+	d mode3.PrivateKey+}++// GenerateKey generates a public/private key pair using entropy from rand.+// If rand is nil, crypto/rand.Reader will be used.+func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error) {+	var seed [SeedSize]byte+	if rand == nil {+		rand = cryptoRand.Reader+	}+	_, err := io.ReadFull(rand, seed[:])+	if err != nil {+		return nil, nil, err+	}++	pk, sk := NewKeyFromSeed(&seed)+	return pk, sk, nil+}++// NewKeyFromSeed derives a public/private key pair using the given seed.+func NewKeyFromSeed(seed *[SeedSize]byte) (*PublicKey, *PrivateKey) {+	var seed1 [32]byte+	var seed2 [32]byte++	h := shake.NewShake256()+	_, _ = h.Write(seed[:])+	_, _ = h.Read(seed1[:])+	_, _ = h.Read(seed2[:])+	dpk, dsk := mode3.NewKeyFromSeed(&seed1)+	epair := ed25519.NewKeyFromSeed(seed2[:])++	return &PublicKey{epair.GetPublic(), *dpk}, &PrivateKey{*epair, *dsk}+}++// SignTo signs the given message and writes the signature into signature.+// It will panic if signature is not of length at least SignatureSize.+func SignTo(sk *PrivateKey, msg []byte, signature []byte) {+	mode3.SignTo(+		&sk.d,+		msg,+		signature[:mode3.SignatureSize],+	)+	esig, _ := sk.e.SignPure(+		msg,+	)+	copy(signature[mode3.SignatureSize:], esig[:])+}++// Verify checks whether the given signature by pk on msg is valid.+func Verify(pk *PublicKey, msg []byte, signature []byte) bool {+	if !mode3.Verify(+		&pk.d,+		msg,+		signature[:mode3.SignatureSize],+	) {+		return false+	}+	if !ed25519.Verify(+		pk.e,+		msg,+		signature[mode3.SignatureSize:],+	) {+		return false+	}+	return true+}++// Unpack unpacks pk to the public key encoded in buf.+func (pk *PublicKey) Unpack(buf *[PublicKeySize]byte) {+	var tmp [mode3.PublicKeySize]byte+	copy(tmp[:], buf[:mode3.PublicKeySize])+	pk.d.Unpack(&tmp)+	pk.e = make([]byte, ed25519.PublicKeySize)+	copy(pk.e, buf[mode3.PublicKeySize:])+}++// Unpack sets sk to the private key encoded in buf.+func (sk *PrivateKey) Unpack(buf *[PrivateKeySize]byte) {+	var tmp [mode3.PrivateKeySize]byte+	copy(tmp[:], buf[:mode3.PrivateKeySize])+	sk.d.Unpack(&tmp)+	sk.e = *ed25519.NewKeyFromSeed(buf[mode3.PrivateKeySize:])+}++// Pack packs the public key into buf.
// Pack the public key into buf.
bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"+	"errors"+	"io"++	"github.com/cloudflare/circl/internal/shake"+	"github.com/cloudflare/circl/sign/dilithium/mode3"+	"github.com/cloudflare/circl/sign/ed25519"+)++const (+	// Size of seed for NewKeyFromSeed+	SeedSize = mode3.SeedSize // = ed25519.SeedSize = 32++	// Size of a packed PublicKey+	PublicKeySize = mode3.PublicKeySize + ed25519.PublicKeySize++	// Size of a packed PrivateKey+	PrivateKeySize = mode3.PrivateKeySize + ed25519.PrivateKeySize++	// Size of a signature+	SignatureSize = mode3.SignatureSize + ed25519.SignatureSize+)++// PublicKey is the type of an EdDilithium3 public key.+type PublicKey struct {+	e ed25519.PublicKey+	d mode3.PublicKey+}++// PrivateKey is the type of an EdDilithium3 private key.+type PrivateKey struct {+	e ed25519.KeyPair+	d mode3.PrivateKey+}++// GenerateKey generates a public/private key pair using entropy from rand.+// If rand is nil, crypto/rand.Reader will be used.+func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error) {+	var seed [SeedSize]byte+	if rand == nil {+		rand = cryptoRand.Reader+	}+	_, err := io.ReadFull(rand, seed[:])+	if err != nil {+		return nil, nil, err+	}++	pk, sk := NewKeyFromSeed(&seed)+	return pk, sk, nil+}++// NewKeyFromSeed derives a public/private key pair using the given seed.+func NewKeyFromSeed(seed *[SeedSize]byte) (*PublicKey, *PrivateKey) {+	var seed1 [32]byte+	var seed2 [32]byte++	h := shake.NewShake256()+	_, _ = h.Write(seed[:])+	_, _ = h.Read(seed1[:])+	_, _ = h.Read(seed2[:])+	dpk, dsk := mode3.NewKeyFromSeed(&seed1)+	epair := ed25519.NewKeyFromSeed(seed2[:])++	return &PublicKey{epair.GetPublic(), *dpk}, &PrivateKey{*epair, *dsk}+}++// SignTo signs the given message and writes the signature into signature.+// It will panic if signature is not of length at least SignatureSize.+func SignTo(sk *PrivateKey, msg []byte, signature []byte) {+	mode3.SignTo(+		&sk.d,+		msg,+		signature[:mode3.SignatureSize],+	)+	esig, _ := sk.e.SignPure(+		msg,+	)+	copy(signature[mode3.SignatureSize:], esig[:])+}++// Verify checks whether the given signature by pk on msg is valid.+func Verify(pk *PublicKey, msg []byte, signature []byte) bool {+	if !mode3.Verify(+		&pk.d,+		msg,+		signature[:mode3.SignatureSize],+	) {+		return false+	}+	if !ed25519.Verify(+		pk.e,+		msg,+		signature[mode3.SignatureSize:],+	) {+		return false+	}+	return true+}++// Unpack unpacks pk to the public key encoded in buf.+func (pk *PublicKey) Unpack(buf *[PublicKeySize]byte) {+	var tmp [mode3.PublicKeySize]byte+	copy(tmp[:], buf[:mode3.PublicKeySize])+	pk.d.Unpack(&tmp)+	pk.e = make([]byte, ed25519.PublicKeySize)+	copy(pk.e, buf[mode3.PublicKeySize:])+}++// Unpack sets sk to the private key encoded in buf.+func (sk *PrivateKey) Unpack(buf *[PrivateKeySize]byte) {+	var tmp [mode3.PrivateKeySize]byte+	copy(tmp[:], buf[:mode3.PrivateKeySize])+	sk.d.Unpack(&tmp)+	sk.e = *ed25519.NewKeyFromSeed(buf[mode3.PrivateKeySize:])+}++// Pack packs the public key into buf.+func (pk *PublicKey) Pack(buf *[PublicKeySize]byte) {+	var tmp [mode3.PublicKeySize]byte+	pk.d.Pack(&tmp)+	copy(buf[:mode3.PublicKeySize], tmp[:])+	copy(buf[mode3.PublicKeySize:], pk.e)+}++// Pack packs the private key into buf.
// Pack the private key into buf.
bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"+	"errors"+	"io"++	"github.com/cloudflare/circl/internal/shake"+	"github.com/cloudflare/circl/sign/dilithium/mode3"+	"github.com/cloudflare/circl/sign/ed25519"+)++const (+	// Size of seed for NewKeyFromSeed+	SeedSize = mode3.SeedSize // = ed25519.SeedSize = 32++	// Size of a packed PublicKey+	PublicKeySize = mode3.PublicKeySize + ed25519.PublicKeySize++	// Size of a packed PrivateKey+	PrivateKeySize = mode3.PrivateKeySize + ed25519.PrivateKeySize++	// Size of a signature+	SignatureSize = mode3.SignatureSize + ed25519.SignatureSize+)++// PublicKey is the type of an EdDilithium3 public key.+type PublicKey struct {+	e ed25519.PublicKey+	d mode3.PublicKey+}++// PrivateKey is the type of an EdDilithium3 private key.+type PrivateKey struct {+	e ed25519.KeyPair+	d mode3.PrivateKey+}++// GenerateKey generates a public/private key pair using entropy from rand.+// If rand is nil, crypto/rand.Reader will be used.+func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error) {+	var seed [SeedSize]byte+	if rand == nil {+		rand = cryptoRand.Reader+	}+	_, err := io.ReadFull(rand, seed[:])+	if err != nil {+		return nil, nil, err+	}++	pk, sk := NewKeyFromSeed(&seed)+	return pk, sk, nil+}++// NewKeyFromSeed derives a public/private key pair using the given seed.+func NewKeyFromSeed(seed *[SeedSize]byte) (*PublicKey, *PrivateKey) {+	var seed1 [32]byte+	var seed2 [32]byte++	h := shake.NewShake256()+	_, _ = h.Write(seed[:])+	_, _ = h.Read(seed1[:])+	_, _ = h.Read(seed2[:])+	dpk, dsk := mode3.NewKeyFromSeed(&seed1)+	epair := ed25519.NewKeyFromSeed(seed2[:])++	return &PublicKey{epair.GetPublic(), *dpk}, &PrivateKey{*epair, *dsk}+}++// SignTo signs the given message and writes the signature into signature.+// It will panic if signature is not of length at least SignatureSize.+func SignTo(sk *PrivateKey, msg []byte, signature []byte) {+	mode3.SignTo(+		&sk.d,+		msg,+		signature[:mode3.SignatureSize],+	)+	esig, _ := sk.e.SignPure(+		msg,+	)+	copy(signature[mode3.SignatureSize:], esig[:])+}++// Verify checks whether the given signature by pk on msg is valid.+func Verify(pk *PublicKey, msg []byte, signature []byte) bool {+	if !mode3.Verify(+		&pk.d,+		msg,+		signature[:mode3.SignatureSize],+	) {+		return false+	}+	if !ed25519.Verify(+		pk.e,+		msg,+		signature[mode3.SignatureSize:],+	) {+		return false+	}+	return true+}++// Unpack unpacks pk to the public key encoded in buf.
// Unpack pk to the public key encoded in buf.
bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"

https://github.com/golang/go/blob/dd150176c3cc49da68c8179f740eadc79404d351/src/crypto/ed25519/ed25519.go#L22

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"

Just to be clear, I think the package alias is good, I'm just suggesting cryptorand not cryptoRand.

Yes, looks like it is done the same way in ed25519 and ed448. I would make the same comment for those occurrences.

bwesterb

comment created time in a month

startedbitwiseshiftleft/ladder_formulas

started time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// Code generated from mode.templ.go. DO NOT EDIT.++package dilithium++import (+	"errors"+	"fmt"+	"io"++	"github.com/cloudflare/circl/sign/dilithium/internal/common"+	"github.com/cloudflare/circl/sign/eddilithium3"+)++// implEdMode3 implements the mode.Mode interface for EdDilithium3.+type implEdMode3 struct{}

Got it. Yeah not a huge deal, I just don't like my Go looking like Java 😝

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"+	"errors"+	"io"++	"github.com/cloudflare/circl/internal/shake"+	"github.com/cloudflare/circl/sign/dilithium/mode3"+	"github.com/cloudflare/circl/sign/ed25519"+)++const (+	// Size of seed for NewKeyFromSeed+	SeedSize = mode3.SeedSize // = ed25519.SeedSize = 32++	// Size of a packed PublicKey+	PublicKeySize = mode3.PublicKeySize + ed25519.PublicKeySize++	// Size of a packed PrivateKey+	PrivateKeySize = mode3.PrivateKeySize + ed25519.PrivateKeySize++	// Size of a signature+	SignatureSize = mode3.SignatureSize + ed25519.SignatureSize+)++// PublicKey is the type of an EdDilithium3 public key.+type PublicKey struct {+	e ed25519.PublicKey+	d mode3.PublicKey+}++// PrivateKey is the type of an EdDilithium3 private key.+type PrivateKey struct {+	e ed25519.KeyPair+	d mode3.PrivateKey+}++// GenerateKey generates a public/private key pair using entropy from rand.+// If rand is nil, crypto/rand.Reader will be used.+func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error) {+	var seed [SeedSize]byte+	if rand == nil {+		rand = cryptoRand.Reader+	}+	_, err := io.ReadFull(rand, seed[:])+	if err != nil {+		return nil, nil, err+	}++	pk, sk := NewKeyFromSeed(&seed)+	return pk, sk, nil+}++// NewKeyFromSeed derives a public/private key pair using the given seed.+func NewKeyFromSeed(seed *[SeedSize]byte) (*PublicKey, *PrivateKey) {+	var seed1 [32]byte+	var seed2 [32]byte++	h := shake.NewShake256()+	_, _ = h.Write(seed[:])+	_, _ = h.Read(seed1[:])+	_, _ = h.Read(seed2[:])+	dpk, dsk := mode3.NewKeyFromSeed(&seed1)+	epair := ed25519.NewKeyFromSeed(seed2[:])++	return &PublicKey{epair.GetPublic(), *dpk}, &PrivateKey{*epair, *dsk}+}++// SignTo signs the given message and writes the signature into signature.+// It will panic if signature is not of length at least SignatureSize.+func SignTo(sk *PrivateKey, msg []byte, signature []byte) {+	mode3.SignTo(+		&sk.d,+		msg,+		signature[:mode3.SignatureSize],+	)+	esig, _ := sk.e.SignPure(+		msg,+	)+	copy(signature[mode3.SignatureSize:], esig[:])+}++// Verify checks whether the given signature by pk on msg is valid.+func Verify(pk *PublicKey, msg []byte, signature []byte) bool {+	if !mode3.Verify(+		&pk.d,+		msg,+		signature[:mode3.SignatureSize],+	) {+		return false+	}+	if !ed25519.Verify(+		pk.e,+		msg,+		signature[mode3.SignatureSize:],+	) {+		return false+	}+	return true+}++// Sets pk to the public key encoded in buf.

Doesn't conform to the "Comment Sentences" guideline:

https://github.com/golang/go/wiki/CodeReviewComments#comment-sentences

This applies to other comments in this file.

Would have expected a lint failure for this.

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"

nit: cryptorand

They are lower case, with no under_scores or mixedCaps

https://blog.golang.org/package-names

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// eddilithium3 implements the hybrid signature scheme Ed25519-Dilithium3.+package eddilithium3++import (+	"crypto"+	cryptoRand "crypto/rand"+	"errors"+	"io"++	"github.com/cloudflare/circl/internal/shake"+	"github.com/cloudflare/circl/sign/dilithium/mode3"+	"github.com/cloudflare/circl/sign/ed25519"+)++const (+	// Size of seed for NewKeyFromSeed+	SeedSize = mode3.SeedSize // = ed25519.SeedSize = 32++	// Size of a packed PublicKey+	PublicKeySize = mode3.PublicKeySize + ed25519.PublicKeySize++	// Size of a packed PrivateKey+	PrivateKeySize = mode3.PrivateKeySize + ed25519.PrivateKeySize++	// Size of a signature+	SignatureSize = mode3.SignatureSize + ed25519.SignatureSize+)++// PublicKey is the type of an EdDilithium3 public key.+type PublicKey struct {+	e ed25519.PublicKey+	d mode3.PublicKey+}++// PrivateKey is the type of an EdDilithium3 private key.+type PrivateKey struct {+	e ed25519.KeyPair+	d mode3.PrivateKey+}++// GenerateKey generates a public/private key pair using entropy from rand.+// If rand is nil, crypto/rand.Reader will be used.+func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error) {+	var seed [SeedSize]byte+	if rand == nil {+		rand = cryptoRand.Reader+	}+	_, err := io.ReadFull(rand, seed[:])+	if err != nil {+		return nil, nil, err+	}++	pk, sk := NewKeyFromSeed(&seed)+	return pk, sk, nil+}++// NewKeyFromSeed derives a public/private key pair using the given seed.+func NewKeyFromSeed(seed *[SeedSize]byte) (*PublicKey, *PrivateKey) {+	var seed1 [32]byte+	var seed2 [32]byte++	h := shake.NewShake256()+	_, _ = h.Write(seed[:])+	_, _ = h.Read(seed1[:])+	_, _ = h.Read(seed2[:])+	dpk, dsk := mode3.NewKeyFromSeed(&seed1)+	epair := ed25519.NewKeyFromSeed(seed2[:])++	return &PublicKey{epair.GetPublic(), *dpk}, &PrivateKey{*epair, *dsk}+}++// SignTo signs the given message and writes the signature into signature.+// It will panic if signature is not of length at least SignatureSize.+func SignTo(sk *PrivateKey, msg []byte, signature []byte) {+	mode3.SignTo(+		&sk.d,+		msg,+		signature[:mode3.SignatureSize],+	)+	esig, _ := sk.e.SignPure(+		msg,+	)+	copy(signature[mode3.SignatureSize:], esig[:])+}++// Verify checks whether the given signature by pk on msg is valid.+func Verify(pk *PublicKey, msg []byte, signature []byte) bool {+	if !mode3.Verify(+		&pk.d,+		msg,+		signature[:mode3.SignatureSize],+	) {+		return false+	}+	if !ed25519.Verify(+		pk.e,+		msg,+		signature[mode3.SignatureSize:],+	) {+		return false+	}

Yep, I was going to suggest using subtle, as @chris-wood recommends.

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// Code generated from mode.templ.go. DO NOT EDIT.++package dilithium++import (+	"errors"+	"fmt"+	"io"++	"github.com/cloudflare/circl/sign/dilithium/internal/common"+	"github.com/cloudflare/circl/sign/eddilithium3"+)++// implEdMode3 implements the mode.Mode interface for EdDilithium3.+type implEdMode3 struct{}++// EdMode3 is Dilithium in mode "EdDilithium3".+var EdMode3 Mode = &implEdMode3{}++func (m *implEdMode3) GenerateKey(rand io.Reader) (PublicKey,+	PrivateKey, error) {+	return eddilithium3.GenerateKey(rand)+}++func (m *implEdMode3) NewKeyFromExpandedSeed(seed *[96]byte) (PublicKey,+	PrivateKey) {+	panic("Not supported for hybrid modes")+}++func (m *implEdMode3) NewKeyFromSeed(seed []byte) (PublicKey,+	PrivateKey) {+	if len(seed) != common.SeedSize {+		panic(fmt.Sprintf("seed must be of length %d", common.SeedSize))

fmt.Errorf?

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

 func (m *{{ .Impl }}) GenerateKey(rand io.Reader) (PublicKey,  func (m *{{ .Impl }}) NewKeyFromExpandedSeed(seed *[96]byte) (PublicKey, 	PrivateKey) {+{{- if  .Hybrid }}+	panic("Not supported for hybrid modes")

nit: lowercase error messages

https://github.com/golang/go/wiki/CodeReviewComments#error-strings

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// Code generated from mode.templ.go. DO NOT EDIT.++package dilithium++import (+	"errors"+	"fmt"+	"io"++	"github.com/cloudflare/circl/sign/dilithium/internal/common"+	"github.com/cloudflare/circl/sign/eddilithium3"+)++// implEdMode3 implements the mode.Mode interface for EdDilithium3.+type implEdMode3 struct{}

nit: not the biggest fan of impl in type names. In a case like this I would usually just call this edMode3

bwesterb

comment created time in a month

Pull request review commentcloudflare/circl

eddilithium3: add hybrid of Dilithium3 and Ed25519

+// Code generated from mode.templ.go. DO NOT EDIT.++package dilithium++import (+	"errors"+	"fmt"+	"io"++	"github.com/cloudflare/circl/sign/dilithium/internal/common"+	"github.com/cloudflare/circl/sign/eddilithium3"+)++// implEdMode3 implements the mode.Mode interface for EdDilithium3.+type implEdMode3 struct{}++// EdMode3 is Dilithium in mode "EdDilithium3".+var EdMode3 Mode = &implEdMode3{}++func (m *implEdMode3) GenerateKey(rand io.Reader) (PublicKey,+	PrivateKey, error) {

nit: unusual line break

bwesterb

comment created time in a month

startedzionlang/zion

started time in a month

startedabenkhadra/bcov

started time in a month

startedmarxin/cvise

started time in a month

issue commentgoogle/benchmark

Custom context fields

Since posting this issue two years ago I now have additional use cases for it. Adding software version information is still useful, but I'd also like to be able to query more information about system and process configuration, for example:

  • What is CPU frequency set to?
  • What is the scaling governor set to
  • Is intel turbo enabled?
  • CPU affinity of the process (how many cores does it have?)
  • Process priority (nice or rt priority)
  • ...

Essentially I'd like to be able to augment the existing context with various other fields read from sysfs/procfs.

@dominichamon For this use case the benchmark::AddContext API from option 2 would be ideal. The CLI flag would still be useful for metadata like software version etc.

mmcloughlin

comment created time in a month

startedFiloSottile/yubikey-agent

started time in 2 months

startedbacdor-factory/go-ldpreload-backdoor

started time in 2 months

startedmortendahl/rust-paillier

started time in 2 months

startedeurecom-s3/symcc

started time in 2 months

startedGaloisInc/macaw

started time in 2 months

startedfelixge/fgprof

started time in 2 months

startedsupranational/blst

started time in 2 months

startedsujankh/experiments

started time in 2 months

startedvtil-project/VTIL-Core

started time in 2 months

startedConsenSys/gurvy

started time in 2 months

startedConsenSys/bavard

started time in 2 months

startedbristolgolang/machinelearning

started time in 2 months

startedgoogle/clusterfuzz

started time in 2 months

issue closedmmcloughlin/geohash

New Release? (0.10.0 or 1.0.0)

Good morning,

I was wondering if you could cut a new release?

Thank you so much for your time.

Ben

closed time in 2 months

benlong-transloc

issue commentmmcloughlin/geohash

New Release? (0.10.0 or 1.0.0)

Yes of course, I just pushed a v0.10.0 tag.

benlong-transloc

comment created time in 2 months

created tagmmcloughlin/geohash

tagv0.10.0

Golang geohash library

created time in 2 months

startedllvm/llvm-lnt

started time in 2 months

startedllvm/llvm-test-suite

started time in 2 months

startedkilic/bn254

started time in 2 months

startedpacedotdev/oto

started time in 2 months

startedgolang/pkgsite

started time in 2 months

startedbradfitz/lesser

started time in 2 months

issue commentuber-go/tally

instrument: deferrable API

Hey @mway!

I have a PR out for an instrument package at Uber ATG with an API similar to my proposal here. The exact API is still under debate. That said, this is an extremely common use case, so I think it's reasonable for tally to have an instrument package (and for the redesign to have one too). Just my 2 cents.

I'm not sure I agree the comparison with errgroup is reasonable. I'm not against function arguments in APIs in general, I'd just claim it's awkward in the instrument use case. In particular, the errgroup API is natural since it's nearly a drop-in replacement for sync.WaitGroup. In these use cases you would likely have a construct like go func() { ... }() anyway, so changing it to g.Go(func() error { ... }) doesn't impose any extra burden. In contrast, the current call.Exec(...) API forces you introduce an extra anonymous function where you didn't have one before. I believe some deferrable API would be less invasive.

mmcloughlin

comment created time in 2 months

issue openeduber-go/tally

instrument: deferrable API

I have found that using the callback-based API provided by instrument can be awkward, especially when the function being instrumented returns a value other than an error. It either forces the body of the function to be indented one more level, or you have to put the function body in a second function called from the instrument callback. When the instrumented function returns some value, you have to do some delicate gymnastics to ensure the return value is assigned to a variable in the closure.

I propose adding a deferrable API to the instrument package, so it could be used something like:

func (s *Struct) Method() (_ *Result, err error) {
	defer instrument.Function(s.scope, "method", &err)()
	// ...
}

This has the benefit that the instrumented function is minimally altered, besides the defer line and the named err return. I'm not sure instrument.Function is a good name, that's up for debate.

I'd be happy to prepare a PR if you think this is a good idea.

created time in 2 months

startedcloudflare/utahfs

started time in 2 months

starteduber/neuropod

started time in 2 months

pull request commentcloudflare/circl

Make f1600x4 public

I'm likely missing context from your team discussions, but I'm wondering why this package is being made public? My feeling is:

  • If it's a public package, it should have a generic fallback, regardless of how slow that is. It can be documented that you probably don't want to use it without amd64+avx2, but it's very unfriendly if the package crashes without it.
  • If it's an internal package, code that works on avx2 only is completely fine.

Generic implementation can also be useful for differential testing #4.

Relevant: #28 https://github.com/golang/go/wiki/TargetSpecific

bwesterb

comment created time in 2 months

pull request commentcloudflare/circl

Make f1600x4 public

I also wonder if it's better to name this package keccakf1600, and then the types/functions in the package have X4 on them?

Suppose there were x1, x2, x8 variants too... would you expect them to be in the same or different packages?

bwesterb

comment created time in 2 months

Pull request review commentcloudflare/circl

Make f1600x4 public

 package internal  import (+	"github.com/cloudflare/circl/hash/f1600x4"

I'd agree with @armfazh here. Ideally there's a generic implementation, doesn't have to be fast, but it works. If not, guard the entire package with amd64 build tags, so it's literally impossible to build against this package on other platforms.

bwesterb

comment created time in 2 months

startedIBM/fhe-toolkit-macos

started time in 2 months

startedcarlini/printf-tac-toe

started time in 2 months

startedCEA-LIST/Cingulata

started time in 2 months

push eventmmcloughlin/addchain

Michael McLoughlin

commit sha 0f719b9ccad849920ce6428a5d210736137be0f4

acc/ir: restore Clone methods Restores code removed in 8a9a61f6e70f11e8b07616045d64986ec41a35ab.

view details

push time in 2 months

push eventmmcloughlin/addchain

Michael McLoughlin

commit sha 1043392a227e6543cff73fcf0414cbcb0dd21691

add: String convenience function Restore function removed in 8a9a61f6e70f11e8b07616045d64986ec41a35ab.

view details

push time in 2 months

startedflyingmutant/changepoint

started time in 2 months

startedAndreyAkinshin/perfolizer

started time in 2 months

starteduber-dev/go

started time in 2 months

startedmiku/zek

started time in 2 months

startedCarloMara/SleigHighlight

started time in 2 months

push eventmmcloughlin/goperf

Michael McLoughlin

commit sha c9cfaf6957aa068c925aff1b7d7f818e67f3c85f

script: pin tool versions

view details

push time in 2 months

push eventmmcloughlin/goperf

Michael McLoughlin

commit sha d245d96c865962c9a5a482cbe4b5a29d59a128ac

app/coordinator: set a (large) job timeout

view details

push time in 2 months

startedMasterminds/sprig

started time in 2 months

issue commentgolang/go

proposal: x/lint: freeze and deprecate

It seems unlikely that I’ll be able to change opinions here, but I feel like saying I personally find this decision slightly disappointing. I don’t really have any opinions on the technical aspects, but it feels to me that through this decision the Go team and larger community is taking one step back from promoting a consistent style across Go code.

In Go at Google: Language Design in the Service of Software Engineering, Rob Pike says about gofmt that

Gofmt also affects scalability: since all code looks the same, teams find it easier to work together or with others' code.

Perhaps I misunderstood the intention, but I always thought that Effective Go, the Code Review Comments and associated x/lint tooling were part of this goal of making Go code "look the same", again in the service of software engineering. That is, I agree with @dsnet in his comment https://github.com/golang/lint/issues/263#issuecomment-269547137

The purpose of lint is to encourage a consistent style of Go across the community. An individual developer may not agree with its style rules (I don't agree with some of them), but there is a strong benefit to consistency in the Go community.

As a result, I am surprised now to see the following quote from this issue:

People can reasonably prefer different styles. They can reasonably want to adopt some aspects of the style or not.

To be clear, I do not have a problem with configurable linters, I use them heavily myself and don't expect others to agree with all my preferences. However, I do believe that there remains a place for a common core set of lint rules recommended by the Go community. For me it feels like by adopting this proposal, the Go community is giving up on this goal of recommending a consistent style, leaving it up to whatever configurable linters people decide to write.

The argument has frequently been made in this discussion that these lint rules are availble in staticcheck. I am very thankful to Dominik Honnef for all his work, I support him with a small donation each month and I use the staticcheck tool regularly. Nonetheless, staticcheck isn't an official Go project, it's still under Dominik's Github account and he has no obligation to take feedback from anyone. I would be very happy if this proposal was instead: x/lint will be deprecated and staticcheck will replace it as an official Go project under github.com/golang/staticcheck or golang.org/x/tools/cmd/staticcheck. Moreover, as far as I understand it, staticcheck does not implement the same defaults as golint so it doesn't necessarily enforce the same "consistent style of Go across the community" that golint did. (For me the loss of the documentation lint rule is particularly disappointing.)

So ultimately I don't have strong opinions about what happens to the x/lint repository, or even the golint tool itself. I'm more concerned about what this means for the Go community's intention to promote a consistent style across Go projects.

ianlancetaylor

comment created time in 3 months

startedcris691/discohash

started time in 3 months

issue commentgolang/go

x/tools/go/analysis/passes/asmdecl: false error report for 16 byte move

Ah thank you @randall77. My attempt to avoid this linter error was to change my test case to 64-bits rather than 128-bit (the PR is mmcloughlin/avo#149).

// Code generated by command: go run asm.go -out issue145.s -stubs stub.go. DO NOT EDIT.

#include "textflag.h"

// func Halves(x uint64) [2]uint32
TEXT ·Halves(SB), NOSPLIT, $0-16
	MOVQ x+0(FP), AX
	MOVQ AX, ret+8(FP)
	RET

This gives the following error

[amd64] Halves: invalid MOVQ of ret+8(FP); [2]uint32 is 8-byte value

As I result I suspect that there are two aspects to this:

  • Detection of moves of 16 bytes and larger
  • Support for non-primitive types like [2]uint32 (complexN also falls in this category)
mmcloughlin

comment created time in 3 months

delete branch mmcloughlin/avo

delete branch : ci-latest-go-version

delete time in 3 months

delete branch mmcloughlin/avo

delete branch : go1.14

delete time in 3 months

issue commentmmcloughlin/avo

all: support AVX-512

The opcodes database only supports a subset of AVX-512 extensions.

avo$ cat internal/data/x86_64.xml  | grep AVX512 | grep ISA | sort | uniq -c | sort -nr
   1710       <ISA id="AVX512F"/>
   1498       <ISA id="AVX512VL"/>
    552       <ISA id="AVX512BW"/>
    252       <ISA id="AVX512DQ"/>
     30       <ISA id="AVX512CD"/>
     24       <ISA id="AVX512VBMI"/>
     20       <ISA id="AVX512ER"/>
     16       <ISA id="AVX512PF"/>
     12       <ISA id="AVX512IFMA"/>
      4       <ISA id="AVX512VPOPCNTDQ"/>

Using the opcodes database is the simplest way to get some AVX-512 support for now. Complete support would probably rely on XED #23.

mmcloughlin

comment created time in 3 months

starteddgryski/go-disco

started time in 3 months

more