aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects/nss/fuzzers
diff options
context:
space:
mode:
authorGravatar Mike Aizatsky <mike.aizatsky@gmail.com>2016-11-29 10:55:25 -0800
committerGravatar Mike Aizatsky <mike.aizatsky@gmail.com>2016-11-29 10:55:25 -0800
commita143b9b39a51412d133f846688194d68fe4197ba (patch)
tree936eb7e6c320fb7066f0da416727ebab8ce4668c /projects/nss/fuzzers
parent330c900781b1a8abde12e5478bb85854da48afc2 (diff)
[infra] renaming targets/ to projects/
Diffstat (limited to 'projects/nss/fuzzers')
-rw-r--r--projects/nss/fuzzers/asn1_algorithmid_fuzzer.cc19
-rw-r--r--projects/nss/fuzzers/asn1_any_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_bitstring_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_bmpstring_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_boolean_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_fuzzer_template.h45
-rw-r--r--projects/nss/fuzzers/asn1_generalizedtime_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_ia5string_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_integer_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_null_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_objectid_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_octetstring_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_utctime_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/asn1_utf8string_fuzzer.cc18
-rw-r--r--projects/nss/fuzzers/cert_certificate_fuzzer.cc19
-rw-r--r--projects/nss/fuzzers/seckey_privatekeyinfo_fuzzer.cc19
16 files changed, 318 insertions, 0 deletions
diff --git a/projects/nss/fuzzers/asn1_algorithmid_fuzzer.cc b/projects/nss/fuzzers/asn1_algorithmid_fuzzer.cc
new file mode 100644
index 00000000..ec244184
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_algorithmid_fuzzer.cc
@@ -0,0 +1,19 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <secoid.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECAlgorithmID, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SECOID_AlgorithmIDTemplate), data, size);
+ NSSFuzzOneInput<SECAlgorithmID, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SECOID_AlgorithmIDTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_any_fuzzer.cc b/projects/nss/fuzzers/asn1_any_fuzzer.cc
new file mode 100644
index 00000000..06a0c090
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_any_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_AnyTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_AnyTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_bitstring_fuzzer.cc b/projects/nss/fuzzers/asn1_bitstring_fuzzer.cc
new file mode 100644
index 00000000..26543c10
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_bitstring_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_BitStringTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_BitStringTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_bmpstring_fuzzer.cc b/projects/nss/fuzzers/asn1_bmpstring_fuzzer.cc
new file mode 100644
index 00000000..a3776409
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_bmpstring_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_BMPStringTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_BMPStringTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_boolean_fuzzer.cc b/projects/nss/fuzzers/asn1_boolean_fuzzer.cc
new file mode 100644
index 00000000..6e178ee0
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_boolean_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_BooleanTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_BooleanTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_fuzzer_template.h b/projects/nss/fuzzers/asn1_fuzzer_template.h
new file mode 100644
index 00000000..416b707e
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_fuzzer_template.h
@@ -0,0 +1,45 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASN1_FUZZER_TEMPLATE_H_
+#define ASN1_FUZZER_TEMPLATE_H_
+
+#include <nspr.h>
+#include <nss.h>
+#include <secasn1.h>
+#include <secder.h>
+#include <secitem.h>
+#include <secport.h>
+#include <stddef.h>
+#include <stdint.h>
+
+template <typename DestinationType,
+ SECStatus (*DecodeFunction)(PLArenaPool*,
+ void*,
+ const SEC_ASN1Template*,
+ const SECItem*)>
+void NSSFuzzOneInput(const SEC_ASN1Template* the_template,
+ const uint8_t* data,
+ size_t size) {
+ DestinationType* destination = new DestinationType();
+ memset(destination, 0, sizeof(DestinationType));
+
+ PLArenaPool* arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+ if (!arena) {
+ delete destination;
+ return;
+ }
+
+ SECItem source;
+ source.type = siBuffer;
+ source.data = static_cast<unsigned char*>(const_cast<uint8_t*>(data));
+ source.len = static_cast<unsigned int>(size);
+
+ DecodeFunction(arena, destination, the_template, &source);
+
+ PORT_FreeArena(arena, PR_FALSE);
+ delete destination;
+}
+
+#endif // ASN1_FUZZER_TEMPLATE_H_
diff --git a/projects/nss/fuzzers/asn1_generalizedtime_fuzzer.cc b/projects/nss/fuzzers/asn1_generalizedtime_fuzzer.cc
new file mode 100644
index 00000000..1faf586f
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_generalizedtime_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_GeneralizedTimeTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_GeneralizedTimeTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_ia5string_fuzzer.cc b/projects/nss/fuzzers/asn1_ia5string_fuzzer.cc
new file mode 100644
index 00000000..2a33255a
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_ia5string_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_IA5StringTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_IA5StringTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_integer_fuzzer.cc b/projects/nss/fuzzers/asn1_integer_fuzzer.cc
new file mode 100644
index 00000000..4e08fec0
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_integer_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_IntegerTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_IntegerTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_null_fuzzer.cc b/projects/nss/fuzzers/asn1_null_fuzzer.cc
new file mode 100644
index 00000000..4af7afb7
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_null_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_NullTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_NullTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_objectid_fuzzer.cc b/projects/nss/fuzzers/asn1_objectid_fuzzer.cc
new file mode 100644
index 00000000..bdc8288b
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_objectid_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_ObjectIDTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_ObjectIDTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_octetstring_fuzzer.cc b/projects/nss/fuzzers/asn1_octetstring_fuzzer.cc
new file mode 100644
index 00000000..71b25776
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_octetstring_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_OctetStringTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_OctetStringTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_utctime_fuzzer.cc b/projects/nss/fuzzers/asn1_utctime_fuzzer.cc
new file mode 100644
index 00000000..604e2609
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_utctime_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_UTCTimeTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_UTCTimeTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/asn1_utf8string_fuzzer.cc b/projects/nss/fuzzers/asn1_utf8string_fuzzer.cc
new file mode 100644
index 00000000..f4a3a6ac
--- /dev/null
+++ b/projects/nss/fuzzers/asn1_utf8string_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECItem, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SEC_UTF8StringTemplate), data, size);
+ NSSFuzzOneInput<SECItem, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SEC_UTF8StringTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/cert_certificate_fuzzer.cc b/projects/nss/fuzzers/cert_certificate_fuzzer.cc
new file mode 100644
index 00000000..ce1efc73
--- /dev/null
+++ b/projects/nss/fuzzers/cert_certificate_fuzzer.cc
@@ -0,0 +1,19 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <cert.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<CERTCertificate, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(CERT_CertificateTemplate), data, size);
+ NSSFuzzOneInput<CERTCertificate, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(CERT_CertificateTemplate), data, size);
+
+ return 0;
+}
diff --git a/projects/nss/fuzzers/seckey_privatekeyinfo_fuzzer.cc b/projects/nss/fuzzers/seckey_privatekeyinfo_fuzzer.cc
new file mode 100644
index 00000000..a6dd802e
--- /dev/null
+++ b/projects/nss/fuzzers/seckey_privatekeyinfo_fuzzer.cc
@@ -0,0 +1,19 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <secmod.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "asn1_fuzzer_template.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ NSSFuzzOneInput<SECKEYPrivateKeyInfo, SEC_QuickDERDecodeItem>(
+ SEC_ASN1_GET(SECKEY_PrivateKeyInfoTemplate), data, size);
+ NSSFuzzOneInput<SECKEYPrivateKeyInfo, SEC_ASN1DecodeItem>(
+ SEC_ASN1_GET(SECKEY_PrivateKeyInfoTemplate), data, size);
+
+ return 0;
+}