Skip to content

Commit

Permalink
fixup! fixup! feat[pallas-crypto]: Implement libsodium vrf signature …
Browse files Browse the repository at this point in the history
…verification
  • Loading branch information
AndrewWestberg committed Sep 6, 2024
1 parent c29f52d commit e1b621d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
21 changes: 9 additions & 12 deletions pallas-crypto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,15 @@ fn main() {
.arg("libsodium.sln")
.arg("/p:Configuration=StaticRelease")
.arg("/p:Platform=x64")
.arg("/t:Rebuild")
.arg("/m")
.arg("/v:m")
.arg("/nologo")
.arg("/clp:NoSummary;NoItemAndPropertyList;ErrorsOnly")
.arg("/nr:false")
.arg("/fl")
.arg("/flp:NoSummary;NoItemAndPropertyList;ErrorsOnly")
.arg("/p:PlatformToolset=v142")
.arg("/p:WindowsTargetPlatformVersion=10.0")
.arg("/p:PreferredToolArchitecture=x64")
.arg("/p:DefineConstants=SODIUM_STATIC")
// .arg("/t:Rebuild")
// .arg("/m")
// .arg("/v:m")
// .arg("/nologo")
// .arg("/clp:NoSummary;NoItemAndPropertyList;ErrorsOnly")
// .arg("/nr:false")
// .arg("/fl")
// .arg("/flp:NoSummary;NoItemAndPropertyList;ErrorsOnly")
// .arg("/p:PlatformToolset=v142")
});

// // debugging: find the path to libsodium.lib
Expand Down
20 changes: 20 additions & 0 deletions pallas-crypto/src/vrf/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
use thiserror::Error;

#[cfg(target_os = "windows")]
#[link(name = "libsodium", kind = "static")]
extern "C" {
// int crypto_vrf_ietfdraft03_prove(unsigned char *proof, const unsigned char *sk, const unsigned char *m, unsigned long long mlen);
fn crypto_vrf_ietfdraft03_prove(proof: *mut u8, sk: *const u8, m: *const u8, mlen: u64) -> i32;

// int crypto_vrf_ietfdraft03_proof_to_hash(unsigned char *hash, const unsigned char *proof);
fn crypto_vrf_ietfdraft03_proof_to_hash(hash: *mut u8, proof: *const u8) -> i32;

// int crypto_vrf_ietfdraft03_verify(unsigned char *output, const unsigned char *pk, const unsigned char *proof, const unsigned char *m, unsigned long long mlen)
fn crypto_vrf_ietfdraft03_verify(
output: *mut u8,
pk: *const u8,
proof: *const u8,
m: *const u8,
mlen: u64,
) -> i32;
}

#[cfg(not(target_os = "windows"))]
#[link(name = "sodium", kind = "static")]
extern "C" {
// int crypto_vrf_ietfdraft03_prove(unsigned char *proof, const unsigned char *sk, const unsigned char *m, unsigned long long mlen);
Expand Down

0 comments on commit e1b621d

Please sign in to comment.