lopy4/components/hash-sigs-master/hss_compute.c
/*
 * This computes an array of intermediate Merkle nodes given by data
 * This may be run in a worker (non-main) thread
 */
This computes an array of intermediate Merkle nodes given by data
This may be run in a worker (non-main) thread
This computes an array of intermediate Merkle nodes given by data This may be run in a worker ( non - main ) thread
void hss_gen_intermediate_tree(const void *data,
                               struct thread_collection *col) {
    const struct intermed_tree_detail *d = data;
    unsigned hash_len = hss_hash_length(d->h);
    unsigned i;
    for (i=0; i<d->node_count; i++) {
        unsigned char result[ MAX_HASH ];
        enum hss_error_code status = hss_compute_internal_node( result,
                            d->node_num + i, 
                            d->seed,
                            d->lm_type,
                            d->lm_ots_type,
                            d->h,
                            d->tree_height,
                            d->I);
        hss_thread_before_write(col);
        if (status == hss_error_none) {
            memcpy( d->dest + i*hash_len, result, hash_len );
        } else {
            *d->got_error = status;
            hss_thread_after_write(col);  
            return;
        }
        hss_thread_after_write(col);
    }
}
void hss_gen_intermediate_tree ( const void * data , struct thread_collection * col ) { const struct intermed_tree_detail * d = data ; unsigned hash_len = hss_hash_length ( d -> h ) ; unsigned i ; for ( i = 0 ; i < d -> node_count ; i ++ ) { unsigned char result [ MAX_HASH ] ; enum hss_error_code status = hss_compute_internal_node ( result , d -> node_num + i , d -> seed , d -> lm_type , d -> lm_ots_type , d -> h , d -> tree_height , d -> I ) ; hss_thread_before_write ( col ) ; if ( status == hss_error_none ) { memcpy ( d -> dest + i * hash_len , result , hash_len ) ; } else { * d -> got_error = status ; hss_thread_after_write ( col ) ; return ; } hss_thread_after_write ( col ) ; } }
This computes an array of intermediate Merkle nodes given by data
 This may be run in a worker (non-main) thread
This computes an array of intermediate Merkle nodes given by data This may be run in a worker ( non - main ) thread
/* Report the results */ /* Copy out the resulting hash */ /* Something went wrong; report the bad news */ /* No point in working more */