Update - OpenSSL 1.1.1-pre7-dev
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env perl
|
||||
# Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2007-2018 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env perl
|
||||
# Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2010-2018 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
|
||||
@@ -88,7 +88,7 @@ $pf = ($flavour =~ /nubi/i) ? $t0 : $t2;
|
||||
#
|
||||
######################################################################
|
||||
|
||||
$big_endian=(`echo MIPSEL | $ENV{CC} -E -`=~/MIPSEL/)?1:0 if ($ENV{CC});
|
||||
$big_endian=(`echo MIPSEB | $ENV{CC} -E -`=~/MIPSEB/)?0:1 if ($ENV{CC});
|
||||
|
||||
for (@ARGV) { $output=$_ if (/\w[\w\-]*\.\w+$/); }
|
||||
open STDOUT,">$output";
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
# CBC en-/decrypt CTR XTS
|
||||
# POWER8[le] 3.96/0.72 0.74 1.1
|
||||
# POWER8[be] 3.75/0.65 0.66 1.0
|
||||
# POWER9[le] 3.05/0.65 0.65 0.80
|
||||
|
||||
$flavour = shift;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env perl
|
||||
# Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2012-2018 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
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !__ASSEMBLER__
|
||||
# ifndef __ASSEMBLER__
|
||||
extern unsigned int OPENSSL_armcap_P;
|
||||
# endif
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env perl
|
||||
# Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2015-2018 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
|
||||
@@ -125,7 +125,7 @@ CRYPTO_memcmp:
|
||||
|
||||
ldmia sp!,{r4,r5}
|
||||
.Lno_data:
|
||||
neg r0,ip
|
||||
rsb r0,ip,#0
|
||||
mov r0,r0,lsr#31
|
||||
#if __ARM_ARCH__>=5
|
||||
bx lr
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -180,9 +180,10 @@ int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a)
|
||||
return BIO_write(bp, "NULL", 4);
|
||||
i = i2t_ASN1_OBJECT(buf, sizeof(buf), a);
|
||||
if (i > (int)(sizeof(buf) - 1)) {
|
||||
p = OPENSSL_malloc(i + 1);
|
||||
if (p == NULL)
|
||||
if ((p = OPENSSL_malloc(i + 1)) == NULL) {
|
||||
ASN1err(ASN1_F_I2A_ASN1_OBJECT, ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
i2t_ASN1_OBJECT(p, i + 1, a);
|
||||
}
|
||||
if (i <= 0) {
|
||||
|
||||
+43
-11
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2018 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
|
||||
@@ -139,7 +139,7 @@ static int do_buf(unsigned char *buf, int buflen,
|
||||
int type, unsigned short flags, char *quotes, char_io *io_ch,
|
||||
void *arg)
|
||||
{
|
||||
int i, outlen, len;
|
||||
int i, outlen, len, charwidth;
|
||||
unsigned short orflags;
|
||||
unsigned char *p, *q;
|
||||
unsigned long c;
|
||||
@@ -147,12 +147,32 @@ static int do_buf(unsigned char *buf, int buflen,
|
||||
p = buf;
|
||||
q = buf + buflen;
|
||||
outlen = 0;
|
||||
charwidth = type & BUF_TYPE_WIDTH_MASK;
|
||||
|
||||
switch (charwidth) {
|
||||
case 4:
|
||||
if (buflen & 3) {
|
||||
ASN1err(ASN1_F_DO_BUF, ASN1_R_INVALID_UNIVERSALSTRING_LENGTH);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (buflen & 1) {
|
||||
ASN1err(ASN1_F_DO_BUF, ASN1_R_INVALID_BMPSTRING_LENGTH);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
while (p != q) {
|
||||
if (p == buf && flags & ASN1_STRFLGS_ESC_2253)
|
||||
orflags = CHARTYPE_FIRST_ESC_2253;
|
||||
else
|
||||
orflags = 0;
|
||||
switch (type & BUF_TYPE_WIDTH_MASK) {
|
||||
|
||||
switch (charwidth) {
|
||||
case 4:
|
||||
c = ((unsigned long)*p++) << 24;
|
||||
c |= ((unsigned long)*p++) << 16;
|
||||
@@ -173,6 +193,7 @@ static int do_buf(unsigned char *buf, int buflen,
|
||||
i = UTF8_getc(p, buflen, &c);
|
||||
if (i < 0)
|
||||
return -1; /* Invalid UTF8String */
|
||||
buflen -= i;
|
||||
p += i;
|
||||
break;
|
||||
default:
|
||||
@@ -259,9 +280,10 @@ static int do_dump(unsigned long lflags, char_io *io_ch, void *arg,
|
||||
t.type = str->type;
|
||||
t.value.ptr = (char *)str;
|
||||
der_len = i2d_ASN1_TYPE(&t, NULL);
|
||||
der_buf = OPENSSL_malloc(der_len);
|
||||
if (der_buf == NULL)
|
||||
if ((der_buf = OPENSSL_malloc(der_len)) == NULL) {
|
||||
ASN1err(ASN1_F_DO_DUMP, ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
p = der_buf;
|
||||
i2d_ASN1_TYPE(&t, &p);
|
||||
outlen = do_hex_dump(io_ch, arg, der_buf, der_len);
|
||||
@@ -280,12 +302,22 @@ static int do_dump(unsigned long lflags, char_io *io_ch, void *arg,
|
||||
static const signed char tag2nbyte[] = {
|
||||
-1, -1, -1, -1, -1, /* 0-4 */
|
||||
-1, -1, -1, -1, -1, /* 5-9 */
|
||||
-1, -1, 0, -1, /* 10-13 */
|
||||
-1, -1, -1, -1, /* 15-17 */
|
||||
1, 1, 1, /* 18-20 */
|
||||
-1, 1, 1, 1, /* 21-24 */
|
||||
-1, 1, -1, /* 25-27 */
|
||||
4, -1, 2 /* 28-30 */
|
||||
-1, -1, /* 10-11 */
|
||||
0, /* 12 V_ASN1_UTF8STRING */
|
||||
-1, -1, -1, -1, -1, /* 13-17 */
|
||||
1, /* 18 V_ASN1_NUMERICSTRING */
|
||||
1, /* 19 V_ASN1_PRINTABLESTRING */
|
||||
1, /* 20 V_ASN1_T61STRING */
|
||||
-1, /* 21 */
|
||||
1, /* 22 V_ASN1_IA5STRING */
|
||||
1, /* 23 V_ASN1_UTCTIME */
|
||||
1, /* 24 V_ASN1_GENERALIZEDTIME */
|
||||
-1, /* 25 */
|
||||
1, /* 26 V_ASN1_ISO64STRING */
|
||||
-1, /* 27 */
|
||||
4, /* 28 V_ASN1_UNIVERSALSTRING */
|
||||
-1, /* 29 */
|
||||
2 /* 30 V_ASN1_BMPSTRING */
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2018 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
|
||||
@@ -156,9 +156,10 @@ static ASN1_STRING_TABLE *stable_get(int nid)
|
||||
tmp = ASN1_STRING_TABLE_get(nid);
|
||||
if (tmp != NULL && tmp->flags & STABLE_FLAGS_MALLOC)
|
||||
return tmp;
|
||||
rv = OPENSSL_zalloc(sizeof(*rv));
|
||||
if (rv == NULL)
|
||||
if ((rv = OPENSSL_zalloc(sizeof(*rv))) == NULL) {
|
||||
ASN1err(ASN1_F_STABLE_GET, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
if (!sk_ASN1_STRING_TABLE_push(stable, rv)) {
|
||||
OPENSSL_free(rv);
|
||||
return NULL;
|
||||
|
||||
@@ -400,3 +400,20 @@ void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth,
|
||||
{
|
||||
ameth->pkey_param_check = pkey_param_check;
|
||||
}
|
||||
|
||||
void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth,
|
||||
int (*set_priv_key) (EVP_PKEY *pk,
|
||||
const unsigned char
|
||||
*priv,
|
||||
size_t len))
|
||||
{
|
||||
ameth->set_priv_key = set_priv_key;
|
||||
}
|
||||
|
||||
void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth,
|
||||
int (*set_pub_key) (EVP_PKEY *pk,
|
||||
const unsigned char *pub,
|
||||
size_t len))
|
||||
{
|
||||
ameth->set_pub_key = set_pub_key;
|
||||
}
|
||||
+17
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -18,6 +18,7 @@ static const ERR_STRING_DATA ASN1_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_A2I_ASN1_INTEGER, 0), "a2i_ASN1_INTEGER"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_A2I_ASN1_STRING, 0), "a2i_ASN1_STRING"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_APPEND_EXP, 0), "append_exp"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_BIO_INIT, 0), "asn1_bio_init"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_BIT_STRING_SET_BIT, 0),
|
||||
"ASN1_BIT_STRING_set_bit"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_CB, 0), "asn1_cb"},
|
||||
@@ -31,6 +32,7 @@ static const ERR_STRING_DATA ASN1_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_DO_ADB, 0), "asn1_do_adb"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_DO_LOCK, 0), "asn1_do_lock"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_DUP, 0), "ASN1_dup"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_ENC_SAVE, 0), "asn1_enc_save"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_EX_C2I, 0), "asn1_ex_c2i"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_FIND_END, 0), "asn1_find_end"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_GENERALIZEDTIME_ADJ, 0),
|
||||
@@ -47,6 +49,8 @@ static const ERR_STRING_DATA ASN1_str_functs[] = {
|
||||
"asn1_item_embed_d2i"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_ITEM_EMBED_NEW, 0),
|
||||
"asn1_item_embed_new"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_ITEM_FLAGS_I2D, 0),
|
||||
"asn1_item_flags_i2d"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_ITEM_I2D_BIO, 0), "ASN1_item_i2d_bio"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_ITEM_I2D_FP, 0), "ASN1_item_i2d_fp"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_ITEM_PACK, 0), "ASN1_item_pack"},
|
||||
@@ -60,6 +64,8 @@ static const ERR_STRING_DATA ASN1_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_OBJECT_NEW, 0), "ASN1_OBJECT_new"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_OUTPUT_DATA, 0), "asn1_output_data"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_PCTX_NEW, 0), "ASN1_PCTX_new"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_PRIMITIVE_NEW, 0),
|
||||
"asn1_primitive_new"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_SCTX_NEW, 0), "ASN1_SCTX_new"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_SIGN, 0), "ASN1_sign"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_STR2TYPE, 0), "asn1_str2type"},
|
||||
@@ -103,7 +109,11 @@ static const ERR_STRING_DATA ASN1_str_functs[] = {
|
||||
"d2i_AutoPrivateKey"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_D2I_PRIVATEKEY, 0), "d2i_PrivateKey"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_D2I_PUBLICKEY, 0), "d2i_PublicKey"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_DO_BUF, 0), "do_buf"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_DO_CREATE, 0), "do_create"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_DO_DUMP, 0), "do_dump"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_DO_TCREATE, 0), "do_tcreate"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_I2A_ASN1_OBJECT, 0), "i2a_ASN1_OBJECT"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_I2D_ASN1_BIO_STREAM, 0),
|
||||
"i2d_ASN1_bio_stream"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_I2D_DSA_PUBKEY, 0), "i2d_DSA_PUBKEY"},
|
||||
@@ -112,6 +122,8 @@ static const ERR_STRING_DATA ASN1_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_I2D_PUBLICKEY, 0), "i2d_PublicKey"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_I2D_RSA_PUBKEY, 0), "i2d_RSA_PUBKEY"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_LONG_C2I, 0), "long_c2i"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_NDEF_PREFIX, 0), "ndef_prefix"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_NDEF_SUFFIX, 0), "ndef_suffix"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_OID_MODULE_INIT, 0), "oid_module_init"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_PARSE_TAGGING, 0), "parse_tagging"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_PKCS5_PBE2_SET_IV, 0), "PKCS5_pbe2_set_iv"},
|
||||
@@ -124,9 +136,12 @@ static const ERR_STRING_DATA ASN1_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_PKCS5_SCRYPT_SET, 0), "pkcs5_scrypt_set"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_SMIME_READ_ASN1, 0), "SMIME_read_ASN1"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_SMIME_TEXT, 0), "SMIME_text"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_STABLE_GET, 0), "stable_get"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_STBL_MODULE_INIT, 0), "stbl_module_init"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_UINT32_C2I, 0), "uint32_c2i"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_UINT32_NEW, 0), "uint32_new"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_UINT64_C2I, 0), "uint64_c2i"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_UINT64_NEW, 0), "uint64_new"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_X509_CRL_ADD0_REVOKED, 0),
|
||||
"X509_CRL_add0_revoked"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, ASN1_F_X509_INFO_NEW, 0), "X509_INFO_new"},
|
||||
@@ -246,6 +261,7 @@ static const ERR_STRING_DATA ASN1_str_reasons[] = {
|
||||
{ERR_PACK(ERR_LIB_ASN1, 0, ASN1_R_MSTRING_WRONG_TAG), "mstring wrong tag"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, 0, ASN1_R_NESTED_ASN1_STRING),
|
||||
"nested asn1 string"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, 0, ASN1_R_NESTED_TOO_DEEP), "nested too deep"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, 0, ASN1_R_NON_HEX_CHARACTERS),
|
||||
"non hex characters"},
|
||||
{ERR_PACK(ERR_LIB_ASN1, 0, ASN1_R_NOT_ASCII_FORMAT), "not ascii format"},
|
||||
|
||||
@@ -953,12 +953,14 @@ static int strip_eol(char *linebuf, int *plen, int flags)
|
||||
|
||||
for (p = linebuf + len - 1; len > 0; len--, p--) {
|
||||
c = *p;
|
||||
if (c == '\n')
|
||||
if (c == '\n') {
|
||||
is_eol = 1;
|
||||
else if (is_eol && flags & SMIME_ASCIICRLF && c < 33)
|
||||
} else if (is_eol && flags & SMIME_ASCIICRLF && c == 32) {
|
||||
/* Strip trailing space on a line; 32 == ASCII for ' ' */
|
||||
continue;
|
||||
else if (c != '\r')
|
||||
} else if (c != '\r') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*plen = len;
|
||||
return is_eol;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2002-2018 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
|
||||
@@ -92,9 +92,10 @@ static int do_create(const char *value, const char *name)
|
||||
p--;
|
||||
}
|
||||
p++;
|
||||
lntmp = OPENSSL_malloc((p - ln) + 1);
|
||||
if (lntmp == NULL)
|
||||
if ((lntmp = OPENSSL_malloc((p - ln) + 1)) == NULL) {
|
||||
ASN1err(ASN1_F_DO_CREATE, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
memcpy(lntmp, ln, p - ln);
|
||||
lntmp[p - ln] = 0;
|
||||
oid = OBJ_nid2obj(nid);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2018 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
|
||||
@@ -116,9 +116,10 @@ static int asn1_bio_new(BIO *b)
|
||||
|
||||
static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
|
||||
{
|
||||
ctx->buf = OPENSSL_malloc(size);
|
||||
if (ctx->buf == NULL)
|
||||
if ((ctx->buf = OPENSSL_malloc(size)) == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_BIO_INIT, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
ctx->bufsize = size;
|
||||
ctx->asn1_class = V_ASN1_UNIVERSAL;
|
||||
ctx->asn1_tag = V_ASN1_OCTET_STRING;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2008-2018 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
|
||||
@@ -113,9 +113,10 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
ndef_aux = *(NDEF_SUPPORT **)parg;
|
||||
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
|
||||
p = OPENSSL_malloc(derlen);
|
||||
if (p == NULL)
|
||||
if ((p = OPENSSL_malloc(derlen)) == NULL) {
|
||||
ASN1err(ASN1_F_NDEF_PREFIX, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ndef_aux->derbuf = p;
|
||||
*pbuf = p;
|
||||
@@ -182,9 +183,10 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
|
||||
return 0;
|
||||
|
||||
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
|
||||
p = OPENSSL_malloc(derlen);
|
||||
if (p == NULL)
|
||||
if ((p = OPENSSL_malloc(derlen)) == NULL) {
|
||||
ASN1err(ASN1_F_NDEF_SUFFIX, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ndef_aux->derbuf = p;
|
||||
*pbuf = p;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2015-2018 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
|
||||
@@ -82,7 +82,7 @@ X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher,
|
||||
if (EVP_CIPHER_iv_length(cipher)) {
|
||||
if (aiv)
|
||||
memcpy(iv, aiv, EVP_CIPHER_iv_length(cipher));
|
||||
else if (RAND_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
|
||||
else if (RAND_bytes(iv, EVP_CIPHER_iv_length(cipher)) <= 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2018 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
|
||||
|
||||
+34
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2018 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,9 +17,19 @@
|
||||
#include "internal/numbers.h"
|
||||
#include "asn1_locl.h"
|
||||
|
||||
|
||||
/*
|
||||
* Constructed types with a recursive definition (such as can be found in PKCS7)
|
||||
* could eventually exceed the stack given malicious input with excessive
|
||||
* recursion. Therefore we limit the stack depth. This is the maximum number of
|
||||
* recursive invocations of asn1_item_embed_d2i().
|
||||
*/
|
||||
#define ASN1_MAX_CONSTRUCTED_NEST 30
|
||||
|
||||
static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
long len, const ASN1_ITEM *it,
|
||||
int tag, int aclass, char opt, ASN1_TLC *ctx);
|
||||
int tag, int aclass, char opt, ASN1_TLC *ctx,
|
||||
int depth);
|
||||
|
||||
static int asn1_check_eoc(const unsigned char **in, long len);
|
||||
static int asn1_find_end(const unsigned char **in, long len, char inf);
|
||||
@@ -37,11 +47,11 @@ static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass,
|
||||
static int asn1_template_ex_d2i(ASN1_VALUE **pval,
|
||||
const unsigned char **in, long len,
|
||||
const ASN1_TEMPLATE *tt, char opt,
|
||||
ASN1_TLC *ctx);
|
||||
ASN1_TLC *ctx, int depth);
|
||||
static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
const unsigned char **in, long len,
|
||||
const ASN1_TEMPLATE *tt, char opt,
|
||||
ASN1_TLC *ctx);
|
||||
ASN1_TLC *ctx, int depth);
|
||||
static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
|
||||
const unsigned char **in, long len,
|
||||
const ASN1_ITEM *it,
|
||||
@@ -111,7 +121,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
int tag, int aclass, char opt, ASN1_TLC *ctx)
|
||||
{
|
||||
int rv;
|
||||
rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx);
|
||||
rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0);
|
||||
if (rv <= 0)
|
||||
ASN1_item_ex_free(pval, it);
|
||||
return rv;
|
||||
@@ -124,7 +134,8 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
|
||||
static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
long len, const ASN1_ITEM *it,
|
||||
int tag, int aclass, char opt, ASN1_TLC *ctx)
|
||||
int tag, int aclass, char opt, ASN1_TLC *ctx,
|
||||
int depth)
|
||||
{
|
||||
const ASN1_TEMPLATE *tt, *errtt = NULL;
|
||||
const ASN1_EXTERN_FUNCS *ef;
|
||||
@@ -145,6 +156,11 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
else
|
||||
asn1_cb = 0;
|
||||
|
||||
if (++depth > ASN1_MAX_CONSTRUCTED_NEST) {
|
||||
ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_NESTED_TOO_DEEP);
|
||||
goto err;
|
||||
}
|
||||
|
||||
switch (it->itype) {
|
||||
case ASN1_ITYPE_PRIMITIVE:
|
||||
if (it->templates) {
|
||||
@@ -160,7 +176,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
goto err;
|
||||
}
|
||||
return asn1_template_ex_d2i(pval, in, len,
|
||||
it->templates, opt, ctx);
|
||||
it->templates, opt, ctx, depth);
|
||||
}
|
||||
return asn1_d2i_ex_primitive(pval, in, len, it,
|
||||
tag, aclass, opt, ctx);
|
||||
@@ -221,7 +237,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
/*
|
||||
* We mark field as OPTIONAL so its absence can be recognised.
|
||||
*/
|
||||
ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx);
|
||||
ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx, depth);
|
||||
/* If field not present, try the next one */
|
||||
if (ret == -1)
|
||||
continue;
|
||||
@@ -344,7 +360,8 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
* attempt to read in field, allowing each to be OPTIONAL
|
||||
*/
|
||||
|
||||
ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx);
|
||||
ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx,
|
||||
depth);
|
||||
if (!ret) {
|
||||
errtt = seqtt;
|
||||
goto err;
|
||||
@@ -420,7 +437,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
static int asn1_template_ex_d2i(ASN1_VALUE **val,
|
||||
const unsigned char **in, long inlen,
|
||||
const ASN1_TEMPLATE *tt, char opt,
|
||||
ASN1_TLC *ctx)
|
||||
ASN1_TLC *ctx, int depth)
|
||||
{
|
||||
int flags, aclass;
|
||||
int ret;
|
||||
@@ -455,7 +472,7 @@ static int asn1_template_ex_d2i(ASN1_VALUE **val,
|
||||
return 0;
|
||||
}
|
||||
/* We've found the field so it can't be OPTIONAL now */
|
||||
ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx);
|
||||
ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx, depth);
|
||||
if (!ret) {
|
||||
ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
|
||||
return 0;
|
||||
@@ -479,7 +496,7 @@ static int asn1_template_ex_d2i(ASN1_VALUE **val,
|
||||
}
|
||||
}
|
||||
} else
|
||||
return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx);
|
||||
return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx, depth);
|
||||
|
||||
*in = p;
|
||||
return 1;
|
||||
@@ -491,7 +508,7 @@ static int asn1_template_ex_d2i(ASN1_VALUE **val,
|
||||
static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
const unsigned char **in, long len,
|
||||
const ASN1_TEMPLATE *tt, char opt,
|
||||
ASN1_TLC *ctx)
|
||||
ASN1_TLC *ctx, int depth)
|
||||
{
|
||||
int flags, aclass;
|
||||
int ret;
|
||||
@@ -573,7 +590,8 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
}
|
||||
skfield = NULL;
|
||||
if (!asn1_item_embed_d2i(&skfield, &p, len,
|
||||
ASN1_ITEM_ptr(tt->item), -1, 0, 0, ctx)) {
|
||||
ASN1_ITEM_ptr(tt->item), -1, 0, 0, ctx,
|
||||
depth)) {
|
||||
ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I,
|
||||
ERR_R_NESTED_ASN1_ERROR);
|
||||
/* |skfield| may be partially allocated despite failure. */
|
||||
@@ -595,7 +613,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
/* IMPLICIT tagging */
|
||||
ret = asn1_item_embed_d2i(val, &p, len,
|
||||
ASN1_ITEM_ptr(tt->item), tt->tag, aclass, opt,
|
||||
ctx);
|
||||
ctx, depth);
|
||||
if (!ret) {
|
||||
ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
@@ -604,7 +622,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
} else {
|
||||
/* Nothing special */
|
||||
ret = asn1_item_embed_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item),
|
||||
-1, 0, opt, ctx);
|
||||
-1, 0, opt, ctx, depth);
|
||||
if (!ret) {
|
||||
ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2018 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
|
||||
@@ -57,12 +57,14 @@ static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,
|
||||
if (out && !*out) {
|
||||
unsigned char *p, *buf;
|
||||
int len;
|
||||
|
||||
len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags);
|
||||
if (len <= 0)
|
||||
return len;
|
||||
buf = OPENSSL_malloc(len);
|
||||
if (buf == NULL)
|
||||
if ((buf = OPENSSL_malloc(len)) == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_ITEM_FLAGS_I2D, ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
p = buf;
|
||||
ASN1_item_ex_i2d(&val, &p, it, -1, flags);
|
||||
*out = buf;
|
||||
@@ -528,6 +530,8 @@ static int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
|
||||
otmp = (ASN1_OBJECT *)*pval;
|
||||
cont = otmp->data;
|
||||
len = otmp->length;
|
||||
if (cont == NULL || len == 0)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case V_ASN1_NULL:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2018 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
|
||||
@@ -299,9 +299,10 @@ static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
return 1;
|
||||
|
||||
case V_ASN1_ANY:
|
||||
typ = OPENSSL_malloc(sizeof(*typ));
|
||||
if (typ == NULL)
|
||||
if ((typ = OPENSSL_malloc(sizeof(*typ))) == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_PRIMITIVE_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
typ->value.ptr = NULL;
|
||||
typ->type = -1;
|
||||
*pval = (ASN1_VALUE *)typ;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2018 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
|
||||
@@ -133,9 +133,10 @@ int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
|
||||
return 1;
|
||||
|
||||
OPENSSL_free(enc->enc);
|
||||
enc->enc = OPENSSL_malloc(inlen);
|
||||
if (enc->enc == NULL)
|
||||
if ((enc->enc = OPENSSL_malloc(inlen)) == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_ENC_SAVE, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
memcpy(enc->enc, in, inlen);
|
||||
enc->len = inlen;
|
||||
enc->modified = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2017-2018 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
|
||||
@@ -28,9 +28,10 @@
|
||||
|
||||
static int uint64_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
*pval = (ASN1_VALUE *)OPENSSL_zalloc(sizeof(uint64_t));
|
||||
if (*pval == NULL)
|
||||
if ((*pval = (ASN1_VALUE *)OPENSSL_zalloc(sizeof(uint64_t))) == NULL) {
|
||||
ASN1err(ASN1_F_UINT64_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -110,9 +111,10 @@ static int uint64_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
|
||||
static int uint32_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
*pval = (ASN1_VALUE *)OPENSSL_zalloc(sizeof(uint32_t));
|
||||
if (*pval == NULL)
|
||||
if ((*pval = (ASN1_VALUE *)OPENSSL_zalloc(sizeof(uint32_t))) == NULL) {
|
||||
ASN1err(ASN1_F_UINT32_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+49
-31
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2015-2018 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
|
||||
@@ -30,11 +30,12 @@
|
||||
static CRYPTO_THREAD_LOCAL ctxkey;
|
||||
static CRYPTO_THREAD_LOCAL poolkey;
|
||||
|
||||
static void async_free_pool_internal(async_pool *pool);
|
||||
|
||||
static async_ctx *async_ctx_new(void)
|
||||
{
|
||||
async_ctx *nctx = NULL;
|
||||
async_ctx *nctx;
|
||||
|
||||
if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ASYNC))
|
||||
return NULL;
|
||||
|
||||
nctx = OPENSSL_malloc(sizeof(*nctx));
|
||||
if (nctx == NULL) {
|
||||
@@ -57,9 +58,6 @@ err:
|
||||
|
||||
async_ctx *async_get_ctx(void)
|
||||
{
|
||||
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
|
||||
return NULL;
|
||||
|
||||
return (async_ctx *)CRYPTO_THREAD_get_local(&ctxkey);
|
||||
}
|
||||
|
||||
@@ -169,16 +167,19 @@ void async_start_func(void)
|
||||
int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
|
||||
int (*func)(void *), void *args, size_t size)
|
||||
{
|
||||
async_ctx *ctx = async_get_ctx();
|
||||
async_ctx *ctx;
|
||||
|
||||
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
|
||||
return ASYNC_ERR;
|
||||
|
||||
ctx = async_get_ctx();
|
||||
if (ctx == NULL)
|
||||
ctx = async_ctx_new();
|
||||
if (ctx == NULL) {
|
||||
if (ctx == NULL)
|
||||
return ASYNC_ERR;
|
||||
}
|
||||
|
||||
if (*job) {
|
||||
if (*job)
|
||||
ctx->currjob = *job;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (ctx->currjob != NULL) {
|
||||
@@ -219,9 +220,8 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
|
||||
}
|
||||
|
||||
/* Start a new job */
|
||||
if ((ctx->currjob = async_get_pool_job()) == NULL) {
|
||||
if ((ctx->currjob = async_get_pool_job()) == NULL)
|
||||
return ASYNC_NO_JOBS;
|
||||
}
|
||||
|
||||
if (args != NULL) {
|
||||
ctx->currjob->funcargs = OPENSSL_malloc(size);
|
||||
@@ -323,12 +323,11 @@ int ASYNC_init_thread(size_t max_size, size_t init_size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL)) {
|
||||
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
|
||||
return 0;
|
||||
}
|
||||
if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ASYNC)) {
|
||||
|
||||
if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ASYNC))
|
||||
return 0;
|
||||
}
|
||||
|
||||
pool = OPENSSL_zalloc(sizeof(*pool));
|
||||
if (pool == NULL) {
|
||||
@@ -369,32 +368,41 @@ int ASYNC_init_thread(size_t max_size, size_t init_size)
|
||||
|
||||
return 1;
|
||||
err:
|
||||
async_free_pool_internal(pool);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void async_free_pool_internal(async_pool *pool)
|
||||
{
|
||||
if (pool == NULL)
|
||||
return;
|
||||
|
||||
async_empty_pool(pool);
|
||||
sk_ASYNC_JOB_free(pool->jobs);
|
||||
OPENSSL_free(pool);
|
||||
CRYPTO_THREAD_set_local(&poolkey, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void async_delete_thread_state(void)
|
||||
{
|
||||
async_pool *pool = (async_pool *)CRYPTO_THREAD_get_local(&poolkey);
|
||||
|
||||
if (pool != NULL) {
|
||||
async_empty_pool(pool);
|
||||
sk_ASYNC_JOB_free(pool->jobs);
|
||||
OPENSSL_free(pool);
|
||||
CRYPTO_THREAD_set_local(&poolkey, NULL);
|
||||
}
|
||||
async_local_cleanup();
|
||||
async_ctx_free();
|
||||
}
|
||||
|
||||
void ASYNC_cleanup_thread(void)
|
||||
{
|
||||
async_free_pool_internal((async_pool *)CRYPTO_THREAD_get_local(&poolkey));
|
||||
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
|
||||
return;
|
||||
|
||||
async_delete_thread_state();
|
||||
}
|
||||
|
||||
ASYNC_JOB *ASYNC_get_current_job(void)
|
||||
{
|
||||
async_ctx *ctx;
|
||||
|
||||
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
|
||||
return NULL;
|
||||
|
||||
ctx = async_get_ctx();
|
||||
if (ctx == NULL)
|
||||
return NULL;
|
||||
@@ -409,7 +417,12 @@ ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job)
|
||||
|
||||
void ASYNC_block_pause(void)
|
||||
{
|
||||
async_ctx *ctx = async_get_ctx();
|
||||
async_ctx *ctx;
|
||||
|
||||
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
|
||||
return;
|
||||
|
||||
ctx = async_get_ctx();
|
||||
if (ctx == NULL || ctx->currjob == NULL) {
|
||||
/*
|
||||
* We're not in a job anyway so ignore this
|
||||
@@ -421,7 +434,12 @@ void ASYNC_block_pause(void)
|
||||
|
||||
void ASYNC_unblock_pause(void)
|
||||
{
|
||||
async_ctx *ctx = async_get_ctx();
|
||||
async_ctx *ctx;
|
||||
|
||||
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
|
||||
return;
|
||||
|
||||
ctx = async_get_ctx();
|
||||
if (ctx == NULL || ctx->currjob == NULL) {
|
||||
/*
|
||||
* We're not in a job anyway so ignore this
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -21,6 +21,8 @@ static const ERR_STRING_DATA ASYNC_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_ASYNC, ASYNC_F_ASYNC_PAUSE_JOB, 0), "ASYNC_pause_job"},
|
||||
{ERR_PACK(ERR_LIB_ASYNC, ASYNC_F_ASYNC_START_FUNC, 0), "async_start_func"},
|
||||
{ERR_PACK(ERR_LIB_ASYNC, ASYNC_F_ASYNC_START_JOB, 0), "ASYNC_start_job"},
|
||||
{ERR_PACK(ERR_LIB_ASYNC, ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD, 0),
|
||||
"ASYNC_WAIT_CTX_set_wait_fd"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2018 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
|
||||
@@ -47,9 +47,10 @@ int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||
{
|
||||
struct fd_lookup_st *fdlookup;
|
||||
|
||||
fdlookup = OPENSSL_zalloc(sizeof(*fdlookup));
|
||||
if (fdlookup == NULL)
|
||||
if ((fdlookup = OPENSSL_zalloc(sizeof(*fdlookup))) == NULL) {
|
||||
ASYNCerr(ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fdlookup->key = key;
|
||||
fdlookup->fd = fd;
|
||||
|
||||
+8
-6
@@ -66,18 +66,18 @@ void BIO_ADDR_clear(BIO_ADDR *ap)
|
||||
int BIO_ADDR_make(BIO_ADDR *ap, const struct sockaddr *sa)
|
||||
{
|
||||
if (sa->sa_family == AF_INET) {
|
||||
ap->s_in = *(const struct sockaddr_in *)sa;
|
||||
memcpy(&(ap->s_in), sa, sizeof(struct sockaddr_in));
|
||||
return 1;
|
||||
}
|
||||
#ifdef AF_INET6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
ap->s_in6 = *(const struct sockaddr_in6 *)sa;
|
||||
memcpy(&(ap->s_in6), sa, sizeof(struct sockaddr_in6));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef AF_UNIX
|
||||
if (sa->sa_family == AF_UNIX) {
|
||||
ap->s_un = *(const struct sockaddr_un *)sa;
|
||||
memcpy(&(ap->s_un), sa, sizeof(struct sockaddr_un));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@@ -565,9 +565,10 @@ static int addrinfo_wrap(int family, int socktype,
|
||||
unsigned short port,
|
||||
BIO_ADDRINFO **bai)
|
||||
{
|
||||
*bai = OPENSSL_zalloc(sizeof(**bai));
|
||||
if (*bai == NULL)
|
||||
if ((*bai = OPENSSL_zalloc(sizeof(**bai))) == NULL) {
|
||||
BIOerr(BIO_F_ADDRINFO_WRAP, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
(*bai)->bai_family = family;
|
||||
(*bai)->bai_socktype = socktype;
|
||||
@@ -602,7 +603,8 @@ static int addrinfo_wrap(int family, int socktype,
|
||||
|
||||
DEFINE_RUN_ONCE_STATIC(do_bio_lookup_init)
|
||||
{
|
||||
OPENSSL_init_crypto(0, NULL);
|
||||
if (!OPENSSL_init_crypto(0, NULL))
|
||||
return 0;
|
||||
bio_lookup_lock = CRYPTO_THREAD_lock_new();
|
||||
return bio_lookup_lock != NULL;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -819,9 +819,10 @@ doapr_outch(char **sbuffer,
|
||||
|
||||
*maxlen += BUFFER_INC;
|
||||
if (*buffer == NULL) {
|
||||
*buffer = OPENSSL_malloc(*maxlen);
|
||||
if (*buffer == NULL)
|
||||
if ((*buffer = OPENSSL_malloc(*maxlen)) == NULL) {
|
||||
BIOerr(BIO_F_DOAPR_OUTCH, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
if (*currlen > 0) {
|
||||
if (!ossl_assert(*sbuffer != NULL))
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -308,7 +308,7 @@ int BIO_socket_nbio(int s, int mode)
|
||||
|
||||
l = fcntl(s, F_GETFL, 0);
|
||||
if (l == -1) {
|
||||
SYSerr(SYS_F_FCNTL, get_last_rtl_error());
|
||||
SYSerr(SYS_F_FCNTL, get_last_sys_error());
|
||||
ret = -1;
|
||||
} else {
|
||||
# if defined(O_NONBLOCK)
|
||||
@@ -326,7 +326,7 @@ int BIO_socket_nbio(int s, int mode)
|
||||
ret = fcntl(s, F_SETFL, l);
|
||||
|
||||
if (ret < 0) {
|
||||
SYSerr(SYS_F_FCNTL, get_last_rtl_error());
|
||||
SYSerr(SYS_F_FCNTL, get_last_sys_error());
|
||||
}
|
||||
}
|
||||
# else
|
||||
|
||||
@@ -59,11 +59,13 @@ static int linebuffer_new(BIO *bi)
|
||||
{
|
||||
BIO_LINEBUFFER_CTX *ctx;
|
||||
|
||||
ctx = OPENSSL_malloc(sizeof(*ctx));
|
||||
if (ctx == NULL)
|
||||
if ((ctx = OPENSSL_malloc(sizeof(*ctx))) == NULL) {
|
||||
BIOerr(BIO_F_LINEBUFFER_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
ctx->obuf = OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE);
|
||||
if (ctx->obuf == NULL) {
|
||||
BIOerr(BIO_F_LINEBUFFER_NEW, ERR_R_MALLOC_FAILURE);
|
||||
OPENSSL_free(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -57,8 +57,10 @@ static int nbiof_new(BIO *bi)
|
||||
{
|
||||
NBIO_TEST *nt;
|
||||
|
||||
if ((nt = OPENSSL_zalloc(sizeof(*nt))) == NULL)
|
||||
if ((nt = OPENSSL_zalloc(sizeof(*nt))) == NULL) {
|
||||
BIOerr(BIO_F_NBIOF_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
nt->lrn = -1;
|
||||
nt->lwn = -1;
|
||||
bi->ptr = (char *)nt;
|
||||
@@ -89,7 +91,7 @@ static int nbiof_read(BIO *b, char *out, int outl)
|
||||
return 0;
|
||||
|
||||
BIO_clear_retry_flags(b);
|
||||
if (RAND_bytes(&n, 1) <= 0)
|
||||
if (RAND_priv_bytes(&n, 1) <= 0)
|
||||
return -1;
|
||||
num = (n & 0x07);
|
||||
|
||||
@@ -126,7 +128,7 @@ static int nbiof_write(BIO *b, const char *in, int inl)
|
||||
num = nt->lwn;
|
||||
nt->lwn = 0;
|
||||
} else {
|
||||
if (RAND_bytes(&n, 1) <= 0)
|
||||
if (RAND_priv_bytes(&n, 1) <= 0)
|
||||
return -1;
|
||||
num = (n & 7);
|
||||
}
|
||||
|
||||
@@ -15,13 +15,16 @@
|
||||
|
||||
static const ERR_STRING_DATA BIO_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_ACPT_STATE, 0), "acpt_state"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_ADDRINFO_WRAP, 0), "addrinfo_wrap"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_ADDR_STRINGS, 0), "addr_strings"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT, 0), "BIO_accept"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT_EX, 0), "BIO_accept_ex"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT_NEW, 0), "BIO_ACCEPT_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ADDR_NEW, 0), "BIO_ADDR_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_BIND, 0), "BIO_bind"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CALLBACK_CTRL, 0), "BIO_callback_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CONNECT, 0), "BIO_connect"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CONNECT_NEW, 0), "BIO_CONNECT_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CTRL, 0), "BIO_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GETS, 0), "BIO_gets"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GET_HOST_IP, 0), "BIO_get_host_ip"},
|
||||
@@ -55,12 +58,17 @@ static const ERR_STRING_DATA BIO_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BUFFER_CTRL, 0), "buffer_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_CONN_CTRL, 0), "conn_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_CONN_STATE, 0), "conn_state"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_DGRAM_SCTP_NEW, 0), "dgram_sctp_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_DGRAM_SCTP_READ, 0), "dgram_sctp_read"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_DGRAM_SCTP_WRITE, 0), "dgram_sctp_write"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_DOAPR_OUTCH, 0), "doapr_outch"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_FILE_CTRL, 0), "file_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_FILE_READ, 0), "file_read"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_CTRL, 0), "linebuffer_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_NEW, 0), "linebuffer_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_MEM_WRITE, 0), "mem_write"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_NBIOF_NEW, 0), "nbiof_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_SLG_WRITE, 0), "slg_write"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_SSL_NEW, 0), "SSL_new"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
+11
-11
@@ -34,9 +34,8 @@ static long bio_call_callback(BIO *b, int oper, const char *argp, size_t len,
|
||||
long ret;
|
||||
int bareoper;
|
||||
|
||||
if (b->callback_ex != NULL) {
|
||||
if (b->callback_ex != NULL)
|
||||
return b->callback_ex(b, oper, argp, len, argi, argl, inret, processed);
|
||||
}
|
||||
|
||||
/* Strip off any BIO_CB_RETURN flag */
|
||||
bareoper = oper & ~BIO_CB_RETURN;
|
||||
@@ -51,17 +50,17 @@ static long bio_call_callback(BIO *b, int oper, const char *argp, size_t len,
|
||||
return -1;
|
||||
|
||||
argi = (int)len;
|
||||
}
|
||||
|
||||
if (inret && (oper & BIO_CB_RETURN)) {
|
||||
if (*processed > INT_MAX)
|
||||
return -1;
|
||||
inret = *processed;
|
||||
}
|
||||
if (inret && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) {
|
||||
if (*processed > INT_MAX)
|
||||
return -1;
|
||||
inret = *processed;
|
||||
}
|
||||
|
||||
ret = b->callback(b, oper, argp, argi, argl, inret);
|
||||
|
||||
if (ret >= 0 && (HAS_LEN_OPER(bareoper) || bareoper == BIO_CB_PUTS)) {
|
||||
if (ret >= 0 && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) {
|
||||
*processed = (size_t)ret;
|
||||
ret = 1;
|
||||
}
|
||||
@@ -260,7 +259,7 @@ static int bio_read_intern(BIO *b, void *data, size_t dlen, size_t *readbytes)
|
||||
|
||||
if ((b->callback != NULL || b->callback_ex != NULL) &&
|
||||
((ret = (int)bio_call_callback(b, BIO_CB_READ, data, dlen, 0, 0L, 1L,
|
||||
readbytes)) <= 0))
|
||||
NULL)) <= 0))
|
||||
return ret;
|
||||
|
||||
if (!b->init) {
|
||||
@@ -333,7 +332,7 @@ static int bio_write_intern(BIO *b, const void *data, size_t dlen,
|
||||
|
||||
if ((b->callback != NULL || b->callback_ex != NULL) &&
|
||||
((ret = (int)bio_call_callback(b, BIO_CB_WRITE, data, dlen, 0, 0L, 1L,
|
||||
written)) <= 0))
|
||||
NULL)) <= 0))
|
||||
return ret;
|
||||
|
||||
if (!b->init) {
|
||||
@@ -542,7 +541,8 @@ long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
|
||||
if (b == NULL)
|
||||
return 0;
|
||||
|
||||
if ((b->method == NULL) || (b->method->callback_ctrl == NULL)) {
|
||||
if ((b->method == NULL) || (b->method->callback_ctrl == NULL)
|
||||
|| (cmd != BIO_CTRL_SET_CALLBACK)) {
|
||||
BIOerr(BIO_F_BIO_CALLBACK_CTRL, BIO_R_UNSUPPORTED_METHOD);
|
||||
return -2;
|
||||
}
|
||||
|
||||
+11
-11
@@ -19,7 +19,7 @@ DEFINE_RUN_ONCE_STATIC(do_bio_type_init)
|
||||
return bio_type_lock != NULL;
|
||||
}
|
||||
|
||||
int BIO_get_new_index()
|
||||
int BIO_get_new_index(void)
|
||||
{
|
||||
static CRYPTO_REF_COUNT bio_count = BIO_TYPE_START;
|
||||
int newval;
|
||||
@@ -55,12 +55,12 @@ void BIO_meth_free(BIO_METHOD *biom)
|
||||
}
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_write(BIO_METHOD *biom)) (BIO *, const char *, int)
|
||||
int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int)
|
||||
{
|
||||
return biom->bwrite_old;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_write_ex(BIO_METHOD *biom)) (BIO *, const char *, size_t,
|
||||
int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t,
|
||||
size_t *)
|
||||
{
|
||||
return biom->bwrite;
|
||||
@@ -102,12 +102,12 @@ int BIO_meth_set_write_ex(BIO_METHOD *biom,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_read(BIO_METHOD *biom)) (BIO *, char *, int)
|
||||
int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int)
|
||||
{
|
||||
return biom->bread_old;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_read_ex(BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *)
|
||||
int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *)
|
||||
{
|
||||
return biom->bread;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ int BIO_meth_set_read_ex(BIO_METHOD *biom,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_puts(BIO_METHOD *biom)) (BIO *, const char *)
|
||||
int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *)
|
||||
{
|
||||
return biom->bputs;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ int BIO_meth_set_puts(BIO_METHOD *biom,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_gets(BIO_METHOD *biom)) (BIO *, char *, int)
|
||||
int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int)
|
||||
{
|
||||
return biom->bgets;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ int BIO_meth_set_gets(BIO_METHOD *biom,
|
||||
return 1;
|
||||
}
|
||||
|
||||
long (*BIO_meth_get_ctrl(BIO_METHOD *biom)) (BIO *, int, long, void *)
|
||||
long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *)
|
||||
{
|
||||
return biom->ctrl;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ int BIO_meth_set_ctrl(BIO_METHOD *biom,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_create(BIO_METHOD *biom)) (BIO *)
|
||||
int (*BIO_meth_get_create(const BIO_METHOD *biom)) (BIO *)
|
||||
{
|
||||
return biom->create;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *))
|
||||
return 1;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_destroy(BIO_METHOD *biom)) (BIO *)
|
||||
int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *)
|
||||
{
|
||||
return biom->destroy;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *))
|
||||
return 1;
|
||||
}
|
||||
|
||||
long (*BIO_meth_get_callback_ctrl(BIO_METHOD *biom)) (BIO *, int, BIO_info_cb *)
|
||||
long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) (BIO *, int, BIO_info_cb *)
|
||||
{
|
||||
return biom->callback_ctrl;
|
||||
}
|
||||
|
||||
@@ -92,8 +92,10 @@ static BIO_ACCEPT *BIO_ACCEPT_new(void)
|
||||
{
|
||||
BIO_ACCEPT *ret;
|
||||
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
|
||||
BIOerr(BIO_F_BIO_ACCEPT_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
ret->accept_family = BIO_FAMILY_IPANY;
|
||||
ret->accept_sock = (int)INVALID_SOCKET;
|
||||
return ret;
|
||||
@@ -103,7 +105,6 @@ static void BIO_ACCEPT_free(BIO_ACCEPT *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
return;
|
||||
|
||||
OPENSSL_free(a->param_addr);
|
||||
OPENSSL_free(a->param_serv);
|
||||
BIO_ADDRINFO_free(a->addr_first);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -223,8 +223,10 @@ BIO_CONNECT *BIO_CONNECT_new(void)
|
||||
{
|
||||
BIO_CONNECT *ret;
|
||||
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
|
||||
BIOerr(BIO_F_BIO_CONNECT_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
ret->state = BIO_CONN_S_BEFORE;
|
||||
ret->connect_family = BIO_FAMILY_IPANY;
|
||||
return ret;
|
||||
@@ -234,7 +236,6 @@ void BIO_CONNECT_free(BIO_CONNECT *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
return;
|
||||
|
||||
OPENSSL_free(a->param_hostname);
|
||||
OPENSSL_free(a->param_service);
|
||||
BIO_ADDRINFO_free(a->addr_first);
|
||||
|
||||
@@ -955,9 +955,10 @@ static int dgram_sctp_new(BIO *bi)
|
||||
|
||||
bi->init = 0;
|
||||
bi->num = 0;
|
||||
data = OPENSSL_zalloc(sizeof(*data));
|
||||
if (data == NULL)
|
||||
if ((data = OPENSSL_zalloc(sizeof(*data))) == NULL) {
|
||||
BIOerr(BIO_F_DGRAM_SCTP_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
# ifdef SCTP_PR_SCTP_NONE
|
||||
data->prinfo.pr_policy = SCTP_PR_SCTP_NONE;
|
||||
# endif
|
||||
|
||||
@@ -39,6 +39,8 @@ void *_malloc32(__size_t);
|
||||
# endif /* __INITIAL_POINTER_SIZE == 64 */
|
||||
# endif /* __INITIAL_POINTER_SIZE && defined
|
||||
* _ANSI_C_SOURCE */
|
||||
#elif defined(__DJGPP__) && defined(OPENSSL_NO_SOCK)
|
||||
# define NO_SYSLOG
|
||||
#elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG)
|
||||
# include <syslog.h>
|
||||
#endif
|
||||
@@ -195,6 +197,7 @@ static int slg_write(BIO *b, const char *in, int inl)
|
||||
};
|
||||
|
||||
if ((buf = OPENSSL_malloc(inl + 1)) == NULL) {
|
||||
BIOerr(BIO_F_SLG_WRITE, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
strncpy(buf, in, inl);
|
||||
|
||||
@@ -216,6 +216,8 @@ static int mem_write(BIO *b, const char *in, int inl)
|
||||
goto end;
|
||||
}
|
||||
BIO_clear_retry_flags(b);
|
||||
if (inl == 0)
|
||||
return 0;
|
||||
blen = bbm->readp->length;
|
||||
mem_buf_sync(b);
|
||||
if (BUF_MEM_grow_clean(bbm->buf, blen + inl) == 0)
|
||||
|
||||
@@ -297,15 +297,12 @@ bn_mul_mont:
|
||||
mov sp,$tp
|
||||
mov $bp,$rp # restore rp
|
||||
|
||||
and sp,$hi0,$ap
|
||||
bic $bp,$hi0,$bp
|
||||
bis $bp,$ap,$ap # ap=borrow?tp:rp
|
||||
|
||||
.align 4
|
||||
.Lcopy: ldq $aj,0($ap) # copy or in-place refresh
|
||||
.Lcopy: ldq $aj,0($tp) # conditional copy
|
||||
ldq $nj,0($rp)
|
||||
lda $tp,8($tp)
|
||||
lda $rp,8($rp)
|
||||
lda $ap,8($ap)
|
||||
cmoveq $hi0,$nj,$aj
|
||||
stq zero,-8($tp) # zap tp
|
||||
cmpult $tp,$tj,AT
|
||||
stq $aj,-8($rp)
|
||||
|
||||
@@ -262,14 +262,15 @@ bn_mul_mont:
|
||||
mov $tp,sp @ "rewind" $tp
|
||||
sub $rp,$rp,$aj @ "rewind" $rp
|
||||
|
||||
and $ap,$tp,$nhi
|
||||
bic $np,$rp,$nhi
|
||||
orr $ap,$ap,$np @ ap=borrow?tp:rp
|
||||
|
||||
.Lcopy: ldr $tj,[$ap],#4 @ copy or in-place refresh
|
||||
.Lcopy: ldr $tj,[$tp] @ conditional copy
|
||||
ldr $aj,[$rp]
|
||||
str sp,[$tp],#4 @ zap tp
|
||||
str $tj,[$rp],#4
|
||||
cmp $tp,$num
|
||||
#ifdef __thumb2__
|
||||
it cc
|
||||
#endif
|
||||
movcc $aj,$tj
|
||||
str $aj,[$rp],#4
|
||||
teq $tp,$num @ preserve carry
|
||||
bne .Lcopy
|
||||
|
||||
mov sp,$num
|
||||
|
||||
@@ -341,19 +341,19 @@ bn_mul_mont_general:
|
||||
{ .mmb; sub rptr=rptr,len // rewind
|
||||
sub tptr=tptr,len
|
||||
clrrrb.pr };;
|
||||
{ .mmi; and aptr=tptr,topbit
|
||||
andcm bptr=rptr,topbit
|
||||
{ .mmi; mov aptr=rptr
|
||||
mov bptr=tptr
|
||||
mov pr.rot=1<<16 };;
|
||||
{ .mii; or nptr=aptr,bptr
|
||||
{ .mii; cmp.eq p0,p6=topbit,r0
|
||||
mov ar.lc=lc
|
||||
mov ar.ec=3 };;
|
||||
mov ar.ec=2 };;
|
||||
|
||||
.Lcopy_ctop:
|
||||
{ .mmb; (p16) ld8 n[0]=[nptr],8
|
||||
(p18) st8 [tptr]=r0,8
|
||||
(p16) nop.b 0 }
|
||||
{ .mmb; (p16) nop.m 0
|
||||
(p18) st8 [rptr]=n[2],8
|
||||
{ .mmi; (p16) ld8 a[0]=[aptr],8
|
||||
(p16) ld8 t[0]=[bptr],8
|
||||
(p6) mov a[1]=t[1] };; // (p17)
|
||||
{ .mmb; (p17) st8 [rptr]=a[1],8
|
||||
(p17) st8 [tptr]=r0,8
|
||||
br.ctop.sptk .Lcopy_ctop };;
|
||||
.Lcopy_cend:
|
||||
|
||||
|
||||
@@ -386,15 +386,13 @@ $code.=<<___;
|
||||
$PTR_SUB $rp,$num # restore rp
|
||||
not $hi1,$hi0
|
||||
|
||||
and $ap,$hi0,$sp
|
||||
and $bp,$hi1,$rp
|
||||
or $ap,$ap,$bp # ap=borrow?tp:rp
|
||||
|
||||
.align 4
|
||||
.Lcopy: $LD $aj,($ap)
|
||||
$PTR_ADD $ap,$BNSZ
|
||||
.Lcopy: $LD $nj,($tp) # conditional move
|
||||
$LD $aj,($rp)
|
||||
$ST $zero,($tp)
|
||||
$PTR_ADD $tp,$BNSZ
|
||||
and $nj,$hi0
|
||||
and $aj,$hi1
|
||||
or $aj,$nj
|
||||
sltu $at,$tp,$tj
|
||||
$ST $aj,($rp)
|
||||
bnez $at,.Lcopy
|
||||
|
||||
@@ -517,7 +517,6 @@ L\$sub
|
||||
stws,ma $hi1,4($rp)
|
||||
|
||||
subb $ti0,%r0,$hi1
|
||||
ldo -4($tp),$tp
|
||||
___
|
||||
$code.=<<___ if ($BN_SZ==8);
|
||||
ldd,ma 8($tp),$ti0
|
||||
@@ -532,20 +531,18 @@ L\$sub
|
||||
|
||||
extrd,u $ti0,31,32,$ti0 ; carry in flipped word order
|
||||
sub,db $ti0,%r0,$hi1
|
||||
ldo -8($tp),$tp
|
||||
___
|
||||
$code.=<<___;
|
||||
and $tp,$hi1,$ap
|
||||
andcm $rp,$hi1,$bp
|
||||
or $ap,$bp,$np
|
||||
|
||||
ldo `$LOCALS+32`($fp),$tp
|
||||
sub $rp,$arrsz,$rp ; rewind rp
|
||||
subi 0,$arrsz,$idx
|
||||
ldo `$LOCALS+32`($fp),$tp
|
||||
L\$copy
|
||||
ldd $idx($np),$hi0
|
||||
ldd 0($tp),$ti0
|
||||
ldd 0($rp),$hi0
|
||||
std,ma %r0,8($tp)
|
||||
addib,<> 8,$idx,.-8 ; L\$copy
|
||||
comiclr,= 0,$hi1,%r0
|
||||
copy $ti0,$hi0
|
||||
addib,<> 8,$idx,L\$copy
|
||||
std,ma $hi0,8($rp)
|
||||
___
|
||||
|
||||
@@ -856,17 +853,16 @@ L\$sub_pa11
|
||||
stws,ma $hi1,4($rp)
|
||||
|
||||
subb $ti0,%r0,$hi1
|
||||
ldo -4($tp),$tp
|
||||
and $tp,$hi1,$ap
|
||||
andcm $rp,$hi1,$bp
|
||||
or $ap,$bp,$np
|
||||
|
||||
ldo `$LOCALS+32`($fp),$tp
|
||||
sub $rp,$arrsz,$rp ; rewind rp
|
||||
subi 0,$arrsz,$idx
|
||||
ldo `$LOCALS+32`($fp),$tp
|
||||
L\$copy_pa11
|
||||
ldwx $idx($np),$hi0
|
||||
ldw 0($tp),$ti0
|
||||
ldw 0($rp),$hi0
|
||||
stws,ma %r0,4($tp)
|
||||
comiclr,= 0,$hi1,%r0
|
||||
copy $ti0,$hi0
|
||||
addib,<> 4,$idx,L\$copy_pa11
|
||||
stws,ma $hi0,4($rp)
|
||||
|
||||
|
||||
@@ -314,15 +314,16 @@ Lsub: $LDX $tj,$tp,$j
|
||||
li $j,0
|
||||
mtctr $num
|
||||
subfe $ovf,$j,$ovf ; handle upmost overflow bit
|
||||
and $ap,$tp,$ovf
|
||||
andc $np,$rp,$ovf
|
||||
or $ap,$ap,$np ; ap=borrow?tp:rp
|
||||
|
||||
.align 4
|
||||
Lcopy: ; copy or in-place refresh
|
||||
$LDX $tj,$ap,$j
|
||||
$STX $tj,$rp,$j
|
||||
Lcopy: ; conditional copy
|
||||
$LDX $tj,$tp,$j
|
||||
$LDX $aj,$rp,$j
|
||||
and $tj,$tj,$ovf
|
||||
andc $aj,$aj,$ovf
|
||||
$STX $j,$tp,$j ; zap at once
|
||||
or $aj,$aj,$tj
|
||||
$STX $aj,$rp,$j
|
||||
addi $j,$j,$BNSZ
|
||||
bdnz Lcopy
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env perl
|
||||
# Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
# Copyright 2004-2018 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
|
||||
@@ -40,7 +40,7 @@
|
||||
#dsa 512 bits 0.0087s 0.0106s 114.3 94.5
|
||||
#dsa 1024 bits 0.0256s 0.0313s 39.0 32.0
|
||||
#
|
||||
# Same bechmark with this assembler code:
|
||||
# Same benchmark with this assembler code:
|
||||
#
|
||||
#rsa 512 bits 0.0056s 0.0005s 178.6 2049.2
|
||||
#rsa 1024 bits 0.0283s 0.0015s 35.3 674.1
|
||||
|
||||
+29
-12
@@ -1501,16 +1501,14 @@ Lsub: ldx $t0,$tp,$i
|
||||
|
||||
li $i,0
|
||||
subfe $ovf,$i,$ovf ; handle upmost overflow bit
|
||||
and $ap,$tp,$ovf
|
||||
andc $np,$rp,$ovf
|
||||
or $ap,$ap,$np ; ap=borrow?tp:rp
|
||||
addi $t7,$ap,8
|
||||
mtctr $j
|
||||
|
||||
.align 4
|
||||
Lcopy: ; copy or in-place refresh
|
||||
ldx $t0,$ap,$i
|
||||
ldx $t1,$t7,$i
|
||||
Lcopy: ; conditional copy
|
||||
ldx $t0,$tp,$i
|
||||
ldx $t1,$t4,$i
|
||||
ldx $t2,$rp,$i
|
||||
ldx $t3,$t6,$i
|
||||
std $i,8($nap_d) ; zap nap_d
|
||||
std $i,16($nap_d)
|
||||
std $i,24($nap_d)
|
||||
@@ -1519,6 +1517,12 @@ Lcopy: ; copy or in-place refresh
|
||||
std $i,48($nap_d)
|
||||
std $i,56($nap_d)
|
||||
stdu $i,64($nap_d)
|
||||
and $t0,$t0,$ovf
|
||||
and $t1,$t1,$ovf
|
||||
andc $t2,$t2,$ovf
|
||||
andc $t3,$t3,$ovf
|
||||
or $t0,$t0,$t2
|
||||
or $t1,$t1,$t3
|
||||
stdx $t0,$rp,$i
|
||||
stdx $t1,$t6,$i
|
||||
stdx $i,$tp,$i ; zap tp at once
|
||||
@@ -1561,20 +1565,21 @@ Lsub: lwz $t0,12($tp) ; load tp[j..j+3] in 64-bit word order
|
||||
|
||||
li $i,0
|
||||
subfe $ovf,$i,$ovf ; handle upmost overflow bit
|
||||
addi $tp,$sp,`$FRAME+$TRANSFER+4`
|
||||
addi $ap,$sp,`$FRAME+$TRANSFER+4`
|
||||
subf $rp,$num,$rp ; rewind rp
|
||||
and $ap,$tp,$ovf
|
||||
andc $np,$rp,$ovf
|
||||
or $ap,$ap,$np ; ap=borrow?tp:rp
|
||||
addi $tp,$sp,`$FRAME+$TRANSFER`
|
||||
mtctr $j
|
||||
|
||||
.align 4
|
||||
Lcopy: ; copy or in-place refresh
|
||||
Lcopy: ; conditional copy
|
||||
lwz $t0,4($ap)
|
||||
lwz $t1,8($ap)
|
||||
lwz $t2,12($ap)
|
||||
lwzu $t3,16($ap)
|
||||
lwz $t4,4($rp)
|
||||
lwz $t5,8($rp)
|
||||
lwz $t6,12($rp)
|
||||
lwz $t7,16($rp)
|
||||
std $i,8($nap_d) ; zap nap_d
|
||||
std $i,16($nap_d)
|
||||
std $i,24($nap_d)
|
||||
@@ -1583,6 +1588,18 @@ Lcopy: ; copy or in-place refresh
|
||||
std $i,48($nap_d)
|
||||
std $i,56($nap_d)
|
||||
stdu $i,64($nap_d)
|
||||
and $t0,$t0,$ovf
|
||||
and $t1,$t1,$ovf
|
||||
and $t2,$t2,$ovf
|
||||
and $t3,$t3,$ovf
|
||||
andc $t4,$t4,$ovf
|
||||
andc $t5,$t5,$ovf
|
||||
andc $t6,$t6,$ovf
|
||||
andc $t7,$t7,$ovf
|
||||
or $t0,$t0,$t4
|
||||
or $t1,$t1,$t5
|
||||
or $t2,$t2,$t6
|
||||
or $t3,$t3,$t7
|
||||
stw $t0,4($rp)
|
||||
stw $t1,8($rp)
|
||||
stw $t2,12($rp)
|
||||
|
||||
@@ -252,16 +252,16 @@ $code.=<<___;
|
||||
brct $count,.Lsub
|
||||
lghi $ahi,0
|
||||
slbgr $AHI,$ahi # handle upmost carry
|
||||
|
||||
ngr $ap,$AHI
|
||||
lghi $np,-1
|
||||
xgr $np,$AHI
|
||||
ngr $np,$rp
|
||||
ogr $ap,$np # ap=borrow?tp:rp
|
||||
lghi $NHI,-1
|
||||
xgr $NHI,$AHI
|
||||
|
||||
la $j,0(%r0)
|
||||
lgr $count,$num
|
||||
.Lcopy: lg $alo,0($j,$ap) # copy or in-place refresh
|
||||
.Lcopy: lg $ahi,$stdframe($j,$sp) # conditional copy
|
||||
lg $alo,0($j,$rp)
|
||||
ngr $ahi,$AHI
|
||||
ngr $alo,$NHI
|
||||
ogr $alo,$ahi
|
||||
_dswap $alo
|
||||
stg $j,$stdframe($j,$sp) # zap tp
|
||||
stg $alo,0($j,$rp)
|
||||
|
||||
@@ -888,19 +888,17 @@ $code.=<<___;
|
||||
sub $tp, $num, $tp
|
||||
sub $rp, $num, $rp
|
||||
|
||||
subc $ovf, %g0, $ovf ! handle upmost overflow bit
|
||||
and $tp, $ovf, $ap
|
||||
andn $rp, $ovf, $np
|
||||
or $np, $ap, $ap ! ap=borrow?tp:rp
|
||||
subccc $ovf, %g0, $ovf ! handle upmost overflow bit
|
||||
ba .Lcopy
|
||||
sub $num, 8, $cnt
|
||||
|
||||
.align 16
|
||||
.Lcopy: ! copy or in-place refresh
|
||||
ldx [$ap+0], $t2
|
||||
add $ap, 8, $ap
|
||||
.Lcopy: ! conditional copy
|
||||
ldx [$tp], $tj
|
||||
ldx [$rp+0], $t2
|
||||
stx %g0, [$tp] ! zap
|
||||
add $tp, 8, $tp
|
||||
movcs %icc, $tj, $t2
|
||||
stx $t2, [$rp+0]
|
||||
add $rp, 8, $rp
|
||||
brnz $cnt, .Lcopy
|
||||
@@ -1136,19 +1134,17 @@ $code.=<<___;
|
||||
sub $tp, $num, $tp
|
||||
sub $rp, $num, $rp
|
||||
|
||||
subc $ovf, %g0, $ovf ! handle upmost overflow bit
|
||||
and $tp, $ovf, $ap
|
||||
andn $rp, $ovf, $np
|
||||
or $np, $ap, $ap ! ap=borrow?tp:rp
|
||||
subccc $ovf, %g0, $ovf ! handle upmost overflow bit
|
||||
ba .Lcopy_g5
|
||||
sub $num, 8, $cnt
|
||||
|
||||
.align 16
|
||||
.Lcopy_g5: ! copy or in-place refresh
|
||||
ldx [$ap+0], $t2
|
||||
add $ap, 8, $ap
|
||||
.Lcopy_g5: ! conditional copy
|
||||
ldx [$tp], $tj
|
||||
ldx [$rp+0], $t2
|
||||
stx %g0, [$tp] ! zap
|
||||
add $tp, 8, $tp
|
||||
movcs %icc, $tj, $t2
|
||||
stx $t2, [$rp+0]
|
||||
add $rp, 8, $rp
|
||||
brnz $cnt, .Lcopy_g5
|
||||
|
||||
@@ -265,7 +265,6 @@ $fname:
|
||||
.Ltail:
|
||||
add $np,$num,$np
|
||||
add $rp,$num,$rp
|
||||
mov $tp,$ap
|
||||
sub %g0,$num,%o7 ! k=-num
|
||||
ba .Lsub
|
||||
subcc %g0,%g0,%g0 ! clear %icc.c
|
||||
@@ -278,15 +277,14 @@ $fname:
|
||||
add %o7,4,%o7
|
||||
brnz %o7,.Lsub
|
||||
st %o1,[$i]
|
||||
subc $car2,0,$car2 ! handle upmost overflow bit
|
||||
and $tp,$car2,$ap
|
||||
andn $rp,$car2,$np
|
||||
or $ap,$np,$ap
|
||||
subccc $car2,0,$car2 ! handle upmost overflow bit
|
||||
sub %g0,$num,%o7
|
||||
|
||||
.Lcopy:
|
||||
ld [$ap+%o7],%o0 ! copy or in-place refresh
|
||||
ld [$tp+%o7],%o1 ! conditional copy
|
||||
ld [$rp+%o7],%o0
|
||||
st %g0,[$tp+%o7] ! zap tp
|
||||
movcs %icc,%o1,%o0
|
||||
st %o0,[$rp+%o7]
|
||||
add %o7,4,%o7
|
||||
brnz %o7,.Lcopy
|
||||
|
||||
@@ -213,18 +213,15 @@ $sp=&DWP(28,"esp");
|
||||
|
||||
&mov ("eax",&DWP(0,"esi","edx",4)); # upmost overflow bit
|
||||
&sbb ("eax",0);
|
||||
&and ("esi","eax");
|
||||
¬ ("eax");
|
||||
&mov ("ebp","edi");
|
||||
&and ("ebp","eax");
|
||||
&or ("esi","ebp"); # tp=carry?tp:rp
|
||||
|
||||
&mov ("ecx","edx"); # num
|
||||
&xor ("edx","edx"); # i=0
|
||||
&mov ("edx",0); # i=0
|
||||
|
||||
&set_label("copy",8);
|
||||
&mov ("eax",&DWP(0,"esi","edx",4));
|
||||
&mov (&DWP(64,"esp","edx",4),"ecx"); # zap tp
|
||||
&mov ("ebx",&DWP(0,"esi","edx",4));
|
||||
&mov ("eax",&DWP(0,"edi","edx",4));
|
||||
&mov (&DWP(0,"esi","edx",4),"ecx"); # zap tp
|
||||
&cmovc ("eax","ebx");
|
||||
&mov (&DWP(0,"edi","edx",4),"eax");
|
||||
&lea ("edx",&DWP(1,"edx")); # i++
|
||||
&loop (&label("copy"));
|
||||
|
||||
@@ -310,23 +310,23 @@ $code.=<<___;
|
||||
sub $anp, $num, $anp
|
||||
sub $rp, $num, $rp
|
||||
|
||||
subc $ovf, %g0, $ovf ! handle upmost overflow bit
|
||||
and $tp, $ovf, $ap
|
||||
andn $rp, $ovf, $np
|
||||
or $np, $ap, $ap ! ap=borrow?tp:rp
|
||||
subccc $ovf, %g0, $ovf ! handle upmost overflow bit
|
||||
ba .Lcopy
|
||||
sub $num, 8, $cnt
|
||||
|
||||
.align 16
|
||||
.Lcopy: ! copy or in-place refresh
|
||||
ld [$ap+0], $t2
|
||||
ld [$ap+4], $t3
|
||||
add $ap, 8, $ap
|
||||
.Lcopy: ! conditional copy
|
||||
ld [$tp+0], $t0
|
||||
ld [$tp+4], $t1
|
||||
ld [$rp+0], $t2
|
||||
ld [$rp+4], $t3
|
||||
stx %g0, [$tp] ! zap
|
||||
add $tp, 8, $tp
|
||||
stx %g0, [$anp] ! zap
|
||||
stx %g0, [$anp+8]
|
||||
add $anp, 16, $anp
|
||||
movcs %icc, $t0, $t2
|
||||
movcs %icc, $t1, $t3
|
||||
st $t3, [$rp+0] ! flip order
|
||||
st $t2, [$rp+4]
|
||||
add $rp, 8, $rp
|
||||
|
||||
@@ -604,16 +604,18 @@ $sbit=$num;
|
||||
&jge (&label("sub"));
|
||||
|
||||
&sbb ("eax",0); # handle upmost overflow bit
|
||||
&and ($tp,"eax");
|
||||
¬ ("eax");
|
||||
&mov ($np,$rp);
|
||||
&and ($np,"eax");
|
||||
&or ($tp,$np); # tp=carry?tp:rp
|
||||
&mov ("edx",-1);
|
||||
&xor ("edx","eax");
|
||||
&jmp (&label("copy"));
|
||||
|
||||
&set_label("copy",16); # copy or in-place refresh
|
||||
&mov ("eax",&DWP(0,$tp,$num,4));
|
||||
&mov (&DWP(0,$rp,$num,4),"eax"); # rp[i]=tp[i]
|
||||
&set_label("copy",16); # conditional copy
|
||||
&mov ($tp,&DWP($frame,"esp",$num,4));
|
||||
&mov ($np,&DWP(0,$rp,$num,4));
|
||||
&mov (&DWP($frame,"esp",$num,4),$j); # zap temporary vector
|
||||
&and ($tp,"eax");
|
||||
&and ($np,"edx");
|
||||
&or ($np,$tp);
|
||||
&mov (&DWP(0,$rp,$num,4),$np);
|
||||
&dec ($num);
|
||||
&jge (&label("copy"));
|
||||
|
||||
|
||||
@@ -311,30 +311,30 @@ $code.=<<___;
|
||||
|
||||
xor $i,$i # i=0 and clear CF!
|
||||
mov (%rsp),%rax # tp[0]
|
||||
lea (%rsp),$ap # borrow ap for tp
|
||||
mov $num,$j # j=num
|
||||
jmp .Lsub
|
||||
|
||||
.align 16
|
||||
.Lsub: sbb ($np,$i,8),%rax
|
||||
mov %rax,($rp,$i,8) # rp[i]=tp[i]-np[i]
|
||||
mov 8($ap,$i,8),%rax # tp[i+1]
|
||||
mov 8(%rsp,$i,8),%rax # tp[i+1]
|
||||
lea 1($i),$i # i++
|
||||
dec $j # doesn't affect CF!
|
||||
jnz .Lsub
|
||||
|
||||
sbb \$0,%rax # handle upmost overflow bit
|
||||
mov \$-1,%rbx
|
||||
xor %rax,%rbx # not %rax
|
||||
xor $i,$i
|
||||
and %rax,$ap
|
||||
not %rax
|
||||
mov $rp,$np
|
||||
and %rax,$np
|
||||
mov $num,$j # j=num
|
||||
or $np,$ap # ap=borrow?tp:rp
|
||||
.align 16
|
||||
.Lcopy: # copy or in-place refresh
|
||||
mov ($ap,$i,8),%rax
|
||||
mov $i,(%rsp,$i,8) # zap temporary vector
|
||||
mov %rax,($rp,$i,8) # rp[i]=tp[i]
|
||||
|
||||
.Lcopy: # conditional copy
|
||||
mov ($rp,$i,8),%rcx
|
||||
mov (%rsp,$i,8),%rdx
|
||||
and %rbx,%rcx
|
||||
and %rax,%rdx
|
||||
mov $num,(%rsp,$i,8) # zap temporary vector
|
||||
or %rcx,%rdx
|
||||
mov %rdx,($rp,$i,8) # rp[i]=tp[i]
|
||||
lea 1($i),$i
|
||||
sub \$1,$j
|
||||
jnz .Lcopy
|
||||
@@ -724,7 +724,6 @@ $code.=<<___;
|
||||
mov 16(%rsp,$num,8),$rp # restore $rp
|
||||
lea -4($num),$j
|
||||
mov 0(%rsp),@ri[0] # tp[0]
|
||||
pxor %xmm0,%xmm0
|
||||
mov 8(%rsp),@ri[1] # tp[1]
|
||||
shr \$2,$j # j=num/4-1
|
||||
lea (%rsp),$ap # borrow ap for tp
|
||||
@@ -734,8 +733,7 @@ $code.=<<___;
|
||||
mov 16($ap),@ri[2] # tp[2]
|
||||
mov 24($ap),@ri[3] # tp[3]
|
||||
sbb 8($np),@ri[1]
|
||||
jmp .Lsub4x
|
||||
.align 16
|
||||
|
||||
.Lsub4x:
|
||||
mov @ri[0],0($rp,$i,8) # rp[i]=tp[i]-np[i]
|
||||
mov @ri[1],8($rp,$i,8) # rp[i]=tp[i]-np[i]
|
||||
@@ -762,34 +760,35 @@ $code.=<<___;
|
||||
|
||||
sbb \$0,@ri[0] # handle upmost overflow bit
|
||||
mov @ri[3],24($rp,$i,8) # rp[i]=tp[i]-np[i]
|
||||
xor $i,$i # i=0
|
||||
and @ri[0],$ap
|
||||
not @ri[0]
|
||||
mov $rp,$np
|
||||
and @ri[0],$np
|
||||
lea -4($num),$j
|
||||
or $np,$ap # ap=borrow?tp:rp
|
||||
shr \$2,$j # j=num/4-1
|
||||
pxor %xmm0,%xmm0
|
||||
movq @ri[0],%xmm4
|
||||
pcmpeqd %xmm5,%xmm5
|
||||
pshufd \$0,%xmm4,%xmm4
|
||||
mov $num,$j
|
||||
pxor %xmm4,%xmm5
|
||||
shr \$2,$j # j=num/4
|
||||
xor %eax,%eax # i=0
|
||||
|
||||
movdqu ($ap),%xmm1
|
||||
movdqa %xmm0,(%rsp)
|
||||
movdqu %xmm1,($rp)
|
||||
jmp .Lcopy4x
|
||||
.align 16
|
||||
.Lcopy4x: # copy or in-place refresh
|
||||
movdqu 16($ap,$i),%xmm2
|
||||
movdqu 32($ap,$i),%xmm1
|
||||
movdqa %xmm0,16(%rsp,$i)
|
||||
movdqu %xmm2,16($rp,$i)
|
||||
movdqa %xmm0,32(%rsp,$i)
|
||||
movdqu %xmm1,32($rp,$i)
|
||||
lea 32($i),$i
|
||||
.Lcopy4x: # conditional copy
|
||||
movdqa (%rsp,%rax),%xmm1
|
||||
movdqu ($rp,%rax),%xmm2
|
||||
pand %xmm4,%xmm1
|
||||
pand %xmm5,%xmm2
|
||||
movdqa 16(%rsp,%rax),%xmm3
|
||||
movdqa %xmm0,(%rsp,%rax)
|
||||
por %xmm2,%xmm1
|
||||
movdqu 16($rp,%rax),%xmm2
|
||||
movdqu %xmm1,($rp,%rax)
|
||||
pand %xmm4,%xmm3
|
||||
pand %xmm5,%xmm2
|
||||
movdqa %xmm0,16(%rsp,%rax)
|
||||
por %xmm2,%xmm3
|
||||
movdqu %xmm3,16($rp,%rax)
|
||||
lea 32(%rax),%rax
|
||||
dec $j
|
||||
jnz .Lcopy4x
|
||||
|
||||
movdqu 16($ap,$i),%xmm2
|
||||
movdqa %xmm0,16(%rsp,$i)
|
||||
movdqu %xmm2,16($rp,$i)
|
||||
___
|
||||
}
|
||||
$code.=<<___;
|
||||
|
||||
@@ -423,18 +423,19 @@ $code.=<<___;
|
||||
jnz .Lsub
|
||||
|
||||
sbb \$0,%rax # handle upmost overflow bit
|
||||
mov \$-1,%rbx
|
||||
xor %rax,%rbx
|
||||
xor $i,$i
|
||||
and %rax,$ap
|
||||
not %rax
|
||||
mov $rp,$np
|
||||
and %rax,$np
|
||||
mov $num,$j # j=num
|
||||
or $np,$ap # ap=borrow?tp:rp
|
||||
.align 16
|
||||
.Lcopy: # copy or in-place refresh
|
||||
mov ($ap,$i,8),%rax
|
||||
|
||||
.Lcopy: # conditional copy
|
||||
mov ($rp,$i,8),%rcx
|
||||
mov (%rsp,$i,8),%rdx
|
||||
and %rbx,%rcx
|
||||
and %rax,%rdx
|
||||
mov $i,(%rsp,$i,8) # zap temporary vector
|
||||
mov %rax,($rp,$i,8) # rp[i]=tp[i]
|
||||
or %rcx,%rdx
|
||||
mov %rdx,($rp,$i,8) # rp[i]=tp[i]
|
||||
lea 1($i),$i
|
||||
sub \$1,$j
|
||||
jnz .Lcopy
|
||||
|
||||
+50
-88
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -10,51 +10,69 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
/* r can == a or b */
|
||||
/* signed add of b to a. */
|
||||
int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
int a_neg = a->neg, ret;
|
||||
int ret, r_neg, cmp_res;
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
|
||||
/*-
|
||||
* a + b a+b
|
||||
* a + -b a-b
|
||||
* -a + b b-a
|
||||
* -a + -b -(a+b)
|
||||
*/
|
||||
if (a_neg ^ b->neg) {
|
||||
/* only one is negative */
|
||||
if (a_neg) {
|
||||
const BIGNUM *tmp;
|
||||
|
||||
tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
|
||||
/* we are now a - b */
|
||||
|
||||
if (BN_ucmp(a, b) < 0) {
|
||||
if (!BN_usub(r, b, a))
|
||||
return 0;
|
||||
r->neg = 1;
|
||||
if (a->neg == b->neg) {
|
||||
r_neg = a->neg;
|
||||
ret = BN_uadd(r, a, b);
|
||||
} else {
|
||||
cmp_res = BN_ucmp(a, b);
|
||||
if (cmp_res > 0) {
|
||||
r_neg = a->neg;
|
||||
ret = BN_usub(r, a, b);
|
||||
} else if (cmp_res < 0) {
|
||||
r_neg = b->neg;
|
||||
ret = BN_usub(r, b, a);
|
||||
} else {
|
||||
if (!BN_usub(r, a, b))
|
||||
return 0;
|
||||
r->neg = 0;
|
||||
r_neg = 0;
|
||||
BN_zero(r);
|
||||
ret = 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
ret = BN_uadd(r, a, b);
|
||||
r->neg = a_neg;
|
||||
r->neg = r_neg;
|
||||
bn_check_top(r);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* unsigned add of b to a */
|
||||
/* signed sub of b from a. */
|
||||
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
int ret, r_neg, cmp_res;
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
|
||||
if (a->neg != b->neg) {
|
||||
r_neg = a->neg;
|
||||
ret = BN_uadd(r, a, b);
|
||||
} else {
|
||||
cmp_res = BN_ucmp(a, b);
|
||||
if (cmp_res > 0) {
|
||||
r_neg = a->neg;
|
||||
ret = BN_usub(r, a, b);
|
||||
} else if (cmp_res < 0) {
|
||||
r_neg = !b->neg;
|
||||
ret = BN_usub(r, b, a);
|
||||
} else {
|
||||
r_neg = 0;
|
||||
BN_zero(r);
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
r->neg = r_neg;
|
||||
bn_check_top(r);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* unsigned add of b to a, r can be equal to a or b. */
|
||||
int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
int max, min, dif;
|
||||
@@ -151,59 +169,3 @@ int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
int max;
|
||||
int add = 0, neg = 0;
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
|
||||
/*-
|
||||
* a - b a-b
|
||||
* a - -b a+b
|
||||
* -a - b -(a+b)
|
||||
* -a - -b b-a
|
||||
*/
|
||||
if (a->neg) {
|
||||
if (b->neg) {
|
||||
const BIGNUM *tmp;
|
||||
|
||||
tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
} else {
|
||||
add = 1;
|
||||
neg = 1;
|
||||
}
|
||||
} else {
|
||||
if (b->neg) {
|
||||
add = 1;
|
||||
neg = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (add) {
|
||||
if (!BN_uadd(r, a, b))
|
||||
return 0;
|
||||
r->neg = neg;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* We are actually doing a - b :-) */
|
||||
|
||||
max = (a->top > b->top) ? a->top : b->top;
|
||||
if (bn_wexpand(r, max) == NULL)
|
||||
return 0;
|
||||
if (BN_ucmp(a, b) < 0) {
|
||||
if (!BN_usub(r, b, a))
|
||||
return 0;
|
||||
r->neg = 1;
|
||||
} else {
|
||||
if (!BN_usub(r, a, b))
|
||||
return 0;
|
||||
r->neg = 0;
|
||||
}
|
||||
bn_check_top(r);
|
||||
return 1;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1998-2018 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
|
||||
@@ -82,7 +82,6 @@ void BN_BLINDING_free(BN_BLINDING *r)
|
||||
{
|
||||
if (r == NULL)
|
||||
return;
|
||||
|
||||
BN_free(r->A);
|
||||
BN_free(r->Ai);
|
||||
BN_free(r->e);
|
||||
@@ -251,7 +250,7 @@ BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
|
||||
|
||||
do {
|
||||
int rv;
|
||||
if (!BN_rand_range(ret->A, ret->mod))
|
||||
if (!BN_priv_rand_range(ret->A, ret->mod))
|
||||
goto err;
|
||||
if (!int_bn_mod_inverse(ret->Ai, ret->A, ret->mod, ctx, &rv)) {
|
||||
/*
|
||||
|
||||
+11
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2018 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
|
||||
@@ -255,9 +255,12 @@ static int BN_STACK_push(BN_STACK *st, unsigned int idx)
|
||||
/* Need to expand */
|
||||
unsigned int newsize =
|
||||
st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
|
||||
unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize);
|
||||
if (newitems == NULL)
|
||||
unsigned int *newitems;
|
||||
|
||||
if ((newitems = OPENSSL_malloc(sizeof(*newitems) * newsize)) == NULL) {
|
||||
BNerr(BN_F_BN_STACK_PUSH, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
if (st->depth)
|
||||
memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
|
||||
OPENSSL_free(st->indexes);
|
||||
@@ -306,9 +309,12 @@ static BIGNUM *BN_POOL_get(BN_POOL *p, int flag)
|
||||
|
||||
/* Full; allocate a new pool item and link it in. */
|
||||
if (p->used == p->size) {
|
||||
BN_POOL_ITEM *item = OPENSSL_malloc(sizeof(*item));
|
||||
if (item == NULL)
|
||||
BN_POOL_ITEM *item;
|
||||
|
||||
if ((item = OPENSSL_malloc(sizeof(*item))) == NULL) {
|
||||
BNerr(BN_F_BN_POOL_GET, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
for (loop = 0, bn = item->vals; loop++ < BN_CTX_POOL_SIZE; bn++) {
|
||||
bn_init(bn);
|
||||
if ((flag & BN_FLG_SECURE) != 0)
|
||||
|
||||
+5
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -62,12 +62,16 @@ static const ERR_STRING_DATA BN_str_functs[] = {
|
||||
"BN_mod_inverse_no_branch"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_MOD_LSHIFT_QUICK, 0), "BN_mod_lshift_quick"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_MOD_SQRT, 0), "BN_mod_sqrt"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_MONT_CTX_NEW, 0), "BN_MONT_CTX_new"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_MPI2BN, 0), "BN_mpi2bn"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_NEW, 0), "BN_new"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_POOL_GET, 0), "BN_POOL_get"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_RAND, 0), "BN_rand"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_RAND_RANGE, 0), "BN_rand_range"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_RECP_CTX_NEW, 0), "BN_RECP_CTX_new"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_RSHIFT, 0), "BN_rshift"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_SET_WORDS, 0), "bn_set_words"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_STACK_PUSH, 0), "BN_STACK_push"},
|
||||
{ERR_PACK(ERR_LIB_BN, BN_F_BN_USUB, 0), "BN_usub"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
+8
-1
@@ -140,7 +140,14 @@ BIGNUM *int_bn_mod_inverse(BIGNUM *in,
|
||||
BIGNUM *ret = NULL;
|
||||
int sign;
|
||||
|
||||
if (pnoinv)
|
||||
/* This is invalid input so we don't worry about constant time here */
|
||||
if (BN_abs_is_word(n, 1) || BN_is_zero(n)) {
|
||||
if (pnoinv != NULL)
|
||||
*pnoinv = 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pnoinv != NULL)
|
||||
*pnoinv = 0;
|
||||
|
||||
if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0)
|
||||
|
||||
+59
-105
@@ -22,30 +22,32 @@
|
||||
*/
|
||||
# define MAX_ITERATIONS 50
|
||||
|
||||
static const BN_ULONG SQR_tb[16] = { 0, 1, 4, 5, 16, 17, 20, 21,
|
||||
64, 65, 68, 69, 80, 81, 84, 85
|
||||
};
|
||||
# define SQR_nibble(w) ((((w) & 8) << 3) \
|
||||
| (((w) & 4) << 2) \
|
||||
| (((w) & 2) << 1) \
|
||||
| ((w) & 1))
|
||||
|
||||
|
||||
/* Platform-specific macros to accelerate squaring. */
|
||||
# if defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)
|
||||
# define SQR1(w) \
|
||||
SQR_tb[(w) >> 60 & 0xF] << 56 | SQR_tb[(w) >> 56 & 0xF] << 48 | \
|
||||
SQR_tb[(w) >> 52 & 0xF] << 40 | SQR_tb[(w) >> 48 & 0xF] << 32 | \
|
||||
SQR_tb[(w) >> 44 & 0xF] << 24 | SQR_tb[(w) >> 40 & 0xF] << 16 | \
|
||||
SQR_tb[(w) >> 36 & 0xF] << 8 | SQR_tb[(w) >> 32 & 0xF]
|
||||
SQR_nibble((w) >> 60) << 56 | SQR_nibble((w) >> 56) << 48 | \
|
||||
SQR_nibble((w) >> 52) << 40 | SQR_nibble((w) >> 48) << 32 | \
|
||||
SQR_nibble((w) >> 44) << 24 | SQR_nibble((w) >> 40) << 16 | \
|
||||
SQR_nibble((w) >> 36) << 8 | SQR_nibble((w) >> 32)
|
||||
# define SQR0(w) \
|
||||
SQR_tb[(w) >> 28 & 0xF] << 56 | SQR_tb[(w) >> 24 & 0xF] << 48 | \
|
||||
SQR_tb[(w) >> 20 & 0xF] << 40 | SQR_tb[(w) >> 16 & 0xF] << 32 | \
|
||||
SQR_tb[(w) >> 12 & 0xF] << 24 | SQR_tb[(w) >> 8 & 0xF] << 16 | \
|
||||
SQR_tb[(w) >> 4 & 0xF] << 8 | SQR_tb[(w) & 0xF]
|
||||
SQR_nibble((w) >> 28) << 56 | SQR_nibble((w) >> 24) << 48 | \
|
||||
SQR_nibble((w) >> 20) << 40 | SQR_nibble((w) >> 16) << 32 | \
|
||||
SQR_nibble((w) >> 12) << 24 | SQR_nibble((w) >> 8) << 16 | \
|
||||
SQR_nibble((w) >> 4) << 8 | SQR_nibble((w) )
|
||||
# endif
|
||||
# ifdef THIRTY_TWO_BIT
|
||||
# define SQR1(w) \
|
||||
SQR_tb[(w) >> 28 & 0xF] << 24 | SQR_tb[(w) >> 24 & 0xF] << 16 | \
|
||||
SQR_tb[(w) >> 20 & 0xF] << 8 | SQR_tb[(w) >> 16 & 0xF]
|
||||
SQR_nibble((w) >> 28) << 24 | SQR_nibble((w) >> 24) << 16 | \
|
||||
SQR_nibble((w) >> 20) << 8 | SQR_nibble((w) >> 16)
|
||||
# define SQR0(w) \
|
||||
SQR_tb[(w) >> 12 & 0xF] << 24 | SQR_tb[(w) >> 8 & 0xF] << 16 | \
|
||||
SQR_tb[(w) >> 4 & 0xF] << 8 | SQR_tb[(w) & 0xF]
|
||||
SQR_nibble((w) >> 12) << 24 | SQR_nibble((w) >> 8) << 16 | \
|
||||
SQR_nibble((w) >> 4) << 8 | SQR_nibble((w) )
|
||||
# endif
|
||||
|
||||
# if !defined(OPENSSL_BN_ASM_GF2m)
|
||||
@@ -547,7 +549,8 @@ int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
|
||||
* Hernandez, J.L., and Menezes, A. "Software Implementation of Elliptic
|
||||
* Curve Cryptography Over Binary Fields".
|
||||
*/
|
||||
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
|
||||
static int BN_GF2m_mod_inv_vartime(BIGNUM *r, const BIGNUM *a,
|
||||
const BIGNUM *p, BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *b, *c = NULL, *u = NULL, *v = NULL, *tmp;
|
||||
int ret = 0;
|
||||
@@ -713,6 +716,46 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*-
|
||||
* Wrapper for BN_GF2m_mod_inv_vartime that blinds the input before calling.
|
||||
* This is not constant time.
|
||||
* But it does eliminate first order deduction on the input.
|
||||
*/
|
||||
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *b = NULL;
|
||||
int ret = 0;
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
if ((b = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
|
||||
/* generate blinding value */
|
||||
do {
|
||||
if (!BN_priv_rand(b, BN_num_bits(p) - 1,
|
||||
BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY))
|
||||
goto err;
|
||||
} while (BN_is_zero(b));
|
||||
|
||||
/* r := a * b */
|
||||
if (!BN_GF2m_mod_mul(r, a, b, p, ctx))
|
||||
goto err;
|
||||
|
||||
/* r := 1/(a * b) */
|
||||
if (!BN_GF2m_mod_inv_vartime(r, r, p, ctx))
|
||||
goto err;
|
||||
|
||||
/* r := b/(a * b) = 1/a */
|
||||
if (!BN_GF2m_mod_mul(r, r, b, p, ctx))
|
||||
goto err;
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Invert xx, reduce modulo p, and store the result in r. r could be xx.
|
||||
* This function calls down to the BN_GF2m_mod_inv implementation; this
|
||||
@@ -740,7 +783,6 @@ int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const int p[],
|
||||
return ret;
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_SUN_GF2M_DIV
|
||||
/*
|
||||
* Divide y by x, reduce modulo p, and store the result in r. r could be x
|
||||
* or y, x could equal y.
|
||||
@@ -771,94 +813,6 @@ int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x,
|
||||
BN_CTX_end(ctx);
|
||||
return ret;
|
||||
}
|
||||
# else
|
||||
/*
|
||||
* Divide y by x, reduce modulo p, and store the result in r. r could be x
|
||||
* or y, x could equal y. Uses algorithm Modular_Division_GF(2^m) from
|
||||
* Chang-Shantz, S. "From Euclid's GCD to Montgomery Multiplication to the
|
||||
* Great Divide".
|
||||
*/
|
||||
int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x,
|
||||
const BIGNUM *p, BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *a, *b, *u, *v;
|
||||
int ret = 0;
|
||||
|
||||
bn_check_top(y);
|
||||
bn_check_top(x);
|
||||
bn_check_top(p);
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
|
||||
a = BN_CTX_get(ctx);
|
||||
b = BN_CTX_get(ctx);
|
||||
u = BN_CTX_get(ctx);
|
||||
v = BN_CTX_get(ctx);
|
||||
if (v == NULL)
|
||||
goto err;
|
||||
|
||||
/* reduce x and y mod p */
|
||||
if (!BN_GF2m_mod(u, y, p))
|
||||
goto err;
|
||||
if (!BN_GF2m_mod(a, x, p))
|
||||
goto err;
|
||||
if (!BN_copy(b, p))
|
||||
goto err;
|
||||
|
||||
while (!BN_is_odd(a)) {
|
||||
if (!BN_rshift1(a, a))
|
||||
goto err;
|
||||
if (BN_is_odd(u))
|
||||
if (!BN_GF2m_add(u, u, p))
|
||||
goto err;
|
||||
if (!BN_rshift1(u, u))
|
||||
goto err;
|
||||
}
|
||||
|
||||
do {
|
||||
if (BN_GF2m_cmp(b, a) > 0) {
|
||||
if (!BN_GF2m_add(b, b, a))
|
||||
goto err;
|
||||
if (!BN_GF2m_add(v, v, u))
|
||||
goto err;
|
||||
do {
|
||||
if (!BN_rshift1(b, b))
|
||||
goto err;
|
||||
if (BN_is_odd(v))
|
||||
if (!BN_GF2m_add(v, v, p))
|
||||
goto err;
|
||||
if (!BN_rshift1(v, v))
|
||||
goto err;
|
||||
} while (!BN_is_odd(b));
|
||||
} else if (BN_abs_is_word(a, 1))
|
||||
break;
|
||||
else {
|
||||
if (!BN_GF2m_add(a, a, b))
|
||||
goto err;
|
||||
if (!BN_GF2m_add(u, u, v))
|
||||
goto err;
|
||||
do {
|
||||
if (!BN_rshift1(a, a))
|
||||
goto err;
|
||||
if (BN_is_odd(u))
|
||||
if (!BN_GF2m_add(u, u, p))
|
||||
goto err;
|
||||
if (!BN_rshift1(u, u))
|
||||
goto err;
|
||||
} while (!BN_is_odd(a));
|
||||
}
|
||||
} while (1);
|
||||
|
||||
if (!BN_copy(r, u))
|
||||
goto err;
|
||||
bn_check_top(r);
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
return ret;
|
||||
}
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Divide yy by xx, reduce modulo p, and store the result in r. r could be xx
|
||||
|
||||
+35
-4
@@ -300,6 +300,11 @@ BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
|
||||
return a;
|
||||
}
|
||||
|
||||
#define FLAGS_DATA(flags) ((flags) & (BN_FLG_STATIC_DATA \
|
||||
| BN_FLG_CONSTTIME \
|
||||
| BN_FLG_SECURE))
|
||||
#define FLAGS_STRUCT(flags) ((flags) & (BN_FLG_MALLOCED))
|
||||
|
||||
void BN_swap(BIGNUM *a, BIGNUM *b)
|
||||
{
|
||||
int flags_old_a, flags_old_b;
|
||||
@@ -327,10 +332,8 @@ void BN_swap(BIGNUM *a, BIGNUM *b)
|
||||
b->dmax = tmp_dmax;
|
||||
b->neg = tmp_neg;
|
||||
|
||||
a->flags =
|
||||
(flags_old_a & BN_FLG_MALLOCED) | (flags_old_b & BN_FLG_STATIC_DATA);
|
||||
b->flags =
|
||||
(flags_old_b & BN_FLG_MALLOCED) | (flags_old_a & BN_FLG_STATIC_DATA);
|
||||
a->flags = FLAGS_STRUCT(flags_old_a) | FLAGS_DATA(flags_old_b);
|
||||
b->flags = FLAGS_STRUCT(flags_old_b) | FLAGS_DATA(flags_old_a);
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
}
|
||||
@@ -739,6 +742,34 @@ void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords)
|
||||
a->top ^= t;
|
||||
b->top ^= t;
|
||||
|
||||
t = (a->neg ^ b->neg) & condition;
|
||||
a->neg ^= t;
|
||||
b->neg ^= t;
|
||||
|
||||
/*-
|
||||
* Idea behind BN_FLG_STATIC_DATA is actually to
|
||||
* indicate that data may not be written to.
|
||||
* Intention is actually to treat it as it's
|
||||
* read-only data, and some (if not most) of it does
|
||||
* reside in read-only segment. In other words
|
||||
* observation of BN_FLG_STATIC_DATA in
|
||||
* BN_consttime_swap should be treated as fatal
|
||||
* condition. It would either cause SEGV or
|
||||
* effectively cause data corruption.
|
||||
* BN_FLG_MALLOCED refers to BN structure itself,
|
||||
* and hence must be preserved. Remaining flags are
|
||||
* BN_FLG_CONSTIME and BN_FLG_SECURE. Latter must be
|
||||
* preserved, because it determines how x->d was
|
||||
* allocated and hence how to free it. This leaves
|
||||
* BN_FLG_CONSTTIME that one can do something about.
|
||||
* To summarize it's sufficient to mask and swap
|
||||
* BN_FLG_CONSTTIME alone. BN_FLG_STATIC_DATA should
|
||||
* be treated as fatal.
|
||||
*/
|
||||
t = ((a->flags ^ b->flags) & BN_FLG_CONSTTIME) & condition;
|
||||
a->flags ^= t;
|
||||
b->flags ^= t;
|
||||
|
||||
#define BN_CONSTTIME_SWAP(ind) \
|
||||
do { \
|
||||
t = (a->d[ind] ^ b->d[ind]) & condition; \
|
||||
|
||||
+17
-10
@@ -95,6 +95,8 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
|
||||
|
||||
/* clear the top words of T */
|
||||
i = max - r->top;
|
||||
if (i < 0)
|
||||
return 0;
|
||||
if (i)
|
||||
memset(&rp[r->top], 0, sizeof(*rp) * i);
|
||||
|
||||
@@ -197,8 +199,10 @@ BN_MONT_CTX *BN_MONT_CTX_new(void)
|
||||
{
|
||||
BN_MONT_CTX *ret;
|
||||
|
||||
if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
|
||||
if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) {
|
||||
BNerr(BN_F_BN_MONT_CTX_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BN_MONT_CTX_init(ret);
|
||||
ret->flags = BN_FLG_MALLOCED;
|
||||
@@ -208,9 +212,9 @@ BN_MONT_CTX *BN_MONT_CTX_new(void)
|
||||
void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
|
||||
{
|
||||
ctx->ri = 0;
|
||||
bn_init(&(ctx->RR));
|
||||
bn_init(&(ctx->N));
|
||||
bn_init(&(ctx->Ni));
|
||||
bn_init(&ctx->RR);
|
||||
bn_init(&ctx->N);
|
||||
bn_init(&ctx->Ni);
|
||||
ctx->n0[0] = ctx->n0[1] = 0;
|
||||
ctx->flags = 0;
|
||||
}
|
||||
@@ -219,10 +223,9 @@ void BN_MONT_CTX_free(BN_MONT_CTX *mont)
|
||||
{
|
||||
if (mont == NULL)
|
||||
return;
|
||||
|
||||
BN_clear_free(&(mont->RR));
|
||||
BN_clear_free(&(mont->N));
|
||||
BN_clear_free(&(mont->Ni));
|
||||
BN_clear_free(&mont->RR);
|
||||
BN_clear_free(&mont->N);
|
||||
BN_clear_free(&mont->Ni);
|
||||
if (mont->flags & BN_FLG_MALLOCED)
|
||||
OPENSSL_free(mont);
|
||||
}
|
||||
@@ -278,7 +281,9 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
|
||||
if ((buf[1] = mod->top > 1 ? mod->d[1] : 0))
|
||||
tmod.top = 2;
|
||||
|
||||
if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
|
||||
if (BN_is_one(&tmod))
|
||||
BN_zero(Ri);
|
||||
else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
|
||||
goto err;
|
||||
if (!BN_lshift(Ri, Ri, 2 * BN_BITS2))
|
||||
goto err; /* R*Ri */
|
||||
@@ -311,7 +316,9 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
|
||||
buf[1] = 0;
|
||||
tmod.top = buf[0] != 0 ? 1 : 0;
|
||||
/* Ri = R^-1 mod N */
|
||||
if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
|
||||
if (BN_is_one(&tmod))
|
||||
BN_zero(Ri);
|
||||
else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
|
||||
goto err;
|
||||
if (!BN_lshift(Ri, Ri, BN_BITS2))
|
||||
goto err; /* R*Ri */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -279,6 +279,7 @@ static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
|
||||
char is_single_word = bits <= BN_BITS2;
|
||||
|
||||
again:
|
||||
/* TODO: Not all primes are private */
|
||||
if (!BN_priv_rand(rnd, bits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ODD))
|
||||
return 0;
|
||||
/* we now have a random number 'rnd' to test. */
|
||||
@@ -363,7 +364,7 @@ int bn_probable_prime_dh(BIGNUM *rnd, int bits,
|
||||
if ((t1 = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
|
||||
if (!BN_priv_rand(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
|
||||
if (!BN_rand(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
|
||||
goto err;
|
||||
|
||||
/* we need ((rnd-rem) % add) == 0 */
|
||||
@@ -419,7 +420,7 @@ static int probable_prime_dh_safe(BIGNUM *p, int bits, const BIGNUM *padd,
|
||||
if (!BN_rshift1(qadd, padd))
|
||||
goto err;
|
||||
|
||||
if (!BN_priv_rand(q, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
|
||||
if (!BN_rand(q, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
|
||||
goto err;
|
||||
|
||||
/* we need ((rnd-rem) % add) == 0 */
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -239,7 +239,7 @@ int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
|
||||
memset(private_bytes + todo, 0, sizeof(private_bytes) - todo);
|
||||
|
||||
for (done = 0; done < num_k_bytes;) {
|
||||
if (RAND_bytes(random_bytes, sizeof(random_bytes)) != 1)
|
||||
if (RAND_priv_bytes(random_bytes, sizeof(random_bytes)) != 1)
|
||||
goto err;
|
||||
SHA512_Init(&sha);
|
||||
SHA512_Update(&sha, &done, sizeof(done));
|
||||
|
||||
+6
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -21,8 +21,10 @@ BN_RECP_CTX *BN_RECP_CTX_new(void)
|
||||
{
|
||||
BN_RECP_CTX *ret;
|
||||
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
|
||||
BNerr(BN_F_BN_RECP_CTX_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bn_init(&(ret->N));
|
||||
bn_init(&(ret->Nr));
|
||||
@@ -34,9 +36,8 @@ void BN_RECP_CTX_free(BN_RECP_CTX *recp)
|
||||
{
|
||||
if (recp == NULL)
|
||||
return;
|
||||
|
||||
BN_free(&(recp->N));
|
||||
BN_free(&(recp->Nr));
|
||||
BN_free(&recp->N);
|
||||
BN_free(&recp->Nr);
|
||||
if (recp->flags & BN_FLG_MALLOCED)
|
||||
OPENSSL_free(recp);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2000-2018 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
|
||||
@@ -179,7 +179,7 @@ BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
|
||||
if (!BN_set_word(y, i))
|
||||
goto end;
|
||||
} else {
|
||||
if (!BN_rand(y, BN_num_bits(p), 0, 0))
|
||||
if (!BN_priv_rand(y, BN_num_bits(p), 0, 0))
|
||||
goto end;
|
||||
if (BN_ucmp(y, p) >= 0) {
|
||||
if (!(p->neg ? BN_add : BN_sub) (y, y, p))
|
||||
|
||||
@@ -28,7 +28,7 @@ void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16],
|
||||
const BN_ULONG exponent[16],
|
||||
const BN_ULONG m_norm[16], const BN_ULONG RR[16],
|
||||
BN_ULONG k0);
|
||||
int rsaz_avx2_eligible();
|
||||
int rsaz_avx2_eligible(void);
|
||||
|
||||
void RSAZ_512_mod_exp(BN_ULONG result[8],
|
||||
const BN_ULONG base_norm[8], const BN_ULONG exponent[8],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -44,7 +44,6 @@ void BUF_MEM_free(BUF_MEM *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
return;
|
||||
|
||||
if (a->data != NULL) {
|
||||
if (a->flags & BUF_MEM_FLAG_SECURE)
|
||||
OPENSSL_secure_clear_free(a->data, a->max);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{- use File::Spec::Functions qw/catdir catfile/; -}
|
||||
LIBS=../libcrypto
|
||||
SOURCE[../libcrypto]=\
|
||||
cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
# PPC970/G5 9.29/+160% 4.60
|
||||
# POWER7 8.62/+61% 4.27
|
||||
# POWER8 8.70/+51% 3.96
|
||||
# POWER9 6.61/+29% 3.67
|
||||
|
||||
$flavour = shift;
|
||||
|
||||
|
||||
+5
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2010-2018 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,6 +12,7 @@
|
||||
#include <string.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/cmac.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
struct CMAC_CTX_st {
|
||||
/* Cipher context to use */
|
||||
@@ -46,9 +47,10 @@ CMAC_CTX *CMAC_CTX_new(void)
|
||||
{
|
||||
CMAC_CTX *ctx;
|
||||
|
||||
ctx = OPENSSL_malloc(sizeof(*ctx));
|
||||
if (ctx == NULL)
|
||||
if ((ctx = OPENSSL_malloc(sizeof(*ctx))) == NULL) {
|
||||
CRYPTOerr(CRYPTO_F_CMAC_CTX_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
ctx->cctx = EVP_CIPHER_CTX_new();
|
||||
if (ctx->cctx == NULL) {
|
||||
OPENSSL_free(ctx);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2008-2018 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
|
||||
@@ -168,9 +168,10 @@ int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec,
|
||||
{
|
||||
ec->cipher = cipher;
|
||||
if (key) {
|
||||
ec->key = OPENSSL_malloc(keylen);
|
||||
if (ec->key == NULL)
|
||||
if ((ec->key = OPENSSL_malloc(keylen)) == NULL) {
|
||||
CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
memcpy(ec->key, key, keylen);
|
||||
}
|
||||
ec->keylen = keylen;
|
||||
|
||||
@@ -282,6 +282,7 @@ int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey)
|
||||
CMSerr(CMS_F_CMS_RECIPIENTINFO_SET0_PKEY, CMS_R_NOT_KEY_TRANSPORT);
|
||||
return 0;
|
||||
}
|
||||
EVP_PKEY_free(ri->d.ktri->pkey);
|
||||
ri->d.ktri->pkey = pkey;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -54,6 +54,8 @@ static const ERR_STRING_DATA CMS_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_CMS, CMS_F_CMS_DIGEST_VERIFY, 0), "CMS_digest_verify"},
|
||||
{ERR_PACK(ERR_LIB_CMS, CMS_F_CMS_ENCODE_RECEIPT, 0), "cms_encode_Receipt"},
|
||||
{ERR_PACK(ERR_LIB_CMS, CMS_F_CMS_ENCRYPT, 0), "CMS_encrypt"},
|
||||
{ERR_PACK(ERR_LIB_CMS, CMS_F_CMS_ENCRYPTEDCONTENT_INIT, 0),
|
||||
"cms_EncryptedContent_init"},
|
||||
{ERR_PACK(ERR_LIB_CMS, CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO, 0),
|
||||
"cms_EncryptedContent_init_bio"},
|
||||
{ERR_PACK(ERR_LIB_CMS, CMS_F_CMS_ENCRYPTEDDATA_DECRYPT, 0),
|
||||
@@ -147,6 +149,7 @@ static const ERR_STRING_DATA CMS_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_CMS, CMS_F_CMS_STREAM, 0), "CMS_stream"},
|
||||
{ERR_PACK(ERR_LIB_CMS, CMS_F_CMS_UNCOMPRESS, 0), "CMS_uncompress"},
|
||||
{ERR_PACK(ERR_LIB_CMS, CMS_F_CMS_VERIFY, 0), "CMS_verify"},
|
||||
{ERR_PACK(ERR_LIB_CMS, CMS_F_KEK_UNWRAP_KEY, 0), "kek_unwrap_key"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2009-2018 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
|
||||
@@ -188,9 +188,10 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
|
||||
/* Invalid size */
|
||||
return 0;
|
||||
}
|
||||
tmp = OPENSSL_malloc(inlen);
|
||||
if (tmp == NULL)
|
||||
if ((tmp = OPENSSL_malloc(inlen)) == NULL) {
|
||||
CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
/* setup IV by decrypting last two blocks */
|
||||
if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
|
||||
in + inlen - 2 * blocklen, blocklen * 2)
|
||||
|
||||
@@ -631,6 +631,7 @@ int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert)
|
||||
* all.
|
||||
*/
|
||||
else if (!cert || !CMS_RecipientInfo_ktri_cert_cmp(ri, cert)) {
|
||||
EVP_PKEY_up_ref(pk);
|
||||
CMS_RecipientInfo_set0_pkey(ri, pk);
|
||||
r = CMS_RecipientInfo_decrypt(cms, ri);
|
||||
CMS_RecipientInfo_set0_pkey(ri, NULL);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -18,6 +18,7 @@ static const ERR_STRING_DATA COMP_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_COMP, COMP_F_BIO_ZLIB_NEW, 0), "bio_zlib_new"},
|
||||
{ERR_PACK(ERR_LIB_COMP, COMP_F_BIO_ZLIB_READ, 0), "bio_zlib_read"},
|
||||
{ERR_PACK(ERR_LIB_COMP, COMP_F_BIO_ZLIB_WRITE, 0), "bio_zlib_write"},
|
||||
{ERR_PACK(ERR_LIB_COMP, COMP_F_COMP_CTX_NEW, 0), "COMP_CTX_new"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1998-2018 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,14 +12,17 @@
|
||||
#include <string.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/comp.h>
|
||||
#include <openssl/err.h>
|
||||
#include "comp_lcl.h"
|
||||
|
||||
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth)
|
||||
{
|
||||
COMP_CTX *ret;
|
||||
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
|
||||
COMPerr(COMP_F_COMP_CTX_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
ret->meth = meth;
|
||||
if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
|
||||
OPENSSL_free(ret);
|
||||
@@ -47,7 +50,6 @@ void COMP_CTX_free(COMP_CTX *ctx)
|
||||
{
|
||||
if (ctx == NULL)
|
||||
return;
|
||||
|
||||
if (ctx->meth->finish != NULL)
|
||||
ctx->meth->finish(ctx);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
LIBS=../../libcrypto
|
||||
SOURCE[../../libcrypto]= \
|
||||
conf_err.c conf_lib.c conf_api.c conf_def.c conf_mod.c \
|
||||
conf_mall.c conf_sap.c
|
||||
conf_mall.c conf_sap.c conf_ssl.c
|
||||
@@ -204,12 +204,14 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section)
|
||||
v->value = (char *)sk;
|
||||
|
||||
vv = lh_CONF_VALUE_insert(conf->data, v);
|
||||
if (vv != NULL)
|
||||
if (vv != NULL || lh_CONF_VALUE_error(conf->data) > 0)
|
||||
goto err;
|
||||
return v;
|
||||
|
||||
err:
|
||||
sk_CONF_VALUE_free(sk);
|
||||
if (v != NULL)
|
||||
OPENSSL_free(v->section);
|
||||
OPENSSL_free(v);
|
||||
return NULL;
|
||||
}
|
||||
+30
-5
@@ -33,6 +33,7 @@
|
||||
*/
|
||||
#define MAX_CONF_VALUE_LENGTH 65536
|
||||
|
||||
static int is_keytype(const CONF *conf, char c, unsigned short type);
|
||||
static char *eat_ws(CONF *conf, char *p);
|
||||
static void trim_ws(CONF *conf, char *start);
|
||||
static char *eat_alpha_numeric(CONF *conf, char *p);
|
||||
@@ -84,12 +85,12 @@ static CONF_METHOD WIN32_method = {
|
||||
def_load
|
||||
};
|
||||
|
||||
CONF_METHOD *NCONF_default()
|
||||
CONF_METHOD *NCONF_default(void)
|
||||
{
|
||||
return &default_method;
|
||||
}
|
||||
|
||||
CONF_METHOD *NCONF_WIN32()
|
||||
CONF_METHOD *NCONF_WIN32(void)
|
||||
{
|
||||
return &WIN32_method;
|
||||
}
|
||||
@@ -558,7 +559,7 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
|
||||
s++;
|
||||
cp = section;
|
||||
e = np = s;
|
||||
while (IS_ALPHA_NUMERIC(conf, *e))
|
||||
while (IS_ALNUM(conf, *e))
|
||||
e++;
|
||||
if ((e[0] == ':') && (e[1] == ':')) {
|
||||
cp = np;
|
||||
@@ -567,7 +568,7 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
|
||||
*rrp = '\0';
|
||||
e += 2;
|
||||
np = e;
|
||||
while (IS_ALPHA_NUMERIC(conf, *e))
|
||||
while (IS_ALNUM(conf, *e))
|
||||
e++;
|
||||
}
|
||||
r = *e;
|
||||
@@ -732,6 +733,30 @@ static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int is_keytype(const CONF *conf, char c, unsigned short type)
|
||||
{
|
||||
const unsigned short * keytypes = (const unsigned short *) conf->meth_data;
|
||||
unsigned char key = (unsigned char)c;
|
||||
|
||||
#ifdef CHARSET_EBCDIC
|
||||
# if CHAR_BIT > 8
|
||||
if (key > 255) {
|
||||
/* key is out of range for os_toascii table */
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
/* convert key from ebcdic to ascii */
|
||||
key = os_toascii[key];
|
||||
#endif
|
||||
|
||||
if (key > 127) {
|
||||
/* key is not a seven bit ascii character */
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (keytypes[key] & type) ? 1 : 0;
|
||||
}
|
||||
|
||||
static char *eat_ws(CONF *conf, char *p)
|
||||
{
|
||||
while (IS_WS(conf, *p) && (!IS_EOF(conf, *p)))
|
||||
@@ -759,7 +784,7 @@ static char *eat_alpha_numeric(CONF *conf, char *p)
|
||||
p = scan_esc(conf, p);
|
||||
continue;
|
||||
}
|
||||
if (!IS_ALPHA_NUMERIC_PUNCT(conf, *p))
|
||||
if (!IS_ALNUM_PUNCT(conf, *p))
|
||||
return p;
|
||||
p++;
|
||||
}
|
||||
|
||||
+27
-80
@@ -9,56 +9,35 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#define CONF_NUMBER 1
|
||||
#define CONF_UPPER 2
|
||||
#define CONF_LOWER 4
|
||||
#define CONF_UNDER 256
|
||||
#define CONF_PUNCTUATION 512
|
||||
#define CONF_WS 16
|
||||
#define CONF_ESC 32
|
||||
#define CONF_QUOTE 64
|
||||
#define CONF_DQUOTE 1024
|
||||
#define CONF_COMMENT 128
|
||||
#define CONF_FCOMMENT 2048
|
||||
#define CONF_EOF 8
|
||||
#define CONF_HIGHBIT 4096
|
||||
#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
|
||||
#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
|
||||
#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \
|
||||
CONF_PUNCTUATION)
|
||||
#define CONF_NUMBER 1
|
||||
#define CONF_UPPER 2
|
||||
#define CONF_LOWER 4
|
||||
#define CONF_UNDER 256
|
||||
#define CONF_PUNCT 512
|
||||
#define CONF_WS 16
|
||||
#define CONF_ESC 32
|
||||
#define CONF_QUOTE 64
|
||||
#define CONF_DQUOTE 1024
|
||||
#define CONF_COMMENT 128
|
||||
#define CONF_FCOMMENT 2048
|
||||
#define CONF_EOF 8
|
||||
#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
|
||||
#define CONF_ALNUM (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
|
||||
#define CONF_ALNUM_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER|CONF_PUNCT)
|
||||
|
||||
#define KEYTYPES(c) ((const unsigned short *)((c)->meth_data))
|
||||
#ifndef CHARSET_EBCDIC
|
||||
# define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
|
||||
# define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
|
||||
# define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
|
||||
# define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
|
||||
# define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
|
||||
# define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS)
|
||||
# define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
|
||||
# define IS_ALPHA_NUMERIC_PUNCT(c,a) \
|
||||
(KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
|
||||
# define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
|
||||
# define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
|
||||
# define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
|
||||
|
||||
#else /* CHARSET_EBCDIC */
|
||||
#define IS_COMMENT(conf,c) is_keytype(conf, c, CONF_COMMENT)
|
||||
#define IS_FCOMMENT(conf,c) is_keytype(conf, c, CONF_FCOMMENT)
|
||||
#define IS_EOF(conf,c) is_keytype(conf, c, CONF_EOF)
|
||||
#define IS_ESC(conf,c) is_keytype(conf, c, CONF_ESC)
|
||||
#define IS_NUMBER(conf,c) is_keytype(conf, c, CONF_NUMBER)
|
||||
#define IS_WS(conf,c) is_keytype(conf, c, CONF_WS)
|
||||
#define IS_ALNUM(conf,c) is_keytype(conf, c, CONF_ALNUM)
|
||||
#define IS_ALNUM_PUNCT(conf,c) is_keytype(conf, c, CONF_ALNUM_PUNCT)
|
||||
#define IS_QUOTE(conf,c) is_keytype(conf, c, CONF_QUOTE)
|
||||
#define IS_DQUOTE(conf,c) is_keytype(conf, c, CONF_DQUOTE)
|
||||
|
||||
# define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_COMMENT)
|
||||
# define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_FCOMMENT)
|
||||
# define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_EOF)
|
||||
# define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ESC)
|
||||
# define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_NUMBER)
|
||||
# define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_WS)
|
||||
# define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ALPHA_NUMERIC)
|
||||
# define IS_ALPHA_NUMERIC_PUNCT(c,a) \
|
||||
(KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ALPHA_NUMERIC_PUNCT)
|
||||
# define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_QUOTE)
|
||||
# define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_DQUOTE)
|
||||
# define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_HIGHBIT)
|
||||
#endif /* CHARSET_EBCDIC */
|
||||
|
||||
static const unsigned short CONF_type_default[256] = {
|
||||
static const unsigned short CONF_type_default[128] = {
|
||||
0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
@@ -75,25 +54,9 @@ static const unsigned short CONF_type_default[256] = {
|
||||
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
|
||||
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
|
||||
0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
};
|
||||
|
||||
static const unsigned short CONF_type_win32[256] = {
|
||||
static const unsigned short CONF_type_win32[128] = {
|
||||
0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
@@ -110,20 +73,4 @@ static const unsigned short CONF_type_win32[256] = {
|
||||
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
|
||||
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
|
||||
0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
|
||||
};
|
||||
@@ -21,6 +21,7 @@ static const ERR_STRING_DATA CONF_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_DEF_LOAD, 0), "def_load"},
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_DEF_LOAD_BIO, 0), "def_load_bio"},
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_GET_NEXT_FILE, 0), "get_next_file"},
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_ADD, 0), "module_add"},
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_INIT, 0), "module_init"},
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_LOAD_DSO, 0), "module_load_dso"},
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_RUN, 0), "module_run"},
|
||||
@@ -35,6 +36,7 @@ static const ERR_STRING_DATA CONF_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_LOAD_FP, 0), "NCONF_load_fp"},
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_NEW, 0), "NCONF_new"},
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_PROCESS_INCLUDE, 0), "process_include"},
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_SSL_MODULE_INIT, 0), "ssl_module_init"},
|
||||
{ERR_PACK(ERR_LIB_CONF, CONF_F_STR_COPY, 0), "str_copy"},
|
||||
{0, NULL}
|
||||
};
|
||||
@@ -60,6 +62,13 @@ static const ERR_STRING_DATA CONF_str_reasons[] = {
|
||||
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_VALUE), "no value"},
|
||||
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_RECURSIVE_DIRECTORY_INCLUDE),
|
||||
"recursive directory include"},
|
||||
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_COMMAND_SECTION_EMPTY),
|
||||
"ssl command section empty"},
|
||||
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_COMMAND_SECTION_NOT_FOUND),
|
||||
"ssl command section not found"},
|
||||
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_SECTION_EMPTY), "ssl section empty"},
|
||||
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_SECTION_NOT_FOUND),
|
||||
"ssl section not found"},
|
||||
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_UNABLE_TO_CREATE_NEW_SECTION),
|
||||
"unable to create new section"},
|
||||
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_UNKNOWN_MODULE_NAME),
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright 2018 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
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
void conf_add_ssl_module(void);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2002-2018 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
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/engine.h>
|
||||
#include "conf_lcl.h"
|
||||
|
||||
/* Load all OpenSSL builtin modules */
|
||||
|
||||
@@ -26,4 +27,5 @@ void OPENSSL_load_builtin_modules(void)
|
||||
ENGINE_add_conf_module();
|
||||
#endif
|
||||
EVP_add_alg_module();
|
||||
conf_add_ssl_module();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2002-2018 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
|
||||
@@ -232,9 +232,10 @@ static CONF_MODULE *module_add(DSO *dso, const char *name,
|
||||
supported_modules = sk_CONF_MODULE_new_null();
|
||||
if (supported_modules == NULL)
|
||||
return NULL;
|
||||
tmod = OPENSSL_zalloc(sizeof(*tmod));
|
||||
if (tmod == NULL)
|
||||
if ((tmod = OPENSSL_zalloc(sizeof(*tmod))) == NULL) {
|
||||
CONFerr(CONF_F_MODULE_ADD, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tmod->dso = dso;
|
||||
tmod->name = OPENSSL_strdup(name);
|
||||
@@ -479,9 +480,11 @@ char *CONF_get1_default_config_file(void)
|
||||
char *file, *sep = "";
|
||||
int len;
|
||||
|
||||
file = getenv("OPENSSL_CONF");
|
||||
if (file)
|
||||
return OPENSSL_strdup(file);
|
||||
if (!OPENSSL_issetugid()) {
|
||||
file = getenv("OPENSSL_CONF");
|
||||
if (file)
|
||||
return OPENSSL_strdup(file);
|
||||
}
|
||||
|
||||
len = strlen(X509_get_default_cert_area());
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Copyright 2015-2018 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
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/err.h>
|
||||
#include "internal/sslconf.h"
|
||||
#include "conf_lcl.h"
|
||||
|
||||
/*
|
||||
* SSL library configuration module placeholder. We load it here but defer
|
||||
* all decisions about its contents to libssl.
|
||||
*/
|
||||
|
||||
struct ssl_conf_name_st {
|
||||
/* Name of this set of commands */
|
||||
char *name;
|
||||
/* List of commands */
|
||||
SSL_CONF_CMD *cmds;
|
||||
/* Number of commands */
|
||||
size_t cmd_count;
|
||||
};
|
||||
|
||||
struct ssl_conf_cmd_st {
|
||||
/* Command */
|
||||
char *cmd;
|
||||
/* Argument */
|
||||
char *arg;
|
||||
};
|
||||
|
||||
static struct ssl_conf_name_st *ssl_names;
|
||||
static size_t ssl_names_count;
|
||||
|
||||
static void ssl_module_free(CONF_IMODULE *md)
|
||||
{
|
||||
size_t i, j;
|
||||
if (ssl_names == NULL)
|
||||
return;
|
||||
for (i = 0; i < ssl_names_count; i++) {
|
||||
struct ssl_conf_name_st *tname = ssl_names + i;
|
||||
|
||||
OPENSSL_free(tname->name);
|
||||
for (j = 0; j < tname->cmd_count; j++) {
|
||||
OPENSSL_free(tname->cmds[j].cmd);
|
||||
OPENSSL_free(tname->cmds[j].arg);
|
||||
}
|
||||
OPENSSL_free(tname->cmds);
|
||||
}
|
||||
OPENSSL_free(ssl_names);
|
||||
ssl_names = NULL;
|
||||
ssl_names_count = 0;
|
||||
}
|
||||
|
||||
static int ssl_module_init(CONF_IMODULE *md, const CONF *cnf)
|
||||
{
|
||||
size_t i, j, cnt;
|
||||
int rv = 0;
|
||||
const char *ssl_conf_section;
|
||||
STACK_OF(CONF_VALUE) *cmd_lists;
|
||||
|
||||
ssl_conf_section = CONF_imodule_get_value(md);
|
||||
cmd_lists = NCONF_get_section(cnf, ssl_conf_section);
|
||||
if (sk_CONF_VALUE_num(cmd_lists) <= 0) {
|
||||
if (cmd_lists == NULL)
|
||||
CONFerr(CONF_F_SSL_MODULE_INIT, CONF_R_SSL_SECTION_NOT_FOUND);
|
||||
else
|
||||
CONFerr(CONF_F_SSL_MODULE_INIT, CONF_R_SSL_SECTION_EMPTY);
|
||||
ERR_add_error_data(2, "section=", ssl_conf_section);
|
||||
goto err;
|
||||
}
|
||||
cnt = sk_CONF_VALUE_num(cmd_lists);
|
||||
ssl_names = OPENSSL_zalloc(sizeof(*ssl_names) * cnt);
|
||||
ssl_names_count = cnt;
|
||||
for (i = 0; i < ssl_names_count; i++) {
|
||||
struct ssl_conf_name_st *ssl_name = ssl_names + i;
|
||||
CONF_VALUE *sect = sk_CONF_VALUE_value(cmd_lists, (int)i);
|
||||
STACK_OF(CONF_VALUE) *cmds = NCONF_get_section(cnf, sect->value);
|
||||
|
||||
if (sk_CONF_VALUE_num(cmds) <= 0) {
|
||||
if (cmds == NULL)
|
||||
CONFerr(CONF_F_SSL_MODULE_INIT,
|
||||
CONF_R_SSL_COMMAND_SECTION_NOT_FOUND);
|
||||
else
|
||||
CONFerr(CONF_F_SSL_MODULE_INIT,
|
||||
CONF_R_SSL_COMMAND_SECTION_EMPTY);
|
||||
ERR_add_error_data(4, "name=", sect->name, ", value=", sect->value);
|
||||
goto err;
|
||||
}
|
||||
ssl_name->name = OPENSSL_strdup(sect->name);
|
||||
if (ssl_name->name == NULL)
|
||||
goto err;
|
||||
cnt = sk_CONF_VALUE_num(cmds);
|
||||
ssl_name->cmds = OPENSSL_zalloc(cnt * sizeof(struct ssl_conf_cmd_st));
|
||||
if (ssl_name->cmds == NULL)
|
||||
goto err;
|
||||
ssl_name->cmd_count = cnt;
|
||||
for (j = 0; j < cnt; j++) {
|
||||
const char *name;
|
||||
CONF_VALUE *cmd_conf = sk_CONF_VALUE_value(cmds, (int)j);
|
||||
struct ssl_conf_cmd_st *cmd = ssl_name->cmds + j;
|
||||
|
||||
/* Skip any initial dot in name */
|
||||
name = strchr(cmd_conf->name, '.');
|
||||
if (name != NULL)
|
||||
name++;
|
||||
else
|
||||
name = cmd_conf->name;
|
||||
cmd->cmd = OPENSSL_strdup(name);
|
||||
cmd->arg = OPENSSL_strdup(cmd_conf->value);
|
||||
if (cmd->cmd == NULL || cmd->arg == NULL)
|
||||
goto err;
|
||||
}
|
||||
|
||||
}
|
||||
rv = 1;
|
||||
err:
|
||||
if (rv == 0)
|
||||
ssl_module_free(md);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the set of commands with index |idx| previously searched for via
|
||||
* conf_ssl_name_find. Also stores the name of the set of commands in |*name|
|
||||
* and the number of commands in the set in |*cnt|.
|
||||
*/
|
||||
const SSL_CONF_CMD *conf_ssl_get(size_t idx, const char **name, size_t *cnt)
|
||||
{
|
||||
*name = ssl_names[idx].name;
|
||||
*cnt = ssl_names[idx].cmd_count;
|
||||
return ssl_names[idx].cmds;
|
||||
}
|
||||
|
||||
/*
|
||||
* Search for the named set of commands given in |name|. On success return the
|
||||
* index for the command set in |*idx|.
|
||||
* Returns 1 on success or 0 on failure.
|
||||
*/
|
||||
int conf_ssl_name_find(const char *name, size_t *idx)
|
||||
{
|
||||
size_t i;
|
||||
const struct ssl_conf_name_st *nm;
|
||||
|
||||
if (name == NULL)
|
||||
return 0;
|
||||
for (i = 0, nm = ssl_names; i < ssl_names_count; i++, nm++) {
|
||||
if (strcmp(nm->name, name) == 0) {
|
||||
*idx = i;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a command set |cmd|, return details on the command at index |idx| which
|
||||
* must be less than the number of commands in the set (as returned by
|
||||
* conf_ssl_get). The name of the command will be returned in |*cmdstr| and the
|
||||
* argument is returned in |*arg|.
|
||||
*/
|
||||
void conf_ssl_get_cmd(const SSL_CONF_CMD *cmd, size_t idx, char **cmdstr,
|
||||
char **arg)
|
||||
{
|
||||
*cmdstr = cmd[idx].cmd;
|
||||
*arg = cmd[idx].arg;
|
||||
}
|
||||
|
||||
void conf_add_ssl_module(void)
|
||||
{
|
||||
CONF_module_add("ssl_conf", ssl_module_init, ssl_module_free);
|
||||
}
|
||||
+81
-108
@@ -6,59 +6,57 @@
|
||||
# in the file LICENSE in the source distribution or at
|
||||
# https://www.openssl.org/source/license.html
|
||||
|
||||
$NUMBER=0x01;
|
||||
$UPPER=0x02;
|
||||
$LOWER=0x04;
|
||||
$UNDER=0x100;
|
||||
$PUNCTUATION=0x200;
|
||||
$WS=0x10;
|
||||
$ESC=0x20;
|
||||
$QUOTE=0x40;
|
||||
$DQUOTE=0x400;
|
||||
$COMMENT=0x80;
|
||||
$FCOMMENT=0x800;
|
||||
$EOF=0x08;
|
||||
$HIGHBIT=0x1000;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
foreach (0 .. 255)
|
||||
{
|
||||
$v=0;
|
||||
$c=sprintf("%c",$_);
|
||||
$v|=$NUMBER if ($c =~ /[0-9]/);
|
||||
$v|=$UPPER if ($c =~ /[A-Z]/);
|
||||
$v|=$LOWER if ($c =~ /[a-z]/);
|
||||
$v|=$UNDER if ($c =~ /_/);
|
||||
$v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/);
|
||||
$v|=$WS if ($c =~ /[ \t\r\n]/);
|
||||
$v|=$ESC if ($c =~ /\\/);
|
||||
$v|=$QUOTE if ($c =~ /['`"]/); # for emacs: "`'}/)
|
||||
$v|=$COMMENT if ($c =~ /\#/);
|
||||
$v|=$EOF if ($c =~ /\0/);
|
||||
$v|=$HIGHBIT if ($c =~/[\x80-\xff]/);
|
||||
my $NUMBER = 0x0001;
|
||||
my $UPPER = 0x0002;
|
||||
my $LOWER = 0x0004;
|
||||
my $UNDER = 0x0100;
|
||||
my $PUNCTUATION = 0x0200;
|
||||
my $WS = 0x0010;
|
||||
my $ESC = 0x0020;
|
||||
my $QUOTE = 0x0040;
|
||||
my $DQUOTE = 0x0400;
|
||||
my $COMMENT = 0x0080;
|
||||
my $FCOMMENT = 0x0800;
|
||||
my $EOF = 0x0008;
|
||||
my @V_def;
|
||||
my @V_w32;
|
||||
|
||||
push(@V_def,$v);
|
||||
}
|
||||
my $v;
|
||||
my $c;
|
||||
foreach (0 .. 127) {
|
||||
$c = sprintf("%c", $_);
|
||||
$v = 0;
|
||||
$v |= $NUMBER if $c =~ /[0-9]/;
|
||||
$v |= $UPPER if $c =~ /[A-Z]/;
|
||||
$v |= $LOWER if $c =~ /[a-z]/;
|
||||
$v |= $UNDER if $c =~ /_/;
|
||||
$v |= $PUNCTUATION if $c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/;
|
||||
$v |= $WS if $c =~ /[ \t\r\n]/;
|
||||
$v |= $ESC if $c =~ /\\/;
|
||||
$v |= $QUOTE if $c =~ /['`"]/; # for emacs: "`'
|
||||
$v |= $COMMENT if $c =~ /\#/;
|
||||
$v |= $EOF if $c =~ /\0/;
|
||||
push(@V_def, $v);
|
||||
|
||||
foreach (0 .. 255)
|
||||
{
|
||||
$v=0;
|
||||
$c=sprintf("%c",$_);
|
||||
$v|=$NUMBER if ($c =~ /[0-9]/);
|
||||
$v|=$UPPER if ($c =~ /[A-Z]/);
|
||||
$v|=$LOWER if ($c =~ /[a-z]/);
|
||||
$v|=$UNDER if ($c =~ /_/);
|
||||
$v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/);
|
||||
$v|=$WS if ($c =~ /[ \t\r\n]/);
|
||||
$v|=$DQUOTE if ($c =~ /["]/); # for emacs: "}/)
|
||||
$v|=$FCOMMENT if ($c =~ /;/);
|
||||
$v|=$EOF if ($c =~ /\0/);
|
||||
$v|=$HIGHBIT if ($c =~/[\x80-\xff]/);
|
||||
|
||||
push(@V_w32,$v);
|
||||
}
|
||||
$v = 0;
|
||||
$v |= $NUMBER if $c =~ /[0-9]/;
|
||||
$v |= $UPPER if $c =~ /[A-Z]/;
|
||||
$v |= $LOWER if $c =~ /[a-z]/;
|
||||
$v |= $UNDER if $c =~ /_/;
|
||||
$v |= $PUNCTUATION if $c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/;
|
||||
$v |= $WS if $c =~ /[ \t\r\n]/;
|
||||
$v |= $DQUOTE if $c =~ /["]/; # for emacs: "
|
||||
$v |= $FCOMMENT if $c =~ /;/;
|
||||
$v |= $EOF if $c =~ /\0/;
|
||||
push(@V_w32, $v);
|
||||
}
|
||||
|
||||
# Output year depends on the year of the script.
|
||||
my $YEAR = [localtime([stat($0)]->[9])]->[5] + 1900;
|
||||
|
||||
print <<"EOF";
|
||||
/*
|
||||
* WARNING: do not edit!
|
||||
@@ -71,73 +69,48 @@ print <<"EOF";
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#define CONF_NUMBER $NUMBER
|
||||
#define CONF_UPPER $UPPER
|
||||
#define CONF_LOWER $LOWER
|
||||
#define CONF_UNDER $UNDER
|
||||
#define CONF_PUNCTUATION $PUNCTUATION
|
||||
#define CONF_WS $WS
|
||||
#define CONF_ESC $ESC
|
||||
#define CONF_QUOTE $QUOTE
|
||||
#define CONF_DQUOTE $DQUOTE
|
||||
#define CONF_COMMENT $COMMENT
|
||||
#define CONF_FCOMMENT $FCOMMENT
|
||||
#define CONF_EOF $EOF
|
||||
#define CONF_HIGHBIT $HIGHBIT
|
||||
#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
|
||||
#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
|
||||
#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \\
|
||||
CONF_PUNCTUATION)
|
||||
#define CONF_NUMBER $NUMBER
|
||||
#define CONF_UPPER $UPPER
|
||||
#define CONF_LOWER $LOWER
|
||||
#define CONF_UNDER $UNDER
|
||||
#define CONF_PUNCT $PUNCTUATION
|
||||
#define CONF_WS $WS
|
||||
#define CONF_ESC $ESC
|
||||
#define CONF_QUOTE $QUOTE
|
||||
#define CONF_DQUOTE $DQUOTE
|
||||
#define CONF_COMMENT $COMMENT
|
||||
#define CONF_FCOMMENT $FCOMMENT
|
||||
#define CONF_EOF $EOF
|
||||
#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
|
||||
#define CONF_ALNUM (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
|
||||
#define CONF_ALNUM_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER|CONF_PUNCT)
|
||||
|
||||
#define KEYTYPES(c) ((const unsigned short *)((c)->meth_data))
|
||||
#ifndef CHARSET_EBCDIC
|
||||
# define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
|
||||
# define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
|
||||
# define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
|
||||
# define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
|
||||
# define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
|
||||
# define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS)
|
||||
# define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
|
||||
# define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
|
||||
(KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
|
||||
# define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
|
||||
# define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
|
||||
# define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
|
||||
|
||||
#else /* CHARSET_EBCDIC */
|
||||
|
||||
# define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_COMMENT)
|
||||
# define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_FCOMMENT)
|
||||
# define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_EOF)
|
||||
# define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ESC)
|
||||
# define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_NUMBER)
|
||||
# define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_WS)
|
||||
# define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ALPHA_NUMERIC)
|
||||
# define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
|
||||
(KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ALPHA_NUMERIC_PUNCT)
|
||||
# define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_QUOTE)
|
||||
# define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_DQUOTE)
|
||||
# define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_HIGHBIT)
|
||||
#endif /* CHARSET_EBCDIC */
|
||||
#define IS_COMMENT(conf,c) is_keytype(conf, c, CONF_COMMENT)
|
||||
#define IS_FCOMMENT(conf,c) is_keytype(conf, c, CONF_FCOMMENT)
|
||||
#define IS_EOF(conf,c) is_keytype(conf, c, CONF_EOF)
|
||||
#define IS_ESC(conf,c) is_keytype(conf, c, CONF_ESC)
|
||||
#define IS_NUMBER(conf,c) is_keytype(conf, c, CONF_NUMBER)
|
||||
#define IS_WS(conf,c) is_keytype(conf, c, CONF_WS)
|
||||
#define IS_ALNUM(conf,c) is_keytype(conf, c, CONF_ALNUM)
|
||||
#define IS_ALNUM_PUNCT(conf,c) is_keytype(conf, c, CONF_ALNUM_PUNCT)
|
||||
#define IS_QUOTE(conf,c) is_keytype(conf, c, CONF_QUOTE)
|
||||
#define IS_DQUOTE(conf,c) is_keytype(conf, c, CONF_DQUOTE)
|
||||
|
||||
EOF
|
||||
|
||||
print "static const unsigned short CONF_type_default[256] = {";
|
||||
|
||||
for ($i=0; $i<256; $i++)
|
||||
{
|
||||
print "\n " if ($i % 8) == 0;
|
||||
printf " 0x%04X,",$V_def[$i];
|
||||
}
|
||||
my $i;
|
||||
|
||||
print "static const unsigned short CONF_type_default[128] = {";
|
||||
for ($i = 0; $i < 128; $i++) {
|
||||
print "\n " if ($i % 8) == 0;
|
||||
printf " 0x%04X,", $V_def[$i];
|
||||
}
|
||||
print "\n};\n\n";
|
||||
|
||||
print "static const unsigned short CONF_type_win32[256] = {";
|
||||
|
||||
for ($i=0; $i<256; $i++)
|
||||
{
|
||||
print "\n " if ($i % 8) == 0;
|
||||
printf " 0x%04X,",$V_w32[$i];
|
||||
}
|
||||
|
||||
print "static const unsigned short CONF_type_win32[128] = {";
|
||||
for ($i = 0; $i < 128; $i++) {
|
||||
print "\n " if ($i % 8) == 0;
|
||||
printf " 0x%04X,", $V_w32[$i];
|
||||
}
|
||||
print "\n};\n";
|
||||
+18
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -14,6 +14,7 @@
|
||||
#ifndef OPENSSL_NO_ERR
|
||||
|
||||
static const ERR_STRING_DATA CRYPTO_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_CMAC_CTX_NEW, 0), "CMAC_CTX_new"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_CRYPTO_DUP_EX_DATA, 0),
|
||||
"CRYPTO_dup_ex_data"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_CRYPTO_FREE_EX_DATA, 0),
|
||||
@@ -23,16 +24,32 @@ static const ERR_STRING_DATA CRYPTO_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_CRYPTO_MEMDUP, 0), "CRYPTO_memdup"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_CRYPTO_NEW_EX_DATA, 0),
|
||||
"CRYPTO_new_ex_data"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_CRYPTO_OCB128_COPY_CTX, 0),
|
||||
"CRYPTO_ocb128_copy_ctx"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_CRYPTO_OCB128_INIT, 0),
|
||||
"CRYPTO_ocb128_init"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_CRYPTO_SET_EX_DATA, 0),
|
||||
"CRYPTO_set_ex_data"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_FIPS_MODE_SET, 0), "FIPS_mode_set"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_GET_AND_LOCK, 0), "get_and_lock"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OPENSSL_ATEXIT, 0), "OPENSSL_atexit"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OPENSSL_BUF2HEXSTR, 0),
|
||||
"OPENSSL_buf2hexstr"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OPENSSL_FOPEN, 0), "openssl_fopen"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OPENSSL_HEXSTR2BUF, 0),
|
||||
"OPENSSL_hexstr2buf"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OPENSSL_INIT_CRYPTO, 0),
|
||||
"OPENSSL_init_crypto"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OPENSSL_LH_NEW, 0), "OPENSSL_LH_new"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OPENSSL_SK_DEEP_COPY, 0),
|
||||
"OPENSSL_sk_deep_copy"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OPENSSL_SK_DUP, 0), "OPENSSL_sk_dup"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_PKEY_HMAC_INIT, 0), "pkey_hmac_init"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_PKEY_POLY1305_INIT, 0),
|
||||
"pkey_poly1305_init"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_PKEY_SIPHASH_INIT, 0),
|
||||
"pkey_siphash_init"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_SK_RESERVE, 0), "sk_reserve"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
||||
+38
-7
@@ -120,6 +120,14 @@ void OPENSSL_cpuid_setup(void)
|
||||
# endif
|
||||
|
||||
# if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
|
||||
# ifdef OPENSSL_SYS_WIN_CORE
|
||||
|
||||
int OPENSSL_isservice(void)
|
||||
{
|
||||
/* OneCore API cannot interact with GUI */
|
||||
return 1;
|
||||
}
|
||||
# else
|
||||
int OPENSSL_isservice(void)
|
||||
{
|
||||
HWINSTA h;
|
||||
@@ -160,7 +168,7 @@ int OPENSSL_isservice(void)
|
||||
|
||||
len++, len &= ~1; /* paranoia */
|
||||
name[len / sizeof(WCHAR)] = L'\0'; /* paranoia */
|
||||
# if 1
|
||||
# if 1
|
||||
/*
|
||||
* This doesn't cover "interactive" services [working with real
|
||||
* WinSta0's] nor programs started non-interactively by Task Scheduler
|
||||
@@ -168,14 +176,15 @@ int OPENSSL_isservice(void)
|
||||
*/
|
||||
if (wcsstr(name, L"Service-0x"))
|
||||
return 1;
|
||||
# else
|
||||
# else
|
||||
/* This covers all non-interactive programs such as services. */
|
||||
if (!wcsstr(name, L"WinSta0"))
|
||||
return 1;
|
||||
# endif
|
||||
# endif
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
# else
|
||||
int OPENSSL_isservice(void)
|
||||
{
|
||||
@@ -272,6 +281,24 @@ void OPENSSL_showfatal(const char *fmta, ...)
|
||||
va_end(ap);
|
||||
|
||||
# if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
|
||||
# ifdef OPENSSL_SYS_WIN_CORE
|
||||
/* ONECORE is always NONGUI and NT >= 0x0601 */
|
||||
|
||||
/*
|
||||
* TODO: (For non GUI and no std error cases)
|
||||
* Add event logging feature here.
|
||||
*/
|
||||
|
||||
# if !defined(NDEBUG)
|
||||
/*
|
||||
* We are in a situation where we tried to report a critical
|
||||
* error and this failed for some reason. As a last resort,
|
||||
* in debug builds, send output to the debugger or any other
|
||||
* tool like DebugView which can monitor the output.
|
||||
*/
|
||||
OutputDebugString(buf);
|
||||
# endif
|
||||
# else
|
||||
/* this -------------v--- guards NT-specific calls */
|
||||
if (check_winnt() && OPENSSL_isservice() > 0) {
|
||||
HANDLE hEventLog = RegisterEventSource(NULL, _T("OpenSSL"));
|
||||
@@ -281,7 +308,7 @@ void OPENSSL_showfatal(const char *fmta, ...)
|
||||
|
||||
if (!ReportEvent(hEventLog, EVENTLOG_ERROR_TYPE, 0, 0, NULL,
|
||||
1, 0, &pmsg, NULL)) {
|
||||
#if defined(DEBUG)
|
||||
# if !defined(NDEBUG)
|
||||
/*
|
||||
* We are in a situation where we tried to report a critical
|
||||
* error and this failed for some reason. As a last resort,
|
||||
@@ -289,14 +316,18 @@ void OPENSSL_showfatal(const char *fmta, ...)
|
||||
* tool like DebugView which can monitor the output.
|
||||
*/
|
||||
OutputDebugString(pmsg);
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
(void)DeregisterEventSource(hEventLog);
|
||||
}
|
||||
} else
|
||||
# endif
|
||||
} else {
|
||||
MessageBox(NULL, buf, _T("OpenSSL: FATAL"), MB_OK | MB_ICONERROR);
|
||||
}
|
||||
# endif
|
||||
# else
|
||||
MessageBox(NULL, buf, _T("OpenSSL: FATAL"), MB_OK | MB_ICONERROR);
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
void OPENSSL_showfatal(const char *fmta, ...)
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new();
|
||||
*/
|
||||
static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx);
|
||||
|
||||
static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new()
|
||||
static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new(void)
|
||||
{
|
||||
CTLOG_STORE_LOAD_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1998-2018 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
|
||||
@@ -13,7 +13,7 @@
|
||||
int DES_random_key(DES_cblock *ret)
|
||||
{
|
||||
do {
|
||||
if (RAND_bytes((unsigned char *)ret, sizeof(DES_cblock)) != 1)
|
||||
if (RAND_priv_bytes((unsigned char *)ret, sizeof(DES_cblock)) != 1)
|
||||
return 0;
|
||||
} while (DES_is_weak_key(ret));
|
||||
DES_set_odd_parity(ret);
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -41,6 +41,7 @@ static const ERR_STRING_DATA DH_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_DH, DH_F_GENERATE_KEY, 0), "generate_key"},
|
||||
{ERR_PACK(ERR_LIB_DH, DH_F_PKEY_DH_CTRL_STR, 0), "pkey_dh_ctrl_str"},
|
||||
{ERR_PACK(ERR_LIB_DH, DH_F_PKEY_DH_DERIVE, 0), "pkey_dh_derive"},
|
||||
{ERR_PACK(ERR_LIB_DH, DH_F_PKEY_DH_INIT, 0), "pkey_dh_init"},
|
||||
{ERR_PACK(ERR_LIB_DH, DH_F_PKEY_DH_KEYGEN, 0), "pkey_dh_keygen"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
@@ -243,6 +243,31 @@ int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key)
|
||||
return 1;
|
||||
}
|
||||
|
||||
const BIGNUM *DH_get0_p(const DH *dh)
|
||||
{
|
||||
return dh->p;
|
||||
}
|
||||
|
||||
const BIGNUM *DH_get0_q(const DH *dh)
|
||||
{
|
||||
return dh->q;
|
||||
}
|
||||
|
||||
const BIGNUM *DH_get0_g(const DH *dh)
|
||||
{
|
||||
return dh->g;
|
||||
}
|
||||
|
||||
const BIGNUM *DH_get0_priv_key(const DH *dh)
|
||||
{
|
||||
return dh->priv_key;
|
||||
}
|
||||
|
||||
const BIGNUM *DH_get0_pub_key(const DH *dh)
|
||||
{
|
||||
return dh->pub_key;
|
||||
}
|
||||
|
||||
void DH_clear_flags(DH *dh, int flags)
|
||||
{
|
||||
dh->flags &= ~flags;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2018 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
|
||||
@@ -75,7 +75,7 @@ int DH_meth_set1_name(DH_METHOD *dhm, const char *name)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int DH_meth_get_flags(DH_METHOD *dhm)
|
||||
int DH_meth_get_flags(const DH_METHOD *dhm)
|
||||
{
|
||||
return dhm->flags;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2018 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
|
||||
@@ -50,9 +50,10 @@ static int pkey_dh_init(EVP_PKEY_CTX *ctx)
|
||||
{
|
||||
DH_PKEY_CTX *dctx;
|
||||
|
||||
dctx = OPENSSL_zalloc(sizeof(*dctx));
|
||||
if (dctx == NULL)
|
||||
if ((dctx = OPENSSL_zalloc(sizeof(*dctx))) == NULL) {
|
||||
DHerr(DH_F_PKEY_DH_INIT, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
dctx->prime_len = 1024;
|
||||
dctx->subprime_len = -1;
|
||||
dctx->generator = 2;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -38,6 +38,7 @@ static const ERR_STRING_DATA DSA_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_DSA, DSA_F_OLD_DSA_PRIV_DECODE, 0),
|
||||
"old_dsa_priv_decode"},
|
||||
{ERR_PACK(ERR_LIB_DSA, DSA_F_PKEY_DSA_CTRL, 0), "pkey_dsa_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_DSA, DSA_F_PKEY_DSA_CTRL_STR, 0), "pkey_dsa_ctrl_str"},
|
||||
{ERR_PACK(ERR_LIB_DSA, DSA_F_PKEY_DSA_KEYGEN, 0), "pkey_dsa_keygen"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
+11
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 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
|
||||
@@ -64,9 +64,16 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
|
||||
/* invalid q size */
|
||||
return 0;
|
||||
|
||||
if (evpmd == NULL)
|
||||
/* use SHA1 as default */
|
||||
evpmd = EVP_sha1();
|
||||
if (evpmd == NULL) {
|
||||
if (qsize == SHA_DIGEST_LENGTH)
|
||||
evpmd = EVP_sha1();
|
||||
else if (qsize == SHA224_DIGEST_LENGTH)
|
||||
evpmd = EVP_sha224();
|
||||
else
|
||||
evpmd = EVP_sha256();
|
||||
} else {
|
||||
qsize = EVP_MD_size(evpmd);
|
||||
}
|
||||
|
||||
if (bits < 512)
|
||||
bits = 512;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2018 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
|
||||
@@ -83,7 +83,7 @@ int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int DSA_meth_get_flags(DSA_METHOD *dsam)
|
||||
int DSA_meth_get_flags(const DSA_METHOD *dsam)
|
||||
{
|
||||
return dsam->flags;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2018 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
|
||||
@@ -189,9 +189,15 @@ static int pkey_dsa_ctrl_str(EVP_PKEY_CTX *ctx,
|
||||
NULL);
|
||||
}
|
||||
if (strcmp(type, "dsa_paramgen_md") == 0) {
|
||||
const EVP_MD *md = EVP_get_digestbyname(value);
|
||||
|
||||
if (md == NULL) {
|
||||
DSAerr(DSA_F_PKEY_DSA_CTRL_STR, DSA_R_INVALID_DIGEST_TYPE);
|
||||
return 0;
|
||||
}
|
||||
return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN,
|
||||
EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0,
|
||||
(void *)EVP_get_digestbyname(value));
|
||||
(void *)md);
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user