From 502c648fc9fa36800a19695297fe1a35cd7c9c47 Mon Sep 17 00:00:00 2001 From: hanez Date: Fri, 3 Apr 2026 18:55:52 +0200 Subject: [PATCH] Removed all libressl support. (0.40.2) --- CMakeLists.txt | 2 +- cmake/Extensions/Extensions.cmake | 2 - cmake/Targets.cmake | 6 +- docs/README.md | 5 +- docs/build.md | 4 +- docs/external/libressl.md | 46 +------------ examples/external/libressl/libressl_md5.fun | 28 -------- .../external/libressl/libressl_ripemd160.fun | 28 -------- .../external/libressl/libressl_sha256.fun | 28 -------- .../external/libressl/libressl_sha512.fun | 28 -------- src/bytecode.c | 8 --- src/bytecode.h | 5 -- src/parser.c | 66 +------------------ src/vm.c | 8 --- 14 files changed, 7 insertions(+), 257 deletions(-) delete mode 100755 examples/external/libressl/libressl_md5.fun delete mode 100755 examples/external/libressl/libressl_ripemd160.fun delete mode 100755 examples/external/libressl/libressl_sha256.fun delete mode 100755 examples/external/libressl/libressl_sha512.fun diff --git a/CMakeLists.txt b/CMakeLists.txt index 816b1b5..249aada 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(fun VERSION 0.40.1 LANGUAGES C) +project(fun VERSION 0.40.2 LANGUAGES C) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) diff --git a/cmake/Extensions/Extensions.cmake b/cmake/Extensions/Extensions.cmake index 92843b6..b16333b 100644 --- a/cmake/Extensions/Extensions.cmake +++ b/cmake/Extensions/Extensions.cmake @@ -23,7 +23,6 @@ include(${CMAKE_SOURCE_DIR}/cmake/Extensions/CURL.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Extensions/NOTCURSES.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Extensions/REPL.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Extensions/OPENSSL.cmake) -include(${CMAKE_SOURCE_DIR}/cmake/Extensions/LIBRESSL.cmake) # Summary of extension toggles message(STATUS "---- Fun extension summary ----") @@ -39,5 +38,4 @@ _fun_print_feature("libcurl (FUN_WITH_CURL)" FUN_WITH_CURL) _fun_print_feature("Notcurses (FUN_WITH_NOTCURSES)" FUN_WITH_NOTCURSES) _fun_print_feature("REPL (FUN_WITH_REPL)" FUN_WITH_REPL) _fun_print_feature("OpenSSL (FUN_WITH_OPENSSL)" FUN_WITH_OPENSSL) -_fun_print_feature("LibreSSL (FUN_WITH_LIBRESSL)" FUN_WITH_LIBRESSL) message(STATUS "--------------------------------") diff --git a/cmake/Targets.cmake b/cmake/Targets.cmake index 2184b30..4a73e0b 100644 --- a/cmake/Targets.cmake +++ b/cmake/Targets.cmake @@ -37,8 +37,7 @@ foreach(var_pair LIBXML2 TCL NOTCURSES - OPENSSL - LIBRESSL) + OPENSSL) if(${var_pair}_INCLUDE_DIRS) target_include_directories(fun_core PRIVATE ${${var_pair}_INCLUDE_DIRS}) endif() @@ -97,9 +96,6 @@ endif() # LibreSSL toggle: ensure compile definitions are applied to fun_core so # the LibreSSL code paths are compiled, and linking vars are handled above. -if(FUN_WITH_LIBRESSL) - target_compile_definitions(fun_core PUBLIC FUN_WITH_LIBRESSL=1) -endif() # Workaround: provide a dummy rust_eh_personality to satisfy linker when using # no_std Rust staticlib with panic abort (some toolchains still reference it). diff --git a/docs/README.md b/docs/README.md index d0cbc19..1d8e140 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,7 +21,7 @@ This file serves as an index of the documents in this directory. Links are relat ## New and supplemental guides -- [build.md](./build.md) - How to build Fun with CMake, available targets, and build options (FUN_DEBUG, FUN_USE_MUSL, FUN_WITH_CPP, FUN_WITH_RUST, FUN_WITH_OPENSSL, FUN_WITH_LIBRESSL). +- [build.md](./build.md) - How to build Fun with CMake, available targets, and build options (FUN_DEBUG, FUN_USE_MUSL, FUN_WITH_CPP, FUN_WITH_RUST, FUN_WITH_OPENSSL). - [cli.md](./cli.md) - Command-line usage of the `fun` executable: synopsis, options, exit codes, includes and library paths. - [fun.md](./fun.md) - Full usage guide for the `fun` executable: invocation patterns, REPL, env vars, include paths, examples, and install locations. - [asyncio.md](./asyncio.md) - Async I/O primitives and patterns: non-blocking sockets, fd polling, examples, and best practices. @@ -47,7 +47,7 @@ This file serves as an index of the documents in this directory. Links are relat Documentation for optional, build-time selectable integrations lives in [external/](./external/): - [Index of extensions](./external/README.md) - - Highlights: [cURL](./external/curl.md), [INI](./external/ini.md), [JSON](./external/json.md), [XML (libxml2)](./external/xml2.md), [SQLite](./external/sqlite.md), [libSQL](./external/libsql.md), [PCRE2](./external/pcre2.md), [PC/SC](./external/pcsc.md), [Notcurses](./external/notcurses.md), [Tcl/Tk](./external/tcltk.md), [OpenSSL](./external/openssl.md), [LibreSSL](./external/libressl.md) + - Highlights: [cURL](./external/curl.md), [INI](./external/ini.md), [JSON](./external/json.md), [XML (libxml2)](./external/xml2.md), [SQLite](./external/sqlite.md), [libSQL](./external/libsql.md), [PCRE2](./external/pcre2.md), [PC/SC](./external/pcsc.md), [Notcurses](./external/notcurses.md), [Tcl/Tk](./external/tcltk.md), [OpenSSL](./external/openssl.md) ## Tips @@ -55,4 +55,3 @@ Documentation for optional, build-time selectable integrations lives in [externa - For a broader project overview and quickstart, see the repository root [README.md](../README.md). - Crypto examples: - If built with `-DFUN_WITH_OPENSSL=ON`, try `examples/crypto/openssl_md5.fun`. - - If built with `-DFUN_WITH_LIBRESSL=ON`, try `examples/crypto/libressl_md5.fun`. diff --git a/docs/build.md b/docs/build.md index 04c45a0..9fb92d6 100644 --- a/docs/build.md +++ b/docs/build.md @@ -23,7 +23,6 @@ Fun exposes several options you can toggle at configure time: - `FUN_WITH_CPP` (ON/OFF) - Enable C++-based opcode/examples support - `FUN_WITH_RUST` (ON/OFF) - Build and link Rust staticlib from `src/rust/` - `FUN_WITH_OPENSSL` (ON/OFF) - Enable OpenSSL-backed helpers (MD5/SHA-256/SHA-512/RIPEMD-160) -- `FUN_WITH_LIBRESSL` (ON/OFF) - Enable LibreSSL-backed helpers (MD5/SHA-256/SHA-512/RIPEMD-160) When configuring, the build prints a summary like: @@ -56,7 +55,7 @@ cmake --build build_release --target build ### Enabling optional extensions ``` cmake -S . -B build_release -DCMAKE_BUILD_TYPE=Release \ - -DFUN_WITH_CPP=ON -DFUN_WITH_RUST=ON -DFUN_WITH_OPENSSL=ON -DFUN_WITH_LIBRESSL=ON + -DFUN_WITH_CPP=ON -DFUN_WITH_RUST=ON -DFUN_WITH_OPENSSL=ON cmake --build build_release --target build ``` @@ -64,7 +63,6 @@ If `FUN_WITH_RUST` is enabled, ensure `cargo` is available in PATH; the build wi If `FUN_WITH_OPENSSL` is enabled, CMake must detect your system OpenSSL (libcrypto). -If `FUN_WITH_LIBRESSL` is enabled, CMake detects LibreSSL directly (via pkg-config or standard include/lib locations) and links to LibreSSL's `libcrypto` — no OpenSSL installation is required. Both extensions use the EVP interface. Note: On OpenSSL 3.x, RIPEMD-160 may require the legacy provider; if unavailable, the helper returns an empty string. ## Running - CLI: run the `fun` executable from your build directory. diff --git a/docs/external/libressl.md b/docs/external/libressl.md index 388c69a..fe38c79 100644 --- a/docs/external/libressl.md +++ b/docs/external/libressl.md @@ -1,45 +1 @@ -# LibreSSL extension (optional) - -- CMake option: FUN_WITH_LIBRESSL=ON -- Purpose: provide small crypto helpers backed by LibreSSL's libcrypto. Includes md5, sha256, sha512, ripemd160 helpers under libressl_* names. -- Homepage: https://www.libressl.org/ - -## Build notes: - -- Requires system LibreSSL development headers and libcrypto. The build detects LibreSSL directly (via pkg-config or standard include/lib locations) and links to libcrypto from LibreSSL — it does not require OpenSSL to be installed. -- When disabled, the builtins below evaluate to empty strings to mirror optionality behavior across extensions. - -## Provided helper functions/opcodes: - -- Function: libressl_md5(data:string) -> string (lowercase hex). -- Function: libressl_sha256(data:string) -> string (lowercase hex). -- Function: libressl_sha512(data:string) -> string (lowercase hex). -- Function: libressl_ripemd160(data:string) -> string (lowercase hex). -- Opcodes: OP_LIBRESSL_MD5, OP_LIBRESSL_SHA256, OP_LIBRESSL_SHA512, OP_LIBRESSL_RIPEMD160 (internal mappings for the functions above). - -## Quickstart: - -- Configure: `cmake -S . -B build -DFUN_WITH_LIBRESSL=ON` -- Build: `cmake --build build --target fun` -- Run examples: - - `./build/fun examples/crypto/libressl_md5.fun` - - `./build/fun examples/crypto/libressl_sha256.fun` - - `./build/fun examples/crypto/libressl_sha512.fun` - - `./build/fun examples/crypto/libressl_ripemd160.fun` - -## Example output: - -- md5(abc) = 900150983cd24fb0d6963f7d28e17f72 -- md5("") = d41d8cd98f00b204e9800998ecf8427e -- sha256(abc) = ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad -- sha256("") = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -- sha512(abc) = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f -- sha512("") = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e -- ripemd160(abc) = 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc -- ripemd160("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31 - -## Notes: - -- The functions accept any Fun value; non-strings are coerced via `to_string` semantics by the VM before hashing. -- On some platforms, RIPEMD-160 may not be available; in that case the helper returns an empty string. -- If your system installs LibreSSL headers under `/usr/include/libressl`, CMake will automatically add this directory to the include path so that `#include ` resolves correctly. +This page has been removed. LibreSSL integration was dropped from the Fun project, along with related examples and build options. diff --git a/examples/external/libressl/libressl_md5.fun b/examples/external/libressl/libressl_md5.fun deleted file mode 100755 index 24b3740..0000000 --- a/examples/external/libressl/libressl_md5.fun +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env fun - -/* - * This file is part of the Fun programming language. - * https://fun-lang.xyz/ - * - * Copyright 2026 Johannes Findeisen - * Licensed under the terms of the Apache-2.0 license. - * https://opensource.org/license/apache-2-0 - * - * Added: 2026-02-19 - */ - -// LibreSSL MD5 example -// Enable with -DFUN_WITH_LIBRESSL=ON during build for real hashing. - -s = "abc" -d = libressl_md5(s) -print("md5(abc) = " + d) - -// Another quick check (empty string) -e = "" -print("md5(\"\") = " + libressl_md5(e)) - -/* Expected output: -md5(abc) = 900150983cd24fb0d6963f7d28e17f72 -md5("") = d41d8cd98f00b204e9800998ecf8427e -*/ diff --git a/examples/external/libressl/libressl_ripemd160.fun b/examples/external/libressl/libressl_ripemd160.fun deleted file mode 100755 index 437e6e1..0000000 --- a/examples/external/libressl/libressl_ripemd160.fun +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env fun - -/* - * This file is part of the Fun programming language. - * https://fun-lang.xyz/ - * - * Copyright 2026 Johannes Findeisen - * Licensed under the terms of the Apache-2.0 license. - * https://opensource.org/license/apache-2-0 - * - * Added: 2026-02-19 - */ - -// LibreSSL RIPEMD-160 example -// Enable with -DFUN_WITH_LIBRESSL=ON during build for real hashing. - -s = "abc" -d = libressl_ripemd160(s) -print("ripemd160(abc) = " + d) - -// Another quick check (empty string) -e = "" -print("ripemd160(\"\") = " + libressl_ripemd160(e)) - -/* Expected output: -ripemd160(abc) = 8eb208f7e05d987a9b049a9a5c0c2b74e07e6a5d -ripemd160("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31 -*/ diff --git a/examples/external/libressl/libressl_sha256.fun b/examples/external/libressl/libressl_sha256.fun deleted file mode 100755 index a51baed..0000000 --- a/examples/external/libressl/libressl_sha256.fun +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env fun - -/* - * This file is part of the Fun programming language. - * https://fun-lang.xyz/ - * - * Copyright 2026 Johannes Findeisen - * Licensed under the terms of the Apache-2.0 license. - * https://opensource.org/license/apache-2-0 - * - * Added: 2026-02-19 - */ - -// LibreSSL SHA-256 example -// Enable with -DFUN_WITH_LIBRESSL=ON during build for real hashing. - -s = "abc" -d = libressl_sha256(s) -print("sha256(abc) = " + d) - -// Another quick check (empty string) -e = "" -print("sha256(\"\") = " + libressl_sha256(e)) - -/* Expected output: -sha256(abc) = ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad -sha256("") = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -*/ diff --git a/examples/external/libressl/libressl_sha512.fun b/examples/external/libressl/libressl_sha512.fun deleted file mode 100755 index 525dbcf..0000000 --- a/examples/external/libressl/libressl_sha512.fun +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env fun - -/* - * This file is part of the Fun programming language. - * https://fun-lang.xyz/ - * - * Copyright 2026 Johannes Findeisen - * Licensed under the terms of the Apache-2.0 license. - * https://opensource.org/license/apache-2-0 - * - * Added: 2026-02-19 - */ - -// LibreSSL SHA-512 example -// Enable with -DFUN_WITH_LIBRESSL=ON during build for real hashing. - -s = "abc" -d = libressl_sha512(s) -print("sha512(abc) = " + d) - -// Another quick check (empty string) -e = "" -print("sha512(\"\") = " + libressl_sha512(e)) - -/* Expected output: -sha512(abc) = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f -sha512("") = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e -*/ diff --git a/src/bytecode.c b/src/bytecode.c index 7173f91..e3ed017 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -291,14 +291,6 @@ static const char *opcode_name(OpCode op) { return "OPENSSL_SHA512"; case OP_OPENSSL_RIPEMD160: return "OPENSSL_RIPEMD160"; - case OP_LIBRESSL_MD5: - return "LIBRESSL_MD5"; - case OP_LIBRESSL_SHA256: - return "LIBRESSL_SHA256"; - case OP_LIBRESSL_SHA512: - return "LIBRESSL_SHA512"; - case OP_LIBRESSL_RIPEMD160: - return "LIBRESSL_RIPEMD160"; case OP_INI_LOAD: return "INI_LOAD"; case OP_INI_FREE: diff --git a/src/bytecode.h b/src/bytecode.h index cacf59f..64349d2 100644 --- a/src/bytecode.h +++ b/src/bytecode.h @@ -187,11 +187,6 @@ typedef enum { OP_OPENSSL_SHA512, // pops data string; pushes sha512 hex string OP_OPENSSL_RIPEMD160, // pops data string; pushes ripemd160 hex string - // LibreSSL (optional; same API as OpenSSL but different toggle) - OP_LIBRESSL_MD5, // pops data string; pushes md5 hex string - OP_LIBRESSL_SHA256, // pops data string; pushes sha256 hex string - OP_LIBRESSL_SHA512, // pops data string; pushes sha512 hex string - OP_LIBRESSL_RIPEMD160, // pops data string; pushes ripemd160 hex string // INI (iniparser 4.2.6) optional OP_INI_LOAD, // pops path; pushes handle (>0) or 0 diff --git a/src/parser.c b/src/parser.c index cb192bb..85b1fbe 100644 --- a/src/parser.c +++ b/src/parser.c @@ -2295,71 +2295,7 @@ static int emit_primary(Bytecode *bc, const char *src, size_t len, size_t *pos) free(name); return 1; } - /* LibreSSL (md5/sha256/sha512/ripemd160) */ - if (strcmp(name, "libressl_md5") == 0) { - (*pos)++; /* '(' */ - if (!emit_expression(bc, src, len, pos)) { - parser_fail(*pos, "libressl_md5 expects (data)"); - free(name); - return 0; - } - if (!consume_char(src, len, pos, ')')) { - parser_fail(*pos, "Expected ')' after libressl_md5 arg"); - free(name); - return 0; - } - bytecode_add_instruction(bc, OP_LIBRESSL_MD5, 0); - free(name); - return 1; - } - if (strcmp(name, "libressl_sha256") == 0) { - (*pos)++; /* '(' */ - if (!emit_expression(bc, src, len, pos)) { - parser_fail(*pos, "libressl_sha256 expects (data)"); - free(name); - return 0; - } - if (!consume_char(src, len, pos, ')')) { - parser_fail(*pos, "Expected ')' after libressl_sha256 arg"); - free(name); - return 0; - } - bytecode_add_instruction(bc, OP_LIBRESSL_SHA256, 0); - free(name); - return 1; - } - if (strcmp(name, "libressl_sha512") == 0) { - (*pos)++; /* '(' */ - if (!emit_expression(bc, src, len, pos)) { - parser_fail(*pos, "libressl_sha512 expects (data)"); - free(name); - return 0; - } - if (!consume_char(src, len, pos, ')')) { - parser_fail(*pos, "Expected ')' after libressl_sha512 arg"); - free(name); - return 0; - } - bytecode_add_instruction(bc, OP_LIBRESSL_SHA512, 0); - free(name); - return 1; - } - if (strcmp(name, "libressl_ripemd160") == 0) { - (*pos)++; /* '(' */ - if (!emit_expression(bc, src, len, pos)) { - parser_fail(*pos, "libressl_ripemd160 expects (data)"); - free(name); - return 0; - } - if (!consume_char(src, len, pos, ')')) { - parser_fail(*pos, "Expected ')' after libressl_ripemd160 arg"); - free(name); - return 0; - } - bytecode_add_instruction(bc, OP_LIBRESSL_RIPEMD160, 0); - free(name); - return 1; - } + /* LibreSSL builtins removed */ /* PCSC builtins */ if (strcmp(name, "pcsc_establish") == 0) { (*pos)++; /* '(' */ diff --git a/src/vm.c b/src/vm.c index 51468ce..416f252 100644 --- a/src/vm.c +++ b/src/vm.c @@ -70,7 +70,6 @@ /* Note: INI opcode handlers are included below; changes in vm/ini/ .c files * require vm.c to rebuild. */ #include "external/json.c" -#include "external/libressl.c" #include "external/libsql.c" #include "external/openssl.c" #include "external/pcre2.c" @@ -851,13 +850,6 @@ void vm_run(VM *vm, Bytecode *entry) { #include "vm/openssl/sha512.c" #endif -/* LibreSSL ops (md5/sha256/sha512/ripemd160) */ -#ifdef FUN_WITH_LIBRESSL -#include "vm/libressl/md5.c" -#include "vm/libressl/ripemd160.c" -#include "vm/libressl/sha256.c" -#include "vm/libressl/sha512.c" -#endif /* Tk (Tcl/Tk) ops */ #ifdef FUN_WITH_TCLTK