Skip to content

Commit

Permalink
merging v4 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AnomalRoil committed Jun 6, 2024
2 parents 49f051c + 0470453 commit 90b3ce8
Show file tree
Hide file tree
Showing 145 changed files with 886 additions and 532 deletions.
79 changes: 0 additions & 79 deletions .github/workflows/test_on_pr.yml

This file was deleted.

59 changes: 0 additions & 59 deletions .github/workflows/test_on_push.yml

This file was deleted.

120 changes: 107 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,121 @@
name: Tests
name: CI Workflow for tests

on:
pull_request_target:
types: [opened, synchronize, reopened, labeled]
push:
branches:
- master
pull_request:
branches: [ master ]

concurrency:
group: ci-${{ github.ref }}-test
cancel-in-progress: true

jobs:
test:
permission:
if: ${{ github.event_name == 'pull_request_target' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Add comment if PR permission failed
if: ${{ !contains(github.event.pull_request.labels.*.name, 'safe PR') }}
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🔒 Could not start CI tests due to missing *safe PR* label. Please contact a DEDIS maintainer.'
})
- name: Check permission
if: ${{ !contains(github.event.pull_request.labels.*.name, 'safe PR') }}
run: |
echo "::error:: Could not start CI tests due to missing *safe PR* label."
exit 1
test:
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe PR')) }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
size: ['64b', '32b']
golang: ['1.21.10', '1.22.3']
exclude:
- os: windows-latest
size: '32b'
- os: macos-latest
size: '32b'

runs-on: ${{ matrix.os }}
env:
DBGSYNCLOG: trace
DBGSYNCON: true

steps:
- name: Set up Go ${{ matrix.golang }}
uses: actions/setup-go@v5
if: ${{ matrix.size == '64b' }}
with:
go-version: ${{ matrix.golang }}
check-latest: false

- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Setup Alpine Linux
uses: jirutka/setup-alpine@v1
if: ${{ matrix.size == '32b' }}
with:
arch: x86
packages: >
make
git
gcc
musl-dev
- name: Test without coverage (Windows, MacOS)
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'windows-latest' }}
run: make test

- name: Test without coverage (Ubuntu x86)
if: ${{ matrix.size == '32b' }}
run: |
cd ..
wget -O go.tgz -nv https://go.dev/dl/go${{matrix.golang}}.linux-386.tar.gz
tar -xzf go.tgz
export PATH=$PATH:$(pwd)/go/bin
cd kyber
make test
shell: alpine.sh {0}

- name: Test with coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.size == '64b' }}
run: make coverage

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.18'
- name: SonarCloud scan
if: ${{ matrix.os == 'ubuntu-latest' && matrix.size == '64b' }}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=dedis
-Dsonar.projectKey=dedis_kyber
-Dsonar.go.tests.reportPaths=report.json
-Dsonar.go.coverage.reportPaths=profile.cov
-Dsonar.pullrequest.key=${{ github.event.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.event.pull_request.base }}
-Dsonar.c.file.suffixes=-
-Dsonar.cpp.file.suffixes=-
-Dsonar.objc.file.suffixes=-
- name: Run tests
run: make test
- name: Send coverage
if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.size == '64b' }}
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Using the module
----------------

Kyber supports Go modules, and currently has a major version of 3, which means that
the import path is: `go.dedis.ch/kyber/v3`.
the import path is: `go.dedis.ch/kyber/v4`.

Here is a basic example of getting started using it:
1. Make a new directory called “ex". Change directory to “ex" and put this in main.go:
Expand All @@ -57,7 +57,7 @@ package main

import (
"fmt"
"go.dedis.ch/kyber/v3/suites"
"go.dedis.ch/kyber/v4/suites"
)

func main() {
Expand All @@ -67,7 +67,7 @@ func main() {
}
```
2. Type “go mod init example.com/ex”. The resulting go.mod file will have no dependencies listed yet.
3. Type “go build”. The go tool will fill in the new dependencies that it find for you, i.e. "require go.dedis.ch/kyber/v3 v3.0.13”.
3. Type “go build”. The go tool will fill in the new dependencies that it find for you, i.e. "require go.dedis.ch/kyber/v4 v3.0.13”.
4. Running `./ex` will print `0000000000000000000000000000000000000000000000000000000000000000`.

A note on deriving shared secrets
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"

"go.dedis.ch/kyber/v3"
"go.dedis.ch/kyber/v3/util/random"
"go.dedis.ch/kyber/v4"
"go.dedis.ch/kyber/v4/util/random"
"golang.org/x/crypto/hkdf"
)

Expand Down
10 changes: 5 additions & 5 deletions encrypt/ecies/ecies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"testing"

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

func TestECIES(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions encrypt/ibe/ibe.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"errors"
"fmt"

"go.dedis.ch/kyber/v3"
"go.dedis.ch/kyber/v3/pairing"
"go.dedis.ch/kyber/v3/util/random"
"go.dedis.ch/kyber/v4"
"go.dedis.ch/kyber/v4/pairing"
"go.dedis.ch/kyber/v4/util/random"
)

type Ciphertext struct {
Expand Down
8 changes: 4 additions & 4 deletions encrypt/ibe/ibe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"testing"

"github.com/stretchr/testify/require"
"go.dedis.ch/kyber/v3"
"go.dedis.ch/kyber/v3/pairing"
"go.dedis.ch/kyber/v3/pairing/bls12381/kilic"
"go.dedis.ch/kyber/v3/util/random"
"go.dedis.ch/kyber/v4"
"go.dedis.ch/kyber/v4/pairing"
"go.dedis.ch/kyber/v4/pairing/bls12381/kilic"
"go.dedis.ch/kyber/v4/util/random"
)

func newSetting(i uint) (
Expand Down
8 changes: 4 additions & 4 deletions examples/bn256_enc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package examples
import (
"fmt"

"go.dedis.ch/kyber/v3"
"go.dedis.ch/kyber/v3/pairing"
"go.dedis.ch/kyber/v3/pairing/bn256"
"go.dedis.ch/kyber/v3/util/random"
"go.dedis.ch/kyber/v4"
"go.dedis.ch/kyber/v4/pairing"
"go.dedis.ch/kyber/v4/pairing/bn256"
"go.dedis.ch/kyber/v4/util/random"
)

func ElGamalEncryptBn256(suite pairing.Suite, pubkey kyber.Point, message []byte) (
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"

"go.dedis.ch/kyber/v3/group/edwards25519"
"go.dedis.ch/kyber/v3/xof/blake2xb"
"go.dedis.ch/kyber/v4/group/edwards25519"
"go.dedis.ch/kyber/v4/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"

"go.dedis.ch/kyber/v3"
"go.dedis.ch/kyber/v3/group/edwards25519"
"go.dedis.ch/kyber/v3/util/random"
"go.dedis.ch/kyber/v4"
"go.dedis.ch/kyber/v4/group/edwards25519"
"go.dedis.ch/kyber/v4/util/random"
)

func ElGamalEncrypt(group kyber.Group, pubkey kyber.Point, message []byte) (
Expand Down
Loading

0 comments on commit 90b3ce8

Please sign in to comment.