1 1.1 christos /* 2 1.1 christos * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. 3 1.1 christos * 4 1.1 christos * Licensed under the Apache License 2.0 (the "License"); 5 1.1 christos * you may not use this file except in compliance with the License. 6 1.1 christos * You may obtain a copy of the License at 7 1.1 christos * https://www.openssl.org/source/license.html 8 1.1 christos * or in the file LICENSE in the source distribution. 9 1.1 christos */ 10 1.1 christos 11 1.1 christos /* 12 1.1 christos * Fuzz ASN.1 parsing for various data structures. Specify which on the 13 1.1 christos * command line: 14 1.1 christos * 15 1.1 christos * asn1 <data structure> 16 1.1 christos */ 17 1.1 christos 18 1.1 christos /* We need to use some deprecated APIs */ 19 1.1 christos #define OPENSSL_SUPPRESS_DEPRECATED 20 1.1 christos 21 1.1 christos #include <stdio.h> 22 1.1 christos #include <string.h> 23 1.1 christos #include <openssl/asn1.h> 24 1.1 christos #include <openssl/asn1t.h> 25 1.1 christos #include <openssl/dh.h> 26 1.1 christos #include <openssl/dsa.h> 27 1.1 christos #include <openssl/ec.h> 28 1.1 christos #include <openssl/ocsp.h> 29 1.1 christos #include <openssl/pkcs12.h> 30 1.1 christos #include <openssl/rsa.h> 31 1.1 christos #include <openssl/ts.h> 32 1.1 christos #include <openssl/x509v3.h> 33 1.1 christos #include <openssl/cms.h> 34 1.1 christos #include <openssl/ess.h> 35 1.1 christos #include <openssl/err.h> 36 1.1 christos #include <openssl/rand.h> 37 1.1 christos #include <openssl/bio.h> 38 1.1 christos #include <openssl/evp.h> 39 1.1 christos #include <openssl/ssl.h> 40 1.1 christos #include <openssl/x509_acert.h> 41 1.1 christos #include "internal/nelem.h" 42 1.1 christos #include "fuzzer.h" 43 1.1 christos 44 1.1 christos static ASN1_ITEM_EXP *item_type[] = { 45 1.1 christos ASN1_ITEM_ref(ACCESS_DESCRIPTION), 46 1.1 christos #ifndef OPENSSL_NO_RFC3779 47 1.1 christos ASN1_ITEM_ref(ASIdentifierChoice), 48 1.1 christos ASN1_ITEM_ref(ASIdentifiers), 49 1.1 christos ASN1_ITEM_ref(ASIdOrRange), 50 1.1 christos #endif 51 1.1 christos ASN1_ITEM_ref(ASN1_ANY), 52 1.1 christos ASN1_ITEM_ref(ASN1_BIT_STRING), 53 1.1 christos ASN1_ITEM_ref(ASN1_BMPSTRING), 54 1.1 christos ASN1_ITEM_ref(ASN1_BOOLEAN), 55 1.1 christos ASN1_ITEM_ref(ASN1_ENUMERATED), 56 1.1 christos ASN1_ITEM_ref(ASN1_FBOOLEAN), 57 1.1 christos ASN1_ITEM_ref(ASN1_GENERALIZEDTIME), 58 1.1 christos ASN1_ITEM_ref(ASN1_GENERALSTRING), 59 1.1 christos ASN1_ITEM_ref(ASN1_IA5STRING), 60 1.1 christos ASN1_ITEM_ref(ASN1_INTEGER), 61 1.1 christos ASN1_ITEM_ref(ASN1_NULL), 62 1.1 christos ASN1_ITEM_ref(ASN1_OBJECT), 63 1.1 christos ASN1_ITEM_ref(ASN1_OCTET_STRING), 64 1.1 christos ASN1_ITEM_ref(ASN1_OCTET_STRING_NDEF), 65 1.1 christos ASN1_ITEM_ref(ASN1_PRINTABLE), 66 1.1 christos ASN1_ITEM_ref(ASN1_PRINTABLESTRING), 67 1.1 christos ASN1_ITEM_ref(ASN1_SEQUENCE), 68 1.1 christos ASN1_ITEM_ref(ASN1_SEQUENCE_ANY), 69 1.1 christos ASN1_ITEM_ref(ASN1_SET_ANY), 70 1.1 christos ASN1_ITEM_ref(ASN1_T61STRING), 71 1.1 christos ASN1_ITEM_ref(ASN1_TBOOLEAN), 72 1.1 christos ASN1_ITEM_ref(ASN1_TIME), 73 1.1 christos ASN1_ITEM_ref(ASN1_UNIVERSALSTRING), 74 1.1 christos ASN1_ITEM_ref(ASN1_UTCTIME), 75 1.1 christos ASN1_ITEM_ref(ASN1_UTF8STRING), 76 1.1 christos ASN1_ITEM_ref(ASN1_VISIBLESTRING), 77 1.1 christos #ifndef OPENSSL_NO_RFC3779 78 1.1 christos ASN1_ITEM_ref(ASRange), 79 1.1 christos #endif 80 1.1 christos ASN1_ITEM_ref(AUTHORITY_INFO_ACCESS), 81 1.1 christos ASN1_ITEM_ref(AUTHORITY_KEYID), 82 1.1 christos ASN1_ITEM_ref(BASIC_CONSTRAINTS), 83 1.1 christos ASN1_ITEM_ref(BIGNUM), 84 1.1 christos ASN1_ITEM_ref(CBIGNUM), 85 1.1 christos ASN1_ITEM_ref(CERTIFICATEPOLICIES), 86 1.1 christos #ifndef OPENSSL_NO_CMS 87 1.1 christos ASN1_ITEM_ref(CMS_ContentInfo), 88 1.1 christos ASN1_ITEM_ref(CMS_ReceiptRequest), 89 1.1 christos ASN1_ITEM_ref(CRL_DIST_POINTS), 90 1.1 christos #endif 91 1.1 christos #ifndef OPENSSL_NO_DH 92 1.1 christos ASN1_ITEM_ref(DHparams), 93 1.1 christos #endif 94 1.1 christos ASN1_ITEM_ref(DIRECTORYSTRING), 95 1.1 christos ASN1_ITEM_ref(DISPLAYTEXT), 96 1.1 christos ASN1_ITEM_ref(DIST_POINT), 97 1.1 christos ASN1_ITEM_ref(DIST_POINT_NAME), 98 1.1 christos #if !defined(OPENSSL_NO_EC) && !defined(OPENSSL_NO_DEPRECATED_3_0) 99 1.1 christos ASN1_ITEM_ref(ECPARAMETERS), 100 1.1 christos ASN1_ITEM_ref(ECPKPARAMETERS), 101 1.1 christos #endif 102 1.1 christos ASN1_ITEM_ref(EDIPARTYNAME), 103 1.1 christos ASN1_ITEM_ref(EXTENDED_KEY_USAGE), 104 1.1 christos ASN1_ITEM_ref(GENERAL_NAME), 105 1.1 christos ASN1_ITEM_ref(GENERAL_NAMES), 106 1.1 christos ASN1_ITEM_ref(GENERAL_SUBTREE), 107 1.1 christos #ifndef OPENSSL_NO_RFC3779 108 1.1 christos ASN1_ITEM_ref(IPAddressChoice), 109 1.1 christos ASN1_ITEM_ref(IPAddressFamily), 110 1.1 christos ASN1_ITEM_ref(IPAddressOrRange), 111 1.1 christos ASN1_ITEM_ref(IPAddressRange), 112 1.1 christos #endif 113 1.1 christos ASN1_ITEM_ref(ISSUING_DIST_POINT), 114 1.1 christos #ifndef OPENSSL_NO_DEPRECATED_3_0 115 1.1 christos ASN1_ITEM_ref(LONG), 116 1.1 christos #endif 117 1.1 christos ASN1_ITEM_ref(NAME_CONSTRAINTS), 118 1.1 christos ASN1_ITEM_ref(NETSCAPE_CERT_SEQUENCE), 119 1.1 christos ASN1_ITEM_ref(NETSCAPE_SPKAC), 120 1.1 christos ASN1_ITEM_ref(NETSCAPE_SPKI), 121 1.1 christos ASN1_ITEM_ref(NOTICEREF), 122 1.1 christos #ifndef OPENSSL_NO_OCSP 123 1.1 christos ASN1_ITEM_ref(OCSP_BASICRESP), 124 1.1 christos ASN1_ITEM_ref(OCSP_CERTID), 125 1.1 christos ASN1_ITEM_ref(OCSP_CERTSTATUS), 126 1.1 christos ASN1_ITEM_ref(OCSP_CRLID), 127 1.1 christos ASN1_ITEM_ref(OCSP_ONEREQ), 128 1.1 christos ASN1_ITEM_ref(OCSP_REQINFO), 129 1.1 christos ASN1_ITEM_ref(OCSP_REQUEST), 130 1.1 christos ASN1_ITEM_ref(OCSP_RESPBYTES), 131 1.1 christos ASN1_ITEM_ref(OCSP_RESPDATA), 132 1.1 christos ASN1_ITEM_ref(OCSP_RESPID), 133 1.1 christos ASN1_ITEM_ref(OCSP_RESPONSE), 134 1.1 christos ASN1_ITEM_ref(OCSP_REVOKEDINFO), 135 1.1 christos ASN1_ITEM_ref(OCSP_SERVICELOC), 136 1.1 christos ASN1_ITEM_ref(OCSP_SIGNATURE), 137 1.1 christos ASN1_ITEM_ref(OCSP_SINGLERESP), 138 1.1 christos #endif 139 1.1 christos ASN1_ITEM_ref(OTHERNAME), 140 1.1 christos ASN1_ITEM_ref(PBE2PARAM), 141 1.1 christos ASN1_ITEM_ref(PBEPARAM), 142 1.1 christos ASN1_ITEM_ref(PBKDF2PARAM), 143 1.1 christos ASN1_ITEM_ref(PKCS12), 144 1.1 christos ASN1_ITEM_ref(PKCS12_AUTHSAFES), 145 1.1 christos ASN1_ITEM_ref(PKCS12_BAGS), 146 1.1 christos ASN1_ITEM_ref(PKCS12_MAC_DATA), 147 1.1 christos ASN1_ITEM_ref(PKCS12_SAFEBAG), 148 1.1 christos ASN1_ITEM_ref(PKCS12_SAFEBAGS), 149 1.1 christos ASN1_ITEM_ref(PKCS7), 150 1.1 christos ASN1_ITEM_ref(PKCS7_ATTR_SIGN), 151 1.1 christos ASN1_ITEM_ref(PKCS7_ATTR_VERIFY), 152 1.1 christos ASN1_ITEM_ref(PKCS7_DIGEST), 153 1.1 christos ASN1_ITEM_ref(PKCS7_ENC_CONTENT), 154 1.1 christos ASN1_ITEM_ref(PKCS7_ENCRYPT), 155 1.1 christos ASN1_ITEM_ref(PKCS7_ENVELOPE), 156 1.1 christos ASN1_ITEM_ref(PKCS7_ISSUER_AND_SERIAL), 157 1.1 christos ASN1_ITEM_ref(PKCS7_RECIP_INFO), 158 1.1 christos ASN1_ITEM_ref(PKCS7_SIGNED), 159 1.1 christos ASN1_ITEM_ref(PKCS7_SIGN_ENVELOPE), 160 1.1 christos ASN1_ITEM_ref(PKCS7_SIGNER_INFO), 161 1.1 christos ASN1_ITEM_ref(PKCS8_PRIV_KEY_INFO), 162 1.1 christos ASN1_ITEM_ref(PKEY_USAGE_PERIOD), 163 1.1 christos ASN1_ITEM_ref(POLICY_CONSTRAINTS), 164 1.1 christos ASN1_ITEM_ref(POLICYINFO), 165 1.1 christos ASN1_ITEM_ref(POLICY_MAPPING), 166 1.1 christos ASN1_ITEM_ref(POLICY_MAPPINGS), 167 1.1 christos ASN1_ITEM_ref(POLICYQUALINFO), 168 1.1 christos ASN1_ITEM_ref(PROXY_CERT_INFO_EXTENSION), 169 1.1 christos ASN1_ITEM_ref(PROXY_POLICY), 170 1.1 christos ASN1_ITEM_ref(RSA_OAEP_PARAMS), 171 1.1 christos ASN1_ITEM_ref(RSA_PSS_PARAMS), 172 1.1 christos #ifndef OPENSSL_NO_DEPRECATED_3_0 173 1.1 christos ASN1_ITEM_ref(RSAPrivateKey), 174 1.1 christos ASN1_ITEM_ref(RSAPublicKey), 175 1.1 christos #endif 176 1.1 christos ASN1_ITEM_ref(SXNET), 177 1.1 christos ASN1_ITEM_ref(SXNETID), 178 1.1 christos ASN1_ITEM_ref(OSSL_TARGETING_INFORMATION), 179 1.1 christos ASN1_ITEM_ref(USERNOTICE), 180 1.1 christos ASN1_ITEM_ref(X509), 181 1.1 christos ASN1_ITEM_ref(X509_ALGOR), 182 1.1 christos ASN1_ITEM_ref(X509_ALGORS), 183 1.1 christos ASN1_ITEM_ref(X509_ATTRIBUTE), 184 1.1 christos ASN1_ITEM_ref(X509_CERT_AUX), 185 1.1 christos ASN1_ITEM_ref(X509_CINF), 186 1.1 christos ASN1_ITEM_ref(X509_CRL), 187 1.1 christos ASN1_ITEM_ref(X509_CRL_INFO), 188 1.1 christos ASN1_ITEM_ref(X509_EXTENSION), 189 1.1 christos ASN1_ITEM_ref(X509_EXTENSIONS), 190 1.1 christos ASN1_ITEM_ref(X509_NAME), 191 1.1 christos ASN1_ITEM_ref(X509_NAME_ENTRY), 192 1.1 christos ASN1_ITEM_ref(X509_PUBKEY), 193 1.1 christos ASN1_ITEM_ref(X509_REQ), 194 1.1 christos ASN1_ITEM_ref(X509_REQ_INFO), 195 1.1 christos ASN1_ITEM_ref(X509_REVOKED), 196 1.1 christos ASN1_ITEM_ref(X509_SIG), 197 1.1 christos ASN1_ITEM_ref(X509_VAL), 198 1.1 christos #ifndef OPENSSL_NO_DEPRECATED_3_0 199 1.1 christos ASN1_ITEM_ref(ZLONG), 200 1.1 christos #endif 201 1.1 christos ASN1_ITEM_ref(INT32), 202 1.1 christos ASN1_ITEM_ref(ZINT32), 203 1.1 christos ASN1_ITEM_ref(UINT32), 204 1.1 christos ASN1_ITEM_ref(ZUINT32), 205 1.1 christos ASN1_ITEM_ref(INT64), 206 1.1 christos ASN1_ITEM_ref(ZINT64), 207 1.1 christos ASN1_ITEM_ref(UINT64), 208 1.1 christos ASN1_ITEM_ref(ZUINT64), 209 1.1 christos NULL 210 1.1 christos }; 211 1.1 christos 212 1.1 christos static ASN1_PCTX *pctx; 213 1.1 christos 214 1.1.1.2 christos #define DO_TEST(TYPE, D2I, I2D, PRINT) \ 215 1.1.1.2 christos { \ 216 1.1.1.2 christos const unsigned char *p = buf; \ 217 1.1.1.2 christos unsigned char *der = NULL; \ 218 1.1.1.2 christos TYPE *type = D2I(NULL, &p, len); \ 219 1.1.1.2 christos \ 220 1.1.1.2 christos if (type != NULL) { \ 221 1.1.1.2 christos int len2; \ 222 1.1.1.2 christos BIO *bio = BIO_new(BIO_s_null()); \ 223 1.1.1.2 christos \ 224 1.1.1.2 christos if (bio != NULL) { \ 225 1.1.1.2 christos PRINT(bio, type); \ 226 1.1.1.2 christos BIO_free(bio); \ 227 1.1.1.2 christos } \ 228 1.1.1.2 christos len2 = I2D(type, &der); \ 229 1.1.1.2 christos if (len2 != 0) { } \ 230 1.1.1.2 christos OPENSSL_free(der); \ 231 1.1.1.2 christos TYPE##_free(type); \ 232 1.1.1.2 christos } \ 233 1.1.1.2 christos } 234 1.1 christos 235 1.1.1.2 christos #define DO_TEST_PRINT_OFFSET(TYPE, D2I, I2D, PRINT) \ 236 1.1.1.2 christos { \ 237 1.1.1.2 christos const unsigned char *p = buf; \ 238 1.1.1.2 christos unsigned char *der = NULL; \ 239 1.1.1.2 christos TYPE *type = D2I(NULL, &p, len); \ 240 1.1.1.2 christos \ 241 1.1.1.2 christos if (type != NULL) { \ 242 1.1.1.2 christos BIO *bio = BIO_new(BIO_s_null()); \ 243 1.1.1.2 christos \ 244 1.1.1.2 christos if (bio != NULL) { \ 245 1.1.1.2 christos PRINT(bio, type, 0); \ 246 1.1.1.2 christos BIO_free(bio); \ 247 1.1.1.2 christos } \ 248 1.1.1.2 christos I2D(type, &der); \ 249 1.1.1.2 christos OPENSSL_free(der); \ 250 1.1.1.2 christos TYPE##_free(type); \ 251 1.1.1.2 christos } \ 252 1.1.1.2 christos } 253 1.1 christos 254 1.1.1.2 christos #define DO_TEST_PRINT_PCTX(TYPE, D2I, I2D, PRINT) \ 255 1.1.1.2 christos { \ 256 1.1.1.2 christos const unsigned char *p = buf; \ 257 1.1.1.2 christos unsigned char *der = NULL; \ 258 1.1.1.2 christos TYPE *type = D2I(NULL, &p, len); \ 259 1.1.1.2 christos \ 260 1.1.1.2 christos if (type != NULL) { \ 261 1.1.1.2 christos BIO *bio = BIO_new(BIO_s_null()); \ 262 1.1.1.2 christos \ 263 1.1.1.2 christos if (bio != NULL) { \ 264 1.1.1.2 christos PRINT(bio, type, 0, pctx); \ 265 1.1.1.2 christos BIO_free(bio); \ 266 1.1.1.2 christos } \ 267 1.1.1.2 christos I2D(type, &der); \ 268 1.1.1.2 christos OPENSSL_free(der); \ 269 1.1.1.2 christos TYPE##_free(type); \ 270 1.1.1.2 christos } \ 271 1.1.1.2 christos } 272 1.1 christos 273 1.1.1.2 christos #define DO_TEST_NO_PRINT(TYPE, D2I, I2D) \ 274 1.1.1.2 christos { \ 275 1.1.1.2 christos const unsigned char *p = buf; \ 276 1.1.1.2 christos unsigned char *der = NULL; \ 277 1.1.1.2 christos TYPE *type = D2I(NULL, &p, len); \ 278 1.1.1.2 christos \ 279 1.1.1.2 christos if (type != NULL) { \ 280 1.1.1.2 christos BIO *bio = BIO_new(BIO_s_null()); \ 281 1.1.1.2 christos \ 282 1.1.1.2 christos BIO_free(bio); \ 283 1.1.1.2 christos I2D(type, &der); \ 284 1.1.1.2 christos OPENSSL_free(der); \ 285 1.1.1.2 christos TYPE##_free(type); \ 286 1.1.1.2 christos } \ 287 1.1.1.2 christos } 288 1.1 christos 289 1.1 christos int FuzzerInitialize(int *argc, char ***argv) 290 1.1 christos { 291 1.1 christos FuzzerSetRand(); 292 1.1 christos pctx = ASN1_PCTX_new(); 293 1.1.1.2 christos ASN1_PCTX_set_flags(pctx, ASN1_PCTX_FLAGS_SHOW_ABSENT | ASN1_PCTX_FLAGS_SHOW_SEQUENCE | ASN1_PCTX_FLAGS_SHOW_SSOF | ASN1_PCTX_FLAGS_SHOW_TYPE | ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME); 294 1.1.1.2 christos ASN1_PCTX_set_str_flags(pctx, ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_SHOW_TYPE | ASN1_STRFLGS_DUMP_ALL); 295 1.1 christos 296 1.1 christos OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); 297 1.1 christos OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL); 298 1.1 christos ERR_clear_error(); 299 1.1 christos CRYPTO_free_ex_index(0, -1); 300 1.1 christos 301 1.1 christos return 1; 302 1.1 christos } 303 1.1 christos 304 1.1 christos int FuzzerTestOneInput(const uint8_t *buf, size_t len) 305 1.1 christos { 306 1.1 christos int n; 307 1.1 christos 308 1.1 christos for (n = 0; item_type[n] != NULL; ++n) { 309 1.1 christos const uint8_t *b = buf; 310 1.1 christos unsigned char *der = NULL; 311 1.1 christos const ASN1_ITEM *i = ASN1_ITEM_ptr(item_type[n]); 312 1.1 christos ASN1_VALUE *o = ASN1_item_d2i(NULL, &b, len, i); 313 1.1 christos 314 1.1 christos if (o != NULL) { 315 1.1 christos /* 316 1.1 christos * Don't print excessively long output to prevent spurious fuzzer 317 1.1 christos * timeouts. 318 1.1 christos */ 319 1.1 christos if (b - buf < 10000) { 320 1.1 christos BIO *bio = BIO_new(BIO_s_null()); 321 1.1 christos if (bio != NULL) { 322 1.1 christos ASN1_item_print(bio, o, 4, i, pctx); 323 1.1 christos BIO_free(bio); 324 1.1 christos } 325 1.1 christos } 326 1.1 christos if (ASN1_item_i2d(o, &der, i) > 0) { 327 1.1 christos OPENSSL_free(der); 328 1.1 christos } 329 1.1 christos ASN1_item_free(o, i); 330 1.1 christos } 331 1.1 christos } 332 1.1 christos 333 1.1 christos #ifndef OPENSSL_NO_TS 334 1.1 christos DO_TEST(TS_REQ, d2i_TS_REQ, i2d_TS_REQ, TS_REQ_print_bio); 335 1.1 christos DO_TEST(TS_MSG_IMPRINT, d2i_TS_MSG_IMPRINT, i2d_TS_MSG_IMPRINT, TS_MSG_IMPRINT_print_bio); 336 1.1 christos DO_TEST(TS_RESP, d2i_TS_RESP, i2d_TS_RESP, TS_RESP_print_bio); 337 1.1 christos DO_TEST(TS_STATUS_INFO, d2i_TS_STATUS_INFO, i2d_TS_STATUS_INFO, TS_STATUS_INFO_print_bio); 338 1.1 christos DO_TEST(TS_TST_INFO, d2i_TS_TST_INFO, i2d_TS_TST_INFO, TS_TST_INFO_print_bio); 339 1.1 christos DO_TEST_NO_PRINT(TS_ACCURACY, d2i_TS_ACCURACY, i2d_TS_ACCURACY); 340 1.1 christos #endif 341 1.1 christos DO_TEST_NO_PRINT(ESS_ISSUER_SERIAL, d2i_ESS_ISSUER_SERIAL, i2d_ESS_ISSUER_SERIAL); 342 1.1 christos DO_TEST_NO_PRINT(ESS_CERT_ID, d2i_ESS_CERT_ID, i2d_ESS_CERT_ID); 343 1.1 christos DO_TEST_NO_PRINT(ESS_SIGNING_CERT, d2i_ESS_SIGNING_CERT, i2d_ESS_SIGNING_CERT); 344 1.1 christos DO_TEST_NO_PRINT(ESS_CERT_ID_V2, d2i_ESS_CERT_ID_V2, i2d_ESS_CERT_ID_V2); 345 1.1 christos DO_TEST_NO_PRINT(ESS_SIGNING_CERT_V2, d2i_ESS_SIGNING_CERT_V2, i2d_ESS_SIGNING_CERT_V2); 346 1.1 christos #if !defined(OPENSSL_NO_DH) && !defined(OPENSSL_NO_DEPRECATED_3_0) 347 1.1 christos DO_TEST_NO_PRINT(DH, d2i_DHparams, i2d_DHparams); 348 1.1 christos DO_TEST_NO_PRINT(DH, d2i_DHxparams, i2d_DHxparams); 349 1.1 christos #endif 350 1.1 christos #ifndef OPENSSL_NO_DSA 351 1.1 christos DO_TEST_NO_PRINT(DSA_SIG, d2i_DSA_SIG, i2d_DSA_SIG); 352 1.1.1.2 christos #ifndef OPENSSL_NO_DEPRECATED_3_0 353 1.1 christos DO_TEST_NO_PRINT(DSA, d2i_DSAPrivateKey, i2d_DSAPrivateKey); 354 1.1 christos DO_TEST_NO_PRINT(DSA, d2i_DSAPublicKey, i2d_DSAPublicKey); 355 1.1 christos DO_TEST_NO_PRINT(DSA, d2i_DSAparams, i2d_DSAparams); 356 1.1.1.2 christos #endif 357 1.1 christos #endif 358 1.1 christos #ifndef OPENSSL_NO_DEPRECATED_3_0 359 1.1 christos DO_TEST_NO_PRINT(RSA, d2i_RSAPublicKey, i2d_RSAPublicKey); 360 1.1 christos #endif 361 1.1 christos #ifndef OPENSSL_NO_EC 362 1.1.1.2 christos #ifndef OPENSSL_NO_DEPRECATED_3_0 363 1.1 christos DO_TEST_PRINT_OFFSET(EC_GROUP, d2i_ECPKParameters, i2d_ECPKParameters, ECPKParameters_print); 364 1.1 christos DO_TEST_PRINT_OFFSET(EC_KEY, d2i_ECPrivateKey, i2d_ECPrivateKey, EC_KEY_print); 365 1.1 christos DO_TEST(EC_KEY, d2i_ECParameters, i2d_ECParameters, ECParameters_print); 366 1.1 christos DO_TEST_NO_PRINT(ECDSA_SIG, d2i_ECDSA_SIG, i2d_ECDSA_SIG); 367 1.1.1.2 christos #endif 368 1.1 christos #endif 369 1.1 christos DO_TEST_PRINT_PCTX(EVP_PKEY, d2i_AutoPrivateKey, i2d_PrivateKey, EVP_PKEY_print_private); 370 1.1 christos DO_TEST(SSL_SESSION, d2i_SSL_SESSION, i2d_SSL_SESSION, SSL_SESSION_print); 371 1.1 christos 372 1.1 christos ERR_clear_error(); 373 1.1 christos 374 1.1 christos return 0; 375 1.1 christos } 376 1.1 christos 377 1.1 christos void FuzzerCleanup(void) 378 1.1 christos { 379 1.1 christos ASN1_PCTX_free(pctx); 380 1.1 christos FuzzerClearRand(); 381 1.1 christos } 382