]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
openssl: Fix AWS-LC build
authorGerardo Ravago <gcr@amazon.com>
Mon, 12 May 2025 18:17:46 +0000 (14:17 -0400)
committerTobias Brunner <tobias@strongswan.org>
Tue, 13 May 2025 15:16:07 +0000 (17:16 +0200)
The `crypt` functions defined here conflict with the `crypt` function
defined in `unistd.h` and trigger compilation errors when building
against the latest version of AWS-LC, which introduced a new transitive
include of `unistd.h` via `bio.h`.

This simply renames the function to avoid the error.

Closes strongswan/strongswan#2786

src/libstrongswan/plugins/openssl/openssl_aead.c
src/libstrongswan/plugins/openssl/openssl_crypter.c

index 87af0e49e640a4785d64623fae22353f60a54f12..b7220bb6a05697a4aa2edf3aa3b13b7830037511 100644 (file)
@@ -86,8 +86,8 @@ struct private_aead_t {
 /**
  * Do the actual en/decryption in an EVP context
  */
-static bool crypt(private_aead_t *this, chunk_t data, chunk_t assoc, chunk_t iv,
-                                 u_char *out, int enc)
+static bool crypt_data(private_aead_t *this, chunk_t data, chunk_t assoc,
+                                          chunk_t iv, u_char *out, int enc)
 {
        EVP_CIPHER_CTX *ctx;
        u_char nonce[NONCE_LEN];
@@ -155,7 +155,7 @@ METHOD(aead_t, encrypt, bool,
                *encrypted = chunk_alloc(plain.len + this->icv_size);
                out = encrypted->ptr;
        }
-       return crypt(this, plain, assoc, iv, out, 1);
+       return crypt_data(this, plain, assoc, iv, out, 1);
 }
 
 METHOD(aead_t, decrypt, bool,
@@ -176,7 +176,7 @@ METHOD(aead_t, decrypt, bool,
                *plain = chunk_alloc(encrypted.len);
                out = plain->ptr;
        }
-       return crypt(this, encrypted, assoc, iv, out, 0);
+       return crypt_data(this, encrypted, assoc, iv, out, 0);
 }
 
 METHOD(aead_t, get_block_size, size_t,
index 21056d98d161bfc2f61b4689327f5cae4c185cca..53352a83e7ea55ec5af1296c6296b3261f54808b 100644 (file)
@@ -102,8 +102,8 @@ static char* lookup_algorithm(uint16_t ikev2_algo, size_t *key_size)
 /**
  * Do the actual en/decryption in an EVP context
  */
-static bool crypt(private_openssl_crypter_t *this, chunk_t data, chunk_t iv,
-                                 chunk_t *dst, int enc)
+static bool crypt_data(private_openssl_crypter_t *this, chunk_t data, chunk_t iv,
+                                          chunk_t *dst, int enc)
 {
        EVP_CIPHER_CTX *ctx;
        int len;
@@ -149,13 +149,13 @@ static bool crypt(private_openssl_crypter_t *this, chunk_t data, chunk_t iv,
 METHOD(crypter_t, decrypt, bool,
        private_openssl_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *dst)
 {
-       return crypt(this, data, iv, dst, 0);
+       return crypt_data(this, data, iv, dst, 0);
 }
 
 METHOD(crypter_t, encrypt, bool,
        private_openssl_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *dst)
 {
-       return crypt(this, data, iv, dst, 1);
+       return crypt_data(this, data, iv, dst, 1);
 }
 
 METHOD(crypter_t, get_block_size, size_t,