Merge branch 'FSM' of https://github.com/jl777/komodo into jl777-FSM
merge
This commit is contained in:
@@ -15,7 +15,7 @@ AM_CFLAGS = -I$(top_srcdir)/src/asn -I$(top_srcdir)/include -I$(top_srcdir)/src/
|
||||
LIBSECP256K1=src/include/secp256k1/libsecp256k1.la
|
||||
|
||||
$(LIBSECP256K1): $(wildcard src/secp256k1/*)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
|
||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) -march:x86-64 -g
|
||||
|
||||
CRYPTOCONDITIONS_CORE=libcryptoconditions_core.la
|
||||
|
||||
|
||||
@@ -56,8 +56,6 @@ typedef struct CC {
|
||||
};
|
||||
} CC;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Crypto Condition Visitor
|
||||
*/
|
||||
@@ -87,6 +85,7 @@ struct CC* cc_conditionFromJSON(cJSON *params, char *err);
|
||||
struct CC* cc_conditionFromJSONString(const char *json, char *err);
|
||||
struct CC* cc_readConditionBinary(const uint8_t *cond_bin, size_t cond_bin_len);
|
||||
struct CC* cc_readFulfillmentBinary(const uint8_t *ffill_bin, size_t ffill_bin_len);
|
||||
int cc_readFulfillmentBinaryExt(const unsigned char *ffill_bin, size_t ffill_bin_len, CC **ppcc);
|
||||
struct CC* cc_new(int typeId);
|
||||
struct cJSON* cc_conditionToJSON(const CC *cond);
|
||||
char* cc_conditionToJSONString(const CC *cond);
|
||||
|
||||
@@ -55,7 +55,7 @@ static void anonToJSON(const CC *cond, cJSON *params) {
|
||||
|
||||
static unsigned char *anonFingerprint(const CC *cond) {
|
||||
unsigned char *out = calloc(1, 32);
|
||||
fprintf(stderr,"anon fingerprint %p %p\n",out,cond->fingerprint);
|
||||
//fprintf(stderr,"anon fingerprint %p %p\n",out,cond->fingerprint);
|
||||
memcpy(out, cond->fingerprint, 32);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _CompoundSha256Condition_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _Condition_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "SimpleSha256Condition.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _ConditionTypes_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <BIT_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _Ed25519FingerprintContents_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _Ed25519Sha512Fulfillment_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _EvalFulfillment_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _Fulfillment_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "PreimageFulfillment.h"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef _INTEGER_H_
|
||||
#define _INTEGER_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
#include <asn_codecs_prim.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef _NativeInteger_H_
|
||||
#define _NativeInteger_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
#include <INTEGER.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef _OCTET_STRING_H_
|
||||
#define _OCTET_STRING_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _PrefixFingerprintContents_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _PrefixFulfillment_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _PreimageFulfillment_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _RsaFingerprintContents_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _RsaSha256Fulfillment_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _Secp256k1FingerprintContents_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _Secp256k1Fulfillment_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _SimpleSha256Condition_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <OCTET_STRING.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _ThresholdFingerprintContents_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <NativeInteger.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _ThresholdFulfillment_H_
|
||||
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include <asn_SET_OF.h>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef ASN_CODECS_PRIM_H
|
||||
#define ASN_CODECS_PRIM_H
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef _BER_DECODER_H_
|
||||
#define _BER_DECODER_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef _CONSTR_CHOICE_H_
|
||||
#define _CONSTR_CHOICE_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef _CONSTR_SEQUENCE_H_
|
||||
#define _CONSTR_SEQUENCE_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef _CONSTR_SET_OF_H_
|
||||
#define _CONSTR_SET_OF_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#ifndef _CONSTR_TYPE_H_
|
||||
#define _CONSTR_TYPE_H_
|
||||
|
||||
#include <ber_tlv_length.h>
|
||||
#include <ber_tlv_tag.h>
|
||||
#include "ber_tlv_length.h"
|
||||
#include "ber_tlv_tag.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -35,13 +35,13 @@ typedef struct asn_struct_ctx_s {
|
||||
ber_tlv_len_t left; /* Number of bytes left, -1 for indefinite */
|
||||
} asn_struct_ctx_t;
|
||||
|
||||
#include <ber_decoder.h> /* Basic Encoding Rules decoder */
|
||||
#include <der_encoder.h> /* Distinguished Encoding Rules encoder */
|
||||
#include <xer_decoder.h> /* Decoder of XER (XML, text) */
|
||||
#include <xer_encoder.h> /* Encoder into XER (XML, text) */
|
||||
#include <per_decoder.h> /* Packet Encoding Rules decoder */
|
||||
#include <per_encoder.h> /* Packet Encoding Rules encoder */
|
||||
#include <constraints.h> /* Subtype constraints support */
|
||||
#include "ber_decoder.h" /* Basic Encoding Rules decoder */
|
||||
#include "der_encoder.h" /* Distinguished Encoding Rules encoder */
|
||||
#include "xer_decoder.h" /* Decoder of XER (XML, text) */
|
||||
#include "xer_encoder.h" /* Encoder into XER (XML, text) */
|
||||
#include "per_decoder.h" /* Packet Encoding Rules decoder */
|
||||
#include "per_encoder.h" /* Packet Encoding Rules encoder */
|
||||
#include "constraints.h" /* Subtype constraints support */
|
||||
|
||||
/*
|
||||
* Free the structure according to its specification.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef ASN1_CONSTRAINTS_VALIDATOR_H
|
||||
#define ASN1_CONSTRAINTS_VALIDATOR_H
|
||||
|
||||
#include <asn_system.h> /* Platform-dependent types */
|
||||
#include "asn_system.h" /* Platform-dependent types */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef _DER_ENCODER_H_
|
||||
#define _DER_ENCODER_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
#include <asn_internal.h>
|
||||
#include <per_decoder.h>
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#ifndef _PER_DECODER_H_
|
||||
#define _PER_DECODER_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include <per_support.h>
|
||||
#include "asn_application.h"
|
||||
#include "per_support.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
#include <asn_internal.h>
|
||||
#include <per_encoder.h>
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#ifndef _PER_ENCODER_H_
|
||||
#define _PER_ENCODER_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include <per_support.h>
|
||||
#include "asn_application.h"
|
||||
#include "per_support.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <per_support.h>
|
||||
#include "per_support.h"
|
||||
#include <constr_TYPE.h>
|
||||
#include <per_opentype.h>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
#include <asn_system.h>
|
||||
#include <asn_internal.h>
|
||||
#include <per_support.h>
|
||||
#include "per_support.h"
|
||||
|
||||
char *
|
||||
per_data_string(asn_per_data_t *pd) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef _PER_SUPPORT_H_
|
||||
#define _PER_SUPPORT_H_
|
||||
|
||||
#include <asn_system.h> /* Platform-specific types */
|
||||
#include "asn_system.h" /* Platform-specific types */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2004, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
#include <asn_internal.h>
|
||||
#include <xer_support.h> /* XER/XML parsing support */
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef _XER_DECODER_H_
|
||||
#define _XER_DECODER_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef _XER_ENCODER_H_
|
||||
#define _XER_ENCODER_H_
|
||||
|
||||
#include <asn_application.h>
|
||||
#include "asn_application.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -216,6 +216,35 @@ end:
|
||||
return cond;
|
||||
}
|
||||
|
||||
int cc_readFulfillmentBinaryExt(const unsigned char *ffill_bin, size_t ffill_bin_len, CC **ppcc) {
|
||||
|
||||
int error = 0;
|
||||
unsigned char *buf = calloc(1,ffill_bin_len);
|
||||
Fulfillment_t *ffill = 0;
|
||||
asn_dec_rval_t rval = ber_decode(0, &asn_DEF_Fulfillment, (void **)&ffill, ffill_bin, ffill_bin_len);
|
||||
if (rval.code != RC_OK) {
|
||||
error = rval.code;
|
||||
goto end;
|
||||
}
|
||||
// Do malleability check
|
||||
asn_enc_rval_t rc = der_encode_to_buffer(&asn_DEF_Fulfillment, ffill, buf, ffill_bin_len);
|
||||
if (rc.encoded == -1) {
|
||||
fprintf(stderr, "FULFILLMENT NOT ENCODED\n");
|
||||
error = -1;
|
||||
goto end;
|
||||
}
|
||||
if (rc.encoded != ffill_bin_len || 0 != memcmp(ffill_bin, buf, rc.encoded)) {
|
||||
error = (rc.encoded == ffill_bin_len) ? -3 : -2;
|
||||
goto end;
|
||||
}
|
||||
|
||||
*ppcc = fulfillmentToCC(ffill);
|
||||
end:
|
||||
free(buf);
|
||||
if (ffill) ASN_STRUCT_FREE(asn_DEF_Fulfillment, ffill);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
int cc_visit(CC *cond, CCVisitor visitor) {
|
||||
int out = visitor.visit(cond, visitor);
|
||||
@@ -225,7 +254,6 @@ int cc_visit(CC *cond, CCVisitor visitor) {
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
int cc_verify(const struct CC *cond, const unsigned char *msg, size_t msgLength, int doHashMsg,
|
||||
const unsigned char *condBin, size_t condBinLength,
|
||||
VerifyEval verifyEval, void *evalContext) {
|
||||
|
||||
@@ -71,7 +71,7 @@ endif
|
||||
endif
|
||||
|
||||
libsecp256k1_la_SOURCES = src/secp256k1.c
|
||||
libsecp256k1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
|
||||
libsecp256k1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES) -march=x86-64 -g
|
||||
libsecp256k1_la_LIBADD = $(JNI_LIB) $(SECP_LIBS) $(COMMON_LIB)
|
||||
|
||||
libsecp256k1_jni_la_SOURCES = src/java/org_bitcoin_NativeSecp256k1.c src/java/org_bitcoin_Secp256k1Context.c
|
||||
|
||||
Reference in New Issue
Block a user