15 #include <gtest/gtest.h> 
   20 #include "../internal.h" 
   21 #include "../test/test_util.h" 
   26 TEST(PBKDFTest, EmptyPassword) {
 
   27   const uint8_t kKey[] = {0xa3, 0x3d, 0xdd, 0xc3, 0x04, 0x78, 0x18,
 
   28                           0x55, 0x15, 0x31, 0x1f, 0x87, 0x52, 0x89,
 
   29                           0x5d, 0x36, 0xea, 0x43, 0x63, 0xa2};
 
   43 TEST(PBKDFTest, EmptySalt) {
 
   44   const uint8_t kKey[] = {0x8b, 0xc2, 0xf9, 0x16, 0x7a, 0x81, 0xcd, 0xcf,
 
   45                           0xad, 0x12, 0x35, 0xcd, 0x90, 0x47, 0xf1, 0x13,
 
   46                           0x62, 0x71, 0xc1, 0xf9, 0x78, 0xfc, 0xfc, 0xb3,
 
   47                           0x5e, 0x22, 0xdb, 0xea, 0xfa, 0x46, 0x34, 0xf6};
 
   61 TEST(PBKDFTest, RFC6070Vectors) {
 
   62   const uint8_t kKey1[] = {0x0c, 0x60, 0xc8, 0x0f, 0x96, 0x1f, 0x0e,
 
   63                            0x71, 0xf3, 0xa9, 0xb5, 0x24, 0xaf, 0x60,
 
   64                            0x12, 0x06, 0x2f, 0xe0, 0x37, 0xa6};
 
   65   const uint8_t kKey2[] = {0xea, 0x6c, 0x01, 0x4d, 0xc7, 0x2d, 0x6f,
 
   66                            0x8c, 0xcd, 0x1e, 0xd9, 0x2a, 0xce, 0x1d,
 
   67                            0x41, 0xf0, 0xd8, 0xde, 0x89, 0x57};
 
   68   const uint8_t kKey3[] = {0x56, 0xfa, 0x6a, 0xa7, 0x55, 0x48, 0x09, 0x9d,
 
   69                            0xcc, 0x37, 0xd7, 0xf0, 0x34, 0x25, 0xe0, 0xc3};
 
   71   static_assert(
sizeof(
key) >= 
sizeof(
kKey2), 
"output too small");
 
   72   static_assert(
sizeof(
key) >= 
sizeof(
kKey3), 
"output too small");
 
   91   const uint8_t kKey1[] = {0xae, 0x4d, 0x0c, 0x95, 0xaf, 0x6b, 0x46, 0xd3,
 
   92                            0x2d, 0x0a, 0xdf, 0xf9, 0x28, 0xf0, 0x6d, 0xd0,
 
   93                            0x2a, 0x30, 0x3f, 0x8e, 0xf3, 0xc2, 0x51, 0xdf,
 
   94                            0xd6, 0xe2, 0xd8, 0x5a, 0x95, 0x47, 0x4c, 0x43};
 
   99       0x8c, 0x05, 0x11, 0xf4, 0xc6, 0xe5, 0x97, 0xc6, 0xac, 0x63, 0x15,
 
  100       0xd8, 0xf0, 0x36, 0x2e, 0x22, 0x5f, 0x3c, 0x50, 0x14, 0x95, 0xba,
 
  101       0x23, 0xb8, 0x68, 0xc0, 0x05, 0x17, 0x4d, 0xc4, 0xee, 0x71, 0x11,
 
  102       0x5b, 0x59, 0xf9, 0xe6, 0x0c, 0xd9, 0x53, 0x2f, 0xa3, 0x3e, 0x0f,
 
  103       0x75, 0xae, 0xfe, 0x30, 0x22, 0x5c, 0x58, 0x3a, 0x18, 0x6c, 0xd8,
 
  104       0x2b, 0xd4, 0xda, 0xea, 0x97, 0x24, 0xa3, 0xd3, 0xb8};
 
  107   static_assert(
sizeof(
key) >= 
sizeof(
kKey1), 
"output too small");
 
  115                         (
const uint8_t *)
"saltSALTsaltSALTsaltSALTsaltSALTsalt",
 
  125 TEST(PBKDFTest, ZeroIterations) {
 
  126   static const char kPassword[] = 
"password";
 
  127   const size_t password_len = strlen(
kPassword);
 
  128   static const uint8_t kSalt[] = {1, 2, 3, 4};
 
  129   const size_t salt_len = 
sizeof(kSalt);
 
  133   const size_t key_len = 
sizeof(
key);
 
  137                                 1 , digest, key_len, 
key));
 
  145                                  0 , digest, key_len, 
key));