Use a block to save 12b

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-10-12 16:55:23 +01:00
parent 351a81c65d
commit 584c8108b3

View file

@ -218,8 +218,6 @@ static int parse_attribute_value_hex_der_encoded(const char *s,
size_t *data_len,
int *tag)
{
unsigned char *p;
/* Step 1: preliminary length checks. */
/* Each byte is encoded by exactly two hexadecimal digits. */
if (len % 2 != 0) {
@ -256,7 +254,8 @@ static int parse_attribute_value_hex_der_encoded(const char *s,
/* Step 3: decode the DER. */
/* We've checked that der_length >= 1 above. */
*tag = der[0];
p = der + 1;
{
unsigned char *p = der + 1;
if (mbedtls_asn1_get_len(&p, der + der_length, data_len) != 0) {
goto error;
}
@ -281,6 +280,7 @@ static int parse_attribute_value_hex_der_encoded(const char *s,
goto error;
}
memcpy(data, p, *data_len);
}
mbedtls_free(der);
return 0;