1 /** 2 * \file x509.h 3 * 4 * \brief Internal part of the public "x509.h". 5 */ 6 /* 7 * Copyright The Mbed TLS Contributors 8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 */ 10 #ifndef MBEDTLS_X509_INTERNAL_H 11 #define MBEDTLS_X509_INTERNAL_H 12 #include "mbedtls/private_access.h" 13 14 #include "mbedtls/build_info.h" 15 16 #include "mbedtls/x509.h" 17 #include "mbedtls/asn1.h" 18 #include "pk_internal.h" 19 20 #if defined(MBEDTLS_RSA_C) 21 #include "mbedtls/rsa.h" 22 #endif 23 24 int mbedtls_x509_get_name(unsigned char **p, const unsigned char *end, 25 mbedtls_x509_name *cur); 26 int mbedtls_x509_get_alg_null(unsigned char **p, const unsigned char *end, 27 mbedtls_x509_buf *alg); 28 int mbedtls_x509_get_alg(unsigned char **p, const unsigned char *end, 29 mbedtls_x509_buf *alg, mbedtls_x509_buf *params); 30 #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) 31 int mbedtls_x509_get_rsassa_pss_params(const mbedtls_x509_buf *params, 32 mbedtls_md_type_t *md_alg, mbedtls_md_type_t *mgf_md, 33 int *salt_len); 34 #endif 35 int mbedtls_x509_get_sig(unsigned char **p, const unsigned char *end, mbedtls_x509_buf *sig); 36 int mbedtls_x509_get_sig_alg(const mbedtls_x509_buf *sig_oid, const mbedtls_x509_buf *sig_params, 37 mbedtls_md_type_t *md_alg, mbedtls_pk_type_t *pk_alg, 38 void **sig_opts); 39 int mbedtls_x509_get_time(unsigned char **p, const unsigned char *end, 40 mbedtls_x509_time *t); 41 int mbedtls_x509_get_serial(unsigned char **p, const unsigned char *end, 42 mbedtls_x509_buf *serial); 43 int mbedtls_x509_get_ext(unsigned char **p, const unsigned char *end, 44 mbedtls_x509_buf *ext, int tag); 45 #if !defined(MBEDTLS_X509_REMOVE_INFO) 46 int mbedtls_x509_sig_alg_gets(char *buf, size_t size, const mbedtls_x509_buf *sig_oid, 47 mbedtls_pk_type_t pk_alg, mbedtls_md_type_t md_alg, 48 const void *sig_opts); 49 #endif 50 int mbedtls_x509_key_size_helper(char *buf, size_t buf_size, const char *name); 51 int mbedtls_x509_set_extension(mbedtls_asn1_named_data **head, const char *oid, size_t oid_len, 52 int critical, const unsigned char *val, 53 size_t val_len); 54 int mbedtls_x509_write_extensions(unsigned char **p, unsigned char *start, 55 mbedtls_asn1_named_data *first); 56 int mbedtls_x509_write_names(unsigned char **p, unsigned char *start, 57 mbedtls_asn1_named_data *first); 58 int mbedtls_x509_write_sig(unsigned char **p, unsigned char *start, 59 const char *oid, size_t oid_len, 60 unsigned char *sig, size_t size, 61 mbedtls_pk_type_t pk_alg); 62 int mbedtls_x509_get_ns_cert_type(unsigned char **p, 63 const unsigned char *end, 64 unsigned char *ns_cert_type); 65 int mbedtls_x509_get_key_usage(unsigned char **p, 66 const unsigned char *end, 67 unsigned int *key_usage); 68 int mbedtls_x509_get_subject_alt_name(unsigned char **p, 69 const unsigned char *end, 70 mbedtls_x509_sequence *subject_alt_name); 71 int mbedtls_x509_get_subject_alt_name_ext(unsigned char **p, 72 const unsigned char *end, 73 mbedtls_x509_sequence *subject_alt_name); 74 int mbedtls_x509_info_subject_alt_name(char **buf, size_t *size, 75 const mbedtls_x509_sequence 76 *subject_alt_name, 77 const char *prefix); 78 int mbedtls_x509_info_cert_type(char **buf, size_t *size, 79 unsigned char ns_cert_type); 80 int mbedtls_x509_info_key_usage(char **buf, size_t *size, 81 unsigned int key_usage); 82 83 int mbedtls_x509_write_set_san_common(mbedtls_asn1_named_data **extensions, 84 const mbedtls_x509_san_list *san_list); 85 86 #endif /* MBEDTLS_X509_INTERNAL_H */ 87