Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
tag_name: ${{ github.ref }}
generate_release_notes: true
files: |
build/noiseprotocol.lua
build/noiseprotocol.lua
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ help:
@echo " make bench-<name> - Run specific benchmark (e.g., make bench-x25519)"
@echo ""
@echo "Building:"
@echo " make build - Build single-file distributions"
@echo " make build - Build single-file distribution"
@echo ""
@echo "Code Quality:"
@echo " make format - Format all code (Lua)"
Expand Down
8 changes: 4 additions & 4 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

# Noise Protocol Library Test Runner
# Runs all test suites for ChaCha20, Poly1305, and ChaCha20-Poly1305 AEAD
#
# Usage: ./run_tests.sh [module_names...]
#
Expand Down Expand Up @@ -45,7 +44,7 @@ script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)

# Add repository root to Lua's package path
# This allows require() to find modules in the src/tests directories
lua_path="$script_dir/?.lua;$script_dir/?/init.lua;$script_dir/src/?.lua;$script_dir/src/?/init.lua;$LUA_PATH"
lua_path="$script_dir/?.lua;$script_dir/?/init.lua;$script_dir/src/?.lua;$script_dir/src/?/init.lua;$script_dir/tests/?.lua;$script_dir/vendor/?.lua;$LUA_PATH"

# Define noise vector files
vectors_dir="${NOISE_VECTORS_DIR:=vectors_sampled}"
Expand Down Expand Up @@ -133,8 +132,6 @@ run_selftest() {
"
}

run_selftest "Utils - 32-bit operations" "utils_bit32" "noiseprotocol.utils.bit32"
run_selftest "Utils - 64-bit operations" "utils_bit64" "noiseprotocol.utils.bit64"
run_selftest "Utils - Byte operations" "utils_bytes" "noiseprotocol.utils.bytes"
run_selftest "Poly1305 MAC" "poly1305" "noiseprotocol.crypto.poly1305"
run_selftest "ChaCha20 Stream Cipher" "chacha20" "noiseprotocol.crypto.chacha20"
Expand Down Expand Up @@ -300,6 +297,9 @@ total_count=$((passed_count + failed_count))

# If only one module is run, no need to summarize
if [ $total_count -eq 1 ]; then
if [ $failed_count -gt 0 ]; then
exit 1
fi
exit 0
fi

Expand Down
3 changes: 2 additions & 1 deletion src/noiseprotocol/crypto/aes_gcm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
--- AES-GCM Authenticated Encryption with Associated Data (AEAD) Implementation for portability.
local aes_gcm = {}

local bit32 = require("vendor.bitn").bit32

local openssl_wrapper = require("noiseprotocol.openssl_wrapper")
local utils = require("noiseprotocol.utils")
local bit32 = utils.bit32
local bytes = utils.bytes
local benchmark_op = utils.benchmark.benchmark_op

Expand Down
6 changes: 4 additions & 2 deletions src/noiseprotocol/crypto/blake2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
--- Pure Lua BLAKE2s and BLAKE2b Implementation for portability.
local blake2 = {}

local bitn = require("vendor.bitn")
local bit32 = bitn.bit32
local bit64 = bitn.bit64

local openssl_wrapper = require("noiseprotocol.openssl_wrapper")
local utils = require("noiseprotocol.utils")
local bit32 = utils.bit32
local bit64 = utils.bit64
local bytes = utils.bytes
local benchmark_op = utils.benchmark.benchmark_op

Expand Down
3 changes: 2 additions & 1 deletion src/noiseprotocol/crypto/chacha20.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
--- ChaCha20 Stream Cipher Implementation for portability.
local chacha20 = {}

local bit32 = require("vendor.bitn").bit32

local openssl_wrapper = require("noiseprotocol.openssl_wrapper")
local utils = require("noiseprotocol.utils")
local bit32 = utils.bit32
local bytes = utils.bytes
local benchmark_op = utils.benchmark.benchmark_op

Expand Down
3 changes: 2 additions & 1 deletion src/noiseprotocol/crypto/poly1305.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
--- Poly1305 Message Authentication Code (MAC) Implementation for portability.
local poly1305 = {}

local bit32 = require("vendor.bitn").bit32

local utils = require("noiseprotocol.utils")
local bit32 = utils.bit32
local bytes = utils.bytes
local benchmark_op = utils.benchmark.benchmark_op

Expand Down
3 changes: 2 additions & 1 deletion src/noiseprotocol/crypto/sha256.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
--- Pure Lua SHA-256 Implementation for portability.
local sha256 = {}

local bit32 = require("vendor.bitn").bit32

local openssl_wrapper = require("noiseprotocol.openssl_wrapper")
local utils = require("noiseprotocol.utils")
local bit32 = utils.bit32
local bytes = utils.bytes
local benchmark_op = utils.benchmark.benchmark_op

Expand Down
6 changes: 4 additions & 2 deletions src/noiseprotocol/crypto/sha512.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
--- Pure Lua SHA-512 Implementation for portability.
local sha512 = {}

local bitn = require("vendor.bitn")
local bit32 = bitn.bit32
local bit64 = bitn.bit64

local openssl_wrapper = require("noiseprotocol.openssl_wrapper")
local utils = require("noiseprotocol.utils")
local bit32 = utils.bit32
local bit64 = utils.bit64
local bytes = utils.bytes
local benchmark_op = utils.benchmark.benchmark_op

Expand Down
3 changes: 2 additions & 1 deletion src/noiseprotocol/crypto/x25519.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
--- X25519 Curve25519 Elliptic Curve Diffie-Hellman Implementation for portability.
local x25519 = {}

local bit32 = require("vendor.bitn").bit32

local utils = require("noiseprotocol.utils")
local bit32 = utils.bit32
local bytes = utils.bytes
local benchmark_op = utils.benchmark.benchmark_op

Expand Down
10 changes: 6 additions & 4 deletions src/noiseprotocol/crypto/x448.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
--- - Key generation and Diffie-Hellman operations
local x448 = {}

local bitn = require("vendor.bitn")
local band = bitn.bit32.band
local bor = bitn.bit32.bor
local bxor = bitn.bit32.bxor
local rshift = bitn.bit32.rshift

local utils = require("noiseprotocol.utils")
local bytes = utils.bytes
local benchmark_op = utils.benchmark.benchmark_op
local band = utils.bit32.band
local bor = utils.bit32.bor
local bxor = utils.bit32.bxor
local rshift = utils.bit32.rshift
local floor = math.floor
local char = string.char
local byte = string.byte
Expand Down
Loading
Loading