Skip to content

Commit 1b1637c

Browse files
authored
v0.5.0 (#70)
* 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
1 parent 1e9e7c9 commit 1b1637c

11 files changed

+123
-38
lines changed

.github/workflows/cross.yml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ jobs:
99
strategy:
1010
matrix:
1111
target: [
12-
aarch64-linux-android,
1312
aarch64-unknown-linux-gnu,
1413
aarch64-unknown-linux-musl,
1514
arm-unknown-linux-gnueabi,

.github/workflows/release.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Version Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- 'v[0-9]+.[0-9]+.*'
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
# Trims latest release notes from CHANGELOG,md
18+
- name: Generate Release Notes
19+
run: sed '1p;1,/^##/!d;/##/d' CHANGELOG.md > ${{ github.ref_name }}.md
20+
21+
- name: Publish Release
22+
uses: softprops/action-gh-release@v1
23+
with:
24+
body_path: ${{ github.ref_name }}.md
25+
env:
26+
GITHUB_REPOSITORY: Argyle-Software/kyber

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ www/node_modules/
1313
www/dist/
1414
www/.bin/
1515
pkg/package.json.bak
16-
release_checklist

CHANGELOG.txt CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
## 0.5.0 - 2023-3-16
2+
3+
### Added
4+
- `90s-fixslice` feature, using RustCrypto's AES implementation
5+
- More key exchange testing (thanks Francesco Medina)
6+
- Examples
7+
8+
### Changed
9+
- Bumped dependencies
10+
11+
### Fixed
12+
- Documentation
13+
14+
### Removed
15+
- Unnecessary sha2 default dependencies
16+
117
## 0.4.0 - 2023-1-18
218

319
### Added

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
[package]
22
name = "pqc_kyber"
3-
version = "0.4.0"
3+
version = "0.5.0"
44
authors = ["Mitchell Berry <foss@mitchellberry.com>"]
55
edition = "2018"
66
license = "MIT/Apache-2.0"
77
repository = "https://github.com/Argyle-Software/kyber"
88
documentation = "https://docs.rs/crate/pqc_kyber/"
9-
categories = ["algorithms", "cryptography"]
9+
categories = ["algorithms", "cryptography", "wasm", "no-std"]
1010
description = "A rust implementation of the post-quantum Kyber KEM algorithm"
1111
keywords = ["kyber", "kem", "key-exchange", "kex", "post-quantum"]
1212
readme = "readme.md"
1313

1414
[dependencies]
1515
rand_core = { version = "0.6.4", default-features = false }
16-
wasm-bindgen = { version = "0.2.83", optional = true }
16+
wasm-bindgen = { version = "0.2.84", optional = true }
1717
sha2 = { version = "0.10.6", optional = true , default-features = false }
1818
getrandom = {version = "0.2.8", features = ["js"], optional = true }
1919
zeroize = { version = "1.5.7", features = ["derive"], optional = true }

pkg/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"collaborators": [
44
"Mitchell Berry <foss@mitchellberry.com>"
55
],
6-
"description": "The post-quantum Kyber KEM algorithm",
7-
"version": "0.4.0",
6+
"description": "The post-quantum Kyber key exchange algorithm, written in rust and compiled to wasm",
7+
"version": "0.5.0",
88
"license": "MIT/Apache-2.0",
99
"repository": {
1010
"type": "git",

pkg/pqc_kyber.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
import * as wasm from "./pqc_kyber_bg.wasm";
2-
export * from "./pqc_kyber_bg.js";
2+
import { __wbg_set_wasm } from "./pqc_kyber_bg.js";
3+
__wbg_set_wasm(wasm);
4+
export * from "./pqc_kyber_bg.js";

pkg/pqc_kyber_bg.js

+32-28
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import * as wasm from './pqc_kyber_bg.wasm';
1+
let wasm;
2+
export function __wbg_set_wasm(val) {
3+
wasm = val;
4+
}
5+
26

3-
const heap = new Array(32).fill(undefined);
7+
const heap = new Array(128).fill(undefined);
48

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

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

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

2731
cachedTextDecoder.decode();
2832

29-
let cachedUint8Memory0 = new Uint8Array();
33+
let cachedUint8Memory0 = null;
3034

3135
function getUint8Memory0() {
32-
if (cachedUint8Memory0.byteLength === 0) {
36+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
3337
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
3438
}
3539
return cachedUint8Memory0;
@@ -170,10 +174,10 @@ function passStringToWasm0(arg, malloc, realloc) {
170174
return ptr;
171175
}
172176

173-
let cachedInt32Memory0 = new Int32Array();
177+
let cachedInt32Memory0 = null;
174178

175179
function getInt32Memory0() {
176-
if (cachedInt32Memory0.byteLength === 0) {
180+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
177181
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
178182
}
179183
return cachedInt32Memory0;
@@ -470,14 +474,6 @@ export function __wbindgen_object_drop_ref(arg0) {
470474
takeObject(arg0);
471475
};
472476

473-
export function __wbg_randomFillSync_6894564c2c334c42() { return handleError(function (arg0, arg1, arg2) {
474-
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
475-
}, arguments) };
476-
477-
export function __wbg_getRandomValues_805f1c3d65988a5a() { return handleError(function (arg0, arg1) {
478-
getObject(arg0).getRandomValues(getObject(arg1));
479-
}, arguments) };
480-
481477
export function __wbg_crypto_e1d53a1d73fb10b8(arg0) {
482478
const ret = getObject(arg0).crypto;
483479
return addHeapObject(ret);
@@ -529,12 +525,20 @@ export function __wbindgen_string_new(arg0, arg1) {
529525
return addHeapObject(ret);
530526
};
531527

532-
export function __wbg_newnoargs_b5b063fc6c2f0376(arg0, arg1) {
528+
export function __wbg_getRandomValues_805f1c3d65988a5a() { return handleError(function (arg0, arg1) {
529+
getObject(arg0).getRandomValues(getObject(arg1));
530+
}, arguments) };
531+
532+
export function __wbg_randomFillSync_6894564c2c334c42() { return handleError(function (arg0, arg1, arg2) {
533+
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
534+
}, arguments) };
535+
536+
export function __wbg_newnoargs_2b8b6bd7753c76ba(arg0, arg1) {
533537
const ret = new Function(getStringFromWasm0(arg0, arg1));
534538
return addHeapObject(ret);
535539
};
536540

537-
export function __wbg_call_97ae9d8645dc388b() { return handleError(function (arg0, arg1) {
541+
export function __wbg_call_95d1ea488d03e4e8() { return handleError(function (arg0, arg1) {
538542
const ret = getObject(arg0).call(getObject(arg1));
539543
return addHeapObject(ret);
540544
}, arguments) };
@@ -544,22 +548,22 @@ export function __wbindgen_object_clone_ref(arg0) {
544548
return addHeapObject(ret);
545549
};
546550

547-
export function __wbg_self_6d479506f72c6a71() { return handleError(function () {
551+
export function __wbg_self_e7c1f827057f6584() { return handleError(function () {
548552
const ret = self.self;
549553
return addHeapObject(ret);
550554
}, arguments) };
551555

552-
export function __wbg_window_f2557cc78490aceb() { return handleError(function () {
556+
export function __wbg_window_a09ec664e14b1b81() { return handleError(function () {
553557
const ret = window.window;
554558
return addHeapObject(ret);
555559
}, arguments) };
556560

557-
export function __wbg_globalThis_7f206bda628d5286() { return handleError(function () {
561+
export function __wbg_globalThis_87cbb8506fecf3a9() { return handleError(function () {
558562
const ret = globalThis.globalThis;
559563
return addHeapObject(ret);
560564
}, arguments) };
561565

562-
export function __wbg_global_ba75c50d1cf384f4() { return handleError(function () {
566+
export function __wbg_global_c85a9259e621f3db() { return handleError(function () {
563567
const ret = global.global;
564568
return addHeapObject(ret);
565569
}, arguments) };
@@ -569,36 +573,36 @@ export function __wbindgen_is_undefined(arg0) {
569573
return ret;
570574
};
571575

572-
export function __wbg_call_168da88779e35f61() { return handleError(function (arg0, arg1, arg2) {
576+
export function __wbg_call_9495de66fdbe016b() { return handleError(function (arg0, arg1, arg2) {
573577
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
574578
return addHeapObject(ret);
575579
}, arguments) };
576580

577-
export function __wbg_buffer_3f3d764d4747d564(arg0) {
581+
export function __wbg_buffer_cf65c07de34b9a08(arg0) {
578582
const ret = getObject(arg0).buffer;
579583
return addHeapObject(ret);
580584
};
581585

582-
export function __wbg_new_8c3f0052272a457a(arg0) {
586+
export function __wbg_new_537b7341ce90bb31(arg0) {
583587
const ret = new Uint8Array(getObject(arg0));
584588
return addHeapObject(ret);
585589
};
586590

587-
export function __wbg_set_83db9690f9353e79(arg0, arg1, arg2) {
591+
export function __wbg_set_17499e8aa4003ebd(arg0, arg1, arg2) {
588592
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
589593
};
590594

591-
export function __wbg_length_9e1ae1900cb0fbd5(arg0) {
595+
export function __wbg_length_27a2afe8ab42b09f(arg0) {
592596
const ret = getObject(arg0).length;
593597
return ret;
594598
};
595599

596-
export function __wbg_newwithlength_f5933855e4f48a19(arg0) {
600+
export function __wbg_newwithlength_b56c882b57805732(arg0) {
597601
const ret = new Uint8Array(arg0 >>> 0);
598602
return addHeapObject(ret);
599603
};
600604

601-
export function __wbg_subarray_58ad4efbb5bcb886(arg0, arg1, arg2) {
605+
export function __wbg_subarray_7526649b91a252a6(arg0, arg1, arg2) {
602606
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
603607
return addHeapObject(ret);
604608
};

pkg/pqc_kyber_bg.wasm

28 Bytes
Binary file not shown.

readme.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
# Kyber
99
[![Build Status](https://github.com/Argyle-Software/kyber/actions/workflows/kat.yml/badge.svg)](https://github.com/Argyle-Software/kyber/actions)
1010
[![Crates](https://img.shields.io/crates/v/pqc-kyber)](https://crates.io/crates/pqc-kyber)
11-
[![NPM](https://img.shields.io/npm/v/pqc-kyber)](https://www.npmjs.com/package/pqc-kyber)
11+
[![NPM](https://img.shields.io/npm/v/pqc-kyber?color=yellow)](https://www.npmjs.com/package/pqc-kyber)
1212
[![License](https://img.shields.io/crates/l/pqc_kyber)](https://github.com/Argyle-Software/kyber/blob/master/LICENSE-MIT)
13+
[![dependency status](https://deps.rs/crate/pqc_kyber/0.4.0/status.svg)](https://deps.rs/crate/pqc_kyber/0.5.0)
1314

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

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

134135
```toml
135136
[dependencies]
136-
pqc_kyber = {version = "0.4.0", features = ["kyber512", "90s", "avx2"]}
137+
pqc_kyber = {version = "0.5.0", features = ["kyber512", "90s", "avx2"]}
137138
```
138139

139140

release.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Release Checklist
2+
3+
1. Bump any dependencies in **Cargo.toml**
4+
5+
2. Run tests and address sanitiser checks:
6+
```bash
7+
export RUSTFLAGS="${RUSTFLAGS:-} -Z sanitizer=address -C target-cpu=native -C target-feature=+aes,+avx2,+sse2,+sse4.1,+bmi2,+popcnt";\
8+
export RUSTDOCFLAGS="-Z sanitizer=address";
9+
rustup default nightly;
10+
KAT=1 AVX2=1 NASM=1 ./tests/run_all_tests.sh;
11+
```
12+
13+
3. Bump version in **Cargo.toml**
14+
15+
4. Bump version in deps.rs badge and features section of **readme.md**
16+
17+
5. Update **changelog.md**
18+
19+
6. `cargo +nightly fmt`
20+
21+
7. `wasm-pack build -- --features wasm`
22+
23+
8. Fix autogenerated **pkg/package.json**:
24+
* name - Replace `pqc_kyber` with `pqc-kyber`
25+
* description - Revert line to replace with old description
26+
27+
9. `git commit -m "v0.0.0"`
28+
29+
10. `git tag v0.0.0`
30+
31+
11. `git push origin v0.0.0`
32+
33+
12. Open PR to master, confirm all CI checks pass, merge PR
34+
35+
13. `cargo publish`
36+
37+
14. `npm publish`
38+

0 commit comments

Comments
 (0)