mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-01 08:03:31 +01:00
Fix crypto/digests test
This commit is contained in:
parent
a7c9d64fd6
commit
e7165659e0
@ -13,9 +13,9 @@
|
||||
#include "crypto_curve25519.h"
|
||||
#endif
|
||||
|
||||
extern const char AUTHORITY_SIGNKEY_1[];
|
||||
extern const char AUTHORITY_SIGNKEY_1_DIGEST[];
|
||||
extern const char AUTHORITY_SIGNKEY_1_DIGEST256[];
|
||||
extern const char AUTHORITY_SIGNKEY_3[];
|
||||
extern const char AUTHORITY_SIGNKEY_A_DIGEST[];
|
||||
extern const char AUTHORITY_SIGNKEY_A_DIGEST256[];
|
||||
|
||||
/** Run unit tests for Diffie-Hellman functionality. */
|
||||
static void
|
||||
@ -519,20 +519,20 @@ test_crypto_digests(void)
|
||||
|
||||
k = crypto_pk_new();
|
||||
test_assert(k);
|
||||
r = crypto_pk_read_private_key_from_string(k, AUTHORITY_SIGNKEY_1, -1);
|
||||
r = crypto_pk_read_private_key_from_string(k, AUTHORITY_SIGNKEY_3, -1);
|
||||
test_assert(!r);
|
||||
|
||||
r = crypto_pk_get_digest(k, digest);
|
||||
test_assert(r == 0);
|
||||
test_memeq(hex_str(digest, DIGEST_LEN),
|
||||
AUTHORITY_SIGNKEY_1_DIGEST, HEX_DIGEST_LEN);
|
||||
AUTHORITY_SIGNKEY_A_DIGEST, HEX_DIGEST_LEN);
|
||||
|
||||
r = crypto_pk_get_all_digests(k, &pkey_digests);
|
||||
|
||||
test_memeq(hex_str(pkey_digests.d[DIGEST_SHA1], DIGEST_LEN),
|
||||
AUTHORITY_SIGNKEY_1_DIGEST, HEX_DIGEST_LEN);
|
||||
AUTHORITY_SIGNKEY_A_DIGEST, HEX_DIGEST_LEN);
|
||||
test_memeq(hex_str(pkey_digests.d[DIGEST_SHA256], DIGEST256_LEN),
|
||||
AUTHORITY_SIGNKEY_1_DIGEST256, HEX_DIGEST256_LEN);
|
||||
AUTHORITY_SIGNKEY_A_DIGEST256, HEX_DIGEST256_LEN);
|
||||
done:
|
||||
crypto_pk_free(k);
|
||||
}
|
||||
|
@ -73,9 +73,9 @@ const char AUTHORITY_SIGNKEY_A[] =
|
||||
"Yx4lqK0ca5IkTp3HevwnlWaJgbaOTUspCVshzJBhDA==\n"
|
||||
"-----END RSA PRIVATE KEY-----\n";
|
||||
|
||||
const char AUTHORITY_SIGNKEY_1_DIGEST[] =
|
||||
const char AUTHORITY_SIGNKEY_A_DIGEST[] =
|
||||
"CBF56A83368A5150F1A9AAADAFB4D77F8C4170E2";
|
||||
const char AUTHORITY_SIGNKEY_1_DIGEST256[] =
|
||||
const char AUTHORITY_SIGNKEY_A_DIGEST256[] =
|
||||
"AF7C5468DBE3BA54A052726038D7F15F3C4CA511B1952645B3D96D83A8DFB51C";
|
||||
|
||||
/** Second of 3 example authority certificates for unit testing. */
|
||||
|
Loading…
Reference in New Issue
Block a user