mirror of
https://github.com/apple/swift-crypto
synced 2026-11-26 04:47:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75ec60b8b4 | ||
|
|
d330d21edf | ||
|
|
9cc89f0170 |
No files matched your search
+1
-1
@@ -20,7 +20,7 @@
|
|||||||
// Sources/CCryptoBoringSSL directory. The source repository is at
|
// Sources/CCryptoBoringSSL directory. The source repository is at
|
||||||
// https://boringssl.googlesource.com/boringssl.
|
// https://boringssl.googlesource.com/boringssl.
|
||||||
//
|
//
|
||||||
// BoringSSL Commit: 0faffc7a30eeb195248ea43056f4848e2a9b1c6d
|
// BoringSSL Commit: 45b8d7bbd771cbf7e116db2ba1f1cc7af959497e
|
||||||
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -23,7 +23,6 @@ add_library(CCryptoBoringSSL STATIC
|
|||||||
"crypto/asn1/a_mbstr.c"
|
"crypto/asn1/a_mbstr.c"
|
||||||
"crypto/asn1/a_object.c"
|
"crypto/asn1/a_object.c"
|
||||||
"crypto/asn1/a_octet.c"
|
"crypto/asn1/a_octet.c"
|
||||||
"crypto/asn1/a_print.c"
|
|
||||||
"crypto/asn1/a_strex.c"
|
"crypto/asn1/a_strex.c"
|
||||||
"crypto/asn1/a_strnid.c"
|
"crypto/asn1/a_strnid.c"
|
||||||
"crypto/asn1/a_time.c"
|
"crypto/asn1/a_time.c"
|
||||||
@@ -364,6 +363,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm
|
|||||||
crypto/chacha/chacha-armv8.ios.aarch64.S
|
crypto/chacha/chacha-armv8.ios.aarch64.S
|
||||||
crypto/cipher_extra/chacha20_poly1305_armv8.ios.aarch64.S
|
crypto/cipher_extra/chacha20_poly1305_armv8.ios.aarch64.S
|
||||||
crypto/fipsmodule/aesv8-armx64.ios.aarch64.S
|
crypto/fipsmodule/aesv8-armx64.ios.aarch64.S
|
||||||
|
crypto/fipsmodule/aesv8-gcm-armv8.ios.aarch64.S
|
||||||
crypto/fipsmodule/armv8-mont.ios.aarch64.S
|
crypto/fipsmodule/armv8-mont.ios.aarch64.S
|
||||||
crypto/fipsmodule/ghash-neon-armv8.ios.aarch64.S
|
crypto/fipsmodule/ghash-neon-armv8.ios.aarch64.S
|
||||||
crypto/fipsmodule/ghashv8-armx64.ios.aarch64.S
|
crypto/fipsmodule/ghashv8-armx64.ios.aarch64.S
|
||||||
@@ -378,6 +378,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|Android" AND CMAKE_SYSTEM_PROCESSOR MATC
|
|||||||
crypto/chacha/chacha-armv8.linux.aarch64.S
|
crypto/chacha/chacha-armv8.linux.aarch64.S
|
||||||
crypto/cipher_extra/chacha20_poly1305_armv8.linux.aarch64.S
|
crypto/cipher_extra/chacha20_poly1305_armv8.linux.aarch64.S
|
||||||
crypto/fipsmodule/aesv8-armx64.linux.aarch64.S
|
crypto/fipsmodule/aesv8-armx64.linux.aarch64.S
|
||||||
|
crypto/fipsmodule/aesv8-gcm-armv8.linux.aarch64.S
|
||||||
crypto/fipsmodule/armv8-mont.linux.aarch64.S
|
crypto/fipsmodule/armv8-mont.linux.aarch64.S
|
||||||
crypto/fipsmodule/ghash-neon-armv8.linux.aarch64.S
|
crypto/fipsmodule/ghash-neon-armv8.linux.aarch64.S
|
||||||
crypto/fipsmodule/ghashv8-armx64.linux.aarch64.S
|
crypto/fipsmodule/ghashv8-armx64.linux.aarch64.S
|
||||||
|
|||||||
@@ -66,7 +66,8 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
|
||||||
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, const unsigned char *d, int len) {
|
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, const unsigned char *d,
|
||||||
|
ossl_ssize_t len) {
|
||||||
return ASN1_STRING_set(x, d, len);
|
return ASN1_STRING_set(x, d, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,22 +81,20 @@ int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) {
|
int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) {
|
||||||
ASN1_GENERALIZEDTIME t;
|
size_t len = strlen(str);
|
||||||
|
CBS cbs;
|
||||||
t.type = V_ASN1_GENERALIZEDTIME;
|
CBS_init(&cbs, (const uint8_t *)str, len);
|
||||||
t.length = strlen(str);
|
if (!CBS_parse_generalized_time(&cbs, /*out_tm=*/NULL,
|
||||||
t.data = (unsigned char *)str;
|
/*allow_timezone_offset=*/0)) {
|
||||||
if (ASN1_GENERALIZEDTIME_check(&t)) {
|
|
||||||
if (s != NULL) {
|
|
||||||
if (!ASN1_STRING_set((ASN1_STRING *)s, (unsigned char *)str, t.length)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
s->type = V_ASN1_GENERALIZEDTIME;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (s != NULL) {
|
||||||
|
if (!ASN1_STRING_set(s, str, len)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
s->type = V_ASN1_GENERALIZEDTIME;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
|
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
|
||||||
|
|||||||
@@ -107,8 +107,12 @@ int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int write_str(BIO *bp, const char *str) {
|
static int write_str(BIO *bp, const char *str) {
|
||||||
int len = strlen(str);
|
size_t len = strlen(str);
|
||||||
return BIO_write(bp, str, len) == len ? len : -1;
|
if (len > INT_MAX) {
|
||||||
|
OPENSSL_PUT_ERROR(ASN1, ERR_R_OVERFLOW);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return BIO_write(bp, str, (int)len) == (int)len ? (int)len : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a) {
|
int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a) {
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This package is an SSL implementation written
|
|
||||||
* by Eric Young (eay@cryptsoft.com).
|
|
||||||
* The implementation was written so as to conform with Netscapes SSL.
|
|
||||||
*
|
|
||||||
* This library is free for commercial and non-commercial use as long as
|
|
||||||
* the following conditions are aheared to. The following conditions
|
|
||||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
|
||||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
|
||||||
* included with this distribution is covered by the same copyright terms
|
|
||||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
|
||||||
*
|
|
||||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
|
||||||
* the code are not to be removed.
|
|
||||||
* If this package is used in a product, Eric Young should be given attribution
|
|
||||||
* as the author of the parts of the library used.
|
|
||||||
* This can be in the form of a textual message at program startup or
|
|
||||||
* in documentation (online or textual) provided with the package.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* "This product includes cryptographic software written by
|
|
||||||
* Eric Young (eay@cryptsoft.com)"
|
|
||||||
* The word 'cryptographic' can be left out if the rouines from the library
|
|
||||||
* being used are not cryptographic related :-).
|
|
||||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
|
||||||
* the apps directory (application code) you must include an acknowledgement:
|
|
||||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* The licence and distribution terms for any publically available version or
|
|
||||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
|
||||||
* copied and put under another distribution licence
|
|
||||||
* [including the GNU Public Licence.] */
|
|
||||||
|
|
||||||
#include <CCryptoBoringSSL_asn1.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
int ASN1_PRINTABLE_type(const unsigned char *s, int len) {
|
|
||||||
if (len < 0) {
|
|
||||||
len = strlen((const char *)s);
|
|
||||||
}
|
|
||||||
|
|
||||||
int printable = 1;
|
|
||||||
for (int i = 0; i < len; i++) {
|
|
||||||
unsigned char c = s[i];
|
|
||||||
if (c & 0x80) {
|
|
||||||
// No need to continue iterating.
|
|
||||||
return V_ASN1_T61STRING;
|
|
||||||
}
|
|
||||||
if (!asn1_is_printable(c)) {
|
|
||||||
printable = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return printable ? V_ASN1_PRINTABLESTRING : V_ASN1_IA5STRING;
|
|
||||||
}
|
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@@ -121,7 +122,8 @@ static int do_esc_char(uint32_t c, unsigned long flags, char *do_quotes,
|
|||||||
return maybe_write(out, &u8, 1) ? 1 : -1;
|
return maybe_write(out, &u8, 1) ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = strlen(buf);
|
static_assert(sizeof(buf) < INT_MAX, "len may not fit in int");
|
||||||
|
int len = (int)strlen(buf);
|
||||||
return maybe_write(out, buf, len) ? len : -1;
|
return maybe_write(out, buf, len) ? len : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
* [including the GNU Public Licence.] */
|
* [including the GNU Public Licence.] */
|
||||||
|
|
||||||
#include <CCryptoBoringSSL_asn1.h>
|
#include <CCryptoBoringSSL_asn1.h>
|
||||||
|
#include <CCryptoBoringSSL_time.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -163,28 +164,9 @@ err:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ASN1_TIME_set_string(ASN1_TIME *s, const char *str) {
|
int ASN1_TIME_set_string(ASN1_TIME *s, const char *str) {
|
||||||
ASN1_TIME t;
|
return ASN1_UTCTIME_set_string(s, str) ||
|
||||||
|
ASN1_GENERALIZEDTIME_set_string(s, str);
|
||||||
t.length = strlen(str);
|
|
||||||
t.data = (unsigned char *)str;
|
|
||||||
t.flags = 0;
|
|
||||||
|
|
||||||
t.type = V_ASN1_UTCTIME;
|
|
||||||
|
|
||||||
if (!ASN1_TIME_check(&t)) {
|
|
||||||
t.type = V_ASN1_GENERALIZEDTIME;
|
|
||||||
if (!ASN1_TIME_check(&t)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s && !ASN1_STRING_copy((ASN1_STRING *)s, (ASN1_STRING *)&t)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *t,
|
static int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *t,
|
||||||
|
|||||||
@@ -82,22 +82,20 @@ int ASN1_UTCTIME_check(const ASN1_UTCTIME *d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str) {
|
int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str) {
|
||||||
ASN1_UTCTIME t;
|
size_t len = strlen(str);
|
||||||
|
CBS cbs;
|
||||||
t.type = V_ASN1_UTCTIME;
|
CBS_init(&cbs, (const uint8_t *)str, len);
|
||||||
t.length = strlen(str);
|
if (!CBS_parse_utc_time(&cbs, /*out_tm=*/NULL,
|
||||||
t.data = (unsigned char *)str;
|
/*allow_timezone_offset=*/1)) {
|
||||||
if (ASN1_UTCTIME_check(&t)) {
|
|
||||||
if (s != NULL) {
|
|
||||||
if (!ASN1_STRING_set((ASN1_STRING *)s, (unsigned char *)str, t.length)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
s->type = V_ASN1_UTCTIME;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (s != NULL) {
|
||||||
|
if (!ASN1_STRING_set(s, str, len)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
s->type = V_ASN1_UTCTIME;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) {
|
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) {
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ int ASN1_get_object(const unsigned char **inp, long *out_len, int *out_tag,
|
|||||||
// signature fields (see b/18228011). Make this only apply to that field,
|
// signature fields (see b/18228011). Make this only apply to that field,
|
||||||
// while requiring DER elsewhere. Better yet, it should be limited to an
|
// while requiring DER elsewhere. Better yet, it should be limited to an
|
||||||
// preprocessing step in that part of Android.
|
// preprocessing step in that part of Android.
|
||||||
unsigned tag;
|
CBS_ASN1_TAG tag;
|
||||||
size_t header_len;
|
size_t header_len;
|
||||||
int indefinite;
|
int indefinite;
|
||||||
CBS cbs, body;
|
CBS cbs, body;
|
||||||
@@ -271,19 +271,27 @@ ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) {
|
int ASN1_STRING_set(ASN1_STRING *str, const void *_data, ossl_ssize_t len_s) {
|
||||||
unsigned char *c;
|
|
||||||
const char *data = _data;
|
const char *data = _data;
|
||||||
|
size_t len;
|
||||||
if (len < 0) {
|
if (len_s < 0) {
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
len = strlen(data);
|
|
||||||
}
|
}
|
||||||
|
len = strlen(data);
|
||||||
|
} else {
|
||||||
|
len = (size_t)len_s;
|
||||||
}
|
}
|
||||||
if ((str->length <= len) || (str->data == NULL)) {
|
|
||||||
c = str->data;
|
// |ASN1_STRING| cannot represent strings that exceed |int|, and we must
|
||||||
|
// reserve space for a trailing NUL below.
|
||||||
|
if (len > INT_MAX || len + 1 < len) {
|
||||||
|
OPENSSL_PUT_ERROR(ASN1, ERR_R_OVERFLOW);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str->length <= (int)len || str->data == NULL) {
|
||||||
|
unsigned char *c = str->data;
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
str->data = OPENSSL_malloc(len + 1);
|
str->data = OPENSSL_malloc(len + 1);
|
||||||
} else {
|
} else {
|
||||||
@@ -296,10 +304,13 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
str->length = len;
|
str->length = (int)len;
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
OPENSSL_memcpy(str->data, data, len);
|
OPENSSL_memcpy(str->data, data, len);
|
||||||
// an allowance for strings :-)
|
// Historically, OpenSSL would NUL-terminate most (but not all)
|
||||||
|
// |ASN1_STRING|s, in case anyone accidentally passed |str->data| into a
|
||||||
|
// function expecting a C string. We retain this behavior for compatibility,
|
||||||
|
// but code must not rely on this. See CVE-2021-3712.
|
||||||
str->data[len] = '\0';
|
str->data[len] = '\0';
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -71,16 +71,6 @@ extern "C" {
|
|||||||
|
|
||||||
// Wrapper functions for time functions.
|
// Wrapper functions for time functions.
|
||||||
|
|
||||||
// OPENSSL_posix_to_tm converts a int64_t POSIX time value in |time| whuch must
|
|
||||||
// be in the range of year 0000 to 9999 to a broken out time value in |tm|. It
|
|
||||||
// returns one on success and zero on error.
|
|
||||||
OPENSSL_EXPORT int OPENSSL_posix_to_tm(int64_t time, struct tm *out_tm);
|
|
||||||
|
|
||||||
// OPENSSL_tm_to_posix converts a time value between the years 0 and 9999 in
|
|
||||||
// |tm| to a POSIX time value in |out|. One is returned on success, zero is
|
|
||||||
// returned on failure. It is a failure if the tm contains out of range values.
|
|
||||||
OPENSSL_EXPORT int OPENSSL_tm_to_posix(const struct tm *tm, int64_t *out);
|
|
||||||
|
|
||||||
// OPENSSL_gmtime converts a time_t value in |time| which must be in the range
|
// OPENSSL_gmtime converts a time_t value in |time| which must be in the range
|
||||||
// of year 0000 to 9999 to a broken out time value in |tm|. On success |tm| is
|
// of year 0000 to 9999 to a broken out time value in |tm|. On success |tm| is
|
||||||
// returned. On failure NULL is returned.
|
// returned. On failure NULL is returned.
|
||||||
@@ -137,8 +127,7 @@ ASN1_OBJECT *ASN1_OBJECT_new(void);
|
|||||||
// problems with invalid encodings which can break signatures.
|
// problems with invalid encodings which can break signatures.
|
||||||
typedef struct ASN1_ENCODING_st {
|
typedef struct ASN1_ENCODING_st {
|
||||||
unsigned char *enc; // DER encoding
|
unsigned char *enc; // DER encoding
|
||||||
long len; // Length of encoding
|
long len; // Length of encoding, or zero if not present.
|
||||||
int modified; // set to 1 if 'enc' is invalid
|
|
||||||
// alias_only is zero if |enc| owns the buffer that it points to
|
// alias_only is zero if |enc| owns the buffer that it points to
|
||||||
// (although |enc| may still be NULL). If one, |enc| points into a
|
// (although |enc| may still be NULL). If one, |enc| points into a
|
||||||
// buffer that is owned elsewhere.
|
// buffer that is owned elsewhere.
|
||||||
@@ -208,6 +197,9 @@ int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval,
|
|||||||
int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
|
int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
|
||||||
const ASN1_ITEM *it);
|
const ASN1_ITEM *it);
|
||||||
|
|
||||||
|
// asn1_encoding_clear clears the cached encoding in |enc|.
|
||||||
|
void asn1_encoding_clear(ASN1_ENCODING *enc);
|
||||||
|
|
||||||
// asn1_type_value_as_pointer returns |a|'s value in pointer form. This is
|
// asn1_type_value_as_pointer returns |a|'s value in pointer form. This is
|
||||||
// usually the value object but, for BOOLEAN values, is 0 or 0xff cast to
|
// usually the value object but, for BOOLEAN values, is 0 or 0xff cast to
|
||||||
// a pointer.
|
// a pointer.
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
// Time conversion to/from POSIX time_t and struct tm, with no support
|
// Time conversion to/from POSIX time_t and struct tm, with no support
|
||||||
// for time zones other than UTC
|
// for time zones other than UTC
|
||||||
|
|
||||||
|
#include <CCryptoBoringSSL_time.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
|||||||
if (i == (it->tcount - 1)) {
|
if (i == (it->tcount - 1)) {
|
||||||
isopt = 0;
|
isopt = 0;
|
||||||
} else {
|
} else {
|
||||||
isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL);
|
isopt = (seqtt->flags & ASN1_TFLG_OPTIONAL) != 0;
|
||||||
}
|
}
|
||||||
// attempt to read in field, allowing each to be OPTIONAL
|
// attempt to read in field, allowing each to be OPTIONAL
|
||||||
|
|
||||||
@@ -459,14 +459,14 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
|||||||
static int asn1_template_ex_d2i(ASN1_VALUE **val, 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,
|
long inlen, const ASN1_TEMPLATE *tt, char opt,
|
||||||
int depth) {
|
int depth) {
|
||||||
int flags, aclass;
|
int aclass;
|
||||||
int ret;
|
int ret;
|
||||||
long len;
|
long len;
|
||||||
const unsigned char *p, *q;
|
const unsigned char *p, *q;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
flags = tt->flags;
|
uint32_t flags = tt->flags;
|
||||||
aclass = flags & ASN1_TFLG_TAG_CLASS;
|
aclass = flags & ASN1_TFLG_TAG_CLASS;
|
||||||
|
|
||||||
p = *in;
|
p = *in;
|
||||||
@@ -517,13 +517,13 @@ err:
|
|||||||
static int asn1_template_noexp_d2i(ASN1_VALUE **val, const unsigned char **in,
|
static int asn1_template_noexp_d2i(ASN1_VALUE **val, const unsigned char **in,
|
||||||
long len, const ASN1_TEMPLATE *tt, char opt,
|
long len, const ASN1_TEMPLATE *tt, char opt,
|
||||||
int depth) {
|
int depth) {
|
||||||
int flags, aclass;
|
int aclass;
|
||||||
int ret;
|
int ret;
|
||||||
const unsigned char *p;
|
const unsigned char *p;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
flags = tt->flags;
|
uint32_t flags = tt->flags;
|
||||||
aclass = flags & ASN1_TFLG_TAG_CLASS;
|
aclass = flags & ASN1_TFLG_TAG_CLASS;
|
||||||
|
|
||||||
p = *in;
|
p = *in;
|
||||||
|
|||||||
@@ -263,9 +263,9 @@ int asn1_item_ex_i2d_opt(ASN1_VALUE **pval, unsigned char **out,
|
|||||||
// taking an |optional| parameter, it uses the |ASN1_TFLG_OPTIONAL| flag.
|
// taking an |optional| parameter, it uses the |ASN1_TFLG_OPTIONAL| flag.
|
||||||
static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||||
const ASN1_TEMPLATE *tt, int tag, int iclass) {
|
const ASN1_TEMPLATE *tt, int tag, int iclass) {
|
||||||
int i, ret, flags, ttag, tclass;
|
int i, ret, ttag, tclass;
|
||||||
size_t j;
|
size_t j;
|
||||||
flags = tt->flags;
|
uint32_t flags = tt->flags;
|
||||||
|
|
||||||
// Historically, |iclass| was repurposed to pass additional flags into the
|
// Historically, |iclass| was repurposed to pass additional flags into the
|
||||||
// encoding process.
|
// encoding process.
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
|||||||
|
|
||||||
case V_ASN1_BOOLEAN:
|
case V_ASN1_BOOLEAN:
|
||||||
if (it) {
|
if (it) {
|
||||||
*(ASN1_BOOLEAN *)pval = it->size;
|
*(ASN1_BOOLEAN *)pval = (ASN1_BOOLEAN)it->size;
|
||||||
} else {
|
} else {
|
||||||
*(ASN1_BOOLEAN *)pval = -1;
|
*(ASN1_BOOLEAN *)pval = -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,9 +273,6 @@ static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) {
|
|||||||
// all the old functions.
|
// all the old functions.
|
||||||
|
|
||||||
static int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
static int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
||||||
ASN1_TYPE *typ;
|
|
||||||
int utype;
|
|
||||||
|
|
||||||
if (!it) {
|
if (!it) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -284,6 +281,7 @@ static int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
|||||||
// |ASN1_PRIMITIVE_FUNCS| table of calbacks.
|
// |ASN1_PRIMITIVE_FUNCS| table of calbacks.
|
||||||
assert(it->funcs == NULL);
|
assert(it->funcs == NULL);
|
||||||
|
|
||||||
|
int utype;
|
||||||
if (it->itype == ASN1_ITYPE_MSTRING) {
|
if (it->itype == ASN1_ITYPE_MSTRING) {
|
||||||
utype = -1;
|
utype = -1;
|
||||||
} else {
|
} else {
|
||||||
@@ -295,15 +293,15 @@ static int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case V_ASN1_BOOLEAN:
|
case V_ASN1_BOOLEAN:
|
||||||
*(ASN1_BOOLEAN *)pval = it->size;
|
*(ASN1_BOOLEAN *)pval = (ASN1_BOOLEAN)it->size;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case V_ASN1_NULL:
|
case V_ASN1_NULL:
|
||||||
*pval = (ASN1_VALUE *)1;
|
*pval = (ASN1_VALUE *)1;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case V_ASN1_ANY:
|
case V_ASN1_ANY: {
|
||||||
typ = OPENSSL_malloc(sizeof(ASN1_TYPE));
|
ASN1_TYPE *typ = OPENSSL_malloc(sizeof(ASN1_TYPE));
|
||||||
if (!typ) {
|
if (!typ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -311,6 +309,7 @@ static int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
|||||||
typ->type = -1;
|
typ->type = -1;
|
||||||
*pval = (ASN1_VALUE *)typ;
|
*pval = (ASN1_VALUE *)typ;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
*pval = (ASN1_VALUE *)ASN1_STRING_type_new(utype);
|
*pval = (ASN1_VALUE *)ASN1_STRING_type_new(utype);
|
||||||
@@ -333,7 +332,7 @@ static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
|||||||
utype = it->utype;
|
utype = it->utype;
|
||||||
}
|
}
|
||||||
if (utype == V_ASN1_BOOLEAN) {
|
if (utype == V_ASN1_BOOLEAN) {
|
||||||
*(ASN1_BOOLEAN *)pval = it->size;
|
*(ASN1_BOOLEAN *)pval = (ASN1_BOOLEAN)it->size;
|
||||||
} else {
|
} else {
|
||||||
*pval = NULL;
|
*pval = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,29 +131,19 @@ static ASN1_ENCODING *asn1_get_enc_ptr(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
||||||
ASN1_ENCODING *enc;
|
ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
|
||||||
enc = asn1_get_enc_ptr(pval, it);
|
|
||||||
if (enc) {
|
if (enc) {
|
||||||
enc->enc = NULL;
|
enc->enc = NULL;
|
||||||
enc->len = 0;
|
enc->len = 0;
|
||||||
enc->alias_only = 0;
|
enc->alias_only = 0;
|
||||||
enc->alias_only_on_next_parse = 0;
|
enc->alias_only_on_next_parse = 0;
|
||||||
enc->modified = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
|
||||||
ASN1_ENCODING *enc;
|
ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
|
||||||
enc = asn1_get_enc_ptr(pval, it);
|
|
||||||
if (enc) {
|
if (enc) {
|
||||||
if (!enc->alias_only) {
|
asn1_encoding_clear(enc);
|
||||||
OPENSSL_free(enc->enc);
|
|
||||||
}
|
|
||||||
enc->enc = NULL;
|
|
||||||
enc->len = 0;
|
|
||||||
enc->alias_only = 0;
|
|
||||||
enc->alias_only_on_next_parse = 0;
|
|
||||||
enc->modified = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,24 +165,30 @@ int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
|
|||||||
if (enc->alias_only) {
|
if (enc->alias_only) {
|
||||||
enc->enc = (uint8_t *)in;
|
enc->enc = (uint8_t *)in;
|
||||||
} else {
|
} else {
|
||||||
enc->enc = OPENSSL_malloc(inlen);
|
enc->enc = OPENSSL_memdup(in, inlen);
|
||||||
if (!enc->enc) {
|
if (!enc->enc) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
OPENSSL_memcpy(enc->enc, in, inlen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enc->len = inlen;
|
enc->len = inlen;
|
||||||
enc->modified = 0;
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void asn1_encoding_clear(ASN1_ENCODING *enc) {
|
||||||
|
if (!enc->alias_only) {
|
||||||
|
OPENSSL_free(enc->enc);
|
||||||
|
}
|
||||||
|
enc->enc = NULL;
|
||||||
|
enc->len = 0;
|
||||||
|
enc->alias_only = 0;
|
||||||
|
enc->alias_only_on_next_parse = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval,
|
int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval,
|
||||||
const ASN1_ITEM *it) {
|
const ASN1_ITEM *it) {
|
||||||
ASN1_ENCODING *enc;
|
ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
|
||||||
enc = asn1_get_enc_ptr(pval, it);
|
if (!enc || enc->len == 0) {
|
||||||
if (!enc || enc->modified) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (out) {
|
if (out) {
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ int BIO_puts(BIO *bio, const char *in) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int BIO_flush(BIO *bio) {
|
int BIO_flush(BIO *bio) {
|
||||||
return BIO_ctrl(bio, BIO_CTRL_FLUSH, 0, NULL);
|
return (int)BIO_ctrl(bio, BIO_CTRL_FLUSH, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
long BIO_ctrl(BIO *bio, int cmd, long larg, void *parg) {
|
long BIO_ctrl(BIO *bio, int cmd, long larg, void *parg) {
|
||||||
@@ -235,11 +235,11 @@ long BIO_int_ctrl(BIO *b, int cmd, long larg, int iarg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int BIO_reset(BIO *bio) {
|
int BIO_reset(BIO *bio) {
|
||||||
return BIO_ctrl(bio, BIO_CTRL_RESET, 0, NULL);
|
return (int)BIO_ctrl(bio, BIO_CTRL_RESET, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_eof(BIO *bio) {
|
int BIO_eof(BIO *bio) {
|
||||||
return BIO_ctrl(bio, BIO_CTRL_EOF, 0, NULL);
|
return (int)BIO_ctrl(bio, BIO_CTRL_EOF, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BIO_set_flags(BIO *bio, int flags) {
|
void BIO_set_flags(BIO *bio, int flags) {
|
||||||
@@ -339,7 +339,7 @@ size_t BIO_wpending(const BIO *bio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int BIO_set_close(BIO *bio, int close_flag) {
|
int BIO_set_close(BIO *bio, int close_flag) {
|
||||||
return BIO_ctrl(bio, BIO_CTRL_SET_CLOSE, close_flag, NULL);
|
return (int)BIO_ctrl(bio, BIO_CTRL_SET_CLOSE, close_flag, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
OPENSSL_EXPORT size_t BIO_number_read(const BIO *bio) {
|
OPENSSL_EXPORT size_t BIO_number_read(const BIO *bio) {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
#include "../internal.h"
|
#include "../internal.h"
|
||||||
|
|
||||||
|
|
||||||
BIO *BIO_new_mem_buf(const void *buf, int len) {
|
BIO *BIO_new_mem_buf(const void *buf, ossl_ssize_t len) {
|
||||||
BIO *ret;
|
BIO *ret;
|
||||||
BUF_MEM *b;
|
BUF_MEM *b;
|
||||||
const size_t size = len < 0 ? strlen((char *)buf) : (size_t)len;
|
const size_t size = len < 0 ? strlen((char *)buf) : (size_t)len;
|
||||||
@@ -312,13 +312,13 @@ long BIO_get_mem_data(BIO *bio, char **contents) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int BIO_get_mem_ptr(BIO *bio, BUF_MEM **out) {
|
int BIO_get_mem_ptr(BIO *bio, BUF_MEM **out) {
|
||||||
return BIO_ctrl(bio, BIO_C_GET_BUF_MEM_PTR, 0, (char *) out);
|
return (int)BIO_ctrl(bio, BIO_C_GET_BUF_MEM_PTR, 0, (char *) out);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_set_mem_buf(BIO *bio, BUF_MEM *b, int take_ownership) {
|
int BIO_set_mem_buf(BIO *bio, BUF_MEM *b, int take_ownership) {
|
||||||
return BIO_ctrl(bio, BIO_C_SET_BUF_MEM, take_ownership, (char *) b);
|
return (int)BIO_ctrl(bio, BIO_C_SET_BUF_MEM, take_ownership, (char *) b);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_set_mem_eof_return(BIO *bio, int eof_value) {
|
int BIO_set_mem_eof_return(BIO *bio, int eof_value) {
|
||||||
return BIO_ctrl(bio, BIO_C_SET_BUF_MEM_EOF_RETURN, eof_value, NULL);
|
return (int)BIO_ctrl(bio, BIO_C_SET_BUF_MEM_EOF_RETURN, eof_value, NULL);
|
||||||
}
|
}
|
||||||
@@ -363,7 +363,7 @@ static int conn_read(BIO *bio, char *out, int out_len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bio_clear_socket_error();
|
bio_clear_socket_error();
|
||||||
ret = recv(bio->num, out, out_len, 0);
|
ret = (int)recv(bio->num, out, out_len, 0);
|
||||||
BIO_clear_retry_flags(bio);
|
BIO_clear_retry_flags(bio);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
if (bio_fd_should_retry(ret)) {
|
if (bio_fd_should_retry(ret)) {
|
||||||
@@ -387,7 +387,7 @@ static int conn_write(BIO *bio, const char *in, int in_len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bio_clear_socket_error();
|
bio_clear_socket_error();
|
||||||
ret = send(bio->num, in, in_len, 0);
|
ret = (int)send(bio->num, in, in_len, 0);
|
||||||
BIO_clear_retry_flags(bio);
|
BIO_clear_retry_flags(bio);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
if (bio_fd_should_retry(ret)) {
|
if (bio_fd_should_retry(ret)) {
|
||||||
@@ -523,11 +523,11 @@ static const BIO_METHOD methods_connectp = {
|
|||||||
const BIO_METHOD *BIO_s_connect(void) { return &methods_connectp; }
|
const BIO_METHOD *BIO_s_connect(void) { return &methods_connectp; }
|
||||||
|
|
||||||
int BIO_set_conn_hostname(BIO *bio, const char *name) {
|
int BIO_set_conn_hostname(BIO *bio, const char *name) {
|
||||||
return BIO_ctrl(bio, BIO_C_SET_CONNECT, 0, (void*) name);
|
return (int)BIO_ctrl(bio, BIO_C_SET_CONNECT, 0, (void*) name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_set_conn_port(BIO *bio, const char *port_str) {
|
int BIO_set_conn_port(BIO *bio, const char *port_str) {
|
||||||
return BIO_ctrl(bio, BIO_C_SET_CONNECT, 1, (void*) port_str);
|
return (int)BIO_ctrl(bio, BIO_C_SET_CONNECT, 1, (void*) port_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_set_conn_int_port(BIO *bio, const int *port) {
|
int BIO_set_conn_int_port(BIO *bio, const int *port) {
|
||||||
@@ -537,11 +537,11 @@ int BIO_set_conn_int_port(BIO *bio, const int *port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int BIO_set_nbio(BIO *bio, int on) {
|
int BIO_set_nbio(BIO *bio, int on) {
|
||||||
return BIO_ctrl(bio, BIO_C_SET_NBIO, on, NULL);
|
return (int)BIO_ctrl(bio, BIO_C_SET_NBIO, on, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_do_connect(BIO *bio) {
|
int BIO_do_connect(BIO *bio) {
|
||||||
return BIO_ctrl(bio, BIO_C_DO_STATE_MACHINE, 0, NULL);
|
return (int)BIO_ctrl(bio, BIO_C_DO_STATE_MACHINE, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // OPENSSL_TRUSTY
|
#endif // OPENSSL_TRUSTY
|
||||||
@@ -265,11 +265,11 @@ static const BIO_METHOD methods_fdp = {
|
|||||||
const BIO_METHOD *BIO_s_fd(void) { return &methods_fdp; }
|
const BIO_METHOD *BIO_s_fd(void) { return &methods_fdp; }
|
||||||
|
|
||||||
int BIO_set_fd(BIO *bio, int fd, int close_flag) {
|
int BIO_set_fd(BIO *bio, int fd, int close_flag) {
|
||||||
return BIO_int_ctrl(bio, BIO_C_SET_FD, close_flag, fd);
|
return (int)BIO_int_ctrl(bio, BIO_C_SET_FD, close_flag, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_get_fd(BIO *bio, int *out_fd) {
|
int BIO_get_fd(BIO *bio, int *out_fd) {
|
||||||
return BIO_ctrl(bio, BIO_C_GET_FD, 0, (char *) out_fd);
|
return (int)BIO_ctrl(bio, BIO_C_GET_FD, 0, (char *) out_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // OPENSSL_TRUSTY
|
#endif // OPENSSL_TRUSTY
|
||||||
@@ -281,31 +281,32 @@ const BIO_METHOD *BIO_s_file(void) { return &methods_filep; }
|
|||||||
|
|
||||||
|
|
||||||
int BIO_get_fp(BIO *bio, FILE **out_file) {
|
int BIO_get_fp(BIO *bio, FILE **out_file) {
|
||||||
return BIO_ctrl(bio, BIO_C_GET_FILE_PTR, 0, (char*) out_file);
|
return (int)BIO_ctrl(bio, BIO_C_GET_FILE_PTR, 0, (char *)out_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_set_fp(BIO *bio, FILE *file, int close_flag) {
|
int BIO_set_fp(BIO *bio, FILE *file, int close_flag) {
|
||||||
return BIO_ctrl(bio, BIO_C_SET_FILE_PTR, close_flag, (char *) file);
|
return (int)BIO_ctrl(bio, BIO_C_SET_FILE_PTR, close_flag, (char *)file);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_read_filename(BIO *bio, const char *filename) {
|
int BIO_read_filename(BIO *bio, const char *filename) {
|
||||||
return BIO_ctrl(bio, BIO_C_SET_FILENAME, BIO_CLOSE | BIO_FP_READ,
|
return (int)BIO_ctrl(bio, BIO_C_SET_FILENAME, BIO_CLOSE | BIO_FP_READ,
|
||||||
(char *)filename);
|
(char *)filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_write_filename(BIO *bio, const char *filename) {
|
int BIO_write_filename(BIO *bio, const char *filename) {
|
||||||
return BIO_ctrl(bio, BIO_C_SET_FILENAME, BIO_CLOSE | BIO_FP_WRITE,
|
return (int)BIO_ctrl(bio, BIO_C_SET_FILENAME, BIO_CLOSE | BIO_FP_WRITE,
|
||||||
(char *)filename);
|
(char *)filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_append_filename(BIO *bio, const char *filename) {
|
int BIO_append_filename(BIO *bio, const char *filename) {
|
||||||
return BIO_ctrl(bio, BIO_C_SET_FILENAME, BIO_CLOSE | BIO_FP_APPEND,
|
return (int)BIO_ctrl(bio, BIO_C_SET_FILENAME, BIO_CLOSE | BIO_FP_APPEND,
|
||||||
(char *)filename);
|
(char *)filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIO_rw_filename(BIO *bio, const char *filename) {
|
int BIO_rw_filename(BIO *bio, const char *filename) {
|
||||||
return BIO_ctrl(bio, BIO_C_SET_FILENAME,
|
return (int)BIO_ctrl(bio, BIO_C_SET_FILENAME,
|
||||||
BIO_CLOSE | BIO_FP_READ | BIO_FP_WRITE, (char *)filename);
|
BIO_CLOSE | BIO_FP_READ | BIO_FP_WRITE,
|
||||||
|
(char *)filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
long BIO_tell(BIO *bio) { return BIO_ctrl(bio, BIO_C_FILE_TELL, 0, NULL); }
|
long BIO_tell(BIO *bio) { return BIO_ctrl(bio, BIO_C_FILE_TELL, 0, NULL); }
|
||||||
|
|||||||
@@ -479,5 +479,5 @@ size_t BIO_ctrl_get_write_guarantee(BIO *bio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int BIO_shutdown_wr(BIO *bio) {
|
int BIO_shutdown_wr(BIO *bio) {
|
||||||
return BIO_ctrl(bio, BIO_C_SHUTDOWN_WR, 0, NULL);
|
return (int)BIO_ctrl(bio, BIO_C_SHUTDOWN_WR, 0, NULL);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
/* crypto/bio/bss_sock.c */
|
|
||||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
// kMaxDepth is a just a sanity limit. The code should be such that the length
|
// kMaxDepth is a just a sanity limit. The code should be such that the length
|
||||||
// of the input being processes always decreases. None the less, a very large
|
// of the input being processes always decreases. None the less, a very large
|
||||||
// input could otherwise cause the stack to overflow.
|
// input could otherwise cause the stack to overflow.
|
||||||
static const unsigned kMaxDepth = 2048;
|
static const uint32_t kMaxDepth = 2048;
|
||||||
|
|
||||||
// is_string_type returns one if |tag| is a string type and zero otherwise. It
|
// is_string_type returns one if |tag| is a string type and zero otherwise. It
|
||||||
// ignores the constructed bit.
|
// ignores the constructed bit.
|
||||||
static int is_string_type(unsigned tag) {
|
static int is_string_type(CBS_ASN1_TAG tag) {
|
||||||
// While BER supports constructed BIT STRINGS, OpenSSL misparses them. To
|
// While BER supports constructed BIT STRINGS, OpenSSL misparses them. To
|
||||||
// avoid acting on an ambiguous input, we do not support constructed BIT
|
// avoid acting on an ambiguous input, we do not support constructed BIT
|
||||||
// STRINGS. See https://github.com/openssl/openssl/issues/12810.
|
// STRINGS. See https://github.com/openssl/openssl/issues/12810.
|
||||||
@@ -55,7 +55,7 @@ static int is_string_type(unsigned tag) {
|
|||||||
// depending on whether an indefinite length element or constructed string was
|
// depending on whether an indefinite length element or constructed string was
|
||||||
// found. The value of |orig_in| is not changed. It returns one on success (i.e.
|
// found. The value of |orig_in| is not changed. It returns one on success (i.e.
|
||||||
// |*ber_found| was set) and zero on error.
|
// |*ber_found| was set) and zero on error.
|
||||||
static int cbs_find_ber(const CBS *orig_in, int *ber_found, unsigned depth) {
|
static int cbs_find_ber(const CBS *orig_in, int *ber_found, uint32_t depth) {
|
||||||
CBS in;
|
CBS in;
|
||||||
|
|
||||||
if (depth > kMaxDepth) {
|
if (depth > kMaxDepth) {
|
||||||
@@ -67,7 +67,7 @@ static int cbs_find_ber(const CBS *orig_in, int *ber_found, unsigned depth) {
|
|||||||
|
|
||||||
while (CBS_len(&in) > 0) {
|
while (CBS_len(&in) > 0) {
|
||||||
CBS contents;
|
CBS contents;
|
||||||
unsigned tag;
|
CBS_ASN1_TAG tag;
|
||||||
size_t header_len;
|
size_t header_len;
|
||||||
int indefinite;
|
int indefinite;
|
||||||
if (!CBS_get_any_ber_asn1_element(&in, &contents, &tag, &header_len,
|
if (!CBS_get_any_ber_asn1_element(&in, &contents, &tag, &header_len,
|
||||||
@@ -110,8 +110,8 @@ static int cbs_get_eoc(CBS *cbs) {
|
|||||||
// constructed string. If |looking_for_eoc| is set then any EOC elements found
|
// constructed string. If |looking_for_eoc| is set then any EOC elements found
|
||||||
// will cause the function to return after consuming it. It returns one on
|
// will cause the function to return after consuming it. It returns one on
|
||||||
// success and zero on error.
|
// success and zero on error.
|
||||||
static int cbs_convert_ber(CBS *in, CBB *out, unsigned string_tag,
|
static int cbs_convert_ber(CBS *in, CBB *out, CBS_ASN1_TAG string_tag,
|
||||||
char looking_for_eoc, unsigned depth) {
|
int looking_for_eoc, uint32_t depth) {
|
||||||
assert(!(string_tag & CBS_ASN1_CONSTRUCTED));
|
assert(!(string_tag & CBS_ASN1_CONSTRUCTED));
|
||||||
|
|
||||||
if (depth > kMaxDepth) {
|
if (depth > kMaxDepth) {
|
||||||
@@ -124,7 +124,7 @@ static int cbs_convert_ber(CBS *in, CBB *out, unsigned string_tag,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CBS contents;
|
CBS contents;
|
||||||
unsigned tag, child_string_tag = string_tag;
|
CBS_ASN1_TAG tag, child_string_tag = string_tag;
|
||||||
size_t header_len;
|
size_t header_len;
|
||||||
int indefinite;
|
int indefinite;
|
||||||
CBB *out_contents, out_contents_storage;
|
CBB *out_contents, out_contents_storage;
|
||||||
@@ -142,7 +142,7 @@ static int cbs_convert_ber(CBS *in, CBB *out, unsigned string_tag,
|
|||||||
}
|
}
|
||||||
out_contents = out;
|
out_contents = out;
|
||||||
} else {
|
} else {
|
||||||
unsigned out_tag = tag;
|
CBS_ASN1_TAG out_tag = tag;
|
||||||
if ((tag & CBS_ASN1_CONSTRUCTED) && is_string_type(tag)) {
|
if ((tag & CBS_ASN1_CONSTRUCTED) && is_string_type(tag)) {
|
||||||
// If a constructed string, clear the constructed bit and inform
|
// If a constructed string, clear the constructed bit and inform
|
||||||
// children to concatenate bodies.
|
// children to concatenate bodies.
|
||||||
@@ -221,7 +221,8 @@ int CBS_asn1_ber_to_der(CBS *in, CBS *out, uint8_t **out_storage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CBS_get_asn1_implicit_string(CBS *in, CBS *out, uint8_t **out_storage,
|
int CBS_get_asn1_implicit_string(CBS *in, CBS *out, uint8_t **out_storage,
|
||||||
unsigned outer_tag, unsigned inner_tag) {
|
CBS_ASN1_TAG outer_tag,
|
||||||
|
CBS_ASN1_TAG inner_tag) {
|
||||||
assert(!(outer_tag & CBS_ASN1_CONSTRUCTED));
|
assert(!(outer_tag & CBS_ASN1_CONSTRUCTED));
|
||||||
assert(!(inner_tag & CBS_ASN1_CONSTRUCTED));
|
assert(!(inner_tag & CBS_ASN1_CONSTRUCTED));
|
||||||
assert(is_string_type(inner_tag));
|
assert(is_string_type(inner_tag));
|
||||||
|
|||||||
@@ -333,14 +333,14 @@ static int add_base128_integer(CBB *cbb, uint64_t v) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBB_add_asn1(CBB *cbb, CBB *out_contents, unsigned tag) {
|
int CBB_add_asn1(CBB *cbb, CBB *out_contents, CBS_ASN1_TAG tag) {
|
||||||
if (!CBB_flush(cbb)) {
|
if (!CBB_flush(cbb)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split the tag into leading bits and tag number.
|
// Split the tag into leading bits and tag number.
|
||||||
uint8_t tag_bits = (tag >> CBS_ASN1_TAG_SHIFT) & 0xe0;
|
uint8_t tag_bits = (tag >> CBS_ASN1_TAG_SHIFT) & 0xe0;
|
||||||
unsigned tag_number = tag & CBS_ASN1_TAG_NUMBER_MASK;
|
CBS_ASN1_TAG tag_number = tag & CBS_ASN1_TAG_NUMBER_MASK;
|
||||||
if (tag_number >= 0x1f) {
|
if (tag_number >= 0x1f) {
|
||||||
// Set all the bits in the tag number to signal high tag number form.
|
// Set all the bits in the tag number to signal high tag number form.
|
||||||
if (!CBB_add_u8(cbb, tag_bits | 0x1f) ||
|
if (!CBB_add_u8(cbb, tag_bits | 0x1f) ||
|
||||||
@@ -470,7 +470,7 @@ int CBB_add_asn1_uint64(CBB *cbb, uint64_t value) {
|
|||||||
return CBB_add_asn1_uint64_with_tag(cbb, value, CBS_ASN1_INTEGER);
|
return CBB_add_asn1_uint64_with_tag(cbb, value, CBS_ASN1_INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBB_add_asn1_uint64_with_tag(CBB *cbb, uint64_t value, unsigned tag) {
|
int CBB_add_asn1_uint64_with_tag(CBB *cbb, uint64_t value, CBS_ASN1_TAG tag) {
|
||||||
CBB child;
|
CBB child;
|
||||||
if (!CBB_add_asn1(cbb, &child, tag)) {
|
if (!CBB_add_asn1(cbb, &child, tag)) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -508,7 +508,7 @@ int CBB_add_asn1_int64(CBB *cbb, int64_t value) {
|
|||||||
return CBB_add_asn1_int64_with_tag(cbb, value, CBS_ASN1_INTEGER);
|
return CBB_add_asn1_int64_with_tag(cbb, value, CBS_ASN1_INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBB_add_asn1_int64_with_tag(CBB *cbb, int64_t value, unsigned tag) {
|
int CBB_add_asn1_int64_with_tag(CBB *cbb, int64_t value, CBS_ASN1_TAG tag) {
|
||||||
if (value >= 0) {
|
if (value >= 0) {
|
||||||
return CBB_add_asn1_uint64_with_tag(cbb, (uint64_t)value, tag);
|
return CBB_add_asn1_uint64_with_tag(cbb, (uint64_t)value, tag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ int CBS_get_u24(CBS *cbs, uint32_t *out) {
|
|||||||
if (!cbs_get_u(cbs, &v, 3)) {
|
if (!cbs_get_u(cbs, &v, 3)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*out = v;
|
*out = (uint32_t)v;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ int CBS_get_u32(CBS *cbs, uint32_t *out) {
|
|||||||
if (!cbs_get_u(cbs, &v, 4)) {
|
if (!cbs_get_u(cbs, &v, 4)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*out = v;
|
*out = (uint32_t)v;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ static int parse_base128_integer(CBS *cbs, uint64_t *out) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_asn1_tag(CBS *cbs, unsigned *out) {
|
static int parse_asn1_tag(CBS *cbs, CBS_ASN1_TAG *out) {
|
||||||
uint8_t tag_byte;
|
uint8_t tag_byte;
|
||||||
if (!CBS_get_u8(cbs, &tag_byte)) {
|
if (!CBS_get_u8(cbs, &tag_byte)) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -266,8 +266,8 @@ static int parse_asn1_tag(CBS *cbs, unsigned *out) {
|
|||||||
// If the number portion is 31 (0x1f, the largest value that fits in the
|
// If the number portion is 31 (0x1f, the largest value that fits in the
|
||||||
// allotted bits), then the tag is more than one byte long and the
|
// allotted bits), then the tag is more than one byte long and the
|
||||||
// continuation bytes contain the tag number.
|
// continuation bytes contain the tag number.
|
||||||
unsigned tag = ((unsigned)tag_byte & 0xe0) << CBS_ASN1_TAG_SHIFT;
|
CBS_ASN1_TAG tag = ((CBS_ASN1_TAG)tag_byte & 0xe0) << CBS_ASN1_TAG_SHIFT;
|
||||||
unsigned tag_number = tag_byte & 0x1f;
|
CBS_ASN1_TAG tag_number = tag_byte & 0x1f;
|
||||||
if (tag_number == 0x1f) {
|
if (tag_number == 0x1f) {
|
||||||
uint64_t v;
|
uint64_t v;
|
||||||
if (!parse_base128_integer(cbs, &v) ||
|
if (!parse_base128_integer(cbs, &v) ||
|
||||||
@@ -277,7 +277,7 @@ static int parse_asn1_tag(CBS *cbs, unsigned *out) {
|
|||||||
v < 0x1f) {
|
v < 0x1f) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
tag_number = (unsigned)v;
|
tag_number = (CBS_ASN1_TAG)v;
|
||||||
}
|
}
|
||||||
|
|
||||||
tag |= tag_number;
|
tag |= tag_number;
|
||||||
@@ -293,7 +293,7 @@ static int parse_asn1_tag(CBS *cbs, unsigned *out) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cbs_get_any_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag,
|
static int cbs_get_any_asn1_element(CBS *cbs, CBS *out, CBS_ASN1_TAG *out_tag,
|
||||||
size_t *out_header_len, int *out_ber_found,
|
size_t *out_header_len, int *out_ber_found,
|
||||||
int *out_indefinite, int ber_ok) {
|
int *out_indefinite, int ber_ok) {
|
||||||
CBS header = *cbs;
|
CBS header = *cbs;
|
||||||
@@ -310,7 +310,7 @@ static int cbs_get_any_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag,
|
|||||||
assert(out_indefinite == NULL);
|
assert(out_indefinite == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned tag;
|
CBS_ASN1_TAG tag;
|
||||||
if (!parse_asn1_tag(&header, &tag)) {
|
if (!parse_asn1_tag(&header, &tag)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -394,7 +394,7 @@ static int cbs_get_any_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag,
|
|||||||
return CBS_get_bytes(cbs, out, len);
|
return CBS_get_bytes(cbs, out, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBS_get_any_asn1(CBS *cbs, CBS *out, unsigned *out_tag) {
|
int CBS_get_any_asn1(CBS *cbs, CBS *out, CBS_ASN1_TAG *out_tag) {
|
||||||
size_t header_len;
|
size_t header_len;
|
||||||
if (!CBS_get_any_asn1_element(cbs, out, out_tag, &header_len)) {
|
if (!CBS_get_any_asn1_element(cbs, out, out_tag, &header_len)) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -408,13 +408,13 @@ int CBS_get_any_asn1(CBS *cbs, CBS *out, unsigned *out_tag) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag,
|
int CBS_get_any_asn1_element(CBS *cbs, CBS *out, CBS_ASN1_TAG *out_tag,
|
||||||
size_t *out_header_len) {
|
size_t *out_header_len) {
|
||||||
return cbs_get_any_asn1_element(cbs, out, out_tag, out_header_len, NULL, NULL,
|
return cbs_get_any_asn1_element(cbs, out, out_tag, out_header_len, NULL, NULL,
|
||||||
/*ber_ok=*/0);
|
/*ber_ok=*/0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBS_get_any_ber_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag,
|
int CBS_get_any_ber_asn1_element(CBS *cbs, CBS *out, CBS_ASN1_TAG *out_tag,
|
||||||
size_t *out_header_len, int *out_ber_found,
|
size_t *out_header_len, int *out_ber_found,
|
||||||
int *out_indefinite) {
|
int *out_indefinite) {
|
||||||
int ber_found_temp;
|
int ber_found_temp;
|
||||||
@@ -424,10 +424,10 @@ int CBS_get_any_ber_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag,
|
|||||||
/*ber_ok=*/1);
|
/*ber_ok=*/1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cbs_get_asn1(CBS *cbs, CBS *out, unsigned tag_value,
|
static int cbs_get_asn1(CBS *cbs, CBS *out, CBS_ASN1_TAG tag_value,
|
||||||
int skip_header) {
|
int skip_header) {
|
||||||
size_t header_len;
|
size_t header_len;
|
||||||
unsigned tag;
|
CBS_ASN1_TAG tag;
|
||||||
CBS throwaway;
|
CBS throwaway;
|
||||||
|
|
||||||
if (out == NULL) {
|
if (out == NULL) {
|
||||||
@@ -447,21 +447,21 @@ static int cbs_get_asn1(CBS *cbs, CBS *out, unsigned tag_value,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBS_get_asn1(CBS *cbs, CBS *out, unsigned tag_value) {
|
int CBS_get_asn1(CBS *cbs, CBS *out, CBS_ASN1_TAG tag_value) {
|
||||||
return cbs_get_asn1(cbs, out, tag_value, 1 /* skip header */);
|
return cbs_get_asn1(cbs, out, tag_value, 1 /* skip header */);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned tag_value) {
|
int CBS_get_asn1_element(CBS *cbs, CBS *out, CBS_ASN1_TAG tag_value) {
|
||||||
return cbs_get_asn1(cbs, out, tag_value, 0 /* include header */);
|
return cbs_get_asn1(cbs, out, tag_value, 0 /* include header */);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value) {
|
int CBS_peek_asn1_tag(const CBS *cbs, CBS_ASN1_TAG tag_value) {
|
||||||
if (CBS_len(cbs) < 1) {
|
if (CBS_len(cbs) < 1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CBS copy = *cbs;
|
CBS copy = *cbs;
|
||||||
unsigned actual_tag;
|
CBS_ASN1_TAG actual_tag;
|
||||||
return parse_asn1_tag(©, &actual_tag) && tag_value == actual_tag;
|
return parse_asn1_tag(©, &actual_tag) && tag_value == actual_tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,7 +524,7 @@ int CBS_get_asn1_bool(CBS *cbs, int *out) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned tag) {
|
int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, CBS_ASN1_TAG tag) {
|
||||||
int present = 0;
|
int present = 0;
|
||||||
|
|
||||||
if (CBS_peek_asn1_tag(cbs, tag)) {
|
if (CBS_peek_asn1_tag(cbs, tag)) {
|
||||||
@@ -542,7 +542,7 @@ int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned tag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present,
|
int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present,
|
||||||
unsigned tag) {
|
CBS_ASN1_TAG tag) {
|
||||||
CBS child;
|
CBS child;
|
||||||
int present;
|
int present;
|
||||||
if (!CBS_get_optional_asn1(cbs, &child, &present, tag)) {
|
if (!CBS_get_optional_asn1(cbs, &child, &present, tag)) {
|
||||||
@@ -563,7 +563,7 @@ int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned tag,
|
int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, CBS_ASN1_TAG tag,
|
||||||
uint64_t default_value) {
|
uint64_t default_value) {
|
||||||
CBS child;
|
CBS child;
|
||||||
int present;
|
int present;
|
||||||
@@ -581,7 +581,7 @@ int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned tag,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned tag,
|
int CBS_get_optional_asn1_bool(CBS *cbs, int *out, CBS_ASN1_TAG tag,
|
||||||
int default_value) {
|
int default_value) {
|
||||||
CBS child, child2;
|
CBS child, child2;
|
||||||
int present;
|
int present;
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ OPENSSL_EXPORT int CBS_asn1_ber_to_der(CBS *in, CBS *out,
|
|||||||
// It returns one on success and zero otherwise.
|
// It returns one on success and zero otherwise.
|
||||||
OPENSSL_EXPORT int CBS_get_asn1_implicit_string(CBS *in, CBS *out,
|
OPENSSL_EXPORT int CBS_get_asn1_implicit_string(CBS *in, CBS *out,
|
||||||
uint8_t **out_storage,
|
uint8_t **out_storage,
|
||||||
unsigned outer_tag,
|
CBS_ASN1_TAG outer_tag,
|
||||||
unsigned inner_tag);
|
CBS_ASN1_TAG inner_tag);
|
||||||
|
|
||||||
// CBB_finish_i2d calls |CBB_finish| on |cbb| which must have been initialized
|
// CBB_finish_i2d calls |CBB_finish| on |cbb| which must have been initialized
|
||||||
// with |CBB_init|. If |outp| is not NULL then the result is written to |*outp|
|
// with |CBB_init|. If |outp| is not NULL then the result is written to |*outp|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1497,7 +1497,11 @@ OPENSSL_armcap_P:
|
|||||||
.indirect_symbol _OPENSSL_armcap_P
|
.indirect_symbol _OPENSSL_armcap_P
|
||||||
.long 0
|
.long 0
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__arm__) && defined(__APPLE__)
|
#endif // defined(__arm__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__ELF__)
|
||||||
#if defined(__arm__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1490,9 +1489,11 @@ ChaCha20_neon:
|
|||||||
.size ChaCha20_neon,.-ChaCha20_neon
|
.size ChaCha20_neon,.-ChaCha20_neon
|
||||||
.comm OPENSSL_armcap_P,4,4
|
.comm OPENSSL_armcap_P,4,4
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__arm__) && defined(__linux__)
|
#endif // defined(__arm__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1991,7 +1991,11 @@ Ldone_512_neon:
|
|||||||
AARCH64_VALIDATE_LINK_REGISTER
|
AARCH64_VALIDATE_LINK_REGISTER
|
||||||
ret
|
ret
|
||||||
|
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__aarch64__) && defined(__APPLE__)
|
#endif // defined(__aarch64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
#if defined(__aarch64__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1992,9 +1991,11 @@ ChaCha20_512_neon:
|
|||||||
AARCH64_VALIDATE_LINK_REGISTER
|
AARCH64_VALIDATE_LINK_REGISTER
|
||||||
ret
|
ret
|
||||||
.size ChaCha20_512_neon,.-ChaCha20_512_neon
|
.size ChaCha20_512_neon,.-ChaCha20_512_neon
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__aarch64__) && defined(__linux__)
|
#endif // defined(__aarch64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
// This file is generated from a similarly-named Perl script in the BoringSSL
|
// This file is generated from a similarly-named Perl script in the BoringSSL
|
||||||
// source tree. Do not edit by hand.
|
// source tree. Do not edit by hand.
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__has_feature)
|
||||||
|
#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
|
||||||
|
#define OPENSSL_NO_ASM
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -973,8 +979,11 @@ ChaCha20_ssse3:
|
|||||||
.byte 44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32
|
.byte 44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32
|
||||||
.byte 60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111
|
.byte 60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111
|
||||||
.byte 114,103,62,0
|
.byte 114,103,62,0
|
||||||
|
#endif // !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
|
||||||
#endif // defined(__i386__) && defined(__linux__)
|
#endif // defined(__i386__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1632,7 +1632,10 @@ ChaCha20_8x:
|
|||||||
.cfi_endproc
|
.cfi_endproc
|
||||||
.size ChaCha20_8x,.-ChaCha20_8x
|
.size ChaCha20_8x,.-ChaCha20_8x
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__linux__)
|
#endif // defined(__x86_64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1624,6 +1624,10 @@ L$8x_epilogue:
|
|||||||
.byte 0xf3,0xc3
|
.byte 0xf3,0xc3
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__APPLE__)
|
#endif // defined(__x86_64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -3078,7 +3078,10 @@ aes256gcmsiv_kdf:
|
|||||||
.cfi_endproc
|
.cfi_endproc
|
||||||
.size aes256gcmsiv_kdf, .-aes256gcmsiv_kdf
|
.size aes256gcmsiv_kdf, .-aes256gcmsiv_kdf
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__linux__)
|
#endif // defined(__x86_64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -3067,6 +3067,10 @@ _aes256gcmsiv_kdf:
|
|||||||
.byte 0xf3,0xc3
|
.byte 0xf3,0xc3
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__APPLE__)
|
#endif // defined(__x86_64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -3016,7 +3016,11 @@ Lopen_128_hash_64:
|
|||||||
b Lopen_128_hash_64
|
b Lopen_128_hash_64
|
||||||
.cfi_endproc
|
.cfi_endproc
|
||||||
|
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__aarch64__) && defined(__APPLE__)
|
#endif // defined(__aarch64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
+5
-4
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
#if defined(__aarch64__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -3017,9 +3016,11 @@ chacha20_poly1305_open:
|
|||||||
b .Lopen_128_hash_64
|
b .Lopen_128_hash_64
|
||||||
.cfi_endproc
|
.cfi_endproc
|
||||||
.size chacha20_poly1305_open,.-chacha20_poly1305_open
|
.size chacha20_poly1305_open,.-chacha20_poly1305_open
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__aarch64__) && defined(__linux__)
|
#endif // defined(__aarch64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
+5
-2
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -8921,7 +8921,10 @@ chacha20_poly1305_seal_avx2:
|
|||||||
.cfi_endproc
|
.cfi_endproc
|
||||||
.size chacha20_poly1305_seal_avx2, .-chacha20_poly1305_seal_avx2
|
.size chacha20_poly1305_seal_avx2, .-chacha20_poly1305_seal_avx2
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__linux__)
|
#endif // defined(__x86_64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -8877,6 +8877,10 @@ L$seal_avx2_exit:
|
|||||||
jmp L$seal_sse_tail_16
|
jmp L$seal_sse_tail_16
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__APPLE__)
|
#endif // defined(__x86_64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
|||||||
@@ -385,8 +385,9 @@ static CONF_VALUE *get_section(const CONF *conf, const char *section) {
|
|||||||
return lh_CONF_VALUE_retrieve(conf->data, &template);
|
return lh_CONF_VALUE_retrieve(conf->data, &template);
|
||||||
}
|
}
|
||||||
|
|
||||||
STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section) {
|
const STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
|
||||||
CONF_VALUE *section_value = get_section(conf, section);
|
const char *section) {
|
||||||
|
const CONF_VALUE *section_value = get_section(conf, section);
|
||||||
if (section_value == NULL) {
|
if (section_value == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* crypto/conf/conf_def.h */
|
|
||||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -14,11 +14,16 @@
|
|||||||
|
|
||||||
#include <CCryptoBoringSSL_crypto.h>
|
#include <CCryptoBoringSSL_crypto.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "fipsmodule/rand/fork_detect.h"
|
#include "fipsmodule/rand/fork_detect.h"
|
||||||
#include "fipsmodule/rand/internal.h"
|
#include "fipsmodule/rand/internal.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
|
||||||
|
static_assert(sizeof(ossl_ssize_t) == sizeof(size_t),
|
||||||
|
"ossl_ssize_t should be the same size as size_t");
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_STATIC_ARMCAP) && \
|
#if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_STATIC_ARMCAP) && \
|
||||||
(defined(OPENSSL_X86) || defined(OPENSSL_X86_64) || \
|
(defined(OPENSSL_X86) || defined(OPENSSL_X86_64) || \
|
||||||
defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64) || \
|
defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64) || \
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM) && defined(__arm__) && !defined(__APPLE__)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__ELF__)
|
||||||
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
@@ -2131,7 +2131,7 @@ mov sp,r12
|
|||||||
vpop {q4,q5,q6,q7}
|
vpop {q4,q5,q6,q7}
|
||||||
bx lr
|
bx lr
|
||||||
|
|
||||||
#endif /* !OPENSSL_NO_ASM && __arm__ && !__APPLE__ */
|
#endif /* !OPENSSL_NO_ASM && __ARMEL__ && __ELF__ */
|
||||||
|
|
||||||
#if defined(__ELF__)
|
#if defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -63,231 +63,231 @@
|
|||||||
|
|
||||||
static const uint32_t des_skb[8][64] = {
|
static const uint32_t des_skb[8][64] = {
|
||||||
{ // for C bits (numbered as per FIPS 46) 1 2 3 4 5 6
|
{ // for C bits (numbered as per FIPS 46) 1 2 3 4 5 6
|
||||||
0x00000000L, 0x00000010L, 0x20000000L, 0x20000010L, 0x00010000L,
|
0x00000000, 0x00000010, 0x20000000, 0x20000010, 0x00010000,
|
||||||
0x00010010L, 0x20010000L, 0x20010010L, 0x00000800L, 0x00000810L,
|
0x00010010, 0x20010000, 0x20010010, 0x00000800, 0x00000810,
|
||||||
0x20000800L, 0x20000810L, 0x00010800L, 0x00010810L, 0x20010800L,
|
0x20000800, 0x20000810, 0x00010800, 0x00010810, 0x20010800,
|
||||||
0x20010810L, 0x00000020L, 0x00000030L, 0x20000020L, 0x20000030L,
|
0x20010810, 0x00000020, 0x00000030, 0x20000020, 0x20000030,
|
||||||
0x00010020L, 0x00010030L, 0x20010020L, 0x20010030L, 0x00000820L,
|
0x00010020, 0x00010030, 0x20010020, 0x20010030, 0x00000820,
|
||||||
0x00000830L, 0x20000820L, 0x20000830L, 0x00010820L, 0x00010830L,
|
0x00000830, 0x20000820, 0x20000830, 0x00010820, 0x00010830,
|
||||||
0x20010820L, 0x20010830L, 0x00080000L, 0x00080010L, 0x20080000L,
|
0x20010820, 0x20010830, 0x00080000, 0x00080010, 0x20080000,
|
||||||
0x20080010L, 0x00090000L, 0x00090010L, 0x20090000L, 0x20090010L,
|
0x20080010, 0x00090000, 0x00090010, 0x20090000, 0x20090010,
|
||||||
0x00080800L, 0x00080810L, 0x20080800L, 0x20080810L, 0x00090800L,
|
0x00080800, 0x00080810, 0x20080800, 0x20080810, 0x00090800,
|
||||||
0x00090810L, 0x20090800L, 0x20090810L, 0x00080020L, 0x00080030L,
|
0x00090810, 0x20090800, 0x20090810, 0x00080020, 0x00080030,
|
||||||
0x20080020L, 0x20080030L, 0x00090020L, 0x00090030L, 0x20090020L,
|
0x20080020, 0x20080030, 0x00090020, 0x00090030, 0x20090020,
|
||||||
0x20090030L, 0x00080820L, 0x00080830L, 0x20080820L, 0x20080830L,
|
0x20090030, 0x00080820, 0x00080830, 0x20080820, 0x20080830,
|
||||||
0x00090820L, 0x00090830L, 0x20090820L, 0x20090830L, },
|
0x00090820, 0x00090830, 0x20090820, 0x20090830, },
|
||||||
{ // for C bits (numbered as per FIPS 46) 7 8 10 11 12 13
|
{ // for C bits (numbered as per FIPS 46) 7 8 10 11 12 13
|
||||||
0x00000000L, 0x02000000L, 0x00002000L, 0x02002000L, 0x00200000L,
|
0x00000000, 0x02000000, 0x00002000, 0x02002000, 0x00200000,
|
||||||
0x02200000L, 0x00202000L, 0x02202000L, 0x00000004L, 0x02000004L,
|
0x02200000, 0x00202000, 0x02202000, 0x00000004, 0x02000004,
|
||||||
0x00002004L, 0x02002004L, 0x00200004L, 0x02200004L, 0x00202004L,
|
0x00002004, 0x02002004, 0x00200004, 0x02200004, 0x00202004,
|
||||||
0x02202004L, 0x00000400L, 0x02000400L, 0x00002400L, 0x02002400L,
|
0x02202004, 0x00000400, 0x02000400, 0x00002400, 0x02002400,
|
||||||
0x00200400L, 0x02200400L, 0x00202400L, 0x02202400L, 0x00000404L,
|
0x00200400, 0x02200400, 0x00202400, 0x02202400, 0x00000404,
|
||||||
0x02000404L, 0x00002404L, 0x02002404L, 0x00200404L, 0x02200404L,
|
0x02000404, 0x00002404, 0x02002404, 0x00200404, 0x02200404,
|
||||||
0x00202404L, 0x02202404L, 0x10000000L, 0x12000000L, 0x10002000L,
|
0x00202404, 0x02202404, 0x10000000, 0x12000000, 0x10002000,
|
||||||
0x12002000L, 0x10200000L, 0x12200000L, 0x10202000L, 0x12202000L,
|
0x12002000, 0x10200000, 0x12200000, 0x10202000, 0x12202000,
|
||||||
0x10000004L, 0x12000004L, 0x10002004L, 0x12002004L, 0x10200004L,
|
0x10000004, 0x12000004, 0x10002004, 0x12002004, 0x10200004,
|
||||||
0x12200004L, 0x10202004L, 0x12202004L, 0x10000400L, 0x12000400L,
|
0x12200004, 0x10202004, 0x12202004, 0x10000400, 0x12000400,
|
||||||
0x10002400L, 0x12002400L, 0x10200400L, 0x12200400L, 0x10202400L,
|
0x10002400, 0x12002400, 0x10200400, 0x12200400, 0x10202400,
|
||||||
0x12202400L, 0x10000404L, 0x12000404L, 0x10002404L, 0x12002404L,
|
0x12202400, 0x10000404, 0x12000404, 0x10002404, 0x12002404,
|
||||||
0x10200404L, 0x12200404L, 0x10202404L, 0x12202404L, },
|
0x10200404, 0x12200404, 0x10202404, 0x12202404, },
|
||||||
{ // for C bits (numbered as per FIPS 46) 14 15 16 17 19 20
|
{ // for C bits (numbered as per FIPS 46) 14 15 16 17 19 20
|
||||||
0x00000000L, 0x00000001L, 0x00040000L, 0x00040001L, 0x01000000L,
|
0x00000000, 0x00000001, 0x00040000, 0x00040001, 0x01000000,
|
||||||
0x01000001L, 0x01040000L, 0x01040001L, 0x00000002L, 0x00000003L,
|
0x01000001, 0x01040000, 0x01040001, 0x00000002, 0x00000003,
|
||||||
0x00040002L, 0x00040003L, 0x01000002L, 0x01000003L, 0x01040002L,
|
0x00040002, 0x00040003, 0x01000002, 0x01000003, 0x01040002,
|
||||||
0x01040003L, 0x00000200L, 0x00000201L, 0x00040200L, 0x00040201L,
|
0x01040003, 0x00000200, 0x00000201, 0x00040200, 0x00040201,
|
||||||
0x01000200L, 0x01000201L, 0x01040200L, 0x01040201L, 0x00000202L,
|
0x01000200, 0x01000201, 0x01040200, 0x01040201, 0x00000202,
|
||||||
0x00000203L, 0x00040202L, 0x00040203L, 0x01000202L, 0x01000203L,
|
0x00000203, 0x00040202, 0x00040203, 0x01000202, 0x01000203,
|
||||||
0x01040202L, 0x01040203L, 0x08000000L, 0x08000001L, 0x08040000L,
|
0x01040202, 0x01040203, 0x08000000, 0x08000001, 0x08040000,
|
||||||
0x08040001L, 0x09000000L, 0x09000001L, 0x09040000L, 0x09040001L,
|
0x08040001, 0x09000000, 0x09000001, 0x09040000, 0x09040001,
|
||||||
0x08000002L, 0x08000003L, 0x08040002L, 0x08040003L, 0x09000002L,
|
0x08000002, 0x08000003, 0x08040002, 0x08040003, 0x09000002,
|
||||||
0x09000003L, 0x09040002L, 0x09040003L, 0x08000200L, 0x08000201L,
|
0x09000003, 0x09040002, 0x09040003, 0x08000200, 0x08000201,
|
||||||
0x08040200L, 0x08040201L, 0x09000200L, 0x09000201L, 0x09040200L,
|
0x08040200, 0x08040201, 0x09000200, 0x09000201, 0x09040200,
|
||||||
0x09040201L, 0x08000202L, 0x08000203L, 0x08040202L, 0x08040203L,
|
0x09040201, 0x08000202, 0x08000203, 0x08040202, 0x08040203,
|
||||||
0x09000202L, 0x09000203L, 0x09040202L, 0x09040203L, },
|
0x09000202, 0x09000203, 0x09040202, 0x09040203, },
|
||||||
{ // for C bits (numbered as per FIPS 46) 21 23 24 26 27 28
|
{ // for C bits (numbered as per FIPS 46) 21 23 24 26 27 28
|
||||||
0x00000000L, 0x00100000L, 0x00000100L, 0x00100100L, 0x00000008L,
|
0x00000000, 0x00100000, 0x00000100, 0x00100100, 0x00000008,
|
||||||
0x00100008L, 0x00000108L, 0x00100108L, 0x00001000L, 0x00101000L,
|
0x00100008, 0x00000108, 0x00100108, 0x00001000, 0x00101000,
|
||||||
0x00001100L, 0x00101100L, 0x00001008L, 0x00101008L, 0x00001108L,
|
0x00001100, 0x00101100, 0x00001008, 0x00101008, 0x00001108,
|
||||||
0x00101108L, 0x04000000L, 0x04100000L, 0x04000100L, 0x04100100L,
|
0x00101108, 0x04000000, 0x04100000, 0x04000100, 0x04100100,
|
||||||
0x04000008L, 0x04100008L, 0x04000108L, 0x04100108L, 0x04001000L,
|
0x04000008, 0x04100008, 0x04000108, 0x04100108, 0x04001000,
|
||||||
0x04101000L, 0x04001100L, 0x04101100L, 0x04001008L, 0x04101008L,
|
0x04101000, 0x04001100, 0x04101100, 0x04001008, 0x04101008,
|
||||||
0x04001108L, 0x04101108L, 0x00020000L, 0x00120000L, 0x00020100L,
|
0x04001108, 0x04101108, 0x00020000, 0x00120000, 0x00020100,
|
||||||
0x00120100L, 0x00020008L, 0x00120008L, 0x00020108L, 0x00120108L,
|
0x00120100, 0x00020008, 0x00120008, 0x00020108, 0x00120108,
|
||||||
0x00021000L, 0x00121000L, 0x00021100L, 0x00121100L, 0x00021008L,
|
0x00021000, 0x00121000, 0x00021100, 0x00121100, 0x00021008,
|
||||||
0x00121008L, 0x00021108L, 0x00121108L, 0x04020000L, 0x04120000L,
|
0x00121008, 0x00021108, 0x00121108, 0x04020000, 0x04120000,
|
||||||
0x04020100L, 0x04120100L, 0x04020008L, 0x04120008L, 0x04020108L,
|
0x04020100, 0x04120100, 0x04020008, 0x04120008, 0x04020108,
|
||||||
0x04120108L, 0x04021000L, 0x04121000L, 0x04021100L, 0x04121100L,
|
0x04120108, 0x04021000, 0x04121000, 0x04021100, 0x04121100,
|
||||||
0x04021008L, 0x04121008L, 0x04021108L, 0x04121108L, },
|
0x04021008, 0x04121008, 0x04021108, 0x04121108, },
|
||||||
{ // for D bits (numbered as per FIPS 46) 1 2 3 4 5 6
|
{ // for D bits (numbered as per FIPS 46) 1 2 3 4 5 6
|
||||||
0x00000000L, 0x10000000L, 0x00010000L, 0x10010000L, 0x00000004L,
|
0x00000000, 0x10000000, 0x00010000, 0x10010000, 0x00000004,
|
||||||
0x10000004L, 0x00010004L, 0x10010004L, 0x20000000L, 0x30000000L,
|
0x10000004, 0x00010004, 0x10010004, 0x20000000, 0x30000000,
|
||||||
0x20010000L, 0x30010000L, 0x20000004L, 0x30000004L, 0x20010004L,
|
0x20010000, 0x30010000, 0x20000004, 0x30000004, 0x20010004,
|
||||||
0x30010004L, 0x00100000L, 0x10100000L, 0x00110000L, 0x10110000L,
|
0x30010004, 0x00100000, 0x10100000, 0x00110000, 0x10110000,
|
||||||
0x00100004L, 0x10100004L, 0x00110004L, 0x10110004L, 0x20100000L,
|
0x00100004, 0x10100004, 0x00110004, 0x10110004, 0x20100000,
|
||||||
0x30100000L, 0x20110000L, 0x30110000L, 0x20100004L, 0x30100004L,
|
0x30100000, 0x20110000, 0x30110000, 0x20100004, 0x30100004,
|
||||||
0x20110004L, 0x30110004L, 0x00001000L, 0x10001000L, 0x00011000L,
|
0x20110004, 0x30110004, 0x00001000, 0x10001000, 0x00011000,
|
||||||
0x10011000L, 0x00001004L, 0x10001004L, 0x00011004L, 0x10011004L,
|
0x10011000, 0x00001004, 0x10001004, 0x00011004, 0x10011004,
|
||||||
0x20001000L, 0x30001000L, 0x20011000L, 0x30011000L, 0x20001004L,
|
0x20001000, 0x30001000, 0x20011000, 0x30011000, 0x20001004,
|
||||||
0x30001004L, 0x20011004L, 0x30011004L, 0x00101000L, 0x10101000L,
|
0x30001004, 0x20011004, 0x30011004, 0x00101000, 0x10101000,
|
||||||
0x00111000L, 0x10111000L, 0x00101004L, 0x10101004L, 0x00111004L,
|
0x00111000, 0x10111000, 0x00101004, 0x10101004, 0x00111004,
|
||||||
0x10111004L, 0x20101000L, 0x30101000L, 0x20111000L, 0x30111000L,
|
0x10111004, 0x20101000, 0x30101000, 0x20111000, 0x30111000,
|
||||||
0x20101004L, 0x30101004L, 0x20111004L, 0x30111004L, },
|
0x20101004, 0x30101004, 0x20111004, 0x30111004, },
|
||||||
{ // for D bits (numbered as per FIPS 46) 8 9 11 12 13 14
|
{ // for D bits (numbered as per FIPS 46) 8 9 11 12 13 14
|
||||||
0x00000000L, 0x08000000L, 0x00000008L, 0x08000008L, 0x00000400L,
|
0x00000000, 0x08000000, 0x00000008, 0x08000008, 0x00000400,
|
||||||
0x08000400L, 0x00000408L, 0x08000408L, 0x00020000L, 0x08020000L,
|
0x08000400, 0x00000408, 0x08000408, 0x00020000, 0x08020000,
|
||||||
0x00020008L, 0x08020008L, 0x00020400L, 0x08020400L, 0x00020408L,
|
0x00020008, 0x08020008, 0x00020400, 0x08020400, 0x00020408,
|
||||||
0x08020408L, 0x00000001L, 0x08000001L, 0x00000009L, 0x08000009L,
|
0x08020408, 0x00000001, 0x08000001, 0x00000009, 0x08000009,
|
||||||
0x00000401L, 0x08000401L, 0x00000409L, 0x08000409L, 0x00020001L,
|
0x00000401, 0x08000401, 0x00000409, 0x08000409, 0x00020001,
|
||||||
0x08020001L, 0x00020009L, 0x08020009L, 0x00020401L, 0x08020401L,
|
0x08020001, 0x00020009, 0x08020009, 0x00020401, 0x08020401,
|
||||||
0x00020409L, 0x08020409L, 0x02000000L, 0x0A000000L, 0x02000008L,
|
0x00020409, 0x08020409, 0x02000000, 0x0A000000, 0x02000008,
|
||||||
0x0A000008L, 0x02000400L, 0x0A000400L, 0x02000408L, 0x0A000408L,
|
0x0A000008, 0x02000400, 0x0A000400, 0x02000408, 0x0A000408,
|
||||||
0x02020000L, 0x0A020000L, 0x02020008L, 0x0A020008L, 0x02020400L,
|
0x02020000, 0x0A020000, 0x02020008, 0x0A020008, 0x02020400,
|
||||||
0x0A020400L, 0x02020408L, 0x0A020408L, 0x02000001L, 0x0A000001L,
|
0x0A020400, 0x02020408, 0x0A020408, 0x02000001, 0x0A000001,
|
||||||
0x02000009L, 0x0A000009L, 0x02000401L, 0x0A000401L, 0x02000409L,
|
0x02000009, 0x0A000009, 0x02000401, 0x0A000401, 0x02000409,
|
||||||
0x0A000409L, 0x02020001L, 0x0A020001L, 0x02020009L, 0x0A020009L,
|
0x0A000409, 0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
|
||||||
0x02020401L, 0x0A020401L, 0x02020409L, 0x0A020409L, },
|
0x02020401, 0x0A020401, 0x02020409, 0x0A020409, },
|
||||||
{ // for D bits (numbered as per FIPS 46) 16 17 18 19 20 21
|
{ // for D bits (numbered as per FIPS 46) 16 17 18 19 20 21
|
||||||
0x00000000L, 0x00000100L, 0x00080000L, 0x00080100L, 0x01000000L,
|
0x00000000, 0x00000100, 0x00080000, 0x00080100, 0x01000000,
|
||||||
0x01000100L, 0x01080000L, 0x01080100L, 0x00000010L, 0x00000110L,
|
0x01000100, 0x01080000, 0x01080100, 0x00000010, 0x00000110,
|
||||||
0x00080010L, 0x00080110L, 0x01000010L, 0x01000110L, 0x01080010L,
|
0x00080010, 0x00080110, 0x01000010, 0x01000110, 0x01080010,
|
||||||
0x01080110L, 0x00200000L, 0x00200100L, 0x00280000L, 0x00280100L,
|
0x01080110, 0x00200000, 0x00200100, 0x00280000, 0x00280100,
|
||||||
0x01200000L, 0x01200100L, 0x01280000L, 0x01280100L, 0x00200010L,
|
0x01200000, 0x01200100, 0x01280000, 0x01280100, 0x00200010,
|
||||||
0x00200110L, 0x00280010L, 0x00280110L, 0x01200010L, 0x01200110L,
|
0x00200110, 0x00280010, 0x00280110, 0x01200010, 0x01200110,
|
||||||
0x01280010L, 0x01280110L, 0x00000200L, 0x00000300L, 0x00080200L,
|
0x01280010, 0x01280110, 0x00000200, 0x00000300, 0x00080200,
|
||||||
0x00080300L, 0x01000200L, 0x01000300L, 0x01080200L, 0x01080300L,
|
0x00080300, 0x01000200, 0x01000300, 0x01080200, 0x01080300,
|
||||||
0x00000210L, 0x00000310L, 0x00080210L, 0x00080310L, 0x01000210L,
|
0x00000210, 0x00000310, 0x00080210, 0x00080310, 0x01000210,
|
||||||
0x01000310L, 0x01080210L, 0x01080310L, 0x00200200L, 0x00200300L,
|
0x01000310, 0x01080210, 0x01080310, 0x00200200, 0x00200300,
|
||||||
0x00280200L, 0x00280300L, 0x01200200L, 0x01200300L, 0x01280200L,
|
0x00280200, 0x00280300, 0x01200200, 0x01200300, 0x01280200,
|
||||||
0x01280300L, 0x00200210L, 0x00200310L, 0x00280210L, 0x00280310L,
|
0x01280300, 0x00200210, 0x00200310, 0x00280210, 0x00280310,
|
||||||
0x01200210L, 0x01200310L, 0x01280210L, 0x01280310L, },
|
0x01200210, 0x01200310, 0x01280210, 0x01280310, },
|
||||||
{ // for D bits (numbered as per FIPS 46) 22 23 24 25 27 28
|
{ // for D bits (numbered as per FIPS 46) 22 23 24 25 27 28
|
||||||
0x00000000L, 0x04000000L, 0x00040000L, 0x04040000L, 0x00000002L,
|
0x00000000, 0x04000000, 0x00040000, 0x04040000, 0x00000002,
|
||||||
0x04000002L, 0x00040002L, 0x04040002L, 0x00002000L, 0x04002000L,
|
0x04000002, 0x00040002, 0x04040002, 0x00002000, 0x04002000,
|
||||||
0x00042000L, 0x04042000L, 0x00002002L, 0x04002002L, 0x00042002L,
|
0x00042000, 0x04042000, 0x00002002, 0x04002002, 0x00042002,
|
||||||
0x04042002L, 0x00000020L, 0x04000020L, 0x00040020L, 0x04040020L,
|
0x04042002, 0x00000020, 0x04000020, 0x00040020, 0x04040020,
|
||||||
0x00000022L, 0x04000022L, 0x00040022L, 0x04040022L, 0x00002020L,
|
0x00000022, 0x04000022, 0x00040022, 0x04040022, 0x00002020,
|
||||||
0x04002020L, 0x00042020L, 0x04042020L, 0x00002022L, 0x04002022L,
|
0x04002020, 0x00042020, 0x04042020, 0x00002022, 0x04002022,
|
||||||
0x00042022L, 0x04042022L, 0x00000800L, 0x04000800L, 0x00040800L,
|
0x00042022, 0x04042022, 0x00000800, 0x04000800, 0x00040800,
|
||||||
0x04040800L, 0x00000802L, 0x04000802L, 0x00040802L, 0x04040802L,
|
0x04040800, 0x00000802, 0x04000802, 0x00040802, 0x04040802,
|
||||||
0x00002800L, 0x04002800L, 0x00042800L, 0x04042800L, 0x00002802L,
|
0x00002800, 0x04002800, 0x00042800, 0x04042800, 0x00002802,
|
||||||
0x04002802L, 0x00042802L, 0x04042802L, 0x00000820L, 0x04000820L,
|
0x04002802, 0x00042802, 0x04042802, 0x00000820, 0x04000820,
|
||||||
0x00040820L, 0x04040820L, 0x00000822L, 0x04000822L, 0x00040822L,
|
0x00040820, 0x04040820, 0x00000822, 0x04000822, 0x00040822,
|
||||||
0x04040822L, 0x00002820L, 0x04002820L, 0x00042820L, 0x04042820L,
|
0x04040822, 0x00002820, 0x04002820, 0x00042820, 0x04042820,
|
||||||
0x00002822L, 0x04002822L, 0x00042822L, 0x04042822L, }};
|
0x00002822, 0x04002822, 0x00042822, 0x04042822, }};
|
||||||
|
|
||||||
static const uint32_t DES_SPtrans[8][64] = {
|
static const uint32_t DES_SPtrans[8][64] = {
|
||||||
{ // nibble 0
|
{ // nibble 0
|
||||||
0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, 0x02000000L,
|
0x02080800, 0x00080000, 0x02000002, 0x02080802, 0x02000000,
|
||||||
0x00080802L, 0x00080002L, 0x02000002L, 0x00080802L, 0x02080800L,
|
0x00080802, 0x00080002, 0x02000002, 0x00080802, 0x02080800,
|
||||||
0x02080000L, 0x00000802L, 0x02000802L, 0x02000000L, 0x00000000L,
|
0x02080000, 0x00000802, 0x02000802, 0x02000000, 0x00000000,
|
||||||
0x00080002L, 0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L,
|
0x00080002, 0x00080000, 0x00000002, 0x02000800, 0x00080800,
|
||||||
0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L, 0x00000002L,
|
0x02080802, 0x02080000, 0x00000802, 0x02000800, 0x00000002,
|
||||||
0x00000800L, 0x00080800L, 0x02080002L, 0x00000800L, 0x02000802L,
|
0x00000800, 0x00080800, 0x02080002, 0x00000800, 0x02000802,
|
||||||
0x02080002L, 0x00000000L, 0x00000000L, 0x02080802L, 0x02000800L,
|
0x02080002, 0x00000000, 0x00000000, 0x02080802, 0x02000800,
|
||||||
0x00080002L, 0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L,
|
0x00080002, 0x02080800, 0x00080000, 0x00000802, 0x02000800,
|
||||||
0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L, 0x00080802L,
|
0x02080002, 0x00000800, 0x00080800, 0x02000002, 0x00080802,
|
||||||
0x00000002L, 0x02000002L, 0x02080000L, 0x02080802L, 0x00080800L,
|
0x00000002, 0x02000002, 0x02080000, 0x02080802, 0x00080800,
|
||||||
0x02080000L, 0x02000802L, 0x02000000L, 0x00000802L, 0x00080002L,
|
0x02080000, 0x02000802, 0x02000000, 0x00000802, 0x00080002,
|
||||||
0x00000000L, 0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L,
|
0x00000000, 0x00080000, 0x02000000, 0x02000802, 0x02080800,
|
||||||
0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L, },
|
0x00000002, 0x02080002, 0x00000800, 0x00080802, },
|
||||||
{ // nibble 1
|
{ // nibble 1
|
||||||
0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L, 0x40000010L,
|
0x40108010, 0x00000000, 0x00108000, 0x40100000, 0x40000010,
|
||||||
0x00008010L, 0x40008000L, 0x00108000L, 0x00008000L, 0x40100010L,
|
0x00008010, 0x40008000, 0x00108000, 0x00008000, 0x40100010,
|
||||||
0x00000010L, 0x40008000L, 0x00100010L, 0x40108000L, 0x40100000L,
|
0x00000010, 0x40008000, 0x00100010, 0x40108000, 0x40100000,
|
||||||
0x00000010L, 0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L,
|
0x00000010, 0x00100000, 0x40008010, 0x40100010, 0x00008000,
|
||||||
0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L, 0x40008010L,
|
0x00108010, 0x40000000, 0x00000000, 0x00100010, 0x40008010,
|
||||||
0x00108010L, 0x40108000L, 0x40000010L, 0x40000000L, 0x00100000L,
|
0x00108010, 0x40108000, 0x40000010, 0x40000000, 0x00100000,
|
||||||
0x00008010L, 0x40108010L, 0x00100010L, 0x40108000L, 0x40008000L,
|
0x00008010, 0x40108010, 0x00100010, 0x40108000, 0x40008000,
|
||||||
0x00108010L, 0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L,
|
0x00108010, 0x40108010, 0x00100010, 0x40000010, 0x00000000,
|
||||||
0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L, 0x00008000L,
|
0x40000000, 0x00008010, 0x00100000, 0x40100010, 0x00008000,
|
||||||
0x40000000L, 0x00108010L, 0x40008010L, 0x40108000L, 0x00008000L,
|
0x40000000, 0x00108010, 0x40008010, 0x40108000, 0x00008000,
|
||||||
0x00000000L, 0x40000010L, 0x00000010L, 0x40108010L, 0x00108000L,
|
0x00000000, 0x40000010, 0x00000010, 0x40108010, 0x00108000,
|
||||||
0x40100000L, 0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L,
|
0x40100000, 0x40100010, 0x00100000, 0x00008010, 0x40008000,
|
||||||
0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L, },
|
0x40008010, 0x00000010, 0x40100000, 0x00108000, },
|
||||||
{ // nibble 2
|
{ // nibble 2
|
||||||
0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L, 0x00040001L,
|
0x04000001, 0x04040100, 0x00000100, 0x04000101, 0x00040001,
|
||||||
0x04000000L, 0x04000101L, 0x00040100L, 0x04000100L, 0x00040000L,
|
0x04000000, 0x04000101, 0x00040100, 0x04000100, 0x00040000,
|
||||||
0x04040000L, 0x00000001L, 0x04040101L, 0x00000101L, 0x00000001L,
|
0x04040000, 0x00000001, 0x04040101, 0x00000101, 0x00000001,
|
||||||
0x04040001L, 0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L,
|
0x04040001, 0x00000000, 0x00040001, 0x04040100, 0x00000100,
|
||||||
0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L, 0x04040001L,
|
0x00000101, 0x04040101, 0x00040000, 0x04000001, 0x04040001,
|
||||||
0x04000100L, 0x00040101L, 0x04040000L, 0x00040100L, 0x00000000L,
|
0x04000100, 0x00040101, 0x04040000, 0x00040100, 0x00000000,
|
||||||
0x04000000L, 0x00040101L, 0x04040100L, 0x00000100L, 0x00000001L,
|
0x04000000, 0x00040101, 0x04040100, 0x00000100, 0x00000001,
|
||||||
0x00040000L, 0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L,
|
0x00040000, 0x00000101, 0x00040001, 0x04040000, 0x04000101,
|
||||||
0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L, 0x00040001L,
|
0x00000000, 0x04040100, 0x00040100, 0x04040001, 0x00040001,
|
||||||
0x04000000L, 0x04040101L, 0x00000001L, 0x00040101L, 0x04000001L,
|
0x04000000, 0x04040101, 0x00000001, 0x00040101, 0x04000001,
|
||||||
0x04000000L, 0x04040101L, 0x00040000L, 0x04000100L, 0x04000101L,
|
0x04000000, 0x04040101, 0x00040000, 0x04000100, 0x04000101,
|
||||||
0x00040100L, 0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L,
|
0x00040100, 0x04000100, 0x00000000, 0x04040001, 0x00000101,
|
||||||
0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L, },
|
0x04000001, 0x00040101, 0x00000100, 0x04040000, },
|
||||||
{ // nibble 3
|
{ // nibble 3
|
||||||
0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L, 0x00000000L,
|
0x00401008, 0x10001000, 0x00000008, 0x10401008, 0x00000000,
|
||||||
0x10400000L, 0x10001008L, 0x00400008L, 0x10401000L, 0x10000008L,
|
0x10400000, 0x10001008, 0x00400008, 0x10401000, 0x10000008,
|
||||||
0x10000000L, 0x00001008L, 0x10000008L, 0x00401008L, 0x00400000L,
|
0x10000000, 0x00001008, 0x10000008, 0x00401008, 0x00400000,
|
||||||
0x10000000L, 0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L,
|
0x10000000, 0x10400008, 0x00401000, 0x00001000, 0x00000008,
|
||||||
0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L, 0x00001008L,
|
0x00401000, 0x10001008, 0x10400000, 0x00001000, 0x00001008,
|
||||||
0x00000000L, 0x00400008L, 0x10401000L, 0x10001000L, 0x10400008L,
|
0x00000000, 0x00400008, 0x10401000, 0x10001000, 0x10400008,
|
||||||
0x10401008L, 0x00400000L, 0x10400008L, 0x00001008L, 0x00400000L,
|
0x10401008, 0x00400000, 0x10400008, 0x00001008, 0x00400000,
|
||||||
0x10000008L, 0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L,
|
0x10000008, 0x00401000, 0x10001000, 0x00000008, 0x10400000,
|
||||||
0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L, 0x00000000L,
|
0x10001008, 0x00000000, 0x00001000, 0x00400008, 0x00000000,
|
||||||
0x10400008L, 0x10401000L, 0x00001000L, 0x10000000L, 0x10401008L,
|
0x10400008, 0x10401000, 0x00001000, 0x10000000, 0x10401008,
|
||||||
0x00401008L, 0x00400000L, 0x10401008L, 0x00000008L, 0x10001000L,
|
0x00401008, 0x00400000, 0x10401008, 0x00000008, 0x10001000,
|
||||||
0x00401008L, 0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L,
|
0x00401008, 0x00400008, 0x00401000, 0x10400000, 0x10001008,
|
||||||
0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L, },
|
0x00001008, 0x10000000, 0x10000008, 0x10401000, },
|
||||||
{ // nibble 4
|
{ // nibble 4
|
||||||
0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L, 0x08010020L,
|
0x08000000, 0x00010000, 0x00000400, 0x08010420, 0x08010020,
|
||||||
0x08000400L, 0x00010420L, 0x08010000L, 0x00010000L, 0x00000020L,
|
0x08000400, 0x00010420, 0x08010000, 0x00010000, 0x00000020,
|
||||||
0x08000020L, 0x00010400L, 0x08000420L, 0x08010020L, 0x08010400L,
|
0x08000020, 0x00010400, 0x08000420, 0x08010020, 0x08010400,
|
||||||
0x00000000L, 0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L,
|
0x00000000, 0x00010400, 0x08000000, 0x00010020, 0x00000420,
|
||||||
0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L, 0x00000020L,
|
0x08000400, 0x00010420, 0x00000000, 0x08000020, 0x00000020,
|
||||||
0x08000420L, 0x08010420L, 0x00010020L, 0x08010000L, 0x00000400L,
|
0x08000420, 0x08010420, 0x00010020, 0x08010000, 0x00000400,
|
||||||
0x00000420L, 0x08010400L, 0x08010400L, 0x08000420L, 0x00010020L,
|
0x00000420, 0x08010400, 0x08010400, 0x08000420, 0x00010020,
|
||||||
0x08010000L, 0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L,
|
0x08010000, 0x00010000, 0x00000020, 0x08000020, 0x08000400,
|
||||||
0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L, 0x00010420L,
|
0x08000000, 0x00010400, 0x08010420, 0x00000000, 0x00010420,
|
||||||
0x08000000L, 0x00000400L, 0x00010020L, 0x08000420L, 0x00000400L,
|
0x08000000, 0x00000400, 0x00010020, 0x08000420, 0x00000400,
|
||||||
0x00000000L, 0x08010420L, 0x08010020L, 0x08010400L, 0x00000420L,
|
0x00000000, 0x08010420, 0x08010020, 0x08010400, 0x00000420,
|
||||||
0x00010000L, 0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L,
|
0x00010000, 0x00010400, 0x08010020, 0x08000400, 0x00000420,
|
||||||
0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L, },
|
0x00000020, 0x00010420, 0x08010000, 0x08000020, },
|
||||||
{ // nibble 5
|
{ // nibble 5
|
||||||
0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L, 0x00200040L,
|
0x80000040, 0x00200040, 0x00000000, 0x80202000, 0x00200040,
|
||||||
0x00002000L, 0x80002040L, 0x00200000L, 0x00002040L, 0x80202040L,
|
0x00002000, 0x80002040, 0x00200000, 0x00002040, 0x80202040,
|
||||||
0x00202000L, 0x80000000L, 0x80002000L, 0x80000040L, 0x80200000L,
|
0x00202000, 0x80000000, 0x80002000, 0x80000040, 0x80200000,
|
||||||
0x00202040L, 0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L,
|
0x00202040, 0x00200000, 0x80002040, 0x80200040, 0x00000000,
|
||||||
0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L, 0x80202040L,
|
0x00002000, 0x00000040, 0x80202000, 0x80200040, 0x80202040,
|
||||||
0x80200000L, 0x80000000L, 0x00002040L, 0x00000040L, 0x00202000L,
|
0x80200000, 0x80000000, 0x00002040, 0x00000040, 0x00202000,
|
||||||
0x00202040L, 0x80002000L, 0x00002040L, 0x80000000L, 0x80002000L,
|
0x00202040, 0x80002000, 0x00002040, 0x80000000, 0x80002000,
|
||||||
0x00202040L, 0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L,
|
0x00202040, 0x80202000, 0x00200040, 0x00000000, 0x80002000,
|
||||||
0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L, 0x00200040L,
|
0x80000000, 0x00002000, 0x80200040, 0x00200000, 0x00200040,
|
||||||
0x80202040L, 0x00202000L, 0x00000040L, 0x80202040L, 0x00202000L,
|
0x80202040, 0x00202000, 0x00000040, 0x80202040, 0x00202000,
|
||||||
0x00200000L, 0x80002040L, 0x80000040L, 0x80200000L, 0x00202040L,
|
0x00200000, 0x80002040, 0x80000040, 0x80200000, 0x00202040,
|
||||||
0x00000000L, 0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L,
|
0x00000000, 0x00002000, 0x80000040, 0x80002040, 0x80202000,
|
||||||
0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L, },
|
0x80200000, 0x00002040, 0x00000040, 0x80200040, },
|
||||||
{ // nibble 6
|
{ // nibble 6
|
||||||
0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L, 0x01004204L,
|
0x00004000, 0x00000200, 0x01000200, 0x01000004, 0x01004204,
|
||||||
0x00004004L, 0x00004200L, 0x00000000L, 0x01000000L, 0x01000204L,
|
0x00004004, 0x00004200, 0x00000000, 0x01000000, 0x01000204,
|
||||||
0x00000204L, 0x01004000L, 0x00000004L, 0x01004200L, 0x01004000L,
|
0x00000204, 0x01004000, 0x00000004, 0x01004200, 0x01004000,
|
||||||
0x00000204L, 0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L,
|
0x00000204, 0x01000204, 0x00004000, 0x00004004, 0x01004204,
|
||||||
0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L, 0x01004004L,
|
0x00000000, 0x01000200, 0x01000004, 0x00004200, 0x01004004,
|
||||||
0x00004204L, 0x01004200L, 0x00000004L, 0x00004204L, 0x01004004L,
|
0x00004204, 0x01004200, 0x00000004, 0x00004204, 0x01004004,
|
||||||
0x00000200L, 0x01000000L, 0x00004204L, 0x01004000L, 0x01004004L,
|
0x00000200, 0x01000000, 0x00004204, 0x01004000, 0x01004004,
|
||||||
0x00000204L, 0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L,
|
0x00000204, 0x00004000, 0x00000200, 0x01000000, 0x01004004,
|
||||||
0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L, 0x00000200L,
|
0x01000204, 0x00004204, 0x00004200, 0x00000000, 0x00000200,
|
||||||
0x01000004L, 0x00000004L, 0x01000200L, 0x00000000L, 0x01000204L,
|
0x01000004, 0x00000004, 0x01000200, 0x00000000, 0x01000204,
|
||||||
0x01000200L, 0x00004200L, 0x00000204L, 0x00004000L, 0x01004204L,
|
0x01000200, 0x00004200, 0x00000204, 0x00004000, 0x01004204,
|
||||||
0x01000000L, 0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L,
|
0x01000000, 0x01004200, 0x00000004, 0x00004004, 0x01004204,
|
||||||
0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L, },
|
0x01000004, 0x01004200, 0x01004000, 0x00004004, },
|
||||||
{ // nibble 7
|
{ // nibble 7
|
||||||
0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L, 0x20020000L,
|
0x20800080, 0x20820000, 0x00020080, 0x00000000, 0x20020000,
|
||||||
0x00800080L, 0x20800000L, 0x20820080L, 0x00000080L, 0x20000000L,
|
0x00800080, 0x20800000, 0x20820080, 0x00000080, 0x20000000,
|
||||||
0x00820000L, 0x00020080L, 0x00820080L, 0x20020080L, 0x20000080L,
|
0x00820000, 0x00020080, 0x00820080, 0x20020080, 0x20000080,
|
||||||
0x20800000L, 0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L,
|
0x20800000, 0x00020000, 0x00820080, 0x00800080, 0x20020000,
|
||||||
0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L, 0x20000000L,
|
0x20820080, 0x20000080, 0x00000000, 0x00820000, 0x20000000,
|
||||||
0x00800000L, 0x20020080L, 0x20800080L, 0x00800000L, 0x00020000L,
|
0x00800000, 0x20020080, 0x20800080, 0x00800000, 0x00020000,
|
||||||
0x20820000L, 0x00000080L, 0x00800000L, 0x00020000L, 0x20000080L,
|
0x20820000, 0x00000080, 0x00800000, 0x00020000, 0x20000080,
|
||||||
0x20820080L, 0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L,
|
0x20820080, 0x00020080, 0x20000000, 0x00000000, 0x00820000,
|
||||||
0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L, 0x20820000L,
|
0x20800080, 0x20020080, 0x20020000, 0x00800080, 0x20820000,
|
||||||
0x00000080L, 0x00800080L, 0x20020000L, 0x20820080L, 0x00800000L,
|
0x00000080, 0x00800080, 0x20020000, 0x20820080, 0x00800000,
|
||||||
0x20800000L, 0x20000080L, 0x00820000L, 0x00020080L, 0x20020080L,
|
0x20800000, 0x20000080, 0x00820000, 0x00020080, 0x20020080,
|
||||||
0x20800000L, 0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L,
|
0x20800000, 0x00000080, 0x20820000, 0x00820080, 0x00000000,
|
||||||
0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, }};
|
0x20000000, 0x20800080, 0x00020000, 0x00820080, }};
|
||||||
|
|
||||||
#define HPERM_OP(a, t, n, m) \
|
#define HPERM_OP(a, t, n, m) \
|
||||||
((t) = ((((a) << (16 - (n))) ^ (a)) & (m)), \
|
((t) = ((((a) << (16 - (n))) ^ (a)) & (m)), \
|
||||||
@@ -308,43 +308,43 @@ void DES_set_key(const DES_cblock *key, DES_key_schedule *schedule) {
|
|||||||
// do PC1 in 47 simple operations :-)
|
// do PC1 in 47 simple operations :-)
|
||||||
// Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov)
|
// Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov)
|
||||||
// for the inspiration. :-)
|
// for the inspiration. :-)
|
||||||
PERM_OP(d, c, t, 4, 0x0f0f0f0fL);
|
PERM_OP(d, c, t, 4, 0x0f0f0f0f);
|
||||||
HPERM_OP(c, t, -2, 0xcccc0000L);
|
HPERM_OP(c, t, -2, 0xcccc0000);
|
||||||
HPERM_OP(d, t, -2, 0xcccc0000L);
|
HPERM_OP(d, t, -2, 0xcccc0000);
|
||||||
PERM_OP(d, c, t, 1, 0x55555555L);
|
PERM_OP(d, c, t, 1, 0x55555555);
|
||||||
PERM_OP(c, d, t, 8, 0x00ff00ffL);
|
PERM_OP(c, d, t, 8, 0x00ff00ff);
|
||||||
PERM_OP(d, c, t, 1, 0x55555555L);
|
PERM_OP(d, c, t, 1, 0x55555555);
|
||||||
d = (((d & 0x000000ffL) << 16L) | (d & 0x0000ff00L) |
|
d = (((d & 0x000000ff) << 16) | (d & 0x0000ff00) |
|
||||||
((d & 0x00ff0000L) >> 16L) | ((c & 0xf0000000L) >> 4L));
|
((d & 0x00ff0000) >> 16) | ((c & 0xf0000000) >> 4));
|
||||||
c &= 0x0fffffffL;
|
c &= 0x0fffffff;
|
||||||
|
|
||||||
for (i = 0; i < ITERATIONS; i++) {
|
for (i = 0; i < ITERATIONS; i++) {
|
||||||
if (shifts2[i]) {
|
if (shifts2[i]) {
|
||||||
c = ((c >> 2L) | (c << 26L));
|
c = ((c >> 2) | (c << 26));
|
||||||
d = ((d >> 2L) | (d << 26L));
|
d = ((d >> 2) | (d << 26));
|
||||||
} else {
|
} else {
|
||||||
c = ((c >> 1L) | (c << 27L));
|
c = ((c >> 1) | (c << 27));
|
||||||
d = ((d >> 1L) | (d << 27L));
|
d = ((d >> 1) | (d << 27));
|
||||||
}
|
}
|
||||||
c &= 0x0fffffffL;
|
c &= 0x0fffffff;
|
||||||
d &= 0x0fffffffL;
|
d &= 0x0fffffff;
|
||||||
// could be a few less shifts but I am to lazy at this
|
// could be a few less shifts but I am to lazy at this
|
||||||
// point in time to investigate
|
// point in time to investigate
|
||||||
s = des_skb[0][(c) & 0x3f] |
|
s = des_skb[0][(c) & 0x3f] |
|
||||||
des_skb[1][((c >> 6L) & 0x03) | ((c >> 7L) & 0x3c)] |
|
des_skb[1][((c >> 6) & 0x03) | ((c >> 7) & 0x3c)] |
|
||||||
des_skb[2][((c >> 13L) & 0x0f) | ((c >> 14L) & 0x30)] |
|
des_skb[2][((c >> 13) & 0x0f) | ((c >> 14) & 0x30)] |
|
||||||
des_skb[3][((c >> 20L) & 0x01) | ((c >> 21L) & 0x06) |
|
des_skb[3][((c >> 20) & 0x01) | ((c >> 21) & 0x06) |
|
||||||
((c >> 22L) & 0x38)];
|
((c >> 22) & 0x38)];
|
||||||
t = des_skb[4][(d) & 0x3f] |
|
t = des_skb[4][(d) & 0x3f] |
|
||||||
des_skb[5][((d >> 7L) & 0x03) | ((d >> 8L) & 0x3c)] |
|
des_skb[5][((d >> 7) & 0x03) | ((d >> 8) & 0x3c)] |
|
||||||
des_skb[6][(d >> 15L) & 0x3f] |
|
des_skb[6][(d >> 15) & 0x3f] |
|
||||||
des_skb[7][((d >> 21L) & 0x0f) | ((d >> 22L) & 0x30)];
|
des_skb[7][((d >> 21) & 0x0f) | ((d >> 22) & 0x30)];
|
||||||
|
|
||||||
// table contained 0213 4657
|
// table contained 0213 4657
|
||||||
t2 = ((t << 16L) | (s & 0x0000ffffL)) & 0xffffffffL;
|
t2 = ((t << 16) | (s & 0x0000ffff)) & 0xffffffff;
|
||||||
schedule->subkeys[i][0] = CRYPTO_rotr_u32(t2, 30);
|
schedule->subkeys[i][0] = CRYPTO_rotr_u32(t2, 30);
|
||||||
|
|
||||||
t2 = ((s >> 16L) | (t & 0xffff0000L));
|
t2 = ((s >> 16) | (t & 0xffff0000));
|
||||||
schedule->subkeys[i][1] = CRYPTO_rotr_u32(t2, 26);
|
schedule->subkeys[i][1] = CRYPTO_rotr_u32(t2, 26);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,9 +67,9 @@
|
|||||||
#include "../internal.h"
|
#include "../internal.h"
|
||||||
|
|
||||||
|
|
||||||
static const unsigned kParametersTag =
|
static const CBS_ASN1_TAG kParametersTag =
|
||||||
CBS_ASN1_CONSTRUCTED | CBS_ASN1_CONTEXT_SPECIFIC | 0;
|
CBS_ASN1_CONSTRUCTED | CBS_ASN1_CONTEXT_SPECIFIC | 0;
|
||||||
static const unsigned kPublicKeyTag =
|
static const CBS_ASN1_TAG kPublicKeyTag =
|
||||||
CBS_ASN1_CONSTRUCTED | CBS_ASN1_CONTEXT_SPECIFIC | 1;
|
CBS_ASN1_CONSTRUCTED | CBS_ASN1_CONTEXT_SPECIFIC | 1;
|
||||||
|
|
||||||
EC_KEY *EC_KEY_parse_private_key(CBS *cbs, const EC_GROUP *group) {
|
EC_KEY *EC_KEY_parse_private_key(CBS *cbs, const EC_GROUP *group) {
|
||||||
@@ -518,42 +518,18 @@ EC_KEY *o2i_ECPublicKey(EC_KEY **keyp, const uint8_t **inp, long len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int i2o_ECPublicKey(const EC_KEY *key, uint8_t **outp) {
|
int i2o_ECPublicKey(const EC_KEY *key, uint8_t **outp) {
|
||||||
size_t buf_len = 0;
|
|
||||||
int new_buffer = 0;
|
|
||||||
|
|
||||||
if (key == NULL) {
|
if (key == NULL) {
|
||||||
OPENSSL_PUT_ERROR(EC, ERR_R_PASSED_NULL_PARAMETER);
|
OPENSSL_PUT_ERROR(EC, ERR_R_PASSED_NULL_PARAMETER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
CBB cbb;
|
||||||
buf_len = EC_POINT_point2oct(key->group, key->pub_key, key->conv_form, NULL,
|
if (!CBB_init(&cbb, 0) || //
|
||||||
0, NULL);
|
!EC_POINT_point2cbb(&cbb, key->group, key->pub_key, key->conv_form,
|
||||||
|
NULL)) {
|
||||||
if (outp == NULL || buf_len == 0) {
|
CBB_cleanup(&cbb);
|
||||||
// out == NULL => just return the length of the octet string
|
return -1;
|
||||||
return buf_len;
|
|
||||||
}
|
}
|
||||||
|
int ret = CBB_finish_i2d(&cbb, outp);
|
||||||
if (*outp == NULL) {
|
// Historically, this function used the wrong return value on error.
|
||||||
*outp = OPENSSL_malloc(buf_len);
|
return ret > 0 ? ret : 0;
|
||||||
if (*outp == NULL) {
|
|
||||||
OPENSSL_PUT_ERROR(EC, ERR_R_MALLOC_FAILURE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
new_buffer = 1;
|
|
||||||
}
|
|
||||||
if (!EC_POINT_point2oct(key->group, key->pub_key, key->conv_form, *outp,
|
|
||||||
buf_len, NULL)) {
|
|
||||||
OPENSSL_PUT_ERROR(EC, ERR_R_EC_LIB);
|
|
||||||
if (new_buffer) {
|
|
||||||
OPENSSL_free(*outp);
|
|
||||||
*outp = NULL;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!new_buffer) {
|
|
||||||
*outp += buf_len;
|
|
||||||
}
|
|
||||||
return buf_len;
|
|
||||||
}
|
}
|
||||||
@@ -167,10 +167,21 @@ int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Once set, parameters may not change.
|
||||||
|
if (!EVP_PKEY_missing_parameters(to)) {
|
||||||
|
if (EVP_PKEY_cmp_parameters(to, from) == 1) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
OPENSSL_PUT_ERROR(EVP, EVP_R_DIFFERENT_PARAMETERS);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (from->ameth && from->ameth->param_copy) {
|
if (from->ameth && from->ameth->param_copy) {
|
||||||
return from->ameth->param_copy(to, from);
|
return from->ameth->param_copy(to, from);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(https://crbug.com/boringssl/536): If the algorithm takes no
|
||||||
|
// parameters, copying them should vacuously succeed.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,6 +430,8 @@ int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) {
|
|||||||
if (a->ameth && a->ameth->param_cmp) {
|
if (a->ameth && a->ameth->param_cmp) {
|
||||||
return a->ameth->param_cmp(a, b);
|
return a->ameth->param_cmp(a, b);
|
||||||
}
|
}
|
||||||
|
// TODO(https://crbug.com/boringssl/536): If the algorithm doesn't use
|
||||||
|
// parameters, they should compare as vacuously equal.
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ static int ec_bits(const EVP_PKEY *pkey) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ec_missing_parameters(const EVP_PKEY *pkey) {
|
static int ec_missing_parameters(const EVP_PKEY *pkey) {
|
||||||
return EC_KEY_get0_group(pkey->pkey.ec) == NULL;
|
return pkey->pkey.ec == NULL || EC_KEY_get0_group(pkey->pkey.ec) == NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ec_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) {
|
static int ec_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) {
|
||||||
@@ -239,8 +239,14 @@ static int ec_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ec_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) {
|
static int ec_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) {
|
||||||
|
if (a->pkey.ec == NULL || b->pkey.ec == NULL) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec),
|
const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec),
|
||||||
*group_b = EC_KEY_get0_group(b->pkey.ec);
|
*group_b = EC_KEY_get0_group(b->pkey.ec);
|
||||||
|
if (group_a == NULL || group_b == NULL) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
if (EC_GROUP_cmp(group_a, group_b, NULL) != 0) {
|
if (EC_GROUP_cmp(group_a, group_b, NULL) != 0) {
|
||||||
// mismatch
|
// mismatch
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -109,6 +109,8 @@
|
|||||||
#include <CCryptoBoringSSL_ex_data.h>
|
#include <CCryptoBoringSSL_ex_data.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <CCryptoBoringSSL_crypto.h>
|
#include <CCryptoBoringSSL_crypto.h>
|
||||||
@@ -149,24 +151,41 @@ int CRYPTO_get_ex_new_index(CRYPTO_EX_DATA_CLASS *ex_data_class, int *out_index,
|
|||||||
ex_data_class->meth = sk_CRYPTO_EX_DATA_FUNCS_new_null();
|
ex_data_class->meth = sk_CRYPTO_EX_DATA_FUNCS_new_null();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ex_data_class->meth == NULL ||
|
if (ex_data_class->meth == NULL) {
|
||||||
!sk_CRYPTO_EX_DATA_FUNCS_push(ex_data_class->meth, funcs)) {
|
|
||||||
OPENSSL_PUT_ERROR(CRYPTO, ERR_R_MALLOC_FAILURE);
|
OPENSSL_PUT_ERROR(CRYPTO, ERR_R_MALLOC_FAILURE);
|
||||||
OPENSSL_free(funcs);
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_index = sk_CRYPTO_EX_DATA_FUNCS_num(ex_data_class->meth) - 1 +
|
// The index must fit in |int|.
|
||||||
|
if (sk_CRYPTO_EX_DATA_FUNCS_num(ex_data_class->meth) >
|
||||||
|
(size_t)(INT_MAX - ex_data_class->num_reserved)) {
|
||||||
|
OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sk_CRYPTO_EX_DATA_FUNCS_push(ex_data_class->meth, funcs)) {
|
||||||
|
OPENSSL_PUT_ERROR(CRYPTO, ERR_R_MALLOC_FAILURE);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
funcs = NULL; // |sk_CRYPTO_EX_DATA_FUNCS_push| takes ownership.
|
||||||
|
|
||||||
|
*out_index = (int)sk_CRYPTO_EX_DATA_FUNCS_num(ex_data_class->meth) - 1 +
|
||||||
ex_data_class->num_reserved;
|
ex_data_class->num_reserved;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
CRYPTO_STATIC_MUTEX_unlock_write(&ex_data_class->lock);
|
CRYPTO_STATIC_MUTEX_unlock_write(&ex_data_class->lock);
|
||||||
|
OPENSSL_free(funcs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int index, void *val) {
|
int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int index, void *val) {
|
||||||
int n, i;
|
if (index < 0) {
|
||||||
|
// A caller that can accidentally pass in an invalid index into this
|
||||||
|
// function will hit an memory error if |index| happened to be valid, and
|
||||||
|
// expected |val| to be of a different type.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
if (ad->sk == NULL) {
|
if (ad->sk == NULL) {
|
||||||
ad->sk = sk_void_new_null();
|
ad->sk = sk_void_new_null();
|
||||||
@@ -176,17 +195,15 @@ int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int index, void *val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
n = sk_void_num(ad->sk);
|
|
||||||
|
|
||||||
// Add NULL values until the stack is long enough.
|
// Add NULL values until the stack is long enough.
|
||||||
for (i = n; i <= index; i++) {
|
for (size_t i = sk_void_num(ad->sk); i <= (size_t)index; i++) {
|
||||||
if (!sk_void_push(ad->sk, NULL)) {
|
if (!sk_void_push(ad->sk, NULL)) {
|
||||||
OPENSSL_PUT_ERROR(CRYPTO, ERR_R_MALLOC_FAILURE);
|
OPENSSL_PUT_ERROR(CRYPTO, ERR_R_MALLOC_FAILURE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_void_set(ad->sk, index, val);
|
sk_void_set(ad->sk, (size_t)index, val);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +259,10 @@ void CRYPTO_free_ex_data(CRYPTO_EX_DATA_CLASS *ex_data_class, void *obj,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < sk_CRYPTO_EX_DATA_FUNCS_num(func_pointers); i++) {
|
// |CRYPTO_get_ex_new_index| will not allocate indices beyond |INT_MAX|.
|
||||||
|
assert(sk_CRYPTO_EX_DATA_FUNCS_num(func_pointers) <=
|
||||||
|
(size_t)(INT_MAX - ex_data_class->num_reserved));
|
||||||
|
for (int i = 0; i < (int)sk_CRYPTO_EX_DATA_FUNCS_num(func_pointers); i++) {
|
||||||
CRYPTO_EX_DATA_FUNCS *func_pointer =
|
CRYPTO_EX_DATA_FUNCS *func_pointer =
|
||||||
sk_CRYPTO_EX_DATA_FUNCS_value(func_pointers, i);
|
sk_CRYPTO_EX_DATA_FUNCS_value(func_pointers, i);
|
||||||
if (func_pointer->free_func) {
|
if (func_pointer->free_func) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -307,6 +307,9 @@ _aesni_ctr32_ghash_6x:
|
|||||||
vpaddb %xmm2,%xmm1,%xmm0
|
vpaddb %xmm2,%xmm1,%xmm0
|
||||||
movq %r13,112+8(%rsp)
|
movq %r13,112+8(%rsp)
|
||||||
leaq 96(%rdi),%rdi
|
leaq 96(%rdi),%rdi
|
||||||
|
|
||||||
|
prefetcht0 512(%rdi)
|
||||||
|
prefetcht0 576(%rdi)
|
||||||
vaesenclast %xmm5,%xmm11,%xmm11
|
vaesenclast %xmm5,%xmm11,%xmm11
|
||||||
vpaddb %xmm2,%xmm0,%xmm5
|
vpaddb %xmm2,%xmm0,%xmm5
|
||||||
movq %r12,120+8(%rsp)
|
movq %r12,120+8(%rsp)
|
||||||
@@ -851,7 +854,10 @@ aesni_gcm_encrypt:
|
|||||||
.byte 65,69,83,45,78,73,32,71,67,77,32,109,111,100,117,108,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 65,69,83,45,78,73,32,71,67,77,32,109,111,100,117,108,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.align 64
|
.align 64
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__linux__)
|
#endif // defined(__x86_64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -307,6 +307,9 @@ L$enc_tail:
|
|||||||
vpaddb %xmm2,%xmm1,%xmm0
|
vpaddb %xmm2,%xmm1,%xmm0
|
||||||
movq %r13,112+8(%rsp)
|
movq %r13,112+8(%rsp)
|
||||||
leaq 96(%rdi),%rdi
|
leaq 96(%rdi),%rdi
|
||||||
|
|
||||||
|
prefetcht0 512(%rdi)
|
||||||
|
prefetcht0 576(%rdi)
|
||||||
vaesenclast %xmm5,%xmm11,%xmm11
|
vaesenclast %xmm5,%xmm11,%xmm11
|
||||||
vpaddb %xmm2,%xmm0,%xmm5
|
vpaddb %xmm2,%xmm0,%xmm5
|
||||||
movq %r12,120+8(%rsp)
|
movq %r12,120+8(%rsp)
|
||||||
@@ -850,6 +853,10 @@ L$one_lsb:
|
|||||||
.byte 65,69,83,45,78,73,32,71,67,77,32,109,111,100,117,108,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 65,69,83,45,78,73,32,71,67,77,32,109,111,100,117,108,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.p2align 6
|
.p2align 6
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__APPLE__)
|
#endif // defined(__x86_64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
// This file is generated from a similarly-named Perl script in the BoringSSL
|
// This file is generated from a similarly-named Perl script in the BoringSSL
|
||||||
// source tree. Do not edit by hand.
|
// source tree. Do not edit by hand.
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__has_feature)
|
||||||
|
#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
|
||||||
|
#define OPENSSL_NO_ASM
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -2511,8 +2517,11 @@ aes_hw_set_decrypt_key:
|
|||||||
.byte 83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83
|
.byte 83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83
|
||||||
.byte 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115
|
.byte 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115
|
||||||
.byte 115,108,46,111,114,103,62,0
|
.byte 115,108,46,111,114,103,62,0
|
||||||
|
#endif // !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
|
||||||
#endif // defined(__i386__) && defined(__linux__)
|
#endif // defined(__i386__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -2505,7 +2505,10 @@ __aesni_set_encrypt_key:
|
|||||||
.byte 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69,83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69,83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.align 64
|
.align 64
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__linux__)
|
#endif // defined(__x86_64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -2503,6 +2503,10 @@ L$key_rcon1b:
|
|||||||
.byte 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69,83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69,83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.p2align 6
|
.p2align 6
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__APPLE__)
|
#endif // defined(__x86_64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -808,7 +808,11 @@ Lctr32_done:
|
|||||||
ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,pc}
|
ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,pc}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__arm__) && defined(__APPLE__)
|
#endif // defined(__arm__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__ELF__)
|
||||||
#if defined(__arm__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -797,9 +796,11 @@ aes_hw_ctr32_encrypt_blocks:
|
|||||||
ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,pc}
|
ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,pc}
|
||||||
.size aes_hw_ctr32_encrypt_blocks,.-aes_hw_ctr32_encrypt_blocks
|
.size aes_hw_ctr32_encrypt_blocks,.-aes_hw_ctr32_encrypt_blocks
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__arm__) && defined(__linux__)
|
#endif // defined(__arm__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -798,7 +798,11 @@ Lctr32_done:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__aarch64__) && defined(__APPLE__)
|
#endif // defined(__aarch64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
#if defined(__aarch64__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -799,9 +798,11 @@ aes_hw_ctr32_encrypt_blocks:
|
|||||||
ret
|
ret
|
||||||
.size aes_hw_ctr32_encrypt_blocks,.-aes_hw_ctr32_encrypt_blocks
|
.size aes_hw_ctr32_encrypt_blocks,.-aes_hw_ctr32_encrypt_blocks
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__aarch64__) && defined(__linux__)
|
#endif // defined(__aarch64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -981,7 +981,11 @@ OPENSSL_armcap_P:
|
|||||||
.long 0
|
.long 0
|
||||||
.private_extern _OPENSSL_armcap_P
|
.private_extern _OPENSSL_armcap_P
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__arm__) && defined(__APPLE__)
|
#endif // defined(__arm__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__ELF__)
|
||||||
#if defined(__arm__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -974,9 +973,11 @@ bn_mul8x_mont_neon:
|
|||||||
.comm OPENSSL_armcap_P,4,4
|
.comm OPENSSL_armcap_P,4,4
|
||||||
.hidden OPENSSL_armcap_P
|
.hidden OPENSSL_armcap_P
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__arm__) && defined(__linux__)
|
#endif // defined(__arm__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1432,7 +1432,11 @@ Lmul4x_done:
|
|||||||
.byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,102,111,114,32,65,82,77,118,56,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,102,111,114,32,65,82,77,118,56,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.align 2
|
.align 2
|
||||||
.align 4
|
.align 4
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__aarch64__) && defined(__APPLE__)
|
#endif // defined(__aarch64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
#if defined(__aarch64__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1433,9 +1432,11 @@ __bn_mul4x_mont:
|
|||||||
.byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,102,111,114,32,65,82,77,118,56,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,102,111,114,32,65,82,77,118,56,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.align 2
|
.align 2
|
||||||
.align 4
|
.align 4
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__aarch64__) && defined(__linux__)
|
#endif // defined(__aarch64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
// This file is generated from a similarly-named Perl script in the BoringSSL
|
// This file is generated from a similarly-named Perl script in the BoringSSL
|
||||||
// source tree. Do not edit by hand.
|
// source tree. Do not edit by hand.
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__has_feature)
|
||||||
|
#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
|
||||||
|
#define OPENSSL_NO_ASM
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -995,8 +1001,11 @@ bn_sub_words:
|
|||||||
popl %ebp
|
popl %ebp
|
||||||
ret
|
ret
|
||||||
.size bn_sub_words,.-.L_bn_sub_words_begin
|
.size bn_sub_words,.-.L_bn_sub_words_begin
|
||||||
|
#endif // !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
|
||||||
#endif // defined(__i386__) && defined(__linux__)
|
#endif // defined(__i386__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -109,6 +109,7 @@
|
|||||||
#include <CCryptoBoringSSL_bn.h>
|
#include <CCryptoBoringSSL_bn.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -396,7 +397,7 @@ err:
|
|||||||
//
|
//
|
||||||
// (with draws in between). Very small exponents are often selected
|
// (with draws in between). Very small exponents are often selected
|
||||||
// with low Hamming weight, so we use w = 1 for b <= 23.
|
// with low Hamming weight, so we use w = 1 for b <= 23.
|
||||||
static int BN_window_bits_for_exponent_size(int b) {
|
static int BN_window_bits_for_exponent_size(size_t b) {
|
||||||
if (b > 671) {
|
if (b > 671) {
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
@@ -721,12 +722,14 @@ err:
|
|||||||
void bn_mod_exp_mont_small(BN_ULONG *r, const BN_ULONG *a, size_t num,
|
void bn_mod_exp_mont_small(BN_ULONG *r, const BN_ULONG *a, size_t num,
|
||||||
const BN_ULONG *p, size_t num_p,
|
const BN_ULONG *p, size_t num_p,
|
||||||
const BN_MONT_CTX *mont) {
|
const BN_MONT_CTX *mont) {
|
||||||
if (num != (size_t)mont->N.width || num > BN_SMALL_MAX_WORDS) {
|
if (num != (size_t)mont->N.width || num > BN_SMALL_MAX_WORDS ||
|
||||||
|
num_p > ((size_t)-1) / BN_BITS2) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
assert(BN_is_odd(&mont->N));
|
assert(BN_is_odd(&mont->N));
|
||||||
|
|
||||||
// Count the number of bits in |p|. Note this function treats |p| as public.
|
// Count the number of bits in |p|, skipping leading zeros. Note this function
|
||||||
|
// treats |p| as public.
|
||||||
while (num_p != 0 && p[num_p - 1] == 0) {
|
while (num_p != 0 && p[num_p - 1] == 0) {
|
||||||
num_p--;
|
num_p--;
|
||||||
}
|
}
|
||||||
@@ -734,7 +737,7 @@ void bn_mod_exp_mont_small(BN_ULONG *r, const BN_ULONG *a, size_t num,
|
|||||||
bn_from_montgomery_small(r, num, mont->RR.d, num, mont);
|
bn_from_montgomery_small(r, num, mont->RR.d, num, mont);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsigned bits = BN_num_bits_word(p[num_p - 1]) + (num_p - 1) * BN_BITS2;
|
size_t bits = BN_num_bits_word(p[num_p - 1]) + (num_p - 1) * BN_BITS2;
|
||||||
assert(bits != 0);
|
assert(bits != 0);
|
||||||
|
|
||||||
// We exponentiate by looking at sliding windows of the exponent and
|
// We exponentiate by looking at sliding windows of the exponent and
|
||||||
@@ -758,7 +761,7 @@ void bn_mod_exp_mont_small(BN_ULONG *r, const BN_ULONG *a, size_t num,
|
|||||||
// |p| is non-zero, so at least one window is non-zero. To save some
|
// |p| is non-zero, so at least one window is non-zero. To save some
|
||||||
// multiplications, defer initializing |r| until then.
|
// multiplications, defer initializing |r| until then.
|
||||||
int r_is_one = 1;
|
int r_is_one = 1;
|
||||||
unsigned wstart = bits - 1; // The top bit of the window.
|
size_t wstart = bits - 1; // The top bit of the window.
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (!bn_is_bit_set_words(p, num_p, wstart)) {
|
if (!bn_is_bit_set_words(p, num_p, wstart)) {
|
||||||
if (!r_is_one) {
|
if (!r_is_one) {
|
||||||
@@ -858,40 +861,15 @@ static int copy_from_prebuf(BIGNUM *b, int top, const BN_ULONG *table, int idx,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MOD_EXP_CTIME_MIN_CACHE_LINE_MASK \
|
|
||||||
(MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - 1)
|
|
||||||
|
|
||||||
// Window sizes optimized for fixed window size modular exponentiation
|
// Window sizes optimized for fixed window size modular exponentiation
|
||||||
// algorithm (BN_mod_exp_mont_consttime).
|
// algorithm (BN_mod_exp_mont_consttime).
|
||||||
//
|
//
|
||||||
// To achieve the security goals of BN_mode_exp_mont_consttime, the maximum
|
// TODO(davidben): These window sizes were originally set for 64-byte cache
|
||||||
// size of the window must not exceed
|
// lines with a cache-line-dependent constant-time mitigation. They can probably
|
||||||
// log_2(MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH).
|
// be revised now that our implementation is no longer cache-time-dependent.
|
||||||
//
|
|
||||||
// Window size thresholds are defined for cache line sizes of 32 and 64, cache
|
|
||||||
// line sizes where log_2(32)=5 and log_2(64)=6 respectively. A window size of
|
|
||||||
// 7 should only be used on processors that have a 128 byte or greater cache
|
|
||||||
// line size.
|
|
||||||
#if MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH == 64
|
|
||||||
|
|
||||||
#define BN_window_bits_for_ctime_exponent_size(b) \
|
#define BN_window_bits_for_ctime_exponent_size(b) \
|
||||||
((b) > 937 ? 6 : (b) > 306 ? 5 : (b) > 89 ? 4 : (b) > 22 ? 3 : 1)
|
((b) > 937 ? 6 : (b) > 306 ? 5 : (b) > 89 ? 4 : (b) > 22 ? 3 : 1)
|
||||||
#define BN_MAX_WINDOW_BITS_FOR_CTIME_EXPONENT_SIZE (6)
|
#define BN_MAX_MOD_EXP_CTIME_WINDOW (6)
|
||||||
|
|
||||||
#elif MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH == 32
|
|
||||||
|
|
||||||
#define BN_window_bits_for_ctime_exponent_size(b) \
|
|
||||||
((b) > 306 ? 5 : (b) > 89 ? 4 : (b) > 22 ? 3 : 1)
|
|
||||||
#define BN_MAX_WINDOW_BITS_FOR_CTIME_EXPONENT_SIZE (5)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Given a pointer value, compute the next address that is a cache line
|
|
||||||
// multiple.
|
|
||||||
#define MOD_EXP_CTIME_ALIGN(x_) \
|
|
||||||
((unsigned char *)(x_) + \
|
|
||||||
(MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - \
|
|
||||||
(((size_t)(x_)) & (MOD_EXP_CTIME_MIN_CACHE_LINE_MASK))))
|
|
||||||
|
|
||||||
// This variant of |BN_mod_exp_mont| uses fixed windows and fixed memory access
|
// This variant of |BN_mod_exp_mont| uses fixed windows and fixed memory access
|
||||||
// patterns to protect secret exponents (cf. the hyper-threading timing attacks
|
// patterns to protect secret exponents (cf. the hyper-threading timing attacks
|
||||||
@@ -900,14 +878,12 @@ static int copy_from_prebuf(BIGNUM *b, int top, const BN_ULONG *table, int idx,
|
|||||||
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||||
const BIGNUM *m, BN_CTX *ctx,
|
const BIGNUM *m, BN_CTX *ctx,
|
||||||
const BN_MONT_CTX *mont) {
|
const BN_MONT_CTX *mont) {
|
||||||
int i, ret = 0, window, wvalue;
|
int i, ret = 0, wvalue;
|
||||||
BN_MONT_CTX *new_mont = NULL;
|
BN_MONT_CTX *new_mont = NULL;
|
||||||
|
|
||||||
int numPowers;
|
unsigned char *powerbuf_free = NULL;
|
||||||
unsigned char *powerbufFree = NULL;
|
size_t powerbuf_len = 0;
|
||||||
int powerbufLen = 0;
|
|
||||||
BN_ULONG *powerbuf = NULL;
|
BN_ULONG *powerbuf = NULL;
|
||||||
BIGNUM tmp, am;
|
|
||||||
|
|
||||||
if (!BN_is_odd(m)) {
|
if (!BN_is_odd(m)) {
|
||||||
OPENSSL_PUT_ERROR(BN, BN_R_CALLED_WITH_EVEN_MODULUS);
|
OPENSSL_PUT_ERROR(BN, BN_R_CALLED_WITH_EVEN_MODULUS);
|
||||||
@@ -953,8 +929,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
|||||||
// paths. If we were to use separate static buffers for each then there is
|
// paths. If we were to use separate static buffers for each then there is
|
||||||
// some chance that both large buffers would be allocated on the stack,
|
// some chance that both large buffers would be allocated on the stack,
|
||||||
// causing the stack space requirement to be truly huge (~10KB).
|
// causing the stack space requirement to be truly huge (~10KB).
|
||||||
alignas(MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH) BN_ULONG
|
alignas(MOD_EXP_CTIME_ALIGN) BN_ULONG storage[MOD_EXP_CTIME_STORAGE_LEN];
|
||||||
storage[MOD_EXP_CTIME_STORAGE_LEN];
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(RSAZ_ENABLED)
|
#if defined(RSAZ_ENABLED)
|
||||||
// If the size of the operands allow it, perform the optimized RSAZ
|
// If the size of the operands allow it, perform the optimized RSAZ
|
||||||
@@ -975,41 +950,49 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get the window size to use with size of p.
|
// Get the window size to use with size of p.
|
||||||
window = BN_window_bits_for_ctime_exponent_size(bits);
|
int window = BN_window_bits_for_ctime_exponent_size(bits);
|
||||||
|
assert(window <= BN_MAX_MOD_EXP_CTIME_WINDOW);
|
||||||
|
|
||||||
|
// Calculating |powerbuf_len| below cannot overflow because of the bound on
|
||||||
|
// Montgomery reduction.
|
||||||
|
assert((size_t)top <= BN_MONTGOMERY_MAX_WORDS);
|
||||||
|
static_assert(
|
||||||
|
BN_MONTGOMERY_MAX_WORDS <=
|
||||||
|
INT_MAX / sizeof(BN_ULONG) / ((1 << BN_MAX_MOD_EXP_CTIME_WINDOW) + 3),
|
||||||
|
"powerbuf_len may overflow");
|
||||||
|
|
||||||
#if defined(OPENSSL_BN_ASM_MONT5)
|
#if defined(OPENSSL_BN_ASM_MONT5)
|
||||||
if (window >= 5) {
|
if (window >= 5) {
|
||||||
window = 5; // ~5% improvement for RSA2048 sign, and even for RSA4096
|
window = 5; // ~5% improvement for RSA2048 sign, and even for RSA4096
|
||||||
// Reserve space for the |mont->N| copy.
|
// Reserve space for the |mont->N| copy.
|
||||||
powerbufLen += top * sizeof(mont->N.d[0]);
|
powerbuf_len += top * sizeof(mont->N.d[0]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Allocate a buffer large enough to hold all of the pre-computed
|
// Allocate a buffer large enough to hold all of the pre-computed
|
||||||
// powers of |am|, |am| itself, and |tmp|.
|
// powers of |am|, |am| itself, and |tmp|.
|
||||||
numPowers = 1 << window;
|
int num_powers = 1 << window;
|
||||||
powerbufLen +=
|
powerbuf_len += sizeof(m->d[0]) * top * (num_powers + 2);
|
||||||
sizeof(m->d[0]) *
|
|
||||||
(top * numPowers + ((2 * top) > numPowers ? (2 * top) : numPowers));
|
|
||||||
|
|
||||||
#if defined(OPENSSL_BN_ASM_MONT5)
|
#if defined(OPENSSL_BN_ASM_MONT5)
|
||||||
if ((size_t)powerbufLen <= sizeof(storage)) {
|
if (powerbuf_len <= sizeof(storage)) {
|
||||||
powerbuf = storage;
|
powerbuf = storage;
|
||||||
}
|
}
|
||||||
// |storage| is more than large enough to handle 1024-bit inputs.
|
// |storage| is more than large enough to handle 1024-bit inputs.
|
||||||
assert(powerbuf != NULL || top * BN_BITS2 > 1024);
|
assert(powerbuf != NULL || top * BN_BITS2 > 1024);
|
||||||
#endif
|
#endif
|
||||||
if (powerbuf == NULL) {
|
if (powerbuf == NULL) {
|
||||||
powerbufFree =
|
powerbuf_free = OPENSSL_malloc(powerbuf_len + MOD_EXP_CTIME_ALIGN);
|
||||||
OPENSSL_malloc(powerbufLen + MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH);
|
if (powerbuf_free == NULL) {
|
||||||
if (powerbufFree == NULL) {
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
powerbuf = (BN_ULONG *)MOD_EXP_CTIME_ALIGN(powerbufFree);
|
powerbuf = align_pointer(powerbuf_free, MOD_EXP_CTIME_ALIGN);
|
||||||
}
|
}
|
||||||
OPENSSL_memset(powerbuf, 0, powerbufLen);
|
OPENSSL_memset(powerbuf, 0, powerbuf_len);
|
||||||
|
|
||||||
// Place |tmp| and |am| right after powers table.
|
// Place |tmp| and |am| right after powers table.
|
||||||
tmp.d = powerbuf + top * numPowers;
|
BIGNUM tmp, am;
|
||||||
|
tmp.d = powerbuf + top * num_powers;
|
||||||
am.d = tmp.d + top;
|
am.d = tmp.d + top;
|
||||||
tmp.width = am.width = 0;
|
tmp.width = am.width = 0;
|
||||||
tmp.dmax = am.dmax = top;
|
tmp.dmax = am.dmax = top;
|
||||||
@@ -1158,7 +1141,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
|||||||
|
|
||||||
copy_to_prebuf(&tmp, top, powerbuf, 2, window);
|
copy_to_prebuf(&tmp, top, powerbuf, 2, window);
|
||||||
|
|
||||||
for (i = 3; i < numPowers; i++) {
|
for (i = 3; i < num_powers; i++) {
|
||||||
// Calculate a^i = a^(i-1) * a
|
// Calculate a^i = a^(i-1) * a
|
||||||
if (!BN_mod_mul_montgomery(&tmp, &am, &tmp, mont, ctx)) {
|
if (!BN_mod_mul_montgomery(&tmp, &am, &tmp, mont, ctx)) {
|
||||||
goto err;
|
goto err;
|
||||||
@@ -1213,11 +1196,11 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
BN_MONT_CTX_free(new_mont);
|
BN_MONT_CTX_free(new_mont);
|
||||||
if (powerbuf != NULL && powerbufFree == NULL) {
|
if (powerbuf != NULL && powerbuf_free == NULL) {
|
||||||
OPENSSL_cleanse(powerbuf, powerbufLen);
|
OPENSSL_cleanse(powerbuf, powerbuf_len);
|
||||||
}
|
}
|
||||||
OPENSSL_free(powerbufFree);
|
OPENSSL_free(powerbuf_free);
|
||||||
return (ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
|
int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
|
||||||
|
|||||||
@@ -189,14 +189,20 @@ extern "C" {
|
|||||||
#define BN_CAN_USE_INLINE_ASM
|
#define BN_CAN_USE_INLINE_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// |BN_mod_exp_mont_consttime| is based on the assumption that the L1 data
|
// MOD_EXP_CTIME_ALIGN is the alignment needed for |BN_mod_exp_mont_consttime|'s
|
||||||
// cache line width of the target processor is at least the following value.
|
// tables.
|
||||||
#define MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH 64
|
//
|
||||||
|
// TODO(davidben): Historically, this alignment came from cache line
|
||||||
|
// assumptions, which we've since removed. Is 64-byte alignment still necessary
|
||||||
|
// or ideal? The true alignment requirement seems to now be 32 bytes, coming
|
||||||
|
// from RSAZ's use of VMOVDQA to a YMM register. Non-x86_64 has even fewer
|
||||||
|
// requirements.
|
||||||
|
#define MOD_EXP_CTIME_ALIGN 64
|
||||||
|
|
||||||
// The number of |BN_ULONG|s needed for the |BN_mod_exp_mont_consttime| stack-
|
// MOD_EXP_CTIME_STORAGE_LEN is the number of |BN_ULONG|s needed for the
|
||||||
// allocated storage buffer. The buffer is just the right size for the RSAZ
|
// |BN_mod_exp_mont_consttime| stack-allocated storage buffer. The buffer is
|
||||||
// and is about ~1KB larger than what's necessary (4480 bytes) for 1024-bit
|
// just the right size for the RSAZ and is about ~1KB larger than what's
|
||||||
// inputs.
|
// necessary (4480 bytes) for 1024-bit inputs.
|
||||||
#define MOD_EXP_CTIME_STORAGE_LEN \
|
#define MOD_EXP_CTIME_STORAGE_LEN \
|
||||||
(((320u * 3u) + (32u * 9u * 16u)) / sizeof(BN_ULONG))
|
(((320u * 3u) + (32u * 9u * 16u)) / sizeof(BN_ULONG))
|
||||||
|
|
||||||
@@ -344,6 +350,12 @@ int bn_rand_range_words(BN_ULONG *out, BN_ULONG min_inclusive,
|
|||||||
int bn_rand_secret_range(BIGNUM *r, int *out_is_uniform, BN_ULONG min_inclusive,
|
int bn_rand_secret_range(BIGNUM *r, int *out_is_uniform, BN_ULONG min_inclusive,
|
||||||
const BIGNUM *max_exclusive);
|
const BIGNUM *max_exclusive);
|
||||||
|
|
||||||
|
// BN_MONTGOMERY_MAX_WORDS is the maximum numer of words allowed in a |BIGNUM|
|
||||||
|
// used with Montgomery reduction. Ideally this limit would be applied to all
|
||||||
|
// |BIGNUM|s, in |bn_wexpand|, but the exactfloat library needs to create 8 MiB
|
||||||
|
// values for other operations.
|
||||||
|
#define BN_MONTGOMERY_MAX_WORDS (8 * 1024 / sizeof(BN_ULONG))
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM) && \
|
#if !defined(OPENSSL_NO_ASM) && \
|
||||||
(defined(OPENSSL_X86) || defined(OPENSSL_X86_64) || \
|
(defined(OPENSSL_X86) || defined(OPENSSL_X86_64) || \
|
||||||
defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64))
|
defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64))
|
||||||
@@ -356,11 +368,13 @@ int bn_rand_secret_range(BIGNUM *r, int *out_is_uniform, BN_ULONG min_inclusive,
|
|||||||
// If at least one of |ap| or |bp| is fully reduced, |rp| will be fully reduced.
|
// If at least one of |ap| or |bp| is fully reduced, |rp| will be fully reduced.
|
||||||
// If neither is fully-reduced, the output may not be either.
|
// If neither is fully-reduced, the output may not be either.
|
||||||
//
|
//
|
||||||
|
// This function allocates |num| words on the stack, so |num| should be at most
|
||||||
|
// |BN_MONTGOMERY_MAX_WORDS|.
|
||||||
|
//
|
||||||
// TODO(davidben): The x86_64 implementation expects a 32-bit input and masks
|
// TODO(davidben): The x86_64 implementation expects a 32-bit input and masks
|
||||||
// off upper bits. The aarch64 implementation expects a 64-bit input and does
|
// off upper bits. The aarch64 implementation expects a 64-bit input and does
|
||||||
// not. |size_t| is the safer option but not strictly correct for x86_64. But
|
// not. |size_t| is the safer option but not strictly correct for x86_64. But
|
||||||
// this function implicitly already has a bound on the size of |num| because it
|
// the |BN_MONTGOMERY_MAX_WORDS| bound makes this moot.
|
||||||
// internally creates |num|-sized stack allocation.
|
|
||||||
//
|
//
|
||||||
// See also discussion in |ToWord| in abi_test.h for notes on smaller-than-word
|
// See also discussion in |ToWord| in abi_test.h for notes on smaller-than-word
|
||||||
// inputs.
|
// inputs.
|
||||||
@@ -374,7 +388,8 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
|
|||||||
// bn_mul_mont_gather5 multiples loads index |power| of |table|, multiplies it
|
// bn_mul_mont_gather5 multiples loads index |power| of |table|, multiplies it
|
||||||
// by |ap| modulo |np|, and stores the result in |rp|. The values are |num|
|
// by |ap| modulo |np|, and stores the result in |rp|. The values are |num|
|
||||||
// words long and represented in Montgomery form. |n0| is a pointer to the
|
// words long and represented in Montgomery form. |n0| is a pointer to the
|
||||||
// corresponding field in |BN_MONT_CTX|.
|
// corresponding field in |BN_MONT_CTX|. |table| must be aligned to at least
|
||||||
|
// 16 bytes. |power| must be less than 32 and is treated as secret.
|
||||||
//
|
//
|
||||||
// WARNING: This function implements Almost Montgomery Multiplication from
|
// WARNING: This function implements Almost Montgomery Multiplication from
|
||||||
// https://eprint.iacr.org/2011/239. The inputs do not need to be fully reduced.
|
// https://eprint.iacr.org/2011/239. The inputs do not need to be fully reduced.
|
||||||
@@ -384,20 +399,22 @@ void bn_mul_mont_gather5(BN_ULONG *rp, const BN_ULONG *ap,
|
|||||||
const BN_ULONG *n0, int num, int power);
|
const BN_ULONG *n0, int num, int power);
|
||||||
|
|
||||||
// bn_scatter5 stores |inp| to index |power| of |table|. |inp| and each entry of
|
// bn_scatter5 stores |inp| to index |power| of |table|. |inp| and each entry of
|
||||||
// |table| are |num| words long. |power| must be less than 32. |table| must be
|
// |table| are |num| words long. |power| must be less than 32 and is treated as
|
||||||
// 32*|num| words long.
|
// public. |table| must be 32*|num| words long. |table| must be aligned to at
|
||||||
|
// least 16 bytes.
|
||||||
void bn_scatter5(const BN_ULONG *inp, size_t num, BN_ULONG *table,
|
void bn_scatter5(const BN_ULONG *inp, size_t num, BN_ULONG *table,
|
||||||
size_t power);
|
size_t power);
|
||||||
|
|
||||||
// bn_gather5 loads index |power| of |table| and stores it in |out|. |out| and
|
// bn_gather5 loads index |power| of |table| and stores it in |out|. |out| and
|
||||||
// each entry of |table| are |num| words long. |power| must be less than 32.
|
// each entry of |table| are |num| words long. |power| must be less than 32 and
|
||||||
|
// is treated as secret. |table| must be aligned to at least 16 bytes.
|
||||||
void bn_gather5(BN_ULONG *out, size_t num, const BN_ULONG *table, size_t power);
|
void bn_gather5(BN_ULONG *out, size_t num, const BN_ULONG *table, size_t power);
|
||||||
|
|
||||||
// bn_power5 squares |ap| five times and multiplies it by the value stored at
|
// bn_power5 squares |ap| five times and multiplies it by the value stored at
|
||||||
// index |power| of |table|, modulo |np|. It stores the result in |rp|. The
|
// index |power| of |table|, modulo |np|. It stores the result in |rp|. The
|
||||||
// values are |num| words long and represented in Montgomery form. |n0| is a
|
// values are |num| words long and represented in Montgomery form. |n0| is a
|
||||||
// pointer to the corresponding field in |BN_MONT_CTX|. |num| must be divisible
|
// pointer to the corresponding field in |BN_MONT_CTX|. |num| must be divisible
|
||||||
// by 8.
|
// by 8. |power| must be less than 32 and is treated as secret.
|
||||||
//
|
//
|
||||||
// WARNING: This function implements Almost Montgomery Multiplication from
|
// WARNING: This function implements Almost Montgomery Multiplication from
|
||||||
// https://eprint.iacr.org/2011/239. The inputs do not need to be fully reduced.
|
// https://eprint.iacr.org/2011/239. The inputs do not need to be fully reduced.
|
||||||
@@ -690,9 +707,10 @@ void bn_mod_mul_montgomery_small(BN_ULONG *r, const BN_ULONG *a,
|
|||||||
// bn_mod_exp_mont_small sets |r| to |a|^|p| mod |mont->N|. It returns one on
|
// bn_mod_exp_mont_small sets |r| to |a|^|p| mod |mont->N|. It returns one on
|
||||||
// success and zero on programmer or internal error. Both inputs and outputs are
|
// success and zero on programmer or internal error. Both inputs and outputs are
|
||||||
// in the Montgomery domain. |r| and |a| are |num| words long, which must be
|
// in the Montgomery domain. |r| and |a| are |num| words long, which must be
|
||||||
// |mont->N.width| and at most |BN_SMALL_MAX_WORDS|. |a| must be fully-reduced.
|
// |mont->N.width| and at most |BN_SMALL_MAX_WORDS|. |num_p|, measured in bits,
|
||||||
// This function runs in time independent of |a|, but |p| and |mont->N| are
|
// must fit in |size_t|. |a| must be fully-reduced. This function runs in time
|
||||||
// public values. |a| must be fully-reduced and may alias with |r|.
|
// independent of |a|, but |p| and |mont->N| are public values. |a| must be
|
||||||
|
// fully-reduced and may alias with |r|.
|
||||||
//
|
//
|
||||||
// Note this function differs from |BN_mod_exp_mont| which uses Montgomery
|
// Note this function differs from |BN_mod_exp_mont| which uses Montgomery
|
||||||
// reduction but takes input and output outside the Montgomery domain. Combine
|
// reduction but takes input and output outside the Montgomery domain. Combine
|
||||||
|
|||||||
@@ -172,6 +172,10 @@ static int bn_mont_ctx_set_N_and_n0(BN_MONT_CTX *mont, const BIGNUM *mod) {
|
|||||||
OPENSSL_PUT_ERROR(BN, BN_R_NEGATIVE_NUMBER);
|
OPENSSL_PUT_ERROR(BN, BN_R_NEGATIVE_NUMBER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (!bn_fits_in_words(mod, BN_MONTGOMERY_MAX_WORDS)) {
|
||||||
|
OPENSSL_PUT_ERROR(BN, BN_R_BIGNUM_TOO_LONG);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Save the modulus.
|
// Save the modulus.
|
||||||
if (!BN_copy(&mont->N, mod)) {
|
if (!BN_copy(&mont->N, mod)) {
|
||||||
@@ -428,6 +432,9 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
|||||||
if (!bn_wexpand(r, num)) {
|
if (!bn_wexpand(r, num)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// This bound is implied by |bn_mont_ctx_set_N_and_n0|. |bn_mul_mont|
|
||||||
|
// allocates |num| words on the stack, so |num| cannot be too large.
|
||||||
|
assert((size_t)num <= BN_MONTGOMERY_MAX_WORDS);
|
||||||
if (!bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) {
|
if (!bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) {
|
||||||
// The check above ensures this won't happen.
|
// The check above ensures this won't happen.
|
||||||
assert(0);
|
assert(0);
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ void RSAZ_1024_mod_exp_avx2(BN_ULONG result_norm[16],
|
|||||||
const BN_ULONG m_norm[16], const BN_ULONG RR[16],
|
const BN_ULONG m_norm[16], const BN_ULONG RR[16],
|
||||||
BN_ULONG k0,
|
BN_ULONG k0,
|
||||||
BN_ULONG storage[MOD_EXP_CTIME_STORAGE_LEN]) {
|
BN_ULONG storage[MOD_EXP_CTIME_STORAGE_LEN]) {
|
||||||
static_assert(MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH % 64 == 0,
|
static_assert(MOD_EXP_CTIME_ALIGN % 64 == 0,
|
||||||
"MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH is too small");
|
"MOD_EXP_CTIME_ALIGN is too small");
|
||||||
assert((uintptr_t)storage % 64 == 0);
|
assert((uintptr_t)storage % 64 == 0);
|
||||||
|
|
||||||
BN_ULONG *a_inv, *m, *result, *table_s = storage + 40 * 3, *R2 = table_s;
|
BN_ULONG *a_inv, *m, *result, *table_s = storage + 40 * 3, *R2 = table_s;
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ extern "C" {
|
|||||||
// modulo |m_norm|. |base_norm| must be fully-reduced and |exponent| must have
|
// modulo |m_norm|. |base_norm| must be fully-reduced and |exponent| must have
|
||||||
// the high bit set (it is 1024 bits wide). |RR| and |k0| must be |RR| and |n0|,
|
// the high bit set (it is 1024 bits wide). |RR| and |k0| must be |RR| and |n0|,
|
||||||
// respectively, extracted from |m_norm|'s |BN_MONT_CTX|. |storage_words| is a
|
// respectively, extracted from |m_norm|'s |BN_MONT_CTX|. |storage_words| is a
|
||||||
// temporary buffer that must be aligned to |MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH|
|
// temporary buffer that must be aligned to |MOD_EXP_CTIME_ALIGN| bytes.
|
||||||
// bytes.
|
|
||||||
void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16], const BN_ULONG base_norm[16],
|
void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16], const BN_ULONG base_norm[16],
|
||||||
const BN_ULONG exponent[16],
|
const BN_ULONG exponent[16],
|
||||||
const BN_ULONG m_norm[16], const BN_ULONG RR[16],
|
const BN_ULONG m_norm[16], const BN_ULONG RR[16],
|
||||||
@@ -79,13 +78,15 @@ void rsaz_1024_sqr_avx2(BN_ULONG ret[40], const BN_ULONG a[40],
|
|||||||
const BN_ULONG n[40], BN_ULONG k, int count);
|
const BN_ULONG n[40], BN_ULONG k, int count);
|
||||||
|
|
||||||
// rsaz_1024_scatter5_avx2 stores |val| at index |i| of |tbl|. |i| must be
|
// rsaz_1024_scatter5_avx2 stores |val| at index |i| of |tbl|. |i| must be
|
||||||
// positive and at most 31. Note the table only uses 18 |BN_ULONG|s per entry
|
// positive and at most 31. It is treated as public. Note the table only uses 18
|
||||||
// instead of 40. It packs two 29-bit limbs into each |BN_ULONG| and only stores
|
// |BN_ULONG|s per entry instead of 40. It packs two 29-bit limbs into each
|
||||||
// 36 limbs rather than the padded 40.
|
// |BN_ULONG| and only stores 36 limbs rather than the padded 40.
|
||||||
void rsaz_1024_scatter5_avx2(BN_ULONG tbl[32 * 18], const BN_ULONG val[40],
|
void rsaz_1024_scatter5_avx2(BN_ULONG tbl[32 * 18], const BN_ULONG val[40],
|
||||||
int i);
|
int i);
|
||||||
|
|
||||||
// rsaz_1024_gather5_avx2 loads index |i| of |tbl| and writes it to |val|.
|
// rsaz_1024_gather5_avx2 loads index |i| of |tbl| and writes it to |val|. |i|
|
||||||
|
// must be positive and at most 31. It is treated as secret. |tbl| must be
|
||||||
|
// aligned to 32 bytes.
|
||||||
void rsaz_1024_gather5_avx2(BN_ULONG val[40], const BN_ULONG tbl[32 * 18],
|
void rsaz_1024_gather5_avx2(BN_ULONG val[40], const BN_ULONG tbl[32 * 18],
|
||||||
int i);
|
int i);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1535,7 +1535,11 @@ Lctr_enc_bzero:@ wipe key schedule [if any]
|
|||||||
@ out to retain a constant-time implementation.
|
@ out to retain a constant-time implementation.
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__arm__) && defined(__APPLE__)
|
#endif // defined(__arm__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__ELF__)
|
||||||
#if defined(__arm__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1526,9 +1525,11 @@ bsaes_ctr32_encrypt_blocks:
|
|||||||
@ out to retain a constant-time implementation.
|
@ out to retain a constant-time implementation.
|
||||||
.size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks
|
.size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__arm__) && defined(__linux__)
|
#endif // defined(__arm__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -529,11 +529,10 @@ static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) {
|
|||||||
if (gctx->iv == c->iv) {
|
if (gctx->iv == c->iv) {
|
||||||
gctx_out->iv = out->iv;
|
gctx_out->iv = out->iv;
|
||||||
} else {
|
} else {
|
||||||
gctx_out->iv = OPENSSL_malloc(gctx->ivlen);
|
gctx_out->iv = OPENSSL_memdup(gctx->iv, gctx->ivlen);
|
||||||
if (!gctx_out->iv) {
|
if (!gctx_out->iv) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
OPENSSL_memcpy(gctx_out->iv, gctx->iv, gctx->ivlen);
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
// This file is generated from a similarly-named Perl script in the BoringSSL
|
// This file is generated from a similarly-named Perl script in the BoringSSL
|
||||||
// source tree. Do not edit by hand.
|
// source tree. Do not edit by hand.
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__has_feature)
|
||||||
|
#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
|
||||||
|
#define OPENSSL_NO_ASM
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1264,8 +1270,11 @@ bn_sqr_comba4:
|
|||||||
popl %esi
|
popl %esi
|
||||||
ret
|
ret
|
||||||
.size bn_sqr_comba4,.-.L_bn_sqr_comba4_begin
|
.size bn_sqr_comba4,.-.L_bn_sqr_comba4_begin
|
||||||
|
#endif // !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
|
||||||
#endif // defined(__i386__) && defined(__linux__)
|
#endif // defined(__i386__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -257,7 +257,11 @@ Lgmult_neon:
|
|||||||
.byte 71,72,65,83,72,32,102,111,114,32,65,82,77,118,52,47,78,69,79,78,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 71,72,65,83,72,32,102,111,114,32,65,82,77,118,52,47,78,69,79,78,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.align 2
|
.align 2
|
||||||
.align 2
|
.align 2
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__arm__) && defined(__APPLE__)
|
#endif // defined(__arm__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__ELF__)
|
||||||
#if defined(__arm__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -252,9 +251,11 @@ gcm_ghash_neon:
|
|||||||
.byte 71,72,65,83,72,32,102,111,114,32,65,82,77,118,52,47,78,69,79,78,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 71,72,65,83,72,32,102,111,114,32,65,82,77,118,52,47,78,69,79,78,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.align 2
|
.align 2
|
||||||
.align 2
|
.align 2
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__arm__) && defined(__linux__)
|
#endif // defined(__arm__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -342,7 +342,11 @@ Lmasks:
|
|||||||
.byte 71,72,65,83,72,32,102,111,114,32,65,82,77,118,56,44,32,100,101,114,105,118,101,100,32,102,114,111,109,32,65,82,77,118,52,32,118,101,114,115,105,111,110,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 71,72,65,83,72,32,102,111,114,32,65,82,77,118,56,44,32,100,101,114,105,118,101,100,32,102,114,111,109,32,65,82,77,118,52,32,118,101,114,115,105,111,110,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.align 2
|
.align 2
|
||||||
.align 2
|
.align 2
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__aarch64__) && defined(__APPLE__)
|
#endif // defined(__aarch64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
#if defined(__aarch64__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -343,9 +342,11 @@ gcm_ghash_neon:
|
|||||||
.byte 71,72,65,83,72,32,102,111,114,32,65,82,77,118,56,44,32,100,101,114,105,118,101,100,32,102,114,111,109,32,65,82,77,118,52,32,118,101,114,115,105,111,110,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 71,72,65,83,72,32,102,111,114,32,65,82,77,118,56,44,32,100,101,114,105,118,101,100,32,102,114,111,109,32,65,82,77,118,52,32,118,101,114,115,105,111,110,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.align 2
|
.align 2
|
||||||
.align 2
|
.align 2
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__aarch64__) && defined(__linux__)
|
#endif // defined(__aarch64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
// This file is generated from a similarly-named Perl script in the BoringSSL
|
// This file is generated from a similarly-named Perl script in the BoringSSL
|
||||||
// source tree. Do not edit by hand.
|
// source tree. Do not edit by hand.
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__has_feature)
|
||||||
|
#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
|
||||||
|
#define OPENSSL_NO_ASM
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -292,8 +298,11 @@ gcm_ghash_ssse3:
|
|||||||
.align 16
|
.align 16
|
||||||
.Llow4_mask:
|
.Llow4_mask:
|
||||||
.long 252645135,252645135,252645135,252645135
|
.long 252645135,252645135,252645135,252645135
|
||||||
|
#endif // !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
|
||||||
#endif // defined(__i386__) && defined(__linux__)
|
#endif // defined(__i386__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -1,296 +1,299 @@
|
|||||||
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
||||||
#if defined(__i386__) && defined(_WIN32)
|
#if defined(__i386__) && defined(_WIN32)
|
||||||
// This file is generated from a similarly-named Perl script in the BoringSSL
|
; This file is generated from a similarly-named Perl script in the BoringSSL
|
||||||
// source tree. Do not edit by hand.
|
; source tree. Do not edit by hand.
|
||||||
|
|
||||||
#if defined(__i386__)
|
%ifdef BORINGSSL_PREFIX
|
||||||
#if defined(BORINGSSL_PREFIX)
|
%include "boringssl_prefix_symbols_nasm.inc"
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
%endif
|
||||||
#endif
|
%ifidn __OUTPUT_FORMAT__, win32
|
||||||
.text
|
%ifidn __OUTPUT_FORMAT__,obj
|
||||||
.globl _gcm_gmult_ssse3
|
section code use32 class=code align=64
|
||||||
.hidden _gcm_gmult_ssse3
|
%elifidn __OUTPUT_FORMAT__,win32
|
||||||
.def _gcm_gmult_ssse3; .scl 2; .type 32; .endef
|
$@feat.00 equ 1
|
||||||
.align 16
|
section .text code align=64
|
||||||
|
%else
|
||||||
|
section .text code
|
||||||
|
%endif
|
||||||
|
global _gcm_gmult_ssse3
|
||||||
|
align 16
|
||||||
_gcm_gmult_ssse3:
|
_gcm_gmult_ssse3:
|
||||||
.L_gcm_gmult_ssse3_begin:
|
L$_gcm_gmult_ssse3_begin:
|
||||||
pushl %ebp
|
push ebp
|
||||||
pushl %ebx
|
push ebx
|
||||||
pushl %esi
|
push esi
|
||||||
pushl %edi
|
push edi
|
||||||
movl 20(%esp),%edi
|
mov edi,DWORD [20+esp]
|
||||||
movl 24(%esp),%esi
|
mov esi,DWORD [24+esp]
|
||||||
movdqu (%edi),%xmm0
|
movdqu xmm0,[edi]
|
||||||
call .L000pic_point
|
call L$000pic_point
|
||||||
.L000pic_point:
|
L$000pic_point:
|
||||||
popl %eax
|
pop eax
|
||||||
movdqa .Lreverse_bytes-.L000pic_point(%eax),%xmm7
|
movdqa xmm7,[(L$reverse_bytes-L$000pic_point)+eax]
|
||||||
movdqa .Llow4_mask-.L000pic_point(%eax),%xmm2
|
movdqa xmm2,[(L$low4_mask-L$000pic_point)+eax]
|
||||||
.byte 102,15,56,0,199
|
db 102,15,56,0,199
|
||||||
movdqa %xmm2,%xmm1
|
movdqa xmm1,xmm2
|
||||||
pandn %xmm0,%xmm1
|
pandn xmm1,xmm0
|
||||||
psrld $4,%xmm1
|
psrld xmm1,4
|
||||||
pand %xmm2,%xmm0
|
pand xmm0,xmm2
|
||||||
pxor %xmm2,%xmm2
|
pxor xmm2,xmm2
|
||||||
pxor %xmm3,%xmm3
|
pxor xmm3,xmm3
|
||||||
movl $5,%eax
|
mov eax,5
|
||||||
.L001loop_row_1:
|
L$001loop_row_1:
|
||||||
movdqa (%esi),%xmm4
|
movdqa xmm4,[esi]
|
||||||
leal 16(%esi),%esi
|
lea esi,[16+esi]
|
||||||
movdqa %xmm2,%xmm6
|
movdqa xmm6,xmm2
|
||||||
.byte 102,15,58,15,243,1
|
db 102,15,58,15,243,1
|
||||||
movdqa %xmm6,%xmm3
|
movdqa xmm3,xmm6
|
||||||
psrldq $1,%xmm2
|
psrldq xmm2,1
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
.byte 102,15,56,0,224
|
db 102,15,56,0,224
|
||||||
.byte 102,15,56,0,233
|
db 102,15,56,0,233
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
psllq $60,%xmm5
|
psllq xmm5,60
|
||||||
movdqa %xmm5,%xmm6
|
movdqa xmm6,xmm5
|
||||||
pslldq $8,%xmm6
|
pslldq xmm6,8
|
||||||
pxor %xmm6,%xmm3
|
pxor xmm3,xmm6
|
||||||
psrldq $8,%xmm5
|
psrldq xmm5,8
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
psrlq $4,%xmm4
|
psrlq xmm4,4
|
||||||
pxor %xmm4,%xmm2
|
pxor xmm2,xmm4
|
||||||
subl $1,%eax
|
sub eax,1
|
||||||
jnz .L001loop_row_1
|
jnz NEAR L$001loop_row_1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $5,%xmm3
|
psrlq xmm3,5
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
pxor %xmm3,%xmm3
|
pxor xmm3,xmm3
|
||||||
movl $5,%eax
|
mov eax,5
|
||||||
.L002loop_row_2:
|
L$002loop_row_2:
|
||||||
movdqa (%esi),%xmm4
|
movdqa xmm4,[esi]
|
||||||
leal 16(%esi),%esi
|
lea esi,[16+esi]
|
||||||
movdqa %xmm2,%xmm6
|
movdqa xmm6,xmm2
|
||||||
.byte 102,15,58,15,243,1
|
db 102,15,58,15,243,1
|
||||||
movdqa %xmm6,%xmm3
|
movdqa xmm3,xmm6
|
||||||
psrldq $1,%xmm2
|
psrldq xmm2,1
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
.byte 102,15,56,0,224
|
db 102,15,56,0,224
|
||||||
.byte 102,15,56,0,233
|
db 102,15,56,0,233
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
psllq $60,%xmm5
|
psllq xmm5,60
|
||||||
movdqa %xmm5,%xmm6
|
movdqa xmm6,xmm5
|
||||||
pslldq $8,%xmm6
|
pslldq xmm6,8
|
||||||
pxor %xmm6,%xmm3
|
pxor xmm3,xmm6
|
||||||
psrldq $8,%xmm5
|
psrldq xmm5,8
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
psrlq $4,%xmm4
|
psrlq xmm4,4
|
||||||
pxor %xmm4,%xmm2
|
pxor xmm2,xmm4
|
||||||
subl $1,%eax
|
sub eax,1
|
||||||
jnz .L002loop_row_2
|
jnz NEAR L$002loop_row_2
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $5,%xmm3
|
psrlq xmm3,5
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
pxor %xmm3,%xmm3
|
pxor xmm3,xmm3
|
||||||
movl $6,%eax
|
mov eax,6
|
||||||
.L003loop_row_3:
|
L$003loop_row_3:
|
||||||
movdqa (%esi),%xmm4
|
movdqa xmm4,[esi]
|
||||||
leal 16(%esi),%esi
|
lea esi,[16+esi]
|
||||||
movdqa %xmm2,%xmm6
|
movdqa xmm6,xmm2
|
||||||
.byte 102,15,58,15,243,1
|
db 102,15,58,15,243,1
|
||||||
movdqa %xmm6,%xmm3
|
movdqa xmm3,xmm6
|
||||||
psrldq $1,%xmm2
|
psrldq xmm2,1
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
.byte 102,15,56,0,224
|
db 102,15,56,0,224
|
||||||
.byte 102,15,56,0,233
|
db 102,15,56,0,233
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
psllq $60,%xmm5
|
psllq xmm5,60
|
||||||
movdqa %xmm5,%xmm6
|
movdqa xmm6,xmm5
|
||||||
pslldq $8,%xmm6
|
pslldq xmm6,8
|
||||||
pxor %xmm6,%xmm3
|
pxor xmm3,xmm6
|
||||||
psrldq $8,%xmm5
|
psrldq xmm5,8
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
psrlq $4,%xmm4
|
psrlq xmm4,4
|
||||||
pxor %xmm4,%xmm2
|
pxor xmm2,xmm4
|
||||||
subl $1,%eax
|
sub eax,1
|
||||||
jnz .L003loop_row_3
|
jnz NEAR L$003loop_row_3
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $5,%xmm3
|
psrlq xmm3,5
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
pxor %xmm3,%xmm3
|
pxor xmm3,xmm3
|
||||||
.byte 102,15,56,0,215
|
db 102,15,56,0,215
|
||||||
movdqu %xmm2,(%edi)
|
movdqu [edi],xmm2
|
||||||
pxor %xmm0,%xmm0
|
pxor xmm0,xmm0
|
||||||
pxor %xmm1,%xmm1
|
pxor xmm1,xmm1
|
||||||
pxor %xmm2,%xmm2
|
pxor xmm2,xmm2
|
||||||
pxor %xmm3,%xmm3
|
pxor xmm3,xmm3
|
||||||
pxor %xmm4,%xmm4
|
pxor xmm4,xmm4
|
||||||
pxor %xmm5,%xmm5
|
pxor xmm5,xmm5
|
||||||
pxor %xmm6,%xmm6
|
pxor xmm6,xmm6
|
||||||
popl %edi
|
pop edi
|
||||||
popl %esi
|
pop esi
|
||||||
popl %ebx
|
pop ebx
|
||||||
popl %ebp
|
pop ebp
|
||||||
ret
|
ret
|
||||||
.globl _gcm_ghash_ssse3
|
global _gcm_ghash_ssse3
|
||||||
.hidden _gcm_ghash_ssse3
|
align 16
|
||||||
.def _gcm_ghash_ssse3; .scl 2; .type 32; .endef
|
|
||||||
.align 16
|
|
||||||
_gcm_ghash_ssse3:
|
_gcm_ghash_ssse3:
|
||||||
.L_gcm_ghash_ssse3_begin:
|
L$_gcm_ghash_ssse3_begin:
|
||||||
pushl %ebp
|
push ebp
|
||||||
pushl %ebx
|
push ebx
|
||||||
pushl %esi
|
push esi
|
||||||
pushl %edi
|
push edi
|
||||||
movl 20(%esp),%edi
|
mov edi,DWORD [20+esp]
|
||||||
movl 24(%esp),%esi
|
mov esi,DWORD [24+esp]
|
||||||
movl 28(%esp),%edx
|
mov edx,DWORD [28+esp]
|
||||||
movl 32(%esp),%ecx
|
mov ecx,DWORD [32+esp]
|
||||||
movdqu (%edi),%xmm0
|
movdqu xmm0,[edi]
|
||||||
call .L004pic_point
|
call L$004pic_point
|
||||||
.L004pic_point:
|
L$004pic_point:
|
||||||
popl %ebx
|
pop ebx
|
||||||
movdqa .Lreverse_bytes-.L004pic_point(%ebx),%xmm7
|
movdqa xmm7,[(L$reverse_bytes-L$004pic_point)+ebx]
|
||||||
andl $-16,%ecx
|
and ecx,-16
|
||||||
.byte 102,15,56,0,199
|
db 102,15,56,0,199
|
||||||
pxor %xmm3,%xmm3
|
pxor xmm3,xmm3
|
||||||
.L005loop_ghash:
|
L$005loop_ghash:
|
||||||
movdqa .Llow4_mask-.L004pic_point(%ebx),%xmm2
|
movdqa xmm2,[(L$low4_mask-L$004pic_point)+ebx]
|
||||||
movdqu (%edx),%xmm1
|
movdqu xmm1,[edx]
|
||||||
.byte 102,15,56,0,207
|
db 102,15,56,0,207
|
||||||
pxor %xmm1,%xmm0
|
pxor xmm0,xmm1
|
||||||
movdqa %xmm2,%xmm1
|
movdqa xmm1,xmm2
|
||||||
pandn %xmm0,%xmm1
|
pandn xmm1,xmm0
|
||||||
psrld $4,%xmm1
|
psrld xmm1,4
|
||||||
pand %xmm2,%xmm0
|
pand xmm0,xmm2
|
||||||
pxor %xmm2,%xmm2
|
pxor xmm2,xmm2
|
||||||
movl $5,%eax
|
mov eax,5
|
||||||
.L006loop_row_4:
|
L$006loop_row_4:
|
||||||
movdqa (%esi),%xmm4
|
movdqa xmm4,[esi]
|
||||||
leal 16(%esi),%esi
|
lea esi,[16+esi]
|
||||||
movdqa %xmm2,%xmm6
|
movdqa xmm6,xmm2
|
||||||
.byte 102,15,58,15,243,1
|
db 102,15,58,15,243,1
|
||||||
movdqa %xmm6,%xmm3
|
movdqa xmm3,xmm6
|
||||||
psrldq $1,%xmm2
|
psrldq xmm2,1
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
.byte 102,15,56,0,224
|
db 102,15,56,0,224
|
||||||
.byte 102,15,56,0,233
|
db 102,15,56,0,233
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
psllq $60,%xmm5
|
psllq xmm5,60
|
||||||
movdqa %xmm5,%xmm6
|
movdqa xmm6,xmm5
|
||||||
pslldq $8,%xmm6
|
pslldq xmm6,8
|
||||||
pxor %xmm6,%xmm3
|
pxor xmm3,xmm6
|
||||||
psrldq $8,%xmm5
|
psrldq xmm5,8
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
psrlq $4,%xmm4
|
psrlq xmm4,4
|
||||||
pxor %xmm4,%xmm2
|
pxor xmm2,xmm4
|
||||||
subl $1,%eax
|
sub eax,1
|
||||||
jnz .L006loop_row_4
|
jnz NEAR L$006loop_row_4
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $5,%xmm3
|
psrlq xmm3,5
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
pxor %xmm3,%xmm3
|
pxor xmm3,xmm3
|
||||||
movl $5,%eax
|
mov eax,5
|
||||||
.L007loop_row_5:
|
L$007loop_row_5:
|
||||||
movdqa (%esi),%xmm4
|
movdqa xmm4,[esi]
|
||||||
leal 16(%esi),%esi
|
lea esi,[16+esi]
|
||||||
movdqa %xmm2,%xmm6
|
movdqa xmm6,xmm2
|
||||||
.byte 102,15,58,15,243,1
|
db 102,15,58,15,243,1
|
||||||
movdqa %xmm6,%xmm3
|
movdqa xmm3,xmm6
|
||||||
psrldq $1,%xmm2
|
psrldq xmm2,1
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
.byte 102,15,56,0,224
|
db 102,15,56,0,224
|
||||||
.byte 102,15,56,0,233
|
db 102,15,56,0,233
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
psllq $60,%xmm5
|
psllq xmm5,60
|
||||||
movdqa %xmm5,%xmm6
|
movdqa xmm6,xmm5
|
||||||
pslldq $8,%xmm6
|
pslldq xmm6,8
|
||||||
pxor %xmm6,%xmm3
|
pxor xmm3,xmm6
|
||||||
psrldq $8,%xmm5
|
psrldq xmm5,8
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
psrlq $4,%xmm4
|
psrlq xmm4,4
|
||||||
pxor %xmm4,%xmm2
|
pxor xmm2,xmm4
|
||||||
subl $1,%eax
|
sub eax,1
|
||||||
jnz .L007loop_row_5
|
jnz NEAR L$007loop_row_5
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $5,%xmm3
|
psrlq xmm3,5
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
pxor %xmm3,%xmm3
|
pxor xmm3,xmm3
|
||||||
movl $6,%eax
|
mov eax,6
|
||||||
.L008loop_row_6:
|
L$008loop_row_6:
|
||||||
movdqa (%esi),%xmm4
|
movdqa xmm4,[esi]
|
||||||
leal 16(%esi),%esi
|
lea esi,[16+esi]
|
||||||
movdqa %xmm2,%xmm6
|
movdqa xmm6,xmm2
|
||||||
.byte 102,15,58,15,243,1
|
db 102,15,58,15,243,1
|
||||||
movdqa %xmm6,%xmm3
|
movdqa xmm3,xmm6
|
||||||
psrldq $1,%xmm2
|
psrldq xmm2,1
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
.byte 102,15,56,0,224
|
db 102,15,56,0,224
|
||||||
.byte 102,15,56,0,233
|
db 102,15,56,0,233
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
movdqa %xmm4,%xmm5
|
movdqa xmm5,xmm4
|
||||||
psllq $60,%xmm5
|
psllq xmm5,60
|
||||||
movdqa %xmm5,%xmm6
|
movdqa xmm6,xmm5
|
||||||
pslldq $8,%xmm6
|
pslldq xmm6,8
|
||||||
pxor %xmm6,%xmm3
|
pxor xmm3,xmm6
|
||||||
psrldq $8,%xmm5
|
psrldq xmm5,8
|
||||||
pxor %xmm5,%xmm2
|
pxor xmm2,xmm5
|
||||||
psrlq $4,%xmm4
|
psrlq xmm4,4
|
||||||
pxor %xmm4,%xmm2
|
pxor xmm2,xmm4
|
||||||
subl $1,%eax
|
sub eax,1
|
||||||
jnz .L008loop_row_6
|
jnz NEAR L$008loop_row_6
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $1,%xmm3
|
psrlq xmm3,1
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
psrlq $5,%xmm3
|
psrlq xmm3,5
|
||||||
pxor %xmm3,%xmm2
|
pxor xmm2,xmm3
|
||||||
pxor %xmm3,%xmm3
|
pxor xmm3,xmm3
|
||||||
movdqa %xmm2,%xmm0
|
movdqa xmm0,xmm2
|
||||||
leal -256(%esi),%esi
|
lea esi,[esi-256]
|
||||||
leal 16(%edx),%edx
|
lea edx,[16+edx]
|
||||||
subl $16,%ecx
|
sub ecx,16
|
||||||
jnz .L005loop_ghash
|
jnz NEAR L$005loop_ghash
|
||||||
.byte 102,15,56,0,199
|
db 102,15,56,0,199
|
||||||
movdqu %xmm0,(%edi)
|
movdqu [edi],xmm0
|
||||||
pxor %xmm0,%xmm0
|
pxor xmm0,xmm0
|
||||||
pxor %xmm1,%xmm1
|
pxor xmm1,xmm1
|
||||||
pxor %xmm2,%xmm2
|
pxor xmm2,xmm2
|
||||||
pxor %xmm3,%xmm3
|
pxor xmm3,xmm3
|
||||||
pxor %xmm4,%xmm4
|
pxor xmm4,xmm4
|
||||||
pxor %xmm5,%xmm5
|
pxor xmm5,xmm5
|
||||||
pxor %xmm6,%xmm6
|
pxor xmm6,xmm6
|
||||||
popl %edi
|
pop edi
|
||||||
popl %esi
|
pop esi
|
||||||
popl %ebx
|
pop ebx
|
||||||
popl %ebp
|
pop ebp
|
||||||
ret
|
ret
|
||||||
.align 16
|
align 16
|
||||||
.Lreverse_bytes:
|
L$reverse_bytes:
|
||||||
.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
|
db 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
|
||||||
.align 16
|
align 16
|
||||||
.Llow4_mask:
|
L$low4_mask:
|
||||||
.long 252645135,252645135,252645135,252645135
|
dd 252645135,252645135,252645135,252645135
|
||||||
#endif
|
%endif
|
||||||
#endif // defined(__i386__) && defined(_WIN32)
|
#endif // defined(__i386__) && defined(_WIN32)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -426,7 +426,10 @@ gcm_ghash_ssse3:
|
|||||||
.Llow4_mask:
|
.Llow4_mask:
|
||||||
.quad 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f
|
.quad 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__linux__)
|
#endif // defined(__x86_64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -426,6 +426,10 @@ L$reverse_bytes:
|
|||||||
L$low4_mask:
|
L$low4_mask:
|
||||||
.quad 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f
|
.quad 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__APPLE__)
|
#endif // defined(__x86_64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
// This file is generated from a similarly-named Perl script in the BoringSSL
|
// This file is generated from a similarly-named Perl script in the BoringSSL
|
||||||
// source tree. Do not edit by hand.
|
// source tree. Do not edit by hand.
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__has_feature)
|
||||||
|
#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
|
||||||
|
#define OPENSSL_NO_ASM
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -328,8 +334,11 @@ gcm_ghash_clmul:
|
|||||||
.byte 82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112
|
.byte 82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112
|
||||||
.byte 112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62
|
.byte 112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62
|
||||||
.byte 0
|
.byte 0
|
||||||
|
#endif // !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
|
||||||
#endif // defined(__i386__) && defined(__linux__)
|
#endif // defined(__i386__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -1,18 +1,25 @@
|
|||||||
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
||||||
#if defined(__i386__) && defined(_WIN32)
|
#if defined(__i386__) && defined(_WIN32)
|
||||||
// This file is generated from a similarly-named Perl script in the BoringSSL
|
; This file is generated from a similarly-named Perl script in the BoringSSL
|
||||||
// source tree. Do not edit by hand.
|
; source tree. Do not edit by hand.
|
||||||
|
|
||||||
#if defined(__i386__)
|
%ifdef BORINGSSL_PREFIX
|
||||||
#if defined(BORINGSSL_PREFIX)
|
%include "boringssl_prefix_symbols_nasm.inc"
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
%endif
|
||||||
#endif
|
%ifidn __OUTPUT_FORMAT__, win32
|
||||||
.text
|
%ifidn __OUTPUT_FORMAT__,obj
|
||||||
.byte 71,72,65,83,72,32,102,111,114,32,120,56,54,44,32,67
|
section code use32 class=code align=64
|
||||||
.byte 82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112
|
%elifidn __OUTPUT_FORMAT__,win32
|
||||||
.byte 112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62
|
$@feat.00 equ 1
|
||||||
.byte 0
|
section .text code align=64
|
||||||
#endif
|
%else
|
||||||
|
section .text code
|
||||||
|
%endif
|
||||||
|
db 71,72,65,83,72,32,102,111,114,32,120,56,54,44,32,67
|
||||||
|
db 82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112
|
||||||
|
db 112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62
|
||||||
|
db 0
|
||||||
|
%endif
|
||||||
#endif // defined(__i386__) && defined(_WIN32)
|
#endif // defined(__i386__) && defined(_WIN32)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1126,7 +1126,10 @@ gcm_ghash_avx:
|
|||||||
.byte 71,72,65,83,72,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 71,72,65,83,72,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.align 64
|
.align 64
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__linux__)
|
#endif // defined(__x86_64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1125,6 +1125,10 @@ L$7_mask:
|
|||||||
.byte 71,72,65,83,72,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
.byte 71,72,65,83,72,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
|
||||||
.p2align 6
|
.p2align 6
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__APPLE__)
|
#endif // defined(__x86_64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -259,7 +259,11 @@ Ldone_v8:
|
|||||||
.align 2
|
.align 2
|
||||||
.align 2
|
.align 2
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__arm__) && defined(__APPLE__)
|
#endif // defined(__arm__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__ARMEL__) && defined(__ELF__)
|
||||||
#if defined(__arm__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -254,9 +253,11 @@ gcm_ghash_v8:
|
|||||||
.align 2
|
.align 2
|
||||||
.align 2
|
.align 2
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__ARMEL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__arm__) && defined(__linux__)
|
#endif // defined(__arm__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -572,7 +572,11 @@ Ldone4x:
|
|||||||
.align 2
|
.align 2
|
||||||
.align 2
|
.align 2
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__APPLE__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__aarch64__) && defined(__APPLE__)
|
#endif // defined(__aarch64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
#define OPENSSL_NO_ASM
|
#define OPENSSL_NO_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM)
|
#if !defined(OPENSSL_NO_ASM) && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
#if defined(__aarch64__)
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -573,9 +572,11 @@ gcm_ghash_v8_4x:
|
|||||||
.align 2
|
.align 2
|
||||||
.align 2
|
.align 2
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !OPENSSL_NO_ASM && defined(__AARCH64EL__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // !OPENSSL_NO_ASM
|
|
||||||
.section .note.GNU-stack,"",%progbits
|
|
||||||
#endif // defined(__aarch64__) && defined(__linux__)
|
#endif // defined(__aarch64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
// This file is generated from a similarly-named Perl script in the BoringSSL
|
// This file is generated from a similarly-named Perl script in the BoringSSL
|
||||||
// source tree. Do not edit by hand.
|
// source tree. Do not edit by hand.
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__has_feature)
|
||||||
|
#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
|
||||||
|
#define OPENSSL_NO_ASM
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -686,8 +692,11 @@ md5_block_asm_data_order:
|
|||||||
popl %esi
|
popl %esi
|
||||||
ret
|
ret
|
||||||
.size md5_block_asm_data_order,.-.L_md5_block_asm_data_order_begin
|
.size md5_block_asm_data_order,.-.L_md5_block_asm_data_order_begin
|
||||||
|
#endif // !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
|
||||||
#endif // defined(__i386__) && defined(__linux__)
|
#endif // defined(__i386__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__ELF__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -701,7 +701,10 @@ md5_block_asm_data_order:
|
|||||||
.cfi_endproc
|
.cfi_endproc
|
||||||
.size md5_block_asm_data_order,.-md5_block_asm_data_order
|
.size md5_block_asm_data_order,.-md5_block_asm_data_order
|
||||||
#endif
|
#endif
|
||||||
.section .note.GNU-stack,"",@progbits
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__linux__)
|
#endif // defined(__x86_64__) && defined(__linux__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM)
|
#if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) && defined(__APPLE__)
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -695,6 +695,10 @@ L$epilogue:
|
|||||||
.byte 0xf3,0xc3
|
.byte 0xf3,0xc3
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if defined(__ELF__)
|
||||||
|
// See https://www.airs.com/blog/archives/518.
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
#endif
|
#endif
|
||||||
#endif // defined(__x86_64__) && defined(__APPLE__)
|
#endif // defined(__x86_64__) && defined(__APPLE__)
|
||||||
#if defined(__linux__) && defined(__ELF__)
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
|||||||
@@ -132,6 +132,46 @@ void gcm_init_ssse3(u128 Htable[16], const uint64_t H[2]) {
|
|||||||
(*gcm_ghash_p)((ctx)->Xi.u, (ctx)->gcm_key.Htable, in, len)
|
(*gcm_ghash_p)((ctx)->Xi.u, (ctx)->gcm_key.Htable, in, len)
|
||||||
#endif // GCM_FUNCREF
|
#endif // GCM_FUNCREF
|
||||||
|
|
||||||
|
#if defined(HW_GCM) && defined(OPENSSL_X86_64)
|
||||||
|
static size_t hw_gcm_encrypt(const uint8_t *in, uint8_t *out, size_t len,
|
||||||
|
const AES_KEY *key, uint8_t ivec[16],
|
||||||
|
uint64_t *Xi) {
|
||||||
|
return aesni_gcm_encrypt(in, out, len, key, ivec, Xi);
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t hw_gcm_decrypt(const uint8_t *in, uint8_t *out, size_t len,
|
||||||
|
const AES_KEY *key, uint8_t ivec[16],
|
||||||
|
uint64_t *Xi) {
|
||||||
|
return aesni_gcm_decrypt(in, out, len, key, ivec, Xi);
|
||||||
|
}
|
||||||
|
#endif // HW_GCM && X86_64
|
||||||
|
|
||||||
|
#if defined(HW_GCM) && defined(OPENSSL_AARCH64)
|
||||||
|
|
||||||
|
static size_t hw_gcm_encrypt(const uint8_t *in, uint8_t *out, size_t len,
|
||||||
|
const AES_KEY *key, uint8_t ivec[16],
|
||||||
|
uint64_t *Xi) {
|
||||||
|
const size_t len_blocks = len & kSizeTWithoutLower4Bits;
|
||||||
|
if (!len_blocks) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
aes_gcm_enc_kernel(in, len_blocks * 8, out, Xi, ivec, key);
|
||||||
|
return len_blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t hw_gcm_decrypt(const uint8_t *in, uint8_t *out, size_t len,
|
||||||
|
const AES_KEY *key, uint8_t ivec[16],
|
||||||
|
uint64_t *Xi) {
|
||||||
|
const size_t len_blocks = len & kSizeTWithoutLower4Bits;
|
||||||
|
if (!len_blocks) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
aes_gcm_dec_kernel(in, len_blocks * 8, out, Xi, ivec, key);
|
||||||
|
return len_blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // HW_GCM && AARCH64
|
||||||
|
|
||||||
void CRYPTO_ghash_init(gmult_func *out_mult, ghash_func *out_hash,
|
void CRYPTO_ghash_init(gmult_func *out_mult, ghash_func *out_hash,
|
||||||
u128 *out_key, u128 out_table[16], int *out_is_avx,
|
u128 *out_key, u128 out_table[16], int *out_is_avx,
|
||||||
const uint8_t gcm_key[16]) {
|
const uint8_t gcm_key[16]) {
|
||||||
@@ -217,7 +257,12 @@ void CRYPTO_gcm128_init_key(GCM128_KEY *gcm_key, const AES_KEY *aes_key,
|
|||||||
CRYPTO_ghash_init(&gcm_key->gmult, &gcm_key->ghash, &gcm_key->H,
|
CRYPTO_ghash_init(&gcm_key->gmult, &gcm_key->ghash, &gcm_key->H,
|
||||||
gcm_key->Htable, &is_avx, ghash_key);
|
gcm_key->Htable, &is_avx, ghash_key);
|
||||||
|
|
||||||
gcm_key->use_aesni_gcm_crypt = (is_avx && block_is_hwaes) ? 1 : 0;
|
#if defined(OPENSSL_AARCH64) && !defined(OPENSSL_NO_ASM)
|
||||||
|
gcm_key->use_hw_gcm_crypt = (gcm_pmull_capable() && block_is_hwaes) ? 1 :
|
||||||
|
0;
|
||||||
|
#else
|
||||||
|
gcm_key->use_hw_gcm_crypt = (is_avx && block_is_hwaes) ? 1 : 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const AES_KEY *key,
|
void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const AES_KEY *key,
|
||||||
@@ -544,12 +589,12 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, const AES_KEY *key,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(AESNI_GCM)
|
#if defined(HW_GCM)
|
||||||
// Check |len| to work around a C language bug. See https://crbug.com/1019588.
|
// Check |len| to work around a C language bug. See https://crbug.com/1019588.
|
||||||
if (ctx->gcm_key.use_aesni_gcm_crypt && len > 0) {
|
if (ctx->gcm_key.use_hw_gcm_crypt && len > 0) {
|
||||||
// |aesni_gcm_encrypt| may not process all the input given to it. It may
|
// |hw_gcm_encrypt| may not process all the input given to it. It may
|
||||||
// not process *any* of its input if it is deemed too small.
|
// not process *any* of its input if it is deemed too small.
|
||||||
size_t bulk = aesni_gcm_encrypt(in, out, len, key, ctx->Yi.c, ctx->Xi.u);
|
size_t bulk = hw_gcm_encrypt(in, out, len, key, ctx->Yi.c, ctx->Xi.u);
|
||||||
in += bulk;
|
in += bulk;
|
||||||
out += bulk;
|
out += bulk;
|
||||||
len -= bulk;
|
len -= bulk;
|
||||||
@@ -632,12 +677,12 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, const AES_KEY *key,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(AESNI_GCM)
|
#if defined(HW_GCM)
|
||||||
// Check |len| to work around a C language bug. See https://crbug.com/1019588.
|
// Check |len| to work around a C language bug. See https://crbug.com/1019588.
|
||||||
if (ctx->gcm_key.use_aesni_gcm_crypt && len > 0) {
|
if (ctx->gcm_key.use_hw_gcm_crypt && len > 0) {
|
||||||
// |aesni_gcm_decrypt| may not process all the input given to it. It may
|
// |hw_gcm_decrypt| may not process all the input given to it. It may
|
||||||
// not process *any* of its input if it is deemed too small.
|
// not process *any* of its input if it is deemed too small.
|
||||||
size_t bulk = aesni_gcm_decrypt(in, out, len, key, ctx->Yi.c, ctx->Xi.u);
|
size_t bulk = hw_gcm_decrypt(in, out, len, key, ctx->Yi.c, ctx->Xi.u);
|
||||||
in += bulk;
|
in += bulk;
|
||||||
out += bulk;
|
out += bulk;
|
||||||
len -= bulk;
|
len -= bulk;
|
||||||
|
|||||||
Loaded 100 of 249 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user