<commit_before>/* Copyright 2018 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <pinweaver.h>

#include <dcrypto.h>
#include <nvmem_vars.h>
#include <sha256.h>
#include <stdint.h>
#include <string.h>
#include <timer.h>
#include <util.h>
#include <pinweaver_types.h>

#include "test_util.h"

struct pw_test_data_t {
	union {
		struct pw_request_t request;
		struct pw_response_t response;
		/* Reserve space for the variable length fields. */
		uint8_t tpm_buffer_size[PW_MAX_MESSAGE_SIZE];
	};
};

/******************************************************************************/
/* Test data
 */
const int EMPTY_TREE_PATH_LENGTH = 18;
const struct merkle_tree_t EMPTY_TREE = {
		{2} /* bits_per_level */,
		{6} /* height */,
		/* root */
		{0x81, 0xaa, 0xe9, 0xde, 0x93, 0xf4, 0xdf, 0x88,
		 0x18, 0xfa, 0xff, 0xbd, 0xb7, 0x09, 0xc0, 0x86,
		 0x48, 0xdd, 0xcd, 0x35, 0x00, 0xf2, 0x88, 0xd6,
		 0x3f, 0xa6, 0x5e, 0x80, 0x10, 0x19, 0x41, 0x17},
		 /* key derivation nonce. */
		{0x75, 0xf8, 0x43, 0xf7, 0x23, 0xbd, 0x2a, 0x0f,
		 0x8d, 0x34, 0xbf, 0xa6, 0x6d, 0xf9, 0x44, 0x38},
		/* hmac_key */
		{0x96, 0xc6, 0xb1, 0x64, 0xb6, 0xa7, 0xa8, 0x01,
		 0xd5, 0x1d, 0x8e, 0x97, 0x24, 0x86, 0xf8, 0x6f,
		 0xd4, 0x84, 0x0f, 0x95, 0x52, 0x93, 0x8d, 0x7d,
		 0x00, 0xbb, 0xba, 0xc8, 0xed, 0x7f, 0xa4, 0x7a},
		/* wrap_key */
		{0x95, 0xc9, 0x0a, 0xd4, 0xb3, 0x61, 0x1b, 0xcf,
		 0x1b, 0x49, 0x2b, 0xd6, 0x5d, 0xbc, 0x80, 0xa9,
		 0xf4, 0x83, 0xf2, 0x84, 0xd4, 0x04, 0x57, 0x7f,
		 0x02, 0xae, 0x37, 0x64, 0xae, 0xda, 0x71, 0x2a},
};

const struct leaf_data_t DEFAULT_LEAF = {
	/*pub*/
	{<commit_msg>test/pinweaver: Fix clang compilation error<commit_after>/* Copyright 2018 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <pinweaver.h>

#include <dcrypto.h>
#include <nvmem_vars.h>
#include <sha256.h>
#include <stdint.h>
#include <string.h>
#include <timer.h>
#include <util.h>
#include <pinweaver_types.h>

#include "test_util.h"

struct pw_test_data_t {
	union {
		struct pw_request_t request;
		struct pw_response_t response;
		/* Reserve space for the variable length fields. */
		uint8_t tpm_buffer_size[PW_MAX_MESSAGE_SIZE];
	};
} PW_ALIGN_TO_WRD;

/******************************************************************************/
/* Test data
 */
const int EMPTY_TREE_PATH_LENGTH = 18;
const struct merkle_tree_t EMPTY_TREE = {
		{2} /* bits_per_level */,
		{6} /* height */,
		/* root */
		{0x81, 0xaa, 0xe9, 0xde, 0x93, 0xf4, 0xdf, 0x88,
		 0x18, 0xfa, 0xff, 0xbd, 0xb7, 0x09, 0xc0, 0x86,
		 0x48, 0xdd, 0xcd, 0x35, 0x00, 0xf2, 0x88, 0xd6,
		 0x3f, 0xa6, 0x5e, 0x80, 0x10, 0x19, 0x41, 0x17},
		 /* key derivation nonce. */
		{0x75, 0xf8, 0x43, 0xf7, 0x23, 0xbd, 0x2a, 0x0f,
		 0x8d, 0x34, 0xbf, 0xa6, 0x6d, 0xf9, 0x44, 0x38},
		/* hmac_key */
		{0x96, 0xc6, 0xb1, 0x64, 0xb6, 0xa7, 0xa8, 0x01,
		 0xd5, 0x1d, 0x8e, 0x97, 0x24, 0x86, 0xf8, 0x6f,
		 0xd4, 0x84, 0x0f, 0x95, 0x52, 0x93, 0x8d, 0x7d,
		 0x00, 0xbb, 0xba, 0xc8, 0xed, 0x7f, 0xa4, 0x7a},
		/* wrap_key */
		{0x95, 0xc9, 0x0a, 0xd4, 0xb3, 0x61, 0x1b, 0xcf,
		 0x1b, 0x49, 0x2b, 0xd6, 0x5d, 0xbc, 0x80, 0xa9,
		 0xf4, 0x83, 0xf2, 0x84, 0xd4, 0x04, 0x57, 0x7f,
		 0x02, 0xae, 0x37, 0x64, 0xae, 0xda, 0x71, 0x2a},
};

const struct leaf_data_t DEFAULT_LEAF = {
	/*pub*/
	{
{'fraction_non_alphanumeric': 0.1838150289017341, 'fraction_numerical': 0.15144508670520232, 'mean_word_length': 3.965566714490674, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1306816', 'n_tokens_mistral': 2079, 'n_tokens_neox': 1684, 'n_words': 413}