#ifndef CRYPTO_SM3_TEST_VECTORS_H
#define CRYPTO_SM3_TEST_VECTORS_H

#include <stdint.h>

/*===========================================================================
  Hash SM3 Test Vectors
  Copyright (c) 2022 Qualcomm Technologies, Inc. and/or its subsidiaries.
  All Rights Reserved.
  Confidential and Proprietary - Qualcomm Technologies, Inc.
  ===========================================================================*/

/* This test vector ported from ...\uclib\uctest\offtarget\test_vectors\hash_test_vectors.h */
typedef struct
{
  const uint8_t *msg;
  size_t msg_len;
  const uint8_t *digest;
  size_t digest_len;
} sm3_test_vector_t;

static const uint8_t msg_0[] =
{

};

static const uint8_t msg_2[] =
{
  0xab, 0xab
};

static const uint8_t msg_4[] =
{
  0xab, 0xab, 0xab, 0xab
};

static const uint8_t msg_8[] =
{
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab
};

static const uint8_t msg_16[] =
{
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab
};

static const uint8_t msg_32[] =
{
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab
};

static const uint8_t msg_64[] =
{
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab
};

static const uint8_t msg_128[] =
{
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab
};

static const uint8_t msg_256[] =
{
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
  0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab
};

static const uint8_t sm3_hash_0[] =
{
  0x1a, 0xb2, 0x1d, 0x83, 0x55, 0xcf, 0xa1, 0x7f, 0x8e, 0x61, 0x19, 0x48, 0x31, 0xe8, 0x1a, 0x8f,
  0x22, 0xbe, 0xc8, 0xc7, 0x28, 0xfe, 0xfb, 0x74, 0x7e, 0xd0, 0x35, 0xeb, 0x50, 0x82, 0xaa, 0x2b
};
static const uint8_t sm3_hash_2[] =
{
  0x9c, 0xf0, 0x5d, 0x91, 0xcc, 0xdb, 0xb5, 0x3f, 0x87, 0x65, 0x43, 0xfd, 0x86, 0x67, 0x0c, 0xfd,
  0x22, 0xe0, 0x4a, 0x14, 0x58, 0xbc, 0xf0, 0x94, 0x06, 0xef, 0x06, 0x17, 0xd8, 0xf8, 0xd3, 0x43
};
static const uint8_t sm3_hash_4[] =
{
  0x54, 0xb9, 0xd3, 0xe3, 0x62, 0xd1, 0x9c, 0xc4, 0xb5, 0x5b, 0x6c, 0x26, 0x3c, 0xa7, 0x77, 0xaf,
  0xa4, 0xe6, 0xb9, 0x66, 0xdb, 0x34, 0x9d, 0xed, 0xa3, 0xa8, 0xed, 0x6c, 0x87, 0x25, 0x2b, 0x7c
};
static const uint8_t sm3_hash_8[] =
{
  0xdd, 0x3e, 0x9f, 0x12, 0x13, 0xa3, 0xd7, 0x4f, 0x2e, 0xb3, 0xa2, 0x01, 0x38, 0x5b, 0x72, 0x9e,
  0x5c, 0xa1, 0xa2, 0xbf, 0x68, 0xad, 0xc2, 0x6c, 0xc3, 0x5e, 0x6f, 0xfc, 0x08, 0x44, 0xc9, 0xb9
};
static const uint8_t sm3_hash_16[] =
{
  0x9a, 0x6f, 0x6a, 0x2d, 0x67, 0x51, 0x92, 0x4b, 0xaa, 0x04, 0xf6, 0x28, 0x66, 0xc3, 0xde, 0x58,
  0xe3, 0x9c, 0x37, 0xc4, 0x10, 0x70, 0x31, 0x41, 0x0e, 0xee, 0x61, 0x20, 0xa8, 0xb5, 0x11, 0x1e
};
static const uint8_t sm3_hash_32[] =
{
  0x21, 0xd8, 0x85, 0x8f, 0xbf, 0x71, 0x1c, 0x38, 0xa4, 0x88, 0x00, 0x2f, 0x36, 0x15, 0x43, 0xbf,
  0x9f, 0xa3, 0xaa, 0x0c, 0x78, 0x2d, 0xa9, 0xab, 0x68, 0x79, 0x6b, 0x93, 0x94, 0x1e, 0xda, 0xcb
};
static const uint8_t sm3_hash_64[] =
{
  0x1b, 0xae, 0x4e, 0xb5, 0x0a, 0xea, 0x2d, 0x90, 0x98, 0x9c, 0x6b, 0x78, 0x71, 0xe7, 0xad, 0x91,
  0xd6, 0xd6, 0xa9, 0xb1, 0xe8, 0xbd, 0xc5, 0xfd, 0x39, 0xa1, 0xbd, 0xb0, 0x91, 0x59, 0x85, 0xa6
};
static const uint8_t sm3_hash_128[] =
{
  0x15, 0x29, 0x3e, 0xf5, 0xe0, 0x12, 0xae, 0x43, 0x9a, 0xb5, 0x4c, 0xd0, 0x6d, 0x33, 0x2a, 0x84,
  0x3e, 0xe4, 0x23, 0xe6, 0xe3, 0xbe, 0xf3, 0x63, 0x10, 0xfa, 0x4c, 0x2a, 0xc8, 0x29, 0x31, 0xea
};
static const uint8_t sm3_hash_256[] =
{
  0xa8, 0x28, 0x2d, 0xba, 0x5c, 0x98, 0x84, 0xbc, 0xcf, 0x8c, 0x55, 0x69, 0x67, 0xfa, 0x3a, 0x8c,
  0xed, 0xd8, 0xca, 0xa4, 0x3e, 0x87, 0x72, 0xed, 0x97, 0x80, 0xf2, 0x01, 0xab, 0xa6, 0xf1, 0x7b
};

/* SM3 test vectors array */
static const sm3_test_vector_t sm3_test_vectors[] =
{
  {
    .msg = msg_0,
    .msg_len = sizeof(msg_0),
    .digest = sm3_hash_0,
    .digest_len = sizeof(sm3_hash_0),
  },
  {
    .msg = msg_2,
    .msg_len = sizeof(msg_2),
    .digest = sm3_hash_2,
    .digest_len = sizeof(sm3_hash_2),
  },
  {
    .msg = msg_4,
    .msg_len = sizeof(msg_4),
    .digest = sm3_hash_4,
    .digest_len = sizeof(sm3_hash_4),
  },
  {
    .msg = msg_8,
    .msg_len = sizeof(msg_8),
    .digest = sm3_hash_8,
    .digest_len = sizeof(sm3_hash_8),
  },
  {
    .msg = msg_16,
    .msg_len = sizeof(msg_16),
    .digest = sm3_hash_16,
    .digest_len = sizeof(sm3_hash_16),
  },
  {
    .msg = msg_32,
    .msg_len = sizeof(msg_32),
    .digest = sm3_hash_32,
    .digest_len = sizeof(sm3_hash_32),
  },
  {
    .msg = msg_64,
    .msg_len = sizeof(msg_64),
    .digest = sm3_hash_64,
    .digest_len = sizeof(sm3_hash_64),
  },
  {
    .msg = msg_128,
    .msg_len = sizeof(msg_128),
    .digest = sm3_hash_128,
    .digest_len = sizeof(sm3_hash_128),
  },
  {
    .msg = msg_256,
    .msg_len = sizeof(msg_256),
    .digest = sm3_hash_256,
    .digest_len = sizeof(sm3_hash_256),
  },
};

#endif
 