Path: blob/main/crypto/openssl/providers/common/der/der_dsa_sig.c
48383 views
/*1* Copyright 2020 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/*10* DSA low level APIs are deprecated for public use, but still ok for11* internal use.12*/13#include "internal/deprecated.h"1415#include <openssl/obj_mac.h>16#include "internal/packet.h"17#include "prov/der_dsa.h"1819#define MD_CASE(name) \20case NID_##name: \21precompiled = ossl_der_oid_id_dsa_with_##name; \22precompiled_sz = sizeof(ossl_der_oid_id_dsa_with_##name); \23break;2425int ossl_DER_w_algorithmIdentifier_DSA_with_MD(WPACKET *pkt, int tag,26DSA *dsa, int mdnid)27{28const unsigned char *precompiled = NULL;29size_t precompiled_sz = 0;3031switch (mdnid) {32MD_CASE(sha1);33MD_CASE(sha224);34MD_CASE(sha256);35MD_CASE(sha384);36MD_CASE(sha512);37MD_CASE(sha3_224);38MD_CASE(sha3_256);39MD_CASE(sha3_384);40MD_CASE(sha3_512);41default:42return 0;43}4445return ossl_DER_w_begin_sequence(pkt, tag)46/* No parameters (yet?) */47&& ossl_DER_w_precompiled(pkt, -1, precompiled, precompiled_sz)48&& ossl_DER_w_end_sequence(pkt, tag);49}505152