Coverage Report

Created: 2025-12-10 06:24

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 "providers/implementations/encode_decode/encode_key2any.inc"
45
46
#if defined(OPENSSL_NO_DH) && defined(OPENSSL_NO_DSA) && defined(OPENSSL_NO_EC)
47
#define OPENSSL_NO_KEYPARAMS
48
#endif
49
50
typedef struct key2any_ctx_st {
51
    PROV_CTX *provctx;
52
53
    /* Set to 0 if parameters should not be saved (dsa only) */
54
    int save_parameters;
55
56
    /* Set to 1 if intending to encrypt/decrypt, otherwise 0 */
57
    int cipher_intent;
58
59
    EVP_CIPHER *cipher;
60
61
    struct ossl_passphrase_data_st pwdata;
62
63
    /* Just-in-time ML-KEM and ML-DSA output format override */
64
    char *output_formats;
65
} KEY2ANY_CTX;
66
67
typedef int check_key_type_fn(const void *key, int nid);
68
typedef int key_to_paramstring_fn(const void *key, int nid, int save,
69
    void **str, int *strtype);
70
typedef int key_to_der_fn(BIO *out, const void *key,
71
    int key_nid, const char *pemname,
72
    key_to_paramstring_fn *p2s,
73
    OSSL_i2d_of_void_ctx *k2d, KEY2ANY_CTX *ctx);
74
typedef int write_bio_of_void_fn(BIO *bp, const void *x);
75
76
/* Free the blob allocated during key_to_paramstring_fn */
77
static void free_asn1_data(int type, void *data)
78
0
{
79
0
    switch (type) {
80
0
    case V_ASN1_OBJECT:
81
0
        ASN1_OBJECT_free(data);
82
0
        break;
83
0
    case V_ASN1_SEQUENCE:
84
0
        ASN1_STRING_free(data);
85
0
        break;
86
0
    }
87
0
}
88
89
static PKCS8_PRIV_KEY_INFO *key_to_p8info(const void *key, int key_nid,
90
    void *params, int params_type,
91
    OSSL_i2d_of_void_ctx *k2d,
92
    KEY2ANY_CTX *ctx)
93
0
{
94
    /* der, derlen store the key DER output and its length */
95
0
    unsigned char *der = NULL;
96
0
    int derlen;
97
    /* The final PKCS#8 info */
98
0
    PKCS8_PRIV_KEY_INFO *p8info = NULL;
99
100
0
    if ((p8info = PKCS8_PRIV_KEY_INFO_new()) == NULL
101
0
        || (derlen = k2d(key, &der, (void *)ctx)) <= 0
102
0
        || !PKCS8_pkey_set0(p8info, OBJ_nid2obj(key_nid), 0,
103
0
            params_type, params, der, derlen)) {
104
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
105
0
        PKCS8_PRIV_KEY_INFO_free(p8info);
106
0
        OPENSSL_free(der);
107
0
        p8info = NULL;
108
0
    }
109
110
0
    return p8info;
111
0
}
112
113
static X509_SIG *p8info_to_encp8(PKCS8_PRIV_KEY_INFO *p8info,
114
    KEY2ANY_CTX *ctx)
115
0
{
116
0
    X509_SIG *p8 = NULL;
117
0
    char kstr[PEM_BUFSIZE];
118
0
    size_t klen = 0;
119
0
    OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
120
121
0
    if (ctx->cipher == NULL)
122
0
        return NULL;
123
124
0
    if (!ossl_pw_get_passphrase(kstr, sizeof(kstr), &klen, NULL, 1,
125
0
            &ctx->pwdata)) {
126
0
        ERR_raise(ERR_LIB_PROV, PROV_R_UNABLE_TO_GET_PASSPHRASE);
127
0
        return NULL;
128
0
    }
129
    /* First argument == -1 means "standard" */
130
0
    p8 = PKCS8_encrypt_ex(-1, ctx->cipher, kstr, (int)klen, NULL, 0, 0, p8info,
131
0
        libctx, NULL);
132
0
    OPENSSL_cleanse(kstr, klen);
133
0
    return p8;
134
0
}
135
136
static X509_SIG *key_to_encp8(const void *key, int key_nid,
137
    void *params, int params_type,
138
    OSSL_i2d_of_void_ctx *k2d,
139
    KEY2ANY_CTX *ctx)
140
0
{
141
0
    PKCS8_PRIV_KEY_INFO *p8info = key_to_p8info(key, key_nid, params, params_type, k2d, ctx);
142
0
    X509_SIG *p8 = NULL;
143
144
0
    if (p8info == NULL) {
145
0
        free_asn1_data(params_type, params);
146
0
    } else {
147
0
        p8 = p8info_to_encp8(p8info, ctx);
148
0
        PKCS8_PRIV_KEY_INFO_free(p8info);
149
0
    }
150
0
    return p8;
151
0
}
152
153
static X509_PUBKEY *key_to_pubkey(const void *key, int key_nid,
154
    void *params, int params_type,
155
    OSSL_i2d_of_void_ctx *k2d,
156
    KEY2ANY_CTX *ctx)
157
0
{
158
    /* der, derlen store the key DER output and its length */
159
0
    unsigned char *der = NULL;
160
0
    int derlen;
161
    /* The final X509_PUBKEY */
162
0
    X509_PUBKEY *xpk = NULL;
163
164
0
    if ((xpk = X509_PUBKEY_new()) == NULL
165
0
        || (derlen = k2d(key, &der, (void *)ctx)) <= 0
166
0
        || !X509_PUBKEY_set0_param(xpk, OBJ_nid2obj(key_nid),
167
0
            params_type, params, der, derlen)) {
168
0
        ERR_raise(ERR_LIB_PROV, ERR_R_X509_LIB);
169
0
        X509_PUBKEY_free(xpk);
170
0
        OPENSSL_free(der);
171
0
        xpk = NULL;
172
0
    }
173
174
0
    return xpk;
175
0
}
176
177
/*
178
 * key_to_epki_* produce encoded output with the private key data in a
179
 * EncryptedPrivateKeyInfo structure (defined by PKCS#8).  They require
180
 * that there's an intent to encrypt, anything else is an error.
181
 *
182
 * key_to_pki_* primarily produce encoded output with the private key data
183
 * in a PrivateKeyInfo structure (also defined by PKCS#8).  However, if
184
 * there is an intent to encrypt the data, the corresponding key_to_epki_*
185
 * function is used instead.
186
 *
187
 * key_to_spki_* produce encoded output with the public key data in an
188
 * X.509 SubjectPublicKeyInfo.
189
 *
190
 * Key parameters don't have any defined envelopment of this kind, but are
191
 * included in some manner in the output from the functions described above,
192
 * either in the AlgorithmIdentifier's parameter field, or as part of the
193
 * key data itself.
194
 */
195
196
static int key_to_epki_der_priv_bio(BIO *out, const void *key,
197
    int key_nid,
198
    ossl_unused const char *pemname,
199
    key_to_paramstring_fn *p2s,
200
    OSSL_i2d_of_void_ctx *k2d,
201
    KEY2ANY_CTX *ctx)
202
0
{
203
0
    int ret = 0;
204
0
    void *str = NULL;
205
0
    int strtype = V_ASN1_UNDEF;
206
0
    X509_SIG *p8;
207
208
0
    if (!ctx->cipher_intent)
209
0
        return 0;
210
211
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
212
0
        return 0;
213
214
0
    p8 = key_to_encp8(key, key_nid, str, strtype, k2d, ctx);
215
0
    if (p8 != NULL)
216
0
        ret = i2d_PKCS8_bio(out, p8);
217
218
0
    X509_SIG_free(p8);
219
220
0
    return ret;
221
0
}
222
223
static int key_to_epki_pem_priv_bio(BIO *out, const void *key,
224
    int key_nid,
225
    ossl_unused const char *pemname,
226
    key_to_paramstring_fn *p2s,
227
    OSSL_i2d_of_void_ctx *k2d,
228
    KEY2ANY_CTX *ctx)
229
0
{
230
0
    int ret = 0;
231
0
    void *str = NULL;
232
0
    int strtype = V_ASN1_UNDEF;
233
0
    X509_SIG *p8;
234
235
0
    if (!ctx->cipher_intent)
236
0
        return 0;
237
238
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
239
0
        return 0;
240
241
0
    p8 = key_to_encp8(key, key_nid, str, strtype, k2d, ctx);
242
0
    if (p8 != NULL)
243
0
        ret = PEM_write_bio_PKCS8(out, p8);
244
245
0
    X509_SIG_free(p8);
246
247
0
    return ret;
248
0
}
249
250
static int key_to_pki_der_priv_bio(BIO *out, const void *key,
251
    int key_nid,
252
    ossl_unused const char *pemname,
253
    key_to_paramstring_fn *p2s,
254
    OSSL_i2d_of_void_ctx *k2d,
255
    KEY2ANY_CTX *ctx)
256
0
{
257
0
    int ret = 0;
258
0
    void *str = NULL;
259
0
    int strtype = V_ASN1_UNDEF;
260
0
    PKCS8_PRIV_KEY_INFO *p8info;
261
262
0
    if (ctx->cipher_intent)
263
0
        return key_to_epki_der_priv_bio(out, key, key_nid, pemname,
264
0
            p2s, k2d, ctx);
265
266
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
267
0
        return 0;
268
269
0
    p8info = key_to_p8info(key, key_nid, str, strtype, k2d, ctx);
270
271
0
    if (p8info != NULL)
272
0
        ret = i2d_PKCS8_PRIV_KEY_INFO_bio(out, p8info);
273
0
    else
274
0
        free_asn1_data(strtype, str);
275
276
0
    PKCS8_PRIV_KEY_INFO_free(p8info);
277
278
0
    return ret;
279
0
}
280
281
static int key_to_pki_pem_priv_bio(BIO *out, const void *key,
282
    int key_nid,
283
    ossl_unused const char *pemname,
284
    key_to_paramstring_fn *p2s,
285
    OSSL_i2d_of_void_ctx *k2d,
286
    KEY2ANY_CTX *ctx)
287
0
{
288
0
    int ret = 0;
289
0
    void *str = NULL;
290
0
    int strtype = V_ASN1_UNDEF;
291
0
    PKCS8_PRIV_KEY_INFO *p8info;
292
293
0
    if (ctx->cipher_intent)
294
0
        return key_to_epki_pem_priv_bio(out, key, key_nid, pemname,
295
0
            p2s, k2d, ctx);
296
297
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
298
0
        return 0;
299
300
0
    p8info = key_to_p8info(key, key_nid, str, strtype, k2d, ctx);
301
302
0
    if (p8info != NULL)
303
0
        ret = PEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8info);
304
0
    else
305
0
        free_asn1_data(strtype, str);
306
307
0
    PKCS8_PRIV_KEY_INFO_free(p8info);
308
309
0
    return ret;
310
0
}
311
312
static int key_to_spki_der_pub_bio(BIO *out, const void *key,
313
    int key_nid,
314
    ossl_unused const char *pemname,
315
    key_to_paramstring_fn *p2s,
316
    OSSL_i2d_of_void_ctx *k2d,
317
    KEY2ANY_CTX *ctx)
318
0
{
319
0
    int ret = 0;
320
0
    void *str = NULL;
321
0
    int strtype = V_ASN1_UNDEF;
322
0
    X509_PUBKEY *xpk = NULL;
323
324
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
325
0
        return 0;
326
327
0
    xpk = key_to_pubkey(key, key_nid, str, strtype, k2d, ctx);
328
329
0
    if (xpk != NULL)
330
0
        ret = i2d_X509_PUBKEY_bio(out, xpk);
331
332
    /* Also frees |str| */
333
0
    X509_PUBKEY_free(xpk);
334
0
    return ret;
335
0
}
336
337
static int key_to_spki_pem_pub_bio(BIO *out, const void *key,
338
    int key_nid,
339
    ossl_unused const char *pemname,
340
    key_to_paramstring_fn *p2s,
341
    OSSL_i2d_of_void_ctx *k2d,
342
    KEY2ANY_CTX *ctx)
343
0
{
344
0
    int ret = 0;
345
0
    void *str = NULL;
346
0
    int strtype = V_ASN1_UNDEF;
347
0
    X509_PUBKEY *xpk = NULL;
348
349
0
    if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, &str, &strtype))
350
0
        return 0;
351
352
0
    xpk = key_to_pubkey(key, key_nid, str, strtype, k2d, ctx);
353
354
0
    if (xpk != NULL)
355
0
        ret = PEM_write_bio_X509_PUBKEY(out, xpk);
356
0
    else
357
0
        free_asn1_data(strtype, str);
358
359
    /* Also frees |str| */
360
0
    X509_PUBKEY_free(xpk);
361
0
    return ret;
362
0
}
363
364
/*
365
 * key_to_type_specific_* produce encoded output with type specific key data,
366
 * no envelopment; the same kind of output as the type specific i2d_ and
367
 * PEM_write_ functions, which is often a simple SEQUENCE of INTEGER.
368
 *
369
 * OpenSSL tries to discourage production of new keys in this form, because
370
 * of the ambiguity when trying to recognise them, but can't deny that PKCS#1
371
 * et al still are live standards.
372
 *
373
 * Note that these functions completely ignore p2s, and rather rely entirely
374
 * on k2d to do the complete work.
375
 */
376
static int key_to_type_specific_der_bio(BIO *out, const void *key,
377
    int key_nid,
378
    ossl_unused const char *pemname,
379
    key_to_paramstring_fn *p2s,
380
    OSSL_i2d_of_void_ctx *k2d,
381
    KEY2ANY_CTX *ctx)
382
0
{
383
0
    unsigned char *der = NULL;
384
0
    int derlen;
385
0
    int ret;
386
387
0
    if ((derlen = k2d(key, &der, (void *)ctx)) <= 0) {
388
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PROV_LIB);
389
0
        return 0;
390
0
    }
391
392
0
    ret = BIO_write(out, der, derlen);
393
0
    OPENSSL_free(der);
394
0
    return ret > 0;
395
0
}
396
0
#define key_to_type_specific_der_priv_bio key_to_type_specific_der_bio
397
0
#define key_to_type_specific_der_pub_bio key_to_type_specific_der_bio
398
0
#define key_to_type_specific_der_param_bio key_to_type_specific_der_bio
399
400
static int key_to_type_specific_pem_bio_cb(BIO *out, const void *key,
401
    int key_nid, const char *pemname,
402
    key_to_paramstring_fn *p2s,
403
    OSSL_i2d_of_void_ctx *k2d,
404
    KEY2ANY_CTX *ctx,
405
    pem_password_cb *cb, void *cbarg)
406
0
{
407
0
    return PEM_ASN1_write_bio_ctx(k2d, (void *)ctx, pemname, out, key,
408
0
               ctx->cipher, NULL, 0, cb, cbarg)
409
0
        > 0;
410
0
}
411
412
static int key_to_type_specific_pem_priv_bio(BIO *out, const void *key,
413
    int key_nid, const char *pemname,
414
    key_to_paramstring_fn *p2s,
415
    OSSL_i2d_of_void_ctx *k2d,
416
    KEY2ANY_CTX *ctx)
417
0
{
418
0
    return key_to_type_specific_pem_bio_cb(out, key, key_nid, pemname,
419
0
        p2s, k2d, ctx,
420
0
        ossl_pw_pem_password, &ctx->pwdata);
421
0
}
422
423
static int key_to_type_specific_pem_pub_bio(BIO *out, const void *key,
424
    int key_nid, const char *pemname,
425
    key_to_paramstring_fn *p2s,
426
    OSSL_i2d_of_void_ctx *k2d,
427
    KEY2ANY_CTX *ctx)
428
0
{
429
0
    return key_to_type_specific_pem_bio_cb(out, key, key_nid, pemname,
430
0
        p2s, k2d, ctx, NULL, NULL);
431
0
}
432
433
#ifndef OPENSSL_NO_KEYPARAMS
434
static int key_to_type_specific_pem_param_bio(BIO *out, const void *key,
435
    int key_nid, const char *pemname,
436
    key_to_paramstring_fn *p2s,
437
    OSSL_i2d_of_void_ctx *k2d,
438
    KEY2ANY_CTX *ctx)
439
0
{
440
0
    return key_to_type_specific_pem_bio_cb(out, key, key_nid, pemname,
441
0
        p2s, k2d, ctx, NULL, NULL);
442
0
}
443
#endif
444
445
/* ---------------------------------------------------------------------- */
446
447
#define k2d_NOCTX(n, f)                            \
448
    static int                                     \
449
    n##_k2d(const void *key, unsigned char **pder, \
450
        ossl_unused void *ctx)                     \
451
0
    {                                              \
452
0
        return f(key, pder);                       \
453
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
454
455
/* ---------------------------------------------------------------------- */
456
457
#ifndef OPENSSL_NO_DH
458
static int prepare_dh_params(const void *dh, int nid, int save,
459
    void **pstr, int *pstrtype)
460
0
{
461
0
    ASN1_STRING *params = ASN1_STRING_new();
462
463
0
    if (params == NULL) {
464
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
465
0
        return 0;
466
0
    }
467
468
0
    if (nid == EVP_PKEY_DHX)
469
0
        params->length = i2d_DHxparams(dh, &params->data);
470
0
    else
471
0
        params->length = i2d_DHparams(dh, &params->data);
472
473
0
    if (params->length <= 0) {
474
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
475
0
        ASN1_STRING_free(params);
476
0
        return 0;
477
0
    }
478
0
    params->type = V_ASN1_SEQUENCE;
479
480
0
    *pstr = params;
481
0
    *pstrtype = V_ASN1_SEQUENCE;
482
0
    return 1;
483
0
}
484
485
static int dh_spki_pub_to_der(const void *dh, unsigned char **pder,
486
    ossl_unused void *ctx)
487
0
{
488
0
    const BIGNUM *bn = NULL;
489
0
    ASN1_INTEGER *pub_key = NULL;
490
0
    int ret;
491
492
0
    if ((bn = DH_get0_pub_key(dh)) == NULL) {
493
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
494
0
        return 0;
495
0
    }
496
0
    if ((pub_key = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) {
497
0
        ERR_raise(ERR_LIB_PROV, PROV_R_BN_ERROR);
498
0
        return 0;
499
0
    }
500
501
0
    ret = i2d_ASN1_INTEGER(pub_key, pder);
502
503
0
    ASN1_STRING_clear_free(pub_key);
504
0
    return ret;
505
0
}
506
507
static int dh_pki_priv_to_der(const void *dh, unsigned char **pder,
508
    ossl_unused void *ctx)
509
0
{
510
0
    const BIGNUM *bn = NULL;
511
0
    ASN1_INTEGER *priv_key = NULL;
512
0
    int ret;
513
514
0
    if ((bn = DH_get0_priv_key(dh)) == NULL) {
515
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
516
0
        return 0;
517
0
    }
518
0
    if ((priv_key = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) {
519
0
        ERR_raise(ERR_LIB_PROV, PROV_R_BN_ERROR);
520
0
        return 0;
521
0
    }
522
523
0
    ret = i2d_ASN1_INTEGER(priv_key, pder);
524
525
0
    ASN1_STRING_clear_free(priv_key);
526
0
    return ret;
527
0
}
528
529
0
#define dh_epki_priv_to_der dh_pki_priv_to_der
530
531
static int
532
dh_type_specific_params_to_der(const void *dh, unsigned char **pder,
533
    ossl_unused void *ctx)
534
0
{
535
0
    if (DH_test_flags(dh, DH_FLAG_TYPE_DHX))
536
0
        return i2d_DHxparams(dh, pder);
537
0
    return i2d_DHparams(dh, pder);
538
0
}
539
540
/*
541
 * DH doesn't have i2d_DHPrivateKey or i2d_DHPublicKey, so we can't make
542
 * corresponding functions here.
543
 */
544
#define dh_type_specific_priv_to_der NULL
545
#define dh_type_specific_pub_to_der NULL
546
547
static int dh_check_key_type(const void *dh, int expected_type)
548
0
{
549
0
    int type = DH_test_flags(dh, DH_FLAG_TYPE_DHX) ? EVP_PKEY_DHX : EVP_PKEY_DH;
550
551
0
    return type == expected_type;
552
0
}
553
554
0
#define dh_evp_type EVP_PKEY_DH
555
0
#define dhx_evp_type EVP_PKEY_DHX
556
0
#define dh_pem_type "DH"
557
0
#define dhx_pem_type "X9.42 DH"
558
#endif
559
560
/* ---------------------------------------------------------------------- */
561
562
#ifndef OPENSSL_NO_DSA
563
static int encode_dsa_params(const void *dsa, int nid,
564
    void **pstr, int *pstrtype)
565
0
{
566
0
    ASN1_STRING *params = ASN1_STRING_new();
567
568
0
    if (params == NULL) {
569
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
570
0
        return 0;
571
0
    }
572
573
0
    params->length = i2d_DSAparams(dsa, &params->data);
574
575
0
    if (params->length <= 0) {
576
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
577
0
        ASN1_STRING_free(params);
578
0
        return 0;
579
0
    }
580
581
0
    *pstrtype = V_ASN1_SEQUENCE;
582
0
    *pstr = params;
583
0
    return 1;
584
0
}
585
586
static int prepare_dsa_params(const void *dsa, int nid, int save,
587
    void **pstr, int *pstrtype)
588
0
{
589
0
    const BIGNUM *p = DSA_get0_p(dsa);
590
0
    const BIGNUM *q = DSA_get0_q(dsa);
591
0
    const BIGNUM *g = DSA_get0_g(dsa);
592
593
0
    if (save && p != NULL && q != NULL && g != NULL)
594
0
        return encode_dsa_params(dsa, nid, pstr, pstrtype);
595
596
0
    *pstr = NULL;
597
0
    *pstrtype = V_ASN1_UNDEF;
598
0
    return 1;
599
0
}
600
601
static int dsa_spki_pub_to_der(const void *dsa, unsigned char **pder,
602
    ossl_unused void *ctx)
603
0
{
604
0
    const BIGNUM *bn = NULL;
605
0
    ASN1_INTEGER *pub_key = NULL;
606
0
    int ret;
607
608
0
    if ((bn = DSA_get0_pub_key(dsa)) == NULL) {
609
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
610
0
        return 0;
611
0
    }
612
0
    if ((pub_key = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) {
613
0
        ERR_raise(ERR_LIB_PROV, PROV_R_BN_ERROR);
614
0
        return 0;
615
0
    }
616
617
0
    ret = i2d_ASN1_INTEGER(pub_key, pder);
618
619
0
    ASN1_STRING_clear_free(pub_key);
620
0
    return ret;
621
0
}
622
623
static int dsa_pki_priv_to_der(const void *dsa, unsigned char **pder,
624
    ossl_unused void *ctx)
625
0
{
626
0
    const BIGNUM *bn = NULL;
627
0
    ASN1_INTEGER *priv_key = NULL;
628
0
    int ret;
629
630
0
    if ((bn = DSA_get0_priv_key(dsa)) == NULL) {
631
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
632
0
        return 0;
633
0
    }
634
0
    if ((priv_key = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) {
635
0
        ERR_raise(ERR_LIB_PROV, PROV_R_BN_ERROR);
636
0
        return 0;
637
0
    }
638
639
0
    ret = i2d_ASN1_INTEGER(priv_key, pder);
640
641
0
    ASN1_STRING_clear_free(priv_key);
642
0
    return ret;
643
0
}
644
645
k2d_NOCTX(dsa_prv, i2d_DSAPrivateKey)
646
    k2d_NOCTX(dsa_pub, i2d_DSAPublicKey)
647
        k2d_NOCTX(dsa_param, i2d_DSAparams)
648
649
0
#define dsa_epki_priv_to_der dsa_pki_priv_to_der
650
651
0
#define dsa_type_specific_priv_to_der dsa_prv_k2d
652
0
#define dsa_type_specific_pub_to_der dsa_pub_k2d
653
0
#define dsa_type_specific_params_to_der dsa_param_k2d
654
655
0
#define dsa_check_key_type NULL
656
0
#define dsa_evp_type EVP_PKEY_DSA
657
0
#define dsa_pem_type "DSA"
658
#endif
659
660
/* ---------------------------------------------------------------------- */
661
662
#ifndef OPENSSL_NO_EC
663
            static int prepare_ec_explicit_params(const void *eckey,
664
                void **pstr, int *pstrtype)
665
0
{
666
0
    ASN1_STRING *params = ASN1_STRING_new();
667
668
0
    if (params == NULL) {
669
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
670
0
        return 0;
671
0
    }
672
673
0
    params->length = i2d_ECParameters(eckey, &params->data);
674
0
    if (params->length <= 0) {
675
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
676
0
        ASN1_STRING_free(params);
677
0
        return 0;
678
0
    }
679
680
0
    *pstrtype = V_ASN1_SEQUENCE;
681
0
    *pstr = params;
682
0
    return 1;
683
0
}
684
685
/*
686
 * This implements EcpkParameters, where the CHOICE is based on whether there
687
 * is a curve name (curve nid) to be found or not.  See RFC 3279 for details.
688
 */
689
static int prepare_ec_params(const void *eckey, int nid, int save,
690
    void **pstr, int *pstrtype)
691
0
{
692
0
    int curve_nid;
693
0
    const EC_GROUP *group = EC_KEY_get0_group(eckey);
694
0
    ASN1_OBJECT *params = NULL;
695
696
0
    if (group == NULL)
697
0
        return 0;
698
0
    curve_nid = EC_GROUP_get_curve_name(group);
699
0
    if (curve_nid != NID_undef) {
700
0
        params = OBJ_nid2obj(curve_nid);
701
0
        if (params == NULL)
702
0
            return 0;
703
0
    }
704
705
0
    if (curve_nid != NID_undef
706
0
        && (EC_GROUP_get_asn1_flag(group) & OPENSSL_EC_NAMED_CURVE)) {
707
        /* The CHOICE came to namedCurve */
708
0
        if (OBJ_length(params) == 0) {
709
            /* Some curves might not have an associated OID */
710
0
            ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_OID);
711
0
            ASN1_OBJECT_free(params);
712
0
            return 0;
713
0
        }
714
0
        *pstr = params;
715
0
        *pstrtype = V_ASN1_OBJECT;
716
0
        return 1;
717
0
    } else {
718
        /* The CHOICE came to ecParameters */
719
0
        return prepare_ec_explicit_params(eckey, pstr, pstrtype);
720
0
    }
721
0
}
722
723
static int ec_spki_pub_to_der(const void *eckey, unsigned char **pder,
724
    ossl_unused void *ctx)
725
0
{
726
0
    if (EC_KEY_get0_public_key(eckey) == NULL) {
727
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
728
0
        return 0;
729
0
    }
730
0
    return i2o_ECPublicKey(eckey, pder);
731
0
}
732
733
static int ec_pki_priv_to_der(const void *veckey, unsigned char **pder,
734
    ossl_unused void *ctx)
735
0
{
736
0
    EC_KEY *eckey = (EC_KEY *)veckey;
737
0
    unsigned int old_flags;
738
0
    int ret = 0;
739
740
    /*
741
     * For PKCS8 the curve name appears in the PKCS8_PRIV_KEY_INFO object
742
     * as the pkeyalg->parameter field. (For a named curve this is an OID)
743
     * The pkey field is an octet string that holds the encoded
744
     * ECPrivateKey SEQUENCE with the optional parameters field omitted.
745
     * We omit this by setting the EC_PKEY_NO_PARAMETERS flag.
746
     */
747
0
    old_flags = EC_KEY_get_enc_flags(eckey); /* save old flags */
748
0
    EC_KEY_set_enc_flags(eckey, old_flags | EC_PKEY_NO_PARAMETERS);
749
0
    ret = i2d_ECPrivateKey(eckey, pder);
750
0
    EC_KEY_set_enc_flags(eckey, old_flags); /* restore old flags */
751
0
    return ret; /* return the length of the der encoded data */
752
0
}
753
754
k2d_NOCTX(ec_param, i2d_ECParameters)
755
    k2d_NOCTX(ec_prv, i2d_ECPrivateKey)
756
757
0
#define ec_epki_priv_to_der ec_pki_priv_to_der
758
759
0
#define ec_type_specific_params_to_der ec_param_k2d
760
/* No ec_type_specific_pub_to_der, there simply is no such thing */
761
0
#define ec_type_specific_priv_to_der ec_prv_k2d
762
763
0
#define ec_check_key_type NULL
764
0
#define ec_evp_type EVP_PKEY_EC
765
0
#define ec_pem_type "EC"
766
767
#ifndef OPENSSL_NO_SM2
768
/*
769
 * Albeit SM2 is a slightly different algorithm than ECDSA, the key type
770
 * encoding (in all places where an AlgorithmIdentifier is produced, such
771
 * as PrivateKeyInfo and SubjectPublicKeyInfo) is the same as for ECC keys
772
 * according to the example in GM/T 0015-2012, appendix D.2.
773
 * This leaves the distinction of SM2 keys to the EC group (which is found
774
 * in AlgorithmIdentified.params).
775
 */
776
0
#define sm2_evp_type ec_evp_type
777
0
#define sm2_pem_type "SM2"
778
#endif
779
#endif
780
781
/* ---------------------------------------------------------------------- */
782
783
#ifndef OPENSSL_NO_ECX
784
0
#define prepare_ecx_params NULL
785
786
        static int ecx_spki_pub_to_der(const void *vecxkey, unsigned char **pder,
787
            ossl_unused void *ctx)
788
0
{
789
0
    const ECX_KEY *ecxkey = vecxkey;
790
0
    unsigned char *keyblob;
791
792
0
    if (ecxkey == NULL) {
793
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
794
0
        return 0;
795
0
    }
796
797
0
    keyblob = OPENSSL_memdup(ecxkey->pubkey, ecxkey->keylen);
798
0
    if (keyblob == NULL)
799
0
        return 0;
800
801
0
    *pder = keyblob;
802
0
    return (int)ecxkey->keylen;
803
0
}
804
805
static int ecx_pki_priv_to_der(const void *vecxkey, unsigned char **pder,
806
    ossl_unused void *ctx)
807
0
{
808
0
    const ECX_KEY *ecxkey = vecxkey;
809
0
    ASN1_OCTET_STRING oct;
810
0
    int keybloblen;
811
812
0
    if (ecxkey == NULL || ecxkey->privkey == NULL) {
813
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
814
0
        return 0;
815
0
    }
816
817
0
    oct.data = ecxkey->privkey;
818
0
    oct.length = (int)ecxkey->keylen;
819
0
    oct.flags = 0;
820
821
0
    keybloblen = i2d_ASN1_OCTET_STRING(&oct, pder);
822
0
    if (keybloblen < 0) {
823
0
        ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
824
0
        return 0;
825
0
    }
826
827
0
    return keybloblen;
828
0
}
829
830
0
#define ecx_epki_priv_to_der ecx_pki_priv_to_der
831
832
/*
833
 * ED25519, ED448, X25519 and X448 only has PKCS#8 / SubjectPublicKeyInfo
834
 * representation, so we don't define ecx_type_specific_[priv,pub,params]_to_der.
835
 */
836
837
0
#define ecx_check_key_type NULL
838
839
0
#define ed25519_evp_type EVP_PKEY_ED25519
840
0
#define ed448_evp_type EVP_PKEY_ED448
841
0
#define x25519_evp_type EVP_PKEY_X25519
842
0
#define x448_evp_type EVP_PKEY_X448
843
0
#define ed25519_pem_type "ED25519"
844
0
#define ed448_pem_type "ED448"
845
0
#define x25519_pem_type "X25519"
846
0
#define x448_pem_type "X448"
847
#endif
848
849
/* ---------------------------------------------------------------------- */
850
851
#ifndef OPENSSL_NO_ML_DSA
852
static int ml_dsa_spki_pub_to_der(const void *vkey, unsigned char **pder,
853
    ossl_unused void *ctx)
854
0
{
855
0
    return ossl_ml_dsa_i2d_pubkey(vkey, pder);
856
0
}
857
858
static int ml_dsa_pki_priv_to_der(const void *vkey, unsigned char **pder,
859
    void *vctx)
860
0
{
861
0
    KEY2ANY_CTX *ctx = vctx;
862
863
0
    return ossl_ml_dsa_i2d_prvkey(vkey, pder,
864
0
        ctx->provctx, ctx->output_formats);
865
0
}
866
867
0
#define ml_dsa_epki_priv_to_der ml_dsa_pki_priv_to_der
868
0
#define prepare_ml_dsa_params NULL
869
0
#define ml_dsa_check_key_type NULL
870
871
0
#define ml_dsa_44_evp_type EVP_PKEY_ML_DSA_44
872
0
#define ml_dsa_44_pem_type "ML-DSA-44"
873
0
#define ml_dsa_65_evp_type EVP_PKEY_ML_DSA_65
874
0
#define ml_dsa_65_pem_type "ML-DSA-65"
875
0
#define ml_dsa_87_evp_type EVP_PKEY_ML_DSA_87
876
0
#define ml_dsa_87_pem_type "ML-DSA-87"
877
#endif /* OPENSSL_NO_ML_DSA */
878
879
/* ---------------------------------------------------------------------- */
880
881
#ifndef OPENSSL_NO_ML_KEM
882
883
static int ml_kem_spki_pub_to_der(const void *vkey, unsigned char **pder,
884
    ossl_unused void *ctx)
885
0
{
886
0
    return ossl_ml_kem_i2d_pubkey(vkey, pder);
887
0
}
888
889
static int ml_kem_pki_priv_to_der(const void *vkey, unsigned char **pder,
890
    void *vctx)
891
0
{
892
0
    KEY2ANY_CTX *ctx = vctx;
893
894
0
    return ossl_ml_kem_i2d_prvkey(vkey, pder,
895
0
        ctx->provctx, ctx->output_formats);
896
0
}
897
898
0
#define ml_kem_epki_priv_to_der ml_kem_pki_priv_to_der
899
0
#define prepare_ml_kem_params NULL
900
0
#define ml_kem_check_key_type NULL
901
902
0
#define ml_kem_512_evp_type EVP_PKEY_ML_KEM_512
903
0
#define ml_kem_512_pem_type "ML-KEM-512"
904
0
#define ml_kem_768_evp_type EVP_PKEY_ML_KEM_768
905
0
#define ml_kem_768_pem_type "ML-KEM-768"
906
0
#define ml_kem_1024_evp_type EVP_PKEY_ML_KEM_1024
907
0
#define ml_kem_1024_pem_type "ML-KEM-1024"
908
#endif
909
910
/* ---------------------------------------------------------------------- */
911
912
/*
913
 * Helper functions to prepare RSA-PSS params for encoding.  We would
914
 * have simply written the whole AlgorithmIdentifier, but existing libcrypto
915
 * functionality doesn't allow that.
916
 */
917
918
static int prepare_rsa_params(const void *rsa, int nid, int save,
919
    void **pstr, int *pstrtype)
920
0
{
921
0
    const RSA_PSS_PARAMS_30 *pss = ossl_rsa_get0_pss_params_30((RSA *)rsa);
922
923
0
    *pstr = NULL;
924
925
0
    switch (RSA_test_flags(rsa, RSA_FLAG_TYPE_MASK)) {
926
0
    case RSA_FLAG_TYPE_RSA:
927
        /* If plain RSA, the parameters shall be NULL */
928
0
        *pstrtype = V_ASN1_NULL;
929
0
        return 1;
930
0
    case RSA_FLAG_TYPE_RSASSAPSS:
931
0
        if (ossl_rsa_pss_params_30_is_unrestricted(pss)) {
932
0
            *pstrtype = V_ASN1_UNDEF;
933
0
            return 1;
934
0
        } else {
935
0
            ASN1_STRING *astr = NULL;
936
0
            WPACKET pkt;
937
0
            unsigned char *str = NULL;
938
0
            size_t str_sz = 0;
939
0
            int i;
940
941
0
            for (i = 0; i < 2; i++) {
942
0
                switch (i) {
943
0
                case 0:
944
0
                    if (!WPACKET_init_null_der(&pkt))
945
0
                        goto err;
946
0
                    break;
947
0
                case 1:
948
0
                    if ((str = OPENSSL_malloc(str_sz)) == NULL
949
0
                        || !WPACKET_init_der(&pkt, str, str_sz)) {
950
0
                        WPACKET_cleanup(&pkt);
951
0
                        goto err;
952
0
                    }
953
0
                    break;
954
0
                }
955
0
                if (!ossl_DER_w_RSASSA_PSS_params(&pkt, -1, pss)
956
0
                    || !WPACKET_finish(&pkt)
957
0
                    || !WPACKET_get_total_written(&pkt, &str_sz)) {
958
0
                    WPACKET_cleanup(&pkt);
959
0
                    goto err;
960
0
                }
961
0
                WPACKET_cleanup(&pkt);
962
963
                /*
964
                 * If no PSS parameters are going to be written, there's no
965
                 * point going for another iteration.
966
                 * This saves us from getting |str| allocated just to have it
967
                 * immediately de-allocated.
968
                 */
969
0
                if (str_sz == 0)
970
0
                    break;
971
0
            }
972
973
0
            if ((astr = ASN1_STRING_new()) == NULL)
974
0
                goto err;
975
0
            *pstrtype = V_ASN1_SEQUENCE;
976
0
            ASN1_STRING_set0(astr, str, (int)str_sz);
977
0
            *pstr = astr;
978
979
0
            return 1;
980
0
        err:
981
0
            OPENSSL_free(str);
982
0
            return 0;
983
0
        }
984
0
    }
985
986
    /* Currently unsupported RSA key type */
987
0
    return 0;
988
0
}
989
990
k2d_NOCTX(rsa_prv, i2d_RSAPrivateKey)
991
    k2d_NOCTX(rsa_pub, i2d_RSAPublicKey)
992
993
/*
994
 * RSA is extremely simple, as PKCS#1 is used for the PKCS#8 |privateKey|
995
 * field as well as the SubjectPublicKeyInfo |subjectPublicKey| field.
996
 */
997
0
#define rsa_pki_priv_to_der rsa_type_specific_priv_to_der
998
0
#define rsa_epki_priv_to_der rsa_type_specific_priv_to_der
999
0
#define rsa_spki_pub_to_der rsa_type_specific_pub_to_der
1000
0
#define rsa_type_specific_priv_to_der rsa_prv_k2d
1001
0
#define rsa_type_specific_pub_to_der rsa_pub_k2d
1002
#define rsa_type_specific_params_to_der NULL
1003
1004
        static int rsa_check_key_type(const void *rsa, int expected_type)
1005
0
{
1006
0
    switch (RSA_test_flags(rsa, RSA_FLAG_TYPE_MASK)) {
1007
0
    case RSA_FLAG_TYPE_RSA:
1008
0
        return expected_type == EVP_PKEY_RSA;
1009
0
    case RSA_FLAG_TYPE_RSASSAPSS:
1010
0
        return expected_type == EVP_PKEY_RSA_PSS;
1011
0
    }
1012
1013
    /* Currently unsupported RSA key type */
1014
0
    return EVP_PKEY_NONE;
1015
0
}
1016
1017
0
#define rsa_evp_type EVP_PKEY_RSA
1018
0
#define rsapss_evp_type EVP_PKEY_RSA_PSS
1019
0
#define rsa_pem_type "RSA"
1020
0
#define rsapss_pem_type "RSA-PSS"
1021
1022
/* ---------------------------------------------------------------------- */
1023
1024
#ifndef OPENSSL_NO_SLH_DSA
1025
0
#define prepare_slh_dsa_params NULL
1026
1027
static int slh_dsa_spki_pub_to_der(const void *vkey, unsigned char **pder,
1028
    ossl_unused void *ctx)
1029
0
{
1030
0
    const SLH_DSA_KEY *key = vkey;
1031
0
    uint8_t *key_blob;
1032
0
    size_t key_len;
1033
1034
0
    if (key == NULL) {
1035
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
1036
0
        return 0;
1037
0
    }
1038
0
    key_len = ossl_slh_dsa_key_get_pub_len(key);
1039
0
    key_blob = OPENSSL_memdup(ossl_slh_dsa_key_get_pub(key), key_len);
1040
0
    if (key_blob == NULL)
1041
0
        return 0;
1042
1043
0
    *pder = key_blob;
1044
0
    return (int)key_len;
1045
0
}
1046
1047
static int slh_dsa_pki_priv_to_der(const void *vkey, unsigned char **pder,
1048
    ossl_unused void *ctx)
1049
0
{
1050
0
    const SLH_DSA_KEY *key = vkey;
1051
0
    size_t len;
1052
1053
0
    if (ossl_slh_dsa_key_get_priv(key) == NULL) {
1054
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
1055
0
        return 0;
1056
0
    }
1057
0
    len = ossl_slh_dsa_key_get_priv_len(key);
1058
1059
0
    if (pder != NULL
1060
0
        && ((*pder = OPENSSL_memdup(ossl_slh_dsa_key_get_priv(key), len)) == NULL))
1061
0
        return 0;
1062
1063
0
    return (int)len;
1064
0
}
1065
0
#define slh_dsa_epki_priv_to_der slh_dsa_pki_priv_to_der
1066
1067
/* SLH_DSA only has PKCS#8 / SubjectPublicKeyInfo representations. */
1068
1069
0
#define slh_dsa_check_key_type NULL
1070
0
#define slh_dsa_sha2_128s_evp_type EVP_PKEY_SLH_DSA_SHA2_128S
1071
0
#define slh_dsa_sha2_128f_evp_type EVP_PKEY_SLH_DSA_SHA2_128F
1072
0
#define slh_dsa_sha2_192s_evp_type EVP_PKEY_SLH_DSA_SHA2_192S
1073
0
#define slh_dsa_sha2_192f_evp_type EVP_PKEY_SLH_DSA_SHA2_192F
1074
0
#define slh_dsa_sha2_256s_evp_type EVP_PKEY_SLH_DSA_SHA2_256S
1075
0
#define slh_dsa_sha2_256f_evp_type EVP_PKEY_SLH_DSA_SHA2_256F
1076
0
#define slh_dsa_shake_128s_evp_type EVP_PKEY_SLH_DSA_SHAKE_128S
1077
0
#define slh_dsa_shake_128f_evp_type EVP_PKEY_SLH_DSA_SHAKE_128F
1078
0
#define slh_dsa_shake_192s_evp_type EVP_PKEY_SLH_DSA_SHAKE_192S
1079
0
#define slh_dsa_shake_192f_evp_type EVP_PKEY_SLH_DSA_SHAKE_192F
1080
0
#define slh_dsa_shake_256s_evp_type EVP_PKEY_SLH_DSA_SHAKE_256S
1081
0
#define slh_dsa_shake_256f_evp_type EVP_PKEY_SLH_DSA_SHAKE_256F
1082
#define slh_dsa_sha2_128s_input_type "SLH-DSA-SHA2-128s"
1083
#define slh_dsa_sha2_128f_input_type "SLH-DSA-SHA2-128f"
1084
#define slh_dsa_sha2_192s_input_type "SLH-DSA-SHA2-192s"
1085
#define slh_dsa_sha2_192f_input_type "SLH-DSA-SHA2-192f"
1086
#define slh_dsa_sha2_256s_input_type "SLH-DSA-SHA2-256s"
1087
#define slh_dsa_sha2_256f_input_type "SLH-DSA-SHA2-256f"
1088
#define slh_dsa_shake_128s_input_type "SLH-DSA-SHAKE-128s"
1089
#define slh_dsa_shake_128f_input_type "SLH-DSA-SHAKE-128f"
1090
#define slh_dsa_shake_192s_input_type "SLH-DSA-SHAKE-192s"
1091
#define slh_dsa_shake_192f_input_type "SLH-DSA-SHAKE-192f"
1092
#define slh_dsa_shake_256s_input_type "SLH-DSA-SHAKE-256s"
1093
#define slh_dsa_shake_256f_input_type "SLH-DSA-SHAKE-256f"
1094
0
#define slh_dsa_sha2_128s_pem_type "SLH-DSA-SHA2-128s"
1095
0
#define slh_dsa_sha2_128f_pem_type "SLH-DSA-SHA2-128f"
1096
0
#define slh_dsa_sha2_192s_pem_type "SLH-DSA-SHA2-192s"
1097
0
#define slh_dsa_sha2_192f_pem_type "SLH-DSA-SHA2-192f"
1098
0
#define slh_dsa_sha2_256s_pem_type "SLH-DSA-SHA2-256s"
1099
0
#define slh_dsa_sha2_256f_pem_type "SLH-DSA-SHA2-256f"
1100
0
#define slh_dsa_shake_128s_pem_type "SLH-DSA-SHAKE-128s"
1101
0
#define slh_dsa_shake_128f_pem_type "SLH-DSA-SHAKE-128f"
1102
0
#define slh_dsa_shake_192s_pem_type "SLH-DSA-SHAKE-192s"
1103
0
#define slh_dsa_shake_192f_pem_type "SLH-DSA-SHAKE-192f"
1104
0
#define slh_dsa_shake_256s_pem_type "SLH-DSA-SHAKE-256s"
1105
0
#define slh_dsa_shake_256f_pem_type "SLH-DSA-SHAKE-256f"
1106
#endif /* OPENSSL_NO_SLH_DSA */
1107
1108
/* ---------------------------------------------------------------------- */
1109
1110
static OSSL_FUNC_decoder_newctx_fn key2any_newctx;
1111
static OSSL_FUNC_decoder_freectx_fn key2any_freectx;
1112
1113
static void *key2any_newctx(void *provctx)
1114
0
{
1115
0
    KEY2ANY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
1116
1117
0
    if (ctx != NULL) {
1118
0
        ctx->provctx = provctx;
1119
0
        ctx->save_parameters = 1;
1120
0
    }
1121
1122
0
    return ctx;
1123
0
}
1124
1125
static void key2any_freectx(void *vctx)
1126
0
{
1127
0
    KEY2ANY_CTX *ctx = vctx;
1128
1129
0
    ossl_pw_clear_passphrase_data(&ctx->pwdata);
1130
0
    EVP_CIPHER_free(ctx->cipher);
1131
0
    OPENSSL_free(ctx->output_formats);
1132
0
    OPENSSL_free(ctx);
1133
0
}
1134
1135
static const OSSL_PARAM *key2any_settable_ctx_params(ossl_unused void *provctx)
1136
0
{
1137
0
    return key2any_set_ctx_params_list;
1138
0
}
1139
1140
static int key2any_set_ctx_params(void *vctx, const OSSL_PARAM params[])
1141
0
{
1142
0
    KEY2ANY_CTX *ctx = vctx;
1143
0
    struct key2any_set_ctx_params_st p;
1144
1145
0
    if (ctx == NULL || !key2any_set_ctx_params_decoder(params, &p))
1146
0
        return 0;
1147
1148
0
    if (p.cipher != NULL) {
1149
0
        const char *ciphername = NULL;
1150
0
        const char *props = NULL;
1151
0
        OSSL_LIB_CTX *libctx;
1152
1153
0
        if (!OSSL_PARAM_get_utf8_string_ptr(p.cipher, &ciphername))
1154
0
            return 0;
1155
0
        if (p.propq != NULL && !OSSL_PARAM_get_utf8_string_ptr(p.propq, &props))
1156
0
            return 0;
1157
1158
0
        libctx = ossl_prov_ctx_get0_libctx(ctx->provctx);
1159
0
        EVP_CIPHER_free(ctx->cipher);
1160
0
        ctx->cipher = NULL;
1161
0
        ctx->cipher_intent = ciphername != NULL;
1162
0
        if (ciphername != NULL
1163
0
            && ((ctx->cipher = EVP_CIPHER_fetch(libctx, ciphername, props)) == NULL))
1164
0
            return 0;
1165
0
    }
1166
1167
0
    if (p.svprm != NULL && !OSSL_PARAM_get_int(p.svprm, &ctx->save_parameters))
1168
0
        return 0;
1169
1170
0
    if (p.output_formats != NULL) {
1171
0
        char *val = NULL;
1172
1173
0
        if (!OSSL_PARAM_get_utf8_string(p.output_formats, &val, 0))
1174
0
            return 0;
1175
0
        OPENSSL_free(ctx->output_formats);
1176
0
        if (*val != '\0') {
1177
0
            ctx->output_formats = val;
1178
0
        } else {
1179
0
            OPENSSL_free(val);
1180
0
            ctx->output_formats = NULL;
1181
0
        }
1182
0
    }
1183
1184
0
    return 1;
1185
0
}
1186
1187
static int key2any_check_selection(int selection, int selection_mask)
1188
0
{
1189
    /*
1190
     * The selections are kinda sorta "levels", i.e. each selection given
1191
     * here is assumed to include those following.
1192
     */
1193
0
    int checks[] = {
1194
0
        OSSL_KEYMGMT_SELECT_PRIVATE_KEY,
1195
0
        OSSL_KEYMGMT_SELECT_PUBLIC_KEY,
1196
0
        OSSL_KEYMGMT_SELECT_ALL_PARAMETERS
1197
0
    };
1198
0
    size_t i;
1199
1200
    /* The decoder implementations made here support guessing */
1201
0
    if (selection == 0)
1202
0
        return 1;
1203
1204
0
    for (i = 0; i < OSSL_NELEM(checks); i++) {
1205
0
        int check1 = (selection & checks[i]) != 0;
1206
0
        int check2 = (selection_mask & checks[i]) != 0;
1207
1208
        /*
1209
         * If the caller asked for the currently checked bit(s), return
1210
         * whether the decoder description says it's supported.
1211
         */
1212
0
        if (check1)
1213
0
            return check2;
1214
0
    }
1215
1216
    /* This should be dead code, but just to be safe... */
1217
0
    return 0;
1218
0
}
1219
1220
static int key2any_encode(KEY2ANY_CTX *ctx, OSSL_CORE_BIO *cout,
1221
    const void *key, int type, const char *pemname,
1222
    check_key_type_fn *checker,
1223
    key_to_der_fn *writer,
1224
    OSSL_PASSPHRASE_CALLBACK *pwcb, void *pwcbarg,
1225
    key_to_paramstring_fn *key2paramstring,
1226
    OSSL_i2d_of_void_ctx *key2der)
1227
0
{
1228
0
    int ret = 0;
1229
1230
0
    if (key == NULL) {
1231
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
1232
0
    } else if (writer != NULL
1233
0
        && (checker == NULL || checker(key, type))) {
1234
0
        BIO *out = ossl_bio_new_from_core_bio(ctx->provctx, cout);
1235
1236
0
        if (out != NULL
1237
0
            && (pwcb == NULL
1238
0
                || ossl_pw_set_ossl_passphrase_cb(&ctx->pwdata, pwcb, pwcbarg)))
1239
0
            ret = writer(out, key, type, pemname, key2paramstring, key2der, ctx);
1240
1241
0
        BIO_free(out);
1242
0
    } else {
1243
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);
1244
0
    }
1245
0
    return ret;
1246
0
}
1247
1248
0
#define DO_PRIVATE_KEY_selection_mask OSSL_KEYMGMT_SELECT_PRIVATE_KEY
1249
#define DO_PRIVATE_KEY(impl, type, kind, output)               \
1250
0
    if ((selection & DO_PRIVATE_KEY_selection_mask) != 0)      \
1251
0
        return key2any_encode(ctx, cout, key, impl##_evp_type, \
1252
0
            impl##_pem_type " PRIVATE KEY",                    \
1253
0
            type##_check_key_type,                             \
1254
0
            key_to_##kind##_##output##_priv_bio,               \
1255
0
            cb, cbarg, prepare_##type##_params,                \
1256
0
            type##_##kind##_priv_to_der);
1257
1258
0
#define DO_PUBLIC_KEY_selection_mask OSSL_KEYMGMT_SELECT_PUBLIC_KEY
1259
#define DO_PUBLIC_KEY(impl, type, kind, output)                \
1260
0
    if ((selection & DO_PUBLIC_KEY_selection_mask) != 0)       \
1261
0
        return key2any_encode(ctx, cout, key, impl##_evp_type, \
1262
0
            impl##_pem_type " PUBLIC KEY",                     \
1263
0
            type##_check_key_type,                             \
1264
0
            key_to_##kind##_##output##_pub_bio,                \
1265
0
            cb, cbarg, prepare_##type##_params,                \
1266
0
            type##_##kind##_pub_to_der);
1267
1268
0
#define DO_PARAMETERS_selection_mask OSSL_KEYMGMT_SELECT_ALL_PARAMETERS
1269
#define DO_PARAMETERS(impl, type, kind, output)                \
1270
0
    if ((selection & DO_PARAMETERS_selection_mask) != 0)       \
1271
0
        return key2any_encode(ctx, cout, key, impl##_evp_type, \
1272
0
            impl##_pem_type " PARAMETERS",                     \
1273
0
            type##_check_key_type,                             \
1274
0
            key_to_##kind##_##output##_param_bio,              \
1275
0
            NULL, NULL, NULL,                                  \
1276
0
            type##_##kind##_params_to_der);
1277
1278
/*-
1279
 * Implement the kinds of output structure that can be produced.  They are
1280
 * referred to by name, and for each name, the following macros are defined
1281
 * (braces not included):
1282
 *
1283
 * DO_{kind}_selection_mask
1284
 *
1285
 *      A mask of selection bits that must not be zero.  This is used as a
1286
 *      selection criterion for each implementation.
1287
 *      This mask must never be zero.
1288
 *
1289
 * DO_{kind}
1290
 *
1291
 *      The performing macro.  It must use the DO_ macros defined above,
1292
 *      always in this order:
1293
 *
1294
 *      - DO_PRIVATE_KEY
1295
 *      - DO_PUBLIC_KEY
1296
 *      - DO_PARAMETERS
1297
 *
1298
 *      Any of those may be omitted, but the relative order must still be
1299
 *      the same.
1300
 */
1301
1302
/*
1303
 * PKCS#8 defines two structures for private keys only:
1304
 * - PrivateKeyInfo             (raw unencrypted form)
1305
 * - EncryptedPrivateKeyInfo    (encrypted wrapping)
1306
 *
1307
 * To allow a certain amount of flexibility, we allow the routines
1308
 * for PrivateKeyInfo to also produce EncryptedPrivateKeyInfo if a
1309
 * passphrase callback has been passed to them.
1310
 */
1311
0
#define DO_PrivateKeyInfo_selection_mask DO_PRIVATE_KEY_selection_mask
1312
#define DO_PrivateKeyInfo(impl, type, output) \
1313
0
    DO_PRIVATE_KEY(impl, type, pki, output)
1314
1315
0
#define DO_EncryptedPrivateKeyInfo_selection_mask DO_PRIVATE_KEY_selection_mask
1316
#define DO_EncryptedPrivateKeyInfo(impl, type, output) \
1317
0
    DO_PRIVATE_KEY(impl, type, epki, output)
1318
1319
/* SubjectPublicKeyInfo is a structure for public keys only */
1320
0
#define DO_SubjectPublicKeyInfo_selection_mask DO_PUBLIC_KEY_selection_mask
1321
#define DO_SubjectPublicKeyInfo(impl, type, output) \
1322
0
    DO_PUBLIC_KEY(impl, type, spki, output)
1323
1324
/*
1325
 * "type-specific" is a uniform name for key type specific output for private
1326
 * and public keys as well as key parameters.  This is used internally in
1327
 * libcrypto so it doesn't have to have special knowledge about select key
1328
 * types, but also when no better name has been found.  If there are more
1329
 * expressive DO_ names above, those are preferred.
1330
 *
1331
 * Three forms exist:
1332
 *
1333
 * - type_specific_keypair              Only supports private and public key
1334
 * - type_specific_params               Only supports parameters
1335
 * - type_specific                      Supports all parts of an EVP_PKEY
1336
 * - type_specific_no_pub               Supports all parts of an EVP_PKEY
1337
 *                                      except public key
1338
 */
1339
0
#define DO_type_specific_params_selection_mask DO_PARAMETERS_selection_mask
1340
#define DO_type_specific_params(impl, type, output) \
1341
0
    DO_PARAMETERS(impl, type, type_specific, output)
1342
#define DO_type_specific_keypair_selection_mask \
1343
0
    (DO_PRIVATE_KEY_selection_mask | DO_PUBLIC_KEY_selection_mask)
1344
#define DO_type_specific_keypair(impl, type, output)  \
1345
0
    DO_PRIVATE_KEY(impl, type, type_specific, output) \
1346
0
    DO_PUBLIC_KEY(impl, type, type_specific, output)
1347
#define DO_type_specific_selection_mask      \
1348
0
    (DO_type_specific_keypair_selection_mask \
1349
0
        | DO_type_specific_params_selection_mask)
1350
#define DO_type_specific(impl, type, output)     \
1351
0
    DO_type_specific_keypair(impl, type, output) \
1352
0
        DO_type_specific_params(impl, type, output)
1353
#define DO_type_specific_no_pub_selection_mask \
1354
0
    (DO_PRIVATE_KEY_selection_mask | DO_PARAMETERS_selection_mask)
1355
#define DO_type_specific_no_pub(impl, type, output)   \
1356
0
    DO_PRIVATE_KEY(impl, type, type_specific, output) \
1357
0
    DO_type_specific_params(impl, type, output)
1358
1359
/*
1360
 * Type specific aliases for the cases where we need to refer to them by
1361
 * type name.
1362
 * This only covers key types that are represented with i2d_{TYPE}PrivateKey,
1363
 * i2d_{TYPE}PublicKey and i2d_{TYPE}params / i2d_{TYPE}Parameters.
1364
 */
1365
0
#define DO_RSA_selection_mask DO_type_specific_keypair_selection_mask
1366
0
#define DO_RSA(impl, type, output) DO_type_specific_keypair(impl, type, output)
1367
1368
0
#define DO_DH_selection_mask DO_type_specific_params_selection_mask
1369
0
#define DO_DH(impl, type, output) DO_type_specific_params(impl, type, output)
1370
1371
0
#define DO_DHX_selection_mask DO_type_specific_params_selection_mask
1372
0
#define DO_DHX(impl, type, output) DO_type_specific_params(impl, type, output)
1373
1374
0
#define DO_DSA_selection_mask DO_type_specific_selection_mask
1375
0
#define DO_DSA(impl, type, output) DO_type_specific(impl, type, output)
1376
1377
0
#define DO_EC_selection_mask DO_type_specific_no_pub_selection_mask
1378
0
#define DO_EC(impl, type, output) DO_type_specific_no_pub(impl, type, output)
1379
1380
0
#define DO_SM2_selection_mask DO_type_specific_no_pub_selection_mask
1381
0
#define DO_SM2(impl, type, output) DO_type_specific_no_pub(impl, type, output)
1382
1383
/* PKCS#1 defines a structure for RSA private and public keys */
1384
0
#define DO_PKCS1_selection_mask DO_RSA_selection_mask
1385
0
#define DO_PKCS1(impl, type, output) DO_RSA(impl, type, output)
1386
1387
/* PKCS#3 defines a structure for DH parameters */
1388
0
#define DO_PKCS3_selection_mask DO_DH_selection_mask
1389
0
#define DO_PKCS3(impl, type, output) DO_DH(impl, type, output)
1390
/* X9.42 defines a structure for DHx parameters */
1391
0
#define DO_X9_42_selection_mask DO_DHX_selection_mask
1392
0
#define DO_X9_42(impl, type, output) DO_DHX(impl, type, output)
1393
1394
/* X9.62 defines a structure for EC keys and parameters */
1395
0
#define DO_X9_62_selection_mask DO_EC_selection_mask
1396
0
#define DO_X9_62(impl, type, output) DO_EC(impl, type, output)
1397
1398
/*
1399
 * MAKE_ENCODER is the single driver for creating OSSL_DISPATCH tables.
1400
 * It takes the following arguments:
1401
 *
1402
 * impl         This is the key type name that's being implemented.
1403
 * type         This is the type name for the set of functions that implement
1404
 *              the key type.  For example, ed25519, ed448, x25519 and x448
1405
 *              are all implemented with the exact same set of functions.
1406
 * kind         What kind of support to implement.  These translate into
1407
 *              the DO_##kind macros above.
1408
 * output       The output type to implement.  may be der or pem.
1409
 *
1410
 * The resulting OSSL_DISPATCH array gets the following name (expressed in
1411
 * C preprocessor terms) from those arguments:
1412
 *
1413
 * ossl_##impl##_to_##kind##_##output##_encoder_functions
1414
 */
1415
#define MAKE_ENCODER(impl, type, kind, output)                                    \
1416
    static OSSL_FUNC_encoder_import_object_fn                                     \
1417
        impl##_to_##kind##_##output##_import_object;                              \
1418
    static OSSL_FUNC_encoder_free_object_fn                                       \
1419
        impl##_to_##kind##_##output##_free_object;                                \
1420
    static OSSL_FUNC_encoder_encode_fn                                            \
1421
        impl##_to_##kind##_##output##_encode;                                     \
1422
                                                                                  \
1423
    static void *                                                                 \
1424
    impl##_to_##kind##_##output##_import_object(void *vctx, int selection,        \
1425
        const OSSL_PARAM params[])                                                \
1426
0
    {                                                                             \
1427
0
        KEY2ANY_CTX *ctx = vctx;                                                  \
1428
0
                                                                                  \
1429
0
        return ossl_prov_import_key(ossl_##impl##_keymgmt_functions,              \
1430
0
            ctx->provctx, selection, params);                                     \
1431
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
1432
    static void impl##_to_##kind##_##output##_free_object(void *key)              \
1433
0
    {                                                                             \
1434
0
        ossl_prov_free_key(ossl_##impl##_keymgmt_functions, key);                 \
1435
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
1436
    static int impl##_to_##kind##_##output##_does_selection(void *ctx,            \
1437
        int selection)                                                            \
1438
0
    {                                                                             \
1439
0
        return key2any_check_selection(selection,                                 \
1440
0
            DO_##kind##_selection_mask);                                          \
1441
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
1442
    static int                                                                    \
1443
    impl##_to_##kind##_##output##_encode(void *ctx, OSSL_CORE_BIO *cout,          \
1444
        const void *key,                                                          \
1445
        const OSSL_PARAM key_abstract[],                                          \
1446
        int selection,                                                            \
1447
        OSSL_PASSPHRASE_CALLBACK *cb,                                             \
1448
        void *cbarg)                                                              \
1449
0
    {                                                                             \
1450
0
        /* We don't deal with abstract objects */                                 \
1451
0
        if (key_abstract != NULL) {                                               \
1452
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);               \
1453
0
            return 0;                                                             \
1454
0
        }                                                                         \
1455
0
        DO_##kind(impl, type, output)                                             \
1456
0
                                                                                  \
1457
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);               \
1458
0
        return 0;                                                                 \
1459
0
    }                                                                             \
1460
    const OSSL_DISPATCH                                                           \
1461
        ossl_##impl##_to_##kind##_##output##_encoder_functions[]                  \
1462
        = {                                                                       \
1463
              { OSSL_FUNC_ENCODER_NEWCTX,                                         \
1464
                  (void (*)(void))key2any_newctx },                               \
1465
              { OSSL_FUNC_ENCODER_FREECTX,                                        \
1466
                  (void (*)(void))key2any_freectx },                              \
1467
              { OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS,                            \
1468
                  (void (*)(void))key2any_settable_ctx_params },                  \
1469
              { OSSL_FUNC_ENCODER_SET_CTX_PARAMS,                                 \
1470
                  (void (*)(void))key2any_set_ctx_params },                       \
1471
              { OSSL_FUNC_ENCODER_DOES_SELECTION,                                 \
1472
                  (void (*)(void))impl##_to_##kind##_##output##_does_selection }, \
1473
              { OSSL_FUNC_ENCODER_IMPORT_OBJECT,                                  \
1474
                  (void (*)(void))impl##_to_##kind##_##output##_import_object },  \
1475
              { OSSL_FUNC_ENCODER_FREE_OBJECT,                                    \
1476
                  (void (*)(void))impl##_to_##kind##_##output##_free_object },    \
1477
              { OSSL_FUNC_ENCODER_ENCODE,                                         \
1478
                  (void (*)(void))impl##_to_##kind##_##output##_encode },         \
1479
              OSSL_DISPATCH_END                                                   \
1480
          }
1481
1482
/*
1483
 * Replacements for i2d_{TYPE}PrivateKey, i2d_{TYPE}PublicKey,
1484
 * i2d_{TYPE}params, as they exist.
1485
 */
1486
0
MAKE_ENCODER(rsa, rsa, type_specific_keypair, der);
1487
#ifndef OPENSSL_NO_DH
1488
0
MAKE_ENCODER(dh, dh, type_specific_params, der);
1489
0
MAKE_ENCODER(dhx, dh, type_specific_params, der);
1490
#endif
1491
#ifndef OPENSSL_NO_DSA
1492
0
MAKE_ENCODER(dsa, dsa, type_specific, der);
1493
#endif
1494
#ifndef OPENSSL_NO_EC
1495
0
MAKE_ENCODER(ec, ec, type_specific_no_pub, der);
1496
#ifndef OPENSSL_NO_SM2
1497
0
MAKE_ENCODER(sm2, ec, type_specific_no_pub, der);
1498
#endif
1499
#endif
1500
1501
/*
1502
 * Replacements for PEM_write_bio_{TYPE}PrivateKey,
1503
 * PEM_write_bio_{TYPE}PublicKey, PEM_write_bio_{TYPE}params, as they exist.
1504
 */
1505
0
MAKE_ENCODER(rsa, rsa, type_specific_keypair, pem);
1506
#ifndef OPENSSL_NO_DH
1507
0
MAKE_ENCODER(dh, dh, type_specific_params, pem);
1508
0
MAKE_ENCODER(dhx, dh, type_specific_params, pem);
1509
#endif
1510
#ifndef OPENSSL_NO_DSA
1511
0
MAKE_ENCODER(dsa, dsa, type_specific, pem);
1512
#endif
1513
#ifndef OPENSSL_NO_EC
1514
0
MAKE_ENCODER(ec, ec, type_specific_no_pub, pem);
1515
#ifndef OPENSSL_NO_SM2
1516
0
MAKE_ENCODER(sm2, ec, type_specific_no_pub, pem);
1517
#endif
1518
#endif
1519
1520
/*
1521
 * PKCS#8 and SubjectPublicKeyInfo support.  This may duplicate some of the
1522
 * implementations specified above, but are more specific.
1523
 * The SubjectPublicKeyInfo implementations also replace the
1524
 * PEM_write_bio_{TYPE}_PUBKEY functions.
1525
 * For PEM, these are expected to be used by PEM_write_bio_PrivateKey(),
1526
 * PEM_write_bio_PUBKEY() and PEM_write_bio_Parameters().
1527
 */
1528
0
MAKE_ENCODER(rsa, rsa, EncryptedPrivateKeyInfo, der);
1529
0
MAKE_ENCODER(rsa, rsa, EncryptedPrivateKeyInfo, pem);
1530
0
MAKE_ENCODER(rsa, rsa, PrivateKeyInfo, der);
1531
0
MAKE_ENCODER(rsa, rsa, PrivateKeyInfo, pem);
1532
0
MAKE_ENCODER(rsa, rsa, SubjectPublicKeyInfo, der);
1533
0
MAKE_ENCODER(rsa, rsa, SubjectPublicKeyInfo, pem);
1534
0
MAKE_ENCODER(rsapss, rsa, EncryptedPrivateKeyInfo, der);
1535
0
MAKE_ENCODER(rsapss, rsa, EncryptedPrivateKeyInfo, pem);
1536
0
MAKE_ENCODER(rsapss, rsa, PrivateKeyInfo, der);
1537
0
MAKE_ENCODER(rsapss, rsa, PrivateKeyInfo, pem);
1538
0
MAKE_ENCODER(rsapss, rsa, SubjectPublicKeyInfo, der);
1539
0
MAKE_ENCODER(rsapss, rsa, SubjectPublicKeyInfo, pem);
1540
#ifndef OPENSSL_NO_DH
1541
0
MAKE_ENCODER(dh, dh, EncryptedPrivateKeyInfo, der);
1542
0
MAKE_ENCODER(dh, dh, EncryptedPrivateKeyInfo, pem);
1543
0
MAKE_ENCODER(dh, dh, PrivateKeyInfo, der);
1544
0
MAKE_ENCODER(dh, dh, PrivateKeyInfo, pem);
1545
0
MAKE_ENCODER(dh, dh, SubjectPublicKeyInfo, der);
1546
0
MAKE_ENCODER(dh, dh, SubjectPublicKeyInfo, pem);
1547
0
MAKE_ENCODER(dhx, dh, EncryptedPrivateKeyInfo, der);
1548
0
MAKE_ENCODER(dhx, dh, EncryptedPrivateKeyInfo, pem);
1549
0
MAKE_ENCODER(dhx, dh, PrivateKeyInfo, der);
1550
0
MAKE_ENCODER(dhx, dh, PrivateKeyInfo, pem);
1551
0
MAKE_ENCODER(dhx, dh, SubjectPublicKeyInfo, der);
1552
0
MAKE_ENCODER(dhx, dh, SubjectPublicKeyInfo, pem);
1553
#endif
1554
#ifndef OPENSSL_NO_DSA
1555
0
MAKE_ENCODER(dsa, dsa, EncryptedPrivateKeyInfo, der);
1556
0
MAKE_ENCODER(dsa, dsa, EncryptedPrivateKeyInfo, pem);
1557
0
MAKE_ENCODER(dsa, dsa, PrivateKeyInfo, der);
1558
0
MAKE_ENCODER(dsa, dsa, PrivateKeyInfo, pem);
1559
0
MAKE_ENCODER(dsa, dsa, SubjectPublicKeyInfo, der);
1560
0
MAKE_ENCODER(dsa, dsa, SubjectPublicKeyInfo, pem);
1561
#endif
1562
#ifndef OPENSSL_NO_EC
1563
0
MAKE_ENCODER(ec, ec, EncryptedPrivateKeyInfo, der);
1564
0
MAKE_ENCODER(ec, ec, EncryptedPrivateKeyInfo, pem);
1565
0
MAKE_ENCODER(ec, ec, PrivateKeyInfo, der);
1566
0
MAKE_ENCODER(ec, ec, PrivateKeyInfo, pem);
1567
0
MAKE_ENCODER(ec, ec, SubjectPublicKeyInfo, der);
1568
0
MAKE_ENCODER(ec, ec, SubjectPublicKeyInfo, pem);
1569
#ifndef OPENSSL_NO_SM2
1570
0
MAKE_ENCODER(sm2, ec, EncryptedPrivateKeyInfo, der);
1571
0
MAKE_ENCODER(sm2, ec, EncryptedPrivateKeyInfo, pem);
1572
0
MAKE_ENCODER(sm2, ec, PrivateKeyInfo, der);
1573
0
MAKE_ENCODER(sm2, ec, PrivateKeyInfo, pem);
1574
0
MAKE_ENCODER(sm2, ec, SubjectPublicKeyInfo, der);
1575
0
MAKE_ENCODER(sm2, ec, SubjectPublicKeyInfo, pem);
1576
#endif
1577
#ifndef OPENSSL_NO_ECX
1578
0
MAKE_ENCODER(ed25519, ecx, EncryptedPrivateKeyInfo, der);
1579
0
MAKE_ENCODER(ed25519, ecx, EncryptedPrivateKeyInfo, pem);
1580
0
MAKE_ENCODER(ed25519, ecx, PrivateKeyInfo, der);
1581
0
MAKE_ENCODER(ed25519, ecx, PrivateKeyInfo, pem);
1582
0
MAKE_ENCODER(ed25519, ecx, SubjectPublicKeyInfo, der);
1583
0
MAKE_ENCODER(ed25519, ecx, SubjectPublicKeyInfo, pem);
1584
0
MAKE_ENCODER(ed448, ecx, EncryptedPrivateKeyInfo, der);
1585
0
MAKE_ENCODER(ed448, ecx, EncryptedPrivateKeyInfo, pem);
1586
0
MAKE_ENCODER(ed448, ecx, PrivateKeyInfo, der);
1587
0
MAKE_ENCODER(ed448, ecx, PrivateKeyInfo, pem);
1588
0
MAKE_ENCODER(ed448, ecx, SubjectPublicKeyInfo, der);
1589
0
MAKE_ENCODER(ed448, ecx, SubjectPublicKeyInfo, pem);
1590
0
MAKE_ENCODER(x25519, ecx, EncryptedPrivateKeyInfo, der);
1591
0
MAKE_ENCODER(x25519, ecx, EncryptedPrivateKeyInfo, pem);
1592
0
MAKE_ENCODER(x25519, ecx, PrivateKeyInfo, der);
1593
0
MAKE_ENCODER(x25519, ecx, PrivateKeyInfo, pem);
1594
0
MAKE_ENCODER(x25519, ecx, SubjectPublicKeyInfo, der);
1595
0
MAKE_ENCODER(x25519, ecx, SubjectPublicKeyInfo, pem);
1596
0
MAKE_ENCODER(x448, ecx, EncryptedPrivateKeyInfo, der);
1597
0
MAKE_ENCODER(x448, ecx, EncryptedPrivateKeyInfo, pem);
1598
0
MAKE_ENCODER(x448, ecx, PrivateKeyInfo, der);
1599
0
MAKE_ENCODER(x448, ecx, PrivateKeyInfo, pem);
1600
0
MAKE_ENCODER(x448, ecx, SubjectPublicKeyInfo, der);
1601
0
MAKE_ENCODER(x448, ecx, SubjectPublicKeyInfo, pem);
1602
#endif
1603
#endif
1604
#ifndef OPENSSL_NO_SLH_DSA
1605
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, EncryptedPrivateKeyInfo, der);
1606
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, EncryptedPrivateKeyInfo, der);
1607
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, EncryptedPrivateKeyInfo, der);
1608
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, EncryptedPrivateKeyInfo, der);
1609
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, EncryptedPrivateKeyInfo, der);
1610
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, EncryptedPrivateKeyInfo, der);
1611
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1612
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1613
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1614
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1615
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1616
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1617
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, EncryptedPrivateKeyInfo, der);
1618
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, EncryptedPrivateKeyInfo, der);
1619
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, EncryptedPrivateKeyInfo, der);
1620
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, EncryptedPrivateKeyInfo, der);
1621
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, EncryptedPrivateKeyInfo, der);
1622
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, EncryptedPrivateKeyInfo, der);
1623
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1624
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1625
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1626
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1627
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, EncryptedPrivateKeyInfo, pem);
1628
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, EncryptedPrivateKeyInfo, pem);
1629
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, PrivateKeyInfo, der);
1630
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, PrivateKeyInfo, der);
1631
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, PrivateKeyInfo, der);
1632
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, PrivateKeyInfo, der);
1633
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, PrivateKeyInfo, der);
1634
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, PrivateKeyInfo, der);
1635
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, PrivateKeyInfo, pem);
1636
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, PrivateKeyInfo, pem);
1637
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, PrivateKeyInfo, pem);
1638
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, PrivateKeyInfo, pem);
1639
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, PrivateKeyInfo, pem);
1640
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, PrivateKeyInfo, pem);
1641
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, PrivateKeyInfo, der);
1642
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, PrivateKeyInfo, der);
1643
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, PrivateKeyInfo, der);
1644
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, PrivateKeyInfo, der);
1645
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, PrivateKeyInfo, der);
1646
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, PrivateKeyInfo, der);
1647
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, PrivateKeyInfo, pem);
1648
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, PrivateKeyInfo, pem);
1649
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, PrivateKeyInfo, pem);
1650
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, PrivateKeyInfo, pem);
1651
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, PrivateKeyInfo, pem);
1652
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, PrivateKeyInfo, pem);
1653
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, SubjectPublicKeyInfo, der);
1654
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, SubjectPublicKeyInfo, der);
1655
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, SubjectPublicKeyInfo, der);
1656
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, SubjectPublicKeyInfo, der);
1657
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, SubjectPublicKeyInfo, der);
1658
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, SubjectPublicKeyInfo, der);
1659
0
MAKE_ENCODER(slh_dsa_sha2_128s, slh_dsa, SubjectPublicKeyInfo, pem);
1660
0
MAKE_ENCODER(slh_dsa_sha2_128f, slh_dsa, SubjectPublicKeyInfo, pem);
1661
0
MAKE_ENCODER(slh_dsa_sha2_192s, slh_dsa, SubjectPublicKeyInfo, pem);
1662
0
MAKE_ENCODER(slh_dsa_sha2_192f, slh_dsa, SubjectPublicKeyInfo, pem);
1663
0
MAKE_ENCODER(slh_dsa_sha2_256s, slh_dsa, SubjectPublicKeyInfo, pem);
1664
0
MAKE_ENCODER(slh_dsa_sha2_256f, slh_dsa, SubjectPublicKeyInfo, pem);
1665
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, SubjectPublicKeyInfo, der);
1666
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, SubjectPublicKeyInfo, der);
1667
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, SubjectPublicKeyInfo, der);
1668
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, SubjectPublicKeyInfo, der);
1669
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, SubjectPublicKeyInfo, der);
1670
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, SubjectPublicKeyInfo, der);
1671
0
MAKE_ENCODER(slh_dsa_shake_128s, slh_dsa, SubjectPublicKeyInfo, pem);
1672
0
MAKE_ENCODER(slh_dsa_shake_128f, slh_dsa, SubjectPublicKeyInfo, pem);
1673
0
MAKE_ENCODER(slh_dsa_shake_192s, slh_dsa, SubjectPublicKeyInfo, pem);
1674
0
MAKE_ENCODER(slh_dsa_shake_192f, slh_dsa, SubjectPublicKeyInfo, pem);
1675
0
MAKE_ENCODER(slh_dsa_shake_256s, slh_dsa, SubjectPublicKeyInfo, pem);
1676
0
MAKE_ENCODER(slh_dsa_shake_256f, slh_dsa, SubjectPublicKeyInfo, pem);
1677
#endif /* OPENSSL_NO_SLH_DSA */
1678
1679
#ifndef OPENSSL_NO_ML_KEM
1680
0
MAKE_ENCODER(ml_kem_512, ml_kem, EncryptedPrivateKeyInfo, der);
1681
0
MAKE_ENCODER(ml_kem_512, ml_kem, EncryptedPrivateKeyInfo, pem);
1682
0
MAKE_ENCODER(ml_kem_512, ml_kem, PrivateKeyInfo, der);
1683
0
MAKE_ENCODER(ml_kem_512, ml_kem, PrivateKeyInfo, pem);
1684
0
MAKE_ENCODER(ml_kem_512, ml_kem, SubjectPublicKeyInfo, der);
1685
0
MAKE_ENCODER(ml_kem_512, ml_kem, SubjectPublicKeyInfo, pem);
1686
1687
0
MAKE_ENCODER(ml_kem_768, ml_kem, EncryptedPrivateKeyInfo, der);
1688
0
MAKE_ENCODER(ml_kem_768, ml_kem, EncryptedPrivateKeyInfo, pem);
1689
0
MAKE_ENCODER(ml_kem_768, ml_kem, PrivateKeyInfo, der);
1690
0
MAKE_ENCODER(ml_kem_768, ml_kem, PrivateKeyInfo, pem);
1691
0
MAKE_ENCODER(ml_kem_768, ml_kem, SubjectPublicKeyInfo, der);
1692
0
MAKE_ENCODER(ml_kem_768, ml_kem, SubjectPublicKeyInfo, pem);
1693
1694
0
MAKE_ENCODER(ml_kem_1024, ml_kem, EncryptedPrivateKeyInfo, der);
1695
0
MAKE_ENCODER(ml_kem_1024, ml_kem, EncryptedPrivateKeyInfo, pem);
1696
0
MAKE_ENCODER(ml_kem_1024, ml_kem, PrivateKeyInfo, der);
1697
0
MAKE_ENCODER(ml_kem_1024, ml_kem, PrivateKeyInfo, pem);
1698
0
MAKE_ENCODER(ml_kem_1024, ml_kem, SubjectPublicKeyInfo, der);
1699
0
MAKE_ENCODER(ml_kem_1024, ml_kem, SubjectPublicKeyInfo, pem);
1700
#endif
1701
1702
/*
1703
 * Support for key type specific output formats.  Not all key types have
1704
 * this, we only aim to duplicate what is available in 1.1.1 as
1705
 * i2d_TYPEPrivateKey(), i2d_TYPEPublicKey() and i2d_TYPEparams().
1706
 * For example, there are no publicly available i2d_ function for
1707
 * ED25519, ED448, X25519 or X448, and they therefore only have PKCS#8
1708
 * and SubjectPublicKeyInfo implementations as implemented above.
1709
 */
1710
0
MAKE_ENCODER(rsa, rsa, RSA, der);
1711
0
MAKE_ENCODER(rsa, rsa, RSA, pem);
1712
#ifndef OPENSSL_NO_DH
1713
0
MAKE_ENCODER(dh, dh, DH, der);
1714
0
MAKE_ENCODER(dh, dh, DH, pem);
1715
0
MAKE_ENCODER(dhx, dh, DHX, der);
1716
0
MAKE_ENCODER(dhx, dh, DHX, pem);
1717
#endif
1718
#ifndef OPENSSL_NO_DSA
1719
0
MAKE_ENCODER(dsa, dsa, DSA, der);
1720
0
MAKE_ENCODER(dsa, dsa, DSA, pem);
1721
#endif
1722
#ifndef OPENSSL_NO_EC
1723
0
MAKE_ENCODER(ec, ec, EC, der);
1724
0
MAKE_ENCODER(ec, ec, EC, pem);
1725
#ifndef OPENSSL_NO_SM2
1726
0
MAKE_ENCODER(sm2, ec, SM2, der);
1727
0
MAKE_ENCODER(sm2, ec, SM2, pem);
1728
#endif
1729
#endif
1730
1731
/* Convenience structure names */
1732
0
MAKE_ENCODER(rsa, rsa, PKCS1, der);
1733
0
MAKE_ENCODER(rsa, rsa, PKCS1, pem);
1734
0
MAKE_ENCODER(rsapss, rsa, PKCS1, der);
1735
0
MAKE_ENCODER(rsapss, rsa, PKCS1, pem);
1736
#ifndef OPENSSL_NO_DH
1737
0
MAKE_ENCODER(dh, dh, PKCS3, der); /* parameters only */
1738
0
MAKE_ENCODER(dh, dh, PKCS3, pem); /* parameters only */
1739
0
MAKE_ENCODER(dhx, dh, X9_42, der); /* parameters only */
1740
0
MAKE_ENCODER(dhx, dh, X9_42, pem); /* parameters only */
1741
#endif
1742
#ifndef OPENSSL_NO_EC
1743
0
MAKE_ENCODER(ec, ec, X9_62, der);
1744
0
MAKE_ENCODER(ec, ec, X9_62, pem);
1745
#endif
1746
1747
#ifndef OPENSSL_NO_ML_DSA
1748
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, EncryptedPrivateKeyInfo, der);
1749
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, EncryptedPrivateKeyInfo, pem);
1750
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, PrivateKeyInfo, der);
1751
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, PrivateKeyInfo, pem);
1752
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, SubjectPublicKeyInfo, der);
1753
0
MAKE_ENCODER(ml_dsa_44, ml_dsa, SubjectPublicKeyInfo, pem);
1754
1755
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, EncryptedPrivateKeyInfo, der);
1756
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, EncryptedPrivateKeyInfo, pem);
1757
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, PrivateKeyInfo, der);
1758
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, PrivateKeyInfo, pem);
1759
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, SubjectPublicKeyInfo, der);
1760
0
MAKE_ENCODER(ml_dsa_65, ml_dsa, SubjectPublicKeyInfo, pem);
1761
1762
0
MAKE_ENCODER(ml_dsa_87, ml_dsa, EncryptedPrivateKeyInfo, der);
1763
0
MAKE_ENCODER(ml_dsa_87, ml_dsa, EncryptedPrivateKeyInfo, pem);
1764
0
MAKE_ENCODER(ml_dsa_87, ml_dsa, PrivateKeyInfo, der);
1765
0
MAKE_ENCODER(ml_dsa_87, ml_dsa, PrivateKeyInfo, pem);
1766
0
MAKE_ENCODER(ml_dsa_87, ml_dsa, SubjectPublicKeyInfo, der);
1767
MAKE_ENCODER(ml_dsa_87, ml_dsa, SubjectPublicKeyInfo, pem);
1768
#endif /* OPENSSL_NO_ML_DSA */