1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * 4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"). You may not use 5e1051a39Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci */ 9e1051a39Sopenharmony_ci 10e1051a39Sopenharmony_ci#ifndef ENCODER_PROVIDER 11e1051a39Sopenharmony_ci# error Macro ENCODER_PROVIDER undefined 12e1051a39Sopenharmony_ci#endif 13e1051a39Sopenharmony_ci 14e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_type_specific_keypair "type-specific" 15e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_type_specific_params "type-specific" 16e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_type_specific "type-specific" 17e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_type_specific_no_pub "type-specific" 18e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_EncryptedPrivateKeyInfo "EncryptedPrivateKeyInfo" 19e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_PrivateKeyInfo "PrivateKeyInfo" 20e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_SubjectPublicKeyInfo "SubjectPublicKeyInfo" 21e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_DH "dh" 22e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_DHX "dhx" 23e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_DSA "dsa" 24e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_EC "ec" 25e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_RSA "rsa" 26e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_PKCS1 "pkcs1" 27e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_PKCS3 "pkcs3" 28e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_X9_42 "X9.42" 29e1051a39Sopenharmony_ci#define ENCODER_STRUCTURE_X9_62 "X9.62" 30e1051a39Sopenharmony_ci 31e1051a39Sopenharmony_ci/* Arguments are prefixed with '_' to avoid build breaks on certain platforms */ 32e1051a39Sopenharmony_ci#define ENCODER_TEXT(_name, _sym, _fips) \ 33e1051a39Sopenharmony_ci { _name, \ 34e1051a39Sopenharmony_ci "provider=" ENCODER_PROVIDER ",fips=" #_fips ",output=text", \ 35e1051a39Sopenharmony_ci (ossl_##_sym##_to_text_encoder_functions) } 36e1051a39Sopenharmony_ci#define ENCODER(_name, _sym, _fips, _output) \ 37e1051a39Sopenharmony_ci { _name, \ 38e1051a39Sopenharmony_ci "provider=" ENCODER_PROVIDER ",fips=" #_fips ",output=" #_output, \ 39e1051a39Sopenharmony_ci (ossl_##_sym##_to_##_output##_encoder_functions) } 40e1051a39Sopenharmony_ci#define ENCODER_w_structure(_name, _sym, _fips, _output, _structure) \ 41e1051a39Sopenharmony_ci { _name, \ 42e1051a39Sopenharmony_ci "provider=" ENCODER_PROVIDER ",fips=" #_fips ",output=" #_output \ 43e1051a39Sopenharmony_ci ",structure=" ENCODER_STRUCTURE_##_structure, \ 44e1051a39Sopenharmony_ci (ossl_##_sym##_to_##_structure##_##_output##_encoder_functions) } 45e1051a39Sopenharmony_ci 46e1051a39Sopenharmony_ci/* 47e1051a39Sopenharmony_ci * Entries for human text "encoders" 48e1051a39Sopenharmony_ci */ 49e1051a39Sopenharmony_ciENCODER_TEXT("RSA", rsa, yes), 50e1051a39Sopenharmony_ciENCODER_TEXT("RSA-PSS", rsapss, yes), 51e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_DH 52e1051a39Sopenharmony_ciENCODER_TEXT("DH", dh, yes), 53e1051a39Sopenharmony_ciENCODER_TEXT("DHX", dhx, yes), 54e1051a39Sopenharmony_ci#endif 55e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_DSA 56e1051a39Sopenharmony_ciENCODER_TEXT("DSA", dsa, yes), 57e1051a39Sopenharmony_ci#endif 58e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_EC 59e1051a39Sopenharmony_ciENCODER_TEXT("EC", ec, yes), 60e1051a39Sopenharmony_ciENCODER_TEXT("ED25519", ed25519, yes), 61e1051a39Sopenharmony_ciENCODER_TEXT("ED448", ed448, yes), 62e1051a39Sopenharmony_ciENCODER_TEXT("X25519", x25519, yes), 63e1051a39Sopenharmony_ciENCODER_TEXT("X448", x448, yes), 64e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_SM2 65e1051a39Sopenharmony_ciENCODER_TEXT("SM2", sm2, no), 66e1051a39Sopenharmony_ci# endif 67e1051a39Sopenharmony_ci#endif 68e1051a39Sopenharmony_ci 69e1051a39Sopenharmony_ci/* 70e1051a39Sopenharmony_ci * Entries for key type specific output formats. The structure name on these 71e1051a39Sopenharmony_ci * is the same as the key type name. This allows us to say something like: 72e1051a39Sopenharmony_ci * 73e1051a39Sopenharmony_ci * To replace i2d_{TYPE}PrivateKey(), i2d_{TYPE}PublicKey() and 74e1051a39Sopenharmony_ci * i2d_{TYPE}Params(), use OSSL_ENCODER functions with an OSSL_ENCODER_CTX 75e1051a39Sopenharmony_ci * created like this: 76e1051a39Sopenharmony_ci * 77e1051a39Sopenharmony_ci * OSSL_ENCODER_CTX *ctx = 78e1051a39Sopenharmony_ci * OSSL_ENCODER_CTX_new_for_pkey(pkey, selection, "DER", "type-specific", 79e1051a39Sopenharmony_ci * NULL, NULL); 80e1051a39Sopenharmony_ci * 81e1051a39Sopenharmony_ci * To replace PEM_write_bio_{TYPE}PrivateKey(), PEM_write_bio_{TYPE}PublicKey() 82e1051a39Sopenharmony_ci * and PEM_write_bio_{TYPE}Params(), use OSSL_ENCODER functions with an 83e1051a39Sopenharmony_ci * OSSL_ENCODER_CTX created like this: 84e1051a39Sopenharmony_ci * 85e1051a39Sopenharmony_ci * OSSL_ENCODER_CTX *ctx = 86e1051a39Sopenharmony_ci * OSSL_ENCODER_CTX_new_for_pkey(pkey, selection, "PEM", "type-specific", 87e1051a39Sopenharmony_ci * NULL, NULL); 88e1051a39Sopenharmony_ci * 89e1051a39Sopenharmony_ci * We only implement those for which there are current i2d_ and PEM_write_bio 90e1051a39Sopenharmony_ci * implementations. 91e1051a39Sopenharmony_ci */ 92e1051a39Sopenharmony_ci 93e1051a39Sopenharmony_ci/* The RSA encoders only support private key and public key output */ 94e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, der, type_specific_keypair), 95e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, pem, type_specific_keypair), 96e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_DH 97e1051a39Sopenharmony_ci/* DH and X9.42 DH only support key parameters output. */ 98e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, der, type_specific_params), 99e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, pem, type_specific_params), 100e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, der, type_specific_params), 101e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, pem, type_specific_params), 102e1051a39Sopenharmony_ci#endif 103e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_DSA 104e1051a39Sopenharmony_ciENCODER_w_structure("DSA", dsa, yes, der, type_specific), 105e1051a39Sopenharmony_ciENCODER_w_structure("DSA", dsa, yes, pem, type_specific), 106e1051a39Sopenharmony_ci#endif 107e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_EC 108e1051a39Sopenharmony_ci/* EC only supports keypair and parameters DER and PEM output. */ 109e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, der, type_specific_no_pub), 110e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, pem, type_specific_no_pub), 111e1051a39Sopenharmony_ci/* EC supports blob output for the public key */ 112e1051a39Sopenharmony_ciENCODER("EC", ec, yes, blob), 113e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_SM2 114e1051a39Sopenharmony_ciENCODER_w_structure("SM2", sm2, no, der, type_specific_no_pub), 115e1051a39Sopenharmony_ciENCODER_w_structure("SM2", sm2, no, pem, type_specific_no_pub), 116e1051a39Sopenharmony_ciENCODER("SM2", sm2, no, blob), 117e1051a39Sopenharmony_ci# endif 118e1051a39Sopenharmony_ci#endif 119e1051a39Sopenharmony_ci 120e1051a39Sopenharmony_ci/* 121e1051a39Sopenharmony_ci * Entries for the output formats MSBLOB and PVK 122e1051a39Sopenharmony_ci */ 123e1051a39Sopenharmony_ciENCODER("RSA", rsa, yes, msblob), 124e1051a39Sopenharmony_ciENCODER("RSA", rsa, yes, pvk), 125e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_DSA 126e1051a39Sopenharmony_ciENCODER("DSA", dsa, yes, msblob), 127e1051a39Sopenharmony_ciENCODER("DSA", dsa, yes, pvk), 128e1051a39Sopenharmony_ci#endif 129e1051a39Sopenharmony_ci 130e1051a39Sopenharmony_ci/* 131e1051a39Sopenharmony_ci * Entries for encrypted PKCS#8 (EncryptedPrivateKeyInfo), unencrypted PKCS#8 132e1051a39Sopenharmony_ci * (PrivateKeyInfo) and SubjectPublicKeyInfo. The "der" ones are added 133e1051a39Sopenharmony_ci * convenience for any user that wants to use OSSL_ENCODER directly. 134e1051a39Sopenharmony_ci * The "pem" ones also support PEM_write_bio_PrivateKey() and 135e1051a39Sopenharmony_ci * PEM_write_bio_PUBKEY(). 136e1051a39Sopenharmony_ci */ 137e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, der, EncryptedPrivateKeyInfo), 138e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, pem, EncryptedPrivateKeyInfo), 139e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, der, PrivateKeyInfo), 140e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, pem, PrivateKeyInfo), 141e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, der, SubjectPublicKeyInfo), 142e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, pem, SubjectPublicKeyInfo), 143e1051a39Sopenharmony_ci 144e1051a39Sopenharmony_ciENCODER_w_structure("RSA-PSS", rsapss, yes, der, EncryptedPrivateKeyInfo), 145e1051a39Sopenharmony_ciENCODER_w_structure("RSA-PSS", rsapss, yes, pem, EncryptedPrivateKeyInfo), 146e1051a39Sopenharmony_ciENCODER_w_structure("RSA-PSS", rsapss, yes, der, PrivateKeyInfo), 147e1051a39Sopenharmony_ciENCODER_w_structure("RSA-PSS", rsapss, yes, pem, PrivateKeyInfo), 148e1051a39Sopenharmony_ciENCODER_w_structure("RSA-PSS", rsapss, yes, der, SubjectPublicKeyInfo), 149e1051a39Sopenharmony_ciENCODER_w_structure("RSA-PSS", rsapss, yes, pem, SubjectPublicKeyInfo), 150e1051a39Sopenharmony_ci 151e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_DH 152e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, der, EncryptedPrivateKeyInfo), 153e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, pem, EncryptedPrivateKeyInfo), 154e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, der, PrivateKeyInfo), 155e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, pem, PrivateKeyInfo), 156e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, der, SubjectPublicKeyInfo), 157e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, pem, SubjectPublicKeyInfo), 158e1051a39Sopenharmony_ci 159e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, der, EncryptedPrivateKeyInfo), 160e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, pem, EncryptedPrivateKeyInfo), 161e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, der, PrivateKeyInfo), 162e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, pem, PrivateKeyInfo), 163e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, der, SubjectPublicKeyInfo), 164e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, pem, SubjectPublicKeyInfo), 165e1051a39Sopenharmony_ci#endif 166e1051a39Sopenharmony_ci 167e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_DSA 168e1051a39Sopenharmony_ciENCODER_w_structure("DSA", dsa, yes, der, EncryptedPrivateKeyInfo), 169e1051a39Sopenharmony_ciENCODER_w_structure("DSA", dsa, yes, pem, EncryptedPrivateKeyInfo), 170e1051a39Sopenharmony_ciENCODER_w_structure("DSA", dsa, yes, der, PrivateKeyInfo), 171e1051a39Sopenharmony_ciENCODER_w_structure("DSA", dsa, yes, pem, PrivateKeyInfo), 172e1051a39Sopenharmony_ciENCODER_w_structure("DSA", dsa, yes, der, SubjectPublicKeyInfo), 173e1051a39Sopenharmony_ciENCODER_w_structure("DSA", dsa, yes, pem, SubjectPublicKeyInfo), 174e1051a39Sopenharmony_ci#endif 175e1051a39Sopenharmony_ci 176e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_EC 177e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, der, EncryptedPrivateKeyInfo), 178e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, pem, EncryptedPrivateKeyInfo), 179e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, der, PrivateKeyInfo), 180e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, pem, PrivateKeyInfo), 181e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, der, SubjectPublicKeyInfo), 182e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, pem, SubjectPublicKeyInfo), 183e1051a39Sopenharmony_ci 184e1051a39Sopenharmony_ciENCODER_w_structure("X25519", x25519, yes, der, EncryptedPrivateKeyInfo), 185e1051a39Sopenharmony_ciENCODER_w_structure("X25519", x25519, yes, pem, EncryptedPrivateKeyInfo), 186e1051a39Sopenharmony_ciENCODER_w_structure("X25519", x25519, yes, der, PrivateKeyInfo), 187e1051a39Sopenharmony_ciENCODER_w_structure("X25519", x25519, yes, pem, PrivateKeyInfo), 188e1051a39Sopenharmony_ciENCODER_w_structure("X25519", x25519, yes, der, SubjectPublicKeyInfo), 189e1051a39Sopenharmony_ciENCODER_w_structure("X25519", x25519, yes, pem, SubjectPublicKeyInfo), 190e1051a39Sopenharmony_ci 191e1051a39Sopenharmony_ciENCODER_w_structure("X448", x448, yes, der, EncryptedPrivateKeyInfo), 192e1051a39Sopenharmony_ciENCODER_w_structure("X448", x448, yes, pem, EncryptedPrivateKeyInfo), 193e1051a39Sopenharmony_ciENCODER_w_structure("X448", x448, yes, der, PrivateKeyInfo), 194e1051a39Sopenharmony_ciENCODER_w_structure("X448", x448, yes, pem, PrivateKeyInfo), 195e1051a39Sopenharmony_ciENCODER_w_structure("X448", x448, yes, der, SubjectPublicKeyInfo), 196e1051a39Sopenharmony_ciENCODER_w_structure("X448", x448, yes, pem, SubjectPublicKeyInfo), 197e1051a39Sopenharmony_ci 198e1051a39Sopenharmony_ciENCODER_w_structure("ED25519", ed25519, yes, der, EncryptedPrivateKeyInfo), 199e1051a39Sopenharmony_ciENCODER_w_structure("ED25519", ed25519, yes, pem, EncryptedPrivateKeyInfo), 200e1051a39Sopenharmony_ciENCODER_w_structure("ED25519", ed25519, yes, der, PrivateKeyInfo), 201e1051a39Sopenharmony_ciENCODER_w_structure("ED25519", ed25519, yes, pem, PrivateKeyInfo), 202e1051a39Sopenharmony_ciENCODER_w_structure("ED25519", ed25519, yes, der, SubjectPublicKeyInfo), 203e1051a39Sopenharmony_ciENCODER_w_structure("ED25519", ed25519, yes, pem, SubjectPublicKeyInfo), 204e1051a39Sopenharmony_ci 205e1051a39Sopenharmony_ciENCODER_w_structure("ED448", ed448, yes, der, EncryptedPrivateKeyInfo), 206e1051a39Sopenharmony_ciENCODER_w_structure("ED448", ed448, yes, pem, EncryptedPrivateKeyInfo), 207e1051a39Sopenharmony_ciENCODER_w_structure("ED448", ed448, yes, der, PrivateKeyInfo), 208e1051a39Sopenharmony_ciENCODER_w_structure("ED448", ed448, yes, pem, PrivateKeyInfo), 209e1051a39Sopenharmony_ciENCODER_w_structure("ED448", ed448, yes, der, SubjectPublicKeyInfo), 210e1051a39Sopenharmony_ciENCODER_w_structure("ED448", ed448, yes, pem, SubjectPublicKeyInfo), 211e1051a39Sopenharmony_ci 212e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_SM2 213e1051a39Sopenharmony_ciENCODER_w_structure("SM2", sm2, no, der, EncryptedPrivateKeyInfo), 214e1051a39Sopenharmony_ciENCODER_w_structure("SM2", sm2, no, pem, EncryptedPrivateKeyInfo), 215e1051a39Sopenharmony_ciENCODER_w_structure("SM2", sm2, no, der, PrivateKeyInfo), 216e1051a39Sopenharmony_ciENCODER_w_structure("SM2", sm2, no, pem, PrivateKeyInfo), 217e1051a39Sopenharmony_ciENCODER_w_structure("SM2", sm2, no, der, SubjectPublicKeyInfo), 218e1051a39Sopenharmony_ciENCODER_w_structure("SM2", sm2, no, pem, SubjectPublicKeyInfo), 219e1051a39Sopenharmony_ci# endif 220e1051a39Sopenharmony_ci#endif 221e1051a39Sopenharmony_ci 222e1051a39Sopenharmony_ci/* 223e1051a39Sopenharmony_ci * Entries for key type specific output formats. These are exactly the 224e1051a39Sopenharmony_ci * same as the type specific above, except that they use the key type 225e1051a39Sopenharmony_ci * name as structure name instead of "type-specific", in the call on 226e1051a39Sopenharmony_ci * OSSL_ENCODER_CTX_new_for_pkey(). 227e1051a39Sopenharmony_ci */ 228e1051a39Sopenharmony_ci 229e1051a39Sopenharmony_ci/* The RSA encoders only support private key and public key output */ 230e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, der, RSA), 231e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, pem, RSA), 232e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_DH 233e1051a39Sopenharmony_ci/* DH and X9.42 DH only support key parameters output. */ 234e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, der, DH), 235e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, pem, DH), 236e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, der, DHX), 237e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, pem, DHX), 238e1051a39Sopenharmony_ci#endif 239e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_DSA 240e1051a39Sopenharmony_ciENCODER_w_structure("DSA", dsa, yes, der, DSA), 241e1051a39Sopenharmony_ciENCODER_w_structure("DSA", dsa, yes, pem, DSA), 242e1051a39Sopenharmony_ci#endif 243e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_EC 244e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, der, EC), 245e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, pem, EC), 246e1051a39Sopenharmony_ci#endif 247e1051a39Sopenharmony_ci 248e1051a39Sopenharmony_ci/* 249e1051a39Sopenharmony_ci * Additional entries with structure names being the standard name. 250e1051a39Sopenharmony_ci * This is entirely for the convenience of the user that wants to use 251e1051a39Sopenharmony_ci * OSSL_ENCODER directly with names they may fancy. These do not impact 252e1051a39Sopenharmony_ci * on libcrypto functionality in any way. 253e1051a39Sopenharmony_ci */ 254e1051a39Sopenharmony_ci/* PKCS#1 is a well known for plain RSA keys, so we add that too */ 255e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, der, PKCS1), 256e1051a39Sopenharmony_ciENCODER_w_structure("RSA", rsa, yes, pem, PKCS1), 257e1051a39Sopenharmony_ciENCODER_w_structure("RSA-PSS", rsapss, yes, der, PKCS1), 258e1051a39Sopenharmony_ciENCODER_w_structure("RSA-PSS", rsapss, yes, pem, PKCS1), 259e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_DH 260e1051a39Sopenharmony_ci/* PKCS#3 defines the format for DH parameters */ 261e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, der, PKCS3), 262e1051a39Sopenharmony_ciENCODER_w_structure("DH", dh, yes, pem, PKCS3), 263e1051a39Sopenharmony_ci/* X9.42 defines the format for DHX parameters */ 264e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, der, X9_42), 265e1051a39Sopenharmony_ciENCODER_w_structure("DHX", dhx, yes, pem, X9_42), 266e1051a39Sopenharmony_ci#endif 267e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_EC 268e1051a39Sopenharmony_ci/* RFC 5915 defines the format for EC keys and parameters */ 269e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, der, X9_62), 270e1051a39Sopenharmony_ciENCODER_w_structure("EC", ec, yes, pem, X9_62), 271e1051a39Sopenharmony_ci#endif 272