Valerio Setti | 25b282e | 2024-01-17 10:55:32 +0100 | [diff] [blame] | 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 |
Harry Ramsey | 0f6bc41 | 2024-10-04 10:36:54 +0100 | [diff] [blame^] | 12 | |
| 13 | #include "common.h" |
Valerio Setti | 25b282e | 2024-01-17 10:55:32 +0100 | [diff] [blame] | 14 | #include "mbedtls/private_access.h" |
| 15 | |
| 16 | #include "mbedtls/build_info.h" |
| 17 | |
| 18 | #include "mbedtls/x509.h" |
| 19 | #include "mbedtls/asn1.h" |
Valerio Setti | 639d567 | 2024-01-17 11:04:56 +0100 | [diff] [blame] | 20 | #include "pk_internal.h" |
Valerio Setti | 25b282e | 2024-01-17 10:55:32 +0100 | [diff] [blame] | 21 | |
| 22 | #if defined(MBEDTLS_RSA_C) |
| 23 | #include "mbedtls/rsa.h" |
| 24 | #endif |
| 25 | |
Valerio Setti | 25b282e | 2024-01-17 10:55:32 +0100 | [diff] [blame] | 26 | int mbedtls_x509_get_name(unsigned char **p, const unsigned char *end, |
| 27 | mbedtls_x509_name *cur); |
| 28 | int mbedtls_x509_get_alg_null(unsigned char **p, const unsigned char *end, |
| 29 | mbedtls_x509_buf *alg); |
| 30 | int mbedtls_x509_get_alg(unsigned char **p, const unsigned char *end, |
| 31 | mbedtls_x509_buf *alg, mbedtls_x509_buf *params); |
| 32 | #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) |
| 33 | int mbedtls_x509_get_rsassa_pss_params(const mbedtls_x509_buf *params, |
| 34 | mbedtls_md_type_t *md_alg, mbedtls_md_type_t *mgf_md, |
| 35 | int *salt_len); |
| 36 | #endif |
| 37 | int mbedtls_x509_get_sig(unsigned char **p, const unsigned char *end, mbedtls_x509_buf *sig); |
| 38 | int mbedtls_x509_get_sig_alg(const mbedtls_x509_buf *sig_oid, const mbedtls_x509_buf *sig_params, |
| 39 | mbedtls_md_type_t *md_alg, mbedtls_pk_type_t *pk_alg, |
| 40 | void **sig_opts); |
| 41 | int mbedtls_x509_get_time(unsigned char **p, const unsigned char *end, |
| 42 | mbedtls_x509_time *t); |
| 43 | int mbedtls_x509_get_serial(unsigned char **p, const unsigned char *end, |
| 44 | mbedtls_x509_buf *serial); |
| 45 | int mbedtls_x509_get_ext(unsigned char **p, const unsigned char *end, |
| 46 | mbedtls_x509_buf *ext, int tag); |
| 47 | #if !defined(MBEDTLS_X509_REMOVE_INFO) |
| 48 | int mbedtls_x509_sig_alg_gets(char *buf, size_t size, const mbedtls_x509_buf *sig_oid, |
| 49 | mbedtls_pk_type_t pk_alg, mbedtls_md_type_t md_alg, |
| 50 | const void *sig_opts); |
| 51 | #endif |
| 52 | int mbedtls_x509_key_size_helper(char *buf, size_t buf_size, const char *name); |
| 53 | int mbedtls_x509_set_extension(mbedtls_asn1_named_data **head, const char *oid, size_t oid_len, |
| 54 | int critical, const unsigned char *val, |
| 55 | size_t val_len); |
| 56 | int mbedtls_x509_write_extensions(unsigned char **p, unsigned char *start, |
| 57 | mbedtls_asn1_named_data *first); |
| 58 | int mbedtls_x509_write_names(unsigned char **p, unsigned char *start, |
| 59 | mbedtls_asn1_named_data *first); |
| 60 | int mbedtls_x509_write_sig(unsigned char **p, unsigned char *start, |
| 61 | const char *oid, size_t oid_len, |
| 62 | unsigned char *sig, size_t size, |
| 63 | mbedtls_pk_type_t pk_alg); |
| 64 | int mbedtls_x509_get_ns_cert_type(unsigned char **p, |
| 65 | const unsigned char *end, |
| 66 | unsigned char *ns_cert_type); |
| 67 | int mbedtls_x509_get_key_usage(unsigned char **p, |
| 68 | const unsigned char *end, |
| 69 | unsigned int *key_usage); |
| 70 | int mbedtls_x509_get_subject_alt_name(unsigned char **p, |
| 71 | const unsigned char *end, |
| 72 | mbedtls_x509_sequence *subject_alt_name); |
| 73 | int mbedtls_x509_get_subject_alt_name_ext(unsigned char **p, |
| 74 | const unsigned char *end, |
| 75 | mbedtls_x509_sequence *subject_alt_name); |
| 76 | int mbedtls_x509_info_subject_alt_name(char **buf, size_t *size, |
| 77 | const mbedtls_x509_sequence |
| 78 | *subject_alt_name, |
| 79 | const char *prefix); |
| 80 | int mbedtls_x509_info_cert_type(char **buf, size_t *size, |
| 81 | unsigned char ns_cert_type); |
| 82 | int mbedtls_x509_info_key_usage(char **buf, size_t *size, |
| 83 | unsigned int key_usage); |
| 84 | |
| 85 | int mbedtls_x509_write_set_san_common(mbedtls_asn1_named_data **extensions, |
| 86 | const mbedtls_x509_san_list *san_list); |
| 87 | |
| 88 | #endif /* MBEDTLS_X509_INTERNAL_H */ |