Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add COSE structure extensions that allow use of predefined cryptographic backends + an OpenSSL based backend. #13

Merged
merged 32 commits into from
Aug 4, 2024

Conversation

pulsastrix
Copy link
Member

@pulsastrix pulsastrix commented Jun 16, 2024

This PR will add cipher implementations based on the openssl crate, which binds to the native openssl library.1

Currently, only one algorithm per "type" is currently supported (ECDSA for signing, AES-GCM for encrypting, AES-Key-Wrap for key distribution, HMAC for message authentication codes).

In order to not inflate this PR further, other algorithms and a potential RustCrypto based backend are probably better added in separate, smaller PRs.

Footnotes

  1. Better Nate than lever!

@pulsastrix pulsastrix requested a review from falko17 June 16, 2024 16:53
@pulsastrix pulsastrix self-assigned this Jun 16, 2024
Cargo.toml Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jun 20, 2024

Pull Request Test Coverage Report for Build 9601666399

Details

  • 280 of 363 (77.13%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-1.8%) to 88.397%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/error/mod.rs 0 1 0.0%
src/token/crypto_impl/openssl.rs 274 356 76.97%
Files with Coverage Reduction New Missed Lines %
src/common/scope/mod.rs 2 93.06%
Totals Coverage Status
Change from base Build 4532502856: -1.8%
Covered Lines: 1897
Relevant Lines: 2146

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 29, 2024

Pull Request Test Coverage Report for Build 9727733938

Details

  • 703 of 939 (74.87%) changed or added relevant lines in 9 files are covered.
  • 14 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-6.4%) to 83.78%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/token/cose/encrypt/mod.rs 6 7 85.71%
src/token/cose/sign/sign1.rs 121 127 95.28%
src/token/cose/sign/sign.rs 151 158 95.57%
src/error/mod.rs 3 14 21.43%
src/token/cose/crypto_impl/openssl.rs 94 108 87.04%
src/token/cose/sign/mod.rs 42 58 72.41%
src/token/cose/encrypt/encrypt0.rs 185 210 88.1%
src/token/cose/header_util.rs 22 65 33.85%
src/token/cose/key.rs 79 192 41.15%
Files with Coverage Reduction New Missed Lines %
src/token/mod.rs 1 84.62%
src/common/scope/mod.rs 2 93.06%
src/endpoints/token_req/mod.rs 11 77.48%
Totals Coverage Status
Change from base Build 4532502856: -6.4%
Covered Lines: 1906
Relevant Lines: 2275

💛 - Coveralls

Copy link
Member

@falko17 falko17 left a comment

Choose a reason for hiding this comment

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

Thank you for the PR! It's nice to finally get an actual cipher implementation. As always, here's my list of pedantic comments.

Cargo.toml Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
src/token/mod.rs Outdated Show resolved Hide resolved
src/error/mod.rs Outdated Show resolved Hide resolved
src/error/mod.rs Outdated Show resolved Hide resolved
src/token/cose/encrypt/encrypt0.rs Outdated Show resolved Hide resolved
src/token/cose/encrypt/encrypt0.rs Outdated Show resolved Hide resolved
src/token/cose/sign/sign.rs Outdated Show resolved Hide resolved
src/token/cose/sign/sign1.rs Outdated Show resolved Hide resolved
src/token/cose/sign/sign1.rs Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jul 2, 2024

Pull Request Test Coverage Report for Build 9767273749

Details

  • 715 of 929 (76.96%) changed or added relevant lines in 9 files are covered.
  • 14 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-5.5%) to 84.68%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/token/cose/encrypt/mod.rs 6 7 85.71%
src/token/cose/sign/sign1.rs 121 127 95.28%
src/token/cose/sign/sign.rs 151 158 95.57%
src/error/mod.rs 3 13 23.08%
src/token/cose/crypto_impl/openssl.rs 94 108 87.04%
src/token/cose/sign/mod.rs 46 62 74.19%
src/token/cose/header_util.rs 23 47 48.94%
src/token/cose/encrypt/encrypt0.rs 192 217 88.48%
src/token/cose/key.rs 79 190 41.58%
Files with Coverage Reduction New Missed Lines %
src/token/mod.rs 1 84.62%
src/common/scope/mod.rs 2 93.06%
src/endpoints/token_req/mod.rs 11 77.48%
Totals Coverage Status
Change from base Build 4532502856: -5.5%
Covered Lines: 1918
Relevant Lines: 2265

💛 - Coveralls

@pulsastrix pulsastrix requested a review from falko17 July 14, 2024 22:32
@coveralls
Copy link

coveralls commented Jul 14, 2024

Pull Request Test Coverage Report for Build 10239234233

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1365 of 1705 (80.06%) changed or added relevant lines in 29 files are covered.
  • 12 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-5.3%) to 84.966%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/common/cbor_map/mod.rs 1 2 50.0%
src/common/scope/mod.rs 0 1 0.0%
src/token/cose/encrypted/encrypt/tests.rs 78 79 98.73%
src/token/cose/encrypted/encrypt0/tests.rs 57 58 98.28%
src/token/cose/signed/sign/tests.rs 72 73 98.63%
src/token/cose/aad.rs 34 36 94.44%
src/token/cose/maced/mac0/tests.rs 58 60 96.67%
src/token/cose/maced/mod.rs 23 27 85.19%
src/token/cose/signed/mod.rs 24 28 85.71%
src/token/tests.rs 106 112 94.64%
Files with Coverage Reduction New Missed Lines %
src/token/mod.rs 1 83.0%
src/common/scope/mod.rs 2 93.06%
src/error/mod.rs 4 48.37%
src/token/tests.rs 5 93.66%
Totals Coverage Status
Change from base Build 4532502856: -5.3%
Covered Lines: 2724
Relevant Lines: 3206

💛 - Coveralls

pulsastrix added a commit that referenced this pull request Jul 15, 2024
@falko17
Copy link
Member

falko17 commented Jul 16, 2024

Oh, before I forget: When you're working on the documentation, could you also update the README, specifically the section about the COSE cipher? To do so, you can change the crate-level documentation in lib.rs, and then run cargo-rdme to update the README.md file (it already contains the appropriate tags for it).

@pulsastrix
Copy link
Member Author

Aside from fixing the links in the documentation and running cargo rdme again, this should now finally be the end of it.

@pulsastrix pulsastrix marked this pull request as ready for review July 24, 2024 20:46
@pulsastrix pulsastrix changed the title Add Cipher implementation using OpenSSL bindings Add COSE structure extensions that allow use of predefined cryptographic backends + an OpenSSL based backend. Jul 25, 2024
Copy link
Member

@falko17 falko17 left a comment

Choose a reason for hiding this comment

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

Some1 final suggestions, but most of these are automatically applicable formatting fixes, the rest are just a few open questions.

Footnotes

  1. Okay, a lot, but to be fair this was also a huge PR

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
src/common/test_helper.rs Outdated Show resolved Hide resolved
src/common/test_helper.rs Show resolved Hide resolved
src/token/mod.rs Outdated Show resolved Hide resolved
src/token/mod.rs Outdated Show resolved Hide resolved
src/token/mod.rs Outdated Show resolved Hide resolved
src/token/mod.rs Outdated Show resolved Hide resolved
src/token/tests.rs Outdated Show resolved Hide resolved
src/common/test_helper.rs Outdated Show resolved Hide resolved
src/endpoints/creation_hint/mod.rs Show resolved Hide resolved
src/error/mod.rs Outdated Show resolved Hide resolved
src/error/mod.rs Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/token/mod.rs Show resolved Hide resolved
src/token/mod.rs Show resolved Hide resolved
src/token/mod.rs Outdated Show resolved Hide resolved
src/token/tests.rs Outdated Show resolved Hide resolved
tests/integration_tests.rs Outdated Show resolved Hide resolved
pulsastrix added a commit that referenced this pull request Jul 31, 2024
Co-authored-by: Falko Galperin <10247603+falko17@users.noreply.github.com>
pulsastrix and others added 24 commits August 4, 2024 22:56
Co-authored-by: Falko Galperin <falko1@uni-bremen.de>
Co-authored-by: Falko Galperin <falko1@uni-bremen.de>
@falko17 falko17 merged commit f64c2ac into main Aug 4, 2024
8 checks passed
@falko17 falko17 deleted the 1-add-cipher-impls branch August 4, 2024 21:02
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.

3 participants