Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f3d8510
security: fast secp256k1 and Keccak engines, JVM crypto benchmark
shai-almog Oct 26, 2026
10a4adb
security: Secp256k1 docs describe the new engine
shai-almog Oct 26, 2026
5f19ae9
security: PBKDF2 with precomputed HMAC states, CryptoEngine seam
shai-almog Oct 26, 2026
82570e6
security: Ed25519, BIP-340 Schnorr, RIPEMD-160, encodings, native cry…
shai-almog Oct 26, 2026
5de0aa5
security: native crypto kernels wired through the engine, builders li…
shai-almog Oct 26, 2026
b7b88fc
crypto-bench: native and JVM benchmark gates against libsecp256k1, li…
shai-almog Oct 26, 2026
87904c1
android: PBKDF2 through the provider's SecretKeyFactory for ASCII pas…
shai-almog Oct 26, 2026
b406316
crypto.hd: BIP-39 mnemonics, BIP-32 with xpub derivation and serializ…
shai-almog Oct 26, 2026
54200e9
crypto: UInt256 amounts and a shared JSON codec; Rlp off java.math; E…
shai-almog Oct 26, 2026
b809e65
crypto.bitcoin: addresses, scripts, transactions with legacy/BIP-143/…
shai-almog Oct 26, 2026
13bc334
crypto.solana: addresses, PDAs and ATAs, legacy and v0 messages, tran…
shai-almog Oct 26, 2026
2238b48
crypto.wallet: Signer, SeedSigner, VaultSigner and the Wallet facade;…
shai-almog Oct 26, 2026
79aa74b
crypto.rpc: JSON-RPC, EvmRpc, EsploraClient, SolanaRpc over RpcTransp…
shai-almog Oct 26, 2026
8146faf
crypto.market: PriceFeed, Quote, CoinGecko, template JSON feeds and a…
shai-almog Oct 26, 2026
f1ecc8e
Bastion: custody on the core crypto stack; drop its own Bip32/RLP/EIP…
shai-almog Oct 26, 2026
7087217
Developer guide: Crypto wallets chapter with compiled snippets
shai-almog Oct 26, 2026
4b120f2
crypto: clear PMD forbidden rules; ParparVM bulk checks for UInt256, …
shai-almog Oct 26, 2026
b7b0cfa
vm/tests: compile the shared crypto stack into the bulk program
shai-almog Oct 26, 2026
6fa410f
javadoc: no links to client-only classes from shared sources
shai-almog Oct 26, 2026
06404d8
Android: JNI crypto kernels (libcn1crypto.so) added by the builder on…
shai-almog Oct 26, 2026
2d30eb4
crypto: native SHA-256/512, RIPEMD-160, HMAC and PBKDF2 kernels behin…
shai-almog Oct 26, 2026
50abb00
crypto: CryptoBatch - batch verify and hash across every core
shai-almog Oct 26, 2026
f644bbd
Backend API: describe the shared signatures, PBKDF2, batches and nati…
shai-almog Oct 26, 2026
3e17884
crypto-bench.yml: hold the prebuilt Android kernels to their sources
shai-almog Oct 26, 2026
a22c49d
crypto kernels: compile the SHA paths on GCC 12 and clang before 16
shai-almog Oct 27, 2026
cd2d3cb
crypto: packed batches read in place, Keccak on the ARMv8.2 SHA3 inst…
shai-almog Oct 27, 2026
a8812d9
crypto kernels: AVX2 hash groups (4-lane Keccak, 8-lane SHA-256) and …
shai-almog Oct 27, 2026
58601c4
crypto: GPU batches on Metal and Vulkan, shared with the CPU cores
shai-almog Oct 27, 2026
500df24
crypto kernels: define _CRT_RAND_S before the first stdlib.h on Windows
shai-almog Oct 27, 2026
32b8d1b
crypto: asynchronous CryptoBatch, WebGPU batches in the browser, benc…
shai-almog Oct 27, 2026
624459a
crypto: red-team round 1 -- errors reach the callback, WebGPU error s…
shai-almog Oct 27, 2026
40b2989
crypto: red-team round 2 -- one GPU dispatch at a time, retry a faile…
shai-almog Oct 27, 2026
21ed2f5
crypto: red-team round 3 -- bench workflow covers HTML5CryptoEngine, …
shai-almog Oct 27, 2026
ddb9012
Merge origin/master into core-crypto-wallets
shai-almog Oct 27, 2026
fae21ac
crypto: copyright headers on the benchmark sources and EncodingTest
shai-almog Oct 27, 2026
0192d59
crypto: Ed25519 verify with half-length scalars, Karatsuba field prod…
shai-almog Oct 27, 2026
1e871f5
crypto: Ed25519 base table without doublings, divstep inverse, quoted…
shai-almog Oct 27, 2026
a216b7a
crypto: Schnorr.KeyPair, benchmark signs with a prepared key; Bastion…
shai-almog Oct 27, 2026
2fd7887
docs: crypto chapter passes Vale and LanguageTool
shai-almog Oct 27, 2026
5159404
ci: cancel-stale reads a PR too large for pulls.get from the list end…
shai-almog Oct 27, 2026
0b52139
bastion: GuardTest installs its own implementation
shai-almog Oct 27, 2026
1ce1e55
Merge remote-tracking branch 'origin/master' into core-crypto-wallets
shai-almog Oct 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# size limits.
vm/ByteCodeTranslator/src/cn1_sqlite3_amalgamation.h linguist-vendored linguist-generated -diff
vm/ByteCodeTranslator/src/cn1_sqlite3.h linguist-vendored linguist-generated -diff
vm/ByteCodeTranslator/src/cn1_crypto_kernels_amalgamation.h linguist-vendored linguist-generated -diff
Ports/JavaScriptPort/src/main/webapp/js/sqlite3mc.js linguist-vendored -diff
Ports/JavaScriptPort/src/main/webapp/js/sqlite3-opfs-async-proxy.js linguist-vendored -diff

Expand Down
3 changes: 3 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ paths-ignore:
# vm/ByteCodeTranslator/src/cn1_sqlite3_README.md.
- 'vm/ByteCodeTranslator/src/cn1_sqlite3_amalgamation.h'
- 'vm/ByteCodeTranslator/src/cn1_sqlite3.h'
# Vendored libsecp256k1 + ed25519-donna, 4MB generated by
# scripts/crypto-kernels/amalgamate.py; see cn1_crypto_kernels_README.md.
- 'vm/ByteCodeTranslator/src/cn1_crypto_kernels_amalgamation.h'
# Test programs for the in-tree Java compiler. They exercise the language's
# corner cases on purpose -- narrowing compound assignments, overflow, odd
# casts -- so every program there must compile and behave exactly as javac's
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/bastion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ on:
# The device key, request signing, the vault, the shield and the second
# factor are all the core's.
- 'CodenameOne/src/com/codename1/security/**'
- 'CodenameOne/src/com/codename1/crypto/**'
# P-256 runs on the core's big numbers.
- 'CodenameOne/src/com/codename1/util/BigInteger.java'
- 'CodenameOne/src/com/codename1/util/BigDecimal.java'
Expand Down Expand Up @@ -97,6 +98,7 @@ on:
# The device key, request signing, the vault, the shield and the second
# factor are all the core's.
- 'CodenameOne/src/com/codename1/security/**'
- 'CodenameOne/src/com/codename1/crypto/**'
# P-256 runs on the core's big numbers.
- 'CodenameOne/src/com/codename1/util/BigInteger.java'
- 'CodenameOne/src/com/codename1/util/BigDecimal.java'
Expand Down
129 changes: 129 additions & 0 deletions .github/workflows/crypto-bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Crypto benchmarks

# The elliptic-curve and hash kernels of com.codename1.security against the
# libraries a developer would otherwise pick, run side by side on one runner so
# the gate compares RATIOS, which a shared runner's speed does not move:
#
# - jvm: the portable Java engine (JavaSE, the backend's JVM twin, and the
# fallback everywhere) against BouncyCastle and the JDK's own Ed25519;
# - native: the C kernels ParparVM links into an iOS, macOS, Windows, Linux or
# backend binary, against upstream libsecp256k1, libsodium and OpenSSL.
#
# Each fails when a ratio drops below scripts/crypto-bench/floors.json. The
# tables land in the job summary.
#
# gpu runs the GPU batches on Mesa's lavapipe, a Vulkan driver on the CPU,
# result for result against the CPU batches -- correctness, not speed: on a
# runner it is slower than the CPU kernels it is checked against. It also holds
# the committed SPIR-V and MSL to the kernel source (scripts/crypto-gpu/gen.py
# --check) and the hand-declared Vulkan subset to the real headers.
#
# android-kernels holds the committed libcn1crypto.so files to the sources
# they were built from: they are prebuilt (Ports/Android/crypto-jni/build.sh,
# NDK r28+), so a kernel change that is not followed by a rebuild would ship
# old C behind new Java. Their speed on ART is measured by
# scripts/crypto-bench/android-run.sh and reported, not gated.

permissions:
contents: read

on:
workflow_dispatch:
pull_request:
branches:
- master
paths:
- 'CodenameOne/src/com/codename1/security/**'
- 'CodenameOne/src/com/codename1/crypto/**'
- 'vm/ByteCodeTranslator/src/cn1_crypto_kernels*'
- 'vm/ByteCodeTranslator/src/cn1_crypto_gpu*'
- 'scripts/crypto-gpu/**'
- 'Ports/JavaScriptPort/src/main/webapp/js/cn1_crypto_gpu.js'
- 'Ports/JavaScriptPort/src/main/java/com/codename1/impl/html5/HTML5CryptoEngine.java'
- 'scripts/crypto-bench/**'
- 'scripts/crypto-kernels/**'
- 'Ports/Android/crypto-jni/**'
- 'maven/build-engine/src/main/resources/com/codename1/builders/android-crypto/**'
- 'scripts/check-android-crypto-kernels.sh'
- '.github/workflows/crypto-bench.yml'
push:
branches:
- master
paths:
- 'CodenameOne/src/com/codename1/security/**'
- 'CodenameOne/src/com/codename1/crypto/**'
- 'vm/ByteCodeTranslator/src/cn1_crypto_kernels*'
- 'vm/ByteCodeTranslator/src/cn1_crypto_gpu*'
- 'scripts/crypto-gpu/**'
- 'Ports/JavaScriptPort/src/main/webapp/js/cn1_crypto_gpu.js'
- 'Ports/JavaScriptPort/src/main/java/com/codename1/impl/html5/HTML5CryptoEngine.java'
- 'scripts/crypto-bench/**'
- 'scripts/crypto-kernels/**'
- 'Ports/Android/crypto-jni/**'
- 'maven/build-engine/src/main/resources/com/codename1/builders/android-crypto/**'
- 'scripts/check-android-crypto-kernels.sh'
- '.github/workflows/crypto-bench.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
android-kernels:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: The prebuilt Android kernels match their sources
shell: bash
run: scripts/check-android-crypto-kernels.sh

gpu:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: The generated shaders match the kernel source
shell: bash
run: scripts/crypto-gpu/gen.py --check
- name: Install Vulkan, its headers and lavapipe
shell: bash
run: sudo apt-get update -q && sudo apt-get install -y -q clang libvulkan-dev mesa-vulkan-drivers
- name: The hand-declared Vulkan subset matches vulkan_core.h
shell: bash
run: clang -std=c11 -fsyntax-only -I vm/ByteCodeTranslator/src scripts/crypto-gpu/vulkan-abi-check.c
- name: GPU batches against CPU batches on lavapipe
shell: bash
env:
CC: clang
CN1_CRYPTO_GPU_ALLOW_CPU_DEVICE: '1'
run: scripts/crypto-gpu/batch-check.sh 2048 --require-gpu | tee -a "$GITHUB_STEP_SUMMARY"

jvm:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- name: Run the JVM benchmark
shell: bash
run: scripts/crypto-bench/jvm-run.sh "$RUNNER_TEMP/jvm" | tee "$RUNNER_TEMP/jvm.txt"
- name: Hold it to the floors
shell: bash
run: scripts/crypto-bench/gate.py jvm "$RUNNER_TEMP/jvm.txt" | tee -a "$GITHUB_STEP_SUMMARY"

native:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Install the reference libraries
shell: bash
run: sudo apt-get update -q && sudo apt-get install -y -q clang cmake libssl-dev libsodium-dev pkg-config
- name: Run the native benchmark
shell: bash
env:
CC: clang
run: scripts/crypto-bench/native/run.sh "$RUNNER_TEMP/native" | tee "$RUNNER_TEMP/native.txt"
- name: Hold it to the floors
shell: bash
run: scripts/crypto-bench/gate.py native "$RUNNER_TEMP/native.txt" | tee -a "$GITHUB_STEP_SUMMARY"
4 changes: 4 additions & 0 deletions .github/workflows/parparvm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ on:
- 'CodenameOne/src/com/codename1/security/Otp.java'
- 'CodenameOne/src/com/codename1/security/Base32.java'
- 'CodenameOne/src/com/codename1/security/CryptoException.java'
- 'CodenameOne/src/com/codename1/security/**'
- 'CodenameOne/src/com/codename1/crypto/**'
- '!vm/**/README.md'
- '!vm/**/readme.md'
- '!vm/**/docs/**'
Expand Down Expand Up @@ -135,6 +137,8 @@ on:
- 'CodenameOne/src/com/codename1/security/Otp.java'
- 'CodenameOne/src/com/codename1/security/Base32.java'
- 'CodenameOne/src/com/codename1/security/CryptoException.java'
- 'CodenameOne/src/com/codename1/security/**'
- 'CodenameOne/src/com/codename1/crypto/**'
- '!vm/**/README.md'
- '!vm/**/readme.md'
- '!vm/**/docs/**'
Expand Down
Loading