Repository navigation
Conversation
This was referenced Mar 26, 2023
```
src/wincng.c:2403:21: warning: cast from 'unsigned char *' to 'BCRYPT_DH_PARAMETER_HEADER *' (aka 'struct _BCRYPT_DH_PARAMETER_HEADER *') increases required alignment from 1 to 4 [-Wcast-align]
dh_params = (BCRYPT_DH_PARAMETER_HEADER*)blob;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wincng.c:2484:23: warning: cast from 'unsigned char *' to 'BCRYPT_DH_KEY_BLOB *' (aka 'struct _BCRYPT_DH_KEY_BLOB *') increases required alignment from 1 to 4 [-Wcast-align]
dh_key_blob = (BCRYPT_DH_KEY_BLOB*)blob;
^~~~~~~~~~~~~~~~~~~~~~~~~
```
```
src/wincng.c:2580:27: warning: cast from 'unsigned char *' to 'BCRYPT_DH_KEY_BLOB *' (aka 'struct _BCRYPT_DH_KEY_BLOB *') increases required alignment from 1 to 4 [-Wcast-align]
public_blob = (BCRYPT_DH_KEY_BLOB*)blob;
^~~~~~~~~~~~~~~~~~~~~~~~~
```
```
src/wincng.c:2164:14: warning: cast from 'unsigned char *' to 'BCRYPT_RSAKEY_BLOB *' (aka 'struct _BCRYPT_RSAKEY_BLOB *') increases required alignment from 1 to 4 [-Wcast-align]
rsakey = (BCRYPT_RSAKEY_BLOB *)key;
^~~~~~~~~~~~~~~~~~~~~~~~~
```
```
src/wincng.c:1921:14: warning: cast from 'unsigned char *' to 'BCRYPT_KEY_DATA_BLOB_HEADER *' (aka 'struct _BCRYPT_KEY_DATA_BLOB_HEADER *') increases required alignment from 1 to 4 [-Wcast-align]
header = (BCRYPT_KEY_DATA_BLOB_HEADER *)key;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
```
src/wincng.c:1364:14: warning: cast from 'unsigned char *' to 'BCRYPT_DSA_KEY_BLOB *' (aka 'struct _BCRYPT_DSA_KEY_BLOB *') increases required alignment from 1 to 4 [-Wcast-align]
dsakey = (BCRYPT_DSA_KEY_BLOB *)key;
^~~~~~~~~~~~~~~~~~~~~~~~~~
```
```
src/wincng.c:1017:14: warning: cast from 'unsigned char *' to 'BCRYPT_RSAKEY_BLOB *' (aka 'struct _BCRYPT_RSAKEY_BLOB *') increases required alignment from 1 to 4 [-Wcast-align]
rsakey = (BCRYPT_RSAKEY_BLOB *)key;
^~~~~~~~~~~~~~~~~~~~~~~~~
```
```
src/wincng.c:866:40: warning: cast from 'unsigned char *' to 'PCRYPT_DATA_BLOB' (aka 'struct _CRYPTOAPI_BLOB *') increases required alignment from 1 to 8 [-Wcast-align]
ret = _libssh2_wincng_bn_ltob(((PCRYPT_DATA_BLOB)pbInteger)->pbData,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wincng.c:867:40: warning: cast from 'unsigned char *' to 'PCRYPT_DATA_BLOB' (aka 'struct _CRYPTOAPI_BLOB *') increases required alignment from 1 to 8 [-Wcast-align]
((PCRYPT_DATA_BLOB)pbInteger)->cbData,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
```
```
src/wincng.c:895:19: warning: cast from 'unsigned char *' to 'PCRYPT_DATA_BLOB' (aka 'struct _CRYPTOAPI_BLOB *') increases required alignment from 1 to 8 [-Wcast-align]
length = ((PCRYPT_DATA_BLOB)pbDecoded)->cbData;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
```
```
src/wincng.c:903:32: warning: cast from 'unsigned char *' to 'PCRYPT_DATA_BLOB' (aka 'struct _CRYPTOAPI_BLOB *') increases required alignment from 1 to 8 [-Wcast-align]
((PCRYPT_DATA_BLOB)pbDecoded)->pbData)[index];
^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wincng.c:902:31: warning: cast from 'BYTE *' (aka 'unsigned char *') to 'PCRYPT_DER_BLOB' (aka 'struct _CRYPTOAPI_BLOB *') increases required alignment from 1 to 8 [-Wcast-align]
pBlob = &((PCRYPT_DER_BLOB)
^~~~~~~~~~~~~~~~~
```
vszakats
force-pushed
the
silence-warnings-1-4
branch
from
March 26, 2023 22:47
b999127 to
501cdeb
Compare
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
Silence alignment warnings in WinCNG, by reworking the code. Also add two unrelated casts to avoid gcc compiler warnings in surrounding code. `increases required alignment from 1 to 4 [-Wcast-align]` `increases required alignment from 1 to 8 [-Wcast-align]` See warning details in the PR's individual commits. Reviewed-by: Marc Hörsken in <libssh2#846 (review)> Cherry-picked from libssh2#846 Closes libssh2#880
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Silence alignment warnings in WinCNG, by reworking the code.
Also add two unrelated casts to avoid gcc compiler warnings
in surrounding code.
increases required alignment from 1 to 4 [-Wcast-align]increases required alignment from 1 to 8 [-Wcast-align]See warning details in the PR's individual commits.
Reviewed-by: Marc Hörsken in #846 (review)
Cherry-picked from #846
Closes #880
TODO:
Partial list of warnings fixed: