1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-07 06:42:56 +03:00

Rename x509_int_to_hexdigit to nibble_to_hex_digit

Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
This commit is contained in:
Agathiyan Bragadeesh
2023-07-24 16:35:57 +01:00
parent dba8a641fe
commit 9d2507c81d

View File

@@ -810,8 +810,7 @@ int mbedtls_x509_get_ext(unsigned char **p, const unsigned char *end,
return 0; return 0;
} }
/* Converts only the 4 least significant bits */ static char nibble_to_hex_digit(int i)
static char x509_int_to_hexdigit(int i)
{ {
return (i < 10) ? (i | 0x30) : ((i - 9) | 0x40); return (i < 10) ? (i | 0x30) : ((i - 9) | 0x40);
} }
@@ -879,8 +878,8 @@ int mbedtls_x509_dn_gets(char *buf, size_t size, const mbedtls_x509_name *dn)
s[j++] = '\\'; s[j++] = '\\';
char lowbits = (c & 0x0F); char lowbits = (c & 0x0F);
char highbits = c>>4; char highbits = c>>4;
s[j++] = x509_int_to_hexdigit(highbits); s[j++] = nibble_to_hex_digit(highbits);
s[j] = x509_int_to_hexdigit(lowbits); s[j] = nibble_to_hex_digit(lowbits);
} else { } else {
s[j] = c; s[j] = c;
} }