Fix IAR 'transfer of control bypasses initialization' warnings
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
54bb76e106
commit
bcb1818e19
3 changed files with 6 additions and 3 deletions
|
@ -172,6 +172,7 @@ int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode,
|
||||||
size_t iv_len = 0;
|
size_t iv_len = 0;
|
||||||
size_t finish_olen = 0;
|
size_t finish_olen = 0;
|
||||||
unsigned int padlen = 0;
|
unsigned int padlen = 0;
|
||||||
|
mbedtls_cipher_padding_t padding;
|
||||||
|
|
||||||
if (pwd == NULL && pwdlen != 0) {
|
if (pwd == NULL && pwdlen != 0) {
|
||||||
return MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA;
|
return MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA;
|
||||||
|
@ -218,7 +219,7 @@ 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;
|
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
|
||||||
* decrypting even when support for PKCS7 padding is disabled. In this
|
* decrypting even when support for PKCS7 padding is disabled. In this
|
||||||
|
|
|
@ -152,6 +152,7 @@ int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode,
|
||||||
mbedtls_cipher_type_t cipher_alg;
|
mbedtls_cipher_type_t cipher_alg;
|
||||||
mbedtls_cipher_context_t cipher_ctx;
|
mbedtls_cipher_context_t cipher_ctx;
|
||||||
unsigned int padlen = 0;
|
unsigned int padlen = 0;
|
||||||
|
mbedtls_cipher_padding_t padding;
|
||||||
|
|
||||||
p = pbe_params->p;
|
p = pbe_params->p;
|
||||||
end = p + pbe_params->len;
|
end = p + pbe_params->len;
|
||||||
|
@ -246,7 +247,7 @@ int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode,
|
||||||
* "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).
|
||||||
*/
|
*/
|
||||||
mbedtls_cipher_padding_t padding = MBEDTLS_PADDING_PKCS7;
|
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
|
||||||
* decrypting even when support for PKCS7 padding is disabled. In this
|
* decrypting even when support for PKCS7 padding is disabled. In this
|
||||||
|
|
|
@ -243,6 +243,8 @@ 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) {
|
||||||
|
@ -254,7 +256,6 @@ 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;
|
|
||||||
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