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