lopy4/components/hash-sigs-master/hss_verify_inc.c
/* We've added all the pieces of the messages, now do the validation */
We've added all the pieces of the messages, now do the validation
We ' ve added all the pieces of the messages now do the validation
bool hss_validate_signature_finalize(
    struct hss_validate_inc *ctx,
    const unsigned char *signature,
    struct hss_extra_info *info) {
    struct hss_extra_info temp_info = { 0 };
    if (!info) info = &temp_info;
    if (!ctx) {
        info->error_code = hss_error_got_null;
        return false;
    }
    if (ctx->status != hss_error_none) {
        info->error_code = ctx->status;
        return false;
    }
    ctx->status = hss_error_ctx_already_used;
    unsigned char hash[ MAX_HASH ];
    unsigned h = ctx->h;
    hss_finalize_hash_context( h, &ctx->hash_ctx, hash );
    if (lm_validate_signature(
            ctx->final_public_key,
            hash, sizeof hash, true,
            signature + ctx->signature_offset, ctx->signature_len)) {
        return true;
    }
    info->error_code = hss_error_bad_signature;
    return false;
}
bool hss_validate_signature_finalize ( struct hss_validate_inc * ctx , const unsigned char * signature , struct hss_extra_info * info ) { struct hss_extra_info temp_info = { 0 } ; if ( ! info ) info = & temp_info ; if ( ! ctx ) { info -> error_code = hss_error_got_null ; return false ; } if ( ctx -> status != hss_error_none ) { info -> error_code = ctx -> status ; return false ; } ctx -> status = hss_error_ctx_already_used ; unsigned char hash [ MAX_HASH ] ; unsigned h = ctx -> h ; hss_finalize_hash_context ( h , & ctx -> hash_ctx , hash ) ; if ( lm_validate_signature ( ctx -> final_public_key , hash , sizeof hash , true , signature + ctx -> signature_offset , ctx -> signature_len ) ) { return true ; } info -> error_code = hss_error_bad_signature ; return false ; }
We've added all the pieces of the messages, now do the validation
We ' ve added all the pieces of the messages now do the validation
/* Success or fail, we can't use the context any more */ /* Generate the final hash */ /* It passes iff the final signature validates */