libnm/crypto: rename crypto functions that are only used by tests

These functions are only used by tests, hence they are much less important.
Mark them as such, by naming them accordingly.
This commit is contained in:
Thomas Haller 2018-08-29 14:42:03 +02:00
parent 5ff12dc86d
commit fbc0f599bc
3 changed files with 24 additions and 24 deletions

View file

@ -463,11 +463,11 @@ decrypt_key (const char *cipher,
}
GByteArray *
crypto_decrypt_openssl_private_key_data (const guint8 *data,
gsize data_len,
const char *password,
NMCryptoKeyType *out_key_type,
GError **error)
nmtst_crypto_decrypt_openssl_private_key_data (const guint8 *data,
gsize data_len,
const char *password,
NMCryptoKeyType *out_key_type,
GError **error)
{
NMCryptoKeyType key_type = NM_CRYPTO_KEY_TYPE_UNKNOWN;
nm_auto_unref_bytearray GByteArray *parsed = NULL;
@ -515,10 +515,10 @@ crypto_decrypt_openssl_private_key_data (const guint8 *data,
}
GByteArray *
crypto_decrypt_openssl_private_key (const char *file,
const char *password,
NMCryptoKeyType *out_key_type,
GError **error)
nmtst_crypto_decrypt_openssl_private_key (const char *file,
const char *password,
NMCryptoKeyType *out_key_type,
GError **error)
{
nm_auto_unref_bytearray GByteArray *contents = NULL;
@ -529,8 +529,8 @@ crypto_decrypt_openssl_private_key (const char *file,
if (!contents)
return NULL;
return crypto_decrypt_openssl_private_key_data (contents->data, contents->len,
password, out_key_type, error);
return nmtst_crypto_decrypt_openssl_private_key_data (contents->data, contents->len,
password, out_key_type, error);
}
static GByteArray *

View file

@ -50,16 +50,16 @@ typedef enum {
gboolean crypto_init (GError **error);
GByteArray *crypto_decrypt_openssl_private_key_data (const guint8 *data,
gsize data_len,
const char *password,
NMCryptoKeyType *out_key_type,
GError **error);
GByteArray *nmtst_crypto_decrypt_openssl_private_key_data (const guint8 *data,
gsize data_len,
const char *password,
NMCryptoKeyType *out_key_type,
GError **error);
GByteArray *crypto_decrypt_openssl_private_key (const char *file,
const char *password,
NMCryptoKeyType *out_key_type,
GError **error);
GByteArray *nmtst_crypto_decrypt_openssl_private_key (const char *file,
const char *password,
NMCryptoKeyType *out_key_type,
GError **error);
GByteArray *crypto_load_and_verify_certificate (const char *file,
NMCryptoFileFormat *out_file_format,

View file

@ -144,7 +144,7 @@ test_load_private_key (const char *path,
g_assert (nm_utils_file_is_private_key (path, &is_encrypted));
g_assert (is_encrypted);
array = crypto_decrypt_openssl_private_key (path, password, &key_type, &error);
array = nmtst_crypto_decrypt_openssl_private_key (path, password, &key_type, &error);
/* Even if the password is wrong, we should determine the key type */
g_assert_cmpint (key_type, ==, NM_CRYPTO_KEY_TYPE_RSA);
@ -264,7 +264,7 @@ test_encrypt_private_key (const char *path,
GByteArray *array, *encrypted, *re_decrypted;
GError *error = NULL;
array = crypto_decrypt_openssl_private_key (path, password, &key_type, &error);
array = nmtst_crypto_decrypt_openssl_private_key (path, password, &key_type, &error);
g_assert_no_error (error);
g_assert (array != NULL);
g_assert_cmpint (key_type, ==, NM_CRYPTO_KEY_TYPE_RSA);
@ -276,8 +276,8 @@ test_encrypt_private_key (const char *path,
/* Then re-decrypt the private key */
key_type = NM_CRYPTO_KEY_TYPE_UNKNOWN;
re_decrypted = crypto_decrypt_openssl_private_key_data (encrypted->data, encrypted->len,
password, &key_type, &error);
re_decrypted = nmtst_crypto_decrypt_openssl_private_key_data (encrypted->data, encrypted->len,
password, &key_type, &error);
g_assert_no_error (error);
g_assert (re_decrypted != NULL);
g_assert_cmpint (key_type, ==, NM_CRYPTO_KEY_TYPE_RSA);