Update ip_string_to_bytes to cert_req version

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
Andrzej Kurek 2023-04-05 11:19:30 -04:00
parent a194904055
commit ed557930bb

View file

@ -216,17 +216,16 @@ struct options {
int format; /* format */ int format; /* format */
} opt; } opt;
static int ip_string_to_bytes(const char *str, uint8_t *bytes, int maxBytes) static void ip_string_to_bytes(const char *str, uint8_t *bytes, int maxBytes)
{ {
for (int i = 0; i < maxBytes; i++) { for (int i = 0; i < maxBytes; i++) {
bytes[i] = strtoul(str, NULL, 16); bytes[i] = (uint8_t) strtoul(str, NULL, 16);
str = strchr(str, '.'); str = strchr(str, '.');
if (str == NULL || *str == '\0') { if (str == NULL || *str == '\0') {
break; break;
} }
str++; str++;
} }
return 0;
} }
int write_certificate(mbedtls_x509write_cert *crt, const char *output_file, int write_certificate(mbedtls_x509write_cert *crt, const char *output_file,