Keep initialisation of p in its original location
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
bcb1818e19
commit
351a81c65d
1 changed files with 3 additions and 2 deletions
|
@ -218,6 +218,8 @@ static int parse_attribute_value_hex_der_encoded(const char *s,
|
||||||
size_t *data_len,
|
size_t *data_len,
|
||||||
int *tag)
|
int *tag)
|
||||||
{
|
{
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
/* Step 1: preliminary length checks. */
|
/* Step 1: preliminary length checks. */
|
||||||
/* Each byte is encoded by exactly two hexadecimal digits. */
|
/* Each byte is encoded by exactly two hexadecimal digits. */
|
||||||
if (len % 2 != 0) {
|
if (len % 2 != 0) {
|
||||||
|
@ -243,8 +245,6 @@ static int parse_attribute_value_hex_der_encoded(const char *s,
|
||||||
return MBEDTLS_ERR_X509_ALLOC_FAILED;
|
return MBEDTLS_ERR_X509_ALLOC_FAILED;
|
||||||
}
|
}
|
||||||
/* Beyond this point, der needs to be freed on exit. */
|
/* Beyond this point, der needs to be freed on exit. */
|
||||||
unsigned char *p = der + 1;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < der_length; i++) {
|
for (size_t i = 0; i < der_length; i++) {
|
||||||
int c = hexpair_to_int(s + 2 * i);
|
int c = hexpair_to_int(s + 2 * i);
|
||||||
if (c < 0) {
|
if (c < 0) {
|
||||||
|
@ -256,6 +256,7 @@ static int parse_attribute_value_hex_der_encoded(const char *s,
|
||||||
/* Step 3: decode the DER. */
|
/* Step 3: decode the DER. */
|
||||||
/* We've checked that der_length >= 1 above. */
|
/* We've checked that der_length >= 1 above. */
|
||||||
*tag = der[0];
|
*tag = der[0];
|
||||||
|
p = der + 1;
|
||||||
if (mbedtls_asn1_get_len(&p, der + der_length, data_len) != 0) {
|
if (mbedtls_asn1_get_len(&p, der + der_length, data_len) != 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue