/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2017-2020, Regents of the University of California.
 *
 * This file is part of ndncert, a certificate management system based on NDN.
 *
 * ndncert is free software: you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * ndncert is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received copies of the GNU General Public License along with
 * ndncert, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 *
 * See AUTHORS.md for complete list of ndncert authors and contributors.
 */

#include "detail/crypto-helpers.hpp"
#include "test-common.hpp"

namespace ndn {
namespace ndncert {
namespace tests {

BOOST_AUTO_TEST_SUITE(TestCryptoHelpers)

BOOST_AUTO_TEST_CASE(EcdhWithRawKey)
{
  ECDHState aliceState;
  auto alicePub = aliceState.getSelfPubKey();
  BOOST_CHECK(!alicePub.empty());

  ECDHState bobState;
  auto bobPub = bobState.getSelfPubKey();
  BOOST_CHECK(!bobPub.empty());

  auto aliceResult = aliceState.deriveSecret(bobPub);
  BOOST_CHECK(!aliceResult.empty());
  auto bobResult = bobState.deriveSecret(alicePub);
  BOOST_CHECK(!bobResult.empty());
  BOOST_CHECK_EQUAL_COLLECTIONS(aliceResult.begin(), aliceResult.end(), bobResult.begin(), bobResult.end());
}

BOOST_AUTO_TEST_CASE(EcdhWithRawKeyWrongInput)
{
  ECDHState aliceState;
  auto alicePub = aliceState.getSelfPubKey();
  BOOST_CHECK(!alicePub.empty());
  std::vector<uint8_t> fakePub(10, 0x0b);
  BOOST_CHECK_THROW(aliceState.deriveSecret(fakePub), std::runtime_error);
}

BOOST_AUTO_TEST_CASE(HmacSha256)
{
  const uint8_t input[] = {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
                           0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
                           0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b};
  const uint8_t key[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
                          0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c};
  const uint8_t expected[] = {0x07, 0x77, 0x09, 0x36, 0x2c, 0x2e, 0x32, 0xdf,
                              0x0d, 0xdc, 0x3f, 0x0d, 0xc4, 0x7b, 0xba, 0x63,
                              0x90, 0xb6, 0xc7, 0x3b, 0xb5, 0x0f, 0x9c, 0x31,
                              0x22, 0xec, 0x84, 0x4a, 0xd7, 0xc2, 0xb3, 0xe5};
  uint8_t result[32];
  hmacSha256(input, sizeof(input), key, sizeof(key), result);
  BOOST_CHECK_EQUAL_COLLECTIONS(result, result + sizeof(result), expected,
                                expected + sizeof(expected));
}

BOOST_AUTO_TEST_CASE(Hkdf1)
{
  // RFC5869 appendix A.1
  const uint8_t ikm[] = {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
                         0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
                         0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b};
  const uint8_t salt[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
                          0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c};
  const uint8_t info[] = {0xf0, 0xf1, 0xf2, 0xf3, 0xf4,
                          0xf5, 0xf6, 0xf7, 0xf8, 0xf9};
  const uint8_t expected[] = {
      0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a, 0x90, 0x43, 0x4f,
      0x64, 0xd0, 0x36, 0x2f, 0x2a, 0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a,
      0x5a, 0x4c, 0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf, 0x34,
      0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18, 0x58, 0x65};
  uint8_t result[42];
  auto resultLen = hkdf(ikm, sizeof(ikm), salt, sizeof(salt), result,
                        sizeof(result), info, sizeof(info));

  BOOST_CHECK_EQUAL(resultLen, sizeof(result));
  BOOST_CHECK_EQUAL_COLLECTIONS(result, result + sizeof(result), expected,
                                expected + sizeof(expected));
}

BOOST_AUTO_TEST_CASE(Hkdf2)
{
  // RFC5869 appendix A.2
  const uint8_t ikm[] = {
      0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
      0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
      0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
      0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
      0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
      0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f};
  const uint8_t salt[] = {
      0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
      0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
      0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83,
      0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
      0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b,
      0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
      0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf};
  const uint8_t info[] = {
      0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb,
      0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
      0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3,
      0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
      0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
      0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
      0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff};
  const uint8_t expected[] = {
      0xb1, 0x1e, 0x39, 0x8d, 0xc8, 0x03, 0x27, 0xa1, 0xc8, 0xe7, 0xf7, 0x8c,
      0x59, 0x6a, 0x49, 0x34, 0x4f, 0x01, 0x2e, 0xda, 0x2d, 0x4e, 0xfa, 0xd8,
      0xa0, 0x50, 0xcc, 0x4c, 0x19, 0xaf, 0xa9, 0x7c, 0x59, 0x04, 0x5a, 0x99,
      0xca, 0xc7, 0x82, 0x72, 0x71, 0xcb, 0x41, 0xc6, 0x5e, 0x59, 0x0e, 0x09,
      0xda, 0x32, 0x75, 0x60, 0x0c, 0x2f, 0x09, 0xb8, 0x36, 0x77, 0x93, 0xa9,
      0xac, 0xa3, 0xdb, 0x71, 0xcc, 0x30, 0xc5, 0x81, 0x79, 0xec, 0x3e, 0x87,
      0xc1, 0x4c, 0x01, 0xd5, 0xc1, 0xf3, 0x43, 0x4f, 0x1d, 0x87};

  uint8_t result[82];
  auto resultLen = hkdf(ikm, sizeof(ikm), salt, sizeof(salt), result,
                        sizeof(result), info, sizeof(info));

  BOOST_CHECK_EQUAL(resultLen, sizeof(result));
  BOOST_CHECK_EQUAL_COLLECTIONS(result, result + sizeof(result), expected,
                                expected + sizeof(expected));
}

BOOST_AUTO_TEST_CASE(Hkdf3)
{
  // RFC5869 appendix A.3
  const uint8_t ikm[] = {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
                         0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
                         0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b};
  const uint8_t expected[] = {
      0x8d, 0xa4, 0xe7, 0x75, 0xa5, 0x63, 0xc1, 0x8f, 0x71, 0x5f, 0x80,
      0x2a, 0x06, 0x3c, 0x5a, 0x31, 0xb8, 0xa1, 0x1f, 0x5c, 0x5e, 0xe1,
      0x87, 0x9e, 0xc3, 0x45, 0x4e, 0x5f, 0x3c, 0x73, 0x8d, 0x2d, 0x9d,
      0x20, 0x13, 0x95, 0xfa, 0xa4, 0xb6, 0x1a, 0x96, 0xc8};
  uint8_t result[42];

  auto resultLen = hkdf(ikm, sizeof(ikm), nullptr, 0, result,
                        sizeof(result), nullptr, 0);

  BOOST_CHECK_EQUAL(resultLen, sizeof(result));
  BOOST_CHECK_EQUAL_COLLECTIONS(result, result + sizeof(result), expected,
                                expected + sizeof(expected));
}

BOOST_AUTO_TEST_CASE(AesGcm1)
{
  // Test case from NIST Cryptographic Algorithm Validation Program
  // https://csrc.nist.gov/Projects/cryptographic-algorithm-validation-program/CAVP-TESTING-BLOCK-CIPHER-MODES
  // Count = 0
  // Key = cf063a34d4a9a76c2c86787d3f96db71
  // IV = 113b9785971864c83b01c787
  // CT =
  // AAD =
  // Tag = 72ac8493e3a5228b5d130a69d2510e42
  // PT =
  const uint8_t key[] = {0xcf, 0x06, 0x3a, 0x34, 0xd4, 0xa9, 0xa7, 0x6c,
                         0x2c, 0x86, 0x78, 0x7d, 0x3f, 0x96, 0xdb, 0x71};
  const uint8_t iv[] = {0x11, 0x3b, 0x97, 0x85, 0x97, 0x18,
                        0x64, 0xc8, 0x3b, 0x01, 0xc7, 0x87};
  const uint8_t expected_tag[] = {0x72, 0xac, 0x84, 0x93, 0xe3, 0xa5,
                                  0x22, 0x8b, 0x5d, 0x13, 0x0a, 0x69,
                                  0xd2, 0x51, 0x0e, 0x42};

  uint8_t ciphertext[256] = {0};
  uint8_t tag[16] = {0};
  const uint8_t empty_buffer[1] = {0};
  int size = aesGcm128Encrypt(empty_buffer, 0, empty_buffer, 0, key, iv, ciphertext, tag);
  BOOST_CHECK(size == 0);
  BOOST_CHECK_EQUAL_COLLECTIONS(tag, tag + 16, expected_tag, expected_tag + sizeof(expected_tag));

  uint8_t decrypted[256] = {0};
  size = aesGcm128Decrypt(ciphertext, size, empty_buffer, 0, tag, key, iv, decrypted);
  BOOST_CHECK(size == 0);
}

BOOST_AUTO_TEST_CASE(AesGcm2)
{
  // Test case from NIST Cryptographic Algorithm Validation Program
  // https://csrc.nist.gov/Projects/cryptographic-algorithm-validation-program/CAVP-TESTING-BLOCK-CIPHER-MODES
  // Count = 1
  // Key = 2370e320d4344208e0ff5683f243b213
  // IV = 04dbb82f044d30831c441228
  // CT =
  // AAD = d43a8e5089eea0d026c03a85178b27da
  // Tag = 2a049c049d25aa95969b451d93c31c6e
  // PT =
  const uint8_t key[] = {0x23, 0x70, 0xe3, 0x20, 0xd4, 0x34, 0x42, 0x08,
                         0xe0, 0xff, 0x56, 0x83, 0xf2, 0x43, 0xb2, 0x13};
  const uint8_t iv[] = {0x04, 0xdb, 0xb8, 0x2f, 0x04, 0x4d,
                        0x30, 0x83, 0x1c, 0x44, 0x12, 0x28};
  const uint8_t aad[] = {0xd4, 0x3a, 0x8e, 0x50, 0x89, 0xee, 0xa0, 0xd0,
                         0x26, 0xc0, 0x3a, 0x85, 0x17, 0x8b, 0x27, 0xda};
  const uint8_t expected_tag[] = {0x2a, 0x04, 0x9c, 0x04, 0x9d, 0x25,
                                  0xaa, 0x95, 0x96, 0x9b, 0x45, 0x1d,
                                  0x93, 0xc3, 0x1c, 0x6e};

  uint8_t ciphertext[256] = {0};
  uint8_t tag[16] = {0};
  const uint8_t empty_buffer[1] = {0};
  int size = aesGcm128Encrypt(empty_buffer, 0, aad, sizeof(aad), key, iv, ciphertext, tag);
  BOOST_CHECK(size == 0);
  BOOST_CHECK_EQUAL_COLLECTIONS(tag, tag + 16, expected_tag, expected_tag + sizeof(expected_tag));

  uint8_t decrypted[256] = {0};
  size = aesGcm128Decrypt(ciphertext, size, aad, sizeof(aad), tag, key, iv, decrypted);
  BOOST_CHECK(size == 0);
}

BOOST_AUTO_TEST_CASE(AesGcm3)
{
  // Test case from NIST Cryptographic Algorithm Validation Program
  // https://csrc.nist.gov/Projects/cryptographic-algorithm-validation-program/CAVP-TESTING-BLOCK-CIPHER-MODES
  // Count = 0
  // Key = bc22f3f05cc40db9311e4192966fee92
  // IV = 134988e662343c06d3ab83db
  // CT = 4c0168ab95d3a10ef25e5924108389365c67d97778995892d9fd46897384af61fc559212b3267e90fe4df7bfd1fbed46f4b9ee
  // AAD = 10087e6ed81049b509c31d12fee88c64
  // Tag = 771357958a316f166bd0dacc98ea801a
  // PT = 337c1bc992386cf0f957617fe4d5ec1218ae1cc40369305518eb177e9b15c1646b142ff71237efaa58790080cd82e8848b295c
  const uint8_t key[] = {0xbc, 0x22, 0xf3, 0xf0, 0x5c, 0xc4, 0x0d, 0xb9,
                         0x31, 0x1e, 0x41, 0x92, 0x96, 0x6f, 0xee, 0x92};
  const uint8_t iv[] = {0x13, 0x49, 0x88, 0xe6, 0x62, 0x34,
                        0x3c, 0x06, 0xd3, 0xab, 0x83, 0xdb};
  const uint8_t aad[] = {0x10, 0x08, 0x7e, 0x6e, 0xd8, 0x10, 0x49, 0xb5,
                         0x09, 0xc3, 0x1d, 0x12, 0xfe, 0xe8, 0x8c, 0x64};
  const uint8_t expected_ciphertext[] = {
      0x4c, 0x01, 0x68, 0xab, 0x95, 0xd3, 0xa1, 0x0e, 0xf2, 0x5e, 0x59,
      0x24, 0x10, 0x83, 0x89, 0x36, 0x5c, 0x67, 0xd9, 0x77, 0x78, 0x99,
      0x58, 0x92, 0xd9, 0xfd, 0x46, 0x89, 0x73, 0x84, 0xaf, 0x61, 0xfc,
      0x55, 0x92, 0x12, 0xb3, 0x26, 0x7e, 0x90, 0xfe, 0x4d, 0xf7, 0xbf,
      0xd1, 0xfb, 0xed, 0x46, 0xf4, 0xb9, 0xee};
  const uint8_t expected_tag[] = {0x77, 0x13, 0x57, 0x95, 0x8a, 0x31,
                                  0x6f, 0x16, 0x6b, 0xd0, 0xda, 0xcc,
                                  0x98, 0xea, 0x80, 0x1a};
  const uint8_t plaintext[] = {
      0x33, 0x7c, 0x1b, 0xc9, 0x92, 0x38, 0x6c, 0xf0, 0xf9, 0x57, 0x61,
      0x7f, 0xe4, 0xd5, 0xec, 0x12, 0x18, 0xae, 0x1c, 0xc4, 0x03, 0x69,
      0x30, 0x55, 0x18, 0xeb, 0x17, 0x7e, 0x9b, 0x15, 0xc1, 0x64, 0x6b,
      0x14, 0x2f, 0xf7, 0x12, 0x37, 0xef, 0xaa, 0x58, 0x79, 0x00, 0x80,
      0xcd, 0x82, 0xe8, 0x84, 0x8b, 0x29, 0x5c};

  uint8_t ciphertext[256] = {0};
  uint8_t tag[16] = {0};
  int size = aesGcm128Encrypt(plaintext, sizeof(plaintext), aad, sizeof(aad), key, iv, ciphertext, tag);
  BOOST_CHECK_EQUAL_COLLECTIONS(ciphertext, ciphertext + size,
                                expected_ciphertext, expected_ciphertext + sizeof(expected_ciphertext));
  BOOST_CHECK_EQUAL_COLLECTIONS(tag, tag + 16, expected_tag, expected_tag + sizeof(expected_tag));

  uint8_t decrypted[256] = {0};
  size = aesGcm128Decrypt(ciphertext, size, aad, sizeof(aad), tag, key, iv, decrypted);
  BOOST_CHECK_EQUAL_COLLECTIONS(decrypted, decrypted + size,
                                plaintext, plaintext + sizeof(plaintext));
}

BOOST_AUTO_TEST_CASE(AesIV)
{
  const uint8_t key[] = {0xbc, 0x22, 0xf3, 0xf0, 0x5c, 0xc4, 0x0d, 0xb9,
                         0x31, 0x1e, 0x41, 0x92, 0x96, 0x6f, 0xee, 0x92};
  const std::string plaintext = "alongstringalongstringalongstringalongstringalongstringalongstringalongstringalongstring";
  const std::string associatedData = "test";
  uint32_t counter = 0;
  auto block = encodeBlockWithAesGcm128(ndn::tlv::Content, key, (uint8_t*)plaintext.c_str(), plaintext.size(),
                                        (uint8_t*)associatedData.c_str(), associatedData.size(), counter);
  block.parse();
  auto ivBlock = block.get(tlv::InitializationVector);
  Buffer ivBuf(ivBlock.value(), ivBlock.value_size());
  BOOST_CHECK_EQUAL(ivBuf.size(), 12);
  BOOST_CHECK(ivBuf[0] >= 128);
  BOOST_CHECK_EQUAL(ivBuf[8] + ivBuf[9] + ivBuf[10] + ivBuf[11], 0);
  BOOST_CHECK_EQUAL(counter, 6);
  counter = 300;
  block = encodeBlockWithAesGcm128(ndn::tlv::ApplicationParameters, key, (uint8_t*)plaintext.c_str(), plaintext.size(),
                                   (uint8_t*)associatedData.c_str(), associatedData.size(), counter);
  block.parse();
  ivBlock = block.get(tlv::InitializationVector);
  Buffer ivBuf2(ivBlock.value(), ivBlock.value_size());
  BOOST_CHECK_EQUAL(ivBuf2.size(), 12);
  BOOST_CHECK(ivBuf2[0] < 128);
  BOOST_CHECK_EQUAL(ivBuf2[8] + ivBuf2[9], 0);
  BOOST_CHECK_EQUAL(ivBuf2[10], 1);
  BOOST_CHECK_EQUAL(ivBuf2[11], 44);
  BOOST_CHECK_EQUAL(counter, 306);
}

BOOST_AUTO_TEST_CASE(BlockEncodingDecoding)
{
  const uint8_t key[] = {0xbc, 0x22, 0xf3, 0xf0, 0x5c, 0xc4, 0x0d, 0xb9,
                         0x31, 0x1e, 0x41, 0x92, 0x96, 0x6f, 0xee, 0x92};
  const std::string plaintext = "alongstringalongstringalongstringalongstringalongstringalongstringalongstringalongstring";
  const std::string plaintext2 = "shortstring";
  const std::string associatedData = "right";
  const std::string wrongAssociatedData = "wrong";
  uint32_t counter = 0;
  // long string encryption
  auto block = encodeBlockWithAesGcm128(ndn::tlv::Content, key, (uint8_t*)plaintext.c_str(), plaintext.size(),
                                        (uint8_t*)associatedData.c_str(), associatedData.size(), counter);
  auto decoded = decodeBlockWithAesGcm128(block, key, (uint8_t*)associatedData.c_str(), associatedData.size());
  BOOST_CHECK_EQUAL(plaintext, std::string(decoded.get<char>(), decoded.size()));

  // short string encryption
  block = encodeBlockWithAesGcm128(ndn::tlv::Content, key, (uint8_t*)plaintext2.c_str(), plaintext2.size(),
                                   (uint8_t*)associatedData.c_str(), associatedData.size(), counter);
  decoded = decodeBlockWithAesGcm128(block, key, (uint8_t*)associatedData.c_str(), associatedData.size());
  BOOST_CHECK_EQUAL(plaintext2, std::string(decoded.get<char>(), decoded.size()));

  // use wrong associated data
  BOOST_CHECK_THROW(decodeBlockWithAesGcm128(block, key,
                                             (uint8_t*)wrongAssociatedData.c_str(),
                                             wrongAssociatedData.size()), std::runtime_error);
}

BOOST_AUTO_TEST_SUITE_END()

} // namespace tests
} // namespace ndncert
} // namespace ndn
