Coverage Report

Created: 2025-08-28 07:07

/src/openssl35/providers/implementations/encode_decode/encode_key2text.c
Line
Count
Source (jump to first uncovered line)
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/core.h>
16
#include <openssl/core_dispatch.h>
17
#include <openssl/core_names.h>
18
#include <openssl/bn.h>
19
#include <openssl/err.h>
20
#include <openssl/safestack.h>
21
#include <openssl/proverr.h>
22
#include "crypto/dh.h"           /* ossl_dh_get0_params() */
23
#include "crypto/dsa.h"          /* ossl_dsa_get0_params() */
24
#include "crypto/ec.h"           /* ossl_ec_key_get_libctx */
25
#include "crypto/ecx.h"          /* ECX_KEY, etc... */
26
#include "crypto/ml_kem.h"       /* ML_KEM_KEY, etc... */
27
#include "crypto/rsa.h"          /* RSA_PSS_PARAMS_30, etc... */
28
#include "crypto/ml_dsa.h"
29
#include "crypto/slh_dsa.h"
30
#include "prov/bio.h"
31
#include "prov/implementations.h"
32
#include "internal/encoder.h"
33
#include "endecoder_local.h"
34
#include "ml_dsa_codecs.h"
35
#include "ml_kem_codecs.h"
36
37
DEFINE_SPECIAL_STACK_OF_CONST(BIGNUM_const, BIGNUM)
38
39
/* ---------------------------------------------------------------------- */
40
41
#ifndef OPENSSL_NO_DH
42
static int dh_to_text(BIO *out, const void *key, int selection)
43
27.8k
{
44
27.8k
    const DH *dh = key;
45
27.8k
    const char *type_label = NULL;
46
27.8k
    const BIGNUM *priv_key = NULL, *pub_key = NULL;
47
27.8k
    const FFC_PARAMS *params = NULL;
48
27.8k
    const BIGNUM *p = NULL;
49
27.8k
    long length;
50
51
27.8k
    if (out == NULL || dh == NULL) {
52
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
53
0
        return 0;
54
0
    }
55
56
27.8k
    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
57
9.07k
        type_label = "DH Private-Key";
58
18.7k
    else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
59
9.75k
        type_label = "DH Public-Key";
60
8.98k
    else if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
61
8.98k
        type_label = "DH Parameters";
62
63
27.8k
    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
64
9.07k
        priv_key = DH_get0_priv_key(dh);
65
9.07k
        if (priv_key == NULL) {
66
8.94k
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
67
8.94k
            return 0;
68
8.94k
        }
69
9.07k
    }
70
18.8k
    if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0) {
71
9.88k
        pub_key = DH_get0_pub_key(dh);
72
9.88k
        if (pub_key == NULL) {
73
8.69k
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
74
8.69k
            return 0;
75
8.69k
        }
76
9.88k
    }
77
10.1k
    if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) {
78
10.1k
        params = ossl_dh_get0_params((DH *)dh);
79
10.1k
        if (params == NULL) {
80
0
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_PARAMETERS);
81
0
            return 0;
82
0
        }
83
10.1k
    }
84
85
10.1k
    p = DH_get0_p(dh);
86
10.1k
    if (p == NULL) {
87
0
        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY);
88
0
        return 0;
89
0
    }
90
91
10.1k
    if (BIO_printf(out, "%s: (%d bit)\n", type_label, BN_num_bits(p)) <= 0)
92
0
        return 0;
93
10.1k
    if (priv_key != NULL
94
10.1k
        && !ossl_bio_print_labeled_bignum(out, "private-key:", priv_key))
95
0
        return 0;
96
10.1k
    if (pub_key != NULL
97
10.1k
        && !ossl_bio_print_labeled_bignum(out, "public-key:", pub_key))
98
0
        return 0;
99
10.1k
    if (params != NULL
100
10.1k
        && !ossl_bio_print_ffc_params(out, params))
101
0
        return 0;
102
10.1k
    length = DH_get_length(dh);
103
10.1k
    if (length > 0
104
10.1k
        && BIO_printf(out, "recommended-private-length: %ld bits\n",
105
215
                      length) <= 0)
106
0
        return 0;
107
108
10.1k
    return 1;
109
10.1k
}
110
#endif
111
112
/* ---------------------------------------------------------------------- */
113
114
#ifndef OPENSSL_NO_DSA
115
static int dsa_to_text(BIO *out, const void *key, int selection)
116
10.1k
{
117
10.1k
    const DSA *dsa = key;
118
10.1k
    const char *type_label = NULL;
119
10.1k
    const BIGNUM *priv_key = NULL, *pub_key = NULL;
120
10.1k
    const FFC_PARAMS *params = NULL;
121
10.1k
    const BIGNUM *p = NULL;
122
123
10.1k
    if (out == NULL || dsa == NULL) {
124
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
125
0
        return 0;
126
0
    }
127
128
10.1k
    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
129
5.24k
        type_label = "Private-Key";
130
4.90k
    else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
131
2.49k
        type_label = "Public-Key";
132
2.40k
    else if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
133
2.40k
        type_label = "DSA-Parameters";
134
135
10.1k
    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
136
5.24k
        priv_key = DSA_get0_priv_key(dsa);
137
5.24k
        if (priv_key == NULL) {
138
276
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
139
276
            return 0;
140
276
        }
141
5.24k
    }
142
9.87k
    if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0) {
143
7.46k
        pub_key = DSA_get0_pub_key(dsa);
144
7.46k
        if (pub_key == NULL) {
145
0
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
146
0
            return 0;
147
0
        }
148
7.46k
    }
149
9.87k
    if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) {
150
9.87k
        params = ossl_dsa_get0_params((DSA *)dsa);
151
9.87k
        if (params == NULL) {
152
0
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_PARAMETERS);
153
0
            return 0;
154
0
        }
155
9.87k
    }
156
157
9.87k
    p = DSA_get0_p(dsa);
158
9.87k
    if (p == NULL) {
159
0
        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY);
160
0
        return 0;
161
0
    }
162
163
9.87k
    if (BIO_printf(out, "%s: (%d bit)\n", type_label, BN_num_bits(p)) <= 0)
164
0
        return 0;
165
9.87k
    if (priv_key != NULL
166
9.87k
        && !ossl_bio_print_labeled_bignum(out, "priv:", priv_key))
167
0
        return 0;
168
9.87k
    if (pub_key != NULL
169
9.87k
        && !ossl_bio_print_labeled_bignum(out, "pub: ", pub_key))
170
0
        return 0;
171
9.87k
    if (params != NULL
172
9.87k
        && !ossl_bio_print_ffc_params(out, params))
173
0
        return 0;
174
175
9.87k
    return 1;
176
9.87k
}
177
#endif
178
179
/* ---------------------------------------------------------------------- */
180
181
#ifndef OPENSSL_NO_EC
182
static int ec_param_explicit_curve_to_text(BIO *out, const EC_GROUP *group,
183
                                           BN_CTX *ctx)
184
1.84k
{
185
1.84k
    const char *plabel = "Prime:";
186
1.84k
    BIGNUM *p = NULL, *a = NULL, *b = NULL;
187
188
1.84k
    p = BN_CTX_get(ctx);
189
1.84k
    a = BN_CTX_get(ctx);
190
1.84k
    b = BN_CTX_get(ctx);
191
1.84k
    if (b == NULL
192
1.84k
        || !EC_GROUP_get_curve(group, p, a, b, ctx))
193
0
        return 0;
194
195
1.84k
    if (EC_GROUP_get_field_type(group) == NID_X9_62_characteristic_two_field) {
196
0
        int basis_type = EC_GROUP_get_basis_type(group);
197
198
        /* print the 'short name' of the base type OID */
199
0
        if (basis_type == NID_undef
200
0
            || BIO_printf(out, "Basis Type: %s\n", OBJ_nid2sn(basis_type)) <= 0)
201
0
            return 0;
202
0
        plabel = "Polynomial:";
203
0
    }
204
1.84k
    return ossl_bio_print_labeled_bignum(out, plabel, p)
205
1.84k
        && ossl_bio_print_labeled_bignum(out, "A:   ", a)
206
1.84k
        && ossl_bio_print_labeled_bignum(out, "B:   ", b);
207
1.84k
}
208
209
static int ec_param_explicit_gen_to_text(BIO *out, const EC_GROUP *group,
210
                                         BN_CTX *ctx)
211
1.84k
{
212
1.84k
    int ret;
213
1.84k
    size_t buflen;
214
1.84k
    point_conversion_form_t form;
215
1.84k
    const EC_POINT *point = NULL;
216
1.84k
    const char *glabel = NULL;
217
1.84k
    unsigned char *buf = NULL;
218
219
1.84k
    form = EC_GROUP_get_point_conversion_form(group);
220
1.84k
    point = EC_GROUP_get0_generator(group);
221
222
1.84k
    if (point == NULL)
223
0
        return 0;
224
225
1.84k
    switch (form) {
226
1.62k
    case POINT_CONVERSION_COMPRESSED:
227
1.62k
       glabel = "Generator (compressed):";
228
1.62k
       break;
229
144
    case POINT_CONVERSION_UNCOMPRESSED:
230
144
        glabel = "Generator (uncompressed):";
231
144
        break;
232
79
    case POINT_CONVERSION_HYBRID:
233
79
        glabel = "Generator (hybrid):";
234
79
        break;
235
0
    default:
236
0
        return 0;
237
1.84k
    }
238
239
1.84k
    buflen = EC_POINT_point2buf(group, point, form, &buf, ctx);
240
1.84k
    if (buflen == 0)
241
0
        return 0;
242
243
1.84k
    ret = ossl_bio_print_labeled_buf(out, glabel, buf, buflen);
244
1.84k
    OPENSSL_clear_free(buf, buflen);
245
1.84k
    return ret;
246
1.84k
}
247
248
/* Print explicit parameters */
249
static int ec_param_explicit_to_text(BIO *out, const EC_GROUP *group,
250
                                     OSSL_LIB_CTX *libctx)
251
1.84k
{
252
1.84k
    int ret = 0, tmp_nid;
253
1.84k
    BN_CTX *ctx = NULL;
254
1.84k
    const BIGNUM *order = NULL, *cofactor = NULL;
255
1.84k
    const unsigned char *seed;
256
1.84k
    size_t seed_len = 0;
257
258
1.84k
    ctx = BN_CTX_new_ex(libctx);
259
1.84k
    if (ctx == NULL)
260
0
        return 0;
261
1.84k
    BN_CTX_start(ctx);
262
263
1.84k
    tmp_nid = EC_GROUP_get_field_type(group);
264
1.84k
    order = EC_GROUP_get0_order(group);
265
1.84k
    if (order == NULL)
266
0
        goto err;
267
268
1.84k
    seed = EC_GROUP_get0_seed(group);
269
1.84k
    if (seed != NULL)
270
1.06k
        seed_len = EC_GROUP_get_seed_len(group);
271
1.84k
    cofactor = EC_GROUP_get0_cofactor(group);
272
273
    /* print the 'short name' of the field type */
274
1.84k
    if (BIO_printf(out, "Field Type: %s\n", OBJ_nid2sn(tmp_nid)) <= 0
275
1.84k
        || !ec_param_explicit_curve_to_text(out, group, ctx)
276
1.84k
        || !ec_param_explicit_gen_to_text(out, group, ctx)
277
1.84k
        || !ossl_bio_print_labeled_bignum(out, "Order: ", order)
278
1.84k
        || (cofactor != NULL
279
1.84k
            && !ossl_bio_print_labeled_bignum(out, "Cofactor: ", cofactor))
280
1.84k
        || (seed != NULL
281
1.84k
            && !ossl_bio_print_labeled_buf(out, "Seed:", seed, seed_len)))
282
0
        goto err;
283
1.84k
    ret = 1;
284
1.84k
err:
285
1.84k
    BN_CTX_end(ctx);
286
1.84k
    BN_CTX_free(ctx);
287
1.84k
    return ret;
288
1.84k
}
289
290
static int ec_param_to_text(BIO *out, const EC_GROUP *group,
291
                            OSSL_LIB_CTX *libctx)
292
14.7k
{
293
14.7k
    if (EC_GROUP_get_asn1_flag(group) & OPENSSL_EC_NAMED_CURVE) {
294
12.9k
        const char *curve_name;
295
12.9k
        int curve_nid = EC_GROUP_get_curve_name(group);
296
297
        /* Explicit parameters */
298
12.9k
        if (curve_nid == NID_undef)
299
0
            return 0;
300
301
12.9k
        if (BIO_printf(out, "%s: %s\n", "ASN1 OID", OBJ_nid2sn(curve_nid)) <= 0)
302
0
            return 0;
303
304
12.9k
        curve_name = EC_curve_nid2nist(curve_nid);
305
12.9k
        return (curve_name == NULL
306
12.9k
                || BIO_printf(out, "%s: %s\n", "NIST CURVE", curve_name) > 0);
307
12.9k
    } else {
308
1.84k
        return ec_param_explicit_to_text(out, group, libctx);
309
1.84k
    }
310
14.7k
}
311
312
static int ec_to_text(BIO *out, const void *key, int selection)
313
18.8k
{
314
18.8k
    const EC_KEY *ec = key;
315
18.8k
    const char *type_label = NULL;
316
18.8k
    unsigned char *priv = NULL, *pub = NULL;
317
18.8k
    size_t priv_len = 0, pub_len = 0;
318
18.8k
    const EC_GROUP *group;
319
18.8k
    int ret = 0;
320
321
18.8k
    if (out == NULL || ec == NULL) {
322
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
323
0
        return 0;
324
0
    }
325
326
18.8k
    if ((group = EC_KEY_get0_group(ec)) == NULL) {
327
0
        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY);
328
0
        return 0;
329
0
    }
330
331
18.8k
    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
332
8.41k
        type_label = "Private-Key";
333
10.4k
    else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)
334
6.18k
        type_label = "Public-Key";
335
4.27k
    else if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
336
4.27k
        if (EC_GROUP_get_curve_name(group) != NID_sm2)
337
4.23k
            type_label = "EC-Parameters";
338
339
18.8k
    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
340
8.41k
        const BIGNUM *priv_key = EC_KEY_get0_private_key(ec);
341
342
8.41k
        if (priv_key == NULL) {
343
1.23k
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
344
1.23k
            goto err;
345
1.23k
        }
346
7.17k
        priv_len = EC_KEY_priv2buf(ec, &priv);
347
7.17k
        if (priv_len == 0)
348
1.82k
            goto err;
349
7.17k
    }
350
15.8k
    if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0) {
351
11.5k
        const EC_POINT *pub_pt = EC_KEY_get0_public_key(ec);
352
353
11.5k
        if (pub_pt == NULL) {
354
620
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
355
620
            goto err;
356
620
        }
357
358
10.9k
        pub_len = EC_KEY_key2buf(ec, EC_KEY_get_conv_form(ec), &pub, NULL);
359
10.9k
        if (pub_len == 0)
360
416
            goto err;
361
10.9k
    }
362
363
14.7k
    if (type_label != NULL
364
14.7k
        && BIO_printf(out, "%s: (%d bit)\n", type_label,
365
14.7k
                      EC_GROUP_order_bits(group)) <= 0)
366
0
        goto err;
367
14.7k
    if (priv != NULL
368
14.7k
        && !ossl_bio_print_labeled_buf(out, "priv:", priv, priv_len))
369
0
        goto err;
370
14.7k
    if (pub != NULL
371
14.7k
        && !ossl_bio_print_labeled_buf(out, "pub:", pub, pub_len))
372
0
        goto err;
373
14.7k
    if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
374
14.7k
        ret = ec_param_to_text(out, group, ossl_ec_key_get_libctx(ec));
375
18.8k
err:
376
18.8k
    OPENSSL_clear_free(priv, priv_len);
377
18.8k
    OPENSSL_free(pub);
378
18.8k
    return ret;
379
14.7k
}
380
#endif
381
382
/* ---------------------------------------------------------------------- */
383
384
#ifndef OPENSSL_NO_ECX
385
static int ecx_to_text(BIO *out, const void *key, int selection)
386
474
{
387
474
    const ECX_KEY *ecx = key;
388
474
    const char *type_label = NULL;
389
390
474
    if (out == NULL || ecx == NULL) {
391
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
392
0
        return 0;
393
0
    }
394
395
474
    switch (ecx->type) {
396
78
    case ECX_KEY_TYPE_X25519:
397
78
        type_label = "X25519";
398
78
        break;
399
113
    case ECX_KEY_TYPE_X448:
400
113
        type_label = "X448";
401
113
        break;
402
72
    case ECX_KEY_TYPE_ED25519:
403
72
        type_label = "ED25519";
404
72
        break;
405
211
    case ECX_KEY_TYPE_ED448:
406
211
        type_label = "ED448";
407
211
        break;
408
474
    }
409
410
474
    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
411
103
        if (ecx->privkey == NULL) {
412
18
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY);
413
18
            return 0;
414
18
        }
415
416
85
        if (BIO_printf(out, "%s Private-Key:\n", type_label) <= 0)
417
0
            return 0;
418
85
        if (!ossl_bio_print_labeled_buf(out, "priv:", ecx->privkey, ecx->keylen))
419
0
            return 0;
420
371
    } else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
421
        /* ecx->pubkey is an array, not a pointer... */
422
302
        if (!ecx->haspubkey) {
423
0
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY);
424
0
            return 0;
425
0
        }
426
427
302
        if (BIO_printf(out, "%s Public-Key:\n", type_label) <= 0)
428
0
            return 0;
429
302
    }
430
431
456
    if (!ossl_bio_print_labeled_buf(out, "pub:", ecx->pubkey, ecx->keylen))
432
0
        return 0;
433
434
456
    return 1;
435
456
}
436
#endif
437
438
/* ---------------------------------------------------------------------- */
439
440
#ifndef OPENSSL_NO_ML_KEM
441
static int ml_kem_to_text(BIO *out, const void *vkey, int selection)
442
151
{
443
151
    return ossl_ml_kem_key_to_text(out, (ML_KEM_KEY *)vkey, selection);
444
151
}
445
#endif
446
447
/* ---------------------------------------------------------------------- */
448
449
#ifndef OPENSSL_NO_SLH_DSA
450
static int slh_dsa_to_text(BIO *out, const void *key, int selection)
451
0
{
452
0
    return ossl_slh_dsa_key_to_text(out, (SLH_DSA_KEY *)key, selection);
453
0
}
454
#endif /* OPENSSL_NO_SLH_DSA */
455
456
static int rsa_to_text(BIO *out, const void *key, int selection)
457
17.8k
{
458
17.8k
    const RSA *rsa = key;
459
17.8k
    const char *type_label = "RSA key";
460
17.8k
    const char *modulus_label = NULL;
461
17.8k
    const char *exponent_label = NULL;
462
17.8k
    const BIGNUM *rsa_d = NULL, *rsa_n = NULL, *rsa_e = NULL;
463
17.8k
    STACK_OF(BIGNUM_const) *factors = NULL;
464
17.8k
    STACK_OF(BIGNUM_const) *exps = NULL;
465
17.8k
    STACK_OF(BIGNUM_const) *coeffs = NULL;
466
17.8k
    int primes;
467
17.8k
    const RSA_PSS_PARAMS_30 *pss_params = ossl_rsa_get0_pss_params_30((RSA *)rsa);
468
17.8k
    int ret = 0;
469
470
17.8k
    if (out == NULL || rsa == NULL) {
471
0
        ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER);
472
0
        goto err;
473
0
    }
474
475
17.8k
    factors = sk_BIGNUM_const_new_null();
476
17.8k
    exps = sk_BIGNUM_const_new_null();
477
17.8k
    coeffs = sk_BIGNUM_const_new_null();
478
479
17.8k
    if (factors == NULL || exps == NULL || coeffs == NULL) {
480
0
        ERR_raise(ERR_LIB_PROV, ERR_R_CRYPTO_LIB);
481
0
        goto err;
482
0
    }
483
484
17.8k
    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
485
4.84k
        type_label = "Private-Key";
486
4.84k
        modulus_label = "modulus:";
487
4.84k
        exponent_label = "publicExponent:";
488
13.0k
    } else if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
489
9.54k
        type_label = "Public-Key";
490
9.54k
        modulus_label = "Modulus:";
491
9.54k
        exponent_label = "Exponent:";
492
9.54k
    }
493
494
17.8k
    RSA_get0_key(rsa, &rsa_n, &rsa_e, &rsa_d);
495
17.8k
    ossl_rsa_get0_all_params((RSA *)rsa, factors, exps, coeffs);
496
17.8k
    primes = sk_BIGNUM_const_num(factors);
497
498
17.8k
    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
499
4.84k
        if (BIO_printf(out, "%s: (%d bit, %d primes)\n",
500
4.84k
                       type_label, BN_num_bits(rsa_n), primes) <= 0)
501
0
            goto err;
502
13.0k
    } else {
503
13.0k
        if (BIO_printf(out, "%s: (%d bit)\n",
504
13.0k
                       type_label, BN_num_bits(rsa_n)) <= 0)
505
0
            goto err;
506
13.0k
    }
507
508
17.8k
    if (!ossl_bio_print_labeled_bignum(out, modulus_label, rsa_n))
509
0
        goto err;
510
17.8k
    if (!ossl_bio_print_labeled_bignum(out, exponent_label, rsa_e))
511
0
        goto err;
512
17.8k
    if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) {
513
4.84k
        int i;
514
515
4.84k
        if (!ossl_bio_print_labeled_bignum(out, "privateExponent:", rsa_d))
516
1.52k
            goto err;
517
3.32k
        if (!ossl_bio_print_labeled_bignum(out, "prime1:",
518
3.32k
                                           sk_BIGNUM_const_value(factors, 0)))
519
0
            goto err;
520
3.32k
        if (!ossl_bio_print_labeled_bignum(out, "prime2:",
521
3.32k
                                           sk_BIGNUM_const_value(factors, 1)))
522
0
            goto err;
523
3.32k
        if (!ossl_bio_print_labeled_bignum(out, "exponent1:",
524
3.32k
                                           sk_BIGNUM_const_value(exps, 0)))
525
0
            goto err;
526
3.32k
        if (!ossl_bio_print_labeled_bignum(out, "exponent2:",
527
3.32k
                                           sk_BIGNUM_const_value(exps, 1)))
528
0
            goto err;
529
3.32k
        if (!ossl_bio_print_labeled_bignum(out, "coefficient:",
530
3.32k
                                           sk_BIGNUM_const_value(coeffs, 0)))
531
0
            goto err;
532
62.3k
        for (i = 2; i < sk_BIGNUM_const_num(factors); i++) {
533
59.0k
            if (BIO_printf(out, "prime%d:", i + 1) <= 0)
534
0
                goto err;
535
59.0k
            if (!ossl_bio_print_labeled_bignum(out, NULL,
536
59.0k
                                               sk_BIGNUM_const_value(factors, i)))
537
0
                goto err;
538
59.0k
            if (BIO_printf(out, "exponent%d:", i + 1) <= 0)
539
0
                goto err;
540
59.0k
            if (!ossl_bio_print_labeled_bignum(out, NULL,
541
59.0k
                                               sk_BIGNUM_const_value(exps, i)))
542
0
                goto err;
543
59.0k
            if (BIO_printf(out, "coefficient%d:", i + 1) <= 0)
544
0
                goto err;
545
59.0k
            if (!ossl_bio_print_labeled_bignum(out, NULL,
546
59.0k
                                               sk_BIGNUM_const_value(coeffs, i - 1)))
547
0
                goto err;
548
59.0k
        }
549
3.32k
    }
550
551
16.3k
    if ((selection & OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS) != 0) {
552
16.3k
        switch (RSA_test_flags(rsa, RSA_FLAG_TYPE_MASK)) {
553
16.1k
        case RSA_FLAG_TYPE_RSA:
554
16.1k
            if (!ossl_rsa_pss_params_30_is_unrestricted(pss_params)) {
555
0
                if (BIO_printf(out, "(INVALID PSS PARAMETERS)\n") <= 0)
556
0
                    goto err;
557
0
            }
558
16.1k
            break;
559
16.1k
        case RSA_FLAG_TYPE_RSASSAPSS:
560
182
            if (ossl_rsa_pss_params_30_is_unrestricted(pss_params)) {
561
41
                if (BIO_printf(out, "No PSS parameter restrictions\n") <= 0)
562
0
                    goto err;
563
141
            } else {
564
141
                int hashalg_nid = ossl_rsa_pss_params_30_hashalg(pss_params);
565
141
                int maskgenalg_nid =
566
141
                    ossl_rsa_pss_params_30_maskgenalg(pss_params);
567
141
                int maskgenhashalg_nid =
568
141
                    ossl_rsa_pss_params_30_maskgenhashalg(pss_params);
569
141
                int saltlen = ossl_rsa_pss_params_30_saltlen(pss_params);
570
141
                int trailerfield =
571
141
                    ossl_rsa_pss_params_30_trailerfield(pss_params);
572
573
141
                if (BIO_printf(out, "PSS parameter restrictions:\n") <= 0)
574
0
                    goto err;
575
141
                if (BIO_printf(out, "  Hash Algorithm: %s%s\n",
576
141
                               ossl_rsa_oaeppss_nid2name(hashalg_nid),
577
141
                               (hashalg_nid == NID_sha1
578
141
                                ? " (default)" : "")) <= 0)
579
0
                    goto err;
580
141
                if (BIO_printf(out, "  Mask Algorithm: %s with %s%s\n",
581
141
                               ossl_rsa_mgf_nid2name(maskgenalg_nid),
582
141
                               ossl_rsa_oaeppss_nid2name(maskgenhashalg_nid),
583
141
                               (maskgenalg_nid == NID_mgf1
584
141
                                && maskgenhashalg_nid == NID_sha1
585
141
                                ? " (default)" : "")) <= 0)
586
0
                    goto err;
587
141
                if (BIO_printf(out, "  Minimum Salt Length: %d%s\n",
588
141
                               saltlen,
589
141
                               (saltlen == 20 ? " (default)" : "")) <= 0)
590
0
                    goto err;
591
141
                if (BIO_printf(out, "  Trailer Field: 0x%x%s\n",
592
141
                               trailerfield,
593
141
                               (trailerfield == 1 ? " (default)" : "")) <= 0)
594
0
                    goto err;
595
141
            }
596
182
            break;
597
16.3k
        }
598
16.3k
    }
599
600
16.3k
    ret = 1;
601
17.8k
 err:
602
17.8k
    sk_BIGNUM_const_free(factors);
603
17.8k
    sk_BIGNUM_const_free(exps);
604
17.8k
    sk_BIGNUM_const_free(coeffs);
605
17.8k
    return ret;
606
16.3k
}
607
608
/* ---------------------------------------------------------------------- */
609
610
#ifndef OPENSSL_NO_ML_DSA
611
static int ml_dsa_to_text(BIO *out, const void *key, int selection)
612
24
{
613
24
    return ossl_ml_dsa_key_to_text(out, (ML_DSA_KEY *)key, selection);
614
24
}
615
#endif /* OPENSSL_NO_ML_DSA */
616
/* ---------------------------------------------------------------------- */
617
618
static void *key2text_newctx(void *provctx)
619
85.1k
{
620
85.1k
    return provctx;
621
85.1k
}
622
623
static void key2text_freectx(ossl_unused void *vctx)
624
85.1k
{
625
85.1k
}
626
627
static int key2text_encode(void *vctx, const void *key, int selection,
628
                           OSSL_CORE_BIO *cout,
629
                           int (*key2text)(BIO *out, const void *key,
630
                                           int selection),
631
                           OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
632
75.3k
{
633
75.3k
    BIO *out = ossl_bio_new_from_core_bio(vctx, cout);
634
75.3k
    int ret;
635
636
75.3k
    if (out == NULL)
637
0
        return 0;
638
639
75.3k
    ret = key2text(out, key, selection);
640
75.3k
    BIO_free(out);
641
642
75.3k
    return ret;
643
75.3k
}
644
645
#define MAKE_TEXT_ENCODER(impl, type)                                   \
646
    static OSSL_FUNC_encoder_import_object_fn                           \
647
    impl##2text_import_object;                                          \
648
    static OSSL_FUNC_encoder_free_object_fn                             \
649
    impl##2text_free_object;                                            \
650
    static OSSL_FUNC_encoder_encode_fn impl##2text_encode;              \
651
                                                                        \
652
    static void *impl##2text_import_object(void *ctx, int selection,    \
653
                                           const OSSL_PARAM params[])   \
654
0
    {                                                                   \
655
0
        return ossl_prov_import_key(ossl_##impl##_keymgmt_functions,    \
656
0
                                    ctx, selection, params);            \
657
0
    }                                                                   \
Unexecuted instantiation: encode_key2text.c:dh2text_import_object
Unexecuted instantiation: encode_key2text.c:dhx2text_import_object
Unexecuted instantiation: encode_key2text.c:dsa2text_import_object
Unexecuted instantiation: encode_key2text.c:ec2text_import_object
Unexecuted instantiation: encode_key2text.c:sm22text_import_object
Unexecuted instantiation: encode_key2text.c:ed255192text_import_object
Unexecuted instantiation: encode_key2text.c:ed4482text_import_object
Unexecuted instantiation: encode_key2text.c:x255192text_import_object
Unexecuted instantiation: encode_key2text.c:x4482text_import_object
Unexecuted instantiation: encode_key2text.c:ml_kem_5122text_import_object
Unexecuted instantiation: encode_key2text.c:ml_kem_7682text_import_object
Unexecuted instantiation: encode_key2text.c:ml_kem_10242text_import_object
Unexecuted instantiation: encode_key2text.c:rsa2text_import_object
Unexecuted instantiation: encode_key2text.c:rsapss2text_import_object
Unexecuted instantiation: encode_key2text.c:ml_dsa_442text_import_object
Unexecuted instantiation: encode_key2text.c:ml_dsa_652text_import_object
Unexecuted instantiation: encode_key2text.c:ml_dsa_872text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_128s2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_128f2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_192s2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_192f2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_256s2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_256f2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_128s2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_128f2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_192s2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_192f2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_256s2text_import_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_256f2text_import_object
658
    static void impl##2text_free_object(void *key)                      \
659
0
    {                                                                   \
660
0
        ossl_prov_free_key(ossl_##impl##_keymgmt_functions, key);       \
661
0
    }                                                                   \
Unexecuted instantiation: encode_key2text.c:dh2text_free_object
Unexecuted instantiation: encode_key2text.c:dhx2text_free_object
Unexecuted instantiation: encode_key2text.c:dsa2text_free_object
Unexecuted instantiation: encode_key2text.c:ec2text_free_object
Unexecuted instantiation: encode_key2text.c:sm22text_free_object
Unexecuted instantiation: encode_key2text.c:ed255192text_free_object
Unexecuted instantiation: encode_key2text.c:ed4482text_free_object
Unexecuted instantiation: encode_key2text.c:x255192text_free_object
Unexecuted instantiation: encode_key2text.c:x4482text_free_object
Unexecuted instantiation: encode_key2text.c:ml_kem_5122text_free_object
Unexecuted instantiation: encode_key2text.c:ml_kem_7682text_free_object
Unexecuted instantiation: encode_key2text.c:ml_kem_10242text_free_object
Unexecuted instantiation: encode_key2text.c:rsa2text_free_object
Unexecuted instantiation: encode_key2text.c:rsapss2text_free_object
Unexecuted instantiation: encode_key2text.c:ml_dsa_442text_free_object
Unexecuted instantiation: encode_key2text.c:ml_dsa_652text_free_object
Unexecuted instantiation: encode_key2text.c:ml_dsa_872text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_128s2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_128f2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_192s2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_192f2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_256s2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_256f2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_128s2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_128f2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_192s2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_192f2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_256s2text_free_object
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_256f2text_free_object
662
    static int impl##2text_encode(void *vctx, OSSL_CORE_BIO *cout,      \
663
                                  const void *key,                      \
664
                                  const OSSL_PARAM key_abstract[],      \
665
                                  int selection,                        \
666
                                  OSSL_PASSPHRASE_CALLBACK *cb,         \
667
                                  void *cbarg)                          \
668
75.3k
    {                                                                   \
669
75.3k
        /* We don't deal with abstract objects */                       \
670
75.3k
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
75.3k
        return key2text_encode(vctx, key, selection, cout,              \
675
75.3k
                               type##_to_text, cb, cbarg);              \
676
75.3k
    }                                                                   \
encode_key2text.c:dh2text_encode
Line
Count
Source
668
7.37k
    {                                                                   \
669
7.37k
        /* We don't deal with abstract objects */                       \
670
7.37k
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
7.37k
        return key2text_encode(vctx, key, selection, cout,              \
675
7.37k
                               type##_to_text, cb, cbarg);              \
676
7.37k
    }                                                                   \
encode_key2text.c:dhx2text_encode
Line
Count
Source
668
20.4k
    {                                                                   \
669
20.4k
        /* We don't deal with abstract objects */                       \
670
20.4k
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
20.4k
        return key2text_encode(vctx, key, selection, cout,              \
675
20.4k
                               type##_to_text, cb, cbarg);              \
676
20.4k
    }                                                                   \
encode_key2text.c:dsa2text_encode
Line
Count
Source
668
10.1k
    {                                                                   \
669
10.1k
        /* We don't deal with abstract objects */                       \
670
10.1k
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
10.1k
        return key2text_encode(vctx, key, selection, cout,              \
675
10.1k
                               type##_to_text, cb, cbarg);              \
676
10.1k
    }                                                                   \
encode_key2text.c:ec2text_encode
Line
Count
Source
668
18.6k
    {                                                                   \
669
18.6k
        /* We don't deal with abstract objects */                       \
670
18.6k
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
18.6k
        return key2text_encode(vctx, key, selection, cout,              \
675
18.6k
                               type##_to_text, cb, cbarg);              \
676
18.6k
    }                                                                   \
encode_key2text.c:sm22text_encode
Line
Count
Source
668
187
    {                                                                   \
669
187
        /* We don't deal with abstract objects */                       \
670
187
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
187
        return key2text_encode(vctx, key, selection, cout,              \
675
187
                               type##_to_text, cb, cbarg);              \
676
187
    }                                                                   \
encode_key2text.c:ed255192text_encode
Line
Count
Source
668
72
    {                                                                   \
669
72
        /* We don't deal with abstract objects */                       \
670
72
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
72
        return key2text_encode(vctx, key, selection, cout,              \
675
72
                               type##_to_text, cb, cbarg);              \
676
72
    }                                                                   \
encode_key2text.c:ed4482text_encode
Line
Count
Source
668
211
    {                                                                   \
669
211
        /* We don't deal with abstract objects */                       \
670
211
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
211
        return key2text_encode(vctx, key, selection, cout,              \
675
211
                               type##_to_text, cb, cbarg);              \
676
211
    }                                                                   \
encode_key2text.c:x255192text_encode
Line
Count
Source
668
78
    {                                                                   \
669
78
        /* We don't deal with abstract objects */                       \
670
78
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
78
        return key2text_encode(vctx, key, selection, cout,              \
675
78
                               type##_to_text, cb, cbarg);              \
676
78
    }                                                                   \
encode_key2text.c:x4482text_encode
Line
Count
Source
668
113
    {                                                                   \
669
113
        /* We don't deal with abstract objects */                       \
670
113
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
113
        return key2text_encode(vctx, key, selection, cout,              \
675
113
                               type##_to_text, cb, cbarg);              \
676
113
    }                                                                   \
encode_key2text.c:ml_kem_5122text_encode
Line
Count
Source
668
111
    {                                                                   \
669
111
        /* We don't deal with abstract objects */                       \
670
111
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
111
        return key2text_encode(vctx, key, selection, cout,              \
675
111
                               type##_to_text, cb, cbarg);              \
676
111
    }                                                                   \
encode_key2text.c:ml_kem_7682text_encode
Line
Count
Source
668
27
    {                                                                   \
669
27
        /* We don't deal with abstract objects */                       \
670
27
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
27
        return key2text_encode(vctx, key, selection, cout,              \
675
27
                               type##_to_text, cb, cbarg);              \
676
27
    }                                                                   \
encode_key2text.c:ml_kem_10242text_encode
Line
Count
Source
668
13
    {                                                                   \
669
13
        /* We don't deal with abstract objects */                       \
670
13
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
13
        return key2text_encode(vctx, key, selection, cout,              \
675
13
                               type##_to_text, cb, cbarg);              \
676
13
    }                                                                   \
encode_key2text.c:rsa2text_encode
Line
Count
Source
668
17.6k
    {                                                                   \
669
17.6k
        /* We don't deal with abstract objects */                       \
670
17.6k
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
17.6k
        return key2text_encode(vctx, key, selection, cout,              \
675
17.6k
                               type##_to_text, cb, cbarg);              \
676
17.6k
    }                                                                   \
encode_key2text.c:rsapss2text_encode
Line
Count
Source
668
194
    {                                                                   \
669
194
        /* We don't deal with abstract objects */                       \
670
194
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
194
        return key2text_encode(vctx, key, selection, cout,              \
675
194
                               type##_to_text, cb, cbarg);              \
676
194
    }                                                                   \
encode_key2text.c:ml_dsa_442text_encode
Line
Count
Source
668
12
    {                                                                   \
669
12
        /* We don't deal with abstract objects */                       \
670
12
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
12
        return key2text_encode(vctx, key, selection, cout,              \
675
12
                               type##_to_text, cb, cbarg);              \
676
12
    }                                                                   \
encode_key2text.c:ml_dsa_652text_encode
Line
Count
Source
668
6
    {                                                                   \
669
6
        /* We don't deal with abstract objects */                       \
670
6
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
6
        return key2text_encode(vctx, key, selection, cout,              \
675
6
                               type##_to_text, cb, cbarg);              \
676
6
    }                                                                   \
encode_key2text.c:ml_dsa_872text_encode
Line
Count
Source
668
6
    {                                                                   \
669
6
        /* We don't deal with abstract objects */                       \
670
6
        if (key_abstract != NULL) {                                     \
671
0
            ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT);     \
672
0
            return 0;                                                   \
673
0
        }                                                               \
674
6
        return key2text_encode(vctx, key, selection, cout,              \
675
6
                               type##_to_text, cb, cbarg);              \
676
6
    }                                                                   \
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_128s2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_128f2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_192s2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_192f2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_256s2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_sha2_256f2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_128s2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_128f2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_192s2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_192f2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_256s2text_encode
Unexecuted instantiation: encode_key2text.c:slh_dsa_shake_256f2text_encode
677
    const OSSL_DISPATCH ossl_##impl##_to_text_encoder_functions[] = {   \
678
        { OSSL_FUNC_ENCODER_NEWCTX,                                     \
679
          (void (*)(void))key2text_newctx },                            \
680
        { OSSL_FUNC_ENCODER_FREECTX,                                    \
681
          (void (*)(void))key2text_freectx },                           \
682
        { OSSL_FUNC_ENCODER_IMPORT_OBJECT,                              \
683
          (void (*)(void))impl##2text_import_object },                  \
684
        { OSSL_FUNC_ENCODER_FREE_OBJECT,                                \
685
          (void (*)(void))impl##2text_free_object },                    \
686
        { OSSL_FUNC_ENCODER_ENCODE,                                     \
687
          (void (*)(void))impl##2text_encode },                         \
688
        OSSL_DISPATCH_END                                               \
689
    }
690
691
#ifndef OPENSSL_NO_DH
692
MAKE_TEXT_ENCODER(dh, dh);
693
MAKE_TEXT_ENCODER(dhx, dh);
694
#endif
695
#ifndef OPENSSL_NO_DSA
696
MAKE_TEXT_ENCODER(dsa, dsa);
697
#endif
698
#ifndef OPENSSL_NO_EC
699
MAKE_TEXT_ENCODER(ec, ec);
700
# ifndef OPENSSL_NO_SM2
701
MAKE_TEXT_ENCODER(sm2, ec);
702
# endif
703
# ifndef OPENSSL_NO_ECX
704
MAKE_TEXT_ENCODER(ed25519, ecx);
705
MAKE_TEXT_ENCODER(ed448, ecx);
706
MAKE_TEXT_ENCODER(x25519, ecx);
707
MAKE_TEXT_ENCODER(x448, ecx);
708
# endif
709
#endif
710
#ifndef OPENSSL_NO_ML_KEM
711
MAKE_TEXT_ENCODER(ml_kem_512, ml_kem);
712
MAKE_TEXT_ENCODER(ml_kem_768, ml_kem);
713
MAKE_TEXT_ENCODER(ml_kem_1024, ml_kem);
714
#endif
715
MAKE_TEXT_ENCODER(rsa, rsa);
716
MAKE_TEXT_ENCODER(rsapss, rsa);
717
718
#ifndef OPENSSL_NO_ML_DSA
719
MAKE_TEXT_ENCODER(ml_dsa_44, ml_dsa);
720
MAKE_TEXT_ENCODER(ml_dsa_65, ml_dsa);
721
MAKE_TEXT_ENCODER(ml_dsa_87, ml_dsa);
722
#endif
723
724
#ifndef OPENSSL_NO_SLH_DSA
725
MAKE_TEXT_ENCODER(slh_dsa_sha2_128s, slh_dsa);
726
MAKE_TEXT_ENCODER(slh_dsa_sha2_128f, slh_dsa);
727
MAKE_TEXT_ENCODER(slh_dsa_sha2_192s, slh_dsa);
728
MAKE_TEXT_ENCODER(slh_dsa_sha2_192f, slh_dsa);
729
MAKE_TEXT_ENCODER(slh_dsa_sha2_256s, slh_dsa);
730
MAKE_TEXT_ENCODER(slh_dsa_sha2_256f, slh_dsa);
731
MAKE_TEXT_ENCODER(slh_dsa_shake_128s, slh_dsa);
732
MAKE_TEXT_ENCODER(slh_dsa_shake_128f, slh_dsa);
733
MAKE_TEXT_ENCODER(slh_dsa_shake_192s, slh_dsa);
734
MAKE_TEXT_ENCODER(slh_dsa_shake_192f, slh_dsa);
735
MAKE_TEXT_ENCODER(slh_dsa_shake_256s, slh_dsa);
736
MAKE_TEXT_ENCODER(slh_dsa_shake_256f, slh_dsa);
737
#endif