Skip to content

Conversation

ttungle96
Copy link

Issues:

Resolves #ISSUE-NUMBER1
Addresses #ISSUE-NUMBER2

Description of changes:

Describe AWS-LC’s current behavior and how your code changes that behavior. If there are no issues this pr is resolving, explain why this change is necessary.

Call-outs:

Point out areas that need special attention or support during the review process. Discuss architecture or design changes.

Testing:

How is this change tested (unit tests, fuzz tests, etc.)? Are there any testing steps to be verified by the reviewer?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 14. Check the log or trigger a new build to see more.

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key.data(), key.size(), tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1622:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm(), key.data(), key.size(), tag_size, nullptr));

size_t plaintext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1631:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm_key_commit(), key.data(), key.size(), tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1666:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm_key_commit(), key.data(), key.size(), tag_size, nullptr));

size_t plaintext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1675:

- en;
+ en = 0;

CHECK_ERROR(EVP_EncryptFinal(ctx.get(), out_vec.data(), &out_len), ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
CHECK_ERROR(EVP_DecryptUpdate(ctx.get(), out_vec.data(), &out_len, in_vec.data(), in_len), ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
CHECK_ERROR(EVP_DecryptFinal(ctx.get(), out_vec.data(), &out_len), ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
int ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
int ciphertext_len;
= 0

int ciphertext_len;
ASSERT_TRUE(EVP_CipherUpdate(ctx.get(), (uint8_t*)ciphertext.data(), &ciphertext_len,
plaintext.data(), plaintext.size()));
int len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
int len;
= 0

ASSERT_EQ((size_t)aad_len, aad.size());

len = 0;
plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

     ^
Additional context

crypto/cipher_extra/cipher_test.cc:1537: Value stored to 'plaintext_len' is never read

     ^

int aad_len = aad.size();
ASSERT_EQ(aad_len, EVP_Cipher(ctx.get(), NULL, aad.data(), aad_len));

int ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
int ciphertext_len;
= 0

int ciphertext_len;
ASSERT_TRUE(EVP_CipherUpdate(ctx.get(), (uint8_t*)ciphertext.data(), &ciphertext_len,
plaintext.data(), plaintext.size()));
int len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
int len;
= 0

ASSERT_EQ((size_t)aad_len, aad.size());

len = 0;
plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

     ^
Additional context

crypto/cipher_extra/cipher_test.cc:1634: Value stored to 'plaintext_len' is never read

     ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

}

DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_xaes_256_gcm) {
memset(out, 0, sizeof(EVP_CIPHER));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

    memset(out, 0, sizeof(EVP_CIPHER));
    ^
Additional context

crypto/fipsmodule/cipher/e_aes.c:1896: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11

    memset(out, 0, sizeof(EVP_CIPHER));
    ^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an OPENSSL_memset that should be used internally.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for letting me know!

}

DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_xaes_256_gcm_key_commit) {
memset(out, 0, sizeof(EVP_CIPHER));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

    memset(out, 0, sizeof(EVP_CIPHER));
    ^
Additional context

crypto/fipsmodule/cipher/e_aes.c:1969: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11

    memset(out, 0, sizeof(EVP_CIPHER));
    ^

}

DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_xaes_256_gcm) {
memset(out, 0, sizeof(EVP_AEAD));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

    memset(out, 0, sizeof(EVP_AEAD));
    ^
Additional context

crypto/fipsmodule/cipher/e_aes.c:2076: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11

    memset(out, 0, sizeof(EVP_AEAD));
    ^

}

DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_xaes_256_gcm_key_commit) {
memset(out, 0, sizeof(EVP_AEAD));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

    memset(out, 0, sizeof(EVP_AEAD));
    ^
Additional context

crypto/fipsmodule/cipher/e_aes.c:2157: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11

    memset(out, 0, sizeof(EVP_AEAD));
    ^

@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 91.85804% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.98%. Comparing base (483d379) to head (6b4aab5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crypto/fipsmodule/cipher/e_aes.c 86.79% 28 Missing ⚠️
crypto/test/test_util.cc 33.33% 6 Missing and 2 partials ⚠️
crypto/cipher_extra/cipher_test.cc 98.69% 2 Missing ⚠️
crypto/fipsmodule/cipher/aead.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2740      +/-   ##
==========================================
+ Coverage   78.89%   78.98%   +0.08%     
==========================================
  Files         677      677              
  Lines      115526   116001     +475     
  Branches    16249    16288      +39     
==========================================
+ Hits        91150    91618     +468     
- Misses      23579    23584       +5     
- Partials      797      799       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

}

DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_xaes_256_gcm) {
memset(out, 0, sizeof(EVP_CIPHER));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

    memset(out, 0, sizeof(EVP_CIPHER));
    ^
Additional context

crypto/fipsmodule/cipher/e_aes.c:1904: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11

    memset(out, 0, sizeof(EVP_CIPHER));
    ^

}

DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_xaes_256_gcm_key_commit) {
memset(out, 0, sizeof(EVP_CIPHER));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

    memset(out, 0, sizeof(EVP_CIPHER));
    ^
Additional context

crypto/fipsmodule/cipher/e_aes.c:1967: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11

    memset(out, 0, sizeof(EVP_CIPHER));
    ^

}

DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_xaes_256_gcm) {
memset(out, 0, sizeof(EVP_AEAD));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

    memset(out, 0, sizeof(EVP_AEAD));
    ^
Additional context

crypto/fipsmodule/cipher/e_aes.c:2074: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11

    memset(out, 0, sizeof(EVP_AEAD));
    ^

}

DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_xaes_256_gcm_key_commit) {
memset(out, 0, sizeof(EVP_AEAD));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

    memset(out, 0, sizeof(EVP_AEAD));
    ^
Additional context

crypto/fipsmodule/cipher/e_aes.c:2155: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11

    memset(out, 0, sizeof(EVP_AEAD));
    ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

}

DEFINE_METHOD_FUNCTION(EVP_CIPHER, EVP_xaes_256_gcm) {
memset(out, 0, sizeof(EVP_CIPHER));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

    memset(out, 0, sizeof(EVP_CIPHER));
    ^
Additional context

crypto/fipsmodule/cipher/e_aes.c:1906: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11

    memset(out, 0, sizeof(EVP_CIPHER));
    ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1716:

- en;
+ en = 0;

ASSERT_TRUE(EVP_CIPHER_CTX_ctrl(ctx.get(), EVP_CTRL_AEAD_SET_IVLEN, 24, NULL));
ASSERT_TRUE(EVP_CipherInit_ex(ctx.get(), NULL, NULL, key, nonce, -1));

int ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
int ciphertext_len;
= 0

ASSERT_TRUE(EVP_CipherUpdate(ctx.get(), (uint8_t*)ciphertext.data(), &ciphertext_len,
plaintext, plaintext_len));

int len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
int len;
= 0

int aad_len = aad.size();
ASSERT_EQ(aad_len, EVP_Cipher(ctx.get(), NULL, aad.data(), aad_len));

int ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
int ciphertext_len;
= 0

ASSERT_TRUE(EVP_CipherUpdate(ctx.get(), (uint8_t*)ciphertext.data(), &ciphertext_len,
plaintext.data(), plaintext.size()));

int len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
int len;
= 0

ASSERT_EQ((size_t)aad_len, aad.size());

len = 0;
size_t plaintext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
size_t plaintext_len;
= 0


decrypted.resize(plaintext.size());
len = 0;
plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

         ^
Additional context

crypto/cipher_extra/cipher_test.cc:1617: Value stored to 'plaintext_len' is never read

         ^


plaintext_len = len;
ASSERT_TRUE(EVP_DecryptFinal(dctx.get(), (uint8_t*)decrypted.data() + len, &len));
plaintext_len += len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

         ^
Additional context

crypto/cipher_extra/cipher_test.cc:1622: Value stored to 'plaintext_len' is never read

         ^

ASSERT_EQ((size_t)aad_len, aad.size());

len = 0;
plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

     ^
Additional context

crypto/cipher_extra/cipher_test.cc:1715: Value stored to 'plaintext_len' is never read

     ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1628:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key.data(), key.size(), tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1660:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm(), key.data(), key.size(), tag_size, nullptr));

size_t plaintext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1674:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm_key_commit(), key.data(), key.size(), tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1715:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm_key_commit(), key.data(), key.size(), tag_size, nullptr));

size_t plaintext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1724:

- en;
+ en = 0;

#define NUM_NID 999
#define NUM_NID 1001

static const uint8_t kObjectData[] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: unknown type name 'uint8_t' [clang-diagnostic-error]

static const uint8_t kObjectData[] = {
             ^

0x32,
};

static const ASN1_OBJECT kObjects[NUM_NID] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: unknown type name 'ASN1_OBJECT' [clang-diagnostic-error]

static const ASN1_OBJECT kObjects[NUM_NID] = {
             ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm_key_commit(), key.data(), key.size(), tag_size, nullptr));

size_t plaintext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1728:

- en;
+ en = 0;

ASSERT_EQ((size_t)aad_len, aad.size());

len = 0;
plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

     ^
Additional context

crypto/cipher_extra/cipher_test.cc:1738: Value stored to 'plaintext_len' is never read

     ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 16. Check the log or trigger a new build to see more.

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1630:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key.data(), key.size(), tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1661:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm(), key.data(), key.size(), tag_size, nullptr));

size_t plaintext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1675:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1729:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t plaintext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1740:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1780:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t plaintext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1791:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm_key_commit(), key.data(), key.size(), tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1819:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm_key_commit(), key.data(), key.size(), tag_size, nullptr));

size_t plaintext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1832:

- en;
+ en = 0;


decrypted.resize(plaintext.size());
len = 0;
plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

         ^
Additional context

crypto/cipher_extra/cipher_test.cc:1604: Value stored to 'plaintext_len' is never read

         ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 18. Check the log or trigger a new build to see more.

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t ciphertext_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1629:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t ciphertext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1728:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1739:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t ciphertext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1779:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm(), key, 32, tag_size, nullptr));

size_t plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1790:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX ctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(ctx.get(), EVP_aead_xaes_256_gcm_key_commit(), key.data(), key.size(), tag_size, nullptr));

size_t ciphertext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1818:

- en;
+ en = 0;

bssl::ScopedEVP_AEAD_CTX dctx;
ASSERT_TRUE(EVP_AEAD_CTX_init(dctx.get(), EVP_aead_xaes_256_gcm_key_commit(), key.data(), key.size(), tag_size, nullptr));

size_t plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

crypto/cipher_extra/aead_test.cc:1831:

- en;
+ en = 0;

ASSERT_TRUE(EVP_CIPHER_CTX_ctrl(ctx.get(), EVP_CTRL_AEAD_SET_IVLEN, iv.size(), NULL));
ASSERT_TRUE(EVP_CipherInit_ex(ctx.get(), NULL, NULL, key.data(), iv.data(), -1));

int ciphertext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ciphertext_len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
int ciphertext_len = 0;
= 0

std::vector<uint8_t> decrypted;
decrypted.resize(plaintext.size());
len = 0;
size_t plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'plaintext_len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
size_t plaintext_len = 0;
= 0


decrypted.resize(plaintext.size());
len = 0;
plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

         ^
Additional context

crypto/cipher_extra/cipher_test.cc:1603: Value stored to 'plaintext_len' is never read

         ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions


plaintext_len = len;
ASSERT_TRUE(EVP_DecryptFinal(dctx.get(), (uint8_t*)decrypted.data() + len, &len));
plaintext_len += len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

         ^
Additional context

crypto/cipher_extra/cipher_test.cc:1608: Value stored to 'plaintext_len' is never read

         ^

ASSERT_EQ((size_t)aad_len, aad.size());

len = 0;
plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

     ^
Additional context

crypto/cipher_extra/cipher_test.cc:1863: Value stored to 'plaintext_len' is never read

     ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

ASSERT_EQ((size_t)aad_len, aad.size());

len = 0;
plaintext_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'plaintext_len' is never read [clang-analyzer-deadcode.DeadStores]

     ^
Additional context

crypto/cipher_extra/cipher_test.cc:1859: Value stored to 'plaintext_len' is never read

     ^

@ttungle96 ttungle96 closed this Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants