Lines Matching refs:len

52 			 size_t len)  in deser_sign_cb()  argument
58 memcpy(ctx->seek, start + len - ctx->unit_size, in deser_sign_cb()
66 static int find_pk_cb(void *void_ppk, int tag, unsigned char *start, size_t len) in find_pk_cb() argument
68 (void)len; in find_pk_cb()
87 #define EXPECTO_TAG(tag, cursor, len) \ argument
96 mbedtls_asn1_get_len(&cursor, end, &len); \
99 len--; \
115 const unsigned char *end, uint32_t *len) in mbedtls_asn1_get_len() argument
121 *len = *(*p)++; in mbedtls_asn1_get_len()
128 *len = (*p)[1]; in mbedtls_asn1_get_len()
136 *len = ((uint32_t)(*p)[1] << 8) | (*p)[2]; in mbedtls_asn1_get_len()
144 *len = ((uint32_t)(*p)[1] << 16) | in mbedtls_asn1_get_len()
153 *len = ((uint32_t)(*p)[1] << 24) | in mbedtls_asn1_get_len()
164 if (*len > (uint32_t)(end - *p)) in mbedtls_asn1_get_len()
185 if (1 == cred_array->len in ca_pk_get()
188 && (0 == cred_array->ptr[0].ca.len || in ca_pk_get()
193 0 == cred_array->ptr[0].ca_pk.len) { in ca_pk_get()
198 root_pk->len = cred_array->ptr[0].ca_pk.len; in ca_pk_get()
204 for (uint16_t i = 0; i < cred_array->len; i++) { in ca_pk_get()
206 0 == cred_array->ptr[i].ca.len) { in ca_pk_get()
211 cred_array->ptr[i].ca.len); in ca_pk_get()
219 cred_array->ptr[i].ca.len), in ca_pk_get()
231 if (0 == memcmp(subject_id->p, issuer, subject_id->len)) { in ca_pk_get()
233 root_pk->len = cred_array->ptr[i].ca_pk.len; in ca_pk_get()
235 root_pk->len); in ca_pk_get()
254 TRY_EXPECT(cbor_decode_cert(cert->ptr, cert->len, &c, &decode_len), 0); in cert_c509_verify()
258 PRINT_ARRAY("issuer", c.cert_issuer.value, (uint32_t)c.cert_issuer.len); in cert_c509_verify()
262 (uint32_t)c.cert_subject.len); in cert_c509_verify()
263 PRINT_ARRAY("PK", c.cert_pk.value, (uint32_t)c.cert_pk.len); in cert_c509_verify()
268 (uint32_t)c.cert_signature.len); in cert_c509_verify()
276 cert->ptr, cert->len - 2 - (uint32_t)c.cert_signature.len); in cert_c509_verify()
278 c.cert_signature.value, (uint32_t)c.cert_signature.len); in cert_c509_verify()
283 TRY(_memcpy_s(pk->ptr, pk->len, c.cert_pk.value, in cert_c509_verify()
284 (uint32_t)c.cert_pk.len)); in cert_c509_verify()
285 pk->len = (uint32_t)c.cert_pk.len; in cert_c509_verify()
303 cert->len), in cert_x509_verify()
308 (uint32_t)m_cert.serial.len); in cert_x509_verify()
310 (uint32_t)m_cert.issuer_raw.len); in cert_x509_verify()
323 PRINTF(" %s: %.*s\n", short_name, (int)p->val.len, in cert_x509_verify()
332 PRINT_ARRAY("cert issuer_id", issuer_id->p, (uint32_t)issuer_id->len); in cert_x509_verify()
365 deser_sign_ctx_init(&deser_sign_ctx, sig.ptr, sig.ptr + sig.len, in cert_x509_verify()
367 mbedtls_asn1_traverse_sequence_of(&pp, pp + m_cert.sig.len, 0, in cert_x509_verify()
370 PRINT_ARRAY("Certificate signature", sig.ptr, sig.len); in cert_x509_verify()
375 BYTE_ARRAY_INIT(m_cert.tbs.p, (uint32_t)m_cert.tbs.len); in cert_x509_verify()
384 mbedtls_asn1_traverse_sequence_of(&pp, pp + m_cert.pk_raw.len, in cert_x509_verify()
390 cpk_len = (uint32_t)m_cert.pk_raw.len - in cert_x509_verify()
393 TRY(_memcpy_s(pk->ptr, pk->len, cpk, (uint32_t)cpk_len)); in cert_x509_verify()
394 pk->len = (uint32_t)cpk_len; in cert_x509_verify()
395 PRINT_ARRAY("pk from cert", pk->ptr, pk->len); in cert_x509_verify()
406 const uint8_t *tbs_end = &cert->ptr[cert->len]; in cert_x509_verify()
414 const uint8_t *end = &cert->ptr[cert->len]; in cert_x509_verify()
415 uint32_t len; in cert_x509_verify()
418 EXPECTO_TAG(ASN1_SEQUENCE, cursor, len); in cert_x509_verify()
422 EXPECTO_TAG(ASN1_SEQUENCE, cursor, len); in cert_x509_verify()
423 tbs_end = cursor + len; in cert_x509_verify()
430 mbedtls_asn1_get_len(&cursor, end, &len); in cert_x509_verify()
431 cursor += len; in cert_x509_verify()
435 EXPECTO_TAG(ASN1_SEQUENCE, cursor, len); in cert_x509_verify()
438 EXPECTO_TAG(ASN1_SEQUENCE, cursor, len); in cert_x509_verify()
440 cursor += len; in cert_x509_verify()
443 EXPECTO_TAG(ASN1_BIT_STRING, cursor, len); in cert_x509_verify()
446 _memcpy_s(pk->ptr, pk->len, cursor, (uint32_t)len); in cert_x509_verify()
447 pk->len = (uint32_t)len; in cert_x509_verify()
448 PRINT_ARRAY("pk from cert", pk->ptr, pk->len); in cert_x509_verify()
454 EXPECTO_TAG(ASN1_SEQUENCE, cursor, len); in cert_x509_verify()
456 cursor += len; in cert_x509_verify()
459 EXPECTO_TAG(ASN1_BIT_STRING, cursor, len); in cert_x509_verify()
462 EXPECTO_TAG(ASN1_SEQUENCE, cursor, len); in cert_x509_verify()
464 EXPECTO_TAG(ASN1_INTEGER, cursor, len); in cert_x509_verify()
466 TRY_EXPECT((cursor + len) <= end, 1); in cert_x509_verify()
467 _memcpy_s(sig.ptr, SIGNATURE_SIZE, cursor, (uint32_t)len); in cert_x509_verify()
468 sig.len = len; in cert_x509_verify()
469 cursor += len; in cert_x509_verify()
471 (uint32_t)sig.len); in cert_x509_verify()
473 EXPECTO_TAG(ASN1_INTEGER, cursor, len); in cert_x509_verify()
474 TRY_EXPECT((cursor + len) <= end, 1); in cert_x509_verify()
475 _memcpy_s(sig.ptr + sig.len, in cert_x509_verify()
476 (uint32_t)(SIGNATURE_SIZE - sig.len), cursor, in cert_x509_verify()
477 (uint32_t)len); in cert_x509_verify()
478 sig.len += len; in cert_x509_verify()
481 (uint32_t)sig.len); in cert_x509_verify()
490 for (uint32_t iter = 0; iter < cred_array->len; iter++) { in cert_x509_verify()
494 root_pk.len); in cert_x509_verify()
496 .len = sig.len }; in cert_x509_verify()