Skip to content

Commit

Permalink
v0.5.0 (#70)
Browse files Browse the repository at this point in the history
* v0.5.0
Update: changelog
Update: wasm binary and files
Bump: deps
Add: release on version tag github action
Add: release checklist

* Remove: Android CI target
Failing due to not finding libunwind
This is related to: cross-rs/cross#1128
There is a workaround: rust-lang/rust#85806 (comment)
Someone might want to try implement it later
For now I'm pulling out the android compiles from CI
  • Loading branch information
mberry committed Mar 16, 2023
1 parent 1e9e7c9 commit 1b1637c
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 38 deletions.
1 change: 0 additions & 1 deletion .github/workflows/cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
strategy:
matrix:
target: [
aarch64-linux-android,
aarch64-unknown-linux-gnu,
aarch64-unknown-linux-musl,
arm-unknown-linux-gnueabi,
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Version Release

on:
push:
branches:
- master
tags:
- 'v[0-9]+.[0-9]+.*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

# Trims latest release notes from CHANGELOG,md
- name: Generate Release Notes
run: sed '1p;1,/^##/!d;/##/d' CHANGELOG.md > ${{ github.ref_name }}.md

- name: Publish Release
uses: softprops/action-gh-release@v1
with:
body_path: ${{ github.ref_name }}.md
env:
GITHUB_REPOSITORY: Argyle-Software/kyber
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ www/node_modules/
www/dist/
www/.bin/
pkg/package.json.bak
release_checklist
16 changes: 16 additions & 0 deletions CHANGELOG.txt → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 0.5.0 - 2023-3-16

### Added
- `90s-fixslice` feature, using RustCrypto's AES implementation
- More key exchange testing (thanks Francesco Medina)
- Examples

### Changed
- Bumped dependencies

### Fixed
- Documentation

### Removed
- Unnecessary sha2 default dependencies

## 0.4.0 - 2023-1-18

### Added
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "pqc_kyber"
version = "0.4.0"
version = "0.5.0"
authors = ["Mitchell Berry <foss@mitchellberry.com>"]
edition = "2018"
license = "MIT/Apache-2.0"
repository = "https://github.com/Argyle-Software/kyber"
documentation = "https://docs.rs/crate/pqc_kyber/"
categories = ["algorithms", "cryptography"]
categories = ["algorithms", "cryptography", "wasm", "no-std"]
description = "A rust implementation of the post-quantum Kyber KEM algorithm"
keywords = ["kyber", "kem", "key-exchange", "kex", "post-quantum"]
readme = "readme.md"

[dependencies]
rand_core = { version = "0.6.4", default-features = false }
wasm-bindgen = { version = "0.2.83", optional = true }
wasm-bindgen = { version = "0.2.84", optional = true }
sha2 = { version = "0.10.6", optional = true , default-features = false }
getrandom = {version = "0.2.8", features = ["js"], optional = true }
zeroize = { version = "1.5.7", features = ["derive"], optional = true }
Expand Down
4 changes: 2 additions & 2 deletions pkg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"collaborators": [
"Mitchell Berry <foss@mitchellberry.com>"
],
"description": "The post-quantum Kyber KEM algorithm",
"version": "0.4.0",
"description": "The post-quantum Kyber key exchange algorithm, written in rust and compiled to wasm",
"version": "0.5.0",
"license": "MIT/Apache-2.0",
"repository": {
"type": "git",
Expand Down
4 changes: 3 additions & 1 deletion pkg/pqc_kyber.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import * as wasm from "./pqc_kyber_bg.wasm";
export * from "./pqc_kyber_bg.js";
import { __wbg_set_wasm } from "./pqc_kyber_bg.js";
__wbg_set_wasm(wasm);
export * from "./pqc_kyber_bg.js";
60 changes: 32 additions & 28 deletions pkg/pqc_kyber_bg.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import * as wasm from './pqc_kyber_bg.wasm';
let wasm;
export function __wbg_set_wasm(val) {
wasm = val;
}


const heap = new Array(32).fill(undefined);
const heap = new Array(128).fill(undefined);

heap.push(undefined, null, true, false);

Expand All @@ -9,7 +13,7 @@ function getObject(idx) { return heap[idx]; }
let heap_next = heap.length;

function dropObject(idx) {
if (idx < 36) return;
if (idx < 132) return;
heap[idx] = heap_next;
heap_next = idx;
}
Expand All @@ -26,10 +30,10 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true

cachedTextDecoder.decode();

let cachedUint8Memory0 = new Uint8Array();
let cachedUint8Memory0 = null;

function getUint8Memory0() {
if (cachedUint8Memory0.byteLength === 0) {
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8Memory0;
Expand Down Expand Up @@ -170,10 +174,10 @@ function passStringToWasm0(arg, malloc, realloc) {
return ptr;
}

let cachedInt32Memory0 = new Int32Array();
let cachedInt32Memory0 = null;

function getInt32Memory0() {
if (cachedInt32Memory0.byteLength === 0) {
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
return cachedInt32Memory0;
Expand Down Expand Up @@ -470,14 +474,6 @@ export function __wbindgen_object_drop_ref(arg0) {
takeObject(arg0);
};

export function __wbg_randomFillSync_6894564c2c334c42() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
}, arguments) };

export function __wbg_getRandomValues_805f1c3d65988a5a() { return handleError(function (arg0, arg1) {
getObject(arg0).getRandomValues(getObject(arg1));
}, arguments) };

export function __wbg_crypto_e1d53a1d73fb10b8(arg0) {
const ret = getObject(arg0).crypto;
return addHeapObject(ret);
Expand Down Expand Up @@ -529,12 +525,20 @@ export function __wbindgen_string_new(arg0, arg1) {
return addHeapObject(ret);
};

export function __wbg_newnoargs_b5b063fc6c2f0376(arg0, arg1) {
export function __wbg_getRandomValues_805f1c3d65988a5a() { return handleError(function (arg0, arg1) {
getObject(arg0).getRandomValues(getObject(arg1));
}, arguments) };

export function __wbg_randomFillSync_6894564c2c334c42() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
}, arguments) };

export function __wbg_newnoargs_2b8b6bd7753c76ba(arg0, arg1) {
const ret = new Function(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
};

export function __wbg_call_97ae9d8645dc388b() { return handleError(function (arg0, arg1) {
export function __wbg_call_95d1ea488d03e4e8() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).call(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
Expand All @@ -544,22 +548,22 @@ export function __wbindgen_object_clone_ref(arg0) {
return addHeapObject(ret);
};

export function __wbg_self_6d479506f72c6a71() { return handleError(function () {
export function __wbg_self_e7c1f827057f6584() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
}, arguments) };

export function __wbg_window_f2557cc78490aceb() { return handleError(function () {
export function __wbg_window_a09ec664e14b1b81() { return handleError(function () {
const ret = window.window;
return addHeapObject(ret);
}, arguments) };

export function __wbg_globalThis_7f206bda628d5286() { return handleError(function () {
export function __wbg_globalThis_87cbb8506fecf3a9() { return handleError(function () {
const ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };

export function __wbg_global_ba75c50d1cf384f4() { return handleError(function () {
export function __wbg_global_c85a9259e621f3db() { return handleError(function () {
const ret = global.global;
return addHeapObject(ret);
}, arguments) };
Expand All @@ -569,36 +573,36 @@ export function __wbindgen_is_undefined(arg0) {
return ret;
};

export function __wbg_call_168da88779e35f61() { return handleError(function (arg0, arg1, arg2) {
export function __wbg_call_9495de66fdbe016b() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
return addHeapObject(ret);
}, arguments) };

export function __wbg_buffer_3f3d764d4747d564(arg0) {
export function __wbg_buffer_cf65c07de34b9a08(arg0) {
const ret = getObject(arg0).buffer;
return addHeapObject(ret);
};

export function __wbg_new_8c3f0052272a457a(arg0) {
export function __wbg_new_537b7341ce90bb31(arg0) {
const ret = new Uint8Array(getObject(arg0));
return addHeapObject(ret);
};

export function __wbg_set_83db9690f9353e79(arg0, arg1, arg2) {
export function __wbg_set_17499e8aa4003ebd(arg0, arg1, arg2) {
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
};

export function __wbg_length_9e1ae1900cb0fbd5(arg0) {
export function __wbg_length_27a2afe8ab42b09f(arg0) {
const ret = getObject(arg0).length;
return ret;
};

export function __wbg_newwithlength_f5933855e4f48a19(arg0) {
export function __wbg_newwithlength_b56c882b57805732(arg0) {
const ret = new Uint8Array(arg0 >>> 0);
return addHeapObject(ret);
};

export function __wbg_subarray_58ad4efbb5bcb886(arg0, arg1, arg2) {
export function __wbg_subarray_7526649b91a252a6(arg0, arg1, arg2) {
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
return addHeapObject(ret);
};
Expand Down
Binary file modified pkg/pqc_kyber_bg.wasm
Binary file not shown.
5 changes: 3 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
# Kyber
[![Build Status](https://github.com/Argyle-Software/kyber/actions/workflows/kat.yml/badge.svg)](https://github.com/Argyle-Software/kyber/actions)
[![Crates](https://img.shields.io/crates/v/pqc-kyber)](https://crates.io/crates/pqc-kyber)
[![NPM](https://img.shields.io/npm/v/pqc-kyber)](https://www.npmjs.com/package/pqc-kyber)
[![NPM](https://img.shields.io/npm/v/pqc-kyber?color=yellow)](https://www.npmjs.com/package/pqc-kyber)
[![License](https://img.shields.io/crates/l/pqc_kyber)](https://github.com/Argyle-Software/kyber/blob/master/LICENSE-MIT)
[![dependency status](https://deps.rs/crate/pqc_kyber/0.4.0/status.svg)](https://deps.rs/crate/pqc_kyber/0.5.0)

A rust implementation of the Kyber algorithm, a KEM standardised by the NIST Post-Quantum Standardization Project.

Expand Down Expand Up @@ -133,7 +134,7 @@ If no security level is specified then kyber768 is used by default as recommende

```toml
[dependencies]
pqc_kyber = {version = "0.4.0", features = ["kyber512", "90s", "avx2"]}
pqc_kyber = {version = "0.5.0", features = ["kyber512", "90s", "avx2"]}
```


Expand Down
38 changes: 38 additions & 0 deletions release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Release Checklist

1. Bump any dependencies in **Cargo.toml**

2. Run tests and address sanitiser checks:
```bash
export RUSTFLAGS="${RUSTFLAGS:-} -Z sanitizer=address -C target-cpu=native -C target-feature=+aes,+avx2,+sse2,+sse4.1,+bmi2,+popcnt";\
export RUSTDOCFLAGS="-Z sanitizer=address";
rustup default nightly;
KAT=1 AVX2=1 NASM=1 ./tests/run_all_tests.sh;
```

3. Bump version in **Cargo.toml**

4. Bump version in deps.rs badge and features section of **readme.md**

5. Update **changelog.md**

6. `cargo +nightly fmt`

7. `wasm-pack build -- --features wasm`

8. Fix autogenerated **pkg/package.json**:
* name - Replace `pqc_kyber` with `pqc-kyber`
* description - Revert line to replace with old description

9. `git commit -m "v0.0.0"`

10. `git tag v0.0.0`

11. `git push origin v0.0.0`

12. Open PR to master, confirm all CI checks pass, merge PR

13. `cargo publish`

14. `npm publish`

0 comments on commit 1b1637c

Please sign in to comment.