File tree Expand file tree Collapse file tree 4 files changed +11
-20
lines changed
Expand file tree Collapse file tree 4 files changed +11
-20
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,7 @@ no-default-features = true
1616
1717[dependencies ]
1818rustls = { version = " 0.23" , default-features = false , features = [" std" ] }
19- sha2 = " 0.10"
2019windows-sys = { version = " 0.59" , features = [" Win32_Foundation" , " Win32_Security_Cryptography" ] }
21- aws-lc-rs = { version = " 1" , optional = true }
2220
2321[dev-dependencies ]
2422anyhow = " 1"
@@ -29,7 +27,6 @@ rustls-pki-types = "1"
2927default = [" logging" , " tls12" , " aws-lc-rs" ]
3028aws-lc-rs = [" rustls/aws_lc_rs" ]
3129early-data = []
32- aws-lc-bindgen = [" aws-lc-rs/bindgen" ]
3330fips = [" rustls/fips" ]
3431logging = [" rustls/logging" ]
3532ring = [" rustls/ring" ]
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ impl CertContext {
9090 }
9191
9292 /// Return DER-encoded X.509 certificate chain.
93- /// (1) exclude the root. (2) check leaf cert to determin to use HKLM engine or HKCU engine
93+ // (1) exclude the root. (2) check leaf cert to determine to use HKLM engine or HKCU engine
9494 pub fn as_chain_der ( & self ) -> Result < Vec < Vec < u8 > > > {
9595 unsafe {
9696 let param = CERT_CHAIN_PARA {
@@ -135,14 +135,9 @@ impl CertContext {
135135 ( * chain_ptr) . cElement as usize ,
136136 ) ;
137137
138- let mut first = true ;
139- for element in elements {
140- if first {
141- first = false ;
142- } else {
143- if 0 != ( ( * * element) . TrustStatus . dwInfoStatus
144- & CERT_TRUST_IS_SELF_SIGNED )
145- {
138+ for ( index, element) in elements. iter ( ) . enumerate ( ) {
139+ if index != 0 {
140+ if 0 != ( ( * * element) . TrustStatus . dwInfoStatus & CERT_TRUST_IS_SELF_SIGNED ) {
146141 break ;
147142 }
148143 }
@@ -153,7 +148,6 @@ impl CertContext {
153148 }
154149
155150 CertFreeCertificateChain ( & * context) ;
156-
157151 Ok ( chain)
158152 } else {
159153 Err ( CngError :: from_win32_error ( ) )
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ struct CngSigner {
104104}
105105
106106impl CngSigner {
107- // new hash function using BCryptHash function which uses FIPS certified SymCrypt
107+ // hash function using BCryptHash function which uses FIPS certified SymCrypt
108108 fn hash ( & self , message : & [ u8 ] ) -> Result < ( Vec < u8 > , SignaturePadding ) , Error > {
109109 let ( alg, padding) = match self . scheme {
110110 SignatureScheme :: RSA_PKCS1_SHA256 => {
Original file line number Diff line number Diff line change @@ -136,12 +136,12 @@ impl CertStore {
136136 unsafe { self . do_find ( CERT_FIND_HASH , & hash_blob as * const _ as _ ) }
137137 }
138138
139- /// On later OS releases, we added CERT_FIND_SHA256_HASH.
140- /// However, rustls-cng could be installed on earlier OS release where this FIND_SHA256 isn't present.
141- /// But the CERT_SHA256_HASH_PROP_ID is present.
142- /// So will need to add a new internal find function that gets and compares the SHA256 property.
143- /// Also, since SHA1 is being deprecated, Windows components should not use.
144- /// Therefore, the need to find via SHA256 instead of SHA1.
139+ // On later OS releases, we added CERT_FIND_SHA256_HASH.
140+ // However, rustls-cng could be installed on earlier OS release where this FIND_SHA256 isn't present.
141+ // But the CERT_SHA256_HASH_PROP_ID is present.
142+ // So will need to add a new internal find function that gets and compares the SHA256 property.
143+ // Also, since SHA1 is being deprecated, Windows components should not use.
144+ // Therefore, the need to find via SHA256 instead of SHA1.
145145
146146 /// Find list of certificates matching the SHA256 hash
147147 pub fn find_by_sha256 < D > ( & self , hash : D ) -> Result < Vec < CertContext > >
You can’t perform that action at this time.
0 commit comments