@@ -572,7 +572,7 @@ static const struct {
572572};
573573
574574/* find a hole and free as required, return -1 if no hole found */
575- static int _find_hole (void )
575+ static int s_find_hole (void )
576576{
577577 unsigned x ;
578578 int y , z ;
@@ -608,7 +608,7 @@ static int _find_hole(void)
608608}
609609
610610/* determine if a base is already in the cache and if so, where */
611- static int _find_base (ecc_point * g )
611+ static int s_find_base (ecc_point * g )
612612{
613613 int x ;
614614 for (x = 0 ; x < FP_ENTRIES ; x ++ ) {
@@ -626,7 +626,7 @@ static int _find_base(ecc_point *g)
626626}
627627
628628/* add a new base to the cache */
629- static int _add_entry (int idx , ecc_point * g )
629+ static int s_add_entry (int idx , ecc_point * g )
630630{
631631 unsigned x , y ;
632632
@@ -668,7 +668,7 @@ static int _add_entry(int idx, ecc_point *g)
668668 * The algorithm builds patterns in increasing bit order by first making all
669669 * single bit input patterns, then all two bit input patterns and so on
670670 */
671- static int _build_lut (int idx , void * a , void * modulus , void * mp , void * mu )
671+ static int s_build_lut (int idx , void * a , void * modulus , void * mp , void * mu )
672672{
673673 unsigned x , y , err , bitlen , lut_gap ;
674674 void * tmp ;
@@ -775,7 +775,7 @@ static int _build_lut(int idx, void *a, void *modulus, void *mp, void *mu)
775775}
776776
777777/* perform a fixed point ECC mulmod */
778- static int _accel_fp_mul (int idx , void * k , ecc_point * R , void * a , void * modulus , void * mp , int map )
778+ static int s_accel_fp_mul (int idx , void * k , ecc_point * R , void * a , void * modulus , void * mp , int map )
779779{
780780 unsigned char kb [128 ];
781781 int x ;
@@ -898,7 +898,7 @@ static int _accel_fp_mul(int idx, void *k, ecc_point *R, void *a, void *modulus,
898898
899899#ifdef LTC_ECC_SHAMIR
900900/* perform a fixed point ECC mulmod */
901- static int _accel_fp_mul2add (int idx1 , int idx2 ,
901+ static int ss_accel_fp_mul2add (int idx1 , int idx2 ,
902902 void * kA , void * kB ,
903903 ecc_point * R , void * a , void * modulus , void * mp )
904904{
@@ -1121,13 +1121,13 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
11211121 mu = NULL ;
11221122 LTC_MUTEX_LOCK (& ltc_ecc_fp_lock );
11231123 /* find point */
1124- idx1 = _find_base (A );
1124+ idx1 = s_find_base (A );
11251125
11261126 /* no entry? */
11271127 if (idx1 == -1 ) {
11281128 /* find hole and add it */
1129- if ((idx1 = _find_hole ()) >= 0 ) {
1130- if ((err = _add_entry (idx1 , A )) != CRYPT_OK ) {
1129+ if ((idx1 = s_find_hole ()) >= 0 ) {
1130+ if ((err = s_add_entry (idx1 , A )) != CRYPT_OK ) {
11311131 goto LBL_ERR ;
11321132 }
11331133 }
@@ -1138,13 +1138,13 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
11381138 }
11391139
11401140 /* find point */
1141- idx2 = _find_base (B );
1141+ idx2 = s_find_base (B );
11421142
11431143 /* no entry? */
11441144 if (idx2 == -1 ) {
11451145 /* find hole and add it */
1146- if ((idx2 = _find_hole ()) >= 0 ) {
1147- if ((err = _add_entry (idx2 , B )) != CRYPT_OK ) {
1146+ if ((idx2 = s_find_hole ()) >= 0 ) {
1147+ if ((err = s_add_entry (idx2 , B )) != CRYPT_OK ) {
11481148 goto LBL_ERR ;
11491149 }
11501150 }
@@ -1168,7 +1168,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
11681168 }
11691169
11701170 /* build the LUT */
1171- if ((err = _build_lut (idx1 , a , modulus , mp , mu )) != CRYPT_OK ) {
1171+ if ((err = s_build_lut (idx1 , a , modulus , mp , mu )) != CRYPT_OK ) {
11721172 goto LBL_ERR ;;
11731173 }
11741174 }
@@ -1189,7 +1189,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
11891189 }
11901190
11911191 /* build the LUT */
1192- if ((err = _build_lut (idx2 , a , modulus , mp , mu )) != CRYPT_OK ) {
1192+ if ((err = s_build_lut (idx2 , a , modulus , mp , mu )) != CRYPT_OK ) {
11931193 goto LBL_ERR ;;
11941194 }
11951195 }
@@ -1200,7 +1200,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
12001200 /* compute mp */
12011201 if ((err = mp_montgomery_setup (modulus , & mp )) != CRYPT_OK ) { goto LBL_ERR ; }
12021202 }
1203- err = _accel_fp_mul2add (idx1 , idx2 , kA , kB , C , a , modulus , mp );
1203+ err = ss_accel_fp_mul2add (idx1 , idx2 , kA , kB , C , a , modulus , mp );
12041204 } else {
12051205 err = ltc_ecc_mul2add (A , kA , B , kB , C , a , modulus );
12061206 }
@@ -1234,15 +1234,15 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulu
12341234 mu = NULL ;
12351235 LTC_MUTEX_LOCK (& ltc_ecc_fp_lock );
12361236 /* find point */
1237- idx = _find_base (G );
1237+ idx = s_find_base (G );
12381238
12391239 /* no entry? */
12401240 if (idx == -1 ) {
12411241 /* find hole and add it */
1242- idx = _find_hole ();
1242+ idx = s_find_hole ();
12431243
12441244 if (idx >= 0 ) {
1245- if ((err = _add_entry (idx , G )) != CRYPT_OK ) {
1245+ if ((err = s_add_entry (idx , G )) != CRYPT_OK ) {
12461246 goto LBL_ERR ;
12471247 }
12481248 }
@@ -1267,7 +1267,7 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulu
12671267 }
12681268
12691269 /* build the LUT */
1270- if ((err = _build_lut (idx , a , modulus , mp , mu )) != CRYPT_OK ) {
1270+ if ((err = s_build_lut (idx , a , modulus , mp , mu )) != CRYPT_OK ) {
12711271 goto LBL_ERR ;;
12721272 }
12731273 }
@@ -1277,7 +1277,7 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulu
12771277 /* compute mp */
12781278 if ((err = mp_montgomery_setup (modulus , & mp )) != CRYPT_OK ) { goto LBL_ERR ; }
12791279 }
1280- err = _accel_fp_mul (idx , k , R , a , modulus , mp , map );
1280+ err = s_accel_fp_mul (idx , k , R , a , modulus , mp , map );
12811281 } else {
12821282 err = ltc_ecc_mulmod (k , G , R , a , modulus , map );
12831283 }
@@ -1293,7 +1293,7 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulu
12931293}
12941294
12951295/* helper function for freeing the cache ... must be called with the cache mutex locked */
1296- static void _ltc_ecc_fp_free_cache (void )
1296+ static void s_ltc_ecc_fp_free_cache (void )
12971297{
12981298 unsigned x , y ;
12991299 for (x = 0 ; x < FP_ENTRIES ; x ++ ) {
@@ -1318,7 +1318,7 @@ static void _ltc_ecc_fp_free_cache(void)
13181318void ltc_ecc_fp_free (void )
13191319{
13201320 LTC_MUTEX_LOCK (& ltc_ecc_fp_lock );
1321- _ltc_ecc_fp_free_cache ();
1321+ s_ltc_ecc_fp_free_cache ();
13221322 LTC_MUTEX_UNLOCK (& ltc_ecc_fp_lock );
13231323}
13241324
@@ -1337,19 +1337,19 @@ ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock)
13371337 void * mu = NULL ;
13381338
13391339 LTC_MUTEX_LOCK (& ltc_ecc_fp_lock );
1340- if ((idx = _find_base (g )) >= 0 ) {
1340+ if ((idx = s_find_base (g )) >= 0 ) {
13411341 /* it is already in the cache ... just check that the LUT is initialized */
13421342 if (fp_cache [idx ].lru_count >= 2 ) {
13431343 LTC_MUTEX_UNLOCK (& ltc_ecc_fp_lock );
13441344 return CRYPT_OK ;
13451345 }
13461346 }
13471347
1348- if (idx == -1 && (idx = _find_hole ()) == -1 ) {
1348+ if (idx == -1 && (idx = s_find_hole ()) == -1 ) {
13491349 err = CRYPT_BUFFER_OVERFLOW ;
13501350 goto LBL_ERR ;
13511351 }
1352- if ((err = _add_entry (idx , g )) != CRYPT_OK ) {
1352+ if ((err = s_add_entry (idx , g )) != CRYPT_OK ) {
13531353 goto LBL_ERR ;
13541354 }
13551355 /* compute mp */
@@ -1366,7 +1366,7 @@ ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock)
13661366 }
13671367
13681368 /* build the LUT */
1369- if ((err = _build_lut (idx , a , modulus , mp , mu )) != CRYPT_OK ) {
1369+ if ((err = s_build_lut (idx , a , modulus , mp , mu )) != CRYPT_OK ) {
13701370 goto LBL_ERR ;
13711371 }
13721372 fp_cache [idx ].lru_count = 2 ;
@@ -1504,7 +1504,7 @@ int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen)
15041504 /*
15051505 * start with an empty cache
15061506 */
1507- _ltc_ecc_fp_free_cache ();
1507+ s_ltc_ecc_fp_free_cache ();
15081508
15091509 /*
15101510 * decode the input packet: It consists of a sequence with a few
@@ -1574,7 +1574,7 @@ int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen)
15741574ERR_OUT :
15751575 if (asn1_list )
15761576 XFREE (asn1_list );
1577- _ltc_ecc_fp_free_cache ();
1577+ s_ltc_ecc_fp_free_cache ();
15781578 LTC_MUTEX_UNLOCK (& ltc_ecc_fp_lock );
15791579 return err ;
15801580}
0 commit comments