2022-03-15 13:29:32 +01:00
|
|
|
/*
|
|
|
|
* X.509 Certificate Signing Request (CSR) parsing
|
|
|
|
*
|
|
|
|
* Copyright The Mbed TLS Contributors
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* The ITU-T X.509 standard defines a certificate format for PKI.
|
|
|
|
*
|
|
|
|
* http://www.ietf.org/rfc/rfc5280.txt (Certificates and CRLs)
|
|
|
|
* http://www.ietf.org/rfc/rfc3279.txt (Alg IDs for CRLs)
|
|
|
|
* http://www.ietf.org/rfc/rfc2986.txt (CSRs, aka PKCS#10)
|
|
|
|
*
|
|
|
|
* http://www.itu.int/ITU-T/studygroups/com17/languages/X.680-0207.pdf
|
|
|
|
* http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_X509_CSR_PARSE_C)
|
|
|
|
|
|
|
|
#include "mbedtls/x509_csr.h"
|
|
|
|
#include "mbedtls/error.h"
|
|
|
|
#include "mbedtls/oid.h"
|
|
|
|
#include "mbedtls/platform_util.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_PEM_PARSE_C)
|
|
|
|
#include "mbedtls/pem.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "mbedtls/platform.h"
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_FS_IO) || defined(EFIX64) || defined(EFI32)
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Version ::= INTEGER { v1(0) }
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
static int x509_csr_get_version(unsigned char **p,
|
|
|
|
const unsigned char *end,
|
|
|
|
int *ver)
|
2022-03-15 13:29:32 +01:00
|
|
|
{
|
|
|
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_asn1_get_int(p, end, ver)) != 0) {
|
|
|
|
if (ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG) {
|
2022-03-15 13:29:32 +01:00
|
|
|
*ver = 0;
|
2023-08-30 11:18:00 +02:00
|
|
|
return 0;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_VERSION, ret);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
return 0;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Parse a CSR in DER format
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
int mbedtls_x509_csr_parse_der(mbedtls_x509_csr *csr,
|
|
|
|
const unsigned char *buf, size_t buflen)
|
2022-03-15 13:29:32 +01:00
|
|
|
{
|
|
|
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
|
|
size_t len;
|
|
|
|
unsigned char *p, *end;
|
|
|
|
mbedtls_x509_buf sig_params;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
memset(&sig_params, 0, sizeof(mbedtls_x509_buf));
|
2022-03-15 13:29:32 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Check for valid input
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
if (csr == NULL || buf == NULL || buflen == 0) {
|
|
|
|
return MBEDTLS_ERR_X509_BAD_INPUT_DATA;
|
|
|
|
}
|
2022-03-15 13:29:32 +01:00
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
mbedtls_x509_csr_init(csr);
|
2022-03-15 13:29:32 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* first copy the raw DER data
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
p = mbedtls_calloc(1, len = buflen);
|
2022-03-15 13:29:32 +01:00
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if (p == NULL) {
|
|
|
|
return MBEDTLS_ERR_X509_ALLOC_FAILED;
|
|
|
|
}
|
2022-03-15 13:29:32 +01:00
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
memcpy(p, buf, buflen);
|
2022-03-15 13:29:32 +01:00
|
|
|
|
|
|
|
csr->raw.p = p;
|
|
|
|
csr->raw.len = len;
|
|
|
|
end = p + len;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CertificationRequest ::= SEQUENCE {
|
|
|
|
* certificationRequestInfo CertificationRequestInfo,
|
|
|
|
* signatureAlgorithm AlgorithmIdentifier,
|
|
|
|
* signature BIT STRING
|
|
|
|
* }
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_asn1_get_tag(&p, end, &len,
|
|
|
|
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE)) != 0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return MBEDTLS_ERR_X509_INVALID_FORMAT;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if (len != (size_t) (end - p)) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT,
|
|
|
|
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CertificationRequestInfo ::= SEQUENCE {
|
|
|
|
*/
|
|
|
|
csr->cri.p = p;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_asn1_get_tag(&p, end, &len,
|
|
|
|
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE)) != 0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
end = p + len;
|
|
|
|
csr->cri.len = end - csr->cri.p;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Version ::= INTEGER { v1(0) }
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = x509_csr_get_version(&p, end, &csr->version)) != 0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return ret;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if (csr->version != 0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return MBEDTLS_ERR_X509_UNKNOWN_VERSION;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
csr->version++;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* subject Name
|
|
|
|
*/
|
|
|
|
csr->subject_raw.p = p;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_asn1_get_tag(&p, end, &len,
|
|
|
|
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE)) != 0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_x509_get_name(&p, p + len, &csr->subject)) != 0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return ret;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
csr->subject_raw.len = p - csr->subject_raw.p;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* subjectPKInfo SubjectPublicKeyInfo
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_pk_parse_subpubkey(&p, end, &csr->pk)) != 0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return ret;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* attributes [0] Attributes
|
|
|
|
*
|
|
|
|
* The list of possible attributes is open-ended, though RFC 2985
|
|
|
|
* (PKCS#9) defines a few in section 5.4. We currently don't support any,
|
|
|
|
* so we just ignore them. This is a safe thing to do as the worst thing
|
|
|
|
* that could happen is that we issue a certificate that does not match
|
|
|
|
* the requester's expectations - this cannot cause a violation of our
|
|
|
|
* signature policies.
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_asn1_get_tag(&p, end, &len,
|
|
|
|
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_CONTEXT_SPECIFIC)) !=
|
|
|
|
0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
p += len;
|
|
|
|
|
|
|
|
end = csr->raw.p + csr->raw.len;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* signatureAlgorithm AlgorithmIdentifier,
|
|
|
|
* signature BIT STRING
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_x509_get_alg(&p, end, &csr->sig_oid, &sig_params)) != 0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return ret;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_x509_get_sig_alg(&csr->sig_oid, &sig_params,
|
|
|
|
&csr->sig_md, &csr->sig_pk,
|
|
|
|
&csr->sig_opts)) != 0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_x509_get_sig(&p, end, &csr->sig)) != 0) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return ret;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if (p != end) {
|
|
|
|
mbedtls_x509_csr_free(csr);
|
|
|
|
return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT,
|
|
|
|
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
return 0;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Parse a CSR, allowing for PEM or raw DER encoding
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
int mbedtls_x509_csr_parse(mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen)
|
2022-03-15 13:29:32 +01:00
|
|
|
{
|
|
|
|
#if defined(MBEDTLS_PEM_PARSE_C)
|
|
|
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
|
|
size_t use_len;
|
|
|
|
mbedtls_pem_context pem;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check for valid input
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
if (csr == NULL || buf == NULL || buflen == 0) {
|
|
|
|
return MBEDTLS_ERR_X509_BAD_INPUT_DATA;
|
|
|
|
}
|
2022-03-15 13:29:32 +01:00
|
|
|
|
|
|
|
#if defined(MBEDTLS_PEM_PARSE_C)
|
|
|
|
/* Avoid calling mbedtls_pem_read_buffer() on non-null-terminated string */
|
2023-08-30 11:18:00 +02:00
|
|
|
if (buf[buflen - 1] == '\0') {
|
|
|
|
mbedtls_pem_init(&pem);
|
|
|
|
ret = mbedtls_pem_read_buffer(&pem,
|
|
|
|
"-----BEGIN CERTIFICATE REQUEST-----",
|
|
|
|
"-----END CERTIFICATE REQUEST-----",
|
|
|
|
buf, NULL, 0, &use_len);
|
|
|
|
if (ret == MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT) {
|
|
|
|
ret = mbedtls_pem_read_buffer(&pem,
|
|
|
|
"-----BEGIN NEW CERTIFICATE REQUEST-----",
|
|
|
|
"-----END NEW CERTIFICATE REQUEST-----",
|
|
|
|
buf, NULL, 0, &use_len);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if (ret == 0) {
|
2022-03-15 13:29:32 +01:00
|
|
|
/*
|
|
|
|
* Was PEM encoded, parse the result
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
ret = mbedtls_x509_csr_parse_der(csr, pem.buf, pem.buflen);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
mbedtls_pem_free(&pem);
|
|
|
|
if (ret != MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT) {
|
|
|
|
return ret;
|
|
|
|
}
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
#endif /* MBEDTLS_PEM_PARSE_C */
|
2023-08-30 11:18:00 +02:00
|
|
|
return mbedtls_x509_csr_parse_der(csr, buf, buflen);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_FS_IO)
|
|
|
|
/*
|
|
|
|
* Load a CSR into the structure
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
int mbedtls_x509_csr_parse_file(mbedtls_x509_csr *csr, const char *path)
|
2022-03-15 13:29:32 +01:00
|
|
|
{
|
|
|
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
|
|
size_t n;
|
|
|
|
unsigned char *buf;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_pk_load_file(path, &buf, &n)) != 0) {
|
|
|
|
return ret;
|
|
|
|
}
|
2022-03-15 13:29:32 +01:00
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
ret = mbedtls_x509_csr_parse(csr, buf, n);
|
2022-03-15 13:29:32 +01:00
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
mbedtls_platform_zeroize(buf, n);
|
|
|
|
mbedtls_free(buf);
|
2022-03-15 13:29:32 +01:00
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
return ret;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
#endif /* MBEDTLS_FS_IO */
|
|
|
|
|
|
|
|
#define BEFORE_COLON 14
|
|
|
|
#define BC "14"
|
|
|
|
/*
|
|
|
|
* Return an informational string about the CSR.
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
int mbedtls_x509_csr_info(char *buf, size_t size, const char *prefix,
|
|
|
|
const mbedtls_x509_csr *csr)
|
2022-03-15 13:29:32 +01:00
|
|
|
{
|
|
|
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
|
|
size_t n;
|
|
|
|
char *p;
|
|
|
|
char key_size_str[BEFORE_COLON];
|
|
|
|
|
|
|
|
p = buf;
|
|
|
|
n = size;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
ret = mbedtls_snprintf(p, n, "%sCSR version : %d",
|
|
|
|
prefix, csr->version);
|
2022-03-15 13:29:32 +01:00
|
|
|
MBEDTLS_X509_SAFE_SNPRINTF;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
ret = mbedtls_snprintf(p, n, "\n%ssubject name : ", prefix);
|
2022-03-15 13:29:32 +01:00
|
|
|
MBEDTLS_X509_SAFE_SNPRINTF;
|
2023-08-30 11:18:00 +02:00
|
|
|
ret = mbedtls_x509_dn_gets(p, n, &csr->subject);
|
2022-03-15 13:29:32 +01:00
|
|
|
MBEDTLS_X509_SAFE_SNPRINTF;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
ret = mbedtls_snprintf(p, n, "\n%ssigned using : ", prefix);
|
2022-03-15 13:29:32 +01:00
|
|
|
MBEDTLS_X509_SAFE_SNPRINTF;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
ret = mbedtls_x509_sig_alg_gets(p, n, &csr->sig_oid, csr->sig_pk, csr->sig_md,
|
|
|
|
csr->sig_opts);
|
2022-03-15 13:29:32 +01:00
|
|
|
MBEDTLS_X509_SAFE_SNPRINTF;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if ((ret = mbedtls_x509_key_size_helper(key_size_str, BEFORE_COLON,
|
|
|
|
mbedtls_pk_get_name(&csr->pk))) != 0) {
|
|
|
|
return ret;
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
ret = mbedtls_snprintf(p, n, "\n%s%-" BC "s: %d bits\n", prefix, key_size_str,
|
|
|
|
(int) mbedtls_pk_get_bitlen(&csr->pk));
|
2022-03-15 13:29:32 +01:00
|
|
|
MBEDTLS_X509_SAFE_SNPRINTF;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
return (int) (size - n);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize a CSR
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
void mbedtls_x509_csr_init(mbedtls_x509_csr *csr)
|
2022-03-15 13:29:32 +01:00
|
|
|
{
|
2023-08-30 11:18:00 +02:00
|
|
|
memset(csr, 0, sizeof(mbedtls_x509_csr));
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Unallocate all CSR data
|
|
|
|
*/
|
2023-08-30 11:18:00 +02:00
|
|
|
void mbedtls_x509_csr_free(mbedtls_x509_csr *csr)
|
2022-03-15 13:29:32 +01:00
|
|
|
{
|
|
|
|
mbedtls_x509_name *name_cur;
|
|
|
|
mbedtls_x509_name *name_prv;
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if (csr == NULL) {
|
2022-03-15 13:29:32 +01:00
|
|
|
return;
|
2023-08-30 11:18:00 +02:00
|
|
|
}
|
2022-03-15 13:29:32 +01:00
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
mbedtls_pk_free(&csr->pk);
|
2022-03-15 13:29:32 +01:00
|
|
|
|
|
|
|
#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)
|
2023-08-30 11:18:00 +02:00
|
|
|
mbedtls_free(csr->sig_opts);
|
2022-03-15 13:29:32 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
name_cur = csr->subject.next;
|
2023-08-30 11:18:00 +02:00
|
|
|
while (name_cur != NULL) {
|
2022-03-15 13:29:32 +01:00
|
|
|
name_prv = name_cur;
|
|
|
|
name_cur = name_cur->next;
|
2023-08-30 11:18:00 +02:00
|
|
|
mbedtls_platform_zeroize(name_prv, sizeof(mbedtls_x509_name));
|
|
|
|
mbedtls_free(name_prv);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
if (csr->raw.p != NULL) {
|
|
|
|
mbedtls_platform_zeroize(csr->raw.p, csr->raw.len);
|
|
|
|
mbedtls_free(csr->raw.p);
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
2023-08-30 11:18:00 +02:00
|
|
|
mbedtls_platform_zeroize(csr, sizeof(mbedtls_x509_csr));
|
2022-03-15 13:29:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* MBEDTLS_X509_CSR_PARSE_C */
|