### Build, test, and install with nmake Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-WINDOWS.md These commands build, test, and install OpenSSL after running Configure. They are part of the quick start steps for native Visual C++ builds. ```text nmake ``` ```text nmake test ``` ```text nmake install ``` -------------------------------- ### Configure with custom prefix Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/expat/README.md Sets the installation directory prefix. By default, libexpat installs to /usr/local/lib, expat.h to /usr/local/include, and xmlwf to /usr/local/bin. This example installs to /home/me/mystuff. ```console ./configure --prefix=/home/me/mystuff ``` -------------------------------- ### Quick Start: aria2-next command examples Source: https://github.com/aninsomniacy/aria2-next/blob/main/README.md Shows typical aria2-next invocations: direct HTTP download, magnet link, ed2k link, enabling RPC on port 6800, and viewing all help options with --help=#all. ```bash aria2-next https://example.com/file.iso aria2-next 'magnet:?xt=urn:btih:...' aria2-next '' aria2-next --enable-rpc --rpc-listen-port=6800 aria2-next --help=#all ``` -------------------------------- ### Development Setup Commands Source: https://github.com/aninsomniacy/aria2-next/blob/main/docs/CONTRIBUTING.md Clone the repository and run the default CMake preset to configure, build, test, and check the version. Requires CMake 3.25+, Ninja, Make, Perl, and a C11/C++20 compiler. ```bash git clone https://github.com/AnInsomniacy/aria2-next.git cd aria2-next cmake --preset default cmake --build --preset default ctest --preset default build/default/aria2-next --version ``` -------------------------------- ### Configure OpenSSL installation directory on Unix Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Use this command to install OpenSSL to a custom location on Unix. The --prefix and --openssldir options control the installation directories; this example installs to /opt/openssl and /usr/local/ssl respectively. ```text $ ./Configure --prefix=/opt/openssl --openssldir=/usr/local/ssl ``` -------------------------------- ### Run example QUIC server Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/README-QUIC.md Run the example QUIC server from the demos/quic/server directory. The first command shows the required arguments; the second is a concrete example. Replace server.pem and server.key with your certificate and private key files. Note that openssl s_server does not support QUIC. ```shell $ ./demos/quic/server/server ``` ```shell $ ./demos/quic/server/server 4433 server.pem server.key ``` -------------------------------- ### Post-installation FIPS provider setup Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Runs the FIPS provider module post-installation command, which is required for the FIPS provider to be usable. See the openssl-fipsinstall(1) manual for details and examples. ```shell $ openssl fipsinstall ``` -------------------------------- ### Install with DESTDIR for packaging (Unix and OpenVMS) Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Shows how package builders can install OpenSSL to a temporary destination directory (DESTDIR) so it can be packaged, with the destination prepended to all installation target paths. ```shell $ make DESTDIR=/tmp/package-root install # Unix $ mms/macro="DESTDIR=TMP:[PACKAGE-ROOT]" install ! OpenVMS ``` -------------------------------- ### Build documentation with make html Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/nghttp2/README.rst Builds the documentation. The generated documents will be placed under doc/manual/html/ and are not installed with 'make install'. ```text $ make html ``` -------------------------------- ### Configure OpenSSL for OSS targets (nonstop-nsx) Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-NONSTOP.md Example Configure commands for OSS targets (nonstop-nsx, nonstop-nsx_put, nonstop-nsx_64, nonstop-nsx_64_put). The _put variants enable threads and define _REENTRANT; all use --with-rand-seed=rdcpu and assume PWD is set per installation standards. ```shell ./Configure nonstop-nsx --prefix=${PWD} \ --openssldir=${PWD}/ssl no-threads \ --with-rand-seed=rdcpu ${CIPHENABLES} ${DBGFLAG} ${SYSTEMLIBS} ./Configure nonstop-nsx_put --prefix=${PWD} \ --openssldir=${PWD}/ssl threads "-D_REENTRANT" \ --with-rand-seed=rdcpu ${CIPHENABLES} ${DBGFLAG} ${SYSTEMLIBS} ./Configure nonstop-nsx_64 --prefix=${PWD} \ --openssldir=${PWD}/ssl no-threads \ --with-rand-seed=rdcpu ${CIPHENABLES} ${DBGFLAG} ${SYSTEMLIBS} ./Configure nonstop-nsx_64_put --prefix=${PWD} \ --openssldir=${PWD}/ssl threads "-D_REENTRANT" \ --with-rand-seed=rdcpu ${CIPHENABLES} ${DBGFLAG} ${SYSTEMLIBS} ``` -------------------------------- ### Install via Homebrew tap Source: https://github.com/aninsomniacy/aria2-next/blob/main/README.md Installs the same prebuilt binaries on macOS and Linux from the project's Homebrew tap. ```bash brew install aninsomniacy/aria2-next/aria2-next ``` -------------------------------- ### Configure OpenSSL installation directory on OpenVMS Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Use this command to install OpenSSL to a custom location on OpenVMS. The --prefix and --openssldir options control the installation directories; this example installs to PROGRAM:[INSTALLS] and SYS$MANAGER:[OPENSSL] respectively. ```text $ perl Configure --prefix=PROGRAM:[INSTALLS] --openssldir=SYS$MANAGER:[OPENSSL] ``` -------------------------------- ### Install spdlog via package managers Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/spdlog/README.md Install spdlog using various package managers. Each command targets a specific package manager and platform. ```console sudo apt install libspdlog-dev ``` ```console brew install spdlog ``` ```console sudo port install spdlog ``` ```console pkg install spdlog ``` ```console dnf install spdlog ``` ```console emerge dev-libs/spdlog ``` ```console pacman -S spdlog ``` ```console sudo zypper in spdlog-devel ``` ```console apt-get install libspdlog-devel ``` ```console vcpkg install spdlog ``` ```console conan install --requires=spdlog/[*] ``` ```console conda install -c conda-forge spdlog ``` ```build2 depends: spdlog ^1.8.2 ``` -------------------------------- ### Install OpenSSL with make install/mms install/nmake install Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Installs OpenSSL after tests pass. Requires appropriate write permissions to the installation directory (specified by --prefix or its default). ```shell $ make install # Unix $ mms install ! OpenVMS $ nmake install # Windows ``` -------------------------------- ### Install OpenSSL on Windows using nmake Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Run this command in an elevated Developer Command Prompt on Windows to install OpenSSL. The default installation location is C:\Program Files\OpenSSL for native binaries, or C:\Program Files (x86)\OpenSSL for 32-bit binaries on 64-bit Windows. ```text $ nmake install ``` -------------------------------- ### Configure OpenSSL with runtime library search path using LIBRPATH Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-UNIX.md This example shows how to configure OpenSSL with a runtime shared library search path using the LIBRPATH variable. It is recommended to avoid verbatim directories because some config targets add an extra directory level for multilib installations. ```shell ./Configure --prefix=/usr/local/ssl --openssldir=/usr/local/ssl \ '-Wl,-rpath,$(LIBRPATH)' ``` -------------------------------- ### Configure OpenSSL for Guardian targets (nonstop-nse) Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-NONSTOP.md Example Configure commands for Guardian targets (nonstop-nse, nonstop-nse_g, nonstop-nse_put, nonstop-nse_64, nonstop-nse_64_put). The _put variants enable threads and define _REENTRANT; all use --with-rand-seed=egd and assume PWD is set per installation standards. ```shell ./Configure nonstop-nse --prefix=${PWD} \ --openssldir=${PWD}/ssl no-threads \ --with-rand-seed=egd ${CIPHENABLES} ${DBGFLAG} ${SYSTEMLIBS} ./Configure nonstop-nse_g --prefix=${PWD} \ --openssldir=${PWD}/ssl no-threads \ --with-rand-seed=egd ${CIPHENABLES} ${DBGFLAG} ${SYSTEMLIBS} ./Configure nonstop-nse_put --prefix=${PWD} \ --openssldir=${PWD}/ssl threads "-D_REENTRANT" \ --with-rand-seed=egd ${CIPHENABLES} ${DBGFLAG} ${SYSTEMLIBS} ./Configure nonstop-nse_64 --prefix=${PWD} \ --openssldir=${PWD}/ssl no-threads \ --with-rand-seed=egd ${CIPHENABLES} ${DBGFLAG} ${SYSTEMLIBS} ./Configure nonstop-nse_64_put --prefix=${PWD} \ --openssldir=${PWD}/ssl threads "-D_REENTRANT" --with-rand-seed=egd ${CIPHENABLES} ${DBGFLAG} ${SYSTEMLIBS} ``` -------------------------------- ### Set installation prefix with --prefix=DIR Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Specifies the top-level installation directory. Defaults are /usr/local on Unix, C:\Program Files\OpenSSL on Windows, and SYS$COMMON:[OPENSSL] on OpenVMS. ```bash --prefix=DIR ``` -------------------------------- ### Install OpenSSL with FIPS provider Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/README-FIPS.md The normal installation procedure for OpenSSL with FIPS enabled. The first command is the final installation step; the second shows the install targets it effectively executes, including the FIPS-specific target. ```shell $ make install ``` ```shell $ make install_sw $ make install_ssldirs $ make install_docs $ make install_fips # for `enable-fips` only ``` -------------------------------- ### XVS example Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/gpac/modules/validator/README.TXT Example of an XVS (XML Validation Sequence) file. It references a source file and contains snapshot and mouse move events with timestamps. ```xml ``` -------------------------------- ### Install with DESTDIR Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/expat/README.md Uses DESTDIR to override the in-makefile DESTDIR for staged installs. Variable-setting priority is commandline, then in-makefile, then environment. ```console make install DESTDIR=/path/to/image ``` -------------------------------- ### Install build dependencies on Ubuntu 22.04 Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/nghttp2/README.rst Install the required packages on Ubuntu 22.04 LTS to build nghttp2. This command installs compilers, build tools, and development libraries needed for the build. ```text sudo apt-get install g++ clang make binutils autoconf automake \ autotools-dev libtool pkg-config \ zlib1g-dev libssl-dev libxml2-dev libev-dev \ libevent-dev libjansson-dev \ libc-ares-dev libjemalloc-dev libsystemd-dev \ ruby-dev bison libelf-dev ``` -------------------------------- ### XVL example Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/gpac/modules/validator/README.TXT Example of an XVL (XML Validation List) file. It lists multiple test scenarios, each referencing an XVS file and a content file. ```xml ``` -------------------------------- ### Install OpenSSL on Unix-like systems Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Install OpenSSL on Unix/Linux/macOS/NonStop. May require root or sudo. By default, files are installed under /usr/local. ```bash $ make install ``` -------------------------------- ### Run OpenSSL tests with qemu flags Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-ANDROID.md Run the OpenSSL test suite with additional qemu flags by quoting the EXE_SHELL value. This example passes -cpu MIPS64R6-generic to qemu-mips64el. ```shell env EXE_SHELL="qemu-mips64el -cpu MIPS64R6-generic" make test ``` -------------------------------- ### Configure with custom build file via BUILDFILE Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Uses a custom build file template specified by the BUILDFILE environment variable. The example shows Unix syntax; adapt for other platforms. ```shell $ BUILDFILE=build.ninja perl Configure [options...] ``` -------------------------------- ### Force CPAN install of Text::Template Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-PERL.md Force installation with CPAN when the normal install fails despite tests passing. This is safe because you have already seen the tests succeed. ```shell $ cpan -f -i Text::Template ``` -------------------------------- ### Install FIPS provider artifacts Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/README-FIPS.md Installs the FIPS provider artifacts (fips.so and fipsmodule.cnf) to known locations on the system. Requires sudo privileges. ```shell $ cd ../openssl-3.1.2 $ sudo make install_fips ``` -------------------------------- ### Install Text::Template on Debian-based Linux Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-PERL.md On Debian-based Linux distributions, search for the module with apt-cache and install the package. The package name is the module name with 'lib' prepended and '-perl' appended. ```shell $ apt-cache search Text::Template ... libtext-template-perl - perl module to process text templates $ sudo apt-get install libtext-template-perl ``` -------------------------------- ### Notational convention: mandatory choice expansion examples Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Shows the three possible commands represented by the mandatory choice notation. ```bash $ echo WORD1 ``` ```bash $ echo WORD2 ``` ```bash $ echo WORD3 ``` -------------------------------- ### OpenSSL config file to load legacy and default providers Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/README-PROVIDERS.md Minimal OpenSSL configuration file example to load and activate both the legacy and the default provider in the default library context. The config file uses the openssl_conf variable and defines provider sections with activate = 1. ```ini openssl_conf = openssl_init [openssl_init] providers = provider_sect [provider_sect] default = default_sect legacy = legacy_sect [default_sect] activate = 1 [legacy_sect] activate = 1 ``` -------------------------------- ### OpenVMS installation directory layout Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Lists the directory layout for OpenSSL installations on OpenVMS, with placeholders 'arch', 'sover', and 'pz' replaced by the architecture, shared library version, and pointer size. ```text [.EXE.'arch'] Contains the openssl binary. [.EXE] Contains a few utility scripts. [.include.openssl] Contains the header files needed if you want to build your own programs that use libcrypto or libssl. [.LIB.'arch'] Contains the OpenSSL library files. [.ENGINES'sover''pz'.'arch'] Contains the OpenSSL dynamically loadable engines. [.SYS$STARTUP] Contains startup, login and shutdown scripts. These define appropriate logical names and command symbols. [.SYSTEST] Contains the installation verification procedure. [.HTML] Contains the HTML rendition of the manual pages. ``` -------------------------------- ### Load and use dynamic ENGINE with control commands Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/README-ENGINES.md Loads and uses an external ENGINE implementation from a shared library. The example assumes ENGINE "foo" is in "libfoo.so" and supports the control command "CMD_FOO". No error checking is shown. ```c ENGINE *e = ENGINE_by_id("dynamic"); ENGINE_ctrl_cmd_string(e, "SO_PATH", "/lib/libfoo.so", 0); ENGINE_ctrl_cmd_string(e, "ID", "foo", 0); ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0); ENGINE_ctrl_cmd_string(e, "CMD_FOO", "some input data", 0); ``` -------------------------------- ### Specify sources for build targets Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/Configurations/README.md For each build target, the SOURCE variable lists the source files it is built from. The example shows two programs with their respective sources. ```text PROGRAMS=foo bar SOURCE[foo]=foo.c common.c SOURCE[bar]=bar.c extra.c common.c ``` -------------------------------- ### Unix/Linux/macOS installation directory layout Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Lists the directory layout after a default OpenSSL installation on Unix/Linux/macOS, including binaries, headers, libraries, engines, man-pages, and HTML documentation. ```text bin/ Contains the openssl binary and a few other utility scripts. include/openssl Contains the header files needed if you want to build your own programs that use libcrypto or libssl. lib Contains the OpenSSL library files. lib/engines Contains the OpenSSL dynamically loadable engines. share/man/man1 Contains the OpenSSL command line man-pages. share/man/man3 Contains the OpenSSL library calls man-pages. share/man/man5 Contains the OpenSSL configuration format man-pages. share/man/man7 Contains the OpenSSL other misc man-pages. share/doc/openssl/html/man1 share/doc/openssl/html/man3 share/doc/openssl/html/man5 share/doc/openssl/html/man7 Contains the HTML rendition of the man-pages. ``` -------------------------------- ### Notational convention: command line example Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Shows the convention for command lines in this document. The dollar sign indicates the shell prompt and is not to be entered. ```bash $ command ``` -------------------------------- ### Notational convention: optional choice expansion examples Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Shows the four possible commands represented by the optional choice notation, including the omission of the choice. ```bash $ echo WORD1 ``` ```bash $ echo WORD2 ``` ```bash $ echo WORD3 ``` ```bash $ echo ``` -------------------------------- ### Configure package config files Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/expat/CMakeLists.txt Generates expat-config.cmake and expat-config-version.cmake using configure_package_config_file and write_basic_package_version_file. Exports the expat target to cmake/expat-targets.cmake and installs the config files. ```cmake configure_package_config_file( cmake/expat-config.cmake.in cmake/expat-config.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/expat-${PROJECT_VERSION}/ ) write_basic_package_version_file( cmake/expat-config-version.cmake COMPATIBILITY SameMajorVersion # i.e. semver ) export( TARGETS expat FILE cmake/expat-targets.cmake # not going to be installed ) expat_install( FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/expat-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmake/expat-config-version.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/expat-${PROJECT_VERSION}/ ) expat_install( EXPORT expat DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/expat-${PROJECT_VERSION}/ NAMESPACE expat:: ) ``` -------------------------------- ### OpenSSL target definition example Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Example structure of a target definition in the OpenSSL configuration files. Shows the keys used to specify compiler, flags, and assembly settings for a target. ```perl my %targets = ( ... "target-name" => { inherit_from => [ "base-target" ], CC => "...", cflags => add("..."), asm_arch => '...', perlasm_scheme => "...", }, ... ) ``` -------------------------------- ### Install Perl module with CPAN Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-PERL.md Install a Perl module using CPAN. This runs all tests that come with the module, which is usually smooth but may fail on some platforms even when tests succeed. ```shell $ cpan -i Text::Template ``` -------------------------------- ### Determine 'arch' value on VMS Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-VMS.md Shows how the 'arch' value mentioned in INSTALL is determined using the VMS system information and upcase editing. ```DCL arch = f$edit( f$getsyi( "arch_name"), "upcase") ``` -------------------------------- ### Show configure options Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/sqlite/README.txt Display the full list of build-time flags supported by the configure script. ```bash ./configure --help ``` -------------------------------- ### @enum example for nghttp2_error Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/nghttp2/doc/README.rst Example of a comment block with the @enum action keyword, used by mkapiref.py to generate API reference documentation for an enum typedef. Each enum value is documented with a comment block starting with /** and ending with */ just before the value. The enum name is extracted from the line starting with '}'. ```c /** * @enum * Error codes used in the nghttp2 library. */ typedef enum { /** * Invalid argument passed. */ NGHTTP2_ERR_INVALID_ARGUMENT = -501, /** * Zlib error. */ NGHTTP2_ERR_ZLIB = -502, } nghttp2_error; ``` -------------------------------- ### User-defined type formatting with fmt::formatter Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/spdlog/README.md Shows how to make a custom type formattable by spdlog by specializing fmt::formatter. The example defines a formatter for my_type and then logs an instance with spdlog::info. ```c++ template<> struct fmt::formatter : fmt::formatter { auto format(my_type my, format_context &ctx) const -> decltype(ctx.out()) { return fmt::format_to(ctx.out(), "[my_type i={}]", my.i); } }; void user_defined_example() { spdlog::info("user defined type: {}", my_type(14)); } ``` -------------------------------- ### Notational convention: optional arguments example Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Shows the notation for optional arguments, enclosed in square brackets with a trailing ellipsis indicating multiple can be specified. ```text [option...] ``` -------------------------------- ### @function example for nghttp2_submit_ping Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/nghttp2/doc/README.rst Example of a comment block with the @function action keyword, used by mkapiref.py to generate API reference documentation for a function. The comment block starts with /** and ends with */, and the next line contains the action keyword. The function declaration follows the comment block and ends with a semicolon. ```c /** * @function * * Submits PING frame to the |session|. */ int nghttp2_submit_ping(nghttp2_session *session); ``` -------------------------------- ### Log binary data in hex Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/spdlog/README.md Demonstrates how to log binary data using spdlog::to_hex with various format flags for controlling output appearance. ```c++ // many types of std::container types can be used. // ranges are supported too. // format flags: // {:X} - print in uppercase. // {:s} - don't separate each byte with space. // {:p} - don't print the position on each line start. // {:n} - don't split the output into lines. // {:a} - show ASCII if :n is not set. #include "spdlog/fmt/bin_to_hex.h" void binary_example() { auto console = spdlog::get("console"); std::array buf; console->info("Binary example: {}", spdlog::to_hex(buf)); console->info("Another binary example:{:n}", spdlog::to_hex(std::begin(buf), std::begin(buf) + 10)); // more examples: // logger->info("uppercase: {:X}", spdlog::to_hex(buf)); // logger->info("uppercase, no delimiters: {:Xs}", spdlog::to_hex(buf)); // logger->info("uppercase, no delimiters, no position info: {:Xsp}", spdlog::to_hex(buf)); } ``` -------------------------------- ### Notational convention: optional choice example Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Illustrates the optional choice notation using square brackets and pipe characters. The choice can be omitted entirely. ```bash $ echo [ WORD1 | WORD2 | WORD3 ] ``` -------------------------------- ### Output public key with openssl rsa -pubout Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/CHANGES.md Use the -pubout option with the rsa command to output a public key from an input private key file. This example reads key.pem and writes the public key to pubkey.pem. ```shell openssl rsa -in key.pem -pubout -out pubkey.pem ``` -------------------------------- ### Use BN_GENCB callback with BN_is_prime_ex Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/CHANGES.md Example of using the new BN_GENCB callback interface for key-generation and primality testing. The callback receives parameters a and b, and should return 1 to continue or 0 to stop. The argument can be retrieved via cb->arg. ```c int (*my_callback)(int a, int b, BN_GENCB *cb) = ...; void *my_arg = ...; BN_GENCB my_cb; BN_GENCB_set(&my_cb, my_callback, my_arg); return BN_is_prime_ex(some_bignum, BN_prime_checks, NULL, &cb); /* For the meaning of a, b in calls to my_callback(), see the * documentation of the function that calls the callback. * cb will point to my_cb; my_arg can be retrieved as cb->arg. * my_callback should return 1 if it wants BN_is_prime_ex() * to continue, or 0 to stop. */ ``` -------------------------------- ### OpenSSL configuration inheritance example Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/Configurations/README.md Shows how inheritance works in OpenSSL configuration targets. The first block defines two templates (foo and bar) and a target (laughter) that inherits from them, using a code block for the hehe key. The second block shows the resulting processed configuration after inheritance and code block execution. ```perl "foo" => { template => 1, haha => "ha ha", hoho => "ho", ignored => "This should not appear in the end result", }, "bar" => { template => 1, haha => "ah", hoho => "haho", hehe => "hehe" }, "laughter" => { inherit_from => [ "foo", "bar" ], hehe => sub { join(" ",(@_,"!!!")) }, ignored => "", } ``` ```perl "laughter" => { haha => "ha ha ah", hoho => "ho haho", hehe => "hehe !!!", ignored => "" } ``` -------------------------------- ### Display configuration data help (Windows/VMS) Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Displays help for the configdata.pm script on Windows and VMS systems. ```bash $ perl configdata.pm --help # Windows and VMS ``` -------------------------------- ### Test QUIC with openssl s_client Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/README-QUIC.md Use this command to test QUIC with a single bidirectional stream. Replace host, port, and myalpn with your server details; for example, use h3 for HTTP/3. Note that OpenSSL has no direct HTTP/3 support, so sending HTTP/3 requests or receiving responses is not possible. ```shell $ openssl s_client -quic -alpn myalpn -connect host:port ``` -------------------------------- ### Restrict content access by client address in nghttpx mruby hook Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/nghttp2/doc/nghttpx.1.rst Restricts access to paths starting with "/log/" to clients from 127.0.0.1 or ::1. For disallowed clients, it sets the response status to 404 and returns "permission denied". The example instantiates App at the end, which is required. ```ruby class App def on_req(env) allowed_clients = ["127.0.0.1", "::1"] if env.req.path.start_with?("/log/") && !allowed_clients.include?(env.remote_addr) then env.resp.status = 404 env.resp.return "permission denied" end end end App.new ``` -------------------------------- ### Install OpenSSL on OpenVMS Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Install OpenSSL on OpenVMS. By default, OpenSSL is installed to SYS$COMMON:[OPENSSL]. ```bash $ mms install ``` -------------------------------- ### Configure OpenSSL for DJGPP Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-DJGPP.md Configure OpenSSL for DJGPP with no-threads and a prefix of /dev/env/DJDIR. Requires a full DJGPP environment, PERL with Text::Template, and WATT-32 networking installed. Set WATT_ROOT to the WATT-32 directory before running. ```shell ./Configure no-threads --prefix=/dev/env/DJDIR DJGPP ``` -------------------------------- ### Run configure script Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/expat/README.md Initial configuration step for building Expat from source using GNU Autotools. Run in the top-level distribution directory. ```console ./configure ``` -------------------------------- ### Load log levels from env variable with spdlog::cfg::load_env_levels Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/spdlog/README.md Loads log levels from the SPDLOG_LEVEL environment variable (or a custom variable) using spdlog::cfg::load_env_levels. The console block shows how to set the variable and run the example. ```c++ #include "spdlog/cfg/env.h" int main (int argc, char *argv[]) { spdlog::cfg::load_env_levels(); // or specify the env variable name: // MYAPP_LEVEL=info,mylogger=trace && ./example // spdlog::cfg::load_env_levels("MYAPP_LEVEL"); // or from the command line: // ./example SPDLOG_LEVEL=info,mylogger=trace // #include "spdlog/cfg/argv.h" // for loading levels from argv // spdlog::cfg::load_argv_levels(argc, argv); } ``` ```console $ export SPDLOG_LEVEL=info,mylogger=trace $ ./example ``` -------------------------------- ### List CMake build options Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/expat/README.md Shows available non-advanced CMake options for building Expat. The command removes CMakeCache.txt and lists options with descriptions. ```console # rm -f CMakeCache.txt ; cmake -D_EXPAT_HELP=ON -LH . | grep -B1 ':.*=' | sed 's,^--$,,' // Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ... CMAKE_BUILD_TYPE:STRING= // Install path prefix, prepended onto install directories. CMAKE_INSTALL_PREFIX:PATH=/usr/local // Path to a program. DOCBOOK_TO_MAN:FILEPATH=/usr/bin/docbook2x-man // Build man page for xmlwf EXPAT_BUILD_DOCS:BOOL=ON // Build the examples for expat library EXPAT_BUILD_EXAMPLES:BOOL=ON // Build fuzzers for the expat library EXPAT_BUILD_FUZZERS:BOOL=OFF // Build pkg-config file EXPAT_BUILD_PKGCONFIG:BOOL=ON // Build the tests for expat library EXPAT_BUILD_TESTS:BOOL=ON // Build the xmlwf tool for expat library EXPAT_BUILD_TOOLS:BOOL=ON // Character type to use (char|ushort|wchar_t) [default=char] EXPAT_CHAR_TYPE:STRING=char // Install expat files in cmake install target EXPAT_ENABLE_INSTALL:BOOL=ON // Use /MT flag (static CRT) when compiling in MSVC EXPAT_MSVC_STATIC_CRT:BOOL=OFF // Build fuzzers via OSS-Fuzz for the expat library EXPAT_OSSFUZZ_BUILD:BOOL=OFF // Build a shared expat library EXPAT_SHARED_LIBS:BOOL=ON // Define to provide symbol versioning for dependency generation EXPAT_SYMBOL_VERSIONING:BOOL=OFF // Treat all compiler warnings as errors EXPAT_WARNINGS_AS_ERRORS:BOOL=OFF ``` -------------------------------- ### Define global variables with OPENSSL_IMPLEMENT_GLOBAL Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/CHANGES.md Use these macros in a source file (e.g., foo.c) to define global variables when the library is configured with EXPORT_VAR_AS_FN or OPENSSL_EXPORT_VAR_AS_FUNCTION. The first example initializes an int global to 1; the second declares a double global without initialization. ```c OPENSSL_IMPLEMENT_GLOBAL(int,foo)=1; OPENSSL_IMPLEMENT_GLOBAL(double,bar); ``` -------------------------------- ### Quick build commands for Unix/Linux/macOS/NonStop Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Commands to configure, build, and test OpenSSL on Unix-like systems. Testing is optional but recommended for production use. ```bash $ ./Configure ``` ```bash $ make ``` ```bash $ make test ``` -------------------------------- ### Asynchronous logging Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/spdlog/README.md Demonstrates initializing an asynchronous logger using the async_factory. ```c++ #include "spdlog/async.h" #include "spdlog/sinks/basic_file_sink.h" void async_example() { // default thread pool settings can be modified *before* creating the async logger: // spdlog::init_thread_pool(8192, 1); // queue with 8k items and 1 backing thread. auto async_file = spdlog::basic_logger_mt("async_file_logger", "logs/async_log.txt"); // alternatively: // auto async_file = spdlog::create_async("async_file_logger", "logs/async_log.txt"); } ``` -------------------------------- ### Set libdir option Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md The --libdir option sets the directory under the installation tree where libraries are installed. By default it is 'lib', but some targets have a multilib postfix. ```text --libdir=DIR ``` -------------------------------- ### Build OpenSSL with make/mms/nmake Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Builds the OpenSSL libraries (libcrypto.a and libssl.a on Unix) and the openssl binary in the apps/ subdirectory. Use the appropriate command for your platform. ```shell $ make # Unix $ mms ! (or mmk) OpenVMS $ nmake # Windows ``` -------------------------------- ### Test shared library ENGINE with openssl engine -pre SO_PATH and LOAD Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/README-ENGINES.md Use this command to test a shared library ENGINE with the dynamic ENGINE loading mechanism. If the library loads successfully, both -pre commands are marked as SUCCESS and the control commands displayed (due to -vvvv) are for the atalla ENGINE, not the dynamic ENGINE. Add the -t switch to attempt initialization and test hardware/driver issues. ```shell apps/openssl engine -vvvv dynamic \ -pre SO_PATH:./crypto/engine/dyn_atalla.so -pre LOAD ``` -------------------------------- ### Force CPAN install of Text::Template on VMS Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-PERL.md On VMS, force the CPAN install of Text::Template with the module name quoted because it contains uppercase characters. ```shell $ cpan -f -i "Text::Template" ``` -------------------------------- ### Run make test with Valgrind and OPENSSL_ia32cap Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-VALGRIND.md Run the full OpenSSL test suite under Valgrind with the EXE_SHELL wrapper and OPENSSL_ia32cap set to disable AVX2 and above. The command line is shown with a line continuation. ```bash $ make test EXE_SHELL="$(/bin/pwd)/util/wrap.pl valgrind --error-exitcode=1 \ --leak-check=full -q" OPENSSL_ia32cap=":0" ``` -------------------------------- ### Add new C source files to build.info Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/HACKING.md Add these lines to the appropriate build.info file for each new C source file. Use the first for files in crypto/ or its subdirectories (libcrypto), and the second for files in ssl/ or its subdirectories (libssl). The path in the SOURCE attribute is relative to where the library is built, so adjust it based on the build.info file's location. ```plaintext SOURCE[../libcrypto]={name-of-C-source-file} ``` ```plaintext SOURCE[../libssl]={name-of-C-source-file} ``` -------------------------------- ### Display configuration data help (Unix) Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Displays help for the configdata.pm script on Unix systems. ```bash $ ./configdata.pm --help # Unix ``` -------------------------------- ### Run OpenSSL tests with qemu-user Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-ANDROID.md Run the OpenSSL test suite on Linux using qemu-user after static linking. Set EXE_SHELL to the appropriate qemu- command; this is not officially supported and requires removing -ldl and -pie flags from the Makefile. ```shell env EXE_SHELL=qemu- make test ``` -------------------------------- ### Install Text::Template on VMS with quoted module name Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-PERL.md On VMS, you must quote any argument that contains uppercase characters, so the CPAN install command uses double quotes around the module name. ```shell $ cpan -i "Text::Template" ``` -------------------------------- ### Build with make (Embarcadero C++Builder) Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-WINDOWS.md Build OpenSSL after configuring with Embarcadero C++Builder. Run in the OpenSSL source directory. ```shell make -N ``` -------------------------------- ### Registry keys for installation directories Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-WINDOWS.md These registry keys can be administratively set to determine the installation directories (OPENSSLDIR, ENGINESDIR, MODULESDIR) for OpenSSL on Windows. The keys are read when the -DOSSL_WINCTX= define is used at build time. ```text \\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL--\OPENSSLDIR ``` ```text \\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL--\ENGINESDIR ``` ```text \\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL--\MODULESDIR ``` -------------------------------- ### @functypedef example for nghttp2_send_callback2 Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/nghttp2/doc/README.rst Example of a comment block with the @functypedef action keyword, used by mkapiref.py to generate API reference documentation for a function pointer typedef. The formatting is similar to @function but outputs to the 'type' domain. ```c /** * @functypedef * * Callback function invoked when |session| wants to send data to * remote peer. */ typedef nghttp2_ssize (*nghttp2_send_callback2) (nghttp2_session *session, const uint8_t *data, size_t length, int flags, void *user_data); ``` -------------------------------- ### Build SQLite on Unix and Windows Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/sqlite/README.txt Build SQLite on Unix-like systems using the configure script and make, or on Windows using NMAKE with the provided Makefile.msc. ```bash ./configure; make ``` ```batch nmake /f Makefile.msc ``` -------------------------------- ### cbc() usage examples Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/crypto/perlasm/README.md Example calls to the cbc() generator for Blowfish and DES CBC modes. The first call uses BF_encrypt for both encryption and decryption, while the DES calls use different encrypt/decrypt functions and parameter numbers. ```perl &cbc("BF_cbc_encrypt","BF_encrypt","BF_encrypt",1,4,5,3,-1,-1); &cbc("des_ncbc_encrypt","des_encrypt","des_encrypt",0,4,5,3,5,-1); &cbc("des_ede3_cbc_encrypt","des_encrypt3","des_decrypt3",0,6,7,3,4,5); ``` -------------------------------- ### Run automake Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/expat/README.md Second step for UTF-16 build. Re-writes Makefile.in files after patching Makefile.am. ```shell automake ``` -------------------------------- ### GET /api/v1beta1/configrevision Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/nghttp2/doc/nghttpx.1.rst API endpoint to retrieve the current configuration revision of nghttpx. ```APIDOC ## GET /api/v1beta1/configrevision ### Description Returns the configuration revision of the current nghttpx. The configuration revision is an opaque string that changes after each reload by SIGHUP. This allows an external application to determine whether nghttpx has finished reloading its configuration by comparing revisions before and after reloading. ### Method GET ### Endpoint /api/v1beta1/configrevision ### Parameters None ### Response #### Success Response (200) - **data** (object) - JSON object containing at least the following key: - **configRevision** (string) - The configuration revision of the current nghttpx. #### Response Example { "data": { "configRevision": "opaque-string" } } ``` -------------------------------- ### Nghttpx::Env#tls_client_not_before Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/nghttp2/doc/nghttpx.1.rst Returns the start date of the client certificate in seconds since the epoch. ```APIDOC ## Nghttpx::Env#tls_client_not_before ### Description Returns the start date of the client certificate in seconds since the epoch. ### Method attr_reader ### Returns - **Integer** - The start date in seconds since the epoch. ``` -------------------------------- ### Configure with optimized CFLAGS Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/sqlite/README.txt Override the default CFLAGS to produce a smaller installation footprint by disabling debugging symbols. ```bash $ CFLAGS="-Os" ./configure ``` -------------------------------- ### Build and test with CMake presets Source: https://github.com/aninsomniacy/aria2-next/blob/main/AGENTS.md Required for normal source or CMake changes. Runs configure, build, and test using the default presets. ```bash cmake --preset default cmake --build --preset default ctest --preset default ``` -------------------------------- ### Declare dependency for a generator file Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/Configurations/README.md Generator files can have their own dependencies, expressed with DEPEND, for example a perl script depending on other perl modules. ```text DEPEND[asm/something.pl]=../perlasm/Foo.pm ``` -------------------------------- ### Test with make (Embarcadero C++Builder) Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-WINDOWS.md Run the OpenSSL test suite after building with Embarcadero C++Builder. ```shell make -N test ``` -------------------------------- ### Blowfish function prototypes Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/crypto/perlasm/README.md C prototypes for the Blowfish encryption functions used in the cbc() example. These are the functions that the generated CBC wrapper will call. ```c void BF_encrypt(BF_LONG *data,BF_KEY *key); void BF_decrypt(BF_LONG *data,BF_KEY *key); void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, BF_KEY *ks, unsigned char *iv, int enc); ``` -------------------------------- ### Load multiple OpenSSL providers into default context Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/README-PROVIDERS.md Loads the legacy and default providers into the default library context (NULL) using OSSL_PROVIDER_load. If loading the legacy provider fails, the program exits; if loading the default provider fails, it unloads the legacy provider before exiting. At the end, both providers are unloaded with OSSL_PROVIDER_unload and the program exits successfully. ```c /* Load Multiple providers into the default (NULL) library context */ legacy = OSSL_PROVIDER_load(NULL, "legacy"); if (legacy == NULL) { printf("Failed to load Legacy provider\n"); exit(EXIT_FAILURE); } deflt = OSSL_PROVIDER_load(NULL, "default"); if (deflt == NULL) { printf("Failed to load Default provider\n"); OSSL_PROVIDER_unload(legacy); exit(EXIT_FAILURE); } /* Rest of application */ OSSL_PROVIDER_unload(legacy); OSSL_PROVIDER_unload(deflt); exit(EXIT_SUCCESS); } ``` -------------------------------- ### Load dynamic ENGINE with openssl engine -pre commands Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/README-ENGINES.md Use the openssl engine utility to load a dynamic ENGINE and pass control commands. The -pre switch passes commands before initialization; the value can be omitted for commands like LOAD. The colon separates command name from value in this syntax. ```shell openssl engine dynamic \ -pre SO_PATH:/lib/libfoo.so \ -pre ID:foo \ -pre LOAD \ -pre "CMD_FOO:some input data" ``` -------------------------------- ### Set cross-compile prefix Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md The --cross-compile-prefix option specifies a prefix for the cross-compilation toolchain. This example uses the prefix for the mingw64 target on Linux. ```text --cross-compile-prefix= ``` -------------------------------- ### Stopwatch Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/spdlog/README.md Uses spdlog::stopwatch to measure elapsed time and log it with fmt formatting. The example logs the stopwatch object directly and with a precision specifier. ```c++ // Stopwatch support for spdlog #include "spdlog/stopwatch.h" void stopwatch_example() { spdlog::stopwatch sw; spdlog::debug("Elapsed {}", sw); spdlog::debug("Elapsed {:.3}", sw); } ``` -------------------------------- ### Out-of-tree build on Windows Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Performs an out-of-tree build on Windows. Creates a temporary directory and runs Configure from there with the source path. ```shell $ C: $ mkdir \temp-openssl $ cd \temp-openssl $ perl d:\PATH\TO\OPENSSL\SOURCE\Configure [options...] ``` -------------------------------- ### Custom _OPENSSL_isservice export Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/NOTES-WINDOWS.md Example of exporting a custom _OPENSSL_isservice function from an executable to avoid relying on USER32.DLL in service processes. This is a C code snippet. ```c __declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void) { DWORD sess; } ``` -------------------------------- ### Configure with custom pkg-config path Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/nghttp2/README.rst Use this command to pass a custom pkg-config search path to the configure script. Set PKG_CONFIG_PATH to the directory containing the desired *.pc files. This is necessary when pkg-config cannot find libraries in standard locations. ```text $ ./configure PKG_CONFIG_PATH=/path/to/pkgconfig ``` -------------------------------- ### Quick build commands for OpenVMS Source: https://github.com/aninsomniacy/aria2-next/blob/main/third_party/openssl/INSTALL.md Commands to build OpenSSL on OpenVMS using Perl and mms. ```bash $ perl Configure ``` ```bash $ mms ``` ```bash $ mms test ```