Skip to content

Commit

Permalink
custom secp256k1 minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-marinica committed Aug 20, 2021
1 parent 1b042fb commit e464f4a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions elrond-wasm-node/src/api/crypto_api_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::ArwenBigUint;
use crate::ArwenApiImpl;
use elrond_wasm::api::CryptoApi;
use elrond_wasm::types::{BoxedBytes, MessageHashType, H256};
use elrond_wasm::{Box, Vec};
use elrond_wasm::Box;

extern "C" {

Expand Down Expand Up @@ -149,18 +149,17 @@ impl CryptoApi for ArwenApiImpl {
sig_length += 1;
}

let mut sig_output = Vec::new();
sig_output.resize(sig_length, 0u8);
let mut sig_output = BoxedBytes::allocate(sig_length);

encodeSecp256k1DerSignature(
r.as_ptr(),
r.len() as i32,
s.as_ptr(),
s.len() as i32,
sig_output.as_mut_slice().as_mut_ptr(),
sig_output.as_mut_ptr(),
);

BoxedBytes::from(sig_output.as_slice())
sig_output
}
}
}

0 comments on commit e464f4a

Please sign in to comment.