2 * Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
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
10 #include <openssl/bn.h>
11 #include <openssl/obj_mac.h>
12 #include "prov/der_rsa.h"
14 /* Well known OIDs precompiled */
16 $OUT = oids_to_c::process_leaves('providers/common/der/RSA.asn1',
17 { dir => $config{sourcedir},
18 filter => \&oids_to_c::filter_to_C });
21 int DER_w_algorithmIdentifier_RSA(WPACKET *pkt, int tag, RSA *rsa)
23 return DER_w_begin_sequence(pkt, tag)
24 /* No parameters (yet?) */
25 && DER_w_precompiled(pkt, -1, der_oid_rsaEncryption,
26 sizeof(der_oid_rsaEncryption))
27 && DER_w_end_sequence(pkt, tag);
30 /* Aliases so we can have a uniform MD_CASE */
31 #define der_oid_sha3_224WithRSAEncryption \
32 der_oid_id_rsassa_pkcs1_v1_5_with_sha3_224
33 #define der_oid_sha3_256WithRSAEncryption \
34 der_oid_id_rsassa_pkcs1_v1_5_with_sha3_256
35 #define der_oid_sha3_384WithRSAEncryption \
36 der_oid_id_rsassa_pkcs1_v1_5_with_sha3_384
37 #define der_oid_sha3_512WithRSAEncryption \
38 der_oid_id_rsassa_pkcs1_v1_5_with_sha3_512
40 #define MD_CASE(name) \
42 precompiled = der_oid_##name##WithRSAEncryption; \
43 precompiled_sz = sizeof(der_oid_##name##WithRSAEncryption); \
46 int DER_w_algorithmIdentifier_RSA_with(WPACKET *pkt, int tag,
49 const unsigned char *precompiled = NULL;
50 size_t precompiled_sz = 0;
58 /* TODO(3.0) Decide what to do about mdc2 and md5_sha1 */
75 return DER_w_begin_sequence(pkt, tag)
76 /* No parameters (yet?) */
77 && DER_w_precompiled(pkt, -1, precompiled, precompiled_sz)
78 && DER_w_end_sequence(pkt, tag);