Branch data Line data Source code
1 : : /* 2 : : * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 : : * 4 : : * Licensed under the Apache License, Version 2.0 (the "License"). 5 : : * You may not use this file except in compliance with the License. 6 : : * A copy of the License is located at 7 : : * 8 : : * http://aws.amazon.com/apache2.0 9 : : * 10 : : * or in the "license" file accompanying this file. This file is distributed 11 : : * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 : : * express or implied. See the License for the specific language governing 13 : : * permissions and limitations under the License. 14 : : */ 15 : : 16 : : #pragma once 17 : : 18 : : #include "crypto/s2n_pkey.h" 19 : : #include "utils/s2n_result.h" 20 : : 21 : : #if S2N_LIBCRYPTO_SUPPORTS_MLDSA 22 : : #define S2N_NID_MLDSA44 NID_MLDSA44 23 : : #define S2N_NID_MLDSA65 NID_MLDSA65 24 : : #define S2N_NID_MLDSA87 NID_MLDSA87 25 : : #else 26 : 212 : #define S2N_NID_MLDSA44 NID_undef 27 : 212 : #define S2N_NID_MLDSA65 NID_undef 28 : 212 : #define S2N_NID_MLDSA87 NID_undef 29 : : #endif 30 : : 31 : : /* 32 : : * The draft ML-DSA PKI RFC 33 : : * (https://www.ietf.org/archive/id/draft-ietf-lamps-dilithium-certificates-07.html) 34 : : * includes a very helpful table of constants related to ML-DSA in Appendix B: 35 : : * |=======+=======+=====+========+========+========| 36 : : * | Level | (k,l) | eta | Sig. | Public | Private| 37 : : * | | | | (B) | Key(B) | Key(B) | 38 : : * |=======+=======+=====+========+========+========| 39 : : * | 2 | (4,4) | 2 | 2420 | 1312 | 32 | 40 : : * | 3 | (6,5) | 4 | 3309 | 1952 | 32 | 41 : : * | 5 | (8,7) | 2 | 4627 | 2592 | 32 | 42 : : * |=======+=======+=====+========+========+========| 43 : : */ 44 : : #define S2N_MLDSA_MAX_PUB_KEY_SIZE 2592 45 : : 46 : : bool s2n_mldsa_is_supported(); 47 : : S2N_RESULT s2n_mldsa_init_mu_hash(struct s2n_hash_state *state, const struct s2n_pkey *pub_key);