Skip to content

Commit

Permalink
Merge pull request #356 from dedis/mod
Browse files Browse the repository at this point in the history
Update for new module import paths
  • Loading branch information
jeffallen committed Jan 25, 2019
2 parents 5cc6460 + c9ac613 commit ffb7191
Show file tree
Hide file tree
Showing 103 changed files with 287 additions and 398 deletions.
14 changes: 12 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
language: go

go:
- "1.11.x"

go_import_path: go.dedis.ch/kyber

install:
- go get -t ./...
- go get github.com/dedis/Coding || true

script:
- make test
- env GO111MODULE=on make test

notifications:
email: false

# https://restic.net/blog/2018-09-02/travis-build-cache
cache:
directories:
- $HOME/.cache/go-build
- $GOPATH/pkg/mod
26 changes: 10 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
[![Docs](https://img.shields.io/badge/docs-current-brightgreen.svg)](https://godoc.org/github.com/dedis/kyber)
[![Docs](https://img.shields.io/badge/docs-current-brightgreen.svg)](https://godoc.org/go.dedis.ch/kyber)
[![Build Status](https://travis-ci.org/dedis/kyber.svg?branch=master)](https://travis-ci.org/dedis/kyber)

DEDIS Advanced Crypto Library for Go
====================================

This package provides a toolbox of advanced cryptographic primitives for Go,
targeting applications like [Cothority](https://github.com/dedis/cothority)
targeting applications like [Cothority](https://go.dedis.ch/cothority)
that need more than straightforward signing and encryption.
Please see the
[Godoc documentation for this package](http://godoc.org/github.com/dedis/kyber)
[Godoc documentation for this package](https://godoc.org/go.dedis.ch/kyber)
for details on the library's purpose and API functionality.

This package includes a mix of variable time and constant time
implementations. If your application is sensitive to timing-based attacks
and you need to constrain Kyber to offering only constant time implementations,
you should use the [suites.RequireConstantTime()](https://godoc.org/github.com/dedis/kyber/suites#RequireConstantTime)
you should use the [suites.RequireConstantTime()](https://godoc.org/go.dedis.ch/kyber/suites#RequireConstantTime)
function in the `init()` function of your `main` package.

Versioning - Development
------------------------

We use the following versioning model:

* crypto.v0 was the previous semi-stable version. See
[migration notes](https://github.com/dedis/kyber/wiki/Migration-from-gopkg.in-dedis-crypto.v0).
* crypto.v0 was the first semi-stable version. See [migration notes](https://github.com/dedis/kyber/wiki/Migration-from-gopkg.in-dedis-crypto.v0).
* kyber.v1 never existed, in order to keep kyber, onet and cothorithy versions linked
* kyber.v2 is the stable version
* the master branch of kyber is the development version
* gopkg.in/dedis/kyber.v2 was the last stable version
* Starting with v3.0.0, kyber is a Go module, and we respect [semantic versioning](https://golang.org/cmd/go/#hdr-Module_compatibility_and_semantic_versioning).

So if you depend on the master branch, you can expect breakages from time
to time. If you need something that doesn't change in a backward-compatible
way you should do:

```
import "gopkg.in/dedis/kyber.v2"
```
way you should use have a `go.mod` file in the directory where your
main package is.

Installing
----------
Expand All @@ -45,9 +41,7 @@ The basic crypto library requires only Go and a few
third-party Go-language dependencies that can be installed automatically
as follows:

go get github.com/dedis/kyber
cd "$(go env GOPATH)/src/github.com/dedis/kyber"
go get -t ./... # install 3rd-party dependencies
go get go.dedis.ch/kyber

You should then be able to test its basic function as follows:

Expand Down
4 changes: 2 additions & 2 deletions encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ type Marshaling interface {
// available:
//
// 1. The protobuf encoding using the variable length Google Protobuf encoding
// scheme. The library is available at https://github.com/dedis/protobuf
// scheme. The library is available at https://go.dedis.ch/protobuf
// 2. The fixbuf encoding, a fixed length binary encoding of arbitrary
// structures. The library is available at https://github.com/dedis/fixbuf.
// structures. The library is available at https://go.dedis.ch/fixbuf.
type Encoding interface {
// Encode and write objects to an io.Writer.
Write(w io.Writer, objs ...interface{}) error
Expand Down
4 changes: 2 additions & 2 deletions encrypt/ecies/ecies.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"errors"
"hash"

"github.com/dedis/kyber"
"github.com/dedis/kyber/util/random"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/util/random"
"golang.org/x/crypto/hkdf"
)

Expand Down
4 changes: 2 additions & 2 deletions encrypt/ecies/ecies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package ecies
import (
"testing"

"github.com/dedis/kyber/group/edwards25519"
"github.com/dedis/kyber/util/random"
"github.com/stretchr/testify/require"
"go.dedis.ch/kyber/group/edwards25519"
"go.dedis.ch/kyber/util/random"
)

func TestECIES(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions examples/dh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package examples
import (
"fmt"

"github.com/dedis/kyber/group/edwards25519"
"github.com/dedis/kyber/xof/blake2xb"
"go.dedis.ch/kyber/group/edwards25519"
"go.dedis.ch/kyber/xof/blake2xb"
)

/*
Expand Down
6 changes: 3 additions & 3 deletions examples/enc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package examples
import (
"fmt"

"github.com/dedis/kyber"
"github.com/dedis/kyber/group/edwards25519"
"github.com/dedis/kyber/util/random"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/group/edwards25519"
"go.dedis.ch/kyber/util/random"
)

func ElGamalEncrypt(group kyber.Group, pubkey kyber.Point, message []byte) (
Expand Down
4 changes: 2 additions & 2 deletions examples/sig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"errors"
"fmt"

"github.com/dedis/kyber"
"github.com/dedis/kyber/group/edwards25519"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/group/edwards25519"
)

type Suite interface {
Expand Down
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module go.dedis.ch/kyber

require (
github.com/stretchr/testify v1.3.0
go.dedis.ch/fixbuf v1.0.3
go.dedis.ch/protobuf v1.0.5
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e
)
15 changes: 15 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
go.dedis.ch/fixbuf v1.0.3 h1:hGcV9Cd/znUxlusJ64eAlExS+5cJDIyTyEG+otu5wQs=
go.dedis.ch/fixbuf v1.0.3/go.mod h1:yzJMt34Wa5xD37V5RTdmp38cz3QhMagdGoem9anUalw=
go.dedis.ch/protobuf v1.0.5 h1:EbF1czEKICxf5KY8Tm7wMF28hcOQbB6yk4IybIFWTYE=
go.dedis.ch/protobuf v1.0.5/go.mod h1:eIV4wicvi6JK0q/QnfIEGeSFNG0ZeB24kzut5+HaRLo=
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b h1:Elez2XeF2p9uyVj0yEUDqQ56NFcDtcBNkYP7yv8YbUE=
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e h1:3GIlrlVLfkoipSReOMNAgApI0ajnalyLa/EZHHca/XI=
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
6 changes: 3 additions & 3 deletions group/curve25519/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"io"
"math/big"

"github.com/dedis/kyber"
"github.com/dedis/kyber/group/internal/marshalling"
"github.com/dedis/kyber/group/mod"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/group/internal/marshalling"
"go.dedis.ch/kyber/group/mod"
)

type basicPoint struct {
Expand Down
2 changes: 1 addition & 1 deletion group/curve25519/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package curve25519
import (
"testing"

"github.com/dedis/kyber/util/test"
"go.dedis.ch/kyber/util/test"
)

// Test the basic implementation of the Ed25519 curve.
Expand Down
6 changes: 3 additions & 3 deletions group/curve25519/curve.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"fmt"
"math/big"

"github.com/dedis/kyber"
"github.com/dedis/kyber/group/mod"
"github.com/dedis/kyber/util/random"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/group/mod"
"go.dedis.ch/kyber/util/random"
)

var zero = big.NewInt(0)
Expand Down
4 changes: 2 additions & 2 deletions group/curve25519/curve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package curve25519
import (
"testing"

"github.com/dedis/kyber/group/edwards25519"
"github.com/dedis/kyber/util/test"
"go.dedis.ch/kyber/group/edwards25519"
"go.dedis.ch/kyber/util/test"
)

var testSuite = NewBlakeSHA256Curve25519(false)
Expand Down
6 changes: 3 additions & 3 deletions group/curve25519/ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"io"
"math/big"

"github.com/dedis/kyber"
"github.com/dedis/kyber/group/internal/marshalling"
"github.com/dedis/kyber/group/mod"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/group/internal/marshalling"
"go.dedis.ch/kyber/group/mod"
)

type extPoint struct {
Expand Down
2 changes: 1 addition & 1 deletion group/curve25519/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package curve25519
import (
"math/big"

"github.com/dedis/kyber/group/mod"
"go.dedis.ch/kyber/group/mod"
)

// Param defines a Twisted Edwards curve (TEC).
Expand Down
6 changes: 3 additions & 3 deletions group/curve25519/proj.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"io"
"math/big"

"github.com/dedis/kyber"
"github.com/dedis/kyber/group/internal/marshalling"
"github.com/dedis/kyber/group/mod"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/group/internal/marshalling"
"go.dedis.ch/kyber/group/mod"
)

type projPoint struct {
Expand Down
12 changes: 6 additions & 6 deletions group/curve25519/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"io"
"reflect"

"github.com/dedis/fixbuf"
"github.com/dedis/kyber"
"github.com/dedis/kyber/group/internal/marshalling"
"github.com/dedis/kyber/util/random"
"github.com/dedis/kyber/xof/blake2xb"
"go.dedis.ch/fixbuf"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/group/internal/marshalling"
"go.dedis.ch/kyber/util/random"
"go.dedis.ch/kyber/xof/blake2xb"
)

// SuiteCurve25519 is the suite for the 25519 curve
Expand Down Expand Up @@ -49,7 +49,7 @@ func (s *SuiteCurve25519) RandomStream() cipher.Stream {
}

// NewBlakeSHA256Curve25519 returns a cipher suite based on package
// github.com/dedis/kyber/xof/blake2xb, SHA-256, and Curve25519.
// go.dedis.ch/kyber/xof/blake2xb, SHA-256, and Curve25519.
//
// If fullGroup is false, then the group is the prime-order subgroup.
//
Expand Down
2 changes: 1 addition & 1 deletion group/edwards25519/allowvt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package edwards25519
import (
"testing"

"github.com/dedis/kyber"
"go.dedis.ch/kyber"
)

func TestVartime(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions group/edwards25519/curve.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"crypto/cipher"
"crypto/sha512"

"github.com/dedis/kyber"
"github.com/dedis/kyber/util/random"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/util/random"
)

// Curve represents the Ed25519 group.
Expand Down
2 changes: 1 addition & 1 deletion group/edwards25519/curve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package edwards25519
import (
"testing"

"github.com/dedis/kyber/util/test"
"go.dedis.ch/kyber/util/test"
)

var tSuite = NewBlakeSHA256Ed25519()
Expand Down
4 changes: 2 additions & 2 deletions group/edwards25519/point.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"errors"
"io"

"github.com/dedis/kyber"
"github.com/dedis/kyber/group/internal/marshalling"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/group/internal/marshalling"
)

var marshalPointID = [8]byte{'e', 'd', '.', 'p', 'o', 'i', 'n', 't'}
Expand Down
8 changes: 4 additions & 4 deletions group/edwards25519/scalar.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"io"
"math/big"

"github.com/dedis/kyber"
"github.com/dedis/kyber/group/internal/marshalling"
"github.com/dedis/kyber/group/mod"
"github.com/dedis/kyber/util/random"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/group/internal/marshalling"
"go.dedis.ch/kyber/group/mod"
"go.dedis.ch/kyber/util/random"
)

// This code is a port of the public domain, "ref10" implementation of ed25519
Expand Down
4 changes: 2 additions & 2 deletions group/edwards25519/scalar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"testing"

"github.com/dedis/kyber"
"github.com/dedis/kyber/util/random"
"github.com/stretchr/testify/require"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/util/random"
)

// SimpleCTScalar implements the scalar operations only using `ScMulAdd` by
Expand Down
14 changes: 7 additions & 7 deletions group/edwards25519/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"io"
"reflect"

"github.com/dedis/fixbuf"
"github.com/dedis/kyber"
"github.com/dedis/kyber/group/internal/marshalling"
"github.com/dedis/kyber/util/random"
"github.com/dedis/kyber/xof/blake2xb"
"go.dedis.ch/fixbuf"
"go.dedis.ch/kyber"
"go.dedis.ch/kyber/group/internal/marshalling"
"go.dedis.ch/kyber/util/random"
"go.dedis.ch/kyber/xof/blake2xb"
)

// SuiteEd25519 implements some basic functionalities such as Group, HashFactory,
Expand Down Expand Up @@ -54,15 +54,15 @@ func (s *SuiteEd25519) RandomStream() cipher.Stream {
}

// NewBlakeSHA256Ed25519 returns a cipher suite based on package
// github.com/dedis/kyber/xof/blake2xb, SHA-256, and the Ed25519 curve.
// go.dedis.ch/kyber/xof/blake2xb, SHA-256, and the Ed25519 curve.
// It produces cryptographically random numbers via package crypto/rand.
func NewBlakeSHA256Ed25519() *SuiteEd25519 {
suite := new(SuiteEd25519)
return suite
}

// NewBlakeSHA256Ed25519WithRand returns a cipher suite based on package
// github.com/dedis/kyber/xof/blake2xb, SHA-256, and the Ed25519 curve.
// go.dedis.ch/kyber/xof/blake2xb, SHA-256, and the Ed25519 curve.
// It produces cryptographically random numbers via the provided stream r.
func NewBlakeSHA256Ed25519WithRand(r cipher.Stream) *SuiteEd25519 {
suite := new(SuiteEd25519)
Expand Down
2 changes: 1 addition & 1 deletion group/internal/marshalling/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"io"
"reflect"

"github.com/dedis/kyber"
"go.dedis.ch/kyber"
)

// PointMarshalTo provides a generic implementation of Point.EncodeTo
Expand Down

0 comments on commit ffb7191

Please sign in to comment.