Lines Matching refs:csr
85 int mbedtls_x509_csr_parse_der( mbedtls_x509_csr *csr, in mbedtls_x509_csr_parse_der() argument
98 if( csr == NULL || buf == NULL || buflen == 0 ) in mbedtls_x509_csr_parse_der()
101 mbedtls_x509_csr_init( csr ); in mbedtls_x509_csr_parse_der()
113 csr->raw.p = p; in mbedtls_x509_csr_parse_der()
114 csr->raw.len = len; in mbedtls_x509_csr_parse_der()
127 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
133 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
141 csr->cri.p = p; in mbedtls_x509_csr_parse_der()
146 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
151 csr->cri.len = end - csr->cri.p; in mbedtls_x509_csr_parse_der()
156 if( ( ret = x509_csr_get_version( &p, end, &csr->version ) ) != 0 ) in mbedtls_x509_csr_parse_der()
158 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
162 if( csr->version != 0 ) in mbedtls_x509_csr_parse_der()
164 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
168 csr->version++; in mbedtls_x509_csr_parse_der()
173 csr->subject_raw.p = p; in mbedtls_x509_csr_parse_der()
178 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
182 if( ( ret = mbedtls_x509_get_name( &p, p + len, &csr->subject ) ) != 0 ) in mbedtls_x509_csr_parse_der()
184 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
188 csr->subject_raw.len = p - csr->subject_raw.p; in mbedtls_x509_csr_parse_der()
193 if( ( ret = mbedtls_pk_parse_subpubkey( &p, end, &csr->pk ) ) != 0 ) in mbedtls_x509_csr_parse_der()
195 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
212 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
218 end = csr->raw.p + csr->raw.len; in mbedtls_x509_csr_parse_der()
224 if( ( ret = mbedtls_x509_get_alg( &p, end, &csr->sig_oid, &sig_params ) ) != 0 ) in mbedtls_x509_csr_parse_der()
226 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
230 if( ( ret = mbedtls_x509_get_sig_alg( &csr->sig_oid, &sig_params, in mbedtls_x509_csr_parse_der()
231 &csr->sig_md, &csr->sig_pk, in mbedtls_x509_csr_parse_der()
232 &csr->sig_opts ) ) != 0 ) in mbedtls_x509_csr_parse_der()
234 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
238 if( ( ret = mbedtls_x509_get_sig( &p, end, &csr->sig ) ) != 0 ) in mbedtls_x509_csr_parse_der()
240 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
246 mbedtls_x509_csr_free( csr ); in mbedtls_x509_csr_parse_der()
257 int mbedtls_x509_csr_parse( mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen ) in mbedtls_x509_csr_parse() argument
268 if( csr == NULL || buf == NULL || buflen == 0 ) in mbedtls_x509_csr_parse()
293 ret = mbedtls_x509_csr_parse_der( csr, pem.buf, pem.buflen ); in mbedtls_x509_csr_parse()
301 return( mbedtls_x509_csr_parse_der( csr, buf, buflen ) ); in mbedtls_x509_csr_parse()
308 int mbedtls_x509_csr_parse_file( mbedtls_x509_csr *csr, const char *path ) in mbedtls_x509_csr_parse_file() argument
317 ret = mbedtls_x509_csr_parse( csr, buf, n ); in mbedtls_x509_csr_parse_file()
333 const mbedtls_x509_csr *csr ) in mbedtls_x509_csr_info() argument
344 prefix, csr->version ); in mbedtls_x509_csr_info()
349 ret = mbedtls_x509_dn_gets( p, n, &csr->subject ); in mbedtls_x509_csr_info()
355 ret = mbedtls_x509_sig_alg_gets( p, n, &csr->sig_oid, csr->sig_pk, csr->sig_md, in mbedtls_x509_csr_info()
356 csr->sig_opts ); in mbedtls_x509_csr_info()
360 mbedtls_pk_get_name( &csr->pk ) ) ) != 0 ) in mbedtls_x509_csr_info()
366 (int) mbedtls_pk_get_bitlen( &csr->pk ) ); in mbedtls_x509_csr_info()
376 void mbedtls_x509_csr_init( mbedtls_x509_csr *csr ) in mbedtls_x509_csr_init() argument
378 memset( csr, 0, sizeof(mbedtls_x509_csr) ); in mbedtls_x509_csr_init()
384 void mbedtls_x509_csr_free( mbedtls_x509_csr *csr ) in mbedtls_x509_csr_free() argument
389 if( csr == NULL ) in mbedtls_x509_csr_free()
392 mbedtls_pk_free( &csr->pk ); in mbedtls_x509_csr_free()
395 mbedtls_free( csr->sig_opts ); in mbedtls_x509_csr_free()
398 name_cur = csr->subject.next; in mbedtls_x509_csr_free()
407 if( csr->raw.p != NULL ) in mbedtls_x509_csr_free()
409 mbedtls_platform_zeroize( csr->raw.p, csr->raw.len ); in mbedtls_x509_csr_free()
410 mbedtls_free( csr->raw.p ); in mbedtls_x509_csr_free()
413 mbedtls_platform_zeroize( csr, sizeof( mbedtls_x509_csr ) ); in mbedtls_x509_csr_free()