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

Remove unneeded calls to .cast() #209

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aws-lc-rs/src/aead/aead_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl AeadCtx {
if 1 != EVP_AEAD_CTX_init(
aead_ctx.as_mut_ptr(),
aead,
key_bytes.as_ptr().cast(),
key_bytes.as_ptr(),
key_bytes.len(),
TAG_LEN,
null_mut(),
Expand Down
3 changes: 1 addition & 2 deletions aws-lc-rs/src/aead/poly1305.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ pub struct Context {
// are used, is only correct when the state buffer is 64-byte aligned.
#[repr(C, align(64))]
#[allow(non_camel_case_types)]
struct poly1305_state([u8; OPAQUE_LEN]);
const OPAQUE_LEN: usize = 512;
struct poly1305_state(aws_lc::poly1305_state);

impl Context {
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion aws-lc-rs/src/agreement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ impl EphemeralPrivateKey {
KeyInner::X25519(priv_key) => {
let mut buffer = [0u8; MAX_PUBLIC_KEY_LEN];
unsafe {
X25519_public_from_private(buffer.as_mut_ptr().cast(), priv_key.as_ptr());
X25519_public_from_private(buffer.as_mut_ptr(), priv_key.as_ptr());
}

Ok(PublicKey {
Expand Down
2 changes: 1 addition & 1 deletion aws-lc-rs/src/ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ unsafe fn ec_point_to_bytes(
**ec_group,
**ec_point,
pt_conv_form,
buf.as_mut_ptr().cast(),
buf.as_mut_ptr(),
PUBLIC_KEY_MAX_LEN,
null_mut(),
);
Expand Down
1 change: 1 addition & 0 deletions aws-lc-rs/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ mod tests {
let unspecified = super::Unspecified::from(key_rejected);
assert_eq!("Unspecified", unspecified.description());

#[allow(clippy::redundant_locals)]
let unspecified = unspecified;
assert_eq!("Unspecified", unspecified.description());
}
Expand Down
6 changes: 1 addition & 5 deletions aws-lc-rs/src/hmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,7 @@ impl Context {
#[inline]
fn try_update(&mut self, data: &[u8]) -> Result<(), Unspecified> {
unsafe {
if 1 != HMAC_Update(
self.key.get_hmac_ctx_ptr(),
data.as_ptr().cast(),
data.len(),
) {
if 1 != HMAC_Update(self.key.get_hmac_ctx_ptr(), data.as_ptr(), data.len()) {
return Err(Unspecified);
}
}
Expand Down