From 9d2507c81dae277e5f82abf85c8de01a3bef9973 Mon Sep 17 00:00:00 2001 From: Agathiyan Bragadeesh Date: Mon, 24 Jul 2023 16:35:57 +0100 Subject: [PATCH] Rename x509_int_to_hexdigit to nibble_to_hex_digit Signed-off-by: Agathiyan Bragadeesh --- library/x509.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/x509.c b/library/x509.c index 5025d774b4..b8a866ac38 100644 --- a/library/x509.c +++ b/library/x509.c @@ -810,8 +810,7 @@ int mbedtls_x509_get_ext(unsigned char **p, const unsigned char *end, return 0; } -/* Converts only the 4 least significant bits */ -static char x509_int_to_hexdigit(int i) +static char nibble_to_hex_digit(int i) { 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++] = '\\'; char lowbits = (c & 0x0F); char highbits = c>>4; - s[j++] = x509_int_to_hexdigit(highbits); - s[j] = x509_int_to_hexdigit(lowbits); + s[j++] = nibble_to_hex_digit(highbits); + s[j] = nibble_to_hex_digit(lowbits); } else { s[j] = c; }