diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-04-20 14:03:39 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-04-20 14:07:34 +0200 |
commit | dd7dd9d1382bf4ceda56ec57f8572a005b89acea (patch) | |
tree | f14226d7b8e7ec572c8e11266226ba805aea1bfc /devel | |
parent | bd70abd581fe4c7dd29eaa7e8c3e177178a53991 (diff) | |
download | gnutls-dd7dd9d1382bf4ceda56ec57f8572a005b89acea.tar.gz |
fuzz: added PEM base64 decoder and encoder fuzzers [ci skip]
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'devel')
-rw-r--r-- | devel/fuzz/Makefile | 6 | ||||
-rw-r--r-- | devel/fuzz/gnutls_base64_decoder.in/key.pem | 32 | ||||
-rw-r--r-- | devel/fuzz/gnutls_base64_decoder_fuzzer.cc | 39 | ||||
-rw-r--r-- | devel/fuzz/gnutls_base64_encoder.in/rnd.raw | bin | 0 -> 160 bytes | |||
-rw-r--r-- | devel/fuzz/gnutls_base64_encoder_fuzzer.cc | 39 |
5 files changed, 114 insertions, 2 deletions
diff --git a/devel/fuzz/Makefile b/devel/fuzz/Makefile index 282d17400c..6b313dee11 100644 --- a/devel/fuzz/Makefile +++ b/devel/fuzz/Makefile @@ -24,7 +24,8 @@ all: gnutls_pkcs7_parser_fuzzer gnutls_client_fuzzer gnutls_dn_parser_fuzzer \ gnutls_openpgp_cert_parser_fuzzer gnutls_pkcs7_parser_fuzzer gnutls_pkcs8_key_parser_fuzzer \ gnutls_private_key_parser_fuzzer gnutls_server_fuzzer gnutls_x509_parser_fuzzer \ gnutls_reverse_idna_parser_fuzzer gnutls_idna_parser_fuzzer gnutls_ocsp_resp_parser_fuzzer \ - gnutls_ocsp_req_parser_fuzzer gnutls_pkcs12_key_parser_fuzzer + gnutls_ocsp_req_parser_fuzzer gnutls_pkcs12_key_parser_fuzzer gnutls_base64_decoder_fuzzer \ + gnutls_base64_encoder_fuzzer %: %.cc $(CC) $(CFLAGS) main.c $^ $(COMMON) -o $@ @@ -34,4 +35,5 @@ clean: gnutls_openpgp_cert_parser_fuzzer gnutls_pkcs7_parser_fuzzer gnutls_pkcs8_key_parser_fuzzer \ gnutls_private_key_parser_fuzzer gnutls_server_fuzzer gnutls_x509_parser_fuzzer \ gnutls_idna_parser_fuzzer gnutls_reverse_idna_parser_fuzzer gnutls_ocsp_resp_parser_fuzzer \ - gnutls_ocsp_req_parser_fuzzer + gnutls_ocsp_req_parser_fuzzer gnutls_base64_decoder_fuzzer \ + gnutls_base64_encoder_fuzzer diff --git a/devel/fuzz/gnutls_base64_decoder.in/key.pem b/devel/fuzz/gnutls_base64_decoder.in/key.pem new file mode 100644 index 0000000000..fec5c5081d --- /dev/null +++ b/devel/fuzz/gnutls_base64_decoder.in/key.pem @@ -0,0 +1,32 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIFfgIBAAKCATEAtGsnmCWvwf8eyrB+9Ni87UOGZ1Rd2rQewpBfgzwCEfwTcoWy +iKRlQQt2XyO+ip/+eUtzOy7HSzy/FsmXVTUX86FySzDC4CeUEvNWAObOgksRXaQe +m/r6uRsqTRi1uqXmDMeoqKFtqoiE3JYOsmwcNarnx5Q9+dXHwqINS7NuevcIX8UJ +zRWTGveY3ypMZokk7R/QFmOBZaVYO6HNJWKbmYFUCBcY7HwvCKI7KFcynRdHCob7 +YrFBmeb73qjqIH7zG+666pohZCmS8q1z5RkFnTdT4hGfGF8iuuKLDQCMni+nhz1A +vkqipZIIDC5hwFh8mpnh1qyDOSXPPhvt66NtncvFON7Bx26bNBS+MD6CkB65Spp2 +5O8zDEaiMXL2w2EL+KpnifSl5XY3oSmfgHmqdQIDAQABAoIBMQCAiid3esIx0PW7 +KuwIvbI8yHMlgzIq81FHBV1HPqWq8pFYcnC0cYvCP8xiFDFYyoyfFmZOsBFFRU5P +iejLyDv8U/X+JAtzcD9LERshIU/X/Guu75LvRm0DHJuSuhwfkrrIOCetnPV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bHq9Zi0jXz72hwaojQdu8GP66ujbme +y1hvTfWRAoGZALNT3AbF9EDnJmZlS30MWtBggw83UhszC8XN2tY30AsvsDOS6a0F +/aQ45EKyCvnqtsCOmB6giDsKRaVncp6lIHSH4kHKT7UvlKadWDW5CNWGR3puoHLk +UVhyNvBTKo6lPqXqUsVxp16TKeeQKF+DuYuuNZN3pXXsHTiHkRMDCRVEqz7UnZEc +/Bq/Kh2aOkelkX2S27QzTZGL +-----END RSA PRIVATE KEY----- diff --git a/devel/fuzz/gnutls_base64_decoder_fuzzer.cc b/devel/fuzz/gnutls_base64_decoder_fuzzer.cc new file mode 100644 index 0000000000..f6d436766b --- /dev/null +++ b/devel/fuzz/gnutls_base64_decoder_fuzzer.cc @@ -0,0 +1,39 @@ +/* +# Copyright 2017 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +*/ + +#include <assert.h> +#include <stdint.h> + +#include <gnutls/gnutls.h> + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + gnutls_datum_t raw; + gnutls_datum_t out; + int ret; + + raw.data = (unsigned char *)data; + raw.size = size; + + ret = gnutls_pem_base64_decode2(NULL, &raw, &out); + if (ret >= 0) { + gnutls_free(out.data); + } + + return 0; +} diff --git a/devel/fuzz/gnutls_base64_encoder.in/rnd.raw b/devel/fuzz/gnutls_base64_encoder.in/rnd.raw Binary files differnew file mode 100644 index 0000000000..effbe3446f --- /dev/null +++ b/devel/fuzz/gnutls_base64_encoder.in/rnd.raw diff --git a/devel/fuzz/gnutls_base64_encoder_fuzzer.cc b/devel/fuzz/gnutls_base64_encoder_fuzzer.cc new file mode 100644 index 0000000000..d1ae23ff90 --- /dev/null +++ b/devel/fuzz/gnutls_base64_encoder_fuzzer.cc @@ -0,0 +1,39 @@ +/* +# Copyright 2017 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +*/ + +#include <assert.h> +#include <stdint.h> + +#include <gnutls/gnutls.h> + + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + gnutls_datum_t raw; + gnutls_datum_t out; + int ret; + + raw.data = (unsigned char *)data; + raw.size = size; + + ret = gnutls_pem_base64_encode2("ARBITRARY", &raw, &out); + if (ret >= 0) { + gnutls_free(out.data); + } + + return 0; +} |