4 #include <polarssl/ssl.h>
5 #include <polarssl/net.h>
7 +#ifdef POLARSSL_API_V1_2
10 + TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
11 + TLS_RSA_WITH_AES_256_CBC_SHA,
12 + TLS_RSA_WITH_AES_128_CBC_SHA,
18 SSL_EDH_RSA_AES_256_SHA,
19 - SSL_EDH_RSA_CAMELLIA_256_SHA,
20 - SSL_EDH_RSA_DES_168_SHA,
22 - SSL_RSA_CAMELLIA_256_SHA,
24 - SSL_RSA_CAMELLIA_128_SHA,
25 - SSL_RSA_DES_168_SHA,
26 - SSL_RSA_RC4_128_SHA,
27 - SSL_RSA_RC4_128_MD5,
31 static x509_cert certificate;
32 static rsa_context key;
33 bool_t builtInTestCertificate;
34 @@ -170,8 +173,13 @@ void SSLi_deinit(void)
35 /* Create SHA1 of last certificate in the peer's chain. */
36 bool_t SSLi_getSHA1Hash(SSL_handle_t *ssl, uint8_t *hash)
38 - x509_cert *cert = ssl->peer_cert;
39 - if (!ssl->peer_cert) {
41 +#ifdef POLARSSL_API_V1_2
42 + cert = ssl_get_peer_cert(ssl);
44 + cert = ssl->peer_cert;
49 sha1(cert->raw.p, cert->raw.len, hash);
50 @@ -207,7 +215,12 @@ SSL_handle_t *SSLi_newconnection(int *fd
52 ssl_set_ciphers(ssl, ciphers);
55 +#ifdef POLARSSL_API_V1_2
56 + ssl_set_session(ssl, ssn);
58 ssl_set_session(ssl, 0, 0, ssn);
61 ssl_set_ca_chain(ssl, &certificate, NULL, NULL);
62 ssl_set_own_cert(ssl, &certificate, &key);
69 + #if (POLARSSL_VERSION_MINOR >= 2)
70 + #define POLARSSL_API_V1_2