diff options
Diffstat (limited to 'src/test/test_crypto.c')
-rw-r--r-- | src/test/test_crypto.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index 6362331942..bf4b68efe2 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -152,13 +152,15 @@ test_crypto_openssl_version(void *arg) (void)arg; const char *version = crypto_openssl_get_version_str(); const char *h_version = crypto_openssl_get_header_version_str(); - tt_assert(version); tt_assert(h_version); tt_assert(!strcmpstart(version, h_version)); /* "-fips" suffix, etc */ tt_assert(!strstr(version, "OpenSSL")); int a=-1,b=-1,c=-1; - sscanf(version, "%d.%d.%d", &a,&b,&c); + if (!strcmpstart(version, "LibreSSL") || !strcmpstart(version, "BoringSSL")) + return; + int r = tor_sscanf(version, "%d.%d.%d", &a,&b,&c); + tt_int_op(r, OP_EQ, 3); tt_int_op(a, OP_GE, 0); tt_int_op(b, OP_GE, 0); tt_int_op(c, OP_GE, 0); @@ -533,7 +535,8 @@ test_crypto_aes_ctr_testvec(void *arg) char plaintext[16*4]; base16_decode(key, sizeof(key), key16, strlen(key16)); base16_decode(iv, sizeof(iv), ctr16, strlen(ctr16)); - base16_decode(plaintext, sizeof(plaintext), plaintext16, strlen(plaintext16)); + base16_decode(plaintext, sizeof(plaintext), + plaintext16, strlen(plaintext16)); crypto_cipher_t *c = crypto_cipher_new_with_iv(key, iv); crypto_cipher_crypt_inplace(c, plaintext, sizeof(plaintext)); @@ -1387,9 +1390,11 @@ test_crypto_digest_names(void *arg) int i; for (i = 0; names[i].n; ++i) { tt_str_op(names[i].n, OP_EQ,crypto_digest_algorithm_get_name(names[i].a)); - tt_int_op(names[i].a, OP_EQ,crypto_digest_algorithm_parse_name(names[i].n)); + tt_int_op(names[i].a, + OP_EQ,crypto_digest_algorithm_parse_name(names[i].n)); } - tt_int_op(-1, OP_EQ, crypto_digest_algorithm_parse_name("TimeCubeHash-4444")); + tt_int_op(-1, OP_EQ, + crypto_digest_algorithm_parse_name("TimeCubeHash-4444")); done: ; } @@ -1878,7 +1883,6 @@ test_crypto_hkdf_sha256_testvecs(void *arg) tor_free(mem_op_hex_tmp); } - static void test_crypto_curve25519_impl(void *arg) { |