Adapt UI to abstract from core functions

This commit is contained in:
Joost Rijneveld 2017-10-26 14:24:10 +02:00
förälder 3c802756aa
incheckning dd1ae2a6aa
Ingen känd nyckel hittad för denna signaturen i databasen
GPG-nyckel ID: A4FE39CF49CBC553
2 ändrade filer med 17 tillägg och 13 borttagningar

Visa fil

@ -1,15 +1,15 @@
#include "../params.h"
#include "../xmss_core.h"
#include "../xmss.h"
#include <stdio.h>
#define MLEN 32
#ifdef XMSSMT
#define XMSS_PARSE_OID xmssmt_parse_oid
#define XMSS_CORE_SIGN_OPEN xmssmt_core_sign_open
#define XMSS_SIGN_OPEN xmssmt_sign_open
#else
#define XMSS_PARSE_OID xmss_parse_oid
#define XMSS_CORE_SIGN_OPEN xmss_core_sign_open
#define XMSS_SIGN_OPEN xmss_sign_open
#endif
int main(int argc, char **argv) {
@ -34,15 +34,16 @@ int main(int argc, char **argv) {
fread(&oid, 1, XMSS_OID_LEN, keypair);
XMSS_PARSE_OID(&params, oid);
unsigned char pk[params.pk_bytes];
unsigned char pk[XMSS_OID_LEN + params.pk_bytes];
unsigned char sm[params.sig_bytes + MLEN];
unsigned char m[params.sig_bytes + MLEN];
unsigned long long mlen;
fread(pk, 1, params.pk_bytes, keypair);
fseek(keypair, 0, SEEK_SET);
fread(pk, 1, XMSS_OID_LEN + params.pk_bytes, keypair);
fread(sm, 1, params.sig_bytes + MLEN, stdin);
ret = XMSS_CORE_SIGN_OPEN(&params, m, &mlen, sm, params.sig_bytes + MLEN, pk);
ret = XMSS_SIGN_OPEN(m, &mlen, sm, params.sig_bytes + MLEN, pk);
if (ret) {
printf("Verification failed!\n");

Visa fil

@ -1,15 +1,15 @@
#include "../params.h"
#include "../xmss_core.h"
#include "../xmss.h"
#include <stdio.h>
#define MLEN 32
#ifdef XMSSMT
#define XMSS_PARSE_OID xmssmt_parse_oid
#define XMSS_CORE_SIGN xmssmt_core_sign
#define XMSS_SIGN xmssmt_sign
#else
#define XMSS_PARSE_OID xmss_parse_oid
#define XMSS_CORE_SIGN xmss_core_sign
#define XMSS_SIGN xmss_sign
#endif
int main(int argc, char **argv) {
@ -42,17 +42,20 @@ int main(int argc, char **argv) {
fread(&oid_sk, 1, XMSS_OID_LEN, keypair);
XMSS_PARSE_OID(&params, oid_sk);
unsigned char sk[params.sk_bytes];
unsigned char sk[XMSS_OID_LEN + params.sk_bytes];
unsigned char m[MLEN];
unsigned char sm[params.sig_bytes + MLEN];
unsigned long long smlen;
fread(sk, 1, params.sk_bytes, keypair);
/* fseek back to start of sk. */
fseek(keypair, -((long int)XMSS_OID_LEN), SEEK_CUR);
fread(sk, 1, XMSS_OID_LEN + params.sk_bytes, keypair);
fread(m, 1, MLEN, stdin);
XMSS_CORE_SIGN(&params, sk, sm, &smlen, m, MLEN);
XMSS_SIGN(sk, sm, &smlen, m, MLEN);
fseek(keypair, -((long int)params.sk_bytes), SEEK_CUR);
fwrite(sk, 1, params.sk_bytes, keypair);
fwrite(sk + XMSS_OID_LEN, 1, params.sk_bytes, keypair);
fwrite(sm, 1, params.sig_bytes + MLEN, stdout);
fclose(keypair);