Skip to content

Commit

Permalink
update to v0.2.0 (#3)
Browse files Browse the repository at this point in the history
update from cryptogarageinc/cfd-rust v0.2.3 (#3)
  • Loading branch information
k-matsuzawa authored Oct 28, 2020
1 parent 1e4a444 commit 79a0f84
Show file tree
Hide file tree
Showing 13 changed files with 1,358 additions and 516 deletions.
65 changes: 23 additions & 42 deletions .github/workflows/create_release-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ on:
tags:
- 'v*'

env:
CMAKE_VERSION: 3.17.2

jobs:
create-releases:
create_releases:
name: create-releases
runs-on: ubuntu-latest
outputs:
release_url: ${{ steps.output_url.outputs.upload_url }}

steps:
- name: checkout
Expand All @@ -30,23 +29,24 @@ jobs:
- Second Change
draft: false
prerelease: true
# continue-on-error: true
- name: write upload url
continue-on-error: true
- name: Get release
if: steps.create_release.outcome == 'failure'
id: get_release
uses: bruceadams/[email protected]
env:
url: ${{ steps.create_release.outputs.upload_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: output url
id: output_url
run: |
echo $url > upload_url.txt
- name: upload artifact
uses: actions/upload-artifact@v1
with:
name: artifact-upload_url
path: upload_url.txt
echo "::set-output name=upload_url::${{steps.get_release.outputs.upload_url}}${{steps.create_release.outputs.upload_url}}"
upload-object-windows-vs2019:
name: upload-object-win-vs2019
needs: create-releases
needs: create_releases
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
bin: [vs2019, vs2019-static]
include:
Expand All @@ -58,17 +58,9 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v2
- name: download artifact
uses: actions/download-artifact@v1
with:
name: artifact-upload_url
- name: dump upload url
- name: output url
id: get_url
run: |
export up_url="$(cat artifact-upload_url/upload_url.txt)"
echo "::set-output name=upload_url::$up_url"
echo "url=$up_url"
shell: bash
run: echo "::set-output name=upload_url::${{ needs.create_releases.outputs.release_url }}"
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
Expand Down Expand Up @@ -123,9 +115,10 @@ jobs:

upload-object-ubuntu:
name: upload-object-ubuntu
needs: create-releases
needs: create_releases
runs-on: ubuntu-${{ matrix.os_ver }}.04
strategy:
fail-fast: false
matrix:
# os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04]
os_ver: [20, 18, 16]
Expand Down Expand Up @@ -161,15 +154,9 @@ jobs:
zip -r cfd.zip usr
echo "---- dump zip file ----"
ls -l
- name: download artifact
uses: actions/download-artifact@v1
with:
name: artifact-upload_url
- name: dump upload url
- name: output url
id: get_url
run: |
url=$(cat artifact-upload_url/upload_url.txt)
echo ::set-output name=upload_url::$url
run: echo "::set-output name=upload_url::${{ needs.create_releases.outputs.release_url }}"
- name: Upload Release Asset Ubuntu
uses: actions/[email protected]
env:
Expand All @@ -182,7 +169,7 @@ jobs:

upload-object-alpine:
name: upload-object-alpine
needs: create-releases
needs: create_releases
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -212,15 +199,9 @@ jobs:
sudo cp -rp /tmp/cfd/cfd.zip $GITHUB_WORKSPACE/dist/cfd.zip
echo "---- dump zip file ----"
sudo ls -l /tmp/cfd
- name: download artifact
uses: actions/download-artifact@v1
with:
name: artifact-upload_url
- name: dump upload url
- name: output url
id: get_url
run: |
url=$(cat artifact-upload_url/upload_url.txt)
echo ::set-output name=upload_url::$url
run: echo "::set-output name=upload_url::${{ needs.create_releases.outputs.release_url }}"
- name: Upload Release Asset
id: upload-release-asset
# if: success()
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cfd-rust"
version = "0.1.0"
version = "0.2.0"
license = "MIT"
readme = "README.md"
keywords = ["build-dependencies"]
Expand Down
2 changes: 1 addition & 1 deletion cfd-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cfd_sys"
version = "0.0.1"
version = "0.2.0"
license = "MIT"
readme = "../README.md"
keywords = ["build-dependencies"]
Expand Down
2 changes: 2 additions & 0 deletions cfd-sys/cfd-cmake/cmake/CfdCommonOption.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ endif()

if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(ENABLE_DEBUG TRUE)
set(RPATH_TARGET "Debug")
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUGBUILD>)
if(ENABLE_COVERAGE AND ${ENABLE_COVERAGE})
set(STACK_PROTECTOR_OPT "")
Expand All @@ -31,6 +32,7 @@ set(STACK_PROTECTOR_OPT $<IF:$<CXX_COMPILER_ID:MSVC>,/GS,-fstack-check -fstack-
endif()
else()
set(ENABLE_DEBUG FALSE)
set(RPATH_TARGET "Release")
set(STACK_PROTECTOR_OPT "")
endif() # CMAKE_BUILD_TYPE

Expand Down
2 changes: 1 addition & 1 deletion cfd-sys/cfd-cmake/external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if(CFD_TARGET_VERSION)
set(CFD_TARGET_TAG ${CFD_TARGET_VERSION})
message(STATUS "[external project local] cfd target=${CFD_TARGET_VERSION}")
else()
set(CFD_TARGET_TAG v0.1.6)
set(CFD_TARGET_TAG v0.2.0)
endif()
if(CFD_TARGET_URL)
set(CFD_TARGET_REP ${CFD_TARGET_URL})
Expand Down
93 changes: 75 additions & 18 deletions cfd-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,44 +339,101 @@ fns! {
pubkey: *const i8,
signature: *const i8,
) -> c_int;
pub fn CfdCalculateSchnorrSignature(
pub fn CfdSignEcdsaAdaptor(
handle: *const c_void,
oracle_privkey: *const i8,
k_value: *const i8,
message: *const i8,
signature: *mut *mut c_char,
secret_key: *const i8,
adaptor: *const i8,
adaptor_signature: *mut *mut c_char,
adaptor_proof: *mut *mut c_char,
) -> c_int;
pub fn CfdCalculateSchnorrSignatureWithNonce(
pub fn CfdAdaptEcdsaAdaptor(
handle: *const c_void,
oracle_privkey: *const i8,
k_value: *const i8,
message: *const i8,
adaptor_signature: *const i8,
adaptor_secret: *const i8,
signature: *mut *mut c_char,
) -> c_int;
pub fn CfdVerifySchnorrSignature(
pub fn CfdExtractEcdsaAdaptorSecret(
handle: *const c_void,
pubkey: *const i8,
adaptor_signature: *const i8,
signature: *const i8,
adaptor: *const i8,
adaptor_secret: *mut *mut c_char,
) -> c_int;
pub fn CfdVerifyEcdsaAdaptor(
handle: *const c_void,
adaptor_signature: *const i8,
proof: *const i8,
adaptor: *const i8,
message: *const i8,
pubkey: *const i8,
) -> c_int;
pub fn CfdGetSchnorrPubkeyFromPrivkey(
handle: *const c_void,
privkey: *const i8,
pubkey: *mut *mut c_char,
parity: *mut bool,
) -> c_int;
pub fn CfdVerifySchnorrSignatureWithNonce(
pub fn CfdGetSchnorrPubkeyFromPubkey(
handle: *const c_void,
pubkey: *const i8,
schnorr_pubkey: *mut *mut c_char,
parity: *mut bool,
) -> c_int;
pub fn CfdSchnorrPubkeyTweakAdd(
handle: *const c_void,
pubkey: *const i8,
tweak: *const i8,
output: *mut *mut c_char,
parity: *mut bool,
) -> c_int;
pub fn CfdSchnorrKeyPairTweakAdd(
handle: *const c_void,
privkey: *const i8,
tweak: *const i8,
tweaked_pubkey: *mut *mut c_char,
tweaked_parity: *mut bool,
tweaked_privkey: *mut *mut c_char,
) -> c_int;
pub fn CfdCheckTweakAddFromSchnorrPubkey(
handle: *const c_void,
tweaked_pubkey: *const i8,
tweaked_parity: bool,
base_pubkey: *const i8,
tweak: *const i8,
) -> c_int;
pub fn CfdSignSchnorr(
handle: *const c_void,
message: *const i8,
secret_key: *const i8,
aux_rand: *const i8,
signature: *mut *mut c_char,
) -> c_int;
pub fn CfdSignSchnorrWithNonce(
handle: *const c_void,
message: *const i8,
secret_key: *const i8,
nonce: *const i8,
signature: *const i8,
signature: *mut *mut c_char,
) -> c_int;
pub fn CfdComputeSchnorrSigPoint(
handle: *const c_void,
message: *const i8,
nonce: *const i8,
pubkey: *const i8,
sig_point: *mut *mut c_char,
) -> c_int;
pub fn CfdGetSchnorrPubkey(
pub fn CfdVerifySchnorr(
handle: *const c_void,
oracle_pubkey: *const i8,
oracle_r_point: *const i8,
signature: *const i8,
message: *const i8,
output: *mut *mut c_char,
pubkey: *const i8,
) -> c_int;
pub fn CfdGetSchnorrPublicNonce(
pub fn CfdSplitSchnorrSignature(
handle: *const c_void,
privkey: *const i8,
signature: *const i8,
nonce: *mut *mut c_char,
key: *mut *mut c_char,
) -> c_int;
pub fn CfdConvertScriptAsmToHex(
handle: *const c_void,
Expand Down
6 changes: 4 additions & 2 deletions src/hdwallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1084,9 +1084,10 @@ impl HDWallet {
mnemonic: &str,
lang: MnemonicLanguage,
) -> Result<Vec<u8>, CfdError> {
let tmp_mnemonic = mnemonic.replace(" ", " ");
let passphrase = alloc_c_string("")?;
let language = alloc_c_string(&lang.to_str())?;
let mnemonic_str = alloc_c_string(&mnemonic)?;
let mnemonic_str = alloc_c_string(&tmp_mnemonic)?;
let handle = ErrorHandle::new()?;
let mut seed: *mut c_char = ptr::null_mut();
let mut entropy: *mut c_char = ptr::null_mut();
Expand Down Expand Up @@ -1155,9 +1156,10 @@ impl HDWallet {
lang: MnemonicLanguage,
passphrase: &str,
) -> Result<HDWallet, CfdError> {
let tmp_mnemonic = mnemonic.replace(" ", " ");
let passphrase = alloc_c_string(passphrase)?;
let language = alloc_c_string(&lang.to_str())?;
let mnemonic_str = alloc_c_string(&mnemonic)?;
let mnemonic_str = alloc_c_string(&tmp_mnemonic)?;
let handle = ErrorHandle::new()?;
let mut seed: *mut c_char = ptr::null_mut();
let mut entropy: *mut c_char = ptr::null_mut();
Expand Down
Loading

0 comments on commit 79a0f84

Please sign in to comment.