Skip to content

Commit

Permalink
better naming for buffer size variable in tls_certificate.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Pyattaev committed Dec 3, 2024
1 parent 6037307 commit 3f96c5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions tls-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "solana-tls-utils"
description = "Solana TLS utilities"
documentation = "https://docs.rs/solana-tls-utils"
publish = false

version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
Expand All @@ -12,7 +11,6 @@ license = { workspace = true }
edition = { workspace = true }

[dependencies]

rustls = { workspace = true, features = ["ring"] }
solana-keypair = { workspace = true }
solana-pubkey = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions tls-utils/src/tls_certificates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ pub fn new_dummy_x509_certificate(
if keypair_secret_len != 32 {
panic!("Unexpected secret key length!");
}
let need_buffer = PKCS8_PREFIX
let buffer_size = PKCS8_PREFIX
.len()
.checked_add(keypair_secret_len) //clippy being overly guarded here but optimizer will elide checked_add
.expect("Unexpected secret key length!");
let mut key_pkcs8_der = Vec::<u8>::with_capacity(need_buffer);
let mut key_pkcs8_der = Vec::<u8>::with_capacity(buffer_size);
key_pkcs8_der.extend_from_slice(&PKCS8_PREFIX);
key_pkcs8_der.extend_from_slice(keypair_secret_bytes);
key_pkcs8_der
Expand Down

0 comments on commit 3f96c5c

Please sign in to comment.