text: /* Nettle module definition
   *
   * Copyright (C) 2018 - 2021, Stephan Mueller <smueller@chronox.de>
   *
   * License: see LICENSE file in root directory
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
   * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
   * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
   * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
   * DAMAGE.
   */
  
  #include "definition.h"
  #include "definition_impl_common.h"
  
  /**************************************************************************
   * SP800-56C rev 1 Onestep KDF
   **************************************************************************/
  static const struct def_algo_prereqs tests_kdf_onestep_prereqs[] = {
  	{
  		.algorithm = "SHA",
  		.valvalue = "same"
  	},
  	{
  		.algorithm = "HMAC",
  		.valvalue = "same"
  	},
  	{
  		.algorithm = "DRBG",
  		.valvalue = "same"
  	},
  };
  
  const struct def_algo_kas_kdf_onestepkdf_aux tests_kas_kdf_onestepkdf_aux[] = { {
  	.auxfunc = ACVP_HMACSHA2_256,
  	.mac_salt_method = DEF_ALG_KAS_KDF_MAC_SALT_DEFAULT |
  			   DEF_ALG_KAS_KDF_MAC_SALT_RANDOM
  }, {
  	.auxfunc = ACVP_SHA256,
  	.mac_salt_method = DEF_ALG_KAS_KDF_MAC_SALT_RANDOM
  } };
  
  
  #define TESTS_KAS_KDF_ONESTEP						\
  	{								\
  	.type = DEF_ALG_TYPE_KDF_ONESTEP,				\
  	.algo.kdf_onestep = {						\
  		DEF_PREREQS(tests_kdf_onestep_prereqs),			\
  		.onestep = 	{					\
  			.aux_function = tests_kas_kdf_onestepkdf_aux,	\
  			.aux_function_num = ARRAY_SIZE(tests_kas_kdf_onestepkdf_aux),\
  			.fixed_info_pattern_type = {			\
  				DEF_ALG_KAS_KDF_FI_PATTERN_U_PARTY_INFO,\
  				DEF_ALG_KAS_KDF_FI_PATTERN_V_PARTY_INFO,\
  				DEF_ALG_KAS_KDF_FI_PATTERN_LITERAL	\
  				},					\
  			.literal = "affedeadbeef",			\
  			.fixed_info_encoding = DEF_ALG_KAS_KDF_FI_ENCODING_CONCATENATION,\
  			},						\
  		.length = 1024,						\
  		DEF_ALG_DOMAIN(.zlen, 256, 512, 128),			\
  		}							\
  	}
  
  /**************************************************************************
   * Implementation Definitions
   **************************************************************************/
  static const struct def_algo tests[] = {
  	TESTS_KAS_KDF_ONESTEP
  };
  
  /**************************************************************************
   * Register operation
   **************************************************************************/
  static struct def_algo_map tests_algo_map [] = {
  	{
  		SET_IMPLEMENTATION(tests),
  		.algo_name = "Tests",
  		.processor = "",
  		.impl_name = "Onestep"
  	}
  };
  
  ACVP_DEFINE_CONSTRUCTOR(tests_register)
  static void tests_register(void)
  {
  	acvp_register_algo_map(tests_algo_map, ARRAY_SIZE(tests_algo_map));
  }
  
  ACVP_EXTENSION(tests_algo_map)
  