Path: blob/main/crypto/openssl/providers/common/der/der_sm2_sig.c
48383 views
/*1* Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.2*3* Licensed under the Apache License 2.0 (the "License"). You may not use4* this file except in compliance with the License. You can obtain a copy5* in the file LICENSE in the source distribution or at6* https://www.openssl.org/source/license.html7*/89#include <openssl/obj_mac.h>10#include "internal/packet.h"11#include "prov/der_sm2.h"1213/* Aliases so we can have a uniform MD_CASE */14#define ossl_der_oid_id_sm2_with_sm3 ossl_der_oid_sm2_with_SM31516#define MD_CASE(name) \17case NID_##name: \18precompiled = ossl_der_oid_id_sm2_with_##name; \19precompiled_sz = sizeof(ossl_der_oid_id_sm2_with_##name); \20break;2122int ossl_DER_w_algorithmIdentifier_SM2_with_MD(WPACKET *pkt, int cont,23EC_KEY *ec, int mdnid)24{25const unsigned char *precompiled = NULL;26size_t precompiled_sz = 0;2728switch (mdnid) {29MD_CASE(sm3);30default:31return 0;32}3334return ossl_DER_w_begin_sequence(pkt, cont)35/* No parameters (yet?) */36&& ossl_DER_w_precompiled(pkt, -1, precompiled, precompiled_sz)37&& ossl_DER_w_end_sequence(pkt, cont);38}394041