Skip to content

Commit

Permalink
fixup! Ensure CKK_EC public keys are correctly formed
Browse files Browse the repository at this point in the history
  • Loading branch information
simo5 committed Nov 25, 2024
1 parent 3da6b39 commit 179ab3e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ fn bits_to_bytes(bits: usize) -> usize {
(bits + 7) / 8
}

fn ec_ws_point_size(bits: usize) -> usize {
fn ec_secp_point_size(bits: usize) -> usize {
2 * bits_to_bytes(bits) + 1
}

pub fn ec_point_size(oid: &asn1::ObjectIdentifier) -> Result<usize> {
match oid {
&EC_SECP256R1 => Ok(ec_ws_point_size(BITS_SECP256R1)),
&EC_SECP384R1 => Ok(ec_ws_point_size(BITS_SECP384R1)),
&EC_SECP521R1 => Ok(ec_ws_point_size(BITS_SECP521R1)),
&EC_SECP256R1 => Ok(ec_secp_point_size(BITS_SECP256R1)),
&EC_SECP384R1 => Ok(ec_secp_point_size(BITS_SECP384R1)),
&EC_SECP521R1 => Ok(ec_secp_point_size(BITS_SECP521R1)),
&ED25519_OID => Ok(bits_to_bytes(BITS_ED25519)),
&ED448_OID => Ok(bits_to_bytes(BITS_ED448)),
&X25519_OID => Ok(bits_to_bytes(BITS_X25519)),
Expand Down

0 comments on commit 179ab3e

Please sign in to comment.