Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 1 | /** |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2 | * \file mbedtls_x509_csr.h |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 3 | * |
| 4 | * \brief X.509 certificate signing request parsing and writing |
| 5 | * |
Manuel Pégourié-Gonnard | a658a40 | 2015-01-23 09:45:19 +0000 | [diff] [blame] | 6 | * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 7 | * |
Manuel Pégourié-Gonnard | fe44643 | 2015-03-06 13:17:10 +0000 | [diff] [blame] | 8 | * This file is part of mbed TLS (https://tls.mbed.org) |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 9 | * |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License along |
| 21 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 22 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 23 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 24 | #ifndef MBEDTLS_X509_CSR_H |
| 25 | #define MBEDTLS_X509_CSR_H |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 26 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 27 | #if !defined(MBEDTLS_CONFIG_FILE) |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 28 | #include "config.h" |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 29 | #else |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 30 | #include MBEDTLS_CONFIG_FILE |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 31 | #endif |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 32 | |
| 33 | #include "x509.h" |
| 34 | |
| 35 | #ifdef __cplusplus |
| 36 | extern "C" { |
| 37 | #endif |
| 38 | |
| 39 | /** |
| 40 | * \addtogroup x509_module |
| 41 | * \{ */ |
| 42 | |
| 43 | /** |
| 44 | * \name Structures and functions for X.509 Certificate Signing Requests (CSR) |
| 45 | * \{ |
| 46 | */ |
| 47 | |
| 48 | /** |
| 49 | * Certificate Signing Request (CSR) structure. |
| 50 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 51 | typedef struct mbedtls_x509_csr |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 52 | { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 53 | mbedtls_x509_buf raw; /**< The raw CSR data (DER). */ |
| 54 | mbedtls_x509_buf cri; /**< The raw CertificateRequestInfo body (DER). */ |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 55 | |
Manuel Pégourié-Gonnard | f4e1b64 | 2014-06-19 11:39:46 +0200 | [diff] [blame] | 56 | int version; /**< CSR version (1=v1). */ |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 57 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 58 | mbedtls_x509_buf subject_raw; /**< The raw subject data (DER). */ |
| 59 | mbedtls_x509_name subject; /**< The parsed subject data (named information object). */ |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 60 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 61 | mbedtls_pk_context pk; /**< Container for the public key context. */ |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 62 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 63 | mbedtls_x509_buf sig_oid; |
| 64 | mbedtls_x509_buf sig; |
| 65 | mbedtls_md_type_t sig_md; /**< Internal representation of the MD algorithm of the signature algorithm, e.g. MBEDTLS_MD_SHA256 */ |
| 66 | mbedtls_pk_type_t sig_pk; /**< Internal representation of the Public Key algorithm of the signature algorithm, e.g. MBEDTLS_PK_RSA */ |
| 67 | void *sig_opts; /**< Signature options to be passed to mbedtls_pk_verify_ext(), e.g. for RSASSA-PSS */ |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 68 | } |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 69 | mbedtls_x509_csr; |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 70 | |
| 71 | /** |
| 72 | * Container for writing a CSR |
| 73 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 74 | typedef struct mbedtls_x509write_csr |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 75 | { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 76 | mbedtls_pk_context *key; |
| 77 | mbedtls_asn1_named_data *subject; |
| 78 | mbedtls_md_type_t md_alg; |
| 79 | mbedtls_asn1_named_data *extensions; |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 80 | } |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 81 | mbedtls_x509write_csr; |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 82 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 83 | #if defined(MBEDTLS_X509_CSR_PARSE_C) |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 84 | /** |
Manuel Pégourié-Gonnard | f3b4724 | 2014-06-16 18:06:48 +0200 | [diff] [blame] | 85 | * \brief Load a Certificate Signing Request (CSR) in DER format |
| 86 | * |
| 87 | * \param csr CSR context to fill |
| 88 | * \param buf buffer holding the CRL data |
| 89 | * \param buflen size of the buffer |
| 90 | * |
| 91 | * \return 0 if successful, or a specific X509 error code |
| 92 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 93 | int mbedtls_x509_csr_parse_der( mbedtls_x509_csr *csr, |
Manuel Pégourié-Gonnard | f3b4724 | 2014-06-16 18:06:48 +0200 | [diff] [blame] | 94 | const unsigned char *buf, size_t buflen ); |
| 95 | |
| 96 | /** |
| 97 | * \brief Load a Certificate Signing Request (CSR), DER or PEM format |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 98 | * |
| 99 | * \param csr CSR context to fill |
| 100 | * \param buf buffer holding the CRL data |
| 101 | * \param buflen size of the buffer |
Manuel Pégourié-Gonnard | 43b37cb | 2015-05-12 11:20:10 +0200 | [diff] [blame^] | 102 | * (including the terminating null byte for PEM data) |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 103 | * |
| 104 | * \return 0 if successful, or a specific X509 or PEM error code |
| 105 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 106 | int mbedtls_x509_csr_parse( mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen ); |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 107 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 108 | #if defined(MBEDTLS_FS_IO) |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 109 | /** |
| 110 | * \brief Load a Certificate Signing Request (CSR) |
| 111 | * |
| 112 | * \param csr CSR context to fill |
| 113 | * \param path filename to read the CSR from |
| 114 | * |
| 115 | * \return 0 if successful, or a specific X509 or PEM error code |
| 116 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 117 | int mbedtls_x509_csr_parse_file( mbedtls_x509_csr *csr, const char *path ); |
| 118 | #endif /* MBEDTLS_FS_IO */ |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 119 | |
| 120 | /** |
| 121 | * \brief Returns an informational string about the |
| 122 | * CSR. |
| 123 | * |
| 124 | * \param buf Buffer to write to |
| 125 | * \param size Maximum size of buffer |
| 126 | * \param prefix A line prefix |
| 127 | * \param csr The X509 CSR to represent |
| 128 | * |
Manuel Pégourié-Gonnard | d77cd5d | 2014-06-13 11:13:15 +0200 | [diff] [blame] | 129 | * \return The length of the string written (exluding the terminating |
| 130 | * null byte), or a negative value in case of an error. |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 131 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 132 | int mbedtls_x509_csr_info( char *buf, size_t size, const char *prefix, |
| 133 | const mbedtls_x509_csr *csr ); |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 134 | |
| 135 | /** |
Paul Bakker | 369d2eb | 2013-09-18 11:58:25 +0200 | [diff] [blame] | 136 | * \brief Initialize a CSR |
| 137 | * |
| 138 | * \param csr CSR to initialize |
| 139 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 140 | void mbedtls_x509_csr_init( mbedtls_x509_csr *csr ); |
Paul Bakker | 369d2eb | 2013-09-18 11:58:25 +0200 | [diff] [blame] | 141 | |
| 142 | /** |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 143 | * \brief Unallocate all CSR data |
| 144 | * |
| 145 | * \param csr CSR to free |
| 146 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 147 | void mbedtls_x509_csr_free( mbedtls_x509_csr *csr ); |
| 148 | #endif /* MBEDTLS_X509_CSR_PARSE_C */ |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 149 | |
| 150 | /* \} name */ |
| 151 | /* \} addtogroup x509_module */ |
| 152 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 153 | #if defined(MBEDTLS_X509_CSR_WRITE_C) |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 154 | /** |
| 155 | * \brief Initialize a CSR context |
| 156 | * |
| 157 | * \param ctx CSR context to initialize |
| 158 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 159 | void mbedtls_x509write_csr_init( mbedtls_x509write_csr *ctx ); |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 160 | |
| 161 | /** |
| 162 | * \brief Set the subject name for a CSR |
| 163 | * Subject names should contain a comma-separated list |
| 164 | * of OID types and values: |
Manuel Pégourié-Gonnard | b4fe3cb | 2015-01-22 16:11:05 +0000 | [diff] [blame] | 165 | * e.g. "C=UK,O=ARM,CN=mbed TLS Server 1" |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 166 | * |
| 167 | * \param ctx CSR context to use |
| 168 | * \param subject_name subject name to set |
| 169 | * |
| 170 | * \return 0 if subject name was parsed successfully, or |
| 171 | * a specific error code |
| 172 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 173 | int mbedtls_x509write_csr_set_subject_name( mbedtls_x509write_csr *ctx, |
Paul Bakker | 50dc850 | 2013-10-28 21:19:10 +0100 | [diff] [blame] | 174 | const char *subject_name ); |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 175 | |
| 176 | /** |
| 177 | * \brief Set the key for a CSR (public key will be included, |
| 178 | * private key used to sign the CSR when writing it) |
| 179 | * |
| 180 | * \param ctx CSR context to use |
| 181 | * \param key Asymetric key to include |
| 182 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 183 | void mbedtls_x509write_csr_set_key( mbedtls_x509write_csr *ctx, mbedtls_pk_context *key ); |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 184 | |
| 185 | /** |
| 186 | * \brief Set the MD algorithm to use for the signature |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 187 | * (e.g. MBEDTLS_MD_SHA1) |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 188 | * |
| 189 | * \param ctx CSR context to use |
| 190 | * \param md_alg MD algorithm to use |
| 191 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 192 | void mbedtls_x509write_csr_set_md_alg( mbedtls_x509write_csr *ctx, mbedtls_md_type_t md_alg ); |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 193 | |
| 194 | /** |
| 195 | * \brief Set the Key Usage Extension flags |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 196 | * (e.g. MBEDTLS_X509_KU_DIGITAL_SIGNATURE | MBEDTLS_X509_KU_KEY_CERT_SIGN) |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 197 | * |
| 198 | * \param ctx CSR context to use |
| 199 | * \param key_usage key usage flags to set |
| 200 | * |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 201 | * \return 0 if successful, or MBEDTLS_ERR_X509_MALLOC_FAILED |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 202 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 203 | int mbedtls_x509write_csr_set_key_usage( mbedtls_x509write_csr *ctx, unsigned char key_usage ); |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 204 | |
| 205 | /** |
| 206 | * \brief Set the Netscape Cert Type flags |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 207 | * (e.g. MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT | MBEDTLS_X509_NS_CERT_TYPE_EMAIL) |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 208 | * |
| 209 | * \param ctx CSR context to use |
| 210 | * \param ns_cert_type Netscape Cert Type flags to set |
| 211 | * |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 212 | * \return 0 if successful, or MBEDTLS_ERR_X509_MALLOC_FAILED |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 213 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 214 | int mbedtls_x509write_csr_set_ns_cert_type( mbedtls_x509write_csr *ctx, |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 215 | unsigned char ns_cert_type ); |
| 216 | |
| 217 | /** |
Paul Bakker | b9e4e2c | 2014-05-01 14:18:25 +0200 | [diff] [blame] | 218 | * \brief Generic function to add to or replace an extension in the |
| 219 | * CSR |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 220 | * |
| 221 | * \param ctx CSR context to use |
| 222 | * \param oid OID of the extension |
| 223 | * \param oid_len length of the OID |
| 224 | * \param val value of the extension OCTET STRING |
| 225 | * \param val_len length of the value data |
| 226 | * |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 227 | * \return 0 if successful, or a MBEDTLS_ERR_X509_MALLOC_FAILED |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 228 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 229 | int mbedtls_x509write_csr_set_extension( mbedtls_x509write_csr *ctx, |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 230 | const char *oid, size_t oid_len, |
| 231 | const unsigned char *val, size_t val_len ); |
| 232 | |
| 233 | /** |
| 234 | * \brief Free the contents of a CSR context |
| 235 | * |
| 236 | * \param ctx CSR context to free |
| 237 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 238 | void mbedtls_x509write_csr_free( mbedtls_x509write_csr *ctx ); |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 239 | |
| 240 | /** |
| 241 | * \brief Write a CSR (Certificate Signing Request) to a |
| 242 | * DER structure |
| 243 | * Note: data is written at the end of the buffer! Use the |
| 244 | * return value to determine where you should start |
| 245 | * using the buffer |
| 246 | * |
| 247 | * \param ctx CSR to write away |
| 248 | * \param buf buffer to write to |
| 249 | * \param size size of the buffer |
| 250 | * \param f_rng RNG function (for signature, see note) |
| 251 | * \param p_rng RNG parameter |
| 252 | * |
| 253 | * \return length of data written if successful, or a specific |
| 254 | * error code |
| 255 | * |
| 256 | * \note f_rng may be NULL if RSA is used for signature and the |
| 257 | * signature is made offline (otherwise f_rng is desirable |
| 258 | * for countermeasures against timing attacks). |
| 259 | * ECDSA signatures always require a non-NULL f_rng. |
| 260 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 261 | int mbedtls_x509write_csr_der( mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size, |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 262 | int (*f_rng)(void *, unsigned char *, size_t), |
| 263 | void *p_rng ); |
| 264 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 265 | #if defined(MBEDTLS_PEM_WRITE_C) |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 266 | /** |
| 267 | * \brief Write a CSR (Certificate Signing Request) to a |
| 268 | * PEM string |
| 269 | * |
| 270 | * \param ctx CSR to write away |
| 271 | * \param buf buffer to write to |
| 272 | * \param size size of the buffer |
| 273 | * \param f_rng RNG function (for signature, see note) |
| 274 | * \param p_rng RNG parameter |
| 275 | * |
| 276 | * \return 0 successful, or a specific error code |
| 277 | * |
| 278 | * \note f_rng may be NULL if RSA is used for signature and the |
| 279 | * signature is made offline (otherwise f_rng is desirable |
| 280 | * for couermeasures against timing attacks). |
| 281 | * ECDSA signatures always require a non-NULL f_rng. |
| 282 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 283 | int mbedtls_x509write_csr_pem( mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size, |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 284 | int (*f_rng)(void *, unsigned char *, size_t), |
| 285 | void *p_rng ); |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 286 | #endif /* MBEDTLS_PEM_WRITE_C */ |
| 287 | #endif /* MBEDTLS_X509_CSR_WRITE_C */ |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 288 | |
| 289 | #ifdef __cplusplus |
| 290 | } |
| 291 | #endif |
| 292 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 293 | #endif /* mbedtls_x509_csr.h */ |