]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
openssl: Remove unused openssl_hash_chunk() helper
authorTobias Brunner <tobias@strongswan.org>
Wed, 5 Oct 2022 16:14:12 +0000 (18:14 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 5 Oct 2022 16:15:26 +0000 (18:15 +0200)
Was used by the ECDSA implementation before 293a912c7de6 ("openssl: Fixes
for ECDSA with OpenSSL 3.0").

src/libstrongswan/plugins/openssl/openssl_util.c
src/libstrongswan/plugins/openssl/openssl_util.h

index 6c12c89c27cc4c747a83d805fafe92b877cb2af2..d08b2f4b66124f1facf484e54af2e0b0ec245f6b 100644 (file)
@@ -129,51 +129,6 @@ bool openssl_fingerprint(EVP_PKEY *key, cred_encoding_type_t type, chunk_t *fp)
        return TRUE;
 }
 
-/**
- * Described in header.
- */
-bool openssl_hash_chunk(int hash_type, chunk_t data, chunk_t *hash)
-{
-       EVP_MD_CTX *ctx;
-       bool ret = FALSE;
-       const EVP_MD *hasher = EVP_get_digestbynid(hash_type);
-       if (!hasher)
-       {
-               return FALSE;
-       }
-
-       ctx = EVP_MD_CTX_create();
-       if (!ctx)
-       {
-               goto error;
-       }
-
-       if (!EVP_DigestInit_ex(ctx, hasher, NULL))
-       {
-               goto error;
-       }
-
-       if (!EVP_DigestUpdate(ctx, data.ptr, data.len))
-       {
-               goto error;
-       }
-
-       *hash = chunk_alloc(EVP_MD_size(hasher));
-       if (!EVP_DigestFinal_ex(ctx, hash->ptr, NULL))
-       {
-               chunk_free(hash);
-               goto error;
-       }
-
-       ret = TRUE;
-error:
-       if (ctx)
-       {
-               EVP_MD_CTX_destroy(ctx);
-       }
-       return ret;
-}
-
 /**
  * Described in header.
  */
index dc33070b703c67afa53d2985c12a05fd8b10534d..dbed0fab97465c2e5b3ef74275472973157f0543 100644 (file)
@@ -57,18 +57,6 @@ bool openssl_compute_shared_key(EVP_PKEY *priv, EVP_PKEY *pub, chunk_t *shared);
  */
 bool openssl_fingerprint(EVP_PKEY *key, cred_encoding_type_t type, chunk_t *fp);
 
-/**
- * Creates a hash of a given type of a chunk of data.
- *
- * Note: this function allocates memory for the hash
- *
- * @param hash_type    NID of the hash
- * @param data         the chunk of data to hash
- * @param hash         chunk that contains the hash
- * @return                     TRUE on success, FALSE otherwise
- */
-bool openssl_hash_chunk(int hash_type, chunk_t data, chunk_t *hash);
-
 /**
  * Concatenates two bignums into a chunk, thereby enforcing the length of
  * a single BIGNUM, if necessary, by pre-pending it with zeros.