summaryrefslogtreecommitdiff
path: root/core/fdrm/crypto/fx_crypt_unittest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fdrm/crypto/fx_crypt_unittest.cpp')
-rw-r--r--core/fdrm/crypto/fx_crypt_unittest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/fdrm/crypto/fx_crypt_unittest.cpp b/core/fdrm/crypto/fx_crypt_unittest.cpp
index 4e3da6e186..bea9378b8c 100644
--- a/core/fdrm/crypto/fx_crypt_unittest.cpp
+++ b/core/fdrm/crypto/fx_crypt_unittest.cpp
@@ -227,3 +227,20 @@ TEST(FXCRYPT, Sha256TestB2) {
for (size_t i = 0; i < 32; ++i)
EXPECT_EQ(expected[i], actual[i]) << " at byte " << i;
}
+
+TEST(FXCRYPT, Sha512Test) {
+ const char* const input =
+ "This is a simple test. To see whether it is getting correct value.";
+ const uint8_t expected[64] = {
+ 0x86, 0xB5, 0x05, 0x63, 0xA2, 0x6F, 0xD6, 0xFA, 0xEB, 0x9B, 0xC3,
+ 0xBB, 0x9E, 0xB7, 0x03, 0x82, 0xB6, 0x50, 0x55, 0x6B, 0x90, 0x69,
+ 0xD0, 0xA7, 0x53, 0x0A, 0x34, 0xDD, 0xEA, 0x11, 0xCC, 0x91, 0x5C,
+ 0xC7, 0x93, 0xCA, 0xAE, 0x30, 0xD1, 0x96, 0xBE, 0xD0, 0x35, 0x21,
+ 0x4A, 0xC6, 0x42, 0x56, 0x0C, 0xA3, 0x00, 0x69, 0x44, 0x77, 0xCC,
+ 0x3E, 0xD4, 0xD6, 0x10, 0x31, 0xC6, 0xC0, 0x58, 0xCF};
+ uint8_t actual[64];
+ CRYPT_SHA512Generate(reinterpret_cast<const uint8_t*>(input), strlen(input),
+ actual);
+ for (size_t i = 0; i < 64; ++i)
+ EXPECT_EQ(expected[i], actual[i]) << " at byte " << i;
+}