27 psa_status_t expected_status;
30 static const char sha384_hash[] = {
31 0x43, 0x72, 0xe3, 0x8a, 0x92, 0xa2, 0x8b, 0x5d, 0x2c, 0x39, 0x1e, 0x62,
32 0x45, 0x2a, 0x86, 0xd5, 0x0e, 0x02, 0x67, 0x22, 0x8b, 0xe1, 0x76, 0xc7, 0x7d, 0x24, 0x02, 0xef,
33 0xfe, 0x9f, 0xa5, 0x0d, 0xe4, 0x07, 0xbb, 0xb8, 0x51, 0xb3, 0x7d, 0x59, 0x04, 0xab, 0xa2, 0xde,
34 0xde, 0x74, 0xda, 0x2a};
36 static const char sha512_hash[] = {
37 0x29, 0x6e, 0x22, 0x67, 0xd7, 0x4c, 0x27, 0x8d, 0xaa, 0xaa, 0x94, 0x0d,
38 0x17, 0xb0, 0xcf, 0xb7, 0x4a, 0x50, 0x83, 0xf8, 0xe0, 0x69, 0x72, 0x6d, 0x8c, 0x84, 0x1c, 0xbe,
39 0x59, 0x6e, 0x04, 0x31, 0xcb, 0x77, 0x41, 0xa5, 0xb5, 0x0f, 0x71, 0x66, 0x6c, 0xfd, 0x54, 0xba,
40 0xcb, 0x7b, 0x00, 0xae, 0xa8, 0x91, 0x49, 0x9c, 0xf4, 0xef, 0x6a, 0x03, 0xc8, 0xa8, 0x3f, 0xe3,
41 0x7c, 0x3f, 0x7b, 0xaf};
45 {
"Test psa_hash_verify with MD2 algorithm\n",
47 {0x8c, 0x9c, 0x17, 0x66, 0x5d, 0x25, 0xb3, 0x5f, 0xc4, 0x13, 0xc4, 0x18, 0x05, 0xc6, 0x79, 0xcf},
53 {
"Test psa_hash_verify with MD4 algorithm\n",
55 {0x18, 0xc3, 0x3f, 0x97, 0x29, 0x7e, 0xfe, 0x5f, 0x8a, 0x73, 0x22, 0x58, 0x28, 0x9f, 0xda, 0x25},
61 {
"Test psa_hash_verify with MD5 algorithm\n",
63 {0xab, 0xae, 0x57, 0xcb, 0x56, 0x2e, 0xcf, 0x29, 0x5b, 0x4a, 0x37, 0xa7, 0x6e, 0xfe, 0x61, 0xfb},
68 #ifdef ARCH_TEST_RIPEMD160 69 {
"Test psa_hash_verify with RIPEMD160 algorithm\n",
70 PSA_ALG_RIPEMD160, 0xbd, 1,
71 {0x50, 0x89, 0x26, 0x5e, 0xe5, 0xd9, 0xaf, 0x75, 0xd1, 0x2d, 0xbf, 0x7e, 0xa2, 0xf2, 0x7d, 0xbd,
72 0xee, 0x43, 0x5b, 0x37},
78 {
"Test psa_hash_verify with SHA1 algorithm\n",
79 PSA_ALG_SHA_1, 0xbd, 1,
80 {0x90, 0x34, 0xaa, 0xf4, 0x51, 0x43, 0x99, 0x6a, 0x2b, 0x14, 0x46, 0x5c, 0x35, 0x2a, 0xb0, 0xc6,
81 0xfa, 0x26, 0xb2, 0x21},
86 #ifdef ARCH_TEST_SHA224 87 {
"Test psa_hash_verify with SHA224 algorithm\n",
88 PSA_ALG_SHA_224, 0xbd, 1,
89 {0xb1, 0xe4, 0x6b, 0xb9, 0xef, 0xe4, 0x5a, 0xf5, 0x54, 0x36, 0x34, 0x49, 0xc6, 0x94, 0x5a, 0x0d,
90 0x61, 0x69, 0xfc, 0x3a, 0x5a, 0x39, 0x6a, 0x56, 0xcb, 0x97, 0xcb, 0x57},
95 #ifdef ARCH_TEST_SHA256 96 {
"Test psa_hash_verify with SHA256 algorithm\n",
97 PSA_ALG_SHA_256, 0xbd, 1,
98 {0x68, 0x32, 0x57, 0x20, 0xaa, 0xbd, 0x7c, 0x82, 0xf3, 0x0f, 0x55, 0x4b, 0x31, 0x3d, 0x05, 0x70,
99 0xc9, 0x5a, 0xcc, 0xbb, 0x7d, 0xc4, 0xb5, 0xaa, 0xe1, 0x12, 0x04, 0xc0, 0x8f, 0xfe, 0x73, 0x2b},
104 #ifdef ARCH_TEST_SHA384 105 {
"Test psa_hash_verify with SHA384 algorithm\n",
106 PSA_ALG_SHA_384, 0xbd, 1, {0}, 48, PSA_SUCCESS,
110 #ifdef ARCH_TEST_SHA512 111 {
"Test psa_hash_verify with SHA512 algorithm\n",
112 PSA_ALG_SHA_512, 0xbd, 1, {0}, 64, PSA_SUCCESS,
116 #ifdef ARCH_TEST_SHA256 117 {
"Test psa_hash_verify with incorrect expected hash\n",
118 PSA_ALG_SHA_256, 0xbd, 1,
119 {0x68, 0x32, 0x57, 0x20, 0xab, 0xbd, 0x7c, 0x82, 0xf3, 0x0f, 0x55, 0x4b, 0x31, 0x3d, 0x05, 0x70,
120 0xc9, 0x5a, 0xcc, 0xbb, 0x7d, 0xc4, 0xb5, 0xaa, 0xe1, 0x12, 0x04, 0xc0, 0x8f, 0xfe, 0x73, 0x78},
121 32, PSA_ERROR_INVALID_SIGNATURE,
124 {
"Test psa_hash_verify with incorrect hash length\n",
125 PSA_ALG_SHA_256, 0xbd, 1,
126 {0x68, 0x32, 0x57, 0x20, 0xaa, 0xbd, 0x7c, 0x82, 0xf3, 0x0f, 0x55, 0x4b, 0x31, 0x3d, 0x05, 0x70,
127 0xc9, 0x5a, 0xcc, 0xbb, 0x7d, 0xc4, 0xb5, 0xaa, 0xe1, 0x12, 0x04, 0xc0, 0x8f, 0xfe, 0x73, 0x2b},
128 31, PSA_ERROR_INVALID_SIGNATURE,
Copyright (c) 2018-2019, Arm Limited or its affiliates.