kee

Offline IOU signer with QR as transport
git clone https://holbrook.no/src/kee
Info | Log | Files | Refs | README | LICENSE

commit 61c2d914e23bba50107a3d78db1c5124d5b79f7b
parent 7d864358931cb3d9c9e80bdd04afa182e548d339
Author: lash <dev@holbrook.no>
Date:   Tue, 30 Apr 2024 14:53:22 +0100

Implement full round-trip test for counter-signing

Diffstat:
Msrc/gpg.c | 1+
Msrc/ledger.c | 165+++++++++++++++++++++++++++++++++++--------------------------------------------
Msrc/ledger.h | 1-
Msrc/tests/ledger.c | 333++++++++-----------------------------------------------------------------------
Msrc/tests/testutil.c | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
Msrc/tests/testutil.h | 2++
6 files changed, 165 insertions(+), 401 deletions(-)

diff --git a/src/gpg.c b/src/gpg.c @@ -636,6 +636,7 @@ int gpg_store_sign_with(struct gpg_store *gpg, char *data, size_t data_len, cons return 0; } +/// \todo data input int gpg_store_verify(const char *sig_bytes, const char *digest, const char *pubkey_bytes) { gcry_mpi_t sig_r; gcry_mpi_t sig_s; diff --git a/src/ledger.c b/src/ledger.c @@ -17,7 +17,8 @@ char zero_content[64]; -static char *get_message_asn(struct kee_ledger_t *ledger, asn1_node item, char *out_digest, char *out_data, size_t *out_len) { +/// \todo consolidate with get_message_data +static char *get_message_asn(struct kee_ledger_t *ledger, asn1_node item, char *out_digest, char *out_data, size_t *out_len, enum kee_item_serialize_mode_e mode) { int r; size_t c; asn1_node root; @@ -38,22 +39,12 @@ static char *get_message_asn(struct kee_ledger_t *ledger, asn1_node item, char * return NULL; } - r = asn1_copy_node(root, "Kee.KeeEntry.signatureRequest", item, "signatureRequest"); + r = asn1_copy_node(root, "Kee.KeeEntry.response", item, "response"); if (r != ASN1_SUCCESS) { printf("%d (%s) %s\n", r, err, asn1_strerror(r)); return NULL; } - r = asn1_copy_node(root, "Kee.KeeEntry.response", item, "response"); - if (r != ASN1_SUCCESS) { - printf("%d (%s) %s\n", r, err, asn1_strerror(r)); - return NULL; - } -// -// r = asn1_copy_node(root, "Kee.KeeEntry.signatureResponse", item, "signatureResponse"); -// if (r != ASN1_SUCCESS) { -// printf("%d (%s) %s\n", r, err, asn1_strerror(r)); -// return NULL; -// } + r = asn1_copy_node(root, "Kee.KeeEntry.timestamp", item, "timestamp"); if (r != ASN1_SUCCESS) { @@ -78,7 +69,7 @@ static char *get_message_asn(struct kee_ledger_t *ledger, asn1_node item, char * printf("%d (%s) %s\n", r, err, asn1_strerror(r)); return NULL; } -// + // c = 64; // r = asn1_read_value(item, "signatureResponse", sig, (int*)&c); // if (r != ASN1_SUCCESS) { @@ -86,14 +77,35 @@ static char *get_message_asn(struct kee_ledger_t *ledger, asn1_node item, char * // return NULL; // } - buf[0] = 0; - c = 0; - r = asn1_write_value(root, "Kee.KeeEntry.signatureResponse", buf, c); - if (r != ASN1_SUCCESS) { - return NULL; + if (mode == KEE_LEDGER_ITEM_SERIALIZE_FINAL) { + r = asn1_copy_node(root, "Kee.KeeEntry.signatureResponse", item, "signatureResponse"); + if (r != ASN1_SUCCESS) { + printf("%d (%s) %s\n", r, err, asn1_strerror(r)); + return NULL; + } + } else { + buf[0] = 0; + c = 0; + r = asn1_write_value(root, "Kee.KeeEntry.signatureResponse", buf, c); + if (r != ASN1_SUCCESS) { + return NULL; + } } - memcpy(out_data, ledger->digest, 64); + if (mode > KEE_LEDGER_ITEM_SERIALIZE_REQUEST) { + r = asn1_copy_node(root, "Kee.KeeEntry.signatureRequest", item, "signatureRequest"); + if (r != ASN1_SUCCESS) { + printf("%d (%s) %s\n", r, err, asn1_strerror(r)); + return NULL; + } + } else { + buf[0] = 0; + c = 0; + r = asn1_write_value(root, "Kee.KeeEntry.signatureRequest", buf, c); + if (r != ASN1_SUCCESS) { + return NULL; + } + } r = asn1_der_coding(root, "Kee.KeeEntry", out_data+64, (int*)out_len, err); if (r != ASN1_SUCCESS) { @@ -101,13 +113,17 @@ static char *get_message_asn(struct kee_ledger_t *ledger, asn1_node item, char * return NULL; } + memcpy(out_data, ledger->digest, 64); *out_len += DIGEST_LENGTH; - r = calculate_digest_algo(out_data, *out_len, out_digest, GCRY_MD_SHA512); - if (r) { - return NULL; - } - return out_digest; + return out_data; + +// r = calculate_digest_algo(out_data, *out_len, out_digest, GCRY_MD_SHA512); +// if (r) { +// return NULL; +// } +// +// return out_digest; } // //static char *get_message_data(struct kee_ledger_t *ledger, const char *item_data, size_t item_data_len, char *out_digest) { @@ -129,12 +145,18 @@ static char *get_message_asn(struct kee_ledger_t *ledger, asn1_node item, char * //} -static int verify_item_data(struct kee_ledger_t *ledger, const char* item_data, const char *sig_data, const char *pubkey_data) { +/// \todo consolidate with verify_item_asn +static int verify_item_data(struct kee_ledger_t *ledger, const char* item_data, size_t item_data_len, const char *sig_data, const char *pubkey_data) { + char b[DIGEST_LENGTH]; int r; - size_t c; - if (c) { - r = gpg_store_verify(sig_data, item_data, pubkey_data); + if (item_data_len) { + r = calculate_digest_algo(item_data, item_data_len, b, GCRY_MD_SHA512); + if (r) { + return NULL; + } + + r = gpg_store_verify(sig_data, b, pubkey_data); if (r) { return 1; } @@ -213,17 +235,20 @@ static int verify_item_asn(struct kee_ledger_t *ledger, asn1_node item, const ch return 1; } - c = 1024; - p = get_message_asn(ledger, item, p, p+64, &c); - if (p == NULL) { - return 1; - } - if (c) { - return 0; + c = 1024; + p = get_message_asn(ledger, item, p, p+64, &c, KEE_LEDGER_ITEM_SERIALIZE_RESPONSE); + if (p == NULL) { + return 1; + } + + r = verify_item_data(ledger, p, c, sig_data, pubkey_last_data); + if (r) { + return 1; + } } - return verify_item_data(ledger, p, sig_data, pubkey_last_data); + return; } static int kee_ledger_digest(struct kee_ledger_t *ledger, char *out) { @@ -699,6 +724,7 @@ int kee_ledger_item_serialize(struct kee_ledger_item_t *item, char *out, size_t } +/// \todo remove external buffer int kee_ledger_sign(struct kee_ledger_t *ledger, struct kee_ledger_item_t *item, struct gpg_store *gpg, char *out, size_t *out_len, const char *passphrase) { int r; char *p; @@ -729,14 +755,6 @@ int kee_ledger_sign(struct kee_ledger_t *ledger, struct kee_ledger_item_t *item, l -= c; *out_len += c; -// r = kee_ledger_serialize(ledger, p, &c); -// if (r) { -// return ERR_FAIL; -// } -// p = out + c; -// l -= c; -// c = l; - c = l; r = kee_ledger_item_serialize(item, p, &c, mode); if (r) { @@ -753,45 +771,6 @@ int kee_ledger_sign(struct kee_ledger_t *ledger, struct kee_ledger_item_t *item, return ERR_OK; } -//int kee_ledger_serialize_pair() { -// int r; -// asn1_node root; -// asn1_node item; -// asn1_node entry; -// asn1_node pair; -// char err[1024]; -// -// memset(&root, 0, sizeof(root)); -// r = asn1_array2tree(schema_entry_asn1_tab, &root, err); -// if (r != ASN1_SUCCESS) { -// debug_log(DEBUG_ERROR, err); -// return ERR_FAIL; -// } -// -// r = asn1_create_element(root, "Kee.KeeEntryInit.KeeEntryHead", &entry); -// if (r != ASN1_SUCCESS) { -// return ERR_FAIL; -// } -// -// r = asn1_create_element(root, "Kee.KeeEntryInit.KeeEntryHead", &entry); -// if (r != ASN1_SUCCESS) { -// return ERR_FAIL; -// } -// -// r = asn1_create_element(root, "Kee.KeeEntryInit.KeeEntry", &item); -// if (r != ASN1_SUCCESS) { -// return ERR_FAIL; -// } -// -// c = strlen(ledger->uoa); -// r = asn1_write_value(node, "Kee.KeeEntryHead.uoa", ledger->uoa, c); -// if (r != ASN1_SUCCESS) { -// return ERR_FAIL; -// } -// -// return ERR_OK; -//} - int kee_ledger_serialize_open(struct kee_ledger_t *ledger, char *out, size_t *out_len) { int r; char err[1024]; @@ -1050,10 +1029,10 @@ static void get_authentication_params(struct kee_ledger_t *ledger, struct kee_le *sig_request = item->alice_signature; *sig_response = item->bob_signature; } - if (!memcmp(sig_request, zero_content, SIGNATURE_LENGTH)) { + if (!memcmp(*sig_request, zero_content, SIGNATURE_LENGTH)) { *sig_request = NULL; } - if (!memcmp(sig_response, zero_content, SIGNATURE_LENGTH)) { + if (!memcmp(*sig_response, zero_content, SIGNATURE_LENGTH)) { *sig_response = NULL; } } @@ -1077,7 +1056,7 @@ int kee_ledger_verify(struct kee_ledger_t *ledger, int *idx) { while (1) { get_authentication_params(ledger, item, &pubkey_request, &sig_request, &pubkey_response, &sig_response); - if (*sig_response == NULL) { + if (sig_response == NULL) { if (*idx > 0) { return ERR_FAIL; } @@ -1087,26 +1066,26 @@ int kee_ledger_verify(struct kee_ledger_t *ledger, int *idx) { if (r) { return ERR_FAIL; } - r = kee_ledger_item_digest(ledger, item, KEE_LEDGER_ITEM_SERIALIZE_RESPONSE, b); + r = kee_ledger_digest(ledger, b); if (r) { return ERR_FAIL; } - r = verify_item_data(ledger, b, sig_response, pubkey_response); + r = verify_item_data(ledger, b, c + DIGEST_LENGTH, sig_response, pubkey_response); if (r) { return ERR_FAIL; } } - if (*sig_request != NULL) { + if (sig_request != NULL) { c = 960; r = kee_ledger_item_serialize(item, ((char*)b)+DIGEST_LENGTH, &c, KEE_LEDGER_ITEM_SERIALIZE_REQUEST); if (r) { return ERR_FAIL; } - r = kee_ledger_item_digest(ledger, item, KEE_LEDGER_ITEM_SERIALIZE_REQUEST, b); + r = kee_ledger_digest(ledger, b); if (r) { return ERR_FAIL; } - r = verify_item_data(ledger, b, sig_response, pubkey_response); + r = verify_item_data(ledger, b, c + DIGEST_LENGTH, sig_request, pubkey_request); if (r) { return ERR_FAIL; } @@ -1115,7 +1094,7 @@ int kee_ledger_verify(struct kee_ledger_t *ledger, int *idx) { if (item == NULL) { break; } - *idx++; + *idx += 1; } return ERR_OK; } diff --git a/src/ledger.h b/src/ledger.h @@ -14,7 +14,6 @@ enum kee_initiator_e { }; enum kee_item_serialize_mode_e { - KEE_LEDGER_ITEM_SERIALIZE_AUTO, KEE_LEDGER_ITEM_SERIALIZE_REQUEST, KEE_LEDGER_ITEM_SERIALIZE_RESPONSE, KEE_LEDGER_ITEM_SERIALIZE_FINAL, diff --git a/src/tests/ledger.c b/src/tests/ledger.c @@ -25,299 +25,6 @@ int test_util() { return 0; } -/// \todo split up function (use util.c) -int test_sign() { - int r; - gcry_sexp_t alice; - gcry_sexp_t bob; - char alice_fingerprint[20]; - char *p; - char *out; - size_t out_len; - char *out_item; - size_t out_item_len; - struct gpg_store gpg; - struct kee_ledger_t ledger; - struct kee_ledger_item_t item; - struct kee_ledger_item_t *item_parsed; - struct kee_content_t content; - struct kee_content_t content_item; - char item_sum[64]; - const char *version; - char path[1024]; - - version = gcry_check_version(NULL); - if (version == 0x0) { - return 1; - } - gcry_control (GCRYCTL_DISABLE_SECMEM, 0); - gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); - - strcpy(path, "/tmp/keetest_key_XXXXXX"); - p = mkdtemp(path); - if (p == NULL) { - return 1; - } - - kee_ledger_init(&ledger); - - gpg_store_init(&gpg, p); - gpg.k = &alice; - r = gpg_key_create(&gpg, "1234"); // alice - if (r) { - return 1; - } - memcpy(ledger.pubkey_alice, gpg.public_key, PUBKEY_LENGTH); - memcpy(alice_fingerprint, gpg.fingerprint, FINGERPRINT_LENGTH); - - gpg_store_init(&gpg, p); - gpg.k = &bob; - r = gpg_key_create(&gpg, "1234"); // bob - if (r) { - return 1; - } - memcpy(ledger.pubkey_bob, gpg.public_key, PUBKEY_LENGTH); - - strcpy(ledger.uoa, "USD"); - ledger.uoa_decimals = 2; - - r = calculate_digest_algo(content_test, strlen(content_test), content.key, GCRY_MD_SHA512); - if (r) { - return 1; - } - r = kee_content_init(&content, content.key, 0); - if (r) { - return 1; - } - r = calculate_digest_algo(content_test, strlen(content_test), content.key, GCRY_MD_SHA512); - if (r) { - return 1; - } - - out_len = 1024*1024; - out = malloc(out_len); - r = kee_ledger_serialize(&ledger, out, &out_len); - if (r) { - return 1; - } - - r = calculate_digest_algo(out, out_len, ledger.digest, GCRY_MD_SHA512); - if (r) { - return 1; - } - - kee_ledger_item_init(&item); - item.alice_credit_delta = 666; - item.bob_credit_delta = -42; - item.alice_collateral_delta = 1024; - item.bob_collateral_delta = 2048; - r = clock_gettime(CLOCK_REALTIME, &item.time); - if (r) { - return 1; - } - item.initiator = BOB; - item.response = 1; - - r = calculate_digest_algo(content_test_item, strlen(content_test_item), content_item.key, GCRY_MD_SHA512); - if (r) { - return 1; - } - r = kee_content_init(&content_item, content_item.key, 0); - if (r) { - return 1; - } - r = calculate_digest_algo(content_test_item, strlen(content_test_item), content_item.key, GCRY_MD_SHA512); - if (r) { - return 1; - } - - out_item_len = 4096; - out_item = malloc(out_item_len); - r = kee_ledger_item_serialize(&item, out_item, &out_item_len, KEE_LEDGER_ITEM_SERIALIZE_REQUEST); - if (r) { - return 1; - } - r = calculate_digest_algo(out_item, out_item_len, item_sum, GCRY_MD_SHA512); - if (r) { - return 1; - } - r = gpg_store_sign(&gpg, out_item, out_item_len, "1234"); - if (r) { - return 1; - } - memcpy(item.bob_signature, gpg.last_signature, SIGNATURE_LENGTH); - r = gpg_store_verify(gpg.last_signature, item_sum, ledger.pubkey_bob); - if (r) { - return 1; - } - - gpg.k = &alice; - r = gpg_key_load(&gpg, "1234", KEE_GPG_FIND_FINGERPRINT, alice_fingerprint); - if (r) { - return 1; - } - - out_item_len = 1024; - r = kee_ledger_sign(&ledger, &item, &gpg, out_item, &out_item_len, "1234"); - if (r) { - return 1; - } - memcpy(item.alice_signature, gpg.last_signature, SIGNATURE_LENGTH); - r = calculate_digest_algo(out_item, out_item_len, item_sum, GCRY_MD_SHA512); - if (r) { - return 1; - } - r = gpg_store_verify(gpg.last_signature, item_sum, ledger.pubkey_alice); - if (r) { - return 1; - } - - out_item_len = 4096; - r = kee_ledger_item_serialize(&item, out_item, &out_item_len, KEE_LEDGER_ITEM_SERIALIZE_FINAL); - if (r) { - return 1; - } - *(out_item+out_item_len) = 1; - - item_parsed = kee_ledger_parse_item(&ledger, out_item, out_item_len + 1); - if (item_parsed == NULL) { - return 1; - } - - free(out_item); - free(out); - kee_content_free(&content_item); - kee_content_free(&content); - kee_ledger_free(&ledger); - - return 0; -} - -int test_alice() { - char *p; - int r; - const char *version; - struct kee_ledger_t ledger; - struct kee_ledger_item_t item; - struct gpg_store gpg; - gcry_sexp_t alice; - char path[1024]; - struct kee_content_t content; - struct kee_content_t content_item; - char item_sum[64]; - size_t out_len; - size_t out_item_len; - char *out; - char *out_item; - - version = gcry_check_version(NULL); - if (version == 0x0) { - return 1; - } - gcry_control (GCRYCTL_DISABLE_SECMEM, 0); - gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); - - strcpy(path, "/tmp/keetest_key_XXXXXX"); - p = mkdtemp(path); - if (p == NULL) { - return 1; - } - - kee_ledger_init(&ledger); - - gpg_store_init(&gpg, p); - gpg.k = &alice; - r = gpg_key_create(&gpg, "1234"); // alice - if (r) { - return 1; - } - memcpy(ledger.pubkey_alice, gpg.public_key, PUBKEY_LENGTH); - - r = calculate_digest_algo(content_test, strlen(content_test), content.key, GCRY_MD_SHA512); - if (r) { - return 1; - } - r = kee_content_init(&content, content.key, 0); - if (r) { - return 1; - } - r = calculate_digest_algo(content_test, strlen(content_test), content.key, GCRY_MD_SHA512); - if (r) { - return 1; - } - - out_len = 1024*1024; - out = malloc(out_len); - r = kee_ledger_serialize(&ledger, out, &out_len); - if (r) { - return 1; - } - - r = calculate_digest_algo(out, out_len, ledger.digest, GCRY_MD_SHA512); - if (r) { - return 1; - } - - kee_ledger_item_init(&item); - item.alice_credit_delta = 666; - item.bob_credit_delta = -42; - item.alice_collateral_delta = 1024; - item.bob_collateral_delta = 2048; - r = clock_gettime(CLOCK_REALTIME, &item.time); - if (r) { - return 1; - } - item.initiator = ALICE; - item.response = 0; - - r = calculate_digest_algo(content_test_item, strlen(content_test_item), content_item.key, GCRY_MD_SHA512); - if (r) { - return 1; - } - r = kee_content_init(&content_item, content_item.key, 0); - if (r) { - return 1; - } - r = calculate_digest_algo(content_test_item, strlen(content_test_item), content_item.key, GCRY_MD_SHA512); - if (r) { - return 1; - } - - out_item_len = 1024; - out_item = malloc(out_item_len); - r = kee_ledger_item_serialize(&item, out_item, &out_item_len, KEE_LEDGER_ITEM_SERIALIZE_REQUEST); - if (r) { - return 1; - } - r = calculate_digest_algo(out_item, out_item_len, item_sum, GCRY_MD_SHA512); - if (r) { - return 1; - } - - out_item_len = 1024; - r = kee_ledger_sign(&ledger, &item, &gpg, out_item, &out_item_len, "1234"); - if (r) { - return 1; - } - memcpy(item.alice_signature, gpg.last_signature, SIGNATURE_LENGTH); - r = calculate_digest_algo(out_item, out_item_len, item_sum, GCRY_MD_SHA512); - if (r) { - return 1; - } - r = gpg_store_verify(gpg.last_signature, item_sum, ledger.pubkey_alice); - if (r) { - return 1; - } - - free(out_item); - free(out); - kee_content_free(&content_item); - kee_content_free(&content); - kee_ledger_free(&ledger); - - return 0; -} - int test_parse() { int r; size_t c; @@ -431,6 +138,23 @@ int test_put() { return 0; } +int test_sign() { + int r; + struct kee_test_t t; + + r = kee_test_generate(&t); + if (r) { + return 1; + } + + r = kee_test_sign_request(&t); + if (r) { + return 1; + } + + return 0; +} + int test_verify() { int r; int i; @@ -441,13 +165,25 @@ int test_verify() { return 1; } + r = kee_test_sign_request(&t); + if (r) { + return 1; + } + + r = kee_ledger_verify(&t.ledger, &i); + if (r) { + return 1; + } + + r = kee_test_sign_response(&t); + if (r) { + return 1; + } + r = kee_ledger_verify(&t.ledger, &i); if (r) { return 1; } - //if (i != 0) { - // return 1; - //} return 0; } @@ -472,11 +208,6 @@ int main() { return i; } i++; - r = test_alice(); - if (r) { - return i; - } - i++; r = test_verify(); if (r) { return i; diff --git a/src/tests/testutil.c b/src/tests/testutil.c @@ -29,6 +29,58 @@ int kee_test_db(struct kee_test_t *t) { return 0; } +int kee_test_sign_request(struct kee_test_t *t) { + int r; + char b[1024]; + size_t c; + + c = 1024; + r = kee_ledger_sign(&t->ledger, t->ledger.last_item, &t->gpg, b, &c, "1234"); + if (r) { + return 1; + } + + return 0; +} + +int kee_test_sign_response(struct kee_test_t *t) { + int r; + char b[1024]; + size_t c; + struct kee_ledger_item_t item_swap; + + c = 1024; + t->gpg.k = &t->bob; + r = gpg_key_load(&t->gpg, "1234", KEE_GPG_FIND_FINGERPRINT, t->bob_fingerprint); + if (r) { + return 1; + } + + memcpy(&item_swap, t->ledger.last_item, sizeof(struct kee_ledger_item_t)); + + t->ledger.last_item->initiator = BOB; + t->ledger.last_item->bob_credit_delta = t->ledger.last_item->alice_credit_delta; + t->ledger.last_item->bob_collateral_delta = t->ledger.last_item->alice_collateral_delta; + memcpy(t->ledger.last_item->bob_signature, t->ledger.last_item->alice_signature, SIGNATURE_LENGTH); + memset(t->ledger.last_item->alice_signature, 0, SIGNATURE_LENGTH); + + r = kee_ledger_sign(&t->ledger, t->ledger.last_item, &t->gpg, b, &c, "1234"); + if (r) { + return 1; + } + memcpy(item_swap.bob_signature, t->gpg.last_signature, SIGNATURE_LENGTH); + memcpy(t->ledger.last_item, &item_swap, sizeof(struct kee_ledger_item_t)); + + t->gpg.k = &t->alice; + r = gpg_key_load(&t->gpg, "1234", KEE_GPG_FIND_FINGERPRINT, t->alice_fingerprint); + if (r) { + return 1; + } + + return 0; +} + + int kee_test_generate(struct kee_test_t *t) { int r; char *p; @@ -75,7 +127,7 @@ int kee_test_generate(struct kee_test_t *t) { return 1; } memcpy(t->ledger.pubkey_bob, t->gpg.public_key, PUBKEY_LENGTH); - memcpy(t->alice_fingerprint, t->gpg.fingerprint, FINGERPRINT_LENGTH); + memcpy(t->bob_fingerprint, t->gpg.fingerprint, FINGERPRINT_LENGTH); strcpy(t->ledger.uoa, "USD"); t->ledger.uoa_decimals = 2; @@ -88,10 +140,7 @@ int kee_test_generate(struct kee_test_t *t) { if (r) { return 1; } - r = calculate_digest_algo(content_test, strlen(content_test), t->content_ledger.key, GCRY_MD_SHA512); - if (r) { - return 1; - } + memcpy(&t->ledger.content, &t->content_ledger, sizeof(struct kee_content_t)); out_len = 1024; r = kee_ledger_serialize(&t->ledger, out, &out_len); @@ -126,7 +175,10 @@ int kee_test_generate(struct kee_test_t *t) { if (r) { return 1; } - r = calculate_digest_algo(content_test_item, strlen(content_test_item), content_item->key, GCRY_MD_SHA512); + memcpy(&item->content, content_item, sizeof(struct kee_content_t)); + + t->gpg.k = &t->alice; + r = gpg_key_load(&t->gpg, "1234", KEE_GPG_FIND_FINGERPRINT, t->alice_fingerprint); if (r) { return 1; } diff --git a/src/tests/testutil.h b/src/tests/testutil.h @@ -33,5 +33,7 @@ void kee_test_free(struct kee_test_t *t); size_t kee_test_get_ledger_data(struct kee_test_t *t, char **out); size_t kee_test_get_ledger_item_data(struct kee_test_t *t, int idx, char **out); int kee_test_db(struct kee_test_t *t); +int kee_test_sign_request(struct kee_test_t *t); +int kee_test_sign_response(struct kee_test_t *t); #endif