Path: blob/main/crypto/openssl/providers/common/der/der_ml_dsa_key.c
48383 views
/*1* Copyright 2025 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 "internal/packet.h"16#include "prov/der_ml_dsa.h"1718int ossl_DER_w_algorithmIdentifier_ML_DSA(WPACKET *pkt, int tag, ML_DSA_KEY *key)19{20const uint8_t *alg;21size_t len;22const char *name = ossl_ml_dsa_key_get_name(key);2324if (OPENSSL_strcasecmp(name, "ML-DSA-44") == 0) {25alg = ossl_der_oid_id_ml_dsa_44;26len = sizeof(ossl_der_oid_id_ml_dsa_44);27} else if (OPENSSL_strcasecmp(name, "ML-DSA-65") == 0) {28alg = ossl_der_oid_id_ml_dsa_65;29len = sizeof(ossl_der_oid_id_ml_dsa_65);30} else if (OPENSSL_strcasecmp(name, "ML-DSA-87") == 0) {31alg = ossl_der_oid_id_ml_dsa_87;32len = sizeof(ossl_der_oid_id_ml_dsa_87);33} else {34return 0;35}36return ossl_DER_w_begin_sequence(pkt, tag)37/* No parameters */38&& ossl_DER_w_precompiled(pkt, -1, alg, len)39&& ossl_DER_w_end_sequence(pkt, tag);40}414243