git: 35c0a8c449fd - main - Add 'contrib/libder/' from commit '9c40c4de4c33b2ba1124fb752ebea0bebaa6013f'

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Wed, 01 Jan 2025 21:11:34 UTC
The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=35c0a8c449fd2b7f75029ebed5e10852240f0865

commit 35c0a8c449fd2b7f75029ebed5e10852240f0865
Merge: d11904b35021 9c40c4de4c33
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2025-01-01 21:11:02 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2025-01-01 21:11:02 +0000

    Add 'contrib/libder/' from commit '9c40c4de4c33b2ba1124fb752ebea0bebaa6013f'
    
    git-subtree-dir: contrib/libder
    git-subtree-mainline: d11904b350214943dedb64c7121d4602799d7afd
    git-subtree-split: 9c40c4de4c33b2ba1124fb752ebea0bebaa6013f

 contrib/libder/.cirrus.yml                 |   16 +
 contrib/libder/.github/workflows/build.yml |   41 +
 contrib/libder/.gitignore                  |   11 +
 contrib/libder/CMakeLists.txt              |   28 +
 contrib/libder/LICENSE                     |   22 +
 contrib/libder/README.md                   |   28 +
 contrib/libder/derdump/.gitignore          |    1 +
 contrib/libder/derdump/CMakeLists.txt      |    6 +
 contrib/libder/derdump/derdump.1           |   51 ++
 contrib/libder/derdump/derdump.c           |   52 ++
 contrib/libder/libder/CMakeLists.txt       |   12 +
 contrib/libder/libder/libder.3             |  179 +++++
 contrib/libder/libder/libder.c             |  119 +++
 contrib/libder/libder/libder.h             |  181 +++++
 contrib/libder/libder/libder_error.c       |   76 ++
 contrib/libder/libder/libder_obj.3         |  138 ++++
 contrib/libder/libder/libder_obj.c         | 1192 ++++++++++++++++++++++++++++
 contrib/libder/libder/libder_private.h     |  178 +++++
 contrib/libder/libder/libder_read.3        |  101 +++
 contrib/libder/libder/libder_read.c        |  864 ++++++++++++++++++++
 contrib/libder/libder/libder_type.3        |   71 ++
 contrib/libder/libder/libder_type.c        |  150 ++++
 contrib/libder/libder/libder_write.3       |   54 ++
 contrib/libder/libder/libder_write.c       |  229 ++++++
 contrib/libder/tests/.gitignore            |   12 +
 contrib/libder/tests/CMakeLists.txt        |   41 +
 contrib/libder/tests/fuzz_parallel.c       |  111 +++
 contrib/libder/tests/fuzz_stream.c         |  246 ++++++
 contrib/libder/tests/fuzz_write.c          |   79 ++
 contrib/libder/tests/fuzzers.h             |   40 +
 contrib/libder/tests/make_corpus.c         |  137 ++++
 contrib/libder/tests/repo.priv             |  Bin 0 -> 64 bytes
 contrib/libder/tests/repo.pub              |  Bin 0 -> 88 bytes
 contrib/libder/tests/test_common.h         |   29 +
 contrib/libder/tests/test_privkey.c        |  175 ++++
 contrib/libder/tests/test_pubkey.c         |  143 ++++
 36 files changed, 4813 insertions(+)

diff --cc contrib/libder/.cirrus.yml
index 000000000000,000000000000..a63de71d8bf4
new file mode 100644
--- /dev/null
+++ b/contrib/libder/.cirrus.yml
@@@ -1,0 -1,0 +1,16 @@@
++build_task:
++  matrix:
++    - name: FreeBSD 13
++      freebsd_instance:
++        image: freebsd-13-2-release-amd64
++    - name: FreeBSD 14
++      freebsd_instance:
++        image: freebsd-14-0-release-amd64-ufs
++  setup_script:
++    sudo pkg install -y cmake
++  configure_script:
++    - cmake -B build -DCMAKE_BUILD_TYPE=Debug
++  build_script:
++    make -C build
++  test_script:
++    make -C build check
diff --cc contrib/libder/.github/workflows/build.yml
index 000000000000,a10daa25e38f..a10daa25e38f
mode 000000,100644..100644
--- a/contrib/libder/.github/workflows/build.yml
+++ b/contrib/libder/.github/workflows/build.yml
diff --cc contrib/libder/.gitignore
index 000000000000,000000000000..34fb4e06c50b
new file mode 100644
--- /dev/null
+++ b/contrib/libder/.gitignore
@@@ -1,0 -1,0 +1,11 @@@
++.*.swp
++.depend*
++*.a
++*.so
++*.so.*
++*.o
++*.pico
++*.debug
++*.full
++
++build/
diff --cc contrib/libder/CMakeLists.txt
index 000000000000,cf0d39e32489..cf0d39e32489
mode 000000,100644..100644
--- a/contrib/libder/CMakeLists.txt
+++ b/contrib/libder/CMakeLists.txt
diff --cc contrib/libder/LICENSE
index 000000000000,477af8f22e4c..477af8f22e4c
mode 000000,100644..100644
--- a/contrib/libder/LICENSE
+++ b/contrib/libder/LICENSE
diff --cc contrib/libder/README.md
index 000000000000,000000000000..9f700493520d
new file mode 100644
--- /dev/null
+++ b/contrib/libder/README.md
@@@ -1,0 -1,0 +1,28 @@@
++# libder
++
++## What is libder?
++
++libder is a small library for encoding/decoding DER-encoded objects.  It is
++expected to be able to decode any BER-encoded buffer, and an attempt to
++re-encode the resulting tree would apply any normalization expected by a DER
++decoder.  The author's use is primarily to decode/encode ECC keys for
++interoperability with OpenSSL.
++
++The authoritative source for this software is located at
++https://git.kevans.dev/kevans/libder, but it's additionally mirrored to
++[GitHub](https://github.com/kevans91/libder) for user-facing interactions.
++Pull requests and issues are open on GitHub.
++
++## What is libder not?
++
++libder is not intended to be a general-purpose library for working with DER/BER
++specified objects.  It may provide some helpers for building more primitive
++data types, but libder will quickly punt on anything even remotely complex and
++require the library consumer to supply it as a type/payload/size triple that it
++will treat as relatively opaque (modulo some encoding normalization rules that
++can be applied without deeply understanding the data contained within).
++
++libder also doesn't do strict validation of what it reads in today, for better
++or worse.  e.g., a boolean may occupy more than one byte and libder will happily
++present it to the application in that way.  It would be normalized on
++re-encoding to 0xff or 0x00 depending on whether any bits are set or not.
diff --cc contrib/libder/derdump/.gitignore
index 000000000000,a35adcc4b71d..a35adcc4b71d
mode 000000,100644..100644
--- a/contrib/libder/derdump/.gitignore
+++ b/contrib/libder/derdump/.gitignore
diff --cc contrib/libder/derdump/CMakeLists.txt
index 000000000000,11657426fbc9..11657426fbc9
mode 000000,100644..100644
--- a/contrib/libder/derdump/CMakeLists.txt
+++ b/contrib/libder/derdump/CMakeLists.txt
diff --cc contrib/libder/derdump/derdump.1
index 000000000000,414799f3055f..414799f3055f
mode 000000,100644..100644
--- a/contrib/libder/derdump/derdump.1
+++ b/contrib/libder/derdump/derdump.1
diff --cc contrib/libder/derdump/derdump.c
index 000000000000,7ea3768524d8..7ea3768524d8
mode 000000,100644..100644
--- a/contrib/libder/derdump/derdump.c
+++ b/contrib/libder/derdump/derdump.c
diff --cc contrib/libder/libder/CMakeLists.txt
index 000000000000,8e6f3426d649..8e6f3426d649
mode 000000,100644..100644
--- a/contrib/libder/libder/CMakeLists.txt
+++ b/contrib/libder/libder/CMakeLists.txt
diff --cc contrib/libder/libder/libder.3
index 000000000000,0e06254ef3fb..0e06254ef3fb
mode 000000,100644..100644
--- a/contrib/libder/libder/libder.3
+++ b/contrib/libder/libder/libder.3
diff --cc contrib/libder/libder/libder.c
index 000000000000,2d52fedd62bd..2d52fedd62bd
mode 000000,100644..100644
--- a/contrib/libder/libder/libder.c
+++ b/contrib/libder/libder/libder.c
diff --cc contrib/libder/libder/libder.h
index 000000000000,4d28aa3052ba..4d28aa3052ba
mode 000000,100644..100644
--- a/contrib/libder/libder/libder.h
+++ b/contrib/libder/libder/libder.h
diff --cc contrib/libder/libder/libder_error.c
index 000000000000,6ca0acc83e6d..6ca0acc83e6d
mode 000000,100644..100644
--- a/contrib/libder/libder/libder_error.c
+++ b/contrib/libder/libder/libder_error.c
diff --cc contrib/libder/libder/libder_obj.3
index 000000000000,d7e51da1d2fb..d7e51da1d2fb
mode 000000,100644..100644
--- a/contrib/libder/libder/libder_obj.3
+++ b/contrib/libder/libder/libder_obj.3
diff --cc contrib/libder/libder/libder_obj.c
index 000000000000,21d39e01fc17..21d39e01fc17
mode 000000,100644..100644
--- a/contrib/libder/libder/libder_obj.c
+++ b/contrib/libder/libder/libder_obj.c
diff --cc contrib/libder/libder/libder_private.h
index 000000000000,3324420ef6d8..3324420ef6d8
mode 000000,100644..100644
--- a/contrib/libder/libder/libder_private.h
+++ b/contrib/libder/libder/libder_private.h
diff --cc contrib/libder/libder/libder_read.3
index 000000000000,69c9ba8d0d2c..69c9ba8d0d2c
mode 000000,100644..100644
--- a/contrib/libder/libder/libder_read.3
+++ b/contrib/libder/libder/libder_read.3
diff --cc contrib/libder/libder/libder_read.c
index 000000000000,dba56746be21..dba56746be21
mode 000000,100644..100644
--- a/contrib/libder/libder/libder_read.c
+++ b/contrib/libder/libder/libder_read.c
diff --cc contrib/libder/libder/libder_type.3
index 000000000000,df577a70f406..df577a70f406
mode 000000,100644..100644
--- a/contrib/libder/libder/libder_type.3
+++ b/contrib/libder/libder/libder_type.3
diff --cc contrib/libder/libder/libder_type.c
index 000000000000,dec942ce68f9..dec942ce68f9
mode 000000,100644..100644
--- a/contrib/libder/libder/libder_type.c
+++ b/contrib/libder/libder/libder_type.c
diff --cc contrib/libder/libder/libder_write.3
index 000000000000,8b1a5aa2bbff..8b1a5aa2bbff
mode 000000,100644..100644
--- a/contrib/libder/libder/libder_write.3
+++ b/contrib/libder/libder/libder_write.3
diff --cc contrib/libder/libder/libder_write.c
index 000000000000,66ccbcfbf21d..66ccbcfbf21d
mode 000000,100644..100644
--- a/contrib/libder/libder/libder_write.c
+++ b/contrib/libder/libder/libder_write.c
diff --cc contrib/libder/tests/.gitignore
index 000000000000,075588a81e75..075588a81e75
mode 000000,100644..100644
--- a/contrib/libder/tests/.gitignore
+++ b/contrib/libder/tests/.gitignore
diff --cc contrib/libder/tests/CMakeLists.txt
index 000000000000,fc366ab88ed7..fc366ab88ed7
mode 000000,100644..100644
--- a/contrib/libder/tests/CMakeLists.txt
+++ b/contrib/libder/tests/CMakeLists.txt
diff --cc contrib/libder/tests/fuzz_parallel.c
index 000000000000,afd4425970a2..afd4425970a2
mode 000000,100644..100644
--- a/contrib/libder/tests/fuzz_parallel.c
+++ b/contrib/libder/tests/fuzz_parallel.c
diff --cc contrib/libder/tests/fuzz_stream.c
index 000000000000,0f7cc6167e7e..0f7cc6167e7e
mode 000000,100644..100644
--- a/contrib/libder/tests/fuzz_stream.c
+++ b/contrib/libder/tests/fuzz_stream.c
diff --cc contrib/libder/tests/fuzz_write.c
index 000000000000,2ad5b5eb1764..2ad5b5eb1764
mode 000000,100644..100644
--- a/contrib/libder/tests/fuzz_write.c
+++ b/contrib/libder/tests/fuzz_write.c
diff --cc contrib/libder/tests/fuzzers.h
index 000000000000,0f94bc7f25fb..0f94bc7f25fb
mode 000000,100644..100644
--- a/contrib/libder/tests/fuzzers.h
+++ b/contrib/libder/tests/fuzzers.h
diff --cc contrib/libder/tests/make_corpus.c
index 000000000000,68554d7c17de..68554d7c17de
mode 000000,100644..100644
--- a/contrib/libder/tests/make_corpus.c
+++ b/contrib/libder/tests/make_corpus.c
diff --cc contrib/libder/tests/repo.priv
index 000000000000,74a030b6802c..74a030b6802c
mode 000000,100644..100644
Binary files differ
diff --cc contrib/libder/tests/repo.pub
index 000000000000,bdcb1a20a1c7..bdcb1a20a1c7
mode 000000,100644..100644
Binary files differ
diff --cc contrib/libder/tests/test_common.h
index 000000000000,76e850f19128..76e850f19128
mode 000000,100644..100644
--- a/contrib/libder/tests/test_common.h
+++ b/contrib/libder/tests/test_common.h
diff --cc contrib/libder/tests/test_privkey.c
index 000000000000,5e7519f5a715..5e7519f5a715
mode 000000,100644..100644
--- a/contrib/libder/tests/test_privkey.c
+++ b/contrib/libder/tests/test_privkey.c
diff --cc contrib/libder/tests/test_pubkey.c
index 000000000000,9fbd070f0e87..9fbd070f0e87
mode 000000,100644..100644
--- a/contrib/libder/tests/test_pubkey.c
+++ b/contrib/libder/tests/test_pubkey.c