]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
openssl: Unify naming of public key structures.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 2 May 2023 20:28:56 +0000 (22:28 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 15 May 2023 18:06:50 +0000 (20:06 +0200)
The pointers to private key structures are all called "priv", but for
their public counterparts we often use "key" rather than "pub". Fix
that to improve readability.

openssl.c

index 0808a8b09c22210e53ff6a4cd3b22f337aec7362..409807993d405a000fbf50f8a83b6638de6dd700 100644 (file)
--- a/openssl.c
+++ b/openssl.c
@@ -280,34 +280,34 @@ int apc_get_pubkey(const char *key_file, struct asymmetric_key **result)
        unsigned char *blob;
        size_t decoded_size;
        int ret;
-       struct asymmetric_key *key = alloc(sizeof(*key));
+       struct asymmetric_key *pub = alloc(sizeof(*pub));
 
        ret = decode_public_key(key_file, &blob, &decoded_size);
        if (ret < 0)
                goto out;
-       ret = read_public_key(blob + ret, decoded_size - ret, &key->rsa);
+       ret = read_public_key(blob + ret, decoded_size - ret, &pub->rsa);
        if (ret < 0)
                goto free_blob;
-       ret = RSA_size(key->rsa);
+       ret = RSA_size(pub->rsa);
        assert(ret > 0);
-       *result = key;
+       *result = pub;
 free_blob:
        free(blob);
 out:
        if (ret < 0) {
-               free(key);
+               free(pub);
                *result = NULL;
                PARA_ERROR_LOG("can not load key %s\n", key_file);
        }
        return ret;
 }
 
-void apc_free_pubkey(struct asymmetric_key *key)
+void apc_free_pubkey(struct asymmetric_key *pub)
 {
-       if (!key)
+       if (!pub)
                return;
-       RSA_free(key->rsa);
-       free(key);
+       RSA_free(pub->rsa);
+       free(pub);
 }
 
 int apc_priv_decrypt(const char *key_file, unsigned char *outbuf,