mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
AppleM1: Update openssl to v1.1.1l
This commit is contained in:
parent
1fe12b8e8c
commit
b787656eea
990 changed files with 13406 additions and 18710 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
@ -84,9 +84,8 @@ IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA,
|
|||
|
||||
|
||||
IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC,
|
||||
RSAPublicKey) IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA,
|
||||
PEM_STRING_PUBLIC,
|
||||
RSA_PUBKEY)
|
||||
RSAPublicKey)
|
||||
IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY)
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
static DSA *pkey_get_dsa(EVP_PKEY *key, DSA **dsa)
|
||||
|
@ -115,7 +114,7 @@ DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb,
|
|||
|
||||
IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA,
|
||||
DSAPrivateKey)
|
||||
IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY)
|
||||
IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY)
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **dsa, pem_password_cb *cb, void *u)
|
||||
{
|
||||
|
@ -176,6 +175,6 @@ EC_KEY *PEM_read_ECPrivateKey(FILE *fp, EC_KEY **eckey, pem_password_cb *cb,
|
|||
#ifndef OPENSSL_NO_DH
|
||||
|
||||
IMPLEMENT_PEM_write_const(DHparams, DH, PEM_STRING_DHPARAMS, DHparams)
|
||||
IMPLEMENT_PEM_write_const(DHxparams, DH, PEM_STRING_DHXPARAMS, DHxparams)
|
||||
IMPLEMENT_PEM_write_const(DHxparams, DH, PEM_STRING_DHXPARAMS, DHxparams)
|
||||
#endif
|
||||
IMPLEMENT_PEM_rw(PUBKEY, EVP_PKEY, PEM_STRING_PUBLIC, PUBKEY)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
@ -60,6 +60,8 @@ static const ERR_STRING_DATA PEM_str_functs[] = {
|
|||
{ERR_PACK(ERR_LIB_PEM, PEM_F_PEM_SIGNFINAL, 0), "PEM_SignFinal"},
|
||||
{ERR_PACK(ERR_LIB_PEM, PEM_F_PEM_WRITE, 0), "PEM_write"},
|
||||
{ERR_PACK(ERR_LIB_PEM, PEM_F_PEM_WRITE_BIO, 0), "PEM_write_bio"},
|
||||
{ERR_PACK(ERR_LIB_PEM, PEM_F_PEM_WRITE_BIO_PRIVATEKEY_TRADITIONAL, 0),
|
||||
"PEM_write_bio_PrivateKey_traditional"},
|
||||
{ERR_PACK(ERR_LIB_PEM, PEM_F_PEM_WRITE_PRIVATEKEY, 0),
|
||||
"PEM_write_PrivateKey"},
|
||||
{ERR_PACK(ERR_LIB_PEM, PEM_F_PEM_X509_INFO_READ, 0), "PEM_X509_INFO_read"},
|
||||
|
@ -109,6 +111,8 @@ static const ERR_STRING_DATA PEM_str_reasons[] = {
|
|||
"unsupported encryption"},
|
||||
{ERR_PACK(ERR_LIB_PEM, 0, PEM_R_UNSUPPORTED_KEY_COMPONENTS),
|
||||
"unsupported key components"},
|
||||
{ERR_PACK(ERR_LIB_PEM, 0, PEM_R_UNSUPPORTED_PUBLIC_KEY_TYPE),
|
||||
"unsupported public key type"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include <string.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/buffer.h>
|
||||
|
@ -18,7 +18,7 @@
|
|||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include <openssl/des.h>
|
||||
#include <openssl/engine.h>
|
||||
|
||||
|
@ -332,7 +332,7 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp,
|
|||
}
|
||||
}
|
||||
|
||||
if ((dsize = i2d(x, NULL)) < 0) {
|
||||
if ((dsize = i2d(x, NULL)) <= 0) {
|
||||
PEMerr(PEM_F_PEM_ASN1_WRITE_BIO, ERR_R_ASN1_LIB);
|
||||
dsize = 0;
|
||||
goto err;
|
||||
|
@ -791,7 +791,7 @@ static int get_header_and_data(BIO *bp, BIO **header, BIO **data, char *name,
|
|||
{
|
||||
BIO *tmp = *header;
|
||||
char *linebuf, *p;
|
||||
int len, line, ret = 0, end = 0;
|
||||
int len, line, ret = 0, end = 0, prev_partial_line_read = 0, partial_line_read = 0;
|
||||
/* 0 if not seen (yet), 1 if reading header, 2 if finished header */
|
||||
enum header_status got_header = MAYBE_HEADER;
|
||||
unsigned int flags_mask;
|
||||
|
@ -809,10 +809,18 @@ static int get_header_and_data(BIO *bp, BIO **header, BIO **data, char *name,
|
|||
flags_mask = ~0u;
|
||||
len = BIO_gets(bp, linebuf, LINESIZE);
|
||||
if (len <= 0) {
|
||||
PEMerr(PEM_F_GET_HEADER_AND_DATA, PEM_R_SHORT_HEADER);
|
||||
PEMerr(PEM_F_GET_HEADER_AND_DATA, PEM_R_BAD_END_LINE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if line has been read completely or if only part of the line
|
||||
* has been read. Keep the previous value to ignore newlines that
|
||||
* appear due to reading a line up until the char before the newline.
|
||||
*/
|
||||
prev_partial_line_read = partial_line_read;
|
||||
partial_line_read = len == LINESIZE-1 && linebuf[LINESIZE-2] != '\n';
|
||||
|
||||
if (got_header == MAYBE_HEADER) {
|
||||
if (memchr(linebuf, ':', len) != NULL)
|
||||
got_header = IN_HEADER;
|
||||
|
@ -823,13 +831,19 @@ static int get_header_and_data(BIO *bp, BIO **header, BIO **data, char *name,
|
|||
|
||||
/* Check for end of header. */
|
||||
if (linebuf[0] == '\n') {
|
||||
if (got_header == POST_HEADER) {
|
||||
/* Another blank line is an error. */
|
||||
PEMerr(PEM_F_GET_HEADER_AND_DATA, PEM_R_BAD_END_LINE);
|
||||
goto err;
|
||||
/*
|
||||
* If previous line has been read only partially this newline is a
|
||||
* regular newline at the end of a line and not an empty line.
|
||||
*/
|
||||
if (!prev_partial_line_read) {
|
||||
if (got_header == POST_HEADER) {
|
||||
/* Another blank line is an error. */
|
||||
PEMerr(PEM_F_GET_HEADER_AND_DATA, PEM_R_BAD_END_LINE);
|
||||
goto err;
|
||||
}
|
||||
got_header = POST_HEADER;
|
||||
tmp = *data;
|
||||
}
|
||||
got_header = POST_HEADER;
|
||||
tmp = *data;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
@ -17,8 +17,8 @@
|
|||
#include <openssl/pem.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/dh.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
|
||||
int pem_check_suffix(const char *pem_str, const char *suffix);
|
||||
|
||||
|
@ -108,6 +108,12 @@ int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x,
|
|||
pem_password_cb *cb, void *u)
|
||||
{
|
||||
char pem_str[80];
|
||||
|
||||
if (x->ameth == NULL || x->ameth->old_priv_encode == NULL) {
|
||||
PEMerr(PEM_F_PEM_WRITE_BIO_PRIVATEKEY_TRADITIONAL,
|
||||
PEM_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
|
||||
return 0;
|
||||
}
|
||||
BIO_snprintf(pem_str, 80, "%s PRIVATE KEY", x->ameth->pem_str);
|
||||
return PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey,
|
||||
pem_str, bp, x, enc, kstr, klen, cb, u);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
@ -31,7 +31,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
|
|||
int i, ret = 0;
|
||||
unsigned int m_len;
|
||||
|
||||
m = OPENSSL_malloc(EVP_PKEY_size(pkey) + 2);
|
||||
m = OPENSSL_malloc(EVP_PKEY_size(pkey));
|
||||
if (m == NULL) {
|
||||
PEMerr(PEM_F_PEM_SIGNFINAL, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2005-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
@ -29,10 +29,10 @@ static unsigned int read_ledword(const unsigned char **in)
|
|||
{
|
||||
const unsigned char *p = *in;
|
||||
unsigned int ret;
|
||||
ret = *p++;
|
||||
ret |= (*p++ << 8);
|
||||
ret |= (*p++ << 16);
|
||||
ret |= (*p++ << 24);
|
||||
ret = (unsigned int)*p++;
|
||||
ret |= (unsigned int)*p++ << 8;
|
||||
ret |= (unsigned int)*p++ << 16;
|
||||
ret |= (unsigned int)*p++ << 24;
|
||||
*in = p;
|
||||
return ret;
|
||||
}
|
||||
|
@ -274,6 +274,9 @@ static EVP_PKEY *b2i_dss(const unsigned char **in,
|
|||
if (!read_lebn(&p, 20, &priv_key))
|
||||
goto memerr;
|
||||
|
||||
/* Set constant time flag before public key calculation */
|
||||
BN_set_flags(priv_key, BN_FLG_CONSTTIME);
|
||||
|
||||
/* Calculate public key */
|
||||
pub_key = BN_new();
|
||||
if (pub_key == NULL)
|
||||
|
@ -841,9 +844,9 @@ static int i2b_PVK(unsigned char **out, EVP_PKEY *pk, int enclevel,
|
|||
if (!EVP_EncryptInit_ex(cctx, EVP_rc4(), NULL, keybuf, NULL))
|
||||
goto error;
|
||||
OPENSSL_cleanse(keybuf, 20);
|
||||
if (!EVP_DecryptUpdate(cctx, p, &enctmplen, p, pklen - 8))
|
||||
if (!EVP_EncryptUpdate(cctx, p, &enctmplen, p, pklen - 8))
|
||||
goto error;
|
||||
if (!EVP_DecryptFinal_ex(cctx, p + enctmplen, &enctmplen))
|
||||
if (!EVP_EncryptFinal_ex(cctx, p + enctmplen, &enctmplen))
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -872,9 +875,9 @@ int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel,
|
|||
wrlen = BIO_write(out, tmp, outlen);
|
||||
OPENSSL_free(tmp);
|
||||
if (wrlen == outlen) {
|
||||
PEMerr(PEM_F_I2B_PVK_BIO, PEM_R_BIO_WRITE_FAILURE);
|
||||
return outlen;
|
||||
}
|
||||
PEMerr(PEM_F_I2B_PVK_BIO, PEM_R_BIO_WRITE_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue