TEST: Add new serializer and deserializer test
authorRichard Levitte <levitte@openssl.org>
Thu, 9 Jul 2020 17:10:39 +0000 (19:10 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 24 Jul 2020 14:43:13 +0000 (16:43 +0200)
commit5a23d78c9b141e31ab9b7d551b2125b124a75e49
tree9655175a4a2359593ce43c9156f003aae3878a19
parentdcfacbbfe9b3f8fa13eeb17a8fa4c89edefc8389
TEST: Add new serializer and deserializer test

This test revolves around a central function that will first serialize
an EVP_PKEY, then deserialize the result into a new EVP_PKEY and
compare the two.

The following tests are currently implemented:

1.  EVP_PKEY (RSA) -> DER, then DER -> EVP_PKEY (RSA).
2.  EVP_PKEY (RSA) -> PEM, then PEM -> EVP_PKEY (RSA).
    This one exercises deserializer chains, as we know that there is a
    PEM -> DER and a DER -> EVP_PKEY (RSA) deserializer, but no direct
    PEM -> EVP_PKEY (RSA) deserializer.

Additionally, a small fix in test_fail_string_common(), as strcmp()
could run past a buffer if one of the strings isn't terminated with
a null byte within the given length.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12410)
test/build.info
test/recipes/04-test_serializer_deserializer.t [new file with mode: 0644]
test/serdes_test.c [new file with mode: 0644]
test/testutil/format_output.c