Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e1da3d3
json: add nlohmann/json as vendored single-header (foundation for #2366)
ronaldtse Jul 27, 2026
71b4991
rnp: migrate rnp_supported_features to nlohmann::json
ronaldtse Jul 27, 2026
1b8f121
rnp: migrate rnp_generate_key_json request parsing to nlohmann::json
ronaldtse Jul 27, 2026
8596fce
rnp: migrate rnp_import_keys and rnp_import_signatures to nlohmann::json
ronaldtse Jul 27, 2026
fd8391a
rnp: migrate dump_key_to_json and helpers to nlohmann::json
ronaldtse Jul 27, 2026
43aee0d
stream-dump: migrate DumpContextJson class to nlohmann::json
ronaldtse Jul 27, 2026
b11a4de
fficli, rnpkeys: migrate CLI to nlohmann::json
ronaldtse Jul 27, 2026
ee5e65d
tests/support: migrate check_json_field_* helpers to nlohmann::json
ronaldtse Jul 27, 2026
8e87945
tests: bulk mechanical migration of test files to nlohmann::json
ronaldtse Jul 27, 2026
51587fb
json: remove json-c dependency entirely from production code
ronaldtse Jul 27, 2026
da4f6cf
tests: complete migration to nlohmann::json (build green)
ronaldtse Jul 27, 2026
beabccf
ci: exclude vendored nlohmann/json from typos lint
ronaldtse Jul 27, 2026
f8dcae5
rnp: fix MSVC va_start with reference arg in add_json_mpis
ronaldtse Jul 27, 2026
9721c09
rnp: fix behavioral regressions from nlohmann::json migration
ronaldtse Jul 27, 2026
9e2719e
ci: exclude vendored nlohmann/json from clang-format lint
ronaldtse Jul 27, 2026
e5710f2
style: clang-format v11 files touched by json migration
ronaldtse Jul 27, 2026
33ef70c
ci: drop json-c-devel install from CentOS/Fedora RPM tests
ronaldtse Jul 28, 2026
e911991
ci: exclude vendored nlohmann/json from codecov coverage
ronaldtse Jul 28, 2026
eacf166
json: replace for-loop with while-loop in dump_pretty to fix CodeQL #614
ronaldtse Jul 29, 2026
871fe76
style: clang-format v11 json-utils.cpp
ronaldtse Jul 29, 2026
4de0fae
cmake: remove duplicated CMAKE_MODULE_PATH restore in rnp-config
ronaldtse Aug 30, 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
4 changes: 0 additions & 4 deletions .github/workflows/centos-and-fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,6 @@ jobs:
wget https://github.com/Kitware/CMake/releases/download/v3.12.0/cmake-3.12.0-Linux-x86_64.sh -O cmake/cmake.sh
sudo sh cmake/cmake.sh --skip-license --prefix=/usr/local

# el8, el9, fr35, fr36 provide json-c-devel (version 12+)
- name: Setup json-c
run: sudo yum -y install json-c-devel

- name: Run packaging tests
run: |
chmod +x ci/tests/pk-tests.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
if: ${{ matrix.language == 'cpp' }}
run: |
sudo apt-get update
sudo apt-get install --yes libbz2-dev libjson-c-dev libgtest-dev
sudo apt-get install --yes libbz2-dev libgtest-dev

- name: After Prepare (cpp)
if: ${{ matrix.language == 'cpp' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: |
apt-get -y update
apt-get -y install git bash build-essential autoconf automake clang cmake \
zlib1g-dev libbz2-dev libjson-c-dev libbotan-3-dev asciidoctor curl
zlib1g-dev libbz2-dev libbotan-3-dev asciidoctor curl

- name: Checkout
uses: actions/checkout@v7
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- uses: DoozyX/clang-format-lint-action@v0.20
with:
clangFormatVersion: 11.1.0
exclude: './src/lib/nlohmann'
shellcheck:
runs-on: ubuntu-latest
steps:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
# Already installed on GHA: build-essential libbz2-dev zlib1g-dev
run: |
sudo apt-get -y update
sudo apt-get -y install cmake libbz2-dev libjson-c-dev ${{ matrix.backend.package }} asciidoctor
sudo apt-get -y install cmake libbz2-dev ${{ matrix.backend.package }} asciidoctor

- name: Configure
run: |
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install cmake libbz2-dev libjson-c-dev libbotan-2-dev asciidoctor googletest
sudo apt-get -y install cmake libbz2-dev libbotan-2-dev asciidoctor googletest

- name: Configure
run: |
Expand Down Expand Up @@ -196,7 +196,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install cmake libbz2-dev libjson-c-dev libbotan-2-dev asciidoctor googletest
sudo apt-get -y install cmake libbz2-dev libbotan-2-dev asciidoctor googletest

- name: Build googletest
run: |
Expand Down Expand Up @@ -243,7 +243,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install cmake libbz2-dev libjson-c-dev libbotan-2-dev asciidoctor
sudo apt-get -y install cmake libbz2-dev libbotan-2-dev asciidoctor

- name: Checkout sexpp
uses: actions/checkout@v7
Expand Down Expand Up @@ -308,7 +308,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install cmake libbz2-dev libjson-c-dev libbotan-2-dev asciidoctor
sudo apt-get -y install cmake libbz2-dev libbotan-2-dev asciidoctor

- name: Configure
run: |
Expand Down Expand Up @@ -345,7 +345,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install cmake libbz2-dev libjson-c-dev libbotan-2-dev asciidoctor
sudo apt-get -y install cmake libbz2-dev libbotan-2-dev asciidoctor

- name: Download source package
uses: actions/download-artifact@v8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
toolchain:p
cmake:p
${{ matrix.backend.lib }}:p
json-c:p

asciidoctor:p
gtest:p
path-type: minimal
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
export SystemDrive="$SYSTEMDRIVE"
export SystemRoot="$SYSTEMROOT"
export windir="$WINDIR"
vcpkg install --triplet ${{ matrix.arch.triplet }} bzip2 zlib json-c getopt dirent ${{ matrix.backend }}
vcpkg install --triplet ${{ matrix.arch.triplet }} bzip2 zlib getopt dirent ${{ matrix.backend }}

- name: Upload vcpkg logs on failure
if: failure()
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ option(ENABLE_SANITIZERS "Enable ASan and other sanitizers.")
option(ENABLE_FUZZERS "Enable fuzz targets.")
option(DOWNLOAD_GTEST "Download Googletest" On)
option(SYSTEM_LIBSEXPP "Use system sexpp library" OFF)
# nlohmann/json is vendored as a single-header under src/lib/nlohmann/ — see
# JSON_VENDORED below. This option is kept for documentation only; if set to
# ON it would let a downstream consumer override the vendored copy via
# find_package(nlohmann_json), but the project itself always vendors.
set(JSON_VENDORED ON CACHE BOOL "Use vendored nlohmann/json (single-header under src/lib/nlohmann/)" FORCE)

# crypto components
function(tristate_feature_auto NAME DESCRIPTION)
Expand Down Expand Up @@ -250,6 +255,11 @@ else (SYSTEM_LIBSEXPP)
set(SEXPP_TARGET sexpp)
endif (SYSTEM_LIBSEXPP)

# nlohmann/json is vendored as a single-header under src/lib/nlohmann/.
# json-utils.h does `#include <nlohmann/json.hpp>`; src/lib/CMakeLists.txt
# adds src/lib/nlohmann to the include path. No external dependency, no
# FetchContent, no install rules.

add_subdirectory(src/lib)
add_subdirectory(src/rnp)
add_subdirectory(src/rnpkeys)
Expand Down
5 changes: 4 additions & 1 deletion _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ ede3 = "ede3"
ffrom = "ffrom"
clen = "clen"
__THW_INTEL__ = "__THW_INTEL__"
unexpect_eof = "unexpect_eof"
unexpect_char = "unexpect_char"

[default.extend-words]
MERCHANTIBILITY = "MERCHANTIBILITY"
Expand All @@ -33,5 +35,6 @@ extend-exclude = [
"src/tests/data/**",
"src/libsexpp/**",
# Generated roff (ci/regen-man-pages.sh); lint the .adoc sources instead
"docs/man/**"
"docs/man/**",
"src/lib/nlohmann/**"
]
4 changes: 2 additions & 2 deletions ci/tests/downstream-consumer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ RNP_ROOT="$( cd "$DIR0"/../.. && pwd )"
# CRYPTO_BACKEND - backend rnp is built with (default: botan3)
# CMAKE_DEPS_PREFIX_PATH - ';'-separated extra CMAKE_PREFIX_PATH entries
# used to locate rnp's dependencies (e.g.
# "/opt/homebrew/opt/botan@3;/opt/homebrew/opt/json-c")
# "/opt/homebrew/opt/botan@3")
# SEXPP_PREFIX - prefix of a sexpp installation, appended to
# CMAKE_PREFIX_PATH for the static consumers
# RAW_DEP_LIBS - extra libraries for the raw-flags static
Expand Down Expand Up @@ -86,7 +86,7 @@ default_raw_dep_libs() {
botan) libs="$libs -lbotan-2" ;;
openssl) libs="$libs -lcrypto" ;;
esac
printf '%s' "$libs -ljson-c -lz -lbz2"
printf '%s' "$libs -lz -lbz2"
}

write_consumer() {
Expand Down
8 changes: 0 additions & 8 deletions ci/tests/pk-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ create_cmake_file() {
find_package(BZip2 REQUIRED)
find_package(ZLIB REQUIRED)

pkg_check_modules(JSONC IMPORTED_TARGET json-c12)
if(NOT JSONC_FOUND)
pkg_check_modules(JSONC REQUIRED IMPORTED_TARGET json-c)
endif(NOT JSONC_FOUND)

add_library(JSON-C::JSON-C INTERFACE IMPORTED)
set_target_properties(JSON-C::JSON-C PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::JSONC)

pkg_check_modules(Botan REQUIRED IMPORTED_TARGET botan-2)
add_library(Botan::Botan INTERFACE IMPORTED)
set_target_properties(Botan::Botan PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::Botan)
Expand Down
127 changes: 0 additions & 127 deletions cmake/Modules/FindJSON-C.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ set(CPACK_RPM_CLI_PACKAGE_SUMMARY "${CPACK_PACKAGE_DESCRIPTION_SUMMARY} (command
set(CPACK_FREEBSD_PACKAGE_MAINTAINER "${PACKAGING_EMAIL}")
set(CPACK_FREEBSD_PACKAGE_ORIGIN "security/rnp")
set(CPACK_FREEBSD_PACKAGE_CATEGORIES security)
set(CPACK_FREEBSD_PACKAGE_DEPS bzip2 json-c botan3)
set(CPACK_FREEBSD_PACKAGE_DEPS bzip2 botan3)

include(CPack)
7 changes: 3 additions & 4 deletions cmake/rnp-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@

include(CMakeFindDependencyMacro)

# The exported rnp targets reference imported targets (e.g. Botan::Botan,
# JSON-C::JSON-C) which are defined by the find modules shipped alongside
# this file, so make those available while resolving the dependencies below.
# The exported rnp targets reference imported targets (e.g. Botan::Botan)
# which are defined by the find modules shipped alongside this file, so
# make those available while resolving the dependencies below.
set(_rnp_saved_cmake_module_path "${CMAKE_MODULE_PATH}")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")

# Crypto backend librnp was built against.
@RNP_CONFIG_CRYPTO_DEPENDENCY@
find_dependency(JSON-C 0.11)
find_dependency(ZLIB)
@RNP_CONFIG_BZIP2_DEPENDENCY@
@RNP_CONFIG_SEXPP_DEPENDENCY@
Expand Down
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ ignore:
- "src/examples"
- "src/libsexpp"
- "src/tests"
# Vendored single-header nlohmann/json
- "src/lib/nlohmann"
Loading
Loading