#include <stdint.h>
#include "common_defs.h"
#include "hss_common.h"
#include "lm_common.h"
#include "config.h"
size_t hss_get_public_key_len(unsigned levels,
const param_set_t *lm_type,
const param_set_t *lm_ots_type) {
LMS_UNUSED(lm_ots_type);
if (levels < MIN_HSS_LEVELS || levels > MAX_HSS_LEVELS) return 0;
size_t first_pubkey = lm_get_public_key_len(lm_type[0]);
if (first_pubkey == 0) return 0;
return 4 + first_pubkey;
}
size_t hss_get_signature_len(unsigned levels,
const param_set_t *lm_type,
const param_set_t *lm_ots_type) {
if (levels < MIN_HSS_LEVELS || levels > MAX_HSS_LEVELS) return 0;
unsigned i;
size_t tot_len = 4;
for (i=0; i<levels; i++) {
size_t next_sig_len = lm_get_signature_len(lm_type[i], lm_ots_type[i]);
if (next_sig_len == 0) return 0;
tot_len += next_sig_len;
if (i > 0) {
size_t next_pub_len = lm_get_public_key_len(lm_type[i]);
if (next_pub_len == 0) return 0;
tot_len += next_pub_len;
}
}
return tot_len;
}