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