PROV: Re-implement all the keypair decoders
[openssl.git] / providers / decoders.inc
1 /*
2  * Copyright 2020 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 #ifndef DECODER_PROVIDER
11 # error Macro DECODER_PROVIDER undefined
12 #endif
13
14 #define DECODER_STRUCTURE_type_specific_keypair         "type-specific"
15 #define DECODER_STRUCTURE_type_specific_params          "type-specific"
16 #define DECODER_STRUCTURE_type_specific                 "type-specific"
17 #define DECODER_STRUCTURE_type_specific_no_pub          "type-specific"
18 #define DECODER_STRUCTURE_PKCS8                         "pkcs8"
19 #define DECODER_STRUCTURE_SubjectPublicKeyInfo          "SubjectPublicKeyInfo"
20 #define DECODER_STRUCTURE_DH                            "dh"
21 #define DECODER_STRUCTURE_DHX                           "dhx"
22 #define DECODER_STRUCTURE_DSA                           "dsa"
23 #define DECODER_STRUCTURE_EC                            "ec"
24 #define DECODER_STRUCTURE_RSA                           "rsa"
25
26 /* Arguments are prefixed with '_' to avoid build breaks on certain platforms */
27 #define DECODER(_name, _input, _output, _fips)                          \
28     { _name,                                                            \
29       "provider=" DECODER_PROVIDER ",fips=" #_fips ",input=" #_input,   \
30       (ossl_##_input##_to_##_output##_decoder_functions) }
31 #define DECODER_w_structure(_name, _input, _structure, _output, _fips)  \
32     { _name,                                                            \
33       "provider=" DECODER_PROVIDER ",fips=" #_fips ",input=" #_input    \
34       ",structure=" DECODER_STRUCTURE_##_structure,                     \
35       (ossl_##_structure##_##_input##_to_##_output##_decoder_functions) }
36
37 #ifndef OPENSSL_NO_DH
38 DECODER_w_structure("DH", der, PKCS8, dh, yes),
39 DECODER_w_structure("DH", der, SubjectPublicKeyInfo, dh, yes),
40 DECODER_w_structure("DH", der, type_specific_params, dh, yes),
41 DECODER_w_structure("DH", der, DH, dh, yes),
42 DECODER_w_structure("DHX", der, PKCS8, dhx, yes),
43 DECODER_w_structure("DHX", der, SubjectPublicKeyInfo, dhx, yes),
44 DECODER_w_structure("DHX", der, type_specific_params, dhx, yes),
45 DECODER_w_structure("DHX", der, DHX, dhx, yes),
46 #endif
47 #ifndef OPENSSL_NO_DSA
48 DECODER_w_structure("DSA", der, PKCS8, dsa, yes),
49 DECODER_w_structure("DSA", der, SubjectPublicKeyInfo, dsa, yes),
50 DECODER_w_structure("DSA", der, type_specific, dsa, yes),
51 DECODER_w_structure("DSA", der, DSA, dsa, yes),
52 DECODER("DSA", msblob, dsa, yes),
53 # ifndef OPENSSL_NO_RC4
54 DECODER("DSA", pvk, dsa, yes),
55 # endif
56 #endif
57 #ifndef OPENSSL_NO_EC
58 DECODER_w_structure("EC", der, PKCS8, ec, yes),
59 DECODER_w_structure("EC", der, SubjectPublicKeyInfo, ec, yes),
60 DECODER_w_structure("EC", der, type_specific_no_pub, ec, yes),
61 DECODER_w_structure("EC", der, EC, ec, yes),
62 DECODER_w_structure("ED25519", der, PKCS8, ed25519, yes),
63 DECODER_w_structure("ED25519", der, SubjectPublicKeyInfo, ed25519, yes),
64 DECODER_w_structure("ED448", der, PKCS8, ed448, yes),
65 DECODER_w_structure("ED448", der, SubjectPublicKeyInfo, ed448, yes),
66 DECODER_w_structure("X25519", der, PKCS8, x25519, yes),
67 DECODER_w_structure("X25519", der, SubjectPublicKeyInfo, x25519, yes),
68 DECODER_w_structure("X448", der, PKCS8, x448, yes),
69 DECODER_w_structure("X448", der, SubjectPublicKeyInfo, x448, yes),
70 #endif
71 DECODER_w_structure("RSA", der, PKCS8, rsa, yes),
72 DECODER_w_structure("RSA", der, SubjectPublicKeyInfo, rsa, yes),
73 DECODER_w_structure("RSA", der, type_specific_keypair, rsa, yes),
74 DECODER_w_structure("RSA", der, RSA, rsa, yes),
75 DECODER_w_structure("RSA-PSS", der, PKCS8, rsapss, yes),
76 DECODER_w_structure("RSA-PSS", der, SubjectPublicKeyInfo, rsapss, yes),
77 #ifndef OPENSSL_NO_DSA
78 DECODER("RSA", msblob, rsa, yes),
79 # ifndef OPENSSL_NO_RC4
80 DECODER("RSA", pvk, rsa, yes),
81 # endif
82 #endif
83
84 DECODER("DER", pem, der, yes),