Skip to content

Commit

Permalink
publish solution 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoXuan40404 committed Mar 30, 2021
1 parent 24784fd commit e3244ae
Show file tree
Hide file tree
Showing 24 changed files with 477 additions and 536 deletions.
12 changes: 4 additions & 8 deletions bounty/src/scd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ fn generate_predicate_proof(
template_private_key: TemplatePrivateKey,
value: u64,
rule_set: &mut VerificationRuleSet,
) -> Result<VerifyRequest, WedprError>
{
) -> Result<VerifyRequest, WedprError> {
user_fill_certificate_attribute(certificate_attribute_dict, value);
let (
sign_certificate_request,
Expand Down Expand Up @@ -353,8 +352,7 @@ fn issuer_make_certificate_template(
fn user_fill_certificate_attribute(
certificate_attribute_dict: &mut AttributeDict,
attribute: u64,
)
{
) {
let mut attribute_kv = StringToStringPair::new();
attribute_kv.set_key(TARGET_ATTRIBUTE.to_string());
attribute_kv.set_value(attribute.to_string());
Expand All @@ -367,8 +365,7 @@ fn user_prove_rule_set(
certificate_template: &CertificateTemplate,
user_private_key_str: &str,
rule_set: &mut VerificationRuleSet,
) -> Result<VerifyRequest, WedprError>
{
) -> Result<VerifyRequest, WedprError> {
// In most cases, this nonce should be provided by the verifier to prevent
// replaying attacks.
let verification_nonce_str = verifier::get_verification_nonce().unwrap();
Expand All @@ -385,7 +382,6 @@ fn user_prove_rule_set(
fn verifier_verify_rule_set(
rule_set: &mut VerificationRuleSet,
request: &VerifyRequest,
) -> bool
{
) -> bool {
verifier::verify_selective_disclosure(&rule_set, &request).unwrap()
}
3 changes: 1 addition & 2 deletions bounty/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ pub fn print_alert5(
message3: &str,
message4: &str,
message5: &str,
)
{
) {
println!(
"{}\n{}\n{}\n{}\n{}\n",
message1.yellow(),
Expand Down
800 changes: 400 additions & 400 deletions bounty/src/vcl_data.rs

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions ffi/ffi_c/ffi_c_ktb/src/hdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ pub extern "C" fn wedpr_ktb_hdk_create_mnemonic_en(
pub extern "C" fn wedpr_ktb_hdk_create_master_key_en(
password_cstring: *mut c_char,
mnemonic_cstring: *mut c_char,
) -> *mut c_char
{
) -> *mut c_char {
let result = panic::catch_unwind(|| {
let passwd = c_safe_c_char_pointer_to_string!(password_cstring);
let mnemonic = c_safe_c_char_pointer_to_string!(mnemonic_cstring);
Expand Down Expand Up @@ -71,8 +70,7 @@ pub extern "C" fn wedpr_ktb_hdk_derive_extended_key(
account: c_int,
change: c_int,
address_index: c_int,
) -> *mut c_char
{
) -> *mut c_char {
let result = panic::catch_unwind(|| {
let master_key = c_safe_c_char_pointer_to_bytes!(master_key_cstring);

Expand Down
3 changes: 1 addition & 2 deletions ffi/ffi_c/ffi_c_scd/src/issuer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ pub extern "C" fn wedpr_scd_sign_certificate(
sign_request_cstring: *mut c_char,
user_id_cstring: *mut c_char,
user_nonce_cstring: *mut c_char,
) -> *mut c_char
{
) -> *mut c_char {
let result = panic::catch_unwind(|| {
let certificate_template_pb = c_safe_c_char_pointer_to_proto!(
certificate_template_cstring,
Expand Down
9 changes: 3 additions & 6 deletions ffi/ffi_c/ffi_c_scd/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ use wedpr_ffi_common::utils::{
pub extern "C" fn wedpr_scd_fill_certificate(
attribute_dict_cstring: *mut c_char,
certificate_template_cstring: *mut c_char,
) -> *mut c_char
{
) -> *mut c_char {
let result = panic::catch_unwind(|| {
let attribute_dict_pb = c_safe_c_char_pointer_to_proto!(
attribute_dict_cstring,
Expand Down Expand Up @@ -67,8 +66,7 @@ pub extern "C" fn wedpr_scd_blind_certificate_signature(
user_private_key_cstring: *mut c_char,
certificate_secrets_blinding_factors_cstring: *mut c_char,
issuer_nonce_cstring: *mut c_char,
) -> *mut c_char
{
) -> *mut c_char {
let result = panic::catch_unwind(|| {
let certificate_signature_pb = c_safe_c_char_pointer_to_proto!(
certificate_signature_cstring,
Expand Down Expand Up @@ -118,8 +116,7 @@ pub extern "C" fn wedpr_scd_prove_selective_disclosure(
certificate_template_cstring: *mut c_char,
user_private_key_cstring: *mut c_char,
verification_nonce_cstring: *mut c_char,
) -> *mut c_char
{
) -> *mut c_char {
let result = panic::catch_unwind(|| {
let certificate_signature_pb = c_safe_c_char_pointer_to_proto!(
certificate_signature_cstring,
Expand Down
3 changes: 1 addition & 2 deletions ffi/ffi_c/ffi_c_scd/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ pub extern "C" fn wedpr_scd_get_revealed_attributes(
pub extern "C" fn wedpr_scd_verify_selective_disclosure(
rule_set_cstring: *mut c_char,
verify_request_cstring: *mut c_char,
) -> *mut c_char
{
) -> *mut c_char {
let result = panic::catch_unwind(|| {
let verify_request_pb = c_safe_c_char_pointer_to_proto!(
verify_request_cstring,
Expand Down
6 changes: 3 additions & 3 deletions ffi/ffi_c/ffi_c_vcl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wedpr_ffi_c_vcl"
version = "1.3.0"
version = "1.4.0"
authors = [ "WeDPR <wedpr@webank.com>" ]
edition = "2018"

Expand All @@ -15,9 +15,9 @@ libc = "0.2.60"
protobuf = "2.22.1"
wedpr_s_verifiable_confidential_ledger = { path = "../../../solution/verifiable_confidential_ledger"}
wedpr_ffi_common = "1.0.0"
wedpr_ffi_macros = { git = "https://gitee.com/WeBankBlockchain/WeDPR-Lab-Crypto.git", branch = "v1.1.0" }
wedpr_ffi_macros = "1.1.0"
wedpr_s_protos = { path = "../../../protos"}
wedpr_l_protos = { git = "https://gitee.com/WeBankBlockchain/WeDPR-Lab-Crypto.git", branch = "v1.1.0" }
wedpr_l_protos = "1.1.0"
wedpr_l_macros = "1.0.0"

# This is required to generate C/C++ header files.
Expand Down
15 changes: 5 additions & 10 deletions ffi/ffi_c/ffi_c_vcl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ pub extern "C" fn wedpr_vcl_prove_sum_balance(
c1_secret_cstring: *mut c_char,
c2_secret_cstring: *mut c_char,
c3_secret_cstring: *mut c_char,
) -> *mut c_char
{
) -> *mut c_char {
let result = panic::catch_unwind(|| {
let c1_secret = decode_secret!(c_safe_c_char_pointer_to_proto!(
c1_secret_cstring,
Expand Down Expand Up @@ -107,8 +106,7 @@ pub extern "C" fn wedpr_vcl_verify_sum_balance(
c2_credit_cstring: *mut c_char,
c3_credit_cstring: *mut c_char,
proof_cstring: *mut c_char,
) -> i8
{
) -> i8 {
let result = panic::catch_unwind(|| {
let proof = c_safe_c_char_pointer_to_proto_with_error_value!(
proof_cstring,
Expand Down Expand Up @@ -224,8 +222,7 @@ pub extern "C" fn wedpr_vcl_prove_product_balance(
c1_secret_cstring: *mut c_char,
c2_secret_cstring: *mut c_char,
c3_secret_cstring: *mut c_char,
) -> *mut c_char
{
) -> *mut c_char {
let result = panic::catch_unwind(|| {
let c1_secret = decode_secret!(c_safe_c_char_pointer_to_proto!(
c1_secret_cstring,
Expand Down Expand Up @@ -256,8 +253,7 @@ pub extern "C" fn wedpr_vcl_verify_product_balance(
c2_credit_cstring: *mut c_char,
c3_credit_cstring: *mut c_char,
proof_cstring: *mut c_char,
) -> i8
{
) -> i8 {
let result = panic::catch_unwind(|| {
let proof = c_safe_c_char_pointer_to_proto_with_error_value!(
proof_cstring,
Expand Down Expand Up @@ -390,8 +386,7 @@ pub extern "C" fn wedpr_vcl_prove_range(
pub extern "C" fn wedpr_vcl_verify_range(
credit_cstring: *mut c_char,
proof_cstring: *mut c_char,
) -> i8
{
) -> i8 {
let result = panic::catch_unwind(|| {
let proof_str = c_safe_c_char_pointer_to_string_with_error_value!(
proof_cstring,
Expand Down
6 changes: 3 additions & 3 deletions ffi/ffi_java/ffi_java_ktb/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ffi_java_ktb"
version = "1.3.0"
version = "1.4.0"
authors = [ "WeDPR <wedpr@webank.com>" ]
edition = "2018"

Expand All @@ -14,8 +14,8 @@ crate-type = [ "cdylib", "staticlib" ]
jni = "0.13.0"
protobuf = "2.22.1"
wedpr_s_hierarchical_deterministic_key = "1.3.0"
wedpr_ffi_common = "1.0.0"
wedpr_ffi_macros = "1.0.0"
wedpr_ffi_common = "1.1.0"
wedpr_ffi_macros = "1.1.0"
wedpr_s_protos = "1.3.0"

[build-dependencies]
Expand Down
9 changes: 3 additions & 6 deletions ffi/ffi_java/ffi_java_ktb/src/hdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ pub extern "system" fn Java_com_webank_wedpr_ktb_hdk_NativeInterface_createMnemo
_env: JNIEnv,
_class: JClass,
word_count: jint,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

// TODO: Extract a macro for this type of function call if feasible.
Expand Down Expand Up @@ -67,8 +66,7 @@ pub extern "system" fn Java_com_webank_wedpr_ktb_hdk_NativeInterface_createMaste
_class: JClass,
password_jstring: JString,
mnemonic_jstring: JString,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

let password =
Expand Down Expand Up @@ -112,8 +110,7 @@ pub extern "system" fn Java_com_webank_wedpr_ktb_hdk_NativeInterface_deriveExten
account: jint,
change: jint,
address_index: jint,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

let master_key =
Expand Down
6 changes: 2 additions & 4 deletions ffi/ffi_java/ffi_java_scd/src/issuer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ pub extern "system" fn Java_com_webank_wedpr_scd_NativeInterface_issuerMakeCerti
_env: JNIEnv,
_class: JClass,
schema_jstring: JString,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

let schema_pb = java_safe_jstring_to_pb!(
Expand Down Expand Up @@ -88,8 +87,7 @@ pub extern "system" fn Java_com_webank_wedpr_scd_NativeInterface_issuerSignCerti
sign_request_jstring: JString,
user_id_jstring: JString,
user_nonce_jstring: JString,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

let certificate_template_pb = java_safe_jstring_to_pb!(
Expand Down
9 changes: 3 additions & 6 deletions ffi/ffi_java/ffi_java_scd/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ pub extern "system" fn Java_com_webank_wedpr_scd_NativeInterface_userFillCertifi
_class: JClass,
attribute_dict_jstring: JString,
certificate_template_jstring: JString,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

let attribute_dict_pb = java_safe_jstring_to_pb!(
Expand Down Expand Up @@ -110,8 +109,7 @@ pub extern "system" fn Java_com_webank_wedpr_scd_NativeInterface_userBlindCertif
user_private_key_jstring: JString,
certificate_secrets_blinding_factors_jstring: JString,
issuer_nonce_jstring: JString,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

let certificate_signature_pb = java_safe_jstring_to_pb!(
Expand Down Expand Up @@ -190,8 +188,7 @@ pub extern "system" fn Java_com_webank_wedpr_scd_NativeInterface_userProveSelect
certificate_template_jstring: JString,
user_private_key_jstring: JString,
verification_nonce_jstring: JString,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

let rule_set_pb = java_safe_jstring_to_pb!(
Expand Down
9 changes: 3 additions & 6 deletions ffi/ffi_java/ffi_java_scd/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ pub extern "system" fn Java_com_webank_wedpr_scd_NativeInterface_verifierGetReve
_env: JNIEnv,
_class: JClass,
verify_request_jstring: JString,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

let verify_request_pb = java_safe_jstring_to_pb!(
Expand Down Expand Up @@ -77,8 +76,7 @@ pub extern "system" fn Java_com_webank_wedpr_scd_NativeInterface_verifierVerifyS
_class: JClass,
rule_set_jstring: JString,
verify_request_jstring: JString,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

let rule_set_pb = java_safe_jstring_to_pb!(
Expand Down Expand Up @@ -122,8 +120,7 @@ pub extern "system" fn Java_com_webank_wedpr_scd_NativeInterface_verifierVerifyS
pub extern "system" fn Java_com_webank_wedpr_scd_NativeInterface_verifierGetVerificationNonce(
_env: JNIEnv,
_class: JClass,
) -> jobject
{
) -> jobject {
let result_jobject = get_result_jobject(&_env);

let verification_nonce =
Expand Down
8 changes: 4 additions & 4 deletions ffi/ffi_java/ffi_java_vcl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wedpr_ffi_java_vcl"
version = "1.3.0"
version = "1.4.0"
authors = [ "WeDPR <wedpr@webank.com>" ]
edition = "2018"

Expand All @@ -14,10 +14,10 @@ crate-type = [ "cdylib", "staticlib" ]
jni = "0.13.0"
protobuf = "2.22.1"
wedpr_s_verifiable_confidential_ledger = { path = "../../../solution/verifiable_confidential_ledger"}
wedpr_ffi_common = { git = "https://gitee.com/WeBankBlockchain/WeDPR-Lab-Crypto.git", branch = "v1.1.0" }
wedpr_ffi_macros = { git = "https://gitee.com/WeBankBlockchain/WeDPR-Lab-Crypto.git", branch = "v1.1.0" }
wedpr_ffi_common = "1.1.0"
wedpr_ffi_macros = "1.1.0"
wedpr_s_protos = { path = "../../../protos"}
wedpr_l_protos = { git = "https://gitee.com/WeBankBlockchain/WeDPR-Lab-Crypto.git", branch = "v1.1.0" }
wedpr_l_protos = "1.1.0"

[build-dependencies]
cbindgen = "0.9.0"
Expand Down
Loading

0 comments on commit e3244ae

Please sign in to comment.