mirror of
https://github.com/vlang/v.git
synced 2025-08-03 09:47:15 -04:00
crypto.ecdsa: improves internal function of calc_digest_with_evpkey
(#23901)
This commit is contained in:
parent
4cc6f2547f
commit
de54be058e
@ -318,12 +318,6 @@ fn calc_digest_with_evpkey(key &C.EVP_PKEY, message []u8, opt SignerOpts) ![]u8
|
||||
if message.len == 0 {
|
||||
return error('null-length messages')
|
||||
}
|
||||
bits_size := C.EVP_PKEY_get_bits(key)
|
||||
if bits_size <= 0 {
|
||||
return error(' bits_size was invalid')
|
||||
}
|
||||
key_size := (bits_size + 7) / 8
|
||||
|
||||
match opt.hash_config {
|
||||
.with_no_hash, .with_recommended_hash {
|
||||
md := default_digest(key)!
|
||||
@ -337,6 +331,7 @@ fn calc_digest_with_evpkey(key &C.EVP_PKEY, message []u8, opt SignerOpts) ![]u8
|
||||
if cfg.custom_hash == unsafe { nil } {
|
||||
return error('Custom hasher was not defined')
|
||||
}
|
||||
key_size := evp_key_size(key)!
|
||||
if key_size > cfg.custom_hash.size() {
|
||||
if !cfg.allow_smaller_size {
|
||||
return error('Hash into smaller size than current key size was not allowed')
|
||||
|
Loading…
x
Reference in New Issue
Block a user