27 #ifndef POLARSSL_COMPAT_1_2_H
28 #define POLARSSL_COMPAT_1_2_H
33 #define SHOW_PROTOTYPE_CHANGE_WARNINGS
37 #undef SHOW_PROTOTYPE_CHANGE_WARNINGS
40 #if defined(SHOW_PROTOTYPE_CHANGE_WARNINGS)
41 #warning "You can disable these warnings by commenting SHOW_PROTOTYPE_CHANGE_WARNINGS in compat-1.2.h"
44 #if defined(POLARSSL_SHA256_C)
45 #define POLARSSL_SHA2_C
63 inline int sha2_file(
const char *path,
unsigned char output[32],
int is224 ) {
66 inline void sha2(
const unsigned char *input,
size_t ilen,
67 unsigned char output[32],
int is224 ) {
68 sha256( input, ilen, output, is224 );
71 size_t keylen,
int is224 ) {
83 inline void sha2_hmac(
const unsigned char *key,
size_t keylen,
84 const unsigned char *input,
size_t ilen,
85 unsigned char output[32],
int is224 ) {
86 sha256_hmac( key, keylen, input, ilen, output, is224 );
93 #if defined(POLARSSL_SHA512_C)
94 #define POLARSSL_SHA4_C
112 inline int sha4_file(
const char *path,
unsigned char output[64],
int is384 ) {
115 inline void sha4(
const unsigned char *input,
size_t ilen,
116 unsigned char output[32],
int is384 ) {
117 sha512( input, ilen, output, is384 );
120 size_t keylen,
int is384 ) {
132 inline void sha4_hmac(
const unsigned char *key,
size_t keylen,
133 const unsigned char *input,
size_t ilen,
134 unsigned char output[64],
int is384 ) {
135 sha512_hmac( key, keylen, input, ilen, output, is384 );
142 #if defined(POLARSSL_CIPHER_C)
143 #if defined(SHOW_PROTOTYPE_CHANGE_WARNINGS)
144 #warning "cipher_reset() prototype changed. Manual change required if used"
148 #if defined(POLARSSL_RSA_C)
149 #define SIG_RSA_RAW POLARSSL_MD_NONE
150 #define SIG_RSA_MD2 POLARSSL_MD_MD2
151 #define SIG_RSA_MD4 POLARSSL_MD_MD4
152 #define SIG_RSA_MD5 POLARSSL_MD_MD5
153 #define SIG_RSA_SHA1 POLARSSL_MD_SHA1
154 #define SIG_RSA_SHA224 POLARSSL_MD_SHA224
155 #define SIG_RSA_SHA256 POLARSSL_MD_SHA256
156 #define SIG_RSA_SHA384 POLARSSL_MD_SHA384
157 #define SIG_RSA_SHA512 POLARSSL_MD_SHA512
158 #if defined(SHOW_PROTOTYPE_CHANGE_WARNINGS)
159 #warning "rsa_pkcs1_verify() prototype changed. Manual change required if used"
160 #warning "rsa_pkcs1_decrypt() prototype changed. Manual change required if used"
164 #if defined(POLARSSL_DHM_C)
165 #if defined(SHOW_PROTOTYPE_CHANGE_WARNINGS)
166 #warning "dhm_calc_secret() prototype changed. Manual change required if used"
170 #if defined(POLARSSL_GCM_C)
171 #if defined(SHOW_PROTOTYPE_CHANGE_WARNINGS)
172 #warning "gcm_init() prototype changed. Manual change required if used"
176 #if defined(POLARSSL_SSL_CLI_C)
177 #if defined(SHOW_PROTOTYPE_CHANGE_WARNINGS)
178 #warning "ssl_set_own_cert() prototype changed. Change to ssl_set_own_cert_rsa(). Manual change required if used"
182 #if defined(POLARSSL_X509_USE_C) || defined(POLARSSL_X509_CREATE_C)
185 #define POLARSSL_ERR_X509_CERT_INVALID_FORMAT POLARSSL_ERR_X509_INVALID_FORMAT
186 #define POLARSSL_ERR_X509_CERT_INVALID_VERSION POLARSSL_ERR_X509_INVALID_VERSION
187 #define POLARSSL_ERR_X509_CERT_INVALID_ALG POLARSSL_ERR_X509_INVALID_ALG
188 #define POLARSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG POLARSSL_ERR_X509_UNKNOWN_SIG_ALG
189 #define POLARSSL_ERR_X509_CERT_INVALID_NAME POLARSSL_ERR_X509_INVALID_NAME
190 #define POLARSSL_ERR_X509_CERT_INVALID_DATE POLARSSL_ERR_X509_INVALID_DATE
191 #define POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS POLARSSL_ERR_X509_INVALID_EXTENSIONS
192 #define POLARSSL_ERR_X509_CERT_SIG_MISMATCH POLARSSL_ERR_X509_SIG_MISMATCH
193 #define POLARSSL_ERR_X509_CERT_INVALID_SIGNATURE POLARSSL_ERR_X509_INVALID_SIGNATURE
194 #define POLARSSL_ERR_X509_CERT_INVALID_SERIAL POLARSSL_ERR_X509_INVALID_SERIAL
195 #define POLARSSL_ERR_X509_CERT_UNKNOWN_VERSION POLARSSL_ERR_X509_UNKNOWN_VERSION
208 #if defined(POLARSSL_X509_CRT_PARSE_C)
209 #define POLARSSL_X509_PARSE_C
231 x509_crl *ca_crl,
const char *cn,
int *flags,
232 int (*f_vrfy)(
void *,
x509_cert *,
int,
int *),
234 return x509_crt_verify( crt, trust_ca, ca_crl, cn, flags, f_vrfy, p_vrfy );
244 #if defined(POLARSSL_X509_CRL_PARSE_C)
245 #define POLARSSL_X509_PARSE_C
259 #if defined(POLARSSL_X509_CSR_PARSE_C)
260 #define POLARSSL_X509_PARSE_C
274 #if defined(POLARSSL_SSL_TLS_C)
277 #define ssl_default_ciphersuites ssl_list_ciphersuites()
280 #if defined(POLARSSL_PK_PARSE_C) && defined(POLARSSL_RSA_C)
284 #define POLARSSL_ERR_X509_PASSWORD_MISMATCH POLARSSL_ERR_PK_PASSWORD_MISMATCH
285 #define POLARSSL_ERR_X509_KEY_INVALID_FORMAT POLARSSL_ERR_PK_KEY_INVALID_FORMAT
286 #define POLARSSL_ERR_X509_UNKNOWN_PK_ALG POLARSSL_ERR_PK_UNKNOWN_PK_ALG
287 #define POLARSSL_ERR_X509_CERT_INVALID_PUBKEY POLARSSL_ERR_PK_INVALID_PUBKEY
289 #if defined(POLARSSL_FS_IO)
323 const unsigned char *pwd,
size_t pwdlen ) {
339 const unsigned char *key,
size_t keylen )
356 #if defined(POLARSSL_PK_WRITE_C) && defined(POLARSSL_RSA_C)
362 if( ( ret =
rsa_copy(
pk_rsa( ctx ), rsa ) ) != 0 )
return( ret );
371 if( ( ret =
rsa_copy(
pk_rsa( ctx ), rsa ) ) != 0 )
return( ret );