]> git.ipfire.org Git - thirdparty/FORT-validator.git/commit
Rewrite the base64 decoder
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Sat, 24 Feb 2024 01:19:34 +0000 (19:19 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Sat, 24 Feb 2024 01:19:34 +0000 (19:19 -0600)
commit96b483001adea84ab74078d288a472459f7285cb
tree624c524f6cf303011f1df12468c5959ce2468fee
parent154742c3fa1bf14f92ac0b42d02ed8d1d5010a05
Rewrite the base64 decoder

The old decoding was done using libcrypto's BIO API, even though the
code didn't need to perform any stream chaining. (Which seems to be the
whole point.)

Trying to figure out why it wasn't properly erroring on invalid base64,
I eventually realized I could dramatically simplify everything by
shifting the API layer. I'm now using `EVP_DecodeUpdate()` and friends.
It's so much cleaner and more correct now; it's incredible.

This had a cascade effect. The complexity of the base64.h API also
collapsed, which resulted in massive refactors on the callers.

Also adds some unit tests for base64 and TAL.
30 files changed:
src/Makefile.am
src/asn1/content_info.c
src/crypto/base64.c
src/crypto/base64.h
src/file.c
src/file.h
src/line_file.c [deleted file]
src/line_file.h [deleted file]
src/object/tal.c
src/rrdp.c
src/slurm/slurm_parser.c
test/Makefile.am
test/crypto/base64_test.c [new file with mode: 0644]
test/crypto/hash_test.c
test/line_file_test.c [deleted file]
test/resources/line_file/core.txt [deleted file]
test/resources/line_file/empty.txt [deleted file]
test/resources/line_file/error.txt [deleted file]
test/resources/tal/1url-crlf.tal [moved from test/tal/lacnic.tal with 81% similarity]
test/resources/tal/1url-lf.tal [new file with mode: 0644]
test/resources/tal/4urls-crlf.tal [new file with mode: 0644]
test/resources/tal/4urls-lf-comment-space-1.tal [new file with mode: 0644]
test/resources/tal/4urls-lf-comment-space-2.tal [new file with mode: 0644]
test/resources/tal/4urls-lf-comment-space-3.tal [new file with mode: 0644]
test/resources/tal/4urls-lf-comment-space-4.tal [new file with mode: 0644]
test/resources/tal/4urls-lf-comment-utf8.tal [new file with mode: 0644]
test/resources/tal/4urls-lf-comment.tal [new file with mode: 0644]
test/resources/tal/4urls-lf.tal [new file with mode: 0644]
test/rrdp_test.c
test/tal_test.c