Skip to content

Commit

Permalink
crypto.ecdsa: apply the review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
blackshirt committed Feb 3, 2025
1 parent 4ac2577 commit 2a1b109
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion vlib/crypto/ecdsa/ecdsa.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module ecdsa
struct C.EVP_PKEY {}

fn C.EVP_PKEY_new() &C.EVP_PKEY
fn C.EVP_EC_gen(curve &u8) &C.EVP_PKEY
fn C.EVP_PKEY_free(key &C.EVP_PKEY)
fn C.EVP_PKEY_get1_EC_KEY(pkey &C.EVP_PKEY) &C.EC_KEY
fn C.EVP_PKEY_base_id(key &C.EVP_PKEY) int
Expand Down
16 changes: 4 additions & 12 deletions vlib/crypto/ecdsa/ecdsa.v
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,7 @@ const nid_evp_pkey_ec = C.EVP_PKEY_EC
// we only support this
const openssl_ec_named_curve = C.OPENSSL_EC_NAMED_CURVE

// Constants of short name of the supported curve(s).
// In the C parts, its defined as #define SN_X9_62_prime256v1 "prime256v1"
// Its placed here to simplify the access.
const sn_prime256v1 = 'prime256v1'
const sn_secp384r1 = 'secp384r1'
const sn_secp521r1 = 'secp521r1'
const sn_secp256k1 = 'secp256k1'

// The enum of supported curve(s)
// Nid is an enumeration of the supported curves
pub enum Nid {
prime256v1
secp384r1
Expand All @@ -58,14 +50,14 @@ pub mut:
fixed_size bool
}

// enum of hashing config for key signing (verifying).
// HashConfig is an enumeration of the possible options for key signing (verifying).
pub enum HashConfig {
with_recommended_hash
with_no_hash
with_custom_hash
}

// SignerOpts was configuration options to drive signing and verifying process.
// SignerOpts represents configuration options to drive signing and verifying process.
@[params]
pub struct SignerOpts {
pub mut:
Expand All @@ -78,7 +70,7 @@ pub mut:
custom_hash &hash.Hash = unsafe { nil }
}

// enum flag to allow flexible PrivateKey size
// KeyFlag is an enumeration of possible options to support flexible of PrivateKey key size.
enum KeyFlag {
// flexible flag to allow flexible-size of seed bytes
flexible
Expand Down

0 comments on commit 2a1b109

Please sign in to comment.