POLARSSL_PEM_C split into POLARSSL_PEM_PARSE_C and POLARSSL_PEM_WRITE_C

This commit is contained in:
Paul Bakker 2013-09-15 20:43:33 +02:00
parent 77e23fb0e0
commit cff6842b39
14 changed files with 242 additions and 195 deletions

View file

@ -719,7 +719,7 @@
* TLS_PSK_WITH_AES_128_CBC_SHA
* TLS_PSK_WITH_AES_256_CBC_SHA
*
* PEM uses AES for decrypting encrypted keys.
* PEM_PARSE uses AES for decrypting encrypted keys.
*/
#define POLARSSL_AES_C
@ -884,7 +884,7 @@
* TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
* TLS_PSK_WITH_3DES_EDE_CBC_SHA
*
* PEM uses DES/3DES for decrypting encrypted keys.
* PEM_PARSE uses DES/3DES for decrypting encrypted keys.
*/
#define POLARSSL_DES_C
@ -1074,7 +1074,7 @@
* library/x509parse.c
*
* This module is required for SSL/TLS and X.509.
* PEM uses MD5 for decrypting encrypted keys.
* PEM_PARSE uses MD5 for decrypting encrypted keys.
*/
#define POLARSSL_MD5_C
@ -1156,18 +1156,34 @@
#define POLARSSL_PBKDF2_C
/**
* \def POLARSSL_PEM_C
* \def POLARSSL_PEM_PARSE_C
*
* Enable PEM decoding
* Enable PEM decoding / parsing
*
* Module: library/pem.c
* Caller: library/x509parse.c
* library/pkparse.c
*
* Requires: POLARSSL_BASE64_C
*
* This modules adds support for decoding PEM files.
* This modules adds support for decoding / parsing PEM files.
*/
#define POLARSSL_PEM_C
#define POLARSSL_PEM_PARSE_C
/**
* \def POLARSSL_PEM_WRITE_C
*
* Enable PEM encoding / writing
*
* Module: library/pem.c
* Caller: library/x509write.c
* library/pkwrite.c
*
* Requires: POLARSSL_BASE64_C
*
* This modules adds support for encoding / writing PEM files.
*/
#define POLARSSL_PEM_WRITE_C
/**
* \def POLARSSL_PK_C
@ -1586,8 +1602,12 @@
#error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
#endif
#if defined(POLARSSL_PEM_C) && !defined(POLARSSL_PEM_C)
#error "POLARSSL_PEM_C defined, but not all prerequisites"
#if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
#error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
#endif
#if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
#error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
#endif
#if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)

View file

@ -50,6 +50,7 @@
extern "C" {
#endif
#if defined(POLARSSL_PEM_PARSE_C)
/**
* \brief PEM context structure
*/
@ -95,6 +96,15 @@ int pem_read_buffer( pem_context *ctx, const char *header, const char *footer,
const unsigned char *pwd,
size_t pwdlen, size_t *use_len );
/**
* \brief PEM context memory freeing
*
* \param ctx context to be freed
*/
void pem_free( pem_context *ctx );
#endif /* POLARSSL_PEM_PARSE_C */
#if defined(POLARSSL_PEM_WRITE_C)
/**
* \brief Write a buffer of PEM information from a DER encoded
* buffer.
@ -114,13 +124,7 @@ int pem_read_buffer( pem_context *ctx, const char *header, const char *footer,
int pem_write_buffer( const char *header, const char *footer,
const unsigned char *der_data, size_t der_len,
unsigned char *buf, size_t buf_len, size_t *olen );
/**
* \brief PEM context memory freeing
*
* \param ctx context to be freed
*/
void pem_free( pem_context *ctx );
#endif /* POLARSSL_PEM_WRITE_C */
#ifdef __cplusplus
}

View file

@ -477,7 +477,7 @@ int pk_write_key_der( pk_context *pk, unsigned char *buf, size_t size );
*/
int pk_write_pubkey_der( pk_context *key, unsigned char *buf, size_t size );
#if defined(POLARSSL_PEM_C)
#if defined(POLARSSL_PEM_WRITE_C)
/**
* \brief Write a public key to a PEM string
*
@ -499,7 +499,7 @@ int pk_write_pubkey_pem( pk_context *key, unsigned char *buf, size_t size );
* \return 0 successful, or a specific error code
*/
int pk_write_key_pem( pk_context *key, unsigned char *buf, size_t size );
#endif /* POLARSSL_PEM_C */
#endif /* POLARSSL_PEM_WRITE_C */
#endif /* POLARSSL_PK_WRITE_C */
/*

View file

@ -414,7 +414,7 @@ int x509write_csr_der( x509write_csr *ctx, unsigned char *buf, size_t size,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng );
#if defined(POLARSSL_PEM_C)
#if defined(POLARSSL_PEM_WRITE_C)
/**
* \brief Write a built up certificate to a X509 PEM string
*
@ -455,7 +455,7 @@ int x509write_crt_pem( x509write_cert *ctx, unsigned char *buf, size_t size,
int x509write_csr_pem( x509write_csr *ctx, unsigned char *buf, size_t size,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng );
#endif /* POLARSSL_PEM_C */
#endif /* POLARSSL_PEM_WRITE_C */
#ifdef __cplusplus
}