Latest update.

This commit is contained in:
2019-10-17 23:54:38 +09:00
parent 41a23ae6f6
commit ee84d0dd84
1357 changed files with 41111 additions and 9603 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
#include <openssl/crypto.h>
#include "internal/bio.h"
#include <openssl/err.h>
#include "ssl_locl.h"
#include "ssl_local.h"
static int ssl_write(BIO *h, const char *buf, size_t size, size_t *written);
static int ssl_read(BIO *b, char *buf, size_t size, size_t *readbytes);
+1 -1
View File
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <openssl/objects.h>
#include <openssl/rand.h>
#include "ssl_locl.h"
#include "ssl_local.h"
static void get_current_time(struct timeval *t);
static int dtls1_handshake_write(SSL *s);
+1 -1
View File
@@ -7,7 +7,7 @@
* https://www.openssl.org/source/license.html
*/
#include "ssl_locl.h"
#include "ssl_local.h"
int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, size_t len,
size_t *written)
+1 -1
View File
@@ -15,7 +15,7 @@
#include <stdio.h>
#include <openssl/objects.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#ifndef OPENSSL_NO_SRTP
+1 -1
View File
@@ -9,7 +9,7 @@
#include <stdio.h>
#include <openssl/objects.h>
#include "ssl_locl.h"
#include "ssl_local.h"
/*-
* TLS/SSLv3 methods
+1 -1
View File
@@ -7,7 +7,7 @@
* https://www.openssl.org/source/license.html
*/
#include "ssl_locl.h"
#include "ssl_local.h"
#include <openssl/bn.h>
struct pqueue_st {
+2 -2
View File
@@ -12,7 +12,7 @@ of these components is defined by:
3) A set of accessor macros
All struct definitions are in record.h. The functions and macros are either
defined in record.h or record_locl.h dependent on whether they are intended to
defined in record.h or record_local.h dependent on whether they are intended to
be private to the record layer, or whether they form part of the API to the rest
of libssl.
@@ -55,7 +55,7 @@ Conceptually it looks like this:
|| rec_layer_d1.c ||
||____________________||
|______________________|
record_locl.h ^ ^ ^
record_local.h ^ ^ ^
_________________| | |_________________
| | |
_____V_________ ______V________ _______V________
+2 -2
View File
@@ -7,8 +7,8 @@
* https://www.openssl.org/source/license.html
*/
#include "../ssl_locl.h"
#include "record_locl.h"
#include "../ssl_local.h"
#include "record_local.h"
/* mod 128 saturating subtract of two 64-bit values in big-endian order */
static int satsub64be(const unsigned char *v1, const unsigned char *v2)
+2 -2
View File
@@ -9,10 +9,10 @@
#include <stdio.h>
#include <errno.h>
#include "../ssl_locl.h"
#include "../ssl_local.h"
#include <openssl/evp.h>
#include <openssl/buffer.h>
#include "record_locl.h"
#include "record_local.h"
#include "internal/packet.h"
#include "internal/cryptlib.h"
+2 -2
View File
@@ -10,11 +10,11 @@
#include <stdio.h>
#include <limits.h>
#include <errno.h>
#include "../ssl_locl.h"
#include "../ssl_local.h"
#include <openssl/evp.h>
#include <openssl/buffer.h>
#include <openssl/rand.h>
#include "record_locl.h"
#include "record_local.h"
#include "internal/packet.h"
#if defined(OPENSSL_SMALL_FOOTPRINT) || \
+2 -2
View File
@@ -7,8 +7,8 @@
* https://www.openssl.org/source/license.html
*/
#include "../ssl_locl.h"
#include "record_locl.h"
#include "../ssl_local.h"
#include "record_local.h"
void SSL3_BUFFER_set_data(SSL3_BUFFER *b, const unsigned char *d, size_t n)
{
+4 -4
View File
@@ -7,11 +7,11 @@
* https://www.openssl.org/source/license.html
*/
#include "../ssl_locl.h"
#include "internal/constant_time_locl.h"
#include "../ssl_local.h"
#include "internal/constant_time.h"
#include <openssl/trace.h>
#include <openssl/rand.h>
#include "record_locl.h"
#include "record_local.h"
#include "internal/cryptlib.h"
static const unsigned char ssl3_pad_1[48] = {
@@ -594,7 +594,7 @@ int ssl3_get_record(SSL *s)
RECORD_LAYER_reset_read_sequence(&s->rlayer);
return 1;
}
SSLfatal(s, SSL_AD_DECRYPTION_FAILED, SSL_F_SSL3_GET_RECORD,
SSLfatal(s, SSL_AD_BAD_RECORD_MAC, SSL_F_SSL3_GET_RECORD,
SSL_R_BLOCK_CIPHER_PAD_IS_WRONG);
return -1;
}
+2 -2
View File
@@ -7,8 +7,8 @@
* https://www.openssl.org/source/license.html
*/
#include "../ssl_locl.h"
#include "record_locl.h"
#include "../ssl_local.h"
#include "record_local.h"
#include "internal/cryptlib.h"
/*-
+2 -2
View File
@@ -7,8 +7,8 @@
* https://www.openssl.org/source/license.html
*/
#include "internal/constant_time_locl.h"
#include "ssl_locl.h"
#include "internal/constant_time.h"
#include "ssl_local.h"
#include "internal/cryptlib.h"
#include <openssl/md5.h>
+6 -4
View File
@@ -9,7 +9,7 @@
*/
#include <stdio.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#include <openssl/evp.h>
#include <openssl/md5.h>
#include <openssl/core_names.h>
@@ -17,6 +17,7 @@
static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
{
EVP_MD *md5;
EVP_MD_CTX *m5;
EVP_MD_CTX *s1;
unsigned char buf[16], smd[SHA_DIGEST_LENGTH];
@@ -28,14 +29,14 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
c = os_toascii[c]; /* 'A' in ASCII */
#endif
k = 0;
md5 = EVP_MD_fetch(NULL, OSSL_DIGEST_NAME_MD5, "-fips");
m5 = EVP_MD_CTX_new();
s1 = EVP_MD_CTX_new();
if (m5 == NULL || s1 == NULL) {
if (md5 == NULL || m5 == NULL || s1 == NULL) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_GENERATE_KEY_BLOCK,
ERR_R_MALLOC_FAILURE);
goto err;
}
EVP_MD_CTX_set_flags(m5, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
for (i = 0; (int)i < num; i += MD5_DIGEST_LENGTH) {
k++;
if (k > sizeof(buf)) {
@@ -55,7 +56,7 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
|| !EVP_DigestUpdate(s1, s->s3.server_random, SSL3_RANDOM_SIZE)
|| !EVP_DigestUpdate(s1, s->s3.client_random, SSL3_RANDOM_SIZE)
|| !EVP_DigestFinal_ex(s1, smd, NULL)
|| !EVP_DigestInit_ex(m5, EVP_md5(), NULL)
|| !EVP_DigestInit_ex(m5, md5, NULL)
|| !EVP_DigestUpdate(m5, s->session->master_key,
s->session->master_key_length)
|| !EVP_DigestUpdate(m5, smd, SHA_DIGEST_LENGTH)) {
@@ -85,6 +86,7 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
err:
EVP_MD_CTX_free(m5);
EVP_MD_CTX_free(s1);
EVP_MD_free(md5);
return ret;
}
+1 -1
View File
@@ -12,7 +12,7 @@
#include <stdio.h>
#include <openssl/objects.h>
#include "internal/nelem.h"
#include "ssl_locl.h"
#include "ssl_local.h"
#include <openssl/md5.h>
#include <openssl/dh.h>
#include <openssl/rand.h>
+1 -1
View File
@@ -7,7 +7,7 @@
* https://www.openssl.org/source/license.html
*/
#include "ssl_locl.h"
#include "ssl_local.h"
int ssl3_do_change_cipher_spec(SSL *s)
{
+2 -2
View File
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#include <openssl/asn1t.h>
#include <openssl/x509.h>
@@ -250,7 +250,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
if (as == NULL)
goto err;
if (!a || !*a) {
if (a == NULL || *a == NULL) {
ret = SSL_SESSION_new();
if (ret == NULL)
goto err;
+1 -1
View File
@@ -20,7 +20,7 @@
#include <openssl/bn.h>
#include <openssl/crypto.h>
#include "internal/refcount.h"
#include "ssl_locl.h"
#include "ssl_local.h"
#include "ssl_cert_table.h"
#include "internal/thread_once.h"
+2 -2
View File
@@ -18,7 +18,7 @@
#include <openssl/conf.h>
#include <openssl/trace.h>
#include "internal/nelem.h"
#include "ssl_locl.h"
#include "ssl_local.h"
#include "internal/thread_once.h"
#include "internal/cryptlib.h"
@@ -95,7 +95,7 @@ static CRYPTO_ONCE ssl_load_builtin_comp_once = CRYPTO_ONCE_STATIC_INIT;
/*
* Constant SSL_MAX_DIGEST equal to size of digests array should be defined
* in the ssl_locl.h
* in the ssl_local.h
*/
#define SSL_MD_NUM_IDX SSL_MAX_DIGEST
+7 -6
View File
@@ -8,7 +8,7 @@
*/
#include <stdio.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#include <openssl/conf.h>
#include <openssl/objects.h>
#include <openssl/dh.h>
@@ -427,7 +427,7 @@ static int cmd_Certificate(SSL_CONF_CTX *cctx, const char *value)
char **pfilename = &cctx->cert_filename[c->key - c->pkeys];
OPENSSL_free(*pfilename);
*pfilename = OPENSSL_strdup(value);
if (!*pfilename)
if (*pfilename == NULL)
rv = 0;
}
@@ -712,7 +712,7 @@ static const ssl_switch_tbl ssl_cmd_switches[] = {
static int ssl_conf_cmd_skip_prefix(SSL_CONF_CTX *cctx, const char **pcmd)
{
if (!pcmd || !*pcmd)
if (pcmd == NULL || *pcmd == NULL)
return 0;
/* If a prefix is set, check and skip */
if (cctx->prefix) {
@@ -830,13 +830,14 @@ int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv)
{
int rv;
const char *arg = NULL, *argn;
if (pargc && *pargc == 0)
if (pargc != NULL && *pargc == 0)
return 0;
if (!pargc || *pargc > 0)
if (pargc == NULL || *pargc > 0)
arg = **pargv;
if (arg == NULL)
return 0;
if (!pargc || *pargc > 1)
if (pargc == NULL || *pargc > 1)
argn = (*pargv)[1];
else
argn = NULL;
+1 -1
View File
@@ -13,7 +13,7 @@
#include <openssl/crypto.h>
#include <openssl/evp.h>
#include <openssl/trace.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#include "internal/thread_once.h"
static int stopped;
+2 -2
View File
@@ -10,7 +10,7 @@
*/
#include <stdio.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#include "e_os.h"
#include <openssl/objects.h>
#include <openssl/x509v3.h>
@@ -2916,7 +2916,7 @@ void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,
unsigned *len)
{
*data = s->ext.npn;
if (!*data) {
if (*data == NULL) {
*len = 0;
} else {
*len = (unsigned int)s->ext.npn_len;
+2 -2
View File
@@ -9,8 +9,8 @@
* https://www.openssl.org/source/license.html
*/
#ifndef HEADER_SSL_LOCL_H
# define HEADER_SSL_LOCL_H
#ifndef OSSL_SSL_LOCAL_H
# define OSSL_SSL_LOCAL_H
# include "e_os.h" /* struct timeval for DTLS */
# include <stdlib.h>
+1 -1
View File
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <openssl/conf.h>
#include <openssl/ssl.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#include "internal/sslconf.h"
/* SSL library configuration module. */
+1 -1
View File
@@ -8,7 +8,7 @@
*/
#include <stdio.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#include "internal/packet.h"
#include <openssl/bio.h>
#include <openssl/objects.h>
+2 -2
View File
@@ -13,8 +13,8 @@
#include <openssl/engine.h>
#include "internal/refcount.h"
#include "internal/cryptlib.h"
#include "ssl_locl.h"
#include "statem/statem_locl.h"
#include "ssl_local.h"
#include "statem/statem_local.h"
static void SSL_SESSION_list_remove(SSL_CTX *ctx, SSL_SESSION *s);
static void SSL_SESSION_list_add(SSL_CTX *ctx, SSL_SESSION *s);
+1 -1
View File
@@ -9,7 +9,7 @@
*/
#include <stdio.h>
#include "ssl_locl.h"
#include "ssl_local.h"
const char *SSL_state_string_long(const SSL *s)
{
+1 -1
View File
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <openssl/buffer.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#ifndef OPENSSL_NO_STDIO
int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x)
+1 -1
View File
@@ -7,7 +7,7 @@
* https://www.openssl.org/source/license.html
*/
#include "ssl_locl.h"
#include "ssl_local.h"
#ifndef OPENSSL_NO_UNIT_TEST
+1 -1
View File
@@ -40,7 +40,7 @@ Conceptually the state machine component is designed as follows:
| |
| Core state machine code |
|____________________________|
statem_locl.h ^ ^
statem_local.h ^ ^
_________| |_______
| |
_____________|____________ _____________|____________
+3 -3
View File
@@ -10,8 +10,8 @@
#include <string.h>
#include "internal/nelem.h"
#include "internal/cryptlib.h"
#include "../ssl_locl.h"
#include "statem_locl.h"
#include "../ssl_local.h"
#include "statem_local.h"
#include "internal/cryptlib.h"
static int final_renegotiate(SSL *s, unsigned int context, int sent);
@@ -92,7 +92,7 @@ typedef struct extensions_definition_st {
/*
* Definitions of all built-in extensions. NOTE: Changes in the number or order
* of these extensions should be mirrored with equivalent changes to the
* indexes ( TLSEXT_IDX_* ) defined in ssl_locl.h.
* indexes ( TLSEXT_IDX_* ) defined in ssl_local.h.
* Each extension has an initialiser, a client and
* server side parser and a finaliser. The initialiser is called (if the
* extension is relevant to the given context) even if we did not see the
+2 -2
View File
@@ -8,9 +8,9 @@
*/
#include <openssl/ocsp.h>
#include "../ssl_locl.h"
#include "../ssl_local.h"
#include "internal/cryptlib.h"
#include "statem_locl.h"
#include "statem_local.h"
EXT_RETURN tls_construct_ctos_renegotiate(SSL *s, WPACKET *pkt,
unsigned int context, X509 *x,
+2 -2
View File
@@ -10,9 +10,9 @@
/* Custom extension utility functions */
#include <openssl/ct.h>
#include "../ssl_locl.h"
#include "../ssl_local.h"
#include "internal/cryptlib.h"
#include "statem_locl.h"
#include "statem_local.h"
typedef struct {
void *add_arg;
+2 -2
View File
@@ -8,8 +8,8 @@
*/
#include <openssl/ocsp.h>
#include "../ssl_locl.h"
#include "statem_locl.h"
#include "../ssl_local.h"
#include "statem_local.h"
#include "internal/cryptlib.h"
#define COOKIE_STATE_FORMAT_VERSION 0
+2 -2
View File
@@ -9,8 +9,8 @@
#include "internal/cryptlib.h"
#include <openssl/rand.h>
#include "../ssl_locl.h"
#include "statem_locl.h"
#include "../ssl_local.h"
#include "statem_local.h"
#include <assert.h>
/*
+3 -3
View File
@@ -12,8 +12,8 @@
#include <stdio.h>
#include <time.h>
#include <assert.h>
#include "../ssl_locl.h"
#include "statem_locl.h"
#include "../ssl_local.h"
#include "statem_local.h"
#include <openssl/buffer.h>
#include <openssl/rand.h>
#include <openssl/objects.h>
@@ -3183,7 +3183,7 @@ static int tls_construct_cke_gost(SSL *s, WPACKET *pkt)
* Get server certificate PKEY and create ctx from it
*/
peer_cert = s->session->peer;
if (!peer_cert) {
if (peer_cert == NULL) {
SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE, SSL_F_TLS_CONSTRUCT_CKE_GOST,
SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER);
return 0;
+2 -2
View File
@@ -10,8 +10,8 @@
#include <limits.h>
#include <string.h>
#include <stdio.h>
#include "../ssl_locl.h"
#include "statem_locl.h"
#include "../ssl_local.h"
#include "statem_local.h"
#include "internal/cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/objects.h>
+19 -8
View File
@@ -11,8 +11,8 @@
#include <limits.h>
#include <string.h>
#include <stdio.h>
#include "../ssl_locl.h"
#include "statem_locl.h"
#include "../ssl_local.h"
#include "statem_local.h"
#include "internal/cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/objects.h>
@@ -170,17 +170,17 @@ static int get_cert_verify_tbs_data(SSL *s, unsigned char *tls13tbs,
void **hdata, size_t *hdatalen)
{
#ifdef CHARSET_EBCDIC
static const char *servercontext = { 0x54, 0x4c, 0x53, 0x20, 0x31, 0x2e,
static const char servercontext[] = { 0x54, 0x4c, 0x53, 0x20, 0x31, 0x2e,
0x33, 0x2c, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x43, 0x65,
0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72,
0x69, 0x66, 0x79, 0x00 };
static const char *clientcontext = { 0x54, 0x4c, 0x53, 0x20, 0x31, 0x2e,
static const char clientcontext[] = { 0x54, 0x4c, 0x53, 0x20, 0x31, 0x2e,
0x33, 0x2c, 0x20, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x43, 0x65,
0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72,
0x69, 0x66, 0x79, 0x00 };
#else
static const char *servercontext = "TLS 1.3, server CertificateVerify";
static const char *clientcontext = "TLS 1.3, client CertificateVerify";
static const char servercontext[] = "TLS 1.3, server CertificateVerify";
static const char clientcontext[] = "TLS 1.3, client CertificateVerify";
#endif
if (SSL_IS_TLS13(s)) {
size_t hashlen;
@@ -1039,14 +1039,25 @@ WORK_STATE tls_finish_handshake(SSL *s, WORK_STATE wst, int clearbufs, int stop)
int cleanuphand = s->statem.cleanuphand;
if (clearbufs) {
if (!SSL_IS_DTLS(s)) {
if (!SSL_IS_DTLS(s)
#ifndef OPENSSL_NO_SCTP
/*
* We don't do this in DTLS because we may still need the init_buf
* RFC6083: SCTP provides a reliable and in-sequence transport service for DTLS
* messages that require it. Therefore, DTLS procedures for retransmissions
* MUST NOT be used.
* Hence the init_buf can be cleared when DTLS over SCTP as transport is used.
*/
|| BIO_dgram_is_sctp(SSL_get_wbio(s))
#endif
) {
/*
* We don't do this in DTLS over UDP because we may still need the init_buf
* in case there are any unexpected retransmits
*/
BUF_MEM_free(s->init_buf);
s->init_buf = NULL;
}
if (!ssl_free_wbio_buffer(s)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_FINISH_HANDSHAKE,
ERR_R_INTERNAL_ERROR);
+3 -3
View File
@@ -10,9 +10,9 @@
*/
#include <stdio.h>
#include "../ssl_locl.h"
#include "statem_locl.h"
#include "internal/constant_time_locl.h"
#include "../ssl_local.h"
#include "statem_local.h"
#include "internal/constant_time.h"
#include "internal/cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/rand.h>
+2 -2
View File
@@ -9,8 +9,8 @@
*/
#include <stdio.h>
#include "ssl_locl.h"
#include "record/record_locl.h"
#include "ssl_local.h"
#include "record/record_local.h"
#include "internal/ktls.h"
#include "internal/cryptlib.h"
#include <openssl/comp.h>
+1 -1
View File
@@ -18,7 +18,7 @@
#include <openssl/dh.h>
#include <openssl/bn.h>
#include "internal/nelem.h"
#include "ssl_locl.h"
#include "ssl_local.h"
#include <openssl/ct.h>
static const SIGALG_LOOKUP *find_sig_alg(SSL *s, X509 *x, EVP_PKEY *pkey);
+4 -3
View File
@@ -7,7 +7,7 @@
* https://www.openssl.org/source/license.html
*/
#include "ssl_locl.h"
#include "ssl_local.h"
#ifndef OPENSSL_NO_SSL_TRACE
@@ -1242,8 +1242,9 @@ static int ssl_print_certificates(BIO *bio, const SSL *ssl, int server,
while (clen > 0) {
if (!ssl_print_certificate(bio, indent + 2, &msg, &clen))
return 0;
if (!ssl_print_extensions(bio, indent + 2, server, SSL3_MT_CERTIFICATE,
&msg, &clen))
if (SSL_IS_TLS13(ssl)
&& !ssl_print_extensions(bio, indent + 2, server,
SSL3_MT_CERTIFICATE, &msg, &clen))
return 0;
}
+1 -1
View File
@@ -8,7 +8,7 @@
*/
#include <stdlib.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#include "internal/cryptlib.h"
#include <openssl/evp.h>
#include <openssl/kdf.h>
+1 -1
View File
@@ -14,7 +14,7 @@
#include <openssl/crypto.h>
#include <openssl/rand.h>
#include <openssl/err.h>
#include "ssl_locl.h"
#include "ssl_local.h"
#ifndef OPENSSL_NO_SRP
# include <openssl/srp.h>