Skip to content

lua-openssl: update to 0.11.1#29236

Open
amnonpaz wants to merge 1 commit intoopenwrt:masterfrom
amnonpaz:lua-openssl-update-0.11.1
Open

lua-openssl: update to 0.11.1#29236
amnonpaz wants to merge 1 commit intoopenwrt:masterfrom
amnonpaz:lua-openssl-update-0.11.1

Conversation

@amnonpaz
Copy link
Copy Markdown
Contributor

📦 Package Details

Maintainer: @amnonpaz

Description:
Update lua-openssl package from 0.10.0-0 to 0.11.1


🧪 Run Testing Details

  • OpenWrt Version: latest
  • OpenWrt Target/Subtarget: x86_64
  • OpenWrt Device: Qemu

Test script:

-- lua-openssl functional test

local ok, openssl = pcall(require, "openssl")
if not ok then
    error("Failed to load openssl module")
end

print("OpenSSL version:", openssl.version())

-- 1. Random bytes (version-tolerant)
do
    local rand
    if openssl.rand and openssl.rand.bytes then
        rand = openssl.rand.bytes(16)
    elseif openssl.random then
        rand = openssl.random(16)
    elseif openssl.rand_bytes then
        rand = openssl.rand_bytes(16)
    else
        error("No RNG function found in openssl module")
    end

    assert(rand and #rand == 16, "RAND failed")
    print("[OK] Random bytes generated")
end

-- 2. SHA256 hash (correct for 0.11.x)
do
    local hash

    if openssl.digest and openssl.digest.new then
        local d = openssl.digest.new("sha256")
        hash = d:final("hello world", true)
    elseif openssl.digest and openssl.digest then
        hash = openssl.digest("sha256", "hello world", true)
    end

    assert(hash and #hash == 32, "SHA256 failed")
    print("[OK] SHA256 works")
end

-- 3. RSA key generation
local pkey
do
    pkey = openssl.pkey.new("rsa", 2048)
    assert(pkey, "RSA key generation failed")
    print("[OK] RSA key generated")
end

-- 4. Sign / verify
do
    local data = "test message"
    local sig = pkey:sign(data, "sha256")
    assert(sig, "Signing failed")

    local ok = pkey:verify(data, sig, "sha256")
    assert(ok, "Signature verification failed")

    print("[OK] Sign/verify works")
end

-- 5. Self-signed certificate
local cert
do
    local name = openssl.x509.name.new({ { CN = "test.local" } })

    cert = openssl.x509.new()
    cert:subject(name)
    cert:pubkey(pkey)
    cert:notbefore(os.time())
    cert:notafter(os.time() + 3600)
    assert(cert:sign(pkey, name, "sha256"), "x509 sign failed")

    print("[OK] Self-signed certificate created")
end

-- 6. PEM encode/decode
do
    local pem = cert:export("pem")
    assert(pem:find("BEGIN CERTIFICATE"), "PEM export failed")

    local cert2 = openssl.x509.read(pem)
    assert(cert2, "PEM parse failed")

    print("[OK] PEM encode/decode works")
end

print("\nAll tests passed successfully.")

Results:

OpenSSL version:	0.11.1	Lua 5.1	OpenSSL 3.5.6 7 Apr 2026
[OK] Random bytes generated
[OK] SHA256 works
[OK] RSA key generated
[OK] Sign/verify works
[OK] Self-signed certificate created
[OK] PEM encode/decode works

✅ Formalities

  • [ X] I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

If your PR contains a patch:

  • It can be applied using git am
  • It has been refreshed to avoid offsets, fuzzes, etc., using
    make package/<your-package>/refresh V=s
  • It is structured in a way that it is potentially upstreamable
    (e.g., subject line, commit description, etc.)
    We must try to upstream patches to reduce maintenance burden.

@amnonpaz amnonpaz force-pushed the lua-openssl-update-0.11.1 branch from 0e8b4d2 to eba6460 Compare April 25, 2026 13:11
Update Makefile with the version
Remove LuaJIT fix patch - No longer needed
Add "ts-time-cb-signature" patch - Fixes build on various platforms

Signed-off-by: Amnon Paz <[email protected]>
@amnonpaz amnonpaz force-pushed the lua-openssl-update-0.11.1 branch from eba6460 to 4481d11 Compare April 25, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant