-
Notifications
You must be signed in to change notification settings - Fork 39
Bump ring from 0.16.20 to 0.17.13 #99
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
Open
dependabot
wants to merge
2
commits into
master
Choose a base branch
from
dependabot/cargo/ring-0.17.13
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,4 +20,4 @@ clap-num = "1.0.2" | |
| tar = "0.4.39" | ||
| elf = "0.7.2" | ||
| sha2 = "0.10.7" | ||
| ring = "0.16.20" | ||
| ring = "0.17.14" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
|
|
||
| use crate::header; | ||
| use crate::util::{self, align_to, amount_alignment_needed}; | ||
| use ring::signature::KeyPair; | ||
| use ring::{rand, signature}; | ||
| use sha2::{Digest, Sha256, Sha384, Sha512}; | ||
| use std::cmp; | ||
|
|
@@ -1060,30 +1059,18 @@ pub fn elf_to_tbf( | |
| panic!("RSA4096 could not be parsed: {:?}", e); | ||
| }); | ||
|
|
||
| let public_key: ring::signature::RsaPublicKeyComponents<Vec<u8>> = | ||
| ring::signature::RsaPublicKeyComponents { | ||
| n: key_pair | ||
| .public_key() | ||
| .modulus() | ||
| .big_endian_without_leading_zero() | ||
| .to_vec(), | ||
| e: key_pair | ||
| .public_key() | ||
| .exponent() | ||
| .big_endian_without_leading_zero() | ||
| .to_vec(), | ||
| }; | ||
|
|
||
| if key_pair.public_modulus_len() != 512 { | ||
| let public_key: ring::signature::RsaPublicKeyComponents<Vec<u8>> = key_pair.public().into(); | ||
|
|
||
| if key_pair.public().modulus_len() != 512 { | ||
| // A 4096-bit key should have a 512-byte modulus | ||
| panic!( | ||
| "RSA4096 signature requested but key {:?} is not 4096 bits, it is {} bits", | ||
| private_key_path, | ||
| key_pair.public_modulus_len() * 8 | ||
| key_pair.public().modulus_len() * 8 | ||
| ); | ||
| } | ||
| let rng = rand::SystemRandom::new(); | ||
| let mut signature = vec![0; key_pair.public_modulus_len()]; | ||
| let mut signature = vec![0; key_pair.public().modulus_len()]; | ||
| let _res = key_pair | ||
| .sign( | ||
| &signature::RSA_PKCS1_SHA512, | ||
|
|
@@ -1095,10 +1082,10 @@ pub fn elf_to_tbf( | |
| panic!("Could not generate RSA4096 signature: {:?}", e); | ||
| }); | ||
| let mut credentials = vec![0; 1024]; | ||
| credentials[..key_pair.public_modulus_len()] | ||
| .copy_from_slice(&public_key.n[..key_pair.public_modulus_len()]); | ||
| credentials[..key_pair.public().modulus_len()] | ||
| .copy_from_slice(&public_key.n[..key_pair.public().modulus_len()]); | ||
| for (i, sig) in signature.iter().enumerate() { | ||
| let index = i + key_pair.public_modulus_len(); | ||
| let index = i + key_pair.public().modulus_len(); | ||
| credentials[index] = *sig; | ||
| } | ||
|
|
||
|
|
@@ -1133,6 +1120,7 @@ pub fn elf_to_tbf( | |
| let key_pair = ring::signature::EcdsaKeyPair::from_pkcs8( | ||
| &ring::signature::ECDSA_P256_SHA256_FIXED_SIGNING, | ||
| &private_key_contents, | ||
| &rand::SystemRandom::new(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be the right thing to do since it was what was previously removed from inside of the function. briansmith/ring@2accae1 |
||
| ) | ||
| .unwrap_or_else(|e| { | ||
| panic!("ECDSA NIST P256 could not be parsed: {:?}", e); | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This got both harder and simpler. Getting the modulus and exponent from a public key is no longer directly supported, however a public key can just be changed into a PublicKeyComponents which is what we're creating here anyways.