]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
spelling: digest
authorJosh Soref <2119212+jsoref@users.noreply.github.com>
Mon, 17 Feb 2025 03:22:42 +0000 (22:22 -0500)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 22 May 2026 10:23:03 +0000 (13:23 +0300)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
src/lib-dcrypt/dcrypt-openssl1.c
src/lib-dcrypt/dcrypt-openssl3.c
src/lib-dcrypt/istream-decrypt.c
src/lib-dcrypt/test-stream.c

index 60ce4f87cc583d689189fb8613678be679faf3a9..0272db4d0c62d000adecd1b8fe8cbf54d4844141 100644 (file)
@@ -2618,15 +2618,15 @@ dcrypt_openssl_load_public_key_dovecot_v1(struct dcrypt_public_key **key_r,
                EVP_PKEY_set1_EC_KEY(key, eckey);
                EC_KEY_free(eckey);
                /* make sure digest matches */
-               buffer_t *dgst = t_buffer_create(32);
+               buffer_t *digest = t_buffer_create(32);
                struct dcrypt_public_key tmp;
                i_zero(&tmp);
                tmp.key = key;
-               if (!dcrypt_openssl_public_key_id_old(&tmp, dgst, error_r)) {
+               if (!dcrypt_openssl_public_key_id_old(&tmp, digest, error_r)) {
                        EVP_PKEY_free(key);
                        return FALSE;
                }
-               if (strcmp(binary_to_hex(dgst->data, dgst->used),
+               if (strcmp(binary_to_hex(digest->data, digest->used),
                           input[len-1]) != 0) {
                        *error_r = "Key id mismatch after load";
                        EVP_PKEY_free(key);
@@ -2667,15 +2667,15 @@ dcrypt_openssl_load_public_key_dovecot_v2(struct dcrypt_public_key **key_r,
        }
 
        /* make sure digest matches */
-       buffer_t *dgst = t_buffer_create(32);
+       buffer_t *digest = t_buffer_create(32);
        struct dcrypt_public_key tmpkey;
        i_zero(&tmpkey);
        tmpkey.key = pkey;
-       if (!dcrypt_openssl_public_key_id(&tmpkey, "sha256", dgst, error_r)) {
+       if (!dcrypt_openssl_public_key_id(&tmpkey, "sha256", digest, error_r)) {
                EVP_PKEY_free(pkey);
                return FALSE;
        }
-       if (strcmp(binary_to_hex(dgst->data, dgst->used), input[len-1]) != 0) {
+       if (strcmp(binary_to_hex(digest->data, digest->used), input[len-1]) != 0) {
                *error_r = "Key id mismatch after load";
                EVP_PKEY_free(pkey);
                return FALSE;
index b7327df07195e865ac6c09693dddf67e5aa2c66f..4674360179c29ce459134b057fe56065b5fae023 100644 (file)
@@ -2639,16 +2639,16 @@ dcrypt_openssl_load_public_key_dovecot_v1(struct dcrypt_public_key **key_r,
        EC_GROUP_free(g);
        i_assert(pkey != NULL);
        /* make sure digest matches */
-       buffer_t *dgst = t_buffer_create(32);
+       buffer_t *digest = t_buffer_create(32);
        struct dcrypt_public_key tmp;
        i_zero(&tmp);
        tmp.key = pkey;
-       if (!dcrypt_openssl_public_key_id_old(&tmp, dgst, error_r)) {
+       if (!dcrypt_openssl_public_key_id_old(&tmp, digest, error_r)) {
                EVP_PKEY_free(pkey);
                return FALSE;
        }
 
-       if (strcmp(binary_to_hex(dgst->data, dgst->used),
+       if (strcmp(binary_to_hex(digest->data, digest->used),
                   input[len-1]) != 0) {
                *error_r = "Key id mismatch after load";
                EVP_PKEY_free(pkey);
@@ -2685,15 +2685,15 @@ dcrypt_openssl_load_public_key_dovecot_v2(struct dcrypt_public_key **key_r,
        }
 
        /* make sure digest matches */
-       buffer_t *dgst = t_buffer_create(32);
+       buffer_t *digest = t_buffer_create(32);
        struct dcrypt_public_key tmpkey = {
                .key = pkey
        };
-       if (!dcrypt_openssl_public_key_id(&tmpkey, "sha256", dgst, error_r)) {
+       if (!dcrypt_openssl_public_key_id(&tmpkey, "sha256", digest, error_r)) {
                EVP_PKEY_free(pkey);
                return FALSE;
        }
-       if (strcmp(binary_to_hex(dgst->data, dgst->used), input[len-1]) != 0) {
+       if (strcmp(binary_to_hex(digest->data, digest->used), input[len-1]) != 0) {
                *error_r = "Key id mismatch after load";
                EVP_PKEY_free(pkey);
                return FALSE;
index 610c7e2ed5ff18a183eb886fa6a40f37953ebd27..fbcd28384c2047d76764c868c0340c2983161988 100644 (file)
@@ -335,7 +335,7 @@ i_stream_decrypt_key(struct decrypt_istream *stream, const char *malg,
        enum dcrypt_key_type ktype;
        int keys;
        bool have_key = FALSE;
-       unsigned char dgst[32];
+       unsigned char digest[32];
        uint32_t val;
        buffer_t buf;
 
@@ -346,7 +346,7 @@ i_stream_decrypt_key(struct decrypt_istream *stream, const char *malg,
 
        /* if we have a key, prefab the digest */
        if (stream->priv_key != NULL) {
-               buffer_create_from_data(&buf, dgst, sizeof(dgst));
+               buffer_create_from_data(&buf, digest, sizeof(digest));
                if (!dcrypt_key_id_private(stream->priv_key, "sha256", &buf,
                                           &error)) {
                        io_stream_set_error(&stream->istream.iostream,
@@ -364,19 +364,19 @@ i_stream_decrypt_key(struct decrypt_istream *stream, const char *malg,
 
        /* for each key */
        for(;keys>0;keys--) {
-               if ((size_t)(end-data) < 1 + (ssize_t)sizeof(dgst))
+               if ((size_t)(end-data) < 1 + (ssize_t)sizeof(digest))
                        return 0;
                ktype = *data++;
 
                if (stream->priv_key != NULL) {
                        /* see if key matches to the one we have */
-                       if (memcmp(dgst, data, sizeof(dgst)) == 0) {
+                       if (memcmp(digest, data, sizeof(digest)) == 0) {
                                have_key = TRUE;
                                break;
                        }
                } else if (stream->key_callback != NULL) {
                        const char *hexdgst = /* digest length */
-                               binary_to_hex(data, sizeof(dgst));
+                               binary_to_hex(data, sizeof(digest));
                        if (stream->priv_key != NULL)
                                dcrypt_key_unref_private(&stream->priv_key);
                        /* hope you going to give us right key.. */
@@ -393,7 +393,7 @@ i_stream_decrypt_key(struct decrypt_istream *stream, const char *malg,
                                break;
                        }
                }
-               data += sizeof(dgst);
+               data += sizeof(digest);
 
                /* wasn't correct key, skip over some data */
                if (!get_msb32(&data, end, &val) ||
@@ -409,7 +409,7 @@ i_stream_decrypt_key(struct decrypt_istream *stream, const char *malg,
                return -1;
        }
 
-       data += sizeof(dgst);
+       data += sizeof(digest);
 
        const unsigned char *ephemeral_key;
        uint32_t ep_key_len;
@@ -966,16 +966,16 @@ i_stream_decrypt_read(struct istream_private *stream)
                        if ((dstream->flags & IO_STREAM_ENC_INTEGRITY_HMAC) ==
                                IO_STREAM_ENC_INTEGRITY_HMAC) {
                                size_t maclen = dcrypt_ctx_hmac_get_digest_length(dstream->ctx_mac);
-                               unsigned char dgst[maclen];
+                               unsigned char digest[maclen];
                                buffer_t db;
-                               buffer_create_from_data(&db, dgst, sizeof(dgst));
+                               buffer_create_from_data(&db, digest, sizeof(digest));
                                if (!dcrypt_ctx_hmac_final(dstream->ctx_mac, &db, &error)) {
                                        io_stream_set_error(&stream->iostream,
                                                "Cannot verify MAC: %s", error);
                                        stream->istream.stream_errno = EIO;
                                        return -1;
                                }
-                               if (memcmp(dgst, data + decrypt_size, maclen) != 0) {
+                               if (memcmp(digest, data + decrypt_size, maclen) != 0) {
                                        io_stream_set_error(&stream->iostream,
                                                "Cannot verify MAC: mismatch");
                                        stream->istream.stream_errno = EIO;
index 6d13c62df7949a460f1f0cde10a9e1e360bd7cc6..c73f64083d603752124f84dbc37fac46bfa69992 100644 (file)
@@ -76,7 +76,7 @@ static void test_static_v1_input(void)
        ssize_t siz;
        const struct hash_method *hash = hash_method_lookup("sha256");
        unsigned char hash_ctx[hash->context_size];
-       unsigned char hash_dgst[hash->digest_size];
+       unsigned char hash_digest[hash->digest_size];
        hash->init(hash_ctx);
 
        test_begin("test_static_v1_input");
@@ -100,10 +100,10 @@ static void test_static_v1_input(void)
 
        i_stream_unref(&is_4);
 
-       hash->result(hash_ctx, hash_dgst);
+       hash->result(hash_ctx, hash_digest);
 
        test_assert(strcmp(test_sample_v1_hash,
-                          binary_to_hex(hash_dgst, sizeof(hash_dgst))) == 0);
+                          binary_to_hex(hash_digest, sizeof(hash_digest))) == 0);
 
        test_end();
 }
@@ -113,7 +113,7 @@ static void test_static_v1_input_short(void)
        ssize_t siz;
        const struct hash_method *hash = hash_method_lookup("sha256");
        unsigned char hash_ctx[hash->context_size];
-       unsigned char hash_dgst[hash->digest_size];
+       unsigned char hash_digest[hash->digest_size];
        hash->init(hash_ctx);
 
        test_begin("test_static_v1_input_short");
@@ -137,10 +137,10 @@ static void test_static_v1_input_short(void)
 
        i_stream_unref(&is_4);
 
-       hash->result(hash_ctx, hash_dgst);
+       hash->result(hash_ctx, hash_digest);
 
        test_assert(strcmp(test_sample_v1_short_hash,
-                          binary_to_hex(hash_dgst, sizeof(hash_dgst))) == 0);
+                          binary_to_hex(hash_digest, sizeof(hash_digest))) == 0);
 
        test_end();
 }
@@ -152,7 +152,7 @@ static void test_static_v2_input(void)
        ssize_t amt;
        const struct hash_method *hash = hash_method_lookup("sha256");
        unsigned char hash_ctx[hash->context_size];
-       unsigned char hash_dgst[hash->digest_size];
+       unsigned char hash_digest[hash->digest_size];
        hash->init(hash_ctx);
 
        struct istream *is_1 =
@@ -174,10 +174,10 @@ static void test_static_v2_input(void)
 
        i_stream_unref(&is_4);
 
-       hash->result(hash_ctx, hash_dgst);
+       hash->result(hash_ctx, hash_digest);
 
        test_assert(strcmp(test_sample_v2_hash,
-                   binary_to_hex(hash_dgst, sizeof(hash_dgst))) == 0);
+                   binary_to_hex(hash_digest, sizeof(hash_digest))) == 0);
 
        test_end();
 
@@ -203,8 +203,8 @@ static void test_static_v2_input(void)
        o_stream_close(os_2);
        i_stream_close(is_2);
 
-       hash->result(hash_ctx, hash_dgst);
-       printf("%s\n", binary_to_hex(hash_dgst, sizeof(hash_dgst)));
+       hash->result(hash_ctx, hash_digest);
+       printf("%s\n", binary_to_hex(hash_digest, sizeof(hash_digest)));
 */
 }