]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Add crypto_pem_{encode,decode}()
authorSteffan Karger <steffan.karger@fox-it.com>
Sun, 22 Jul 2018 10:06:45 +0000 (12:06 +0200)
committerGert Doering <gert@greenie.muc.de>
Sun, 22 Jul 2018 12:22:31 +0000 (14:22 +0200)
commita5d35a01dcf73e6a93f59d687adb6e5be38c7750
treeea6296521cd4690474572e4bddf38c9f123af201
parent3e5561d34099f28a759865efff0523005116b6a1
Add crypto_pem_{encode,decode}()

Needed for tls-crypt-v2, but isolated enough to be reviewed as a separate
patch.

The encode API allocates memory, because it fits our typical gc-oriented
code pattern and the caller does not have to do multiple calls or
calculations to determine the required destination buffer size.

The decode API does not allocate memory, because the required destination
buffer is always smaller than the input buffer (so is easy to manage by
the caller) and does not force the caller to use the heap.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20180722100645.5813-1-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg17284.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/crypto_backend.h
src/openvpn/crypto_mbedtls.c
src/openvpn/crypto_openssl.c
tests/unit_tests/openvpn/Makefile.am
tests/unit_tests/openvpn/test_crypto.c [new file with mode: 0644]