Lines Matching refs:ret
39 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in pkcs12_parse_pbe_params() local
55 if ((ret = mbedtls_asn1_get_tag(p, end, &salt->len, MBEDTLS_ASN1_OCTET_STRING)) != 0) { in pkcs12_parse_pbe_params()
56 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_PKCS12_PBE_INVALID_FORMAT, ret); in pkcs12_parse_pbe_params()
62 if ((ret = mbedtls_asn1_get_int(p, end, iterations)) != 0) { in pkcs12_parse_pbe_params()
63 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_PKCS12_PBE_INVALID_FORMAT, ret); in pkcs12_parse_pbe_params()
81 int ret, iterations = 0; in pkcs12_pbe_derive_key_iv() local
93 if ((ret = pkcs12_parse_pbe_params(pbe_params, &salt, in pkcs12_pbe_derive_key_iv()
95 return ret; in pkcs12_pbe_derive_key_iv()
102 if ((ret = mbedtls_pkcs12_derivation(key, keylen, unipwd, pwdlen * 2 + 2, in pkcs12_pbe_derive_key_iv()
105 return ret; in pkcs12_pbe_derive_key_iv()
112 if ((ret = mbedtls_pkcs12_derivation(iv, ivlen, unipwd, pwdlen * 2 + 2, in pkcs12_pbe_derive_key_iv()
115 return ret; in pkcs12_pbe_derive_key_iv()
157 int ret, keylen = 0; in mbedtls_pkcs12_pbe_ext() local
191 if ((ret = pkcs12_pbe_derive_key_iv(pbe_params, md_type, pwd, pwdlen, in mbedtls_pkcs12_pbe_ext()
194 return ret; in mbedtls_pkcs12_pbe_ext()
199 if ((ret = mbedtls_cipher_setup(&cipher_ctx, cipher_info)) != 0) { in mbedtls_pkcs12_pbe_ext()
203 if ((ret = mbedtls_cipher_setkey(&cipher_ctx, key, 8 * keylen, in mbedtls_pkcs12_pbe_ext()
222 if ((ret = mbedtls_cipher_set_padding_mode(&cipher_ctx, padding)) != 0) { in mbedtls_pkcs12_pbe_ext()
228 ret = mbedtls_cipher_crypt(&cipher_ctx, iv, iv_len, data, len, output, &finish_olen); in mbedtls_pkcs12_pbe_ext()
229 if (ret == MBEDTLS_ERR_CIPHER_INVALID_PADDING) { in mbedtls_pkcs12_pbe_ext()
230 ret = MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH; in mbedtls_pkcs12_pbe_ext()
240 return ret; in mbedtls_pkcs12_pbe_ext()
273 int ret = -1; in calculate_hashes() local
284 if ((ret = mbedtls_md_setup(&md_ctx, md_info, 0)) != 0) { in calculate_hashes()
285 return ret; in calculate_hashes()
288 if ((ret = mbedtls_md_starts(&md_ctx)) != 0) { in calculate_hashes()
292 if ((ret = mbedtls_md_update(&md_ctx, diversifier, v)) != 0) { in calculate_hashes()
297 if ((ret = mbedtls_md_update(&md_ctx, salt_block, v)) != 0) { in calculate_hashes()
303 if ((ret = mbedtls_md_update(&md_ctx, pwd_block, v)) != 0) { in calculate_hashes()
308 if ((ret = mbedtls_md_finish(&md_ctx, hash_output)) != 0) { in calculate_hashes()
314 if ((ret = mbedtls_md(md_info, hash_output, hlen, hash_output)) in calculate_hashes()
322 return ret; in calculate_hashes()
331 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_pkcs12_derivation() local
426 ret = 0; in mbedtls_pkcs12_derivation()
434 return ret; in mbedtls_pkcs12_derivation()