Stop IAR warning about goto skipping variable definition
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
71f2e398bd
commit
515af1d80d
3 changed files with 53 additions and 48 deletions
|
@ -216,8 +216,8 @@ int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode,
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
|
#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
|
||||||
|
{
|
||||||
/* PKCS12 uses CBC with PKCS7 padding */
|
/* PKCS12 uses CBC with PKCS7 padding */
|
||||||
|
|
||||||
mbedtls_cipher_padding_t padding = MBEDTLS_PADDING_PKCS7;
|
mbedtls_cipher_padding_t padding = MBEDTLS_PADDING_PKCS7;
|
||||||
#if !defined(MBEDTLS_CIPHER_PADDING_PKCS7)
|
#if !defined(MBEDTLS_CIPHER_PADDING_PKCS7)
|
||||||
/* For historical reasons, when decrypting, this function works when
|
/* For historical reasons, when decrypting, this function works when
|
||||||
|
@ -232,6 +232,7 @@ int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode,
|
||||||
if ((ret = mbedtls_cipher_set_padding_mode(&cipher_ctx, padding)) != 0) {
|
if ((ret = mbedtls_cipher_set_padding_mode(&cipher_ctx, padding)) != 0) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
|
#endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
|
||||||
|
|
||||||
ret = mbedtls_cipher_crypt(&cipher_ctx, iv, iv_len, data, len, output, &finish_olen);
|
ret = mbedtls_cipher_crypt(&cipher_ctx, iv, iv_len, data, len, output, &finish_olen);
|
||||||
|
|
|
@ -242,6 +242,7 @@ int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode,
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
|
#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
|
||||||
|
{
|
||||||
/* PKCS5 uses CBC with PKCS7 padding (which is the same as
|
/* PKCS5 uses CBC with PKCS7 padding (which is the same as
|
||||||
* "PKCS5 padding" except that it's typically only called PKCS5
|
* "PKCS5 padding" except that it's typically only called PKCS5
|
||||||
* with 64-bit-block ciphers).
|
* with 64-bit-block ciphers).
|
||||||
|
@ -260,6 +261,7 @@ int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode,
|
||||||
if ((ret = mbedtls_cipher_set_padding_mode(&cipher_ctx, padding)) != 0) {
|
if ((ret = mbedtls_cipher_set_padding_mode(&cipher_ctx, padding)) != 0) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
|
#endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
|
||||||
if ((ret = mbedtls_cipher_crypt(&cipher_ctx, iv, enc_scheme_params.len,
|
if ((ret = mbedtls_cipher_crypt(&cipher_ctx, iv, enc_scheme_params.len,
|
||||||
data, datalen, output, output_len)) != 0) {
|
data, datalen, output, output_len)) != 0) {
|
||||||
|
|
|
@ -254,6 +254,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];
|
||||||
|
{
|
||||||
unsigned char *p = der + 1;
|
unsigned char *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;
|
||||||
|
@ -279,6 +280,7 @@ static int parse_attribute_value_hex_der_encoded(const char *s,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
memcpy(data, p, *data_len);
|
memcpy(data, p, *data_len);
|
||||||
|
}
|
||||||
mbedtls_free(der);
|
mbedtls_free(der);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue