Lines Matching refs:csr

94 int mbedtls_x509_csr_parse_der( mbedtls_x509_csr *csr,  in mbedtls_x509_csr_parse_der()  argument
107 if( csr == NULL || buf == NULL || buflen == 0 ) in mbedtls_x509_csr_parse_der()
110 mbedtls_x509_csr_init( csr ); in mbedtls_x509_csr_parse_der()
122 csr->raw.p = p; in mbedtls_x509_csr_parse_der()
123 csr->raw.len = len; in mbedtls_x509_csr_parse_der()
136 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
142 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
150 csr->cri.p = p; in mbedtls_x509_csr_parse_der()
155 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
160 csr->cri.len = end - csr->cri.p; in mbedtls_x509_csr_parse_der()
165 if( ( ret = x509_csr_get_version( &p, end, &csr->version ) ) != 0 ) in mbedtls_x509_csr_parse_der()
167 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
171 csr->version++; in mbedtls_x509_csr_parse_der()
173 if( csr->version != 1 ) in mbedtls_x509_csr_parse_der()
175 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
182 csr->subject_raw.p = p; in mbedtls_x509_csr_parse_der()
187 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
191 if( ( ret = mbedtls_x509_get_name( &p, p + len, &csr->subject ) ) != 0 ) in mbedtls_x509_csr_parse_der()
193 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
197 csr->subject_raw.len = p - csr->subject_raw.p; in mbedtls_x509_csr_parse_der()
202 if( ( ret = mbedtls_pk_parse_subpubkey( &p, end, &csr->pk ) ) != 0 ) in mbedtls_x509_csr_parse_der()
204 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
221 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
227 end = csr->raw.p + csr->raw.len; in mbedtls_x509_csr_parse_der()
233 if( ( ret = mbedtls_x509_get_alg( &p, end, &csr->sig_oid, &sig_params ) ) != 0 ) in mbedtls_x509_csr_parse_der()
235 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
239 if( ( ret = mbedtls_x509_get_sig_alg( &csr->sig_oid, &sig_params, in mbedtls_x509_csr_parse_der()
240 &csr->sig_md, &csr->sig_pk, in mbedtls_x509_csr_parse_der()
241 &csr->sig_opts ) ) != 0 ) in mbedtls_x509_csr_parse_der()
243 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
247 if( ( ret = mbedtls_x509_get_sig( &p, end, &csr->sig ) ) != 0 ) in mbedtls_x509_csr_parse_der()
249 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
255 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
266 int mbedtls_x509_csr_parse( mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen ) in mbedtls_x509_csr_parse() argument
277 if( csr == NULL || buf == NULL || buflen == 0 ) in mbedtls_x509_csr_parse()
297 if( ( ret = mbedtls_x509_csr_parse_der( csr, pem.buf, pem.buflen ) ) != 0 ) in mbedtls_x509_csr_parse()
310 return( mbedtls_x509_csr_parse_der( csr, buf, buflen ) ); in mbedtls_x509_csr_parse()
317 int mbedtls_x509_csr_parse_file( mbedtls_x509_csr *csr, const char *path ) in mbedtls_x509_csr_parse_file() argument
326 ret = mbedtls_x509_csr_parse( csr, buf, n ); in mbedtls_x509_csr_parse_file()
341 const mbedtls_x509_csr *csr ) in mbedtls_x509_csr_info() argument
352 prefix, csr->version ); in mbedtls_x509_csr_info()
357 ret = mbedtls_x509_dn_gets( p, n, &csr->subject ); in mbedtls_x509_csr_info()
363 ret = mbedtls_x509_sig_alg_gets( p, n, &csr->sig_oid, csr->sig_pk, csr->sig_md, in mbedtls_x509_csr_info()
364 csr->sig_opts ); in mbedtls_x509_csr_info()
368 mbedtls_pk_get_name( &csr->pk ) ) ) != 0 ) in mbedtls_x509_csr_info()
374 (int) mbedtls_pk_get_bitlen( &csr->pk ) ); in mbedtls_x509_csr_info()
383 void mbedtls_x509_csr_init( mbedtls_x509_csr *csr ) in mbedtls_x509_csr_init() argument
385 memset( csr, 0, sizeof(mbedtls_x509_csr) ); in mbedtls_x509_csr_init()
391 void mbedtls_x509_csr_free( mbedtls_x509_csr *csr ) in mbedtls_x509_csr_free() argument
396 if( csr == NULL ) in mbedtls_x509_csr_free()
399 mbedtls_pk_free( &csr->pk ); in mbedtls_x509_csr_free()
402 mbedtls_free( csr->sig_opts ); in mbedtls_x509_csr_free()
405 name_cur = csr->subject.next; in mbedtls_x509_csr_free()
414 if( csr->raw.p != NULL ) in mbedtls_x509_csr_free()
416 mbedtls_zeroize( csr->raw.p, csr->raw.len ); in mbedtls_x509_csr_free()
417 mbedtls_free( csr->raw.p ); in mbedtls_x509_csr_free()
420 mbedtls_zeroize( csr, sizeof( mbedtls_x509_csr ) ); in mbedtls_x509_csr_free()