Skip to content

Commit

Permalink
Release build for MinGW CI; Fix GCC 12/13 warnings (#1536)
Browse files Browse the repository at this point in the history
### Issues:
Resolves: 
* aws/aws-lc-rs#397

### Description of changes: 
* Perform "release" build for MinGW in the CI.
* Address several GCC 12/13 warnings


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.
  • Loading branch information
justsmth authored Apr 17, 2024
1 parent ca72f77 commit 77c88cd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/windows-alt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
CMAKE_BUILD_TYPE=Release \
- name: Build Project
run: cmake --build ./build --target all
- name: Run tests
Expand Down Expand Up @@ -63,6 +64,7 @@ jobs:
CMAKE_SYSTEM_NAME=Windows \
CMAKE_SYSTEM_PROCESSOR=x86_64 \
CMAKE_BUILD_TOOL=ninja.exe \
CMAKE_BUILD_TYPE=Release \
- name: Build Project
run: cmake --build ./build --target all
- name: Run tests
Expand Down
4 changes: 3 additions & 1 deletion crypto/bytestring/cbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,9 @@ int CBS_get_asn1_int64(CBS *cbs, int64_t *out) {
}
uint8_t sign_extend[sizeof(int64_t)];
memset(sign_extend, is_negative ? 0xff : 0, sizeof(sign_extend));
for (size_t i = 0; i < len; i++) {
// GCC 12/13 report `stringop-overflow` on the following line
// without additional condition: `i < sizeof(int64_t)`
for (size_t i = 0; i < len && i < sizeof(int64_t); i++) {
// `data` is big-endian.
// Values are always shifted toward the "little" end.
#ifdef OPENSSL_BIG_ENDIAN
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ecdsa/ecdsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ ECDSA_SIG *ecdsa_digestsign_no_self_test(const EVP_MD *md, const uint8_t *input,
const uint8_t *nonce,
size_t nonce_len) {
uint8_t digest[EVP_MAX_MD_SIZE];
unsigned int digest_len;
unsigned int digest_len = EVP_MAX_MD_SIZE;
if (!EVP_Digest(input, in_len, digest, &digest_len, md, NULL)) {
return 0;
}
Expand All @@ -455,7 +455,7 @@ int ecdsa_digestverify_no_self_test(const EVP_MD *md, const uint8_t *input,
size_t in_len, const ECDSA_SIG *sig,
const EC_KEY *eckey){
uint8_t digest[EVP_MAX_MD_SIZE];
unsigned int digest_len;
unsigned int digest_len = EVP_MAX_MD_SIZE;
if (!EVP_Digest(input, in_len, digest, &digest_len, md, NULL)) {
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/rsa/rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ int rsa_digestsign_no_self_test(const EVP_MD *md, const uint8_t *input,
size_t in_len, uint8_t *out, unsigned *out_len,
RSA *rsa) {
uint8_t digest[EVP_MAX_MD_SIZE];
unsigned int digest_len;
unsigned int digest_len = EVP_MAX_MD_SIZE;
if (!EVP_Digest(input, in_len, digest, &digest_len, md, NULL)) {
return 0;
}
Expand Down Expand Up @@ -760,7 +760,7 @@ int rsa_digestverify_no_self_test(const EVP_MD *md, const uint8_t *input,
size_t in_len, const uint8_t *sig,
size_t sig_len, RSA *rsa) {
uint8_t digest[EVP_MAX_MD_SIZE];
unsigned int digest_len;
unsigned int digest_len = EVP_MAX_MD_SIZE;
if (!EVP_Digest(input, in_len, digest, &digest_len, md, NULL)) {
return 0;
}
Expand Down

0 comments on commit 77c88cd

Please sign in to comment.