Lines Matching refs:p

42 int mbedtls_asn1_write_len( unsigned char **p, unsigned char *start, size_t len )  in mbedtls_asn1_write_len()  argument
46 if( *p - start < 1 ) in mbedtls_asn1_write_len()
49 *--(*p) = (unsigned char) len; in mbedtls_asn1_write_len()
55 if( *p - start < 2 ) in mbedtls_asn1_write_len()
58 *--(*p) = (unsigned char) len; in mbedtls_asn1_write_len()
59 *--(*p) = 0x81; in mbedtls_asn1_write_len()
65 if( *p - start < 3 ) in mbedtls_asn1_write_len()
68 *--(*p) = ( len ) & 0xFF; in mbedtls_asn1_write_len()
69 *--(*p) = ( len >> 8 ) & 0xFF; in mbedtls_asn1_write_len()
70 *--(*p) = 0x82; in mbedtls_asn1_write_len()
76 if( *p - start < 4 ) in mbedtls_asn1_write_len()
79 *--(*p) = ( len ) & 0xFF; in mbedtls_asn1_write_len()
80 *--(*p) = ( len >> 8 ) & 0xFF; in mbedtls_asn1_write_len()
81 *--(*p) = ( len >> 16 ) & 0xFF; in mbedtls_asn1_write_len()
82 *--(*p) = 0x83; in mbedtls_asn1_write_len()
88 if( *p - start < 5 ) in mbedtls_asn1_write_len()
91 *--(*p) = ( len ) & 0xFF; in mbedtls_asn1_write_len()
92 *--(*p) = ( len >> 8 ) & 0xFF; in mbedtls_asn1_write_len()
93 *--(*p) = ( len >> 16 ) & 0xFF; in mbedtls_asn1_write_len()
94 *--(*p) = ( len >> 24 ) & 0xFF; in mbedtls_asn1_write_len()
95 *--(*p) = 0x84; in mbedtls_asn1_write_len()
102 int mbedtls_asn1_write_tag( unsigned char **p, unsigned char *start, unsigned char tag ) in mbedtls_asn1_write_tag() argument
104 if( *p - start < 1 ) in mbedtls_asn1_write_tag()
107 *--(*p) = tag; in mbedtls_asn1_write_tag()
112 int mbedtls_asn1_write_raw_buffer( unsigned char **p, unsigned char *start, in mbedtls_asn1_write_raw_buffer() argument
117 if( *p < start || (size_t)( *p - start ) < size ) in mbedtls_asn1_write_raw_buffer()
121 (*p) -= len; in mbedtls_asn1_write_raw_buffer()
122 memcpy( *p, buf, len ); in mbedtls_asn1_write_raw_buffer()
128 int mbedtls_asn1_write_mpi( unsigned char **p, unsigned char *start, const mbedtls_mpi *X ) in mbedtls_asn1_write_mpi() argument
137 if( *p < start || (size_t)( *p - start ) < len ) in mbedtls_asn1_write_mpi()
140 (*p) -= len; in mbedtls_asn1_write_mpi()
141 MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( X, *p, len ) ); in mbedtls_asn1_write_mpi()
146 if( X->s ==1 && **p & 0x80 ) in mbedtls_asn1_write_mpi()
148 if( *p - start < 1 ) in mbedtls_asn1_write_mpi()
151 *--(*p) = 0x00; in mbedtls_asn1_write_mpi()
155 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); in mbedtls_asn1_write_mpi()
156 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_INTEGER ) ); in mbedtls_asn1_write_mpi()
165 int mbedtls_asn1_write_null( unsigned char **p, unsigned char *start ) in mbedtls_asn1_write_null() argument
172 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, 0) ); in mbedtls_asn1_write_null()
173 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_NULL ) ); in mbedtls_asn1_write_null()
178 int mbedtls_asn1_write_oid( unsigned char **p, unsigned char *start, in mbedtls_asn1_write_oid() argument
184 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_raw_buffer( p, start, in mbedtls_asn1_write_oid()
186 MBEDTLS_ASN1_CHK_ADD( len , mbedtls_asn1_write_len( p, start, len ) ); in mbedtls_asn1_write_oid()
187 MBEDTLS_ASN1_CHK_ADD( len , mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_OID ) ); in mbedtls_asn1_write_oid()
192 int mbedtls_asn1_write_algorithm_identifier( unsigned char **p, unsigned char *start, in mbedtls_asn1_write_algorithm_identifier() argument
200 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_null( p, start ) ); in mbedtls_asn1_write_algorithm_identifier()
204 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_oid( p, start, oid, oid_len ) ); in mbedtls_asn1_write_algorithm_identifier()
206 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); in mbedtls_asn1_write_algorithm_identifier()
207 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, in mbedtls_asn1_write_algorithm_identifier()
213 int mbedtls_asn1_write_bool( unsigned char **p, unsigned char *start, int boolean ) in mbedtls_asn1_write_bool() argument
218 if( *p - start < 1 ) in mbedtls_asn1_write_bool()
221 *--(*p) = (boolean) ? 255 : 0; in mbedtls_asn1_write_bool()
224 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); in mbedtls_asn1_write_bool()
225 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_BOOLEAN ) ); in mbedtls_asn1_write_bool()
230 int mbedtls_asn1_write_int( unsigned char **p, unsigned char *start, int val ) in mbedtls_asn1_write_int() argument
239 if( *p - start < 1 ) in mbedtls_asn1_write_int()
243 *--(*p) = val; in mbedtls_asn1_write_int()
245 if( val > 0 && **p & 0x80 ) in mbedtls_asn1_write_int()
247 if( *p - start < 1 ) in mbedtls_asn1_write_int()
250 *--(*p) = 0x00; in mbedtls_asn1_write_int()
254 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); in mbedtls_asn1_write_int()
255 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_INTEGER ) ); in mbedtls_asn1_write_int()
260 int mbedtls_asn1_write_printable_string( unsigned char **p, unsigned char *start, in mbedtls_asn1_write_printable_string() argument
266 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_raw_buffer( p, start, in mbedtls_asn1_write_printable_string()
269 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); in mbedtls_asn1_write_printable_string()
270 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_PRINTABLE_STRING ) ); in mbedtls_asn1_write_printable_string()
275 int mbedtls_asn1_write_ia5_string( unsigned char **p, unsigned char *start, in mbedtls_asn1_write_ia5_string() argument
281 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_raw_buffer( p, start, in mbedtls_asn1_write_ia5_string()
284 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); in mbedtls_asn1_write_ia5_string()
285 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_IA5_STRING ) ); in mbedtls_asn1_write_ia5_string()
290 int mbedtls_asn1_write_bitstring( unsigned char **p, unsigned char *start, in mbedtls_asn1_write_bitstring() argument
300 if( *p < start || (size_t)( *p - start ) < size + 1 ) in mbedtls_asn1_write_bitstring()
304 (*p) -= size; in mbedtls_asn1_write_bitstring()
305 memcpy( *p, buf, size ); in mbedtls_asn1_write_bitstring()
309 *--(*p) = (unsigned char) (size * 8 - bits); in mbedtls_asn1_write_bitstring()
311 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); in mbedtls_asn1_write_bitstring()
312 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_BIT_STRING ) ); in mbedtls_asn1_write_bitstring()
317 int mbedtls_asn1_write_octet_string( unsigned char **p, unsigned char *start, in mbedtls_asn1_write_octet_string() argument
323 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_raw_buffer( p, start, buf, size ) ); in mbedtls_asn1_write_octet_string()
325 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); in mbedtls_asn1_write_octet_string()
326 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_OCTET_STRING ) ); in mbedtls_asn1_write_octet_string()
348 cur->oid.p = mbedtls_calloc( 1, oid_len ); in mbedtls_asn1_store_named_data()
349 if( cur->oid.p == NULL ) in mbedtls_asn1_store_named_data()
355 memcpy( cur->oid.p, oid, oid_len ); in mbedtls_asn1_store_named_data()
358 cur->val.p = mbedtls_calloc( 1, val_len ); in mbedtls_asn1_store_named_data()
359 if( cur->val.p == NULL ) in mbedtls_asn1_store_named_data()
361 mbedtls_free( cur->oid.p ); in mbedtls_asn1_store_named_data()
376 void *p = mbedtls_calloc( 1, val_len ); in mbedtls_asn1_store_named_data() local
377 if( p == NULL ) in mbedtls_asn1_store_named_data()
380 mbedtls_free( cur->val.p ); in mbedtls_asn1_store_named_data()
381 cur->val.p = p; in mbedtls_asn1_store_named_data()
386 memcpy( cur->val.p, val, val_len ); in mbedtls_asn1_store_named_data()