@@ -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 _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 _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 _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 * modulus , void * mp , void * mu )
671+ static int _build_lut (int idx , 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 *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 * modulus , void * mp , int map )
778+ static int _accel_fp_mul (int idx , void * k , ecc_point * R , 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 *modulus, void *mp,
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 _accel_fp_mul2add (int idx1 , int idx2 ,
902902 void * kA , void * kB ,
903903 ecc_point * R , void * modulus , void * mp )
904904{
@@ -1119,13 +1119,13 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
11191119 mu = NULL ;
11201120 LTC_MUTEX_LOCK (& ltc_ecc_fp_lock );
11211121 /* find point */
1122- idx1 = find_base (A );
1122+ idx1 = _find_base (A );
11231123
11241124 /* no entry? */
11251125 if (idx1 == -1 ) {
11261126 /* find hole and add it */
1127- if ((idx1 = find_hole ()) >= 0 ) {
1128- if ((err = add_entry (idx1 , A )) != CRYPT_OK ) {
1127+ if ((idx1 = _find_hole ()) >= 0 ) {
1128+ if ((err = _add_entry (idx1 , A )) != CRYPT_OK ) {
11291129 goto LBL_ERR ;
11301130 }
11311131 }
@@ -1136,13 +1136,13 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
11361136 }
11371137
11381138 /* find point */
1139- idx2 = find_base (B );
1139+ idx2 = _find_base (B );
11401140
11411141 /* no entry? */
11421142 if (idx2 == -1 ) {
11431143 /* find hole and add it */
1144- if ((idx2 = find_hole ()) >= 0 ) {
1145- if ((err = add_entry (idx2 , B )) != CRYPT_OK ) {
1144+ if ((idx2 = _find_hole ()) >= 0 ) {
1145+ if ((err = _add_entry (idx2 , B )) != CRYPT_OK ) {
11461146 goto LBL_ERR ;
11471147 }
11481148 }
@@ -1166,7 +1166,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
11661166 }
11671167
11681168 /* build the LUT */
1169- if ((err = build_lut (idx1 , modulus , mp , mu )) != CRYPT_OK ) {
1169+ if ((err = _build_lut (idx1 , modulus , mp , mu )) != CRYPT_OK ) {
11701170 goto LBL_ERR ;;
11711171 }
11721172 }
@@ -1187,7 +1187,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
11871187 }
11881188
11891189 /* build the LUT */
1190- if ((err = build_lut (idx2 , modulus , mp , mu )) != CRYPT_OK ) {
1190+ if ((err = _build_lut (idx2 , modulus , mp , mu )) != CRYPT_OK ) {
11911191 goto LBL_ERR ;;
11921192 }
11931193 }
@@ -1198,7 +1198,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
11981198 /* compute mp */
11991199 if ((err = mp_montgomery_setup (modulus , & mp )) != CRYPT_OK ) { goto LBL_ERR ; }
12001200 }
1201- err = accel_fp_mul2add (idx1 , idx2 , kA , kB , C , modulus , mp );
1201+ err = _accel_fp_mul2add (idx1 , idx2 , kA , kB , C , modulus , mp );
12021202 } else {
12031203 err = ltc_ecc_mul2add (A , kA , B , kB , C , modulus );
12041204 }
@@ -1231,15 +1231,15 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int ma
12311231 mu = NULL ;
12321232 LTC_MUTEX_LOCK (& ltc_ecc_fp_lock );
12331233 /* find point */
1234- idx = find_base (G );
1234+ idx = _find_base (G );
12351235
12361236 /* no entry? */
12371237 if (idx == -1 ) {
12381238 /* find hole and add it */
1239- idx = find_hole ();
1239+ idx = _find_hole ();
12401240
12411241 if (idx >= 0 ) {
1242- if ((err = add_entry (idx , G )) != CRYPT_OK ) {
1242+ if ((err = _add_entry (idx , G )) != CRYPT_OK ) {
12431243 goto LBL_ERR ;
12441244 }
12451245 }
@@ -1264,7 +1264,7 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int ma
12641264 }
12651265
12661266 /* build the LUT */
1267- if ((err = build_lut (idx , modulus , mp , mu )) != CRYPT_OK ) {
1267+ if ((err = _build_lut (idx , modulus , mp , mu )) != CRYPT_OK ) {
12681268 goto LBL_ERR ;;
12691269 }
12701270 }
@@ -1274,7 +1274,7 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int ma
12741274 /* compute mp */
12751275 if ((err = mp_montgomery_setup (modulus , & mp )) != CRYPT_OK ) { goto LBL_ERR ; }
12761276 }
1277- err = accel_fp_mul (idx , k , R , modulus , mp , map );
1277+ err = _accel_fp_mul (idx , k , R , modulus , mp , map );
12781278 } else {
12791279 err = ltc_ecc_mulmod (k , G , R , modulus , map );
12801280 }
@@ -1290,7 +1290,7 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int ma
12901290}
12911291
12921292/* helper function for freeing the cache ... must be called with the cache mutex locked */
1293- static void ltc_ecc_fp_free_cache (void )
1293+ static void _ltc_ecc_fp_free_cache (void )
12941294{
12951295 unsigned x , y ;
12961296 for (x = 0 ; x < FP_ENTRIES ; x ++ ) {
@@ -1315,7 +1315,7 @@ static void ltc_ecc_fp_free_cache(void)
13151315void ltc_ecc_fp_free (void )
13161316{
13171317 LTC_MUTEX_LOCK (& ltc_ecc_fp_lock );
1318- ltc_ecc_fp_free_cache ();
1318+ _ltc_ecc_fp_free_cache ();
13191319 LTC_MUTEX_UNLOCK (& ltc_ecc_fp_lock );
13201320}
13211321
@@ -1334,19 +1334,19 @@ ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock)
13341334 void * mu = NULL ;
13351335
13361336 LTC_MUTEX_LOCK (& ltc_ecc_fp_lock );
1337- if ((idx = find_base (g )) >= 0 ) {
1337+ if ((idx = _find_base (g )) >= 0 ) {
13381338 /* it is already in the cache ... just check that the LUT is initialized */
13391339 if (fp_cache [idx ].lru_count >= 2 ) {
13401340 LTC_MUTEX_UNLOCK (& ltc_ecc_fp_lock );
13411341 return CRYPT_OK ;
13421342 }
13431343 }
13441344
1345- if (idx == -1 && (idx = find_hole ()) == -1 ) {
1345+ if (idx == -1 && (idx = _find_hole ()) == -1 ) {
13461346 err = CRYPT_BUFFER_OVERFLOW ;
13471347 goto LBL_ERR ;
13481348 }
1349- if ((err = add_entry (idx , g )) != CRYPT_OK ) {
1349+ if ((err = _add_entry (idx , g )) != CRYPT_OK ) {
13501350 goto LBL_ERR ;
13511351 }
13521352 /* compute mp */
@@ -1363,7 +1363,7 @@ ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock)
13631363 }
13641364
13651365 /* build the LUT */
1366- if ((err = build_lut (idx , modulus , mp , mu )) != CRYPT_OK ) {
1366+ if ((err = _build_lut (idx , modulus , mp , mu )) != CRYPT_OK ) {
13671367 goto LBL_ERR ;
13681368 }
13691369 fp_cache [idx ].lru_count = 2 ;
@@ -1501,7 +1501,7 @@ int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen)
15011501 /*
15021502 * start with an empty cache
15031503 */
1504- ltc_ecc_fp_free_cache ();
1504+ _ltc_ecc_fp_free_cache ();
15051505
15061506 /*
15071507 * decode the input packet: It consists of a sequence with a few
@@ -1571,7 +1571,7 @@ int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen)
15711571ERR_OUT :
15721572 if (asn1_list )
15731573 XFREE (asn1_list );
1574- ltc_ecc_fp_free_cache ();
1574+ _ltc_ecc_fp_free_cache ();
15751575 LTC_MUTEX_UNLOCK (& ltc_ecc_fp_lock );
15761576 return err ;
15771577}
0 commit comments