1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Some fixes after going through the test harness

git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@222 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
cameronrich 2012-02-11 11:30:45 +00:00
parent ffa4da45ee
commit af155d91d9
3 changed files with 29 additions and 24 deletions

View File

@ -349,14 +349,19 @@ EXP_FUNC int STDCALL base64_decode(const char *in, int len,
y = t = 0;
}
if (z >= *outlen) /* check that we don't go past the output buffer */
/* check that we don't go past the output buffer */
if (outlen && z >= *outlen)
{
printf("Stuff %d, %d\n", z, *outlen);
goto error;
}
}
if (y != 0)
goto error;
*outlen = z;
ret = 0;
error:

View File

@ -291,17 +291,17 @@ static int asn1_get_printable_str(const uint8_t *buf, int *offset, char **str)
int asn1_type = buf[*offset];
/* some certs have this awful crud in them for some reason */
if (buf[asn1_type] != ASN1_PRINTABLE_STR &&
buf[asn1_type] != ASN1_PRINTABLE_STR2 &&
buf[asn1_type] != ASN1_TELETEX_STR &&
buf[asn1_type] != ASN1_IA5_STR &&
buf[asn1_type] != ASN1_UNICODE_STR)
if (asn1_type != ASN1_PRINTABLE_STR &&
asn1_type != ASN1_PRINTABLE_STR2 &&
asn1_type != ASN1_TELETEX_STR &&
asn1_type != ASN1_IA5_STR &&
asn1_type != ASN1_UNICODE_STR)
goto end_pnt_str;
(*offset)++;
len = get_asn1_length(buf, offset);
if (buf[asn1_type - 1] == ASN1_UNICODE_STR)
if (asn1_type == ASN1_UNICODE_STR)
{
int i;
*str = (char *)malloc(len/2+1); /* allow for null */

View File

@ -259,7 +259,6 @@ static int pem_decrypt(const char *where, const char *end,
/* turn base64 into binary */
pem_size = (int)(end-start);
ssl_obj->len = sizeof(ssl_obj->buf);
if (base64_decode(start, pem_size, ssl_obj->buf, &ssl_obj->len) != 0)
goto error;
@ -315,6 +314,7 @@ static int new_pem_obj(SSL_CTX *ssl_ctx, int is_cacert, char *where,
/* 4/3 bigger than what we need but so what */
ssl_obj->buf = (uint8_t *)calloc(1, pem_size);
ssl_obj->len = pem_size;
if (i == IS_RSA_PRIVATE_KEY &&
strstr(start, "Proc-Type:") &&