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 1999-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2021 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
|
||||
|
@ -12,11 +12,12 @@
|
|||
#include "e_os.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include <string.h>
|
||||
#include "crypto/ctype.h"
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/bn.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
|
@ -34,17 +35,26 @@ static int ipv6_hex(unsigned char *out, const char *in, int inlen);
|
|||
|
||||
/* Add a CONF_VALUE name value pair to stack */
|
||||
|
||||
int X509V3_add_value(const char *name, const char *value,
|
||||
STACK_OF(CONF_VALUE) **extlist)
|
||||
static int x509v3_add_len_value(const char *name, const char *value,
|
||||
size_t vallen, STACK_OF(CONF_VALUE) **extlist)
|
||||
{
|
||||
CONF_VALUE *vtmp = NULL;
|
||||
char *tname = NULL, *tvalue = NULL;
|
||||
int sk_allocated = (*extlist == NULL);
|
||||
|
||||
if (name && (tname = OPENSSL_strdup(name)) == NULL)
|
||||
goto err;
|
||||
if (value && (tvalue = OPENSSL_strdup(value)) == NULL)
|
||||
if (name != NULL && (tname = OPENSSL_strdup(name)) == NULL)
|
||||
goto err;
|
||||
if (value != NULL && vallen > 0) {
|
||||
/*
|
||||
* We tolerate a single trailing NUL character, but otherwise no
|
||||
* embedded NULs
|
||||
*/
|
||||
if (memchr(value, 0, vallen - 1) != NULL)
|
||||
goto err;
|
||||
tvalue = OPENSSL_strndup(value, vallen);
|
||||
if (tvalue == NULL)
|
||||
goto err;
|
||||
}
|
||||
if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL)
|
||||
goto err;
|
||||
if (sk_allocated && (*extlist = sk_CONF_VALUE_new_null()) == NULL)
|
||||
|
@ -56,7 +66,7 @@ int X509V3_add_value(const char *name, const char *value,
|
|||
goto err;
|
||||
return 1;
|
||||
err:
|
||||
X509V3err(X509V3_F_X509V3_ADD_VALUE, ERR_R_MALLOC_FAILURE);
|
||||
X509V3err(X509V3_F_X509V3_ADD_LEN_VALUE, ERR_R_MALLOC_FAILURE);
|
||||
if (sk_allocated) {
|
||||
sk_CONF_VALUE_free(*extlist);
|
||||
*extlist = NULL;
|
||||
|
@ -67,10 +77,26 @@ int X509V3_add_value(const char *name, const char *value,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int X509V3_add_value(const char *name, const char *value,
|
||||
STACK_OF(CONF_VALUE) **extlist)
|
||||
{
|
||||
return x509v3_add_len_value(name, value,
|
||||
value != NULL ? strlen((const char *)value) : 0,
|
||||
extlist);
|
||||
}
|
||||
|
||||
int X509V3_add_value_uchar(const char *name, const unsigned char *value,
|
||||
STACK_OF(CONF_VALUE) **extlist)
|
||||
{
|
||||
return X509V3_add_value(name, (const char *)value, extlist);
|
||||
return x509v3_add_len_value(name, (const char *)value,
|
||||
value != NULL ? strlen((const char *)value) : 0,
|
||||
extlist);
|
||||
}
|
||||
|
||||
int x509v3_add_len_value_uchar(const char *name, const unsigned char *value,
|
||||
size_t vallen, STACK_OF(CONF_VALUE) **extlist)
|
||||
{
|
||||
return x509v3_add_len_value(name, (const char *)value, vallen, extlist);
|
||||
}
|
||||
|
||||
/* Free function for STACK_OF(CONF_VALUE) */
|
||||
|
@ -502,18 +528,26 @@ static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, const ASN1_IA5STRING *email
|
|||
/* First some sanity checks */
|
||||
if (email->type != V_ASN1_IA5STRING)
|
||||
return 1;
|
||||
if (!email->data || !email->length)
|
||||
if (email->data == NULL || email->length == 0)
|
||||
return 1;
|
||||
if (memchr(email->data, 0, email->length) != NULL)
|
||||
return 1;
|
||||
if (*sk == NULL)
|
||||
*sk = sk_OPENSSL_STRING_new(sk_strcmp);
|
||||
if (*sk == NULL)
|
||||
return 0;
|
||||
|
||||
emtmp = OPENSSL_strndup((char *)email->data, email->length);
|
||||
if (emtmp == NULL)
|
||||
return 0;
|
||||
|
||||
/* Don't add duplicates */
|
||||
if (sk_OPENSSL_STRING_find(*sk, (char *)email->data) != -1)
|
||||
if (sk_OPENSSL_STRING_find(*sk, emtmp) != -1) {
|
||||
OPENSSL_free(emtmp);
|
||||
return 1;
|
||||
emtmp = OPENSSL_strdup((char *)email->data);
|
||||
if (emtmp == NULL || !sk_OPENSSL_STRING_push(*sk, emtmp)) {
|
||||
OPENSSL_free(emtmp); /* free on push failure */
|
||||
}
|
||||
if (!sk_OPENSSL_STRING_push(*sk, emtmp)) {
|
||||
OPENSSL_free(emtmp); /* free on push failure */
|
||||
X509_email_free(*sk);
|
||||
*sk = NULL;
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue