Path: blob/main/crypto/openssl/providers/common/der/der_slh_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#include <openssl/obj_mac.h>10#include <openssl/objects.h>11#include "internal/packet.h"12#include "prov/der_slh_dsa.h"1314#define CASE_OID(nid, name) \15case nid: \16alg = ossl_der_oid_##name; \17len = sizeof(ossl_der_oid_##name); \18break1920int ossl_DER_w_algorithmIdentifier_SLH_DSA(WPACKET *pkt, int tag, SLH_DSA_KEY *key)21{22const uint8_t *alg;23size_t len;24int nid = ossl_slh_dsa_key_get_type(key);2526switch (nid) {27CASE_OID(NID_SLH_DSA_SHA2_128s, id_slh_dsa_sha2_128s);28CASE_OID(NID_SLH_DSA_SHA2_128f, id_slh_dsa_sha2_128f);29CASE_OID(NID_SLH_DSA_SHA2_192s, id_slh_dsa_sha2_192s);30CASE_OID(NID_SLH_DSA_SHA2_192f, id_slh_dsa_sha2_192f);31CASE_OID(NID_SLH_DSA_SHA2_256s, id_slh_dsa_sha2_256s);32CASE_OID(NID_SLH_DSA_SHA2_256f, id_slh_dsa_sha2_256f);33CASE_OID(NID_SLH_DSA_SHAKE_128s, id_slh_dsa_shake_128s);34CASE_OID(NID_SLH_DSA_SHAKE_128f, id_slh_dsa_shake_128f);35CASE_OID(NID_SLH_DSA_SHAKE_192s, id_slh_dsa_shake_192s);36CASE_OID(NID_SLH_DSA_SHAKE_192f, id_slh_dsa_shake_192f);37CASE_OID(NID_SLH_DSA_SHAKE_256s, id_slh_dsa_shake_256s);38CASE_OID(NID_SLH_DSA_SHAKE_256f, id_slh_dsa_shake_256f);39default:40return 0;41}42return ossl_DER_w_begin_sequence(pkt, tag)43/* No parameters */44&& ossl_DER_w_precompiled(pkt, -1, alg, len)45&& ossl_DER_w_end_sequence(pkt, tag);46}474849