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_ec.h"
14 /* Well known OIDs precompiled */
16 $OUT = oids_to_c::process_leaves('providers/common/der/EC.asn1',
17 { dir => $config{sourcedir},
18 filter => \&oids_to_c::filter_to_C });
21 int DER_w_algorithmIdentifier_EC(WPACKET *pkt, int cont, EC_KEY *ec)
23 return DER_w_begin_sequence(pkt, cont)
24 /* No parameters (yet?) */
25 && DER_w_precompiled(pkt, -1, der_oid_id_ecPublicKey,
26 sizeof(der_oid_id_ecPublicKey))
27 && DER_w_end_sequence(pkt, cont);
30 /* Aliases so we can have a uniform MD_CASE */
31 #define der_oid_id_ecdsa_with_sha1 der_oid_ecdsa_with_SHA1
32 #define der_oid_id_ecdsa_with_sha224 der_oid_ecdsa_with_SHA224
33 #define der_oid_id_ecdsa_with_sha256 der_oid_ecdsa_with_SHA256
34 #define der_oid_id_ecdsa_with_sha384 der_oid_ecdsa_with_SHA384
35 #define der_oid_id_ecdsa_with_sha512 der_oid_ecdsa_with_SHA512
37 #define MD_CASE(name) \
39 precompiled = der_oid_id_ecdsa_with_##name; \
40 precompiled_sz = sizeof(der_oid_id_ecdsa_with_##name); \
43 int DER_w_algorithmIdentifier_ECDSA_with(WPACKET *pkt, int cont,
44 EC_KEY *ec, int mdnid)
46 const unsigned char *precompiled = NULL;
47 size_t precompiled_sz = 0;
63 return DER_w_begin_sequence(pkt, cont)
64 /* No parameters (yet?) */
65 && DER_w_precompiled(pkt, -1, precompiled, precompiled_sz)
66 && DER_w_end_sequence(pkt, cont);