]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
crypt: Rename decoding functions.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 28 Aug 2018 19:38:33 +0000 (21:38 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 25 Dec 2018 16:45:24 +0000 (17:45 +0100)
decode_ssh_key() and decode_key() operate on public and private keys
respectively. This should be obvious from the naming. Also, the
two functions will soon be grouped together in the same file. The
inconsistent naming would even increase the possible confusion,
so it's better to rename the functions now.

crypt_backend.h
crypt_common.c
gcrypt.c
openssl.c

index 175a6881c3d6567137513043055f548700c6ab65..6f8008759d0412e095aa46f14473a98201fa960e 100644 (file)
@@ -7,6 +7,6 @@
 /** AES block size in bytes. */
 #define AES_CRT128_BLOCK_SIZE 16
 
-int decode_ssh_key(const char *filename, unsigned char **blob,
+int decode_public_key(const char *filename, unsigned char **blob,
                size_t *decoded_size);
 int check_private_key_file(const char *file);
index 235b8b8d3e398551fc28bfbc746349c5dc8f6f1c..2b2e06c169c64064db47c850e03c81cd309f6b8c 100644 (file)
@@ -85,7 +85,7 @@ static int check_ssh_key_header(const unsigned char *blob, int blen)
  *
  * \sa \ref uudecode().
  */
-int decode_ssh_key(const char *filename, unsigned char **blob,
+int decode_public_key(const char *filename, unsigned char **blob,
                size_t *decoded_size)
 {
        int ret, ret2;
index 5d151a3cc9f7c42e6322f1748902b14281b49f1c..8431cc24c5a8d44f339937bb1f1aefb1a5c0bb42 100644 (file)
--- a/gcrypt.c
+++ b/gcrypt.c
@@ -111,7 +111,7 @@ static const char *gcrypt_strerror(gcry_error_t gret)
 /** Private keys end with this footer. */
 #define PRIVATE_KEY_FOOTER "-----END RSA PRIVATE KEY-----"
 
-static int decode_key(const char *key_file, unsigned char **result,
+static int decode_private_key(const char *key_file, unsigned char **result,
                size_t *blob_size)
 {
        int ret, ret2, i, j;
@@ -368,7 +368,7 @@ static int get_private_key(const char *key_file, struct asymmetric_key **result)
        struct asymmetric_key *key;
 
        *result = NULL;
-       ret = decode_key(key_file, &blob, &blob_size);
+       ret = decode_private_key(key_file, &blob, &blob_size);
        if (ret < 0)
                return ret;
        end = blob + blob_size;
@@ -426,7 +426,7 @@ int apc_get_pubkey(const char *key_file, struct asymmetric_key **result)
        struct asymmetric_key *key;
        unsigned bits;
 
-       ret = decode_ssh_key(key_file, &blob, &decoded_size);
+       ret = decode_public_key(key_file, &blob, &decoded_size);
        if (ret < 0)
                return ret;
        p = blob + ret;
index 4895e176ba9cf7f86962d365f3d9514aed0f0180..a27e0ca3f81e28aeb6edfef13ecca65e3b0decd3 100644 (file)
--- a/openssl.c
+++ b/openssl.c
@@ -151,7 +151,7 @@ int apc_get_pubkey(const char *key_file, struct asymmetric_key **result)
        int ret;
        struct asymmetric_key *key = para_malloc(sizeof(*key));
 
-       ret = decode_ssh_key(key_file, &blob, &decoded_size);
+       ret = decode_public_key(key_file, &blob, &decoded_size);
        if (ret < 0)
                goto out;
        ret = read_rsa_bignums(blob + ret, decoded_size - ret, &key->rsa);