Skip to content

support encrypt-then-mac (etm) MACs - #987

Merged
vszakats merged 10 commits into
libssh2:masterfrom
vszakats:etm-mac
Apr 21, 2023
Merged

vszakats merged 10 commits into
libssh2:masterfrom
vszakats:etm-mac

Conversation

@vszakats

@vszakats vszakats commented Apr 20, 2023 •

Copy link
Copy Markdown
Member

Support for calculating MAC (message authentication code) on encrypted
data instead of plain text data.

This adds support for the following MACs:

Integration-patches-by: Viktor Szakats

  • rebase on master
  • fix checksec warnings
  • fix compiler warning
  • fix indent/whitespace/eol
  • rebase/manual merge onto AES-GCM patch Add support for AES-GCM crypto protocols #797
  • more manual merge of libssh2_transport_send() based
    on dfandrich/shellfish

Fixes #582
Closes #655
Closes #987


After rebasing to AES-GCM, the whitespace-free diff is recommended for a clearer view:
https://github.com/libssh2/libssh2/pull/987/files?w=1

Support for calculating MAC (message authentication code) on encrypted data instead of plain text data.

This adds support for the following MACs:
  [email protected]
  [email protected]
  [email protected]

Integration-patches-by: Viktor Szakats

* rebase on master
* fix checksrc warnings
* fix compiler warnings
* fix indent/whitespace/eol
* merge with AES-GCM patch

Closes libssh2#655
Closes libssh2#987
@vszakats

Copy link
Copy Markdown
Member Author

@palmin: After merging the AES-GCM patch (#797) by @dfandrich, I've rebased your ETM-MAC patch onto it. Can you review / test it, if there is any issues to address?

A critical area is _libssh2_transport_send(), that had to be manually merged. I kept both ETM and GCM crypt loops. Maybe they can be merged into a single one.

@dfandrich

dfandrich commented Apr 20, 2023 via email

Copy link
Copy Markdown
Contributor

@vszakats

Copy link
Copy Markdown
Member Author

@dfandrich Thank you, looking into it.

```
src/transport.c:262:30: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
  262 |                 if(blocksize < decrypt_size) {
      |                              ^
```
```
src/transport.c:503:25: error: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
  503 |             if(numbytes < required_size) {
      |                         ^
```
@vszakats

vszakats commented Apr 20, 2023 •

Copy link
Copy Markdown
Member Author

That loop deduped. All went smooth. This PR is effectively on par with dfandrich/shellfish, only rebased to fresh master and some compiler warnings silenced.

@vszakats
vszakats merged commit 0048f30 into libssh2:master Apr 21, 2023
@vszakats
vszakats deleted the etm-mac branch April 21, 2023 09:24
@vszakats

Copy link
Copy Markdown
Member Author

@palmin Managed to mess up attribution in the final commit. I apologize.

agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
Support for calculating MAC (message authentication code) on encrypted
data instead of plain text data.

This adds support for the following MACs:
- `[email protected]`
- `[email protected]`
- `[email protected]`

Integration-patches-by: Viktor Szakats

* rebase on master
* fix checksec warnings
* fix compiler warning
* fix indent/whitespace/eol
* rebase/manual merge onto AES-GCM patch libssh2#797
* more manual merge of `libssh2_transport_send()` based
  on dfandrich/shellfish

Fixes libssh2#582
Closes libssh2#655
Closes libssh2#987
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement HMAC -SHA-2 EtM

3 participants