Lines Matching refs:p
66 volatile unsigned char *p = v; while( n-- ) *p++ = 0; in mbedtls_zeroize() local
173 static int pk_get_ecparams( unsigned char **p, const unsigned char *end, in pk_get_ecparams() argument
179 params->tag = **p; in pk_get_ecparams()
190 if( ( ret = mbedtls_asn1_get_tag( p, end, ¶ms->len, params->tag ) ) != 0 ) in pk_get_ecparams()
195 params->p = *p; in pk_get_ecparams()
196 *p += params->len; in pk_get_ecparams()
198 if( *p != end ) in pk_get_ecparams()
228 unsigned char *p = params->p; in pk_group_from_specified() local
229 const unsigned char * const end = params->p + params->len; in pk_group_from_specified()
235 if( ( ret = mbedtls_asn1_get_int( &p, end, &ver ) ) != 0 ) in pk_group_from_specified()
247 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in pk_group_from_specified()
251 end_field = p + len; in pk_group_from_specified()
261 if( ( ret = mbedtls_asn1_get_tag( &p, end_field, &len, MBEDTLS_ASN1_OID ) ) != 0 ) in pk_group_from_specified()
265 memcmp( p, MBEDTLS_OID_ANSI_X9_62_PRIME_FIELD, len ) != 0 ) in pk_group_from_specified()
270 p += len; in pk_group_from_specified()
273 if( ( ret = mbedtls_asn1_get_mpi( &p, end_field, &grp->P ) ) != 0 ) in pk_group_from_specified()
278 if( p != end_field ) in pk_group_from_specified()
291 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in pk_group_from_specified()
295 end_curve = p + len; in pk_group_from_specified()
301 if( ( ret = mbedtls_asn1_get_tag( &p, end_curve, &len, MBEDTLS_ASN1_OCTET_STRING ) ) != 0 || in pk_group_from_specified()
302 ( ret = mbedtls_mpi_read_binary( &grp->A, p, len ) ) != 0 ) in pk_group_from_specified()
307 p += len; in pk_group_from_specified()
309 if( ( ret = mbedtls_asn1_get_tag( &p, end_curve, &len, MBEDTLS_ASN1_OCTET_STRING ) ) != 0 || in pk_group_from_specified()
310 ( ret = mbedtls_mpi_read_binary( &grp->B, p, len ) ) != 0 ) in pk_group_from_specified()
315 p += len; in pk_group_from_specified()
318 if( ( ret = mbedtls_asn1_get_tag( &p, end_curve, &len, MBEDTLS_ASN1_BIT_STRING ) ) == 0 ) in pk_group_from_specified()
319 p += len; in pk_group_from_specified()
321 if( p != end_curve ) in pk_group_from_specified()
328 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, MBEDTLS_ASN1_OCTET_STRING ) ) != 0 ) in pk_group_from_specified()
332 ( const unsigned char *) p, len ) ) != 0 ) in pk_group_from_specified()
339 ( p[0] != 0x02 && p[0] != 0x03 ) || in pk_group_from_specified()
341 mbedtls_mpi_read_binary( &grp->G.X, p + 1, len - 1 ) != 0 || in pk_group_from_specified()
342 mbedtls_mpi_lset( &grp->G.Y, p[0] - 2 ) != 0 || in pk_group_from_specified()
349 p += len; in pk_group_from_specified()
354 if( ( ret = mbedtls_asn1_get_mpi( &p, end, &grp->N ) ) != 0 ) in pk_group_from_specified()
481 static int pk_get_ecpubkey( unsigned char **p, const unsigned char *end, in pk_get_ecpubkey() argument
487 (const unsigned char *) *p, end - *p ) ) == 0 ) in pk_get_ecpubkey()
495 *p = (unsigned char *) end; in pk_get_ecpubkey()
508 static int pk_get_rsapubkey( unsigned char **p, in pk_get_rsapubkey() argument
515 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in pk_get_rsapubkey()
519 if( *p + len != end ) in pk_get_rsapubkey()
523 if( ( ret = mbedtls_asn1_get_mpi( p, end, &rsa->N ) ) != 0 || in pk_get_rsapubkey()
524 ( ret = mbedtls_asn1_get_mpi( p, end, &rsa->E ) ) != 0 ) in pk_get_rsapubkey()
527 if( *p != end ) in pk_get_rsapubkey()
546 static int pk_get_pk_alg( unsigned char **p, in pk_get_pk_alg() argument
555 if( ( ret = mbedtls_asn1_get_alg( p, end, &alg_oid, params ) ) != 0 ) in pk_get_pk_alg()
579 int mbedtls_pk_parse_subpubkey( unsigned char **p, const unsigned char *end, in mbedtls_pk_parse_subpubkey() argument
588 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in mbedtls_pk_parse_subpubkey()
594 end = *p + len; in mbedtls_pk_parse_subpubkey()
596 if( ( ret = pk_get_pk_alg( p, end, &pk_alg, &alg_params ) ) != 0 ) in mbedtls_pk_parse_subpubkey()
599 if( ( ret = mbedtls_asn1_get_bitstring_null( p, end, &len ) ) != 0 ) in mbedtls_pk_parse_subpubkey()
602 if( *p + len != end ) in mbedtls_pk_parse_subpubkey()
615 ret = pk_get_rsapubkey( p, end, mbedtls_pk_rsa( *pk ) ); in mbedtls_pk_parse_subpubkey()
623 ret = pk_get_ecpubkey( p, end, mbedtls_pk_ec( *pk ) ); in mbedtls_pk_parse_subpubkey()
628 if( ret == 0 && *p != end ) in mbedtls_pk_parse_subpubkey()
648 unsigned char *p, *end; in pk_parse_key_pkcs1_der() local
650 p = (unsigned char *) key; in pk_parse_key_pkcs1_der()
651 end = p + keylen; in pk_parse_key_pkcs1_der()
669 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in pk_parse_key_pkcs1_der()
675 end = p + len; in pk_parse_key_pkcs1_der()
677 if( ( ret = mbedtls_asn1_get_int( &p, end, &rsa->ver ) ) != 0 ) in pk_parse_key_pkcs1_der()
687 if( ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->N ) ) != 0 || in pk_parse_key_pkcs1_der()
688 ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->E ) ) != 0 || in pk_parse_key_pkcs1_der()
689 ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->D ) ) != 0 || in pk_parse_key_pkcs1_der()
690 ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->P ) ) != 0 || in pk_parse_key_pkcs1_der()
691 ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->Q ) ) != 0 || in pk_parse_key_pkcs1_der()
692 ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->DP ) ) != 0 || in pk_parse_key_pkcs1_der()
693 ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->DQ ) ) != 0 || in pk_parse_key_pkcs1_der()
694 ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->QP ) ) != 0 ) in pk_parse_key_pkcs1_der()
702 if( p != end ) in pk_parse_key_pkcs1_der()
731 unsigned char *p = (unsigned char *) key; in pk_parse_key_sec1_der() local
732 unsigned char *end = p + keylen; in pk_parse_key_sec1_der()
745 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in pk_parse_key_sec1_der()
751 end = p + len; in pk_parse_key_sec1_der()
753 if( ( ret = mbedtls_asn1_get_int( &p, end, &version ) ) != 0 ) in pk_parse_key_sec1_der()
759 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, MBEDTLS_ASN1_OCTET_STRING ) ) != 0 ) in pk_parse_key_sec1_der()
762 if( ( ret = mbedtls_mpi_read_binary( &eck->d, p, len ) ) != 0 ) in pk_parse_key_sec1_der()
768 p += len; in pk_parse_key_sec1_der()
771 if( p != end ) in pk_parse_key_sec1_der()
776 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in pk_parse_key_sec1_der()
779 if( ( ret = pk_get_ecparams( &p, p + len, ¶ms) ) != 0 || in pk_parse_key_sec1_der()
796 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in pk_parse_key_sec1_der()
799 end2 = p + len; in pk_parse_key_sec1_der()
801 if( ( ret = mbedtls_asn1_get_bitstring_null( &p, end2, &len ) ) != 0 ) in pk_parse_key_sec1_der()
804 if( p + len != end2 ) in pk_parse_key_sec1_der()
808 if( ( ret = pk_get_ecpubkey( &p, end2, eck ) ) == 0 ) in pk_parse_key_sec1_der()
856 unsigned char *p = (unsigned char *) key; in pk_parse_key_pkcs8_unencrypted_der() local
857 unsigned char *end = p + keylen; in pk_parse_key_pkcs8_unencrypted_der()
877 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in pk_parse_key_pkcs8_unencrypted_der()
883 end = p + len; in pk_parse_key_pkcs8_unencrypted_der()
885 if( ( ret = mbedtls_asn1_get_int( &p, end, &version ) ) != 0 ) in pk_parse_key_pkcs8_unencrypted_der()
891 if( ( ret = pk_get_pk_alg( &p, end, &pk_alg, ¶ms ) ) != 0 ) in pk_parse_key_pkcs8_unencrypted_der()
894 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, MBEDTLS_ASN1_OCTET_STRING ) ) != 0 ) in pk_parse_key_pkcs8_unencrypted_der()
910 if( ( ret = pk_parse_key_pkcs1_der( mbedtls_pk_rsa( *pk ), p, len ) ) != 0 ) in pk_parse_key_pkcs8_unencrypted_der()
921 ( ret = pk_parse_key_sec1_der( mbedtls_pk_ec( *pk ), p, len ) ) != 0 ) in pk_parse_key_pkcs8_unencrypted_der()
945 unsigned char *p, *end; in pk_parse_key_pkcs8_encrypted_der() local
954 p = (unsigned char *) key; in pk_parse_key_pkcs8_encrypted_der()
955 end = p + keylen; in pk_parse_key_pkcs8_encrypted_der()
974 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in pk_parse_key_pkcs8_encrypted_der()
980 end = p + len; in pk_parse_key_pkcs8_encrypted_der()
982 if( ( ret = mbedtls_asn1_get_alg( &p, end, &pbe_alg_oid, &pbe_params ) ) != 0 ) in pk_parse_key_pkcs8_encrypted_der()
985 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, MBEDTLS_ASN1_OCTET_STRING ) ) != 0 ) in pk_parse_key_pkcs8_encrypted_der()
999 pwd, pwdlen, p, len, buf ) ) != 0 ) in pk_parse_key_pkcs8_encrypted_der()
1014 p, len, buf ) ) != 0 ) in pk_parse_key_pkcs8_encrypted_der()
1033 p, len, buf ) ) != 0 ) in pk_parse_key_pkcs8_encrypted_der()
1252 unsigned char *p; in mbedtls_pk_parse_public_key() local
1282 p = (unsigned char *) key; in mbedtls_pk_parse_public_key()
1284 ret = mbedtls_pk_parse_subpubkey( &p, p + keylen, ctx ); in mbedtls_pk_parse_public_key()