XenevaOS
Loading...
Searching...
No Matches
pem.h
Go to the documentation of this file.
1
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9 */
10#ifndef MBEDTLS_PEM_H
11#define MBEDTLS_PEM_H
13
14#include "mbedtls/build_info.h"
15
16#include <stddef.h>
17
25#define MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080
27#define MBEDTLS_ERR_PEM_INVALID_DATA -0x1100
29#define MBEDTLS_ERR_PEM_ALLOC_FAILED -0x1180
31#define MBEDTLS_ERR_PEM_INVALID_ENC_IV -0x1200
33#define MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG -0x1280
35#define MBEDTLS_ERR_PEM_PASSWORD_REQUIRED -0x1300
37#define MBEDTLS_ERR_PEM_PASSWORD_MISMATCH -0x1380
39#define MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
41#define MBEDTLS_ERR_PEM_BAD_INPUT_DATA -0x1480
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48#if defined(MBEDTLS_PEM_PARSE_C)
52typedef struct mbedtls_pem_context {
53 unsigned char *MBEDTLS_PRIVATE(buf);
54 size_t MBEDTLS_PRIVATE(buflen);
55 unsigned char *MBEDTLS_PRIVATE(info);
56}
57mbedtls_pem_context;
58
64void mbedtls_pem_init(mbedtls_pem_context *ctx);
65
92int mbedtls_pem_read_buffer(mbedtls_pem_context *ctx, const char *header, const char *footer,
93 const unsigned char *data,
94 const unsigned char *pwd,
95 size_t pwdlen, size_t *use_len);
96
109static inline const unsigned char *mbedtls_pem_get_buffer(mbedtls_pem_context *ctx, size_t *buflen)
110{
111 *buflen = ctx->MBEDTLS_PRIVATE(buflen);
112 return ctx->MBEDTLS_PRIVATE(buf);
113}
114
115
121void mbedtls_pem_free(mbedtls_pem_context *ctx);
122#endif /* MBEDTLS_PEM_PARSE_C */
123
124#if defined(MBEDTLS_PEM_WRITE_C)
151int mbedtls_pem_write_buffer(const char *header, const char *footer,
152 const unsigned char *der_data, size_t der_len,
153 unsigned char *buf, size_t buf_len, size_t *olen);
154#endif /* MBEDTLS_PEM_WRITE_C */
155
156#ifdef __cplusplus
157}
158#endif
159
160#endif /* pem.h */
void * data
Definition kthread.h:30
Build-time configuration info.
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
Definition private_access.h:15