From 342dc1c50cedad89f6c820ebe4eb819c19e9e47d Mon Sep 17 00:00:00 2001 From: Joost Rijneveld Date: Thu, 26 Oct 2017 12:10:17 +0200 Subject: [PATCH] Clean up xmss_core header file --- xmss_core.h | 61 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/xmss_core.h b/xmss_core.h index 3308cae..e670dd8 100644 --- a/xmss_core.h +++ b/xmss_core.h @@ -3,45 +3,56 @@ #include "params.h" -/** +/* * Generates a XMSS key pair for a given parameter set. - * Format sk: [(32bit) idx || SK_SEED || SK_PRF || PUB_SEED || root] - * Format pk: [root || PUB_SEED] omitting algo oid. + * Format sk: [(32bit) index || SK_SEED || SK_PRF || PUB_SEED || root] + * Format pk: [root || PUB_SEED], omitting algorithm OID. */ -int xmss_core_keypair(const xmss_params *params, unsigned char *pk, unsigned char *sk); +int xmss_core_keypair(const xmss_params *params, + unsigned char *pk, unsigned char *sk); + /** - * Signs a message. - * Returns - * 1. an array containing the signature followed by the message AND - * 2. an updated secret key! + * Signs a message. Returns an array containing the signature followed by the + * message and an updated secret key. */ -int xmss_core_sign(const xmss_params *params, unsigned char *sk, unsigned char *sig_msg, unsigned long long *sig_msg_len, const unsigned char *msg, unsigned long long msglen); +int xmss_core_sign(const xmss_params *params, + unsigned char *sk, + unsigned char *sm, unsigned long long *smlen, + const unsigned char *m, unsigned long long mlen); + /** * Verifies a given message signature pair under a given public key. - * - * Note: msg and msglen are pure outputs which carry the message in case - * verification succeeds. The (input) message is assumed to be within sig_msg - * which has the form (sig||msg). + * Note that this assumes a pk without an OID, i.e. [root || PUB_SEED] */ -int xmss_core_sign_open(const xmss_params *params, unsigned char *msg, unsigned long long *msglen, const unsigned char *sig_msg, unsigned long long sig_msg_len, const unsigned char *pk); +int xmss_core_sign_open(const xmss_params *params, + unsigned char *m, unsigned long long *mlen, + const unsigned char *sm, unsigned long long smlen, + const unsigned char *pk); /* * Generates a XMSSMT key pair for a given parameter set. - * Format sk: [(ceil(h/8) bit) idx || SK_SEED || SK_PRF || PUB_SEED || root] - * Format pk: [root || PUB_SEED] omitting algo oid. + * Format sk: [(ceil(h/8) bit) index || SK_SEED || SK_PRF || PUB_SEED] + * Format pk: [root || PUB_SEED] omitting algorithm OID. */ -int xmssmt_core_keypair(const xmss_params *params, unsigned char *pk, unsigned char *sk); +int xmssmt_core_keypair(const xmss_params *params, + unsigned char *pk, unsigned char *sk); + /** - * Signs a message. - * Returns - * 1. an array containing the signature followed by the message AND - * 2. an updated secret key! - * + * Signs a message. Returns an array containing the signature followed by the + * message and an updated secret key. */ -int xmssmt_core_sign(const xmss_params *params, unsigned char *sk, unsigned char *sig_msg, unsigned long long *sig_msg_len, const unsigned char *msg, unsigned long long msglen); +int xmssmt_core_sign(const xmss_params *params, + unsigned char *sk, + unsigned char *sm, unsigned long long *smlen, + const unsigned char *m, unsigned long long mlen); + /** * Verifies a given message signature pair under a given public key. + * Note that this assumes a pk without an OID, i.e. [root || PUB_SEED] */ -int xmssmt_core_sign_open(const xmss_params *params, unsigned char *msg, unsigned long long *msglen, const unsigned char *sig_msg, unsigned long long sig_msg_len, const unsigned char *pk); -#endif +int xmssmt_core_sign_open(const xmss_params *params, + unsigned char *m, unsigned long long *mlen, + const unsigned char *sm, unsigned long long smlen, + const unsigned char *pk); +#endif