Coverage Report

Created: 2026-03-10 06:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl/providers/implementations/encode_decode/encode_key2any.c
Line
Count
Source
1
/*
2
 * Copyright 2020-2025 The OpenSSL Project Authors. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License 2.0 (the "License").  You may not use
5
 * this file except in compliance with the License.  You can obtain a copy
6
 * in the file LICENSE in the source distribution or at
7
 * https://www.openssl.org/source/license.html
8
 */
9
10
/*
11
 * Low level APIs are deprecated for public use, but still ok for internal use.
12
 */
13
#include "internal/deprecated.h"
14
15
#include <openssl/byteorder.h>
16
#include <openssl/core.h>
17
#include <openssl/core_dispatch.h>
18
#include <openssl/core_names.h>
19
#include <openssl/crypto.h>
20
#include <openssl/params.h>
21
#include <openssl/asn1.h>
22
#include <openssl/err.h>
23
#include <openssl/pem.h>
24
#include <openssl/x509.h>
25
#include <openssl/pkcs12.h> /* PKCS8_encrypt() */
26
#include <openssl/dh.h>
27
#include <openssl/dsa.h>
28
#include <openssl/ec.h>
29
#include <openssl/proverr.h>
30
#include "internal/passphrase.h"
31
#include "internal/cryptlib.h"
32
#include "crypto/ecx.h"
33
#include "crypto/ml_kem.h"
34
#include "crypto/rsa.h"
35
#include "crypto/ml_dsa.h"
36
#include "crypto/slh_dsa.h"
37
#include "prov/implementations.h"
38
#include "prov/bio.h"
39
#include "prov/provider_ctx.h"
40
#include "prov/der_rsa.h"
41
#include "prov/endecoder_local.h"
42
#include "prov/ml_dsa_codecs.h"
43
#include "prov/ml_kem_codecs.h"
44
#include "prov/lms_codecs.h"
45
#include "providers/implementations/encode_decode/encode_key2any.inc"
46
47
#include <crypto/asn1.h>
48
49
#if defined(OPENSSL_NO_DH) && defined(OPENSSL_NO_DSA) && defined(OPENSSL_NO_EC)
50
#define OPENSSL_NO_KEYPARAMS
51
#endif
52
53
typedef struct key2any_ctx_st {
54
    PROV_CTX *provctx;
55
56
    /* Set to 0 if parameters should not be saved (dsa only) */
57
    int save_parameters;
58
59
    /* Set to 1 if intending to encrypt/decrypt, otherwise 0 */
60
    int cipher_intent;
61
62
    EVP_CIPHER *cipher;
63
64
    struct ossl_passphrase_data_st pwdata;
65
66
    /* Just-in-time ML-KEM and ML-DSA output format override */
67
    char *output_formats;
68
} KEY2ANY_CTX;
69
70
typedef int check_key_type_fn(const void *key, int nid);
71
typedef int key_to_paramstring_fn(const void *key, int nid, int save,
72
    void **str, int *strtype);
73
typedef int key_to_der_fn(BIO *out, const void *key,
74
    int key_nid, const char *pemname,
75
    key_to_paramstring_fn *p2s,
76
    OSSL_i2d_of_void_ctx *k2d, KEY2ANY_CTX *ctx);
77
typedef int write_bio_of_void_fn(BIO *bp, const void *x);
78
79
/* Free the blob allocated during key_to_paramstring_fn */
80
static void free_asn1_data(int type, void *data)
81
0
{
82
0
    switch (type) {
83
0
    case V_ASN1_OBJECT:
84
0
        ASN1_OBJECT_free(data);
85
0
        break;
86
0
    case V_ASN1_SEQUENCE:
87
0
        ASN1_STRING_free(data);
88
0
        break;
89
0
    }
90
0
}
91
92
static PKCS8_PRIV_KEY_INFO *key_to_p8info(const void *key, int key_nid,
93
    void *params, int params_type,
94
    OSSL_i2d_of_void_ctx *k2d,
95
    KEY2ANY_CTX *ctx)
96
0
{
97
    /* der, derlen store the key DER output and its length */
98
0
    unsigned char *der = NULL;
99
0
    int derlen;
100
    /* The final PKCS#8 info */
101
0
    PKCS8_PRIV_KEY_INFO *p8info = NULL;
102
103
0
    if ((p8info = PKCS8_PRIV_KEY_INFO_new()) == NULL
104
0
        || (derlen = k2d(key, &der, (void *)ctx)) <= 0
105
0
        || !PKCS8_pkey_set0(p8info, OBJ_nid2obj(key_nid), 0,
106
0
            params_type, params, der, derlen)) {
107
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
108
0
        PKCS8_PRIV_KEY_INFO_free(p8info);
109
0
        OPENSSL_free(der);
110
0
        p8info = NULL;
111
0
    }
112
113
0
    return p8info;
114
0
}
115
116
static X509_SIG *p8info_to_encp8(PKCS8_PRIV_KEY_INFO *p8info,
117
    KEY2ANY_CTX *ctx)
118
0
{
119
0
    X509_SIG *p8 = NULL;
120
0
    char kstr[PEM_BUFSIZE];
121
0
    size_t klen = 0;
122
0
    OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
123
124
0
    if (ctx->cipher == NULL)
125
0
        return NULL;
126
127
0
    if (!ossl_pw_get_passphrase(kstr, sizeof(kstr), &klen, NULL, 1,
128
0
            &ctx->pwdata)) {
129
0
        ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_GET_PASSPHRASE);
130
0
        return NULL;
131
0
    }
132
    /* First argument == -1 means "standard" */
133
0
    p8 = PKCS8_encrypt_ex(-1, ctx->cipher, kstr, (int)klen, NULL, 0, 0, p8info,
134
0
        libctx, NULL);
135
0
    OPENSSL_cleanse(kstr, klen);
136
0
    return p8;
137
0
}
138
139
static X509_SIG *key_to_encp8(const void *key, int key_nid,
140
    void *params, int params_type,
141
    OSSL_i2d_of_void_ctx *k2d,
142
    KEY2ANY_CTX *ctx)
143
0
{
144
0
    PKCS8_PRIV_KEY_INFO *p8info = key_to_p8info(key, key_nid, params, params_type, k2d, ctx);
145
0
    X509_SIG *p8 = NULL;
146
147
0
    if (p8info == NULL) {
148
0
        free_asn1_data(params_type, params);
149
0
    } else {
150
0
        p8 = p8info_to_encp8(p8info, ctx);
151
0
        PKCS8_PRIV_KEY_INFO_free(p8info);
152
0
    }
153
0
    return p8;
154
0
}
155
156
static X509_PUBKEY *key_to_pubkey(const void *key, int key_nid,
157
    void *params, int params_type,
158
    OSSL_i2d_of_void_ctx *k2d,
159
    KEY2ANY_CTX *ctx)
160
0
{
161
    /* der, derlen store the key DER output and its length */
162
0
    unsigned char *der = NULL;
163
0
    int derlen;
164
    /* The final X509_PUBKEY */
165
0
    X509_PUBKEY *xpk = NULL;
166
167
0
    if ((xpk = X509_PUBKEY_new()) == NULL
168
0
        || (derlen = k2d(key, &der, (void *)ctx)) <= 0
169
0
        || !X509_PUBKEY_set0_param(xpk, OBJ_nid2obj(key_nid),
170
0
            params_type, params, der, derlen)) {
171
0
        ERR_raise(ERR_LIB_PROV, ERR_R_X509_LIB);
172
0
        X509_PUBKEY_free(xpk);
173
0
        OPENSSL_free(der);
174
0
        xpk = NULL;
175
0
    }
176
177
0
    return xpk;
178
0
}
179
180
/*
181
 * key_to_epki_* produce encoded output with the private key data in a
182
 * EncryptedPrivateKeyInfo structure (defined by PKCS#8).  They require
183
 * that there's an intent to encrypt, anything else is an error.
184
 *
185
 * key_to_pki_* primarily produce encoded output with the private key data
186
 * in a PrivateKeyInfo structure (also defined by PKCS#8).  However, if
187
 * there is an intent to encrypt the data, the corresponding key_to_epki_*
188
 * function is used instead.
189
 *
190
 * key_to_spki_* produce encoded output with the public key data in an
191
 * X.509 SubjectPublicKeyInfo.
192
 *
193
 * Key parameters don't have any defined envelopment of this kind, but are
194
 * included in some manner in the output from the functions described above,
195
 * either in the AlgorithmIdentifier's parameter field, or as part of the
196
 * key data itself.
197
 */
198
199
static int key_to_epki_der_priv_bio(BIO *out, const void *key,
200
    int key_nid,
201
    ossl_unused const char *pemname,
202
    key_to_paramstring_fn *p2s,
203
    OSSL_i2d_of_void_ctx *k2d,
204
    KEY2ANY_CTX *ctx)
205
0
{
206
0
    int ret = 0;
207
0
    void *str = NULL;
208
0
    int strtype = V_ASN1_UNDEF;
209
0
    X509_SIG *p8;
210
211
0
    if (!ctx->cipher_intent)
212
0
        return 0;
213
214
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
215
0
        return 0;
216
217
0
    p8 = key_to_encp8(key, key_nid, str, strtype, k2d, ctx);
218
0
    if (p8 != NULL)
219
0
        ret = i2d_PKCS8_bio(out, p8);
220
221
0
    X509_SIG_free(p8);
222
223
0
    return ret;
224
0
}
225
226
static int key_to_epki_pem_priv_bio(BIO *out, const void *key,
227
    int key_nid,
228
    ossl_unused const char *pemname,
229
    key_to_paramstring_fn *p2s,
230
    OSSL_i2d_of_void_ctx *k2d,
231
    KEY2ANY_CTX *ctx)
232
0
{
233
0
    int ret = 0;
234
0
    void *str = NULL;
235
0
    int strtype = V_ASN1_UNDEF;
236
0
    X509_SIG *p8;
237
238
0
    if (!ctx->cipher_intent)
239
0
        return 0;
240
241
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
242
0
        return 0;
243
244
0
    p8 = key_to_encp8(key, key_nid, str, strtype, k2d, ctx);
245
0
    if (p8 != NULL)
246
0
        ret = PEM_write_bio_PKCS8(out, p8);
247
248
0
    X509_SIG_free(p8);
249
250
0
    return ret;
251
0
}
252
253
static int key_to_pki_der_priv_bio(BIO *out, const void *key,
254
    int key_nid,
255
    ossl_unused const char *pemname,
256
    key_to_paramstring_fn *p2s,
257
    OSSL_i2d_of_void_ctx *k2d,
258
    KEY2ANY_CTX *ctx)
259
0
{
260
0
    int ret = 0;
261
0
    void *str = NULL;
262
0
    int strtype = V_ASN1_UNDEF;
263
0
    PKCS8_PRIV_KEY_INFO *p8info;
264
265
0
    if (ctx->cipher_intent)
266
0
        return key_to_epki_der_priv_bio(out, key, key_nid, pemname,
267
0
            p2s, k2d, ctx);
268
269
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
270
0
        return 0;
271
272
0
    p8info = key_to_p8info(key, key_nid, str, strtype, k2d, ctx);
273
274
0
    if (p8info != NULL)
275
0
        ret = i2d_PKCS8_PRIV_KEY_INFO_bio(out, p8info);
276
0
    else
277
0
        free_asn1_data(strtype, str);
278
279
0
    PKCS8_PRIV_KEY_INFO_free(p8info);
280
281
0
    return ret;
282
0
}
283
284
static int key_to_pki_pem_priv_bio(BIO *out, const void *key,
285
    int key_nid,
286
    ossl_unused const char *pemname,
287
    key_to_paramstring_fn *p2s,
288
    OSSL_i2d_of_void_ctx *k2d,
289
    KEY2ANY_CTX *ctx)
290
0
{
291
0
    int ret = 0;
292
0
    void *str = NULL;
293
0
    int strtype = V_ASN1_UNDEF;
294
0
    PKCS8_PRIV_KEY_INFO *p8info;
295
296
0
    if (ctx->cipher_intent)
297
0
        return key_to_epki_pem_priv_bio(out, key, key_nid, pemname,
298
0
            p2s, k2d, ctx);
299
300
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
301
0
        return 0;
302
303
0
    p8info = key_to_p8info(key, key_nid, str, strtype, k2d, ctx);
304
305
0
    if (p8info != NULL)
306
0
        ret = PEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8info);
307
0
    else
308
0
        free_asn1_data(strtype, str);
309
310
0
    PKCS8_PRIV_KEY_INFO_free(p8info);
311
312
0
    return ret;
313
0
}
314
315
static int key_to_spki_der_pub_bio(BIO *out, const void *key,
316
    int key_nid,
317
    ossl_unused const char *pemname,
318
    key_to_paramstring_fn *p2s,
319
    OSSL_i2d_of_void_ctx *k2d,
320
    KEY2ANY_CTX *ctx)
321
0
{
322
0
    int ret = 0;
323
0
    void *str = NULL;
324
0
    int strtype = V_ASN1_UNDEF;
325
0
    X509_PUBKEY *xpk = NULL;
326
327
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
328
0
        return 0;
329
330
0
    xpk = key_to_pubkey(key, key_nid, str, strtype, k2d, ctx);
331
332
0
    if (xpk != NULL)
333
0
        ret = i2d_X509_PUBKEY_bio(out, xpk);
334
335
    /* Also frees |str| */
336
0
    X509_PUBKEY_free(xpk);
337
0
    return ret;
338
0
}
339
340
static int key_to_spki_pem_pub_bio(BIO *out, const void *key,
341
    int key_nid,
342
    ossl_unused const char *pemname,
343
    key_to_paramstring_fn *p2s,
344
    OSSL_i2d_of_void_ctx *k2d,
345
    KEY2ANY_CTX *ctx)
346
0
{
347
0
    int ret = 0;
348
0
    void *str = NULL;
349
0
    int strtype = V_ASN1_UNDEF;
350
0
    X509_PUBKEY *xpk = NULL;
351
352
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
353
0
        return 0;
354
355
0
    xpk = key_to_pubkey(key, key_nid, str, strtype, k2d, ctx);
356
357
0
    if (xpk != NULL)
358
0
        ret = PEM_write_bio_X509_PUBKEY(out, xpk);
359
0
    else
360
0
        free_asn1_data(strtype, str);
361
362
    /* Also frees |str| */
363
0
    X509_PUBKEY_free(xpk);
364
0
    return ret;
365
0
}
366
367
/*
368
 * key_to_type_specific_* produce encoded output with type specific key data,
369
 * no envelopment; the same kind of output as the type specific i2d_ and
370
 * PEM_write_ functions, which is often a simple SEQUENCE of INTEGER.
371
 *
372
 * OpenSSL tries to discourage production of new keys in this form, because
373
 * of the ambiguity when trying to recognise them, but can't deny that PKCS#1
374
 * et al still are live standards.
375
 *
376
 * Note that these functions completely ignore p2s, and rather rely entirely
377
 * on k2d to do the complete work.
378
 */
379
static int key_to_type_specific_der_bio(BIO *out, const void *key,
380
    int key_nid,
381
    ossl_unused const char *pemname,
382
    key_to_paramstring_fn *p2s,
383
    OSSL_i2d_of_void_ctx *k2d,
384
    KEY2ANY_CTX *ctx)
385
0
{
386
0
    unsigned char *der = NULL;
387
0
    int derlen;
388
0
    int ret;
389
390
0
    if ((derlen = k2d(key, &der, (void *)ctx)) <= 0) {
391
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PROV_LIB);
392
0
        return 0;
393
0
    }
394
395
0
    ret = BIO_write(out, der, derlen);
396
0
    OPENSSL_free(der);
397
0
    return ret > 0;
398
0
}
399
0
#define key_to_type_specific_der_priv_bio key_to_type_specific_der_bio
400
0
#define key_to_type_specific_der_pub_bio key_to_type_specific_der_bio
401
0
#define key_to_type_specific_der_param_bio key_to_type_specific_der_bio
402
403
static int key_to_type_specific_pem_bio_cb(BIO *out, const void *key,
404
    int key_nid, const char *pemname,
405
    key_to_paramstring_fn *p2s,
406
    OSSL_i2d_of_void_ctx *k2d,
407
    KEY2ANY_CTX *ctx,
408
    pem_password_cb *cb, void *cbarg)
409
0
{
410
0
    return PEM_ASN1_write_bio_ctx(k2d, (void *)ctx, pemname, out, key,
411
0
               ctx->cipher, NULL, 0, cb, cbarg)
412
0
        > 0;
413
0
}
414
415
static int key_to_type_specific_pem_priv_bio(BIO *out, const void *key,
416
    int key_nid, const char *pemname,
417
    key_to_paramstring_fn *p2s,
418
    OSSL_i2d_of_void_ctx *k2d,
419
    KEY2ANY_CTX *ctx)
420
0
{
421
0
    return key_to_type_specific_pem_bio_cb(out, key, key_nid, pemname,
422
0
        p2s, k2d, ctx,
423
0
        ossl_pw_pem_password, &ctx->pwdata);
424
0
}
425
426
static int key_to_type_specific_pem_pub_bio(BIO *out, const void *key,
427
    int key_nid, const char *pemname,
428
    key_to_paramstring_fn *p2s,
429
    OSSL_i2d_of_void_ctx *k2d,
430
    KEY2ANY_CTX *ctx)
431
0
{
432
0
    return key_to_type_specific_pem_bio_cb(out, key, key_nid, pemname,
433
0
        p2s, k2d, ctx, NULL, NULL);
434
0
}
435
436
#ifndef OPENSSL_NO_KEYPARAMS
437
static int key_to_type_specific_pem_param_bio(BIO *out, const void *key,
438
    int key_nid, const char *pemname,
439
    key_to_paramstring_fn *p2s,
440
    OSSL_i2d_of_void_ctx *k2d,
441
    KEY2ANY_CTX *ctx)
442
0
{
443
0
    return key_to_type_specific_pem_bio_cb(out, key, key_nid, pemname,
444
0
        p2s, k2d, ctx, NULL, NULL);
445
0
}
446
#endif
447
448
/* ---------------------------------------------------------------------- */
449
450
#define k2d_NOCTX(n, f)                            \
451
    static int                                     \
452
    n##_k2d(const void *key, unsigned char **pder, \
453
        ossl_unused void *ctx)                     \
454
0
    {                                              \
455
0
        return f(key, pder);                       \
456
0
    }
Unexecuted instantiation: encode_key2any.c:rsa_prv_k2d
Unexecuted instantiation: encode_key2any.c:rsa_pub_k2d
Unexecuted instantiation: encode_key2any.c:dsa_prv_k2d
Unexecuted instantiation: encode_key2any.c:dsa_pub_k2d
Unexecuted instantiation: encode_key2any.c:dsa_param_k2d
Unexecuted instantiation: encode_key2any.c:ec_prv_k2d
Unexecuted instantiation: encode_key2any.c:ec_param_k2d
457
458
/* ---------------------------------------------------------------------- */
459
460
#ifndef OPENSSL_NO_DH
461
static int prepare_dh_params(const void *dh, int nid, int save,
462
    void **pstr, int *pstrtype)
463
0
{
464
0
    ASN1_STRING *params = ASN1_STRING_new();
465
466
0
    if (params == NULL) {
467
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
468
0
        return 0;
469
0
    }
470
471
0
    if (nid == EVP_PKEY_DHX)
472
0
        params->length = i2d_DHxparams(dh, &params->data);
473
0
    else
474
0
        params->length = i2d_DHparams(dh, &params->data);
475
476
0
    if (params->length <= 0) {
477
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
478
0
        ASN1_STRING_free(params);
479
0
        return 0;
480
0
    }
481
0
    params->type = V_ASN1_SEQUENCE;
482
483
0
    *pstr = params;
484
0
    *pstrtype = V_ASN1_SEQUENCE;
485
0
    return 1;
486
0
}
487
488
static int dh_spki_pub_to_der(const void *dh, unsigned char **pder,
489
    ossl_unused void *ctx)
490
0
{
491
0
    const BIGNUM *bn = NULL;
492
0
    ASN1_INTEGER *pub_key = NULL;
493
0
    int ret;
494
495
0
    if ((bn = DH_get0_pub_key(dh)) == NULL) {
496
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
497
0
        return 0;
498
0
    }
499
0
    if ((pub_key = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) {
500
0
        ERR_raise(ERR_LIB_PROV, PROV_R_BN_ERROR);
501
0
        return 0;
502
0
    }
503
504
0
    ret = i2d_ASN1_INTEGER(pub_key, pder);
505
506
0
    ASN1_STRING_clear_free(pub_key);
507
0
    return ret;
508
0
}
509
510
static int dh_pki_priv_to_der(const void *dh, unsigned char **pder,
511
    ossl_unused void *ctx)
512
0
{
513
0
    const BIGNUM *bn = NULL;
514
0
    ASN1_INTEGER *priv_key = NULL;
515
0
    int ret;
516
517
0
    if ((bn = DH_get0_priv_key(dh)) == NULL) {
518
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
519
0
        return 0;
520
0
    }
521
0
    if ((priv_key = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) {
522
0
        ERR_raise(ERR_LIB_PROV, PROV_R_BN_ERROR);
523
0
        return 0;
524
0
    }
525
526
0
    ret = i2d_ASN1_INTEGER(priv_key, pder);
527
528
0
    ASN1_STRING_clear_free(priv_key);
529
0
    return ret;
530
0
}
531
532
0
#define dh_epki_priv_to_der dh_pki_priv_to_der
533
534
static int
535
dh_type_specific_params_to_der(const void *dh, unsigned char **pder,
536
    ossl_unused void *ctx)
537
0
{
538
0
    if (DH_test_flags(dh, DH_FLAG_TYPE_DHX))
539
0
        return i2d_DHxparams(dh, pder);
540
0
    return i2d_DHparams(dh, pder);
541
0
}
542
543
/*
544
 * DH doesn't have i2d_DHPrivateKey or i2d_DHPublicKey, so we can't make
545
 * corresponding functions here.
546
 */
547
#define dh_type_specific_priv_to_der NULL
548
#define dh_type_specific_pub_to_der NULL
549
550
static int dh_check_key_type(const void *dh, int expected_type)
551
0
{
552
0
    int type = DH_test_flags(dh, DH_FLAG_TYPE_DHX) ? EVP_PKEY_DHX : EVP_PKEY_DH;
553
554
0
    return type == expected_type;
555
0
}
556
557
0
#define dh_evp_type EVP_PKEY_DH
558
0
#define dhx_evp_type EVP_PKEY_DHX
559
0
#define dh_pem_type "DH"
560
0
#define dhx_pem_type "X9.42 DH"
561
#endif
562
563
/* ---------------------------------------------------------------------- */
564
565
#ifndef OPENSSL_NO_DSA
566
static int encode_dsa_params(const void *dsa, int nid,
567
    void **pstr, int *pstrtype)
568
0
{
569
0
    ASN1_STRING *params = ASN1_STRING_new();
570
571
0
    if (params == NULL) {
572
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
573
0
        return 0;
574
0
    }
575
576
0
    params->length = i2d_DSAparams(dsa, &params->data);
577
578
0
    if (params->length <= 0) {
579
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
580
0
        ASN1_STRING_free(params);
581
0
        return 0;
582
0
    }
583
584
0
    *pstrtype = V_ASN1_SEQUENCE;
585
0
    *pstr = params;
586
0
    return 1;
587
0
}
588
589
static int prepare_dsa_params(const void *dsa, int nid, int save,
590
    void **pstr, int *pstrtype)
591
0
{
592
0
    const BIGNUM *p = DSA_get0_p(dsa);
593
0
    const BIGNUM *q = DSA_get0_q(dsa);
594
0
    const BIGNUM *g = DSA_get0_g(dsa);
595
596
0
    if (save && p != NULL && q != NULL && g != NULL)
597
0
        return encode_dsa_params(dsa, nid, pstr, pstrtype);
598
599
0
    *pstr = NULL;
600
0
    *pstrtype = V_ASN1_UNDEF;
601
0
    return 1;
602
0
}
603
604
static int dsa_spki_pub_to_der(const void *dsa, unsigned char **pder,
605
    ossl_unused void *ctx)
606
0
{
607
0
    const BIGNUM *bn = NULL;
608
0
    ASN1_INTEGER *pub_key = NULL;
609
0
    int ret;
610
611
0
    if ((bn = DSA_get0_pub_key(dsa)) == NULL) {
612
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
613
0
        return 0;
614
0
    }
615
0
    if ((pub_key = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) {
616
0
        ERR_raise(ERR_LIB_PROV, PROV_R_BN_ERROR);
617
0
        return 0;
618
0
    }
619
620
0
    ret = i2d_ASN1_INTEGER(pub_key, pder);
621
622
0
    ASN1_STRING_clear_free(pub_key);
623
0
    return ret;
624
0
}
625
626
static int dsa_pki_priv_to_der(const void *dsa, unsigned char **pder,
627
    ossl_unused void *ctx)
628
0
{
629
0
    const BIGNUM *bn = NULL;
630
0
    ASN1_INTEGER *priv_key = NULL;
631
0
    int ret;
632
633
0
    if ((bn = DSA_get0_priv_key(dsa)) == NULL) {
634
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
635
0
        return 0;
636
0
    }
637
0
    if ((priv_key = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) {
638
0
        ERR_raise(ERR_LIB_PROV, PROV_R_BN_ERROR);
639
0
        return 0;
640
0
    }
641
642
0
    ret = i2d_ASN1_INTEGER(priv_key, pder);
643
644
0
    ASN1_STRING_clear_free(priv_key);
645
0
    return ret;
646
0
}
647
648
k2d_NOCTX(dsa_prv, i2d_DSAPrivateKey)
649
    k2d_NOCTX(dsa_pub, i2d_DSAPublicKey)
650
        k2d_NOCTX(dsa_param, i2d_DSAparams)
651
652
0
#define dsa_epki_priv_to_der dsa_pki_priv_to_der
653
654
0
#define dsa_type_specific_priv_to_der dsa_prv_k2d
655
0
#define dsa_type_specific_pub_to_der dsa_pub_k2d
656
0
#define dsa_type_specific_params_to_der dsa_param_k2d
657
658
0
#define dsa_check_key_type NULL
659
0
#define dsa_evp_type EVP_PKEY_DSA
660
0
#define dsa_pem_type "DSA"
661
#endif
662
663
/* ---------------------------------------------------------------------- */
664
665
#ifndef OPENSSL_NO_EC
666
            static int prepare_ec_explicit_params(const void *eckey,
667
                void **pstr, int *pstrtype)
668
0
{
669
0
    ASN1_STRING *params = ASN1_STRING_new();
670
671
0
    if (params == NULL) {
672
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
673
0
        return 0;
674
0
    }
675
676
0
    params->length = i2d_ECParameters(eckey, &params->data);
677
0
    if (params->length <= 0) {
678
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
679
0
        ASN1_STRING_free(params);
680
0
        return 0;
681
0
    }
682
683
0
    *pstrtype = V_ASN1_SEQUENCE;
684
0
    *pstr = params;
685
0
    return 1;
686
0
}
687
688
/*
689
 * This implements EcpkParameters, where the CHOICE is based on whether there
690
 * is a curve name (curve nid) to be found or not.  See RFC 3279 for details.
691
 */
692
static int prepare_ec_params(const void *eckey, int nid, int save,
693
    void **pstr, int *pstrtype)
694
0
{
695
0
    int curve_nid;
696
0
    const EC_GROUP *group = EC_KEY_get0_group(eckey);
697
0
    ASN1_OBJECT *params = NULL;
698
699
0
    if (group == NULL)
700
0
        return 0;
701
0
    curve_nid = EC_GROUP_get_curve_name(group);
702
0
    if (curve_nid != NID_undef) {
703
0
        params = OBJ_nid2obj(curve_nid);
704
0
        if (params == NULL)
705
0
            return 0;
706
0
    }
707
708
0
    if (curve_nid != NID_undef
709
0
        && (EC_GROUP_get_asn1_flag(group) & OPENSSL_EC_NAMED_CURVE)) {
710
        /* The CHOICE came to namedCurve */
711
0
        if (OBJ_length(params) == 0) {
712
            /* Some curves might not have an associated OID */
713
0
            ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_OID);
714
0
            ASN1_OBJECT_free(params);
715
0
            return 0;
716
0
        }
717
0
        *pstr = params;
718
0
        *pstrtype = V_ASN1_OBJECT;
719
0
        return 1;
720
0
    } else {
721
        /* The CHOICE came to ecParameters */
722
0
        return prepare_ec_explicit_params(eckey, pstr, pstrtype);
723
0
    }
724
0
}
725
726
static int ec_spki_pub_to_der(const void *eckey, unsigned char **pder,
727
    ossl_unused void *ctx)
728
0
{
729
0
    if (EC_KEY_get0_public_key(eckey) == NULL) {
730
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
731
0
        return 0;
732
0
    }
733
0
    return i2o_ECPublicKey(eckey, pder);
734
0
}
735
736
static int ec_pki_priv_to_der(const void *veckey, unsigned char **pder,
737
    ossl_unused void *ctx)
738
0
{
739
0
    EC_KEY *eckey = (EC_KEY *)veckey;
740
0
    unsigned int old_flags;
741
0
    int ret = 0;
742
743
    /*
744
     * For PKCS8 the curve name appears in the PKCS8_PRIV_KEY_INFO object
745
     * as the pkeyalg->parameter field. (For a named curve this is an OID)
746
     * The pkey field is an octet string that holds the encoded
747
     * ECPrivateKey SEQUENCE with the optional parameters field omitted.
748
     * We omit this by setting the EC_PKEY_NO_PARAMETERS flag.
749
     */
750
0
    old_flags = EC_KEY_get_enc_flags(eckey); /* save old flags */
751
0
    EC_KEY_set_enc_flags(eckey, old_flags | EC_PKEY_NO_PARAMETERS);
752
0
    ret = i2d_ECPrivateKey(eckey, pder);
753
0
    EC_KEY_set_enc_flags(eckey, old_flags); /* restore old flags */
754
0
    return ret; /* return the length of the der encoded data */
755
0
}
756
757
k2d_NOCTX(ec_param, i2d_ECParameters)
758
    k2d_NOCTX(ec_prv, i2d_ECPrivateKey)
759
760
0
#define ec_epki_priv_to_der ec_pki_priv_to_der
761
762
0
#define ec_type_specific_params_to_der ec_param_k2d
763
/* No ec_type_specific_pub_to_der, there simply is no such thing */
764
0
#define ec_type_specific_priv_to_der ec_prv_k2d
765
766
0
#define ec_check_key_type NULL
767
0
#define ec_evp_type EVP_PKEY_EC
768
0
#define ec_pem_type "EC"
769
770
#ifndef OPENSSL_NO_SM2
771
/*
772
 * Albeit SM2 is a slightly different algorithm than ECDSA, the key type
773
 * encoding (in all places where an AlgorithmIdentifier is produced, such
774
 * as PrivateKeyInfo and SubjectPublicKeyInfo) is the same as for ECC keys
775
 * according to the example in GM/T 0015-2012, appendix D.2.
776
 * This leaves the distinction of SM2 keys to the EC group (which is found
777
 * in AlgorithmIdentified.params).
778
 */
779
0
#define sm2_evp_type ec_evp_type
780
0
#define sm2_pem_type "SM2"
781
#endif
782
#endif
783
784
/* ---------------------------------------------------------------------- */
785
786
#ifndef OPENSSL_NO_ECX
787
0
#define prepare_ecx_params NULL
788
789
        static int ecx_spki_pub_to_der(const void *vecxkey, unsigned char **pder,
790
            ossl_unused void *ctx)
791
0
{
792
0
    const ECX_KEY *ecxkey = vecxkey;
793
0
    unsigned char *keyblob;
794
795
0
    if (ecxkey == NULL) {
796
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
797
0
        return 0;
798
0
    }
799
800
0
    keyblob = OPENSSL_memdup(ecxkey->pubkey, ecxkey->keylen);
801
0
    if (keyblob == NULL)
802
0
        return 0;
803
804
0
    *pder = keyblob;
805
0
    return (int)ecxkey->keylen;
806
0
}
807
808
static int ecx_pki_priv_to_der(const void *vecxkey, unsigned char **pder,
809
    ossl_unused void *ctx)
810
0
{
811
0
    const ECX_KEY *ecxkey = vecxkey;
812
0
    ASN1_OCTET_STRING oct;
813
0
    int keybloblen;
814
815
0
    if (ecxkey == NULL || ecxkey->privkey == NULL) {
816
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
817
0
        return 0;
818
0
    }
819
820
0
    oct.data = ecxkey->privkey;
821
0
    oct.length = (int)ecxkey->keylen;
822
0
    oct.flags = 0;
823
824
0
    keybloblen = i2d_ASN1_OCTET_STRING(&oct, pder);
825
0
    if (keybloblen < 0) {
826
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
827
0
        return 0;
828
0
    }
829
830
0
    return keybloblen;
831
0
}
832
833
0
#define ecx_epki_priv_to_der ecx_pki_priv_to_der
834
835
/*
836
 * ED25519, ED448, X25519 and X448 only has PKCS#8 / SubjectPublicKeyInfo
837
 * representation, so we don't define ecx_type_specific_[priv,pub,params]_to_der.
838
 */
839
840
0
#define ecx_check_key_type NULL
841
842
0
#define ed25519_evp_type EVP_PKEY_ED25519
843
0
#define ed448_evp_type EVP_PKEY_ED448
844
0
#define x25519_evp_type EVP_PKEY_X25519
845
0
#define x448_evp_type EVP_PKEY_X448
846
0
#define ed25519_pem_type "ED25519"
847
0
#define ed448_pem_type "ED448"
848
0
#define x25519_pem_type "X25519"
849
0
#define x448_pem_type "X448"
850
#endif
851
852
/* ---------------------------------------------------------------------- */
853
854
#ifndef OPENSSL_NO_ML_DSA
855
static int ml_dsa_spki_pub_to_der(const void *vkey, unsigned char **pder,
856
    ossl_unused void *ctx)
857
0
{
858
0
    return ossl_ml_dsa_i2d_pubkey(vkey, pder);
859
0
}
860
861
static int ml_dsa_pki_priv_to_der(const void *vkey, unsigned char **pder,
862
    void *vctx)
863
0
{
864
0
    KEY2ANY_CTX *ctx = vctx;
865
866
0
    return ossl_ml_dsa_i2d_prvkey(vkey, pder,
867
0
        ctx->provctx, ctx->output_formats);
868
0
}
869
870
0
#define ml_dsa_epki_priv_to_der ml_dsa_pki_priv_to_der
871
0
#define prepare_ml_dsa_params NULL
872
0
#define ml_dsa_check_key_type NULL
873
874
0
#define ml_dsa_44_evp_type EVP_PKEY_ML_DSA_44
875
0
#define ml_dsa_44_pem_type "ML-DSA-44"
876
0
#define ml_dsa_65_evp_type EVP_PKEY_ML_DSA_65
877
0
#define ml_dsa_65_pem_type "ML-DSA-65"
878
0
#define ml_dsa_87_evp_type EVP_PKEY_ML_DSA_87
879
0
#define ml_dsa_87_pem_type "ML-DSA-87"
880
#endif /* OPENSSL_NO_ML_DSA */
881
882
/* ---------------------------------------------------------------------- */
883
884
#ifndef OPENSSL_NO_ML_KEM
885
886
static int ml_kem_spki_pub_to_der(const void *vkey, unsigned char **pder,
887
    ossl_unused void *ctx)
888
0
{
889
0
    return ossl_ml_kem_i2d_pubkey(vkey, pder);
890
0
}
891
892
static int ml_kem_pki_priv_to_der(const void *vkey, unsigned char **pder,
893
    void *vctx)
894
0
{
895
0
    KEY2ANY_CTX *ctx = vctx;
896
897
0
    return ossl_ml_kem_i2d_prvkey(vkey, pder,
898
0
        ctx->provctx, ctx->output_formats);
899
0
}
900
901
0
#define ml_kem_epki_priv_to_der ml_kem_pki_priv_to_der
902
0
#define prepare_ml_kem_params NULL
903
0
#define ml_kem_check_key_type NULL
904
905
0
#define ml_kem_512_evp_type EVP_PKEY_ML_KEM_512
906
0
#define ml_kem_512_pem_type "ML-KEM-512"
907
0
#define ml_kem_768_evp_type EVP_PKEY_ML_KEM_768
908
0
#define ml_kem_768_pem_type "ML-KEM-768"
909
0
#define ml_kem_1024_evp_type EVP_PKEY_ML_KEM_1024
910
0
#define ml_kem_1024_pem_type "ML-KEM-1024"
911
#endif
912
913
/* ---------------------------------------------------------------------- */
914
915
/*
916
 * Helper functions to prepare RSA-PSS params for encoding.  We would
917
 * have simply written the whole AlgorithmIdentifier, but existing libcrypto
918
 * functionality doesn't allow that.
919
 */
920
921
static int prepare_rsa_params(const void *rsa, int nid, int save,
922
    void **pstr, int *pstrtype)
923
0
{
924
0
    const RSA_PSS_PARAMS_30 *pss = ossl_rsa_get0_pss_params_30((RSA *)rsa);
925
926
0
    *pstr = NULL;
927
928
0
    switch (RSA_test_flags(rsa, RSA_FLAG_TYPE_MASK)) {
929
0
    case RSA_FLAG_TYPE_RSA:
930
        /* If plain RSA, the parameters shall be NULL */
931
0
        *pstrtype = V_ASN1_NULL;
932
0
        return 1;
933
0
    case RSA_FLAG_TYPE_RSASSAPSS:
934
0
        if (ossl_rsa_pss_params_30_is_unrestricted(pss)) {
935
0
            *pstrtype = V_ASN1_UNDEF;
936
0
            return 1;
937
0
        } else {
938
0
            ASN1_STRING *astr = NULL;
939
0
            WPACKET pkt;
940
0
            unsigned char *str = NULL;
941
0
            size_t str_sz = 0;
942
0
            int i;
943
944
0
            for (i = 0; i < 2; i++) {
945
0
                switch (i) {
946
0
                case 0:
947
0
                    if (!WPACKET_init_null_der(&pkt))
948
0
                        goto err;
949
0
                    break;
950
0
                case 1:
951
0
                    if ((str = OPENSSL_malloc(str_sz)) == NULL
952
0
                        || !WPACKET_init_der(&pkt, str, str_sz)) {
953
0
                        WPACKET_cleanup(&pkt);
954
0
                        goto err;
955
0
                    }
956
0
                    break;
957
0
                }
958
0
                if (!ossl_DER_w_RSASSA_PSS_params(&pkt, -1, pss)
959
0
                    || !WPACKET_finish(&pkt)
960
0
                    || !WPACKET_get_total_written(&pkt, &str_sz)) {
961
0
                    WPACKET_cleanup(&pkt);
962
0
                    goto err;
963
0
                }
964
0
                WPACKET_cleanup(&pkt);
965
966
                /*
967
                 * If no PSS parameters are going to be written, there's no
968
                 * point going for another iteration.
969
                 * This saves us from getting |str| allocated just to have it
970
                 * immediately de-allocated.
971
                 */
972
0
                if (str_sz == 0)
973
0
                    break;
974
0
            }
975
976
0
            if ((astr = ASN1_STRING_new()) == NULL)
977
0
                goto err;
978
0
            *pstrtype = V_ASN1_SEQUENCE;
979
0
            ASN1_STRING_set0(astr, str, (int)str_sz);
980
0
            *pstr = astr;
981
982
0
            return 1;
983
0
        err:
984
0
            OPENSSL_free(str);
985
0
            return 0;
986
0
        }
987
0
    }
988
989
    /* Currently unsupported RSA key type */
990
0
    return 0;
991
0
}
992
993
k2d_NOCTX(rsa_prv, i2d_RSAPrivateKey)
994
    k2d_NOCTX(rsa_pub, i2d_RSAPublicKey)
995
996
/*
997
 * RSA is extremely simple, as PKCS#1 is used for the PKCS#8 |privateKey|
998
 * field as well as the SubjectPublicKeyInfo |subjectPublicKey| field.
999
 */
1000
0
#define rsa_pki_priv_to_der rsa_type_specific_priv_to_der
1001
0
#define rsa_epki_priv_to_der rsa_type_specific_priv_to_der
1002
0
#define rsa_spki_pub_to_der rsa_type_specific_pub_to_der
1003
0
#define rsa_type_specific_priv_to_der rsa_prv_k2d
1004
0
#define rsa_type_specific_pub_to_der rsa_pub_k2d
1005
#define rsa_type_specific_params_to_der NULL
1006
1007
        static int rsa_check_key_type(const void *rsa, int expected_type)
1008
0
{
1009
0
    switch (RSA_test_flags(rsa, RSA_FLAG_TYPE_MASK)) {
1010
0
    case RSA_FLAG_TYPE_RSA:
1011
0
        return expected_type == EVP_PKEY_RSA;
1012
0
    case RSA_FLAG_TYPE_RSASSAPSS:
1013
0
        return expected_type == EVP_PKEY_RSA_PSS;
1014
0
    }
1015
1016
    /* Currently unsupported RSA key type */
1017
0
    return EVP_PKEY_NONE;
1018
0
}
1019
1020
0
#define rsa_evp_type EVP_PKEY_RSA
1021
0
#define rsapss_evp_type EVP_PKEY_RSA_PSS
1022
0
#define rsa_pem_type "RSA"
1023
0
#define rsapss_pem_type "RSA-PSS"
1024
1025
/* ---------------------------------------------------------------------- */
1026
1027
#ifndef OPENSSL_NO_SLH_DSA
1028
0
#define prepare_slh_dsa_params NULL
1029
1030
static int slh_dsa_spki_pub_to_der(const void *vkey, unsigned char **pder,
1031
    ossl_unused void *ctx)
1032
0
{
1033
0
    const SLH_DSA_KEY *key = vkey;
1034
0
    uint8_t *key_blob;
1035
0
    size_t key_len;
1036
1037
0
    if (key == NULL) {
1038
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
1039
0
        return 0;
1040
0
    }
1041
0
    key_len = ossl_slh_dsa_key_get_pub_len(key);
1042
0
    key_blob = OPENSSL_memdup(ossl_slh_dsa_key_get_pub(key), key_len);
1043
0
    if (key_blob == NULL)
1044
0
        return 0;
1045
1046
0
    *pder = key_blob;
1047
0
    return (int)key_len;
1048
0
}
1049
1050
static int slh_dsa_pki_priv_to_der(const void *vkey, unsigned char **pder,
1051
    ossl_unused void *ctx)
1052
0
{
1053
0
    const SLH_DSA_KEY *key = vkey;
1054
0
    size_t len;
1055
1056
0
    if (ossl_slh_dsa_key_get_priv(key) == NULL) {
1057
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
1058
0
        return 0;
1059
0
    }
1060
0
    len = ossl_slh_dsa_key_get_priv_len(key);
1061
1062
0
    if (pder != NULL
1063
0
        && ((*pder = OPENSSL_memdup(ossl_slh_dsa_key_get_priv(key), len)) == NULL))
1064
0
        return 0;
1065
1066
0
    return (int)len;
1067
0
}
1068
0
#define slh_dsa_epki_priv_to_der slh_dsa_pki_priv_to_der
1069
1070
/* SLH_DSA only has PKCS#8 / SubjectPublicKeyInfo representations. */
1071
1072
0
#define slh_dsa_check_key_type NULL
1073
0
#define slh_dsa_sha2_128s_evp_type EVP_PKEY_SLH_DSA_SHA2_128S
1074
0
#define slh_dsa_sha2_128f_evp_type EVP_PKEY_SLH_DSA_SHA2_128F
1075
0
#define slh_dsa_sha2_192s_evp_type EVP_PKEY_SLH_DSA_SHA2_192S
1076
0
#define slh_dsa_sha2_192f_evp_type EVP_PKEY_SLH_DSA_SHA2_192F
1077
0
#define slh_dsa_sha2_256s_evp_type EVP_PKEY_SLH_DSA_SHA2_256S
1078
0
#define slh_dsa_sha2_256f_evp_type EVP_PKEY_SLH_DSA_SHA2_256F
1079
0
#define slh_dsa_shake_128s_evp_type EVP_PKEY_SLH_DSA_SHAKE_128S
1080
0
#define slh_dsa_shake_128f_evp_type EVP_PKEY_SLH_DSA_SHAKE_128F
1081
0
#define slh_dsa_shake_192s_evp_type EVP_PKEY_SLH_DSA_SHAKE_192S
1082
0
#define slh_dsa_shake_192f_evp_type EVP_PKEY_SLH_DSA_SHAKE_192F
1083
0
#define slh_dsa_shake_256s_evp_type EVP_PKEY_SLH_DSA_SHAKE_256S
1084
0
#define slh_dsa_shake_256f_evp_type EVP_PKEY_SLH_DSA_SHAKE_256F
1085
#define slh_dsa_sha2_128s_input_type "SLH-DSA-SHA2-128s"
1086
#define slh_dsa_sha2_128f_input_type "SLH-DSA-SHA2-128f"
1087
#define slh_dsa_sha2_192s_input_type "SLH-DSA-SHA2-192s"
1088
#define slh_dsa_sha2_192f_input_type "SLH-DSA-SHA2-192f"
1089
#define slh_dsa_sha2_256s_input_type "SLH-DSA-SHA2-256s"
1090
#define slh_dsa_sha2_256f_input_type "SLH-DSA-SHA2-256f"
1091
#define slh_dsa_shake_128s_input_type "SLH-DSA-SHAKE-128s"
1092
#define slh_dsa_shake_128f_input_type "SLH-DSA-SHAKE-128f"
1093
#define slh_dsa_shake_192s_input_type "SLH-DSA-SHAKE-192s"
1094
#define slh_dsa_shake_192f_input_type "SLH-DSA-SHAKE-192f"
1095
#define slh_dsa_shake_256s_input_type "SLH-DSA-SHAKE-256s"
1096
#define slh_dsa_shake_256f_input_type "SLH-DSA-SHAKE-256f"
1097
0
#define slh_dsa_sha2_128s_pem_type "SLH-DSA-SHA2-128s"
1098
0
#define slh_dsa_sha2_128f_pem_type "SLH-DSA-SHA2-128f"
1099
0
#define slh_dsa_sha2_192s_pem_type "SLH-DSA-SHA2-192s"
1100
0
#define slh_dsa_sha2_192f_pem_type "SLH-DSA-SHA2-192f"
1101
0
#define slh_dsa_sha2_256s_pem_type "SLH-DSA-SHA2-256s"
1102
0
#define slh_dsa_sha2_256f_pem_type "SLH-DSA-SHA2-256f"
1103
0
#define slh_dsa_shake_128s_pem_type "SLH-DSA-SHAKE-128s"
1104
0
#define slh_dsa_shake_128f_pem_type "SLH-DSA-SHAKE-128f"
1105
0
#define slh_dsa_shake_192s_pem_type "SLH-DSA-SHAKE-192s"
1106
0
#define slh_dsa_shake_192f_pem_type "SLH-DSA-SHAKE-192f"
1107
0
#define slh_dsa_shake_256s_pem_type "SLH-DSA-SHAKE-256s"
1108
0
#define slh_dsa_shake_256f_pem_type "SLH-DSA-SHAKE-256f"
1109
#endif /* OPENSSL_NO_SLH_DSA */
1110
1111
#ifndef OPENSSL_NO_LMS
1112
static int lms_spki_pub_to_der(const void *vkey, unsigned char **pder,
1113
    ossl_unused void *ctx)
1114
{
1115
    return ossl_lms_i2d_pubkey(vkey, pder);
1116
}
1117
1118
#define prepare_lms_params NULL
1119
#define lms_check_key_type NULL
1120
#define lms_evp_type EVP_PKEY_HSS_LMS
1121
#define lms_pem_type "LMS"
1122
#endif /* OPENSSL_NO_LMS */
1123
1124
/* ---------------------------------------------------------------------- */
1125
1126
static OSSL_FUNC_decoder_newctx_fn key2any_newctx;
1127
static OSSL_FUNC_decoder_freectx_fn key2any_freectx;
1128
1129
static void *key2any_newctx(void *provctx)
1130
0
{
1131
0
    KEY2ANY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
1132
1133
0
    if (ctx != NULL) {
1134
0
        ctx->provctx = provctx;
1135
0
        ctx->save_parameters = 1;
1136
0
    }
1137
1138
0
    return ctx;
1139
0
}
1140
1141
static void key2any_freectx(void *vctx)
1142
0
{
1143
0
    KEY2ANY_CTX *ctx = vctx;
1144
1145
0
    ossl_pw_clear_passphrase_data(&ctx->pwdata);
1146
0
    EVP_CIPHER_free(ctx->cipher);
1147
0
    OPENSSL_free(ctx->output_formats);
1148
0
    OPENSSL_free(ctx);
1149
0
}
1150
1151
static const OSSL_PARAM *key2any_settable_ctx_params(ossl_unused void *provctx)
1152
0
{
1153
0
    return key2any_set_ctx_params_list;
1154
0
}
1155
1156
static int key2any_set_ctx_params(void *vctx, const OSSL_PARAM params[])
1157
0
{
1158
0
    KEY2ANY_CTX *ctx = vctx;
1159
0
    struct key2any_set_ctx_params_st p;
1160
1161
0
    if (ctx == NULL || !key2any_set_ctx_params_decoder(params, &p))
1162
0
        return 0;
1163
1164
0
    if (p.cipher != NULL) {
1165
0
        const char *ciphername = NULL;
1166
0
        const char *props = NULL;
1167
0
        OSSL_LIB_CTX *libctx;
1168
1169
0
        if (!OSSL_PARAM_get_utf8_string_ptr(p.cipher, &ciphername))
1170
0
            return 0;
1171
0
        if (p.propq != NULL && !OSSL_PARAM_get_utf8_string_ptr(p.propq, &props))
1172
0
            return 0;
1173
1174
0
        libctx = ossl_prov_ctx_get0_libctx(ctx->provctx);
1175
0
        EVP_CIPHER_free(ctx->cipher);
1176
0
        ctx->cipher = NULL;
1177
0
        ctx->cipher_intent = ciphername != NULL;
1178
0
        if (ciphername != NULL
1179
0
            && ((ctx->cipher = EVP_CIPHER_fetch(libctx, ciphername, props)) == NULL))
1180
0
            return 0;
1181
0
    }
1182
1183
0
    if (p.svprm != NULL && !OSSL_PARAM_get_int(p.svprm, &ctx->save_parameters))
1184
0
        return 0;
1185
1186
0
    if (p.output_formats != NULL) {
1187
0
        char *val = NULL;
1188
1189
0
        if (!OSSL_PARAM_get_utf8_string(p.output_formats, &val, 0))
1190
0
            return 0;
1191
0
        OPENSSL_free(ctx->output_formats);
1192
0
        if (*val != '\0') {
1193
0
            ctx->output_formats = val;
1194
0
        } else {
1195
0
            OPENSSL_free(val);
1196
0
            ctx->output_formats = NULL;
1197
0
        }
1198
0
    }
1199
1200
0
    return 1;
1201
0
}
1202
1203
static int key2any_check_selection(int selection, int selection_mask)
1204
0
{
1205
    /*
1206
     * The selections are kinda sorta "levels", i.e. each selection given
1207
     * here is assumed to include those following.
1208
     */
1209
0
    int checks[] = {
1210
0
        OSSL_KEYMGMT_SELECT_PRIVATE_KEY,
1211
0
        OSSL_KEYMGMT_SELECT_PUBLIC_KEY,
1212
0
        OSSL_KEYMGMT_SELECT_ALL_PARAMETERS
1213
0
    };
1214
0
    size_t i;
1215
1216
    /* The decoder implementations made here support guessing */
1217
0
    if (selection == 0)
1218
0
        return 1;
1219
1220
0
    for (i = 0; i < OSSL_NELEM(checks); i++) {
1221
0
        int check1 = (selection & checks[i]) != 0;
1222
0
        int check2 = (selection_mask & checks[i]) != 0;
1223
1224
        /*
1225
         * If the caller asked for the currently checked bit(s), return
1226
         * whether the decoder description says it's supported.
1227
         */
1228
0
        if (check1)
1229
0
            return check2;
1230
0
    }
1231
1232
    /* This should be dead code, but just to be safe... */
1233
0
    return 0;
1234
0
}
1235
1236
static int key2any_encode(KEY2ANY_CTX *ctx, OSSL_CORE_BIO *cout,
1237
    const void *key, int type, const char *pemname,
1238
    check_key_type_fn *checker,
1239
    key_to_der_fn *writer,
1240
    OSSL_PASSPHRASE_CALLBACK *pwcb, void *pwcbarg,
1241
    key_to_paramstring_fn *key2paramstring,
1242
    OSSL_i2d_of_void_ctx *key2der)
1243
0
{
1244
0
    int ret = 0;
1245
1246
0
    if (key == NULL) {
1247
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
1248
0
    } else if (writer != NULL
1249
0
        && (checker == NULL || checker(key, type))) {
1250
0
        BIO *out = ossl_bio_new_from_core_bio(ctx->provctx, cout);
1251
1252
0
        if (out != NULL
1253
0
            && (pwcb == NULL
1254
0
                || ossl_pw_set_ossl_passphrase_cb(&ctx->pwdata, pwcb, pwcbarg)))
1255
0
            ret = writer(out, key, type, pemname, key2paramstring, key2der, ctx);
1256
1257
0
        BIO_free(out);
1258
0
    } else {
1259
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);
1260
0
    }
1261
0
    return ret;
1262
0
}
1263
1264
0
#define DO_PRIVATE_KEY_selection_mask OSSL_KEYMGMT_SELECT_PRIVATE_KEY
1265
#define DO_PRIVATE_KEY(impl, type, kind, output)               \
1266
0
    if ((selection & DO_PRIVATE_KEY_selection_mask) != 0)      \
1267
0
        return key2any_encode(ctx, cout, key, impl##_evp_type, \
1268
0
            impl##_pem_type " PRIVATE KEY",                    \
1269
0
            type##_check_key_type,                             \
1270
0
            key_to_##kind##_##output##_priv_bio,               \
1271
0
            cb, cbarg, prepare_##type##_params,                \
1272
0
            type##_##kind##_priv_to_der);
1273
1274
0
#define DO_PUBLIC_KEY_selection_mask OSSL_KEYMGMT_SELECT_PUBLIC_KEY
1275
#define DO_PUBLIC_KEY(impl, type, kind, output)                \
1276
0
    if ((selection & DO_PUBLIC_KEY_selection_mask) != 0)       \
1277
0
        return key2any_encode(ctx, cout, key, impl##_evp_type, \
1278
0
            impl##_pem_type " PUBLIC KEY",                     \
1279
0
            type##_check_key_type,                             \
1280
0
            key_to_##kind##_##output##_pub_bio,                \
1281
0
            cb, cbarg, prepare_##type##_params,                \
1282
0
            type##_##kind##_pub_to_der);
1283
1284
0
#define DO_PARAMETERS_selection_mask OSSL_KEYMGMT_SELECT_ALL_PARAMETERS
1285
#define DO_PARAMETERS(impl, type, kind, output)                \
1286
0
    if ((selection & DO_PARAMETERS_selection_mask) != 0)       \
1287
0
        return key2any_encode(ctx, cout, key, impl##_evp_type, \
1288
0
            impl##_pem_type " PARAMETERS",                     \
1289
0
            type##_check_key_type,                             \
1290
0
            key_to_##kind##_##output##_param_bio,              \
1291
0
            NULL, NULL, NULL,                                  \
1292
0
            type##_##kind##_params_to_der);
1293
1294
/*-
1295
 * Implement the kinds of output structure that can be produced.  They are
1296
 * referred to by name, and for each name, the following macros are defined
1297
 * (braces not included):
1298
 *
1299
 * DO_{kind}_selection_mask
1300
 *
1301
 *      A mask of selection bits that must not be zero.  This is used as a
1302
 *      selection criterion for each implementation.
1303
 *      This mask must never be zero.
1304
 *
1305
 * DO_{kind}
1306
 *
1307
 *      The performing macro.  It must use the DO_ macros defined above,
1308
 *      always in this order:
1309
 *
1310
 *      - DO_PRIVATE_KEY
1311
 *      - DO_PUBLIC_KEY
1312
 *      - DO_PARAMETERS
1313
 *
1314
 *      Any of those may be omitted, but the relative order must still be
1315
 *      the same.
1316
 */
1317
1318
/*
1319
 * PKCS#8 defines two structures for private keys only:
1320
 * - PrivateKeyInfo             (raw unencrypted form)
1321
 * - EncryptedPrivateKeyInfo    (encrypted wrapping)
1322
 *
1323
 * To allow a certain amount of flexibility, we allow the routines
1324
 * for PrivateKeyInfo to also produce EncryptedPrivateKeyInfo if a
1325
 * passphrase callback has been passed to them.
1326
 */
1327
0
#define DO_PrivateKeyInfo_selection_mask DO_PRIVATE_KEY_selection_mask
1328
#define DO_PrivateKeyInfo(impl, type, output) \
1329
0
    DO_PRIVATE_KEY(impl, type, pki, output)
1330
1331
0
#define DO_EncryptedPrivateKeyInfo_selection_mask DO_PRIVATE_KEY_selection_mask
1332
#define DO_EncryptedPrivateKeyInfo(impl, type, output) \
1333
0
    DO_PRIVATE_KEY(impl, type, epki, output)
1334
1335
/* SubjectPublicKeyInfo is a structure for public keys only */
1336
0
#define DO_SubjectPublicKeyInfo_selection_mask DO_PUBLIC_KEY_selection_mask
1337
#define DO_SubjectPublicKeyInfo(impl, type, output) \
1338
0
    DO_PUBLIC_KEY(impl, type, spki, output)
1339
1340
/*
1341
 * "type-specific" is a uniform name for key type specific output for private
1342
 * and public keys as well as key parameters.  This is used internally in
1343
 * libcrypto so it doesn't have to have special knowledge about select key
1344
 * types, but also when no better name has been found.  If there are more
1345
 * expressive DO_ names above, those are preferred.
1346
 *
1347
 * Three forms exist:
1348
 *
1349
 * - type_specific_keypair              Only supports private and public key
1350
 * - type_specific_params               Only supports parameters
1351
 * - type_specific                      Supports all parts of an EVP_PKEY
1352
 * - type_specific_no_pub               Supports all parts of an EVP_PKEY
1353
 *                                      except public key
1354
 */
1355
0
#define DO_type_specific_params_selection_mask DO_PARAMETERS_selection_mask
1356
#define DO_type_specific_params(impl, type, output) \
1357
0
    DO_PARAMETERS(impl, type, type_specific, output)
1358
#define DO_type_specific_keypair_selection_mask \
1359
0
    (DO_PRIVATE_KEY_selection_mask | DO_PUBLIC_KEY_selection_mask)
1360
#define DO_type_specific_keypair(impl, type, output)  \
1361
0
    DO_PRIVATE_KEY(impl, type, type_specific, output) \
1362
0
    DO_PUBLIC_KEY(impl, type, type_specific, output)
1363
#define DO_type_specific_selection_mask      \
1364
0
    (DO_type_specific_keypair_selection_mask \
1365
0
        | DO_type_specific_params_selection_mask)
1366
#define DO_type_specific(impl, type, output)     \
1367
0
    DO_type_specific_keypair(impl, type, output) \
1368
0
        DO_type_specific_params(impl, type, output)
1369
#define DO_type_specific_no_pub_selection_mask \
1370
0
    (DO_PRIVATE_KEY_selection_mask | DO_PARAMETERS_selection_mask)
1371
#define DO_type_specific_no_pub(impl, type, output)   \
1372
0
    DO_PRIVATE_KEY(impl, type, type_specific, output) \
1373
0
    DO_type_specific_params(impl, type, output)
1374
1375
/*
1376
 * Type specific aliases for the cases where we need to refer to them by
1377
 * type name.
1378
 * This only covers key types that are represented with i2d_{TYPE}PrivateKey,
1379
 * i2d_{TYPE}PublicKey and i2d_{TYPE}params / i2d_{TYPE}Parameters.
1380
 */
1381
0
#define DO_RSA_selection_mask DO_type_specific_keypair_selection_mask
1382
0
#define DO_RSA(impl, type, output) DO_type_specific_keypair(impl, type, output)
1383
1384
0
#define DO_DH_selection_mask DO_type_specific_params_selection_mask
1385
0
#define DO_DH(impl, type, output) DO_type_specific_params(impl, type, output)
1386
1387
0
#define DO_DHX_selection_mask DO_type_specific_params_selection_mask
1388
0
#define DO_DHX(impl, type, output) DO_type_specific_params(impl, type, output)
1389
1390
0
#define DO_DSA_selection_mask DO_type_specific_selection_mask
1391
0
#define DO_DSA(impl, type, output) DO_type_specific(impl, type, output)
1392
1393
0
#define DO_EC_selection_mask DO_type_specific_no_pub_selection_mask
1394
0
#define DO_EC(impl, type, output) DO_type_specific_no_pub(impl, type, output)
1395
1396
0
#define DO_SM2_selection_mask DO_type_specific_no_pub_selection_mask
1397
0
#define DO_SM2(impl, type, output) DO_type_specific_no_pub(impl, type, output)
1398
1399
/* PKCS#1 defines a structure for RSA private and public keys */
1400
0
#define DO_PKCS1_selection_mask DO_RSA_selection_mask
1401
0
#define DO_PKCS1(impl, type, output) DO_RSA(impl, type, output)
1402
1403
/* PKCS#3 defines a structure for DH parameters */
1404
0
#define DO_PKCS3_selection_mask DO_DH_selection_mask
1405
0
#define DO_PKCS3(impl, type, output) DO_DH(impl, type, output)
1406
/* X9.42 defines a structure for DHx parameters */
1407
0
#define DO_X9_42_selection_mask DO_DHX_selection_mask
1408
0
#define DO_X9_42(impl, type, output) DO_DHX(impl, type, output)
1409
1410
/* X9.62 defines a structure for EC keys and parameters */
1411
0
#define DO_X9_62_selection_mask DO_EC_selection_mask
1412
0
#define DO_X9_62(impl, type, output) DO_EC(impl, type, output)
1413
1414
/*
1415
 * MAKE_ENCODER is the single driver for creating OSSL_DISPATCH tables.
1416
 * It takes the following arguments:
1417
 *
1418
 * impl         This is the key type name that's being implemented.
1419
 * type         This is the type name for the set of functions that implement
1420
 *              the key type.  For example, ed25519, ed448, x25519 and x448
1421
 *              are all implemented with the exact same set of functions.
1422
 * kind         What kind of support to implement.  These translate into
1423
 *              the DO_##kind macros above.
1424
 * output       The output type to implement.  may be der or pem.
1425
 *
1426
 * The resulting OSSL_DISPATCH array gets the following name (expressed in
1427
 * C preprocessor terms) from those arguments:
1428
 *
1429
 * ossl_##impl##_to_##kind##_##output##_encoder_functions
1430
 */
1431
#define MAKE_ENCODER(impl, type, kind, output)                                    \
1432
    static OSSL_FUNC_encoder_import_object_fn                                     \
1433
        impl##_to_##kind##_##output##_import_object;                              \
1434
    static OSSL_FUNC_encoder_free_object_fn                                       \
1435
        impl##_to_##kind##_##output##_free_object;                                \
1436
    static OSSL_FUNC_encoder_encode_fn                                            \
1437
        impl##_to_##kind##_##output##_encode;                                     \
1438
                                                                                  \
1439
    static void *                                                                 \
1440
    impl##_to_##kind##_##output##_import_object(void *vctx, int selection,        \
1441
        const OSSL_PARAM params[])                                                \
1442
0
    {                                                                             \
1443
0
        KEY2ANY_CTX *ctx = vctx;                                                  \
1444
0
                                                                                  \
1445
0
        return ossl_prov_import_key(ossl_##impl##_keymgmt_functions,              \
1446
0
            ctx->provctx, selection, params);                                     \
1447
0
    }                                                                             \
Unexecuted instantiation: encode_key2any.c:rsa_to_type_specific_keypair_der_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_type_specific_params_der_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_type_specific_params_der_import_object
Unexecuted instantiation: encode_key2any.c:dsa_to_type_specific_der_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_type_specific_no_pub_der_import_object
Unexecuted instantiation: encode_key2any.c:sm2_to_type_specific_no_pub_der_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_type_specific_keypair_pem_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_type_specific_params_pem_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_type_specific_params_pem_import_object
Unexecuted instantiation: encode_key2any.c:dsa_to_type_specific_pem_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_type_specific_no_pub_pem_import_object
Unexecuted instantiation: encode_key2any.c:sm2_to_type_specific_no_pub_pem_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:dsa_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:dsa_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:dsa_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:dsa_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:dsa_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:dsa_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:sm2_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:sm2_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:sm2_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:sm2_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:sm2_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:sm2_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ed448_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ed448_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ed448_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ed448_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ed448_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ed448_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:x25519_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:x25519_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:x25519_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:x25519_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:x25519_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:x25519_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:x448_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:x448_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:x448_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:x448_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:x448_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:x448_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_RSA_der_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_RSA_pem_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_DH_der_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_DH_pem_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_DHX_der_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_DHX_pem_import_object
Unexecuted instantiation: encode_key2any.c:dsa_to_DSA_der_import_object
Unexecuted instantiation: encode_key2any.c:dsa_to_DSA_pem_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_EC_der_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_EC_pem_import_object
Unexecuted instantiation: encode_key2any.c:sm2_to_SM2_der_import_object
Unexecuted instantiation: encode_key2any.c:sm2_to_SM2_pem_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_PKCS1_der_import_object
Unexecuted instantiation: encode_key2any.c:rsa_to_PKCS1_pem_import_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_PKCS1_der_import_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_PKCS1_pem_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_PKCS3_der_import_object
Unexecuted instantiation: encode_key2any.c:dh_to_PKCS3_pem_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_X9_42_der_import_object
Unexecuted instantiation: encode_key2any.c:dhx_to_X9_42_pem_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_X9_62_der_import_object
Unexecuted instantiation: encode_key2any.c:ec_to_X9_62_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_SubjectPublicKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_EncryptedPrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_EncryptedPrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_PrivateKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_PrivateKeyInfo_pem_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_SubjectPublicKeyInfo_der_import_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_SubjectPublicKeyInfo_pem_import_object
1448
    static void impl##_to_##kind##_##output##_free_object(void *key)              \
1449
0
    {                                                                             \
1450
0
        ossl_prov_free_key(ossl_##impl##_keymgmt_functions, key);                 \
1451
0
    }                                                                             \
Unexecuted instantiation: encode_key2any.c:rsa_to_type_specific_keypair_der_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_type_specific_params_der_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_type_specific_params_der_free_object
Unexecuted instantiation: encode_key2any.c:dsa_to_type_specific_der_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_type_specific_no_pub_der_free_object
Unexecuted instantiation: encode_key2any.c:sm2_to_type_specific_no_pub_der_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_type_specific_keypair_pem_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_type_specific_params_pem_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_type_specific_params_pem_free_object
Unexecuted instantiation: encode_key2any.c:dsa_to_type_specific_pem_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_type_specific_no_pub_pem_free_object
Unexecuted instantiation: encode_key2any.c:sm2_to_type_specific_no_pub_pem_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:dsa_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:dsa_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:dsa_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:dsa_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:dsa_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:dsa_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:sm2_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:sm2_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:sm2_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:sm2_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:sm2_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:sm2_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ed25519_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ed448_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ed448_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ed448_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ed448_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ed448_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ed448_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:x25519_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:x25519_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:x25519_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:x25519_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:x25519_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:x25519_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:x448_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:x448_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:x448_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:x448_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:x448_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:x448_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_RSA_der_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_RSA_pem_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_DH_der_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_DH_pem_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_DHX_der_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_DHX_pem_free_object
Unexecuted instantiation: encode_key2any.c:dsa_to_DSA_der_free_object
Unexecuted instantiation: encode_key2any.c:dsa_to_DSA_pem_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_EC_der_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_EC_pem_free_object
Unexecuted instantiation: encode_key2any.c:sm2_to_SM2_der_free_object
Unexecuted instantiation: encode_key2any.c:sm2_to_SM2_pem_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_PKCS1_der_free_object
Unexecuted instantiation: encode_key2any.c:rsa_to_PKCS1_pem_free_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_PKCS1_der_free_object
Unexecuted instantiation: encode_key2any.c:rsapss_to_PKCS1_pem_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_PKCS3_der_free_object
Unexecuted instantiation: encode_key2any.c:dh_to_PKCS3_pem_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_X9_42_der_free_object
Unexecuted instantiation: encode_key2any.c:dhx_to_X9_42_pem_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_X9_62_der_free_object
Unexecuted instantiation: encode_key2any.c:ec_to_X9_62_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_SubjectPublicKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_EncryptedPrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_EncryptedPrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_PrivateKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_PrivateKeyInfo_pem_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_SubjectPublicKeyInfo_der_free_object
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_SubjectPublicKeyInfo_pem_free_object
1452
    static int impl##_to_##kind##_##output##_does_selection(void *ctx,            \
1453
        int selection)                                                            \
1454
0
    {                                                                             \
1455
0
        return key2any_check_selection(selection,                                 \
1456
0
            DO_##kind##_selection_mask);                                          \
1457
0
    }                                                                             \
Unexecuted instantiation: encode_key2any.c:rsa_to_type_specific_keypair_der_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_type_specific_params_der_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_type_specific_params_der_does_selection
Unexecuted instantiation: encode_key2any.c:dsa_to_type_specific_der_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_type_specific_no_pub_der_does_selection
Unexecuted instantiation: encode_key2any.c:sm2_to_type_specific_no_pub_der_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_type_specific_keypair_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_type_specific_params_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_type_specific_params_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dsa_to_type_specific_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_type_specific_no_pub_pem_does_selection
Unexecuted instantiation: encode_key2any.c:sm2_to_type_specific_no_pub_pem_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:rsapss_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:rsapss_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:rsapss_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:rsapss_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:rsapss_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:rsapss_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dsa_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:dsa_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dsa_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:dsa_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dsa_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:dsa_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:sm2_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:sm2_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:sm2_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:sm2_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:sm2_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:sm2_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ed25519_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ed25519_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ed25519_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ed25519_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ed25519_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ed25519_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ed448_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ed448_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ed448_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ed448_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ed448_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ed448_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:x25519_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:x25519_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:x25519_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:x25519_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:x25519_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:x25519_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:x448_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:x448_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:x448_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:x448_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:x448_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:x448_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128s_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_128f_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192s_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_192f_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256s_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_sha2_256f_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128s_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_128f_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192s_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_192f_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256s_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:slh_dsa_shake_256f_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_512_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_768_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_kem_1024_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_RSA_der_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_RSA_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_DH_der_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_DH_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_DHX_der_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_DHX_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dsa_to_DSA_der_does_selection
Unexecuted instantiation: encode_key2any.c:dsa_to_DSA_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_EC_der_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_EC_pem_does_selection
Unexecuted instantiation: encode_key2any.c:sm2_to_SM2_der_does_selection
Unexecuted instantiation: encode_key2any.c:sm2_to_SM2_pem_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_PKCS1_der_does_selection
Unexecuted instantiation: encode_key2any.c:rsa_to_PKCS1_pem_does_selection
Unexecuted instantiation: encode_key2any.c:rsapss_to_PKCS1_der_does_selection
Unexecuted instantiation: encode_key2any.c:rsapss_to_PKCS1_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_PKCS3_der_does_selection
Unexecuted instantiation: encode_key2any.c:dh_to_PKCS3_pem_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_X9_42_der_does_selection
Unexecuted instantiation: encode_key2any.c:dhx_to_X9_42_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_X9_62_der_does_selection
Unexecuted instantiation: encode_key2any.c:ec_to_X9_62_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_44_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_65_to_SubjectPublicKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_EncryptedPrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_EncryptedPrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_PrivateKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_PrivateKeyInfo_pem_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_SubjectPublicKeyInfo_der_does_selection
Unexecuted instantiation: encode_key2any.c:ml_dsa_87_to_SubjectPublicKeyInfo_pem_does_selection
1458
    static int                                                                    \
1459
    impl##_to_##kind##_##output##_encode(void *ctx, OSSL_CORE_BIO *cout,          \
1460
        const void *key,                                                          \
1461
        const OSSL_PARAM key_abstract[],                                          \
1462
        int selection,                                                            \
1463
        OSSL_PASSPHRASE_CALLBACK *cb,                                             \
1464
        void *cbarg)                                                              \
1465
0
    {                                                                             \
1466
0
        /* We don't deal with abstract objects */                                 \
1467
0
        if (key_abstract != NULL) {                                               \
1468
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);               \
1469
0
            return 0;                                                             \
1470
0
        }                                                                         \
1471
0
        DO_##kind(impl, type, output)                                             \
1472
0
                                                                                  \
1473
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);               \
1474
0
        return 0;                                                                 \
1475
0
    }                                                                             \
1476
    const OSSL_DISPATCH                                                           \
1477
        ossl_##impl##_to_##kind##_##output##_encoder_functions[]                  \
1478
        = {                                                                       \
1479
              { OSSL_FUNC_ENCODER_NEWCTX,                                         \
1480
                  (void (*)(void))key2any_newctx },                               \
1481
              { OSSL_FUNC_ENCODER_FREECTX,                                        \
1482
                  (void (*)(void))key2any_freectx },                              \
1483
              { OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS,                            \
1484
                  (void (*)(void))key2any_settable_ctx_params },                  \
1485
              { OSSL_FUNC_ENCODER_SET_CTX_PARAMS,                                 \
1486
                  (void (*)(void))key2any_set_ctx_params },                       \
1487
              { OSSL_FUNC_ENCODER_DOES_SELECTION,                                 \
1488
                  (void (*)(void))impl##_to_##kind##_##output##_does_selection }, \
1489
              { OSSL_FUNC_ENCODER_IMPORT_OBJECT,                                  \
1490
                  (void (*)(void))impl##_to_##kind##_##output##_import_object },  \
1491
              { OSSL_FUNC_ENCODER_FREE_OBJECT,                                    \
1492
                  (void (*)(void))impl##_to_##kind##_##output##_free_object },    \
1493
              { OSSL_FUNC_ENCODER_ENCODE,                                         \
1494
                  (void (*)(void))impl##_to_##kind##_##output##_encode },         \
1495
              OSSL_DISPATCH_END                                                   \
1496
          }
1497
1498
/*
1499
 * Replacements for i2d_{TYPE}PrivateKey, i2d_{TYPE}PublicKey,
1500
 * i2d_{TYPE}params, as they exist.
1501
 */
1502
0
MAKE_ENCODER(rsa, rsa, type_specific_keypair, der);
1503
#ifndef OPENSSL_NO_DH
1504
0
MAKE_ENCODER(dh, dh, type_specific_params, der);
1505
0
MAKE_ENCODER(dhx, dh, type_specific_params, der);
1506
#endif
1507
#ifndef OPENSSL_NO_DSA
1508
0
MAKE_ENCODER(dsa, dsa, type_specific, der);
1509
#endif
1510
#ifndef OPENSSL_NO_EC
1511
0
MAKE_ENCODER(ec, ec, type_specific_no_pub, der);
1512
#ifndef OPENSSL_NO_SM2
1513
0
MAKE_ENCODER(sm2, ec, type_specific_no_pub, der);
1514
#endif
1515
#endif
1516
1517
/*
1518
 * Replacements for PEM_write_bio_{TYPE}PrivateKey,
1519
 * PEM_write_bio_{TYPE}PublicKey, PEM_write_bio_{TYPE}params, as they exist.
1520
 */
1521
0
MAKE_ENCODER(rsa, rsa, type_specific_keypair, pem);
1522
#ifndef OPENSSL_NO_DH
1523
0
MAKE_ENCODER(dh, dh, type_specific_params, pem);
1524
0
MAKE_ENCODER(dhx, dh, type_specific_params, pem);
1525
#endif
1526
#ifndef OPENSSL_NO_DSA
1527
0
MAKE_ENCODER(dsa, dsa, type_specific, pem);
1528
#endif
1529
#ifndef OPENSSL_NO_EC
1530
0
MAKE_ENCODER(ec, ec, type_specific_no_pub, pem);
1531
#ifndef OPENSSL_NO_SM2
1532
0
MAKE_ENCODER(sm2, ec, type_specific_no_pub, pem);
1533
#endif
1534
#endif
1535
1536
/*
1537
 * PKCS#8 and SubjectPublicKeyInfo support.  This may duplicate some of the
1538
 * implementations specified above, but are more specific.
1539
 * The SubjectPublicKeyInfo implementations also replace the
1540
 * PEM_write_bio_{TYPE}_PUBKEY functions.
1541
 * For PEM, these are expected to be used by PEM_write_bio_PrivateKey(),
1542
 * PEM_write_bio_PUBKEY() and PEM_write_bio_Parameters().
1543
 */
1544
0
MAKE_ENCODER(rsa, rsa, EncryptedPrivateKeyInfo, der);
1545
0
MAKE_ENCODER(rsa, rsa, EncryptedPrivateKeyInfo, pem);
1546
0
MAKE_ENCODER(rsa, rsa, PrivateKeyInfo, der);
1547
0
MAKE_ENCODER(rsa, rsa, PrivateKeyInfo, pem);
1548
0
MAKE_ENCODER(rsa, rsa, SubjectPublicKeyInfo, der);
1549
0
MAKE_ENCODER(rsa, rsa, SubjectPublicKeyInfo, pem);
1550
0
MAKE_ENCODER(rsapss, rsa, EncryptedPrivateKeyInfo, der);
1551
0
MAKE_ENCODER(rsapss, rsa, EncryptedPrivateKeyInfo, pem);
1552
0
MAKE_ENCODER(rsapss, rsa, PrivateKeyInfo, der);
1553
0
MAKE_ENCODER(rsapss, rsa, PrivateKeyInfo, pem);
1554
0
MAKE_ENCODER(rsapss, rsa, SubjectPublicKeyInfo, der);
1555
0
MAKE_ENCODER(rsapss, rsa, SubjectPublicKeyInfo, pem);
1556
#ifndef OPENSSL_NO_DH
1557
0
MAKE_ENCODER(dh, dh, EncryptedPrivateKeyInfo, der);
1558
0
MAKE_ENCODER(dh, dh, EncryptedPrivateKeyInfo, pem);
1559
0
MAKE_ENCODER(dh, dh, PrivateKeyInfo, der);
1560
0
MAKE_ENCODER(dh, dh, PrivateKeyInfo, pem);
1561
0
MAKE_ENCODER(dh, dh, SubjectPublicKeyInfo, der);
1562
0
MAKE_ENCODER(dh, dh, SubjectPublicKeyInfo, pem);
1563
0
MAKE_ENCODER(dhx, dh, EncryptedPrivateKeyInfo, der);
1564
0
MAKE_ENCODER(dhx, dh, EncryptedPrivateKeyInfo, pem);
1565
0
MAKE_ENCODER(dhx, dh, PrivateKeyInfo, der);
1566
0
MAKE_ENCODER(dhx, dh, PrivateKeyInfo, pem);
1567
0
MAKE_ENCODER(dhx, dh, SubjectPublicKeyInfo, der);
1568
0
MAKE_ENCODER(dhx, dh, SubjectPublicKeyInfo, pem);
1569
#endif
1570
#ifndef OPENSSL_NO_DSA
1571
0
MAKE_ENCODER(dsa, dsa, EncryptedPrivateKeyInfo, der);
1572
0
MAKE_ENCODER(dsa, dsa, EncryptedPrivateKeyInfo, pem);
1573
0
MAKE_ENCODER(dsa, dsa, PrivateKeyInfo, der);
1574
0
MAKE_ENCODER(dsa, dsa, PrivateKeyInfo, pem);
1575
0
MAKE_ENCODER(dsa, dsa, SubjectPublicKeyInfo, der);
1576
0
MAKE_ENCODER(dsa, dsa, SubjectPublicKeyInfo, pem);
1577
#endif
1578
#ifndef OPENSSL_NO_EC
1579
0
MAKE_ENCODER(ec, ec, EncryptedPrivateKeyInfo, der);
1580
0
MAKE_ENCODER(ec, ec, EncryptedPrivateKeyInfo, pem);
1581
0
MAKE_ENCODER(ec, ec, PrivateKeyInfo, der);
1582
0
MAKE_ENCODER(ec, ec, PrivateKeyInfo, pem);
1583
0
MAKE_ENCODER(ec, ec, SubjectPublicKeyInfo, der);
1584
0
MAKE_ENCODER(ec, ec, SubjectPublicKeyInfo, pem);
1585
#ifndef OPENSSL_NO_SM2
1586
0
MAKE_ENCODER(sm2, ec, EncryptedPrivateKeyInfo, der);
1587
0
MAKE_ENCODER(sm2, ec, EncryptedPrivateKeyInfo, pem);
1588
0
MAKE_ENCODER(sm2, ec, PrivateKeyInfo, der);
1589
0
MAKE_ENCODER(sm2, ec, PrivateKeyInfo, pem);
1590
0
MAKE_ENCODER(sm2, ec, SubjectPublicKeyInfo, der);
1591
0
MAKE_ENCODER(sm2, ec, SubjectPublicKeyInfo, pem);
1592
#endif
1593
#ifndef OPENSSL_NO_ECX
1594
0
MAKE_ENCODER(ed25519, ecx, EncryptedPrivateKeyInfo, der);
1595
0
MAKE_ENCODER(ed25519, ecx, EncryptedPrivateKeyInfo, pem);
1596
0
MAKE_ENCODER(ed25519, ecx, PrivateKeyInfo, der);
1597
0
MAKE_ENCODER(ed25519, ecx, PrivateKeyInfo, pem);
1598
0
MAKE_ENCODER(ed25519, ecx, SubjectPublicKeyInfo, der);
1599
0
MAKE_ENCODER(ed25519, ecx, SubjectPublicKeyInfo, pem);
1600
0
MAKE_ENCODER(ed448, ecx, EncryptedPrivateKeyInfo, der);
1601
0
MAKE_ENCODER(ed448, ecx, EncryptedPrivateKeyInfo, pem);
1602
0
MAKE_ENCODER(ed448, ecx, PrivateKeyInfo, der);
1603
0
MAKE_ENCODER(ed448, ecx, PrivateKeyInfo, pem);
1604
0
MAKE_ENCODER(ed448, ecx, SubjectPublicKeyInfo, der);
1605
0
MAKE_ENCODER(ed448, ecx, SubjectPublicKeyInfo, pem);
1606
0
MAKE_ENCODER(x25519, ecx, EncryptedPrivateKeyInfo, der);
1607
0
MAKE_ENCODER(x25519, ecx, EncryptedPrivateKeyInfo, pem);
1608
0
MAKE_ENCODER(x25519, ecx, PrivateKeyInfo, der);
1609
0
MAKE_ENCODER(x25519, ecx, PrivateKeyInfo, pem);
1610
0
MAKE_ENCODER(x25519, ecx, SubjectPublicKeyInfo, der);
1611
0
MAKE_ENCODER(x25519, ecx, SubjectPublicKeyInfo, pem);
1612
0
MAKE_ENCODER(x448, ecx, EncryptedPrivateKeyInfo, der);
1613
0
MAKE_ENCODER(x448, ecx, EncryptedPrivateKeyInfo, pem);
1614
0
MAKE_ENCODER(x448, ecx, PrivateKeyInfo, der);
1615
0
MAKE_ENCODER(x448, ecx, PrivateKeyInfo, pem);
1616
0
MAKE_ENCODER(x448, ecx, SubjectPublicKeyInfo, der);
1617
0
MAKE_ENCODER(x448, ecx, SubjectPublicKeyInfo, pem);
1618
#endif
1619
#endif
1620
#ifndef OPENSSL_NO_SLH_DSA
1621
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, EncryptedPrivateKeyInfo, der);
1622
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, EncryptedPrivateKeyInfo, der);
1623
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, EncryptedPrivateKeyInfo, der);
1624
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, EncryptedPrivateKeyInfo, der);
1625
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, EncryptedPrivateKeyInfo, der);
1626
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, EncryptedPrivateKeyInfo, der);
1627
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1628
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1629
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1630
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1631
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1632
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1633
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, EncryptedPrivateKeyInfo, der);
1634
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, EncryptedPrivateKeyInfo, der);
1635
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, EncryptedPrivateKeyInfo, der);
1636
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, EncryptedPrivateKeyInfo, der);
1637
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, EncryptedPrivateKeyInfo, der);
1638
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, EncryptedPrivateKeyInfo, der);
1639
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1640
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1641
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1642
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1643
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1644
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1645
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, PrivateKeyInfo, der);
1646
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, PrivateKeyInfo, der);
1647
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, PrivateKeyInfo, der);
1648
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, PrivateKeyInfo, der);
1649
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, PrivateKeyInfo, der);
1650
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, PrivateKeyInfo, der);
1651
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, PrivateKeyInfo, pem);
1652
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, PrivateKeyInfo, pem);
1653
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, PrivateKeyInfo, pem);
1654
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, PrivateKeyInfo, pem);
1655
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, PrivateKeyInfo, pem);
1656
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, PrivateKeyInfo, pem);
1657
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, PrivateKeyInfo, der);
1658
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, PrivateKeyInfo, der);
1659
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, PrivateKeyInfo, der);
1660
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, PrivateKeyInfo, der);
1661
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, PrivateKeyInfo, der);
1662
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, PrivateKeyInfo, der);
1663
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, PrivateKeyInfo, pem);
1664
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, PrivateKeyInfo, pem);
1665
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, PrivateKeyInfo, pem);
1666
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, PrivateKeyInfo, pem);
1667
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, PrivateKeyInfo, pem);
1668
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, PrivateKeyInfo, pem);
1669
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, SubjectPublicKeyInfo, der);
1670
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, SubjectPublicKeyInfo, der);
1671
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, SubjectPublicKeyInfo, der);
1672
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, SubjectPublicKeyInfo, der);
1673
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, SubjectPublicKeyInfo, der);
1674
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, SubjectPublicKeyInfo, der);
1675
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, SubjectPublicKeyInfo, pem);
1676
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, SubjectPublicKeyInfo, pem);
1677
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, SubjectPublicKeyInfo, pem);
1678
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, SubjectPublicKeyInfo, pem);
1679
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, SubjectPublicKeyInfo, pem);
1680
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, SubjectPublicKeyInfo, pem);
1681
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, SubjectPublicKeyInfo, der);
1682
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, SubjectPublicKeyInfo, der);
1683
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, SubjectPublicKeyInfo, der);
1684
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, SubjectPublicKeyInfo, der);
1685
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, SubjectPublicKeyInfo, der);
1686
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, SubjectPublicKeyInfo, der);
1687
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, SubjectPublicKeyInfo, pem);
1688
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, SubjectPublicKeyInfo, pem);
1689
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, SubjectPublicKeyInfo, pem);
1690
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, SubjectPublicKeyInfo, pem);
1691
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, SubjectPublicKeyInfo, pem);
1692
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, SubjectPublicKeyInfo, pem);
1693
#endif /* OPENSSL_NO_SLH_DSA */
1694
1695
#ifndef OPENSSL_NO_ML_KEM
1696
0
MAKE_ENCODER(ml_kem_512, ml_kem, EncryptedPrivateKeyInfo, der);
1697
0
MAKE_ENCODER(ml_kem_512, ml_kem, EncryptedPrivateKeyInfo, pem);
1698
0
MAKE_ENCODER(ml_kem_512, ml_kem, PrivateKeyInfo, der);
1699
0
MAKE_ENCODER(ml_kem_512, ml_kem, PrivateKeyInfo, pem);
1700
0
MAKE_ENCODER(ml_kem_512, ml_kem, SubjectPublicKeyInfo, der);
1701
0
MAKE_ENCODER(ml_kem_512, ml_kem, SubjectPublicKeyInfo, pem);
1702
1703
0
MAKE_ENCODER(ml_kem_768, ml_kem, EncryptedPrivateKeyInfo, der);
1704
0
MAKE_ENCODER(ml_kem_768, ml_kem, EncryptedPrivateKeyInfo, pem);
1705
0
MAKE_ENCODER(ml_kem_768, ml_kem, PrivateKeyInfo, der);
1706
0
MAKE_ENCODER(ml_kem_768, ml_kem, PrivateKeyInfo, pem);
1707
0
MAKE_ENCODER(ml_kem_768, ml_kem, SubjectPublicKeyInfo, der);
1708
0
MAKE_ENCODER(ml_kem_768, ml_kem, SubjectPublicKeyInfo, pem);
1709
1710
0
MAKE_ENCODER(ml_kem_1024, ml_kem, EncryptedPrivateKeyInfo, der);
1711
0
MAKE_ENCODER(ml_kem_1024, ml_kem, EncryptedPrivateKeyInfo, pem);
1712
0
MAKE_ENCODER(ml_kem_1024, ml_kem, PrivateKeyInfo, der);
1713
0
MAKE_ENCODER(ml_kem_1024, ml_kem, PrivateKeyInfo, pem);
1714
0
MAKE_ENCODER(ml_kem_1024, ml_kem, SubjectPublicKeyInfo, der);
1715
0
MAKE_ENCODER(ml_kem_1024, ml_kem, SubjectPublicKeyInfo, pem);
1716
#endif
1717
1718
/*
1719
 * Support for key type specific output formats.  Not all key types have
1720
 * this, we only aim to duplicate what is available in 1.1.1 as
1721
 * i2d_TYPEPrivateKey(), i2d_TYPEPublicKey() and i2d_TYPEparams().
1722
 * For example, there are no publicly available i2d_ function for
1723
 * ED25519, ED448, X25519 or X448, and they therefore only have PKCS#8
1724
 * and SubjectPublicKeyInfo implementations as implemented above.
1725
 */
1726
0
MAKE_ENCODER(rsa, rsa, RSA, der);
1727
0
MAKE_ENCODER(rsa, rsa, RSA, pem);
1728
#ifndef OPENSSL_NO_DH
1729
0
MAKE_ENCODER(dh, dh, DH, der);
1730
0
MAKE_ENCODER(dh, dh, DH, pem);
1731
0
MAKE_ENCODER(dhx, dh, DHX, der);
1732
0
MAKE_ENCODER(dhx, dh, DHX, pem);
1733
#endif
1734
#ifndef OPENSSL_NO_DSA
1735
0
MAKE_ENCODER(dsa, dsa, DSA, der);
1736
0
MAKE_ENCODER(dsa, dsa, DSA, pem);
1737
#endif
1738
#ifndef OPENSSL_NO_EC
1739
0
MAKE_ENCODER(ec, ec, EC, der);
1740
0
MAKE_ENCODER(ec, ec, EC, pem);
1741
#ifndef OPENSSL_NO_SM2
1742
0
MAKE_ENCODER(sm2, ec, SM2, der);
1743
0
MAKE_ENCODER(sm2, ec, SM2, pem);
1744
#endif
1745
#endif
1746
1747
/* Convenience structure names */
1748
0
MAKE_ENCODER(rsa, rsa, PKCS1, der);
1749
0
MAKE_ENCODER(rsa, rsa, PKCS1, pem);
1750
0
MAKE_ENCODER(rsapss, rsa, PKCS1, der);
1751
0
MAKE_ENCODER(rsapss, rsa, PKCS1, pem);
1752
#ifndef OPENSSL_NO_DH
1753
0
MAKE_ENCODER(dh, dh, PKCS3, der); /* parameters only */
1754
0
MAKE_ENCODER(dh, dh, PKCS3, pem); /* parameters only */
1755
0
MAKE_ENCODER(dhx, dh, X9_42, der); /* parameters only */
1756
0
MAKE_ENCODER(dhx, dh, X9_42, pem); /* parameters only */
1757
#endif
1758
#ifndef OPENSSL_NO_EC
1759
0
MAKE_ENCODER(ec, ec, X9_62, der);
1760
0
MAKE_ENCODER(ec, ec, X9_62, pem);
1761
#endif
1762
1763
#ifndef OPENSSL_NO_ML_DSA
1764
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, EncryptedPrivateKeyInfo, der);
1765
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, EncryptedPrivateKeyInfo, pem);
1766
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, PrivateKeyInfo, der);
1767
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, PrivateKeyInfo, pem);
1768
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, SubjectPublicKeyInfo, der);
1769
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, SubjectPublicKeyInfo, pem);
1770
1771
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, EncryptedPrivateKeyInfo, der);
1772
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, EncryptedPrivateKeyInfo, pem);
1773
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, PrivateKeyInfo, der);
1774
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, PrivateKeyInfo, pem);
1775
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, SubjectPublicKeyInfo, der);
1776
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, SubjectPublicKeyInfo, pem);
1777
1778
0
MAKE_ENCODER(ml_dsa_87, ml_dsa, EncryptedPrivateKeyInfo, der);
1779
0
MAKE_ENCODER(ml_dsa_87, ml_dsa, EncryptedPrivateKeyInfo, pem);
1780
0
MAKE_ENCODER(ml_dsa_87, ml_dsa, PrivateKeyInfo, der);
1781
0
MAKE_ENCODER(ml_dsa_87, ml_dsa, PrivateKeyInfo, pem);
1782
0
MAKE_ENCODER(ml_dsa_87, ml_dsa, SubjectPublicKeyInfo, der);
1783
MAKE_ENCODER(ml_dsa_87, ml_dsa, SubjectPublicKeyInfo, pem);
1784
#endif /* OPENSSL_NO_ML_DSA */
1785
1786
#ifndef OPENSSL_NO_LMS
1787
MAKE_ENCODER(lms, lms, SubjectPublicKeyInfo, der);
1788
MAKE_ENCODER(lms, lms, SubjectPublicKeyInfo, pem);
1789
#endif