[sr-dev] [kamailio/kamailio] core/crypto: fix several mismatched bound warnings (PR #3098)

Ovidiu Sas notifications at github.com
Fri Apr 29 17:04:28 CEST 2022


#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [*] Commit message has the format required by CONTRIBUTING guide
- [*] Commits are split per component (core, individual modules, libs, utils, ...)
- [*] Each component has a single commit (if not, squash them into one commit)
- [*] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)

#### Type Of Change
- [*] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

#### Checklist:
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)

#### Description
Fix for the following compiler warnings:
```
core/crypto/sha256.c:548:32: warning: argument 1 of type ‘sha2_byte[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
  548 | void sr_SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
      |                      ~~~~~~~~~~^~~~~~~~
In file included from core/crypto/sha256.c:36:
core/crypto/sha256.h:86:22: note: previously declared as ‘uint8_t[32]’ {aka ‘unsigned char[32]’}
   86 | void sr_SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
core/crypto/sha256.c:611:47: warning: argument 2 of type ‘char[]’ with mismatched bound [-Warray-parameter=]
  611 | char *sr_SHA256_End(SHA256_CTX* context, char buffer[]) {
      |                                          ~~~~~^~~~~~~~
In file included from core/crypto/sha256.c:36:
core/crypto/sha256.h:87:34: note: previously declared as ‘char[65]’
   87 | char* sr_SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
core/crypto/sha256.c:911:32: warning: argument 1 of type ‘sha2_byte[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
  911 | void sr_SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
      |                      ~~~~~~~~~~^~~~~~~~
In file included from core/crypto/sha256.c:36:
core/crypto/sha256.h:98:22: note: previously declared as ‘uint8_t[64]’ {aka ‘unsigned char[64]’}
   98 | void sr_SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
core/crypto/sha256.c:940:47: warning: argument 2 of type ‘char[]’ with mismatched bound [-Warray-parameter=]
  940 | char *sr_SHA512_End(SHA512_CTX* context, char buffer[]) {
      |                                          ~~~~~^~~~~~~~
In file included from core/crypto/sha256.c:36:
core/crypto/sha256.h:99:34: note: previously declared as ‘char[129]’
   99 | char* sr_SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
core/crypto/sha256.c:986:32: warning: argument 1 of type ‘sha2_byte[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
  986 | void sr_SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
      |                      ~~~~~~~~~~^~~~~~~~
In file included from core/crypto/sha256.c:36:
core/crypto/sha256.h:92:22: note: previously declared as ‘uint8_t[48]’ {aka ‘unsigned char[48]’}
   92 | void sr_SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
core/crypto/sha256.c:1015:47: warning: argument 2 of type ‘char[]’ with mismatched bound [-Warray-parameter=]
 1015 | char *sr_SHA384_End(SHA384_CTX* context, char buffer[]) {
      |                                          ~~~~~^~~~~~~~
In file included from core/crypto/sha256.c:36:
core/crypto/sha256.h:93:34: note: previously declared as ‘char[97]’
   93 | char* sr_SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/3098

-- Commit Summary --

  * core/crypto: fix several mismatched bound warnings

-- File Changes --

    M src/core/crypto/sha256.c (16)
    M src/core/crypto/sha256.h (9)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/3098.patch
https://github.com/kamailio/kamailio/pull/3098.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3098
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/pull/3098 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20220429/22cb55d6/attachment-0001.htm>


More information about the sr-dev mailing list