base64: remove a timing variation
This commit is contained in:
@@ -45,7 +45,12 @@ static unsigned char base64_char_to_sixbit(char c)
|
|||||||
* Yes, this is slow. But it's also very simple, and easy to verify.
|
* Yes, this is slow. But it's also very simple, and easy to verify.
|
||||||
* We don't need performance here.
|
* We don't need performance here.
|
||||||
*/
|
*/
|
||||||
const char *match = strchr(table, c);
|
const char *match = NULL;
|
||||||
|
for ( const char *search = table; *search; search++ ) {
|
||||||
|
if ( *search == c ) {
|
||||||
|
match = search;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ( !match ) {
|
if ( !match ) {
|
||||||
return 0xff;
|
return 0xff;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user