Lines Matching refs:rc

73     int rc;  in key_unwrap()  local
76 rc = bootutil_aes_kw_set_unwrap_key(&aes_kw, bootutil_enc_key->key, *bootutil_enc_key->len); in key_unwrap()
77 if (rc != 0) { in key_unwrap()
80 rc = bootutil_aes_kw_unwrap(&aes_kw, wrapped, TLV_ENC_KW_SZ, enckey, BOOT_ENC_KEY_SIZE); in key_unwrap()
81 if (rc != 0) { in key_unwrap()
87 return rc; in key_unwrap()
105 int rc; in parse_ec256_enckey() local
111 if ((rc = mbedtls_asn1_get_tag(p, end, &len, in parse_ec256_enckey()
125 if ((rc = mbedtls_asn1_get_alg(p, end, &alg, &param)) != 0) { in parse_ec256_enckey()
138 if ((rc = mbedtls_asn1_get_tag(p, end, &len, MBEDTLS_ASN1_OCTET_STRING)) != 0) { in parse_ec256_enckey()
144 if ((rc = mbedtls_asn1_get_tag(p, end, &len, in parse_ec256_enckey()
156 if ((rc = mbedtls_asn1_get_tag(p, end, &len, MBEDTLS_ASN1_OCTET_STRING)) != 0) { in parse_ec256_enckey()
251 int rc; in hkdf() local
264 rc = bootutil_hmac_sha256_set_key(&hmac, salt, BOOTUTIL_CRYPTO_SHA256_DIGEST_SIZE); in hkdf()
265 if (rc != 0) { in hkdf()
269 rc = bootutil_hmac_sha256_update(&hmac, ikm, ikm_len); in hkdf()
270 if (rc != 0) { in hkdf()
274 rc = bootutil_hmac_sha256_finish(&hmac, prk, BOOTUTIL_CRYPTO_SHA256_DIGEST_SIZE); in hkdf()
275 if (rc != 0) { in hkdf()
291 rc = bootutil_hmac_sha256_set_key(&hmac, prk, BOOTUTIL_CRYPTO_SHA256_DIGEST_SIZE); in hkdf()
292 if (rc != 0) { in hkdf()
299 rc = bootutil_hmac_sha256_update(&hmac, T, BOOTUTIL_CRYPTO_SHA256_DIGEST_SIZE); in hkdf()
300 if (rc != 0) { in hkdf()
305 rc = bootutil_hmac_sha256_update(&hmac, info, info_len); in hkdf()
306 if (rc != 0) { in hkdf()
310 rc = bootutil_hmac_sha256_update(&hmac, &counter, 1); in hkdf()
311 if (rc != 0) { in hkdf()
315 rc = bootutil_hmac_sha256_finish(&hmac, T, BOOTUTIL_CRYPTO_SHA256_DIGEST_SIZE); in hkdf()
316 if (rc != 0) { in hkdf()
373 int rc; in boot_enc_set_key() local
375 rc = bootutil_aes_ctr_set_key(&enc_state[slot].aes_ctr, bs->enckey[slot]); in boot_enc_set_key()
376 if (rc != 0) { in boot_enc_set_key()
460 int rc = -1; in boot_decrypt_key() local
462 rc = boot_enc_retrieve_private_key(&bootutil_enc_key); in boot_decrypt_key()
463 if (rc) { in boot_decrypt_key()
464 return rc; in boot_decrypt_key()
468 return rc; in boot_decrypt_key()
478 rc = bootutil_rsa_parse_private_key(&rsa, &cp, cpend); in boot_decrypt_key()
479 if (rc) { in boot_decrypt_key()
481 return rc; in boot_decrypt_key()
484 rc = bootutil_rsa_oaep_decrypt(&rsa, &olen, buf, enckey, BOOT_ENC_KEY_SIZE); in boot_decrypt_key()
486 if (rc) { in boot_decrypt_key()
487 return rc; in boot_decrypt_key()
495 rc = key_unwrap(buf, enckey, bootutil_enc_key); in boot_decrypt_key()
508 rc = parse_ec256_enckey(&cp, cpend, private_key); in boot_decrypt_key()
509 if (rc) { in boot_decrypt_key()
510 return rc; in boot_decrypt_key()
518 rc = bootutil_ecdh_p256_shared_secret(&ecdh_p256, &buf[EC_PUBK_INDEX], private_key, shared); in boot_decrypt_key()
520 if (rc != 0) { in boot_decrypt_key()
535 rc = parse_x25519_enckey(&cp, cpend, private_key); in boot_decrypt_key()
536 if (rc) { in boot_decrypt_key()
537 return rc; in boot_decrypt_key()
546 rc = bootutil_ecdh_x25519_shared_secret(&ecdh_x25519, &buf[EC_PUBK_INDEX], private_key, shared); in boot_decrypt_key()
548 if (!rc) { in boot_decrypt_key()
561 rc = hkdf(shared, SHARED_KEY_LEN, (uint8_t *)"MCUBoot_ECIES_v1", 16, in boot_decrypt_key()
563 if (rc != 0 || len != (BOOTUTIL_CRYPTO_AES_CTR_KEY_SIZE + BOOTUTIL_CRYPTO_SHA256_DIGEST_SIZE)) { in boot_decrypt_key()
573 rc = bootutil_hmac_sha256_set_key(&hmac, &derived_key[BOOT_ENC_KEY_SIZE], 32); in boot_decrypt_key()
574 if (rc != 0) { in boot_decrypt_key()
579 rc = bootutil_hmac_sha256_update(&hmac, &buf[EC_CIPHERKEY_INDEX], BOOT_ENC_KEY_SIZE); in boot_decrypt_key()
580 if (rc != 0) { in boot_decrypt_key()
586 rc = bootutil_hmac_sha256_finish(&hmac, tag, BOOTUTIL_CRYPTO_SHA256_DIGEST_SIZE); in boot_decrypt_key()
587 if (rc != 0) { in boot_decrypt_key()
604 if (rc != 0) { in boot_decrypt_key()
609 rc = bootutil_aes_ctr_set_key(&aes_ctr, derived_key); in boot_decrypt_key()
610 if (rc != 0) { in boot_decrypt_key()
616rc = bootutil_aes_ctr_decrypt(&aes_ctr, counter, &buf[EC_CIPHERKEY_INDEX], BOOTUTIL_CRYPTO_AES_CTR… in boot_decrypt_key()
617 if (rc != 0) { in boot_decrypt_key()
624 rc = 0; in boot_decrypt_key()
628 return rc; in boot_decrypt_key()
647 int rc; in boot_enc_load() local
657 rc = bootutil_tlv_iter_begin(&it, hdr, fap, EXPECTED_ENC_TLV, false); in boot_enc_load()
658 if (rc) { in boot_enc_load()
662 rc = bootutil_tlv_iter_next(&it, &off, &len, NULL); in boot_enc_load()
663 if (rc != 0) { in boot_enc_load()
664 return rc; in boot_enc_load()
676 rc = flash_area_read(fap, off, buf, EXPECTED_ENC_LEN); in boot_enc_load()
677 if (rc) { in boot_enc_load()