Add base code to load a SLH_DSA public key.

This loads a SLH_DSA public key from data.
A simple SLH_DSA keymanager imports this key.

Initially this only has a parameter set for
SLH-DSA-SHA2-128s

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25882)
This commit is contained in:
slontis 2024-11-06 14:22:45 +11:00 committed by Tomas Mraz
parent 16395ee9cc
commit 34f4cacc8f
18 changed files with 612 additions and 1 deletions

28
include/crypto/slh_dsa.h Normal file
View file

@ -0,0 +1,28 @@
/*
* Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
/* Internal SLH_DSA functions for other submodules, not for application use */
#ifndef OSSL_CRYPTO_SLH_DSA_H
# define OSSL_CRYPTO_SLH_DSA_H
# pragma once
# include <openssl/e_os2.h>
# include <openssl/types.h>
# include "crypto/types.h"
SLH_DSA_KEY *ossl_slh_dsa_key_new(OSSL_LIB_CTX *libctx, const char *alg);
void ossl_slh_dsa_key_free(SLH_DSA_KEY *key);
int ossl_slh_dsa_key_up_ref(SLH_DSA_KEY *key);
int ossl_slh_dsa_key_equal(const SLH_DSA_KEY *key1, const SLH_DSA_KEY *key2,
int selection);
int ossl_slh_dsa_key_has(const SLH_DSA_KEY *key, int selection);
int ossl_slh_dsa_key_fromdata(SLH_DSA_KEY *key, const OSSL_PARAM *params);
#endif /* OSSL_CRYPTO_SLH_DSA_H */

View file

@ -28,6 +28,9 @@ typedef struct dsa_st DSA;
# ifndef OPENSSL_NO_EC
typedef struct ecx_key_st ECX_KEY;
# endif
# ifndef OPENSSL_NO_SLH_DSA
typedef struct slh_dsa_key_st SLH_DSA_KEY;
# endif
typedef struct prov_skey_st PROV_SKEY;