Also re-serialize X509 objects in fuzz/cert.cc.
This is a fairly common operation on an X509. Change-Id: I1820f20b555f75c98ab7e3283b5530bc1c200e2a Reviewed-on: https://boringssl-review.googlesource.com/7611 Reviewed-by: Steven Valdez <svaldez@google.com> Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
parent
20568e7a4f
commit
66ec5c9066
@ -1,11 +1,17 @@
|
||||
#include <openssl/mem.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len) {
|
||||
const uint8_t *bufp = buf;
|
||||
X509 *x509 = d2i_X509(NULL, &bufp, len);
|
||||
if (x509 != NULL) {
|
||||
/* Also extract the public key. */
|
||||
/* Extract the public key. */
|
||||
EVP_PKEY_free(X509_get_pubkey(x509));
|
||||
|
||||
/* Reserialize the structure. */
|
||||
uint8_t *der = NULL;
|
||||
i2d_X509(x509, &der);
|
||||
OPENSSL_free(der);
|
||||
}
|
||||
X509_free(x509);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user