Skip to content

Commit

Permalink
Merge pull request #14 from lakshya-sky/ext_crypto_ecdsa_generate_ver…
Browse files Browse the repository at this point in the history
…sion_1

Add `ext_crypto_ecdsa_generate_version_1`
  • Loading branch information
axaysagathiya authored Mar 24, 2024
2 parents 7e7d4bd + f58938d commit e315472
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Binary file modified test/runtimes/hostapi/hostapi_runtime.compact.wasm
Binary file not shown.
11 changes: 11 additions & 0 deletions test/runtimes/hostapi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ extern "C" {
fn ext_crypto_sr25519_verify_version_1(sig: u32, msg: u64, pubkey: u32) -> i32;

fn ext_crypto_secp256k1_ecdsa_recover_version_1(sig: u32, msg: u32) -> u64;
fn ext_crypto_ecdsa_generate_version_1(id: u32, seed: u64) -> i32;
fn ext_crypto_ecdsa_verify_version_2(sig: u32, msg: u64, pubkey: u32) -> i32;

// Hashing API
Expand Down Expand Up @@ -485,6 +486,16 @@ sp_core::wasm_export_functions! {
from_mem(value)
}
}
fn rtm_ext_crypto_ecdsa_generate_version_1(id_data: [u8;4], seed_data:Option<Vec<u8>>) -> Vec<u8> {
let seed_data = seed_data.encode();
unsafe {
let value = ext_crypto_ecdsa_generate_version_1(
id_data.as_ptr() as u32,
seed_data.as_re_ptr()
);
std::slice::from_raw_parts(value as *mut u8, 33).to_vec()
}
}
fn rtm_ext_crypto_ecdsa_verify_version_2(sig_data: Vec<u8>, msg_data: Vec<u8>, pubkey_data: Vec<u8>) -> u32 {
unsafe {
ext_crypto_ecdsa_verify_version_2(
Expand Down

0 comments on commit e315472

Please sign in to comment.