Skip to content

Commit 29b478f

Browse files
cameronrichikeyasu
cameronrich
authored andcommitted
* Put back TLS 1.0.
git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@268 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
1 parent f599ff8 commit 29b478f

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

ssl/tls1.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,7 @@ int send_packet(SSL *ssl, uint8_t protocol, const uint8_t *in, int length)
11451145
increment_write_sequence(ssl);
11461146

11471147
/* add the explicit IV for TLS1.1 */
1148+
if (ssl->version >= SSL_PROTOCOL_VERSION_TLS1_1)
11481149
{
11491150
uint8_t iv_size = ssl->cipher_info->iv_size;
11501151
uint8_t *t_buf = malloc(msg_length + iv_size);
@@ -1358,8 +1359,12 @@ int basic_read(SSL *ssl, uint8_t **in_data)
13581359
if (IS_SET_SSL_FLAG(SSL_RX_ENCRYPTED))
13591360
{
13601361
ssl->cipher_info->decrypt(ssl->decrypt_ctx, buf, buf, read_len);
1361-
buf += ssl->cipher_info->iv_size;
1362-
read_len -= ssl->cipher_info->iv_size;
1362+
1363+
if (ssl->version >= SSL_PROTOCOL_VERSION_TLS1_1)
1364+
{
1365+
buf += ssl->cipher_info->iv_size;
1366+
read_len -= ssl->cipher_info->iv_size;
1367+
}
13631368

13641369
read_len = verify_digest(ssl,
13651370
is_client ? SSL_CLIENT_READ : SSL_SERVER_READ, buf, read_len);

ssl/tls1.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ extern "C" {
4747
#include "crypto.h"
4848
#include "crypto_misc.h"
4949

50-
#define SSL_PROTOCOL_MIN_VERSION 0x32 /* TLS v1.1 */
51-
#define SSL_PROTOCOL_VERSION_MAX 0x33 /* TLS v1.2 */
50+
#define SSL_PROTOCOL_MIN_VERSION 0x31 /* TLS v1.0 */
51+
#define SSL_PROTOCOL_VERSION_MAX 0x33 /* TLS v1.3 */
52+
#define SSL_PROTOCOL_VERSION_TLS1_1 0x32 /* TLS v1.1 */
5253
#define SSL_PROTOCOL_VERSION_TLS1_2 0x33 /* TLS v1.2 */
5354
#define SSL_RANDOM_SIZE 32
5455
#define SSL_SECRET_SIZE 48

ssl/x509.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ int x509_new(const uint8_t *cert, int *len, X509_CTX **ctx)
7474
int begin_tbs, end_tbs;
7575
int ret = X509_NOT_OK, offset = 0, cert_size = 0;
7676
X509_CTX *x509_ctx;
77+
#ifdef CONFIG_SSL_CERT_VERIFICATION /* only care if doing verification */
7778
BI_CTX *bi_ctx;
79+
#endif
7880

7981
*ctx = (X509_CTX *)calloc(1, sizeof(X509_CTX));
8082
x509_ctx = *ctx;
@@ -117,7 +119,6 @@ int x509_new(const uint8_t *cert, int *len, X509_CTX **ctx)
117119
goto end_cert;
118120
}
119121

120-
bi_ctx = x509_ctx->rsa_ctx->bi_ctx;
121122

122123
x509_ctx->fingerprint = malloc(SHA1_SIZE);
123124
SHA1_CTX sha_fp_ctx;
@@ -126,6 +127,8 @@ int x509_new(const uint8_t *cert, int *len, X509_CTX **ctx)
126127
SHA1_Final(x509_ctx->fingerprint, &sha_fp_ctx);
127128

128129
#ifdef CONFIG_SSL_CERT_VERIFICATION /* only care if doing verification */
130+
bi_ctx = x509_ctx->rsa_ctx->bi_ctx;
131+
129132
/* use the appropriate signature algorithm */
130133
switch (x509_ctx->sig_type)
131134
{

0 commit comments

Comments
 (0)