Fingerprint prints
This commit is contained in:
@@ -55,6 +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);
|
||||
memcpy(out, cond->fingerprint, 32);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -71,8 +71,7 @@ char *cc_conditionUri(const CC *cond) {
|
||||
unsigned char *encoded = base64_encode(fp, 32);
|
||||
|
||||
unsigned char *out = calloc(1, 1000);
|
||||
sprintf(out, "ni:///sha-256;%s?fpt=%s&cost=%lu",
|
||||
encoded, cc_typeName(cond), cc_getCost(cond));
|
||||
sprintf(out, "ni:///sha-256;%s?fpt=%s&cost=%lu",encoded, cc_typeName(cond), cc_getCost(cond));
|
||||
|
||||
if (cond->type->getSubtypes) {
|
||||
appendUriSubtypes(cond->type->getSubtypes(cond), out);
|
||||
|
||||
@@ -27,6 +27,7 @@ struct CCType CC_Ed25519Type;
|
||||
|
||||
static unsigned char *ed25519Fingerprint(const CC *cond) {
|
||||
Ed25519FingerprintContents_t *fp = calloc(1, sizeof(Ed25519FingerprintContents_t));
|
||||
fprintf(stderr,"ed25519 fingerprint %p %p\n",fp,cond->publicKey);
|
||||
OCTET_STRING_fromBuf(&fp->publicKey, cond->publicKey, 32);
|
||||
return hashFingerprintContents(&asn_DEF_Ed25519FingerprintContents, fp);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ struct CCType CC_EvalType;
|
||||
|
||||
static unsigned char *evalFingerprint(const CC *cond) {
|
||||
unsigned char *hash = calloc(1, 32);
|
||||
fprintf(stderr,"evalfingerprint %p %p\n",hash,cond->code);
|
||||
sha256(cond->code, cond->codeLength, hash);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ static int prefixVisitChildren(CC *cond, CCVisitor visitor) {
|
||||
|
||||
static unsigned char *prefixFingerprint(const CC *cond) {
|
||||
PrefixFingerprintContents_t *fp = calloc(1, sizeof(PrefixFingerprintContents_t));
|
||||
fprintf(stderr,"prefixfinger %p %p\n",fp,cond->prefix);
|
||||
asnCondition(cond->subcondition, &fp->subcondition); // TODO: check asnCondition for safety
|
||||
fp->maxMessageLength = cond->maxMessageLength;
|
||||
OCTET_STRING_fromBuf(&fp->prefix, cond->prefix, cond->prefixLength);
|
||||
|
||||
@@ -46,6 +46,7 @@ static unsigned long preimageCost(const CC *cond) {
|
||||
|
||||
static unsigned char *preimageFingerprint(const CC *cond) {
|
||||
unsigned char *hash = calloc(1, 32);
|
||||
fprintf(stderr,"preimage %p %p\n",hash,cond->preimage);
|
||||
sha256(cond->preimage, cond->preimageLength, hash);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ void initVerify() {
|
||||
|
||||
static unsigned char *secp256k1Fingerprint(const CC *cond) {
|
||||
Secp256k1FingerprintContents_t *fp = calloc(1, sizeof(Secp256k1FingerprintContents_t));
|
||||
fprintf(stderr,"secpfinger %p %p\n",fp,cond->publicKey);
|
||||
OCTET_STRING_fromBuf(&fp->publicKey, cond->publicKey, SECP256K1_PK_SIZE);
|
||||
return hashFingerprintContents(&asn_DEF_Secp256k1FingerprintContents, fp);
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ static int cmpConditionBin(const void *a, const void *b) {
|
||||
static unsigned char *thresholdFingerprint(const CC *cond) {
|
||||
/* Create fingerprint */
|
||||
ThresholdFingerprintContents_t *fp = calloc(1, sizeof(ThresholdFingerprintContents_t));
|
||||
fprintf(stderr,"thresholdfinger %p\n",fp);
|
||||
fp->threshold = cond->threshold;
|
||||
for (int i=0; i<cond->size; i++) {
|
||||
Condition_t *asnCond = asnConditionNew(cond->subconditions[i]);
|
||||
|
||||
Reference in New Issue
Block a user