lopy4/components/hash-sigs-master/lm_common.c
/*
 * Internal utility to convert encoded parameter sets into what they represent
 */
Internal utility to convert encoded parameter sets into what they represent
Internal utility to convert encoded parameter sets into what they represent
bool lm_look_up_parameter_set(param_set_t parameter_set,
     unsigned *h, unsigned *n, unsigned *height) {
    unsigned v_h, v_n, v_height;
    switch (parameter_set) {
    case LMS_SHA256_N32_H5:
        v_h = HASH_SHA256; v_n = 32; v_height = 5; break;
    case LMS_SHA256_N32_H10:
        v_h = HASH_SHA256; v_n = 32; v_height = 10; break;
    case LMS_SHA256_N32_H15:
        v_h = HASH_SHA256; v_n = 32; v_height = 15; break;
    case LMS_SHA256_N32_H20:
        v_h = HASH_SHA256; v_n = 32; v_height = 20; break;
    case LMS_SHA256_N32_H25:
        v_h = HASH_SHA256; v_n = 32; v_height = 25; break;
    default: return false;
    }
    if (h) *h = v_h;
    if (n) *n = v_n;
    if (height) *height = v_height;
    return true;
}
bool lm_look_up_parameter_set ( param_set_t parameter_set , unsigned * h , unsigned * n , unsigned * height ) { unsigned v_h , v_n , v_height ; switch ( parameter_set ) { case LMS_SHA256_N32_H5 : v_h = HASH_SHA256 ; v_n = 32 ; v_height = 5 ; break ; case LMS_SHA256_N32_H10 : v_h = HASH_SHA256 ; v_n = 32 ; v_height = 10 ; break ; case LMS_SHA256_N32_H15 : v_h = HASH_SHA256 ; v_n = 32 ; v_height = 15 ; break ; case LMS_SHA256_N32_H20 : v_h = HASH_SHA256 ; v_n = 32 ; v_height = 20 ; break ; case LMS_SHA256_N32_H25 : v_h = HASH_SHA256 ; v_n = 32 ; v_height = 25 ; break ; default : return false ; } if ( h ) * h = v_h ; if ( n ) * n = v_n ; if ( height ) * height = v_height ; return true ; }
Internal utility to convert encoded parameter sets into what they represent
Internal utility to convert encoded parameter sets into what they represent