Lines Matching refs:ret
74 int ret = 0; in ta_entry_mbedtls_check_cert() local
85 ret = mbedtls_x509_crt_parse(&crt, params[0].memref.buffer, in ta_entry_mbedtls_check_cert()
87 if (ret) { in ta_entry_mbedtls_check_cert()
88 EMSG("mbedtls_x509_crt_parse: failed: %#x", ret); in ta_entry_mbedtls_check_cert()
92 ret = mbedtls_x509_crt_parse(&trust_crt, params[1].memref.buffer, in ta_entry_mbedtls_check_cert()
94 if (ret) { in ta_entry_mbedtls_check_cert()
95 EMSG("mbedtls_x509_crt_parse: failed: %#x", ret); in ta_entry_mbedtls_check_cert()
100 ret = mbedtls_x509_crt_verify(&crt, &trust_crt, NULL, NULL, &flags, in ta_entry_mbedtls_check_cert()
102 if (ret) { in ta_entry_mbedtls_check_cert()
103 EMSG("mbedtls_x509_crt_verify: failed: %#x", ret); in ta_entry_mbedtls_check_cert()
124 int ret = 0; in write_cert() local
128 ret = mbedtls_x509write_crt_pem(crt, buf, *blen, f_rng, NULL); in write_cert()
129 if (!ret) in write_cert()
132 if (ret != MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL) { in write_cert()
133 EMSG("mbedtls_x509write_crt_pem: failed: %#x", ret); in write_cert()
145 ret = mbedtls_x509write_crt_pem(crt, b, bl, f_rng, NULL); in write_cert()
146 if (!ret) { in write_cert()
152 if (ret != MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL) { in write_cert()
153 EMSG("mbedtls_x509write_crt_pem: failed: %#x", ret); in write_cert()
162 int ret = 0; in parse_issuer_cert() local
170 ret = mbedtls_x509_crt_parse(crt, buf, mid_crt_size + 1); in parse_issuer_cert()
172 if (ret) { in parse_issuer_cert()
173 EMSG("mbedtls_x509_crt_parse: failed: %#x", ret); in parse_issuer_cert()
182 int ret = 0; in parse_issuer_key() local
190 ret = mbedtls_pk_parse_key(pk, buf, mid_key_size + 1, NULL, 0); in parse_issuer_key()
192 if (ret) { in parse_issuer_key()
193 EMSG("mbedtls_pk_parse_key: failed: %#x", ret); in parse_issuer_key()
214 int ret = 0; in ta_entry_mbedtls_sign_cert() local
226 ret = parse_issuer_cert(&issuer_crt); in ta_entry_mbedtls_sign_cert()
227 if (ret) in ta_entry_mbedtls_sign_cert()
229 ret = parse_issuer_key(&issuer_key); in ta_entry_mbedtls_sign_cert()
230 if (ret) in ta_entry_mbedtls_sign_cert()
233 ret = mbedtls_mpi_lset(&serial, 1); in ta_entry_mbedtls_sign_cert()
234 if (ret) { in ta_entry_mbedtls_sign_cert()
235 EMSG("mbedtls_mpi_read_string: failed: %#x", ret); in ta_entry_mbedtls_sign_cert()
240 ret = mbedtls_x509_csr_parse(&csr, params[0].memref.buffer, in ta_entry_mbedtls_sign_cert()
242 if (ret) { in ta_entry_mbedtls_sign_cert()
243 EMSG("mbedtls_x509_csr_parse: failed: %#x", ret); in ta_entry_mbedtls_sign_cert()
249 ret = mbedtls_x509_dn_gets(name, sizeof(name), &csr.subject); in ta_entry_mbedtls_sign_cert()
250 if (ret < 0) { in ta_entry_mbedtls_sign_cert()
251 EMSG("mbedtls_x509_dn_gets: failed: %#x", ret); in ta_entry_mbedtls_sign_cert()
255 ret = mbedtls_x509write_crt_set_subject_name(&crt, name); in ta_entry_mbedtls_sign_cert()
256 if (ret) { in ta_entry_mbedtls_sign_cert()
258 ret); in ta_entry_mbedtls_sign_cert()
264 ret = mbedtls_x509_dn_gets(name, sizeof(name), &issuer_crt.subject); in ta_entry_mbedtls_sign_cert()
265 if (ret < 0) { in ta_entry_mbedtls_sign_cert()
266 EMSG("mbedtls_x509_dn_gets: failed: %#x", ret); in ta_entry_mbedtls_sign_cert()
270 ret = mbedtls_x509write_crt_set_issuer_name(&crt, name); in ta_entry_mbedtls_sign_cert()
271 if (ret) { in ta_entry_mbedtls_sign_cert()
273 ret); in ta_entry_mbedtls_sign_cert()
282 ret = mbedtls_x509write_crt_set_serial(&crt, &serial); in ta_entry_mbedtls_sign_cert()
283 if (ret) { in ta_entry_mbedtls_sign_cert()
284 EMSG("mbedtls_x509write_crt_set_serial: failed: %#x", ret); in ta_entry_mbedtls_sign_cert()
289 ret = mbedtls_x509write_crt_set_validity(&crt, "19700101000000", in ta_entry_mbedtls_sign_cert()
291 if (ret) { in ta_entry_mbedtls_sign_cert()
292 EMSG("mbedtls_x509write_crt_set_validity: failed: %#x", ret); in ta_entry_mbedtls_sign_cert()
297 ret = mbedtls_x509write_crt_set_basic_constraints(&crt, 0, 0); in ta_entry_mbedtls_sign_cert()
298 if (ret) { in ta_entry_mbedtls_sign_cert()
299 EMSG("mbedtls_x509write_crt_set_validity: failed: %#x", ret); in ta_entry_mbedtls_sign_cert()
304 ret = mbedtls_x509write_crt_set_subject_key_identifier(&crt); in ta_entry_mbedtls_sign_cert()
305 if (ret) { in ta_entry_mbedtls_sign_cert()
307 ret); in ta_entry_mbedtls_sign_cert()
312 ret = mbedtls_x509write_crt_set_authority_key_identifier(&crt); in ta_entry_mbedtls_sign_cert()
313 if (ret) { in ta_entry_mbedtls_sign_cert()
315 ret); in ta_entry_mbedtls_sign_cert()
326 ret = snprintf(params[2].memref.buffer, params[2].memref.size, in ta_entry_mbedtls_sign_cert()
329 if (ret < 0) { in ta_entry_mbedtls_sign_cert()
333 if ((size_t)ret >= params[2].memref.size) in ta_entry_mbedtls_sign_cert()
335 params[2].memref.size = ret + 1; in ta_entry_mbedtls_sign_cert()