mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
* PT_APP_PROTOCOL_DATA has a test for hs_status=SSL_OK to prevent possible exchanges before the handshake is complete.
* Changed license on sha256.c to full BSD. git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@244 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
parent
67111693e6
commit
0d334d81c2
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Cameron Rich
|
* Copyright (C) 2001-2003 Christophe Devine
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@ -28,26 +28,6 @@
|
|||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* FIPS-180-2 compliant SHA-256 implementation
|
|
||||||
*
|
|
||||||
* Copyright (C) 2001-2003 Christophe Devine
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "os_port.h"
|
#include "os_port.h"
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, Cameron Rich
|
* Copyright (c) 2007-2014, Cameron Rich
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@ -142,7 +142,7 @@ static int gen_dn(const char *name, uint8_t dn_type,
|
|||||||
buf[(*offset)++] = dn_type;
|
buf[(*offset)++] = dn_type;
|
||||||
buf[(*offset)++] = ASN1_PRINTABLE_STR;
|
buf[(*offset)++] = ASN1_PRINTABLE_STR;
|
||||||
buf[(*offset)++] = name_size;
|
buf[(*offset)++] = name_size;
|
||||||
strcpy(&buf[*offset], name);
|
strcpy((char *)&buf[*offset], name);
|
||||||
*offset += name_size;
|
*offset += name_size;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
@ -165,7 +165,13 @@ static int gen_issuer(const char * dn[], uint8_t *buf, int *offset)
|
|||||||
gethostname(fqdn, sizeof(fqdn));
|
gethostname(fqdn, sizeof(fqdn));
|
||||||
fqdn_len = strlen(fqdn);
|
fqdn_len = strlen(fqdn);
|
||||||
fqdn[fqdn_len++] = '.';
|
fqdn[fqdn_len++] = '.';
|
||||||
getdomainname(&fqdn[fqdn_len], sizeof(fqdn)-fqdn_len);
|
|
||||||
|
if (getdomainname(&fqdn[fqdn_len], sizeof(fqdn)-fqdn_len) < 0)
|
||||||
|
{
|
||||||
|
ret = X509_NOT_OK;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
fqdn_len = strlen(fqdn);
|
fqdn_len = strlen(fqdn);
|
||||||
|
|
||||||
if (fqdn[fqdn_len-1] == '.') /* ensure '.' is not last char */
|
if (fqdn[fqdn_len-1] == '.') /* ensure '.' is not last char */
|
||||||
|
@ -1348,13 +1348,14 @@ int basic_read(SSL *ssl, uint8_t **in_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PT_APP_PROTOCOL_DATA:
|
case PT_APP_PROTOCOL_DATA:
|
||||||
if (in_data)
|
if (in_data && ssl->hs_status == SSL_OK)
|
||||||
{
|
{
|
||||||
*in_data = buf; /* point to the work buffer */
|
*in_data = buf; /* point to the work buffer */
|
||||||
(*in_data)[read_len] = 0; /* null terminate just in case */
|
(*in_data)[read_len] = 0; /* null terminate just in case */
|
||||||
|
ret = read_len;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
ret = read_len;
|
ret = SSL_ERROR_INVALID_PROT_MSG;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PT_ALERT_PROTOCOL:
|
case PT_ALERT_PROTOCOL:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user