lopy4/components/hash-sigs-master/hss_derive.c
/* This creates a seed derivation object */
This creates a seed derivation object
This creates a seed derivation object
bool hss_seed_derive_init( struct seed_derive *derive,
                 param_set_t lm, param_set_t ots,
                 const unsigned char *I, const unsigned char *seed ) {
    derive->I = I;
    derive->master_seed = seed;
    unsigned height, p;
    if (!lm_look_up_parameter_set(lm, 0, 0, &height) ||
        !lm_ots_look_up_parameter_set(ots, 0, 0, 0, &p, 0)) {
        return false;
    }
    p += NUM_ARTIFICIAL_SEEDS; 
    derive->q_levels = (height + SECRET_MAX - 1)/SECRET_MAX;
    derive->r_mask = (merkle_index_t)1 << height;
    unsigned j_height = my_log2(p);
    derive->j_levels = (j_height + SECRET_MAX - 1)/SECRET_MAX;
    derive->j_mask = 1 << j_height;
    derive->q = derive->r_mask;
    return true;
}
bool hss_seed_derive_init ( struct seed_derive * derive , param_set_t lm , param_set_t ots , const unsigned char * I , const unsigned char * seed ) { derive -> I = I ; derive -> master_seed = seed ; unsigned height , p ; if ( ! lm_look_up_parameter_set ( lm , 0 , 0 , & height ) || ! lm_ots_look_up_parameter_set ( ots , 0 , 0 , 0 , & p , 0 ) ) { return false ; } p += NUM_ARTIFICIAL_SEEDS ; derive -> q_levels = ( height + SECRET_MAX - 1 ) / SECRET_MAX ; derive -> r_mask = ( merkle_index_t ) 1 << height ; unsigned j_height = my_log2 ( p ) ; derive -> j_levels = ( j_height + SECRET_MAX - 1 ) / SECRET_MAX ; derive -> j_mask = 1 << j_height ; derive -> q = derive -> r_mask ; return true ; }
This creates a seed derivation object
This creates a seed derivation object
/* These parameter sets will define the size of the trees we'll use */ /* We use one artifical value for the */ /* randomizer and two artificial values to generate seed, I */ /* for child trees */ /* Compute the number of r-levels we have */ /* And which bit to set when converting 'q' to 'r' */ /* Compute the number of j-levels we have */ /* And which bit to set when writing q values into the hash */ /* We reset the current 'q' value to am impossible value; we do this so */ /* that the initial 'q' value given to use by the application will */ /* rebuild the entire path through the tree */