Update BoringSSL to 4ca15d5dcbe6e8051a4654df7c971ea8307abfe0 (#142)

This commit is contained in:
Cory Benfield authored and GitHub committed 2019-10-10 13:36:50 +01:00
1 parent 8a5135cce9
commit bd235c580b
70 files changed
+329 -110

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ import PackageDescription
// Sources/CNIOBoringSSL directory. The source repository is at
// https://boringssl.googlesource.com/boringssl.
//
// BoringSSL Commit: 6e7255c17e1a7348a2377fbc804441dd284806e2
// BoringSSL Commit: 4ca15d5dcbe6e8051a4654df7c971ea8307abfe0
let package = Package(
name: "swift-nio-ssl",
@@ -1490,6 +1490,7 @@ ChaCha20_neon:
.size ChaCha20_neon,.-ChaCha20_neon
.comm OPENSSL_armcap_P,4,4
#endif
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -1982,6 +1982,7 @@ ChaCha20_512_neon:
ldp x29,x30,[sp],#96
ret
.size ChaCha20_512_neon,.-ChaCha20_512_neon
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__aarch64__) && defined(__linux__)
@@ -973,6 +973,7 @@ ChaCha20_ssse3:
.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 114,103,62,0
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1631,6 +1631,7 @@ ChaCha20_8x:
.byte 0xf3,0xc3
.cfi_endproc
.size ChaCha20_8x,.-ChaCha20_8x
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -3077,6 +3077,7 @@ aes256gcmsiv_kdf:
.byte 0xf3,0xc3
.cfi_endproc
.size aes256gcmsiv_kdf, .-aes256gcmsiv_kdf
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -8985,6 +8985,7 @@ seal_avx2_short_tail:
vzeroupper
jmp seal_sse_tail_16
.cfi_endproc
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -2131,6 +2131,10 @@ mov sp,r12
vpop {q4,q5,q6,q7}
bx lr
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif
#endif /* !OPENSSL_NO_ASM && __arm__ && !__APPLE__ */
#endif // defined(__arm__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -3261,6 +3261,7 @@ aes_nohw_set_decrypt_key:
.byte 65,69,83,32,102,111,114,32,120,56,54,44,32,67,82,89
.byte 80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114
.byte 111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1219,6 +1219,7 @@ _armv4_AES_decrypt:
.byte 65,69,83,32,102,111,114,32,65,82,77,118,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 2
.align 2
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -2663,6 +2663,7 @@ aes_nohw_cbc_encrypt:
.long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
.byte 65,69,83,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
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -850,6 +850,7 @@ aesni_gcm_encrypt:
.byte 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -2511,6 +2511,7 @@ aes_hw_set_decrypt_key:
.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 115,108,46,111,114,103,62,0
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -2504,6 +2504,7 @@ __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
.align 64
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -778,6 +778,7 @@ aes_hw_ctr32_encrypt_blocks:
ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,pc}
.size aes_hw_ctr32_encrypt_blocks,.-aes_hw_ctr32_encrypt_blocks
#endif
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -772,6 +772,7 @@ aes_hw_ctr32_encrypt_blocks:
ret
.size aes_hw_ctr32_encrypt_blocks,.-aes_hw_ctr32_encrypt_blocks
#endif
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__aarch64__) && defined(__linux__)
@@ -974,6 +974,7 @@ bn_mul8x_mont_neon:
.comm OPENSSL_armcap_P,4,4
.hidden OPENSSL_armcap_P
#endif
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -1420,6 +1420,7 @@ __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
.align 2
.align 4
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__aarch64__) && defined(__linux__)
@@ -1542,6 +1542,7 @@ bn_sub_part_words:
popl %ebp
ret
.size bn_sub_part_words,.-.L_bn_sub_part_words_begin
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1526,6 +1526,7 @@ bsaes_ctr32_encrypt_blocks:
@ out to retain a constant-time implementation.
.size bsaes_ctr32_encrypt_blocks,.-bsaes_ctr32_encrypt_blocks
#endif
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -1264,6 +1264,7 @@ bn_sqr_comba4:
popl %esi
ret
.size bn_sqr_comba4,.-.L_bn_sqr_comba4_begin
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -588,6 +588,7 @@ 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
.align 2
.align 2
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -338,6 +338,7 @@ 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
.align 2
.align 2
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__aarch64__) && defined(__linux__)
@@ -292,6 +292,7 @@ gcm_ghash_ssse3:
.align 16
.Llow4_mask:
.long 252645135,252645135,252645135,252645135
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -425,6 +425,7 @@ gcm_ghash_ssse3:
.Llow4_mask:
.quad 0x0f0f0f0f0f0f0f0f, 0x0f0f0f0f0f0f0f0f
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1073,6 +1073,7 @@ gcm_ghash_clmul:
.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 0
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1870,6 +1870,7 @@ 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
.align 64
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -250,6 +250,7 @@ gcm_ghash_v8:
.byte 71,72,65,83,72,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
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -246,6 +246,7 @@ gcm_ghash_v8:
.byte 71,72,65,83,72,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
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__aarch64__) && defined(__linux__)
@@ -686,6 +686,7 @@ md5_block_asm_data_order:
popl %esi
ret
.size md5_block_asm_data_order,.-.L_md5_block_asm_data_order_begin
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -700,6 +700,7 @@ md5_block_asm_data_order:
.byte 0xf3,0xc3
.cfi_endproc
.size md5_block_asm_data_order,.-md5_block_asm_data_order
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -4541,6 +4541,7 @@ ecp_nistz256_point_add_affinex:
.byte 0xf3,0xc3
.cfi_endproc
.size ecp_nistz256_point_add_affinex,.-ecp_nistz256_point_add_affinex
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -341,6 +341,7 @@ beeu_mod_inverse_vartime:
.cfi_endproc
.size beeu_mod_inverse_vartime, .-beeu_mod_inverse_vartime
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -41,6 +41,11 @@ void RAND_bytes_with_additional_data(uint8_t *out, size_t out_len,
void CRYPTO_sysrand(uint8_t *buf, size_t len);
#if defined(OPENSSL_URANDOM) && defined(BORINGSSL_FIPS)
// CRYPTO_sysrand_for_seed fills |len| bytes at |buf| with entropy from the
// operating system. It may draw from the |GRND_RANDOM| pool on Android,
// depending on the vendor's configuration.
void CRYPTO_sysrand_for_seed(uint8_t *buf, size_t len);
// CRYPTO_sysrand_if_available fills |len| bytes at |buf| with entropy from the
// operating system, if the entropy pool is initialized. If it is uninitialized,
// it will not block and will instead fill |buf| with all zeros or early
@@ -32,9 +32,9 @@
// It's assumed that the operating system always has an unfailing source of
// entropy which is accessed via |CRYPTO_sysrand|. (If the operating system
// entropy source fails, it's up to |CRYPTO_sysrand| to abort the process—we
// don't try to handle it.)
// entropy which is accessed via |CRYPTO_sysrand[_for_seed]|. (If the operating
// system entropy source fails, it's up to |CRYPTO_sysrand| to abort the
// process—we don't try to handle it.)
//
// In addition, the hardware may provide a low-latency RNG. Intel's rdrand
// instruction is the canonical example of this. When a hardware RNG is
@@ -61,11 +61,11 @@ struct rand_thread_state {
// (re)seeded. This is bound by |kReseedInterval|.
unsigned calls;
// last_block_valid is non-zero iff |last_block| contains data from
// |CRYPTO_sysrand|.
// |CRYPTO_sysrand_for_seed|.
int last_block_valid;
#if defined(BORINGSSL_FIPS)
// last_block contains the previous block from |CRYPTO_sysrand|.
// last_block contains the previous block from |CRYPTO_sysrand_for_seed|.
uint8_t last_block[CRNGT_BLOCK_SIZE];
// next and prev form a NULL-terminated, double-linked list of all states in
// a process.
@@ -169,7 +169,7 @@ static void rand_get_seed(struct rand_thread_state *state,
uint8_t seed[CTR_DRBG_ENTROPY_LEN]) {
if (!state->last_block_valid) {
if (!hwrand(state->last_block, sizeof(state->last_block))) {
CRYPTO_sysrand(state->last_block, sizeof(state->last_block));
CRYPTO_sysrand_for_seed(state->last_block, sizeof(state->last_block));
}
state->last_block_valid = 1;
}
@@ -181,7 +181,7 @@ static void rand_get_seed(struct rand_thread_state *state,
int used_hwrand = hwrand(entropy, sizeof(entropy));
if (!used_hwrand) {
CRYPTO_sysrand(entropy, sizeof(entropy));
CRYPTO_sysrand_for_seed(entropy, sizeof(entropy));
}
// See FIPS 140-2, section 4.9.2. This is the “continuous random number
@@ -36,6 +36,10 @@
#endif
#include <sys/syscall.h>
#if defined(OPENSSL_ANDROID)
#include <sys/system_properties.h>
#endif
#if !defined(OPENSSL_ANDROID)
#define OPENSSL_HAS_GETAUXVAL
#endif
@@ -120,6 +124,9 @@ static ssize_t boringssl_getrandom(void *buf, size_t buf_len, unsigned flags) {
#if !defined(GRND_NONBLOCK)
#define GRND_NONBLOCK 1
#endif
#if !defined(GRND_RANDOM)
#define GRND_RANDOM 2
#endif
#endif // OPENSSL_LINUX
@@ -138,10 +145,36 @@ DEFINE_BSS_GET(int, urandom_fd_requested)
DEFINE_BSS_GET(int, urandom_fd)
#if defined(USE_NR_getrandom)
// getrandom_ready is one if |getrandom| had been initialized by the time
// |init_once| was called and zero otherwise.
DEFINE_BSS_GET(int, getrandom_ready)
// extra_getrandom_flags_for_seed contains a value that is ORed into the flags
// for getrandom() when reading entropy for a seed.
DEFINE_BSS_GET(int, extra_getrandom_flags_for_seed)
// On Android, check a system property to decide whether to set
// |extra_getrandom_flags_for_seed| otherwise they will default to zero. If
// ro.oem_boringcrypto_hwrand is true then |extra_getrandom_flags_for_seed| will
// be set to GRND_RANDOM, causing all random data to be drawn from the same
// source as /dev/random.
static void maybe_set_extra_getrandom_flags(void) {
#if defined(BORINGSSL_FIPS) && defined(OPENSSL_ANDROID)
char value[PROP_VALUE_MAX + 1];
int length = __system_property_get("ro.boringcrypto.hwrand", value);
if (length < 0 || length > PROP_VALUE_MAX) {
return;
}
value[length] = 0;
if (strcasecmp(value, "true") == 0) {
*extra_getrandom_flags_for_seed_bss_get() = GRND_RANDOM;
}
#endif
}
#endif // USE_NR_getrandom
DEFINE_STATIC_ONCE(rand_once)
@@ -176,6 +209,7 @@ static void init_once(void) {
if (have_getrandom) {
*urandom_fd_bss_get() = kHaveGetrandom;
maybe_set_extra_getrandom_flags();
return;
}
#endif // USE_NR_getrandom
@@ -346,11 +380,23 @@ void RAND_set_urandom_fd(int fd) {
// on success and zero on error. If |block| is one, this function will block
// until the entropy pool is initialized. Otherwise, this function may fail,
// setting |errno| to |EAGAIN| if the entropy pool has not yet been initialized.
static int fill_with_entropy(uint8_t *out, size_t len, int block) {
// If |seed| is one, this function will OR in the value of
// |*extra_getrandom_flags_for_seed()| when using |getrandom|.
static int fill_with_entropy(uint8_t *out, size_t len, int block, int seed) {
if (len == 0) {
return 1;
}
#if defined(USE_NR_getrandom)
int getrandom_flags = 0;
if (block) {
getrandom_flags |= GRND_NONBLOCK;
}
if (seed) {
getrandom_flags |= *extra_getrandom_flags_for_seed_bss_get();
}
#endif
CRYPTO_once(rand_once_bss_get(), init_once);
if (block) {
CRYPTO_once(wait_for_entropy_once_bss_get(), wait_for_entropy);
@@ -364,7 +410,7 @@ static int fill_with_entropy(uint8_t *out, size_t len, int block) {
if (*urandom_fd_bss_get() == kHaveGetrandom) {
#if defined(USE_NR_getrandom)
r = boringssl_getrandom(out, len, block ? 0 : GRND_NONBLOCK);
r = boringssl_getrandom(out, len, getrandom_flags);
#elif defined(OPENSSL_MACOS)
if (__builtin_available(macos 10.12, *)) {
// |getentropy| can only request 256 bytes at a time.
@@ -400,7 +446,15 @@ static int fill_with_entropy(uint8_t *out, size_t len, int block) {
// CRYPTO_sysrand puts |requested| random bytes into |out|.
void CRYPTO_sysrand(uint8_t *out, size_t requested) {
if (!fill_with_entropy(out, requested, /*block=*/1)) {
if (!fill_with_entropy(out, requested, /*block=*/1, /*seed=*/0)) {
perror("entropy fill failed");
abort();
}
}
#if defined(BORINGSSL_FIPS)
void CRYPTO_sysrand_for_seed(uint8_t *out, size_t requested) {
if (!fill_with_entropy(out, requested, /*block=*/1, /*seed=*/1)) {
perror("entropy fill failed");
abort();
}
@@ -412,12 +466,11 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) {
#endif
}
#if defined(BORINGSSL_FIPS)
void CRYPTO_sysrand_if_available(uint8_t *out, size_t requested) {
// Return all zeros if |fill_with_entropy| fails.
OPENSSL_memset(out, 0, requested);
if (!fill_with_entropy(out, requested, /*block=*/0) &&
if (!fill_with_entropy(out, requested, /*block=*/0, /*seed=*/0) &&
errno != EAGAIN) {
perror("opportunistic entropy fill failed");
abort();
@@ -61,6 +61,7 @@ CRYPTO_rdrand_multiple8_buf:
.byte 0xf3,0xc3
.cfi_endproc
.size CRYPTO_rdrand_multiple8_buf,.-CRYPTO_rdrand_multiple8_buf
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1747,6 +1747,7 @@ rsaz_1024_gather5_avx2:
.long 2,2,2,2, 3,3,3,3
.long 4,4,4,4, 4,4,4,4
.align 64
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -3806,6 +3806,7 @@ _sha1_block_data_order_avx:
.byte 102,111,114,109,32,102,111,114,32,120,56,54,44,32,67,82
.byte 89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112
.byte 114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1508,6 +1508,7 @@ sha1_block_data_order_armv8:
.comm OPENSSL_armcap_P,4,4
.hidden OPENSSL_armcap_P
#endif
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -1232,6 +1232,7 @@ sha1_block_armv8:
.align 2
.comm OPENSSL_armcap_P,4,4
.hidden OPENSSL_armcap_P
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__aarch64__) && defined(__linux__)
@@ -3599,6 +3599,7 @@ K_XX_XX:
.byte 0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0
.byte 83,72,65,49,32,98,108,111,99,107,32,116,114,97,110,115,102,111,114,109,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
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -5565,6 +5565,7 @@ sha256_block_data_order:
popl %ebp
ret
.size sha256_block_data_order,.-.L_sha256_block_data_order_begin
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -2836,6 +2836,7 @@ sha256_block_data_order_armv8:
.comm OPENSSL_armcap_P,4,4
.hidden OPENSSL_armcap_P
#endif
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -1210,6 +1210,7 @@ sha256_block_armv8:
.comm OPENSSL_armcap_P,4,4
.hidden OPENSSL_armcap_P
#endif
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__aarch64__) && defined(__linux__)
@@ -3971,6 +3971,7 @@ sha256_block_data_order_avx:
.byte 0xf3,0xc3
.cfi_endproc
.size sha256_block_data_order_avx,.-sha256_block_data_order_avx
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -2835,6 +2835,7 @@ sha512_block_data_order:
.byte 67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
.byte 112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
.byte 62,0
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1891,6 +1891,7 @@ sha512_block_data_order_neon:
.comm OPENSSL_armcap_P,4,4
.hidden OPENSSL_armcap_P
#endif
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -1082,6 +1082,7 @@ sha512_block_data_order:
.comm OPENSSL_armcap_P,4,4
.hidden OPENSSL_armcap_P
#endif
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__aarch64__) && defined(__linux__)
@@ -2990,6 +2990,7 @@ sha512_block_data_order_avx:
.byte 0xf3,0xc3
.cfi_endproc
.size sha512_block_data_order_avx,.-sha512_block_data_order_avx
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1233,6 +1233,7 @@ vpaes_ctr32_encrypt_blocks:
vldmia sp!, {d8,d9,d10,d11,d12,d13,d14,d15}
ldmia sp!, {r7,r8,r9,r10,r11, pc} @ return
.size vpaes_ctr32_encrypt_blocks,.-vpaes_ctr32_encrypt_blocks
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__arm__) && defined(__linux__)
@@ -1213,6 +1213,7 @@ vpaes_ctr32_encrypt_blocks:
ldp x29,x30,[sp],#16
ret
.size vpaes_ctr32_encrypt_blocks,.-vpaes_ctr32_encrypt_blocks
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__aarch64__) && defined(__linux__)
@@ -706,6 +706,7 @@ vpaes_cbc_encrypt:
popl %ebp
ret
.size vpaes_cbc_encrypt,.-.L_vpaes_cbc_encrypt_begin
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1131,6 +1131,7 @@ _vpaes_consts:
.byte 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105,111,110,32,65,69,83,32,102,111,114,32,120,56,54,95,54,52,47,83,83,83,69,51,44,32,77,105,107,101,32,72,97,109,98,117,114,103,32,40,83,116,97,110,102,111,114,100,32,85,110,105,118,101,114,115,105,116,121,41,0
.align 64
.size _vpaes_consts,.-_vpaes_consts
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -482,6 +482,7 @@ bn_mul_mont:
.byte 54,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121
.byte 32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46
.byte 111,114,103,62,0
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__i386__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -1258,6 +1258,7 @@ bn_mulx4x_mont:
.size bn_mulx4x_mont,.-bn_mulx4x_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,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 16
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -3788,6 +3788,7 @@ bn_gather5:
.long 0,0, 1,1
.long 2,2, 2,2
.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,119,105,116,104,32,115,99,97,116,116,101,114,47,103,97,116,104,101,114,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
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -8462,6 +8462,10 @@ ret
.cfi_endproc
.size poly_Rq_mul,.-poly_Rq_mul
#if defined(__ELF__)
.section .note.GNU-stack,"",@progbits
#endif
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -2024,6 +2024,10 @@ vst1.8 d4,[r0,: 64]
add sp,sp,#0
bx lr
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif
#endif /* __arm__ && !OPENSSL_NO_ASM && !__APPLE__ */
#endif // defined(__arm__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
@@ -996,6 +996,7 @@ sike_mpdblsubx2_asm:
ldp x29, x30, [sp],#16
ret
.section .note.GNU-stack,"",%progbits
#endif
#endif // !OPENSSL_NO_ASM
#endif // defined(__aarch64__) && defined(__linux__)
@@ -1869,6 +1869,7 @@ sike_mpmul:
.cfi_adjust_cfa_offset -8
.byte 0xf3,0xc3
.cfi_endproc
.section .note.GNU-stack,"",@progbits
#endif
#endif // defined(__x86_64__) && defined(__linux__)
#if defined(__linux__) && defined(__ELF__)
+1 -1
View File
@@ -1 +1 @@
This directory is derived from BoringSSL cloned from https://boringssl.googlesource.com/boringssl at revision 6e7255c17e1a7348a2377fbc804441dd284806e2
This directory is derived from BoringSSL cloned from https://boringssl.googlesource.com/boringssl at revision 4ca15d5dcbe6e8051a4654df7c971ea8307abfe0
@@ -4195,29 +4195,6 @@
#define sk_ASN1_VALUE_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_VALUE_is_sorted)
#define sk_ASN1_VALUE_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_VALUE_set_cmp_func)
#define sk_ASN1_VALUE_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_VALUE_deep_copy)
#define sk_CertCompressionAlg_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_call_free_func)
#define sk_CertCompressionAlg_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_call_copy_func)
#define sk_CertCompressionAlg_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_call_cmp_func)
#define sk_CertCompressionAlg_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_new)
#define sk_CertCompressionAlg_new_null BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_new_null)
#define sk_CertCompressionAlg_num BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_num)
#define sk_CertCompressionAlg_zero BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_zero)
#define sk_CertCompressionAlg_value BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_value)
#define sk_CertCompressionAlg_set BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_set)
#define sk_CertCompressionAlg_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_free)
#define sk_CertCompressionAlg_pop_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_pop_free)
#define sk_CertCompressionAlg_insert BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_insert)
#define sk_CertCompressionAlg_delete BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_delete)
#define sk_CertCompressionAlg_delete_ptr BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_delete_ptr)
#define sk_CertCompressionAlg_find BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_find)
#define sk_CertCompressionAlg_shift BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_shift)
#define sk_CertCompressionAlg_push BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_push)
#define sk_CertCompressionAlg_pop BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_pop)
#define sk_CertCompressionAlg_dup BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_dup)
#define sk_CertCompressionAlg_sort BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_sort)
#define sk_CertCompressionAlg_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_is_sorted)
#define sk_CertCompressionAlg_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_set_cmp_func)
#define sk_CertCompressionAlg_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CertCompressionAlg_deep_copy)
#define lh_ASN1_OBJECT_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, lh_ASN1_OBJECT_call_cmp_func)
#define lh_ASN1_OBJECT_call_hash_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, lh_ASN1_OBJECT_call_hash_func)
#define lh_ASN1_OBJECT_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, lh_ASN1_OBJECT_new)
@@ -560,6 +560,13 @@ OPENSSL_EXPORT int SSL_get_error(const SSL *ssl, int ret_code);
#define SSL_ERROR_HANDOFF 17
#define SSL_ERROR_HANDBACK 18
// SSL_ERROR_WANT_RENEGOTIATE indicates the operation is pending a response to
// a renegotiation request from the server. The caller may call
// |SSL_renegotiate| to schedule a renegotiation and retry the operation.
//
// See also |ssl_renegotiate_explicit|.
#define SSL_ERROR_WANT_RENEGOTIATE 19
// SSL_error_description returns a string representation of |err|, where |err|
// is one of the |SSL_ERROR_*| constants returned by |SSL_get_error|, or NULL
// if the value is unrecognized.
@@ -3605,6 +3612,7 @@ enum ssl_renegotiate_mode_t BORINGSSL_ENUM_INT {
ssl_renegotiate_once,
ssl_renegotiate_freely,
ssl_renegotiate_ignore,
ssl_renegotiate_explicit,
};
// SSL_set_renegotiate_mode configures how |ssl|, a client, reacts to
@@ -3618,6 +3626,13 @@ enum ssl_renegotiate_mode_t BORINGSSL_ENUM_INT {
// Note that ignoring HelloRequest messages may cause the connection to stall
// if the server waits for the renegotiation to complete.
//
// If set to |ssl_renegotiate_explicit|, |SSL_read| and |SSL_peek| calls which
// encounter a HelloRequest will pause with |SSL_ERROR_WANT_RENEGOTIATE|.
// |SSL_write| will continue to work while paused. The caller may call
// |SSL_renegotiate| to begin the renegotiation at a later point. This mode may
// be used if callers wish to eagerly call |SSL_peek| without triggering a
// renegotiation.
//
// If configuration shedding is enabled (see |SSL_set_shed_handshake_config|),
// configuration is released if, at any point after the handshake, renegotiation
// is disabled. It is not possible to switch from disabling renegotiation to
@@ -3630,6 +3645,16 @@ enum ssl_renegotiate_mode_t BORINGSSL_ENUM_INT {
OPENSSL_EXPORT void SSL_set_renegotiate_mode(SSL *ssl,
enum ssl_renegotiate_mode_t mode);
// SSL_renegotiate starts a deferred renegotiation on |ssl| if it was configured
// with |ssl_renegotiate_explicit| and has a pending HelloRequest. It returns
// one on success and zero on error.
//
// This function does not do perform any I/O. On success, a subsequent
// |SSL_do_handshake| call will run the handshake. |SSL_write| and
// |SSL_read| will also complete the handshake before sending or receiving
// application data.
OPENSSL_EXPORT int SSL_renegotiate(SSL *ssl);
// SSL_renegotiate_pending returns one if |ssl| is in the middle of a
// renegotiation.
OPENSSL_EXPORT int SSL_renegotiate_pending(SSL *ssl);
@@ -4081,9 +4106,6 @@ OPENSSL_EXPORT int SSL_get_read_ahead(const SSL *ssl);
// SSL_set_read_ahead returns one.
OPENSSL_EXPORT int SSL_set_read_ahead(SSL *ssl, int yes);
// SSL_renegotiate put an error on the error queue and returns zero.
OPENSSL_EXPORT int SSL_renegotiate(SSL *ssl);
// SSL_set_state does nothing.
OPENSSL_EXPORT void SSL_set_state(SSL *ssl, int state);
+96 -3
View File
@@ -353,6 +353,97 @@ class Array {
size_t size_ = 0;
};
// GrowableArray<T> is an array that owns elements of |T|, backed by an
// Array<T>. When necessary, pushing will automatically trigger a resize.
//
// Note, for simplicity, this class currently differs from |std::vector| in that
// |T| must be efficiently default-constructible. Allocated elements beyond the
// end of the array are constructed and destructed.
template <typename T>
class GrowableArray {
public:
GrowableArray() = default;
GrowableArray(const GrowableArray &) = delete;
GrowableArray(GrowableArray &&other) { *this = std::move(other); }
~GrowableArray() {}
GrowableArray &operator=(const GrowableArray &) = delete;
GrowableArray &operator=(GrowableArray &&other) {
size_ = other.size_;
other.size_ = 0;
array_ = std::move(other.array_);
return *this;
}
size_t size() const { return size_; }
bool empty() const { return size_ == 0; }
const T &operator[](size_t i) const { return array_[i]; }
T &operator[](size_t i) { return array_[i]; }
T *begin() { return array_.data(); }
const T *cbegin() const { return array_.data(); }
T *end() { return array_.data() + size_; }
const T *cend() const { return array_.data() + size_; }
// Push adds |elem| at the end of the internal array, growing if necessary. It
// returns false when allocation fails.
bool Push(T elem) {
if (!MaybeGrow()) {
return false;
}
array_[size_] = std::move(elem);
size_++;
return true;
}
// CopyFrom replaces the contents of the array with a copy of |in|. It returns
// true on success and false on allocation error.
bool CopyFrom(Span<const T> in) {
if (!array_.CopyFrom(in)) {
return false;
}
size_ = in.size();
return true;
}
private:
// If there is no room for one more element, creates a new backing array with
// double the size of the old one and copies elements over.
bool MaybeGrow() {
if (array_.size() == 0) {
return array_.Init(kDefaultSize);
}
// No need to grow if we have room for one more T.
if (size_ < array_.size()) {
return true;
}
// Double the array's size if it's safe to do so.
if (array_.size() > std::numeric_limits<size_t>::max() / 2) {
OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
return false;
}
Array<T> new_array;
if (!new_array.Init(array_.size() * 2)) {
return false;
}
for (size_t i = 0; i < array_.size(); i++) {
new_array[i] = std::move(array_[i]);
}
array_ = std::move(new_array);
return true;
}
// |size_| is the number of elements stored in this GrowableArray.
size_t size_ = 0;
// |array_| is the backing array. Note that |array_.size()| is this
// GrowableArray's current capacity and that |size_ <= array_.size()|.
Array<T> array_;
// |kDefaultSize| is the default initial size of the backing array.
static constexpr size_t kDefaultSize = 16;
};
// CBBFinishArray behaves like |CBB_finish| but stores the result in an Array.
OPENSSL_EXPORT bool CBBFinishArray(CBB *cbb, Array<uint8_t> *out);
@@ -2155,8 +2246,6 @@ BSSL_NAMESPACE_END
DEFINE_LHASH_OF(SSL_SESSION)
DEFINE_NAMED_STACK_OF(CertCompressionAlg, bssl::CertCompressionAlg)
BSSL_NAMESPACE_BEGIN
// An ssl_shutdown_t describes the shutdown state of one end of the connection,
@@ -2294,6 +2383,10 @@ struct SSL3_STATE {
// alert_dispatch is true there is an alert in |send_alert| to be sent.
bool alert_dispatch : 1;
// renegotiate_pending is whether the read half of the channel is blocked on a
// HelloRequest.
bool renegotiate_pending : 1;
// hs_buf is the buffer of handshake data to process.
UniquePtr<BUF_MEM> hs_buf;
@@ -3137,7 +3230,7 @@ struct ssl_ctx_st {
bssl::UniquePtr<STACK_OF(SRTP_PROTECTION_PROFILE)> srtp_profiles;
// Defined compression algorithms for certificates.
bssl::UniquePtr<STACK_OF(CertCompressionAlg)> cert_compression_algs;
bssl::GrowableArray<bssl::CertCompressionAlg> cert_compression_algs;
// Supported group values inherited by SSL structure
bssl::Array<uint16_t> supported_group_list;
+2 -1
View File
@@ -181,7 +181,8 @@ SSL3_STATE::SSL3_STATE()
tls13_downgrade(false),
token_binding_negotiated(false),
pq_experiment_signal_seen(false),
alert_dispatch(false) {}
alert_dispatch(false),
renegotiate_pending(false) {}
SSL3_STATE::~SSL3_STATE() {}
+53 -47
View File
@@ -478,6 +478,7 @@ static bool ssl_can_renegotiate(const SSL *ssl) {
return false;
case ssl_renegotiate_freely:
case ssl_renegotiate_explicit:
return true;
case ssl_renegotiate_once:
return ssl->s3->total_renegotiations == 0;
@@ -945,29 +946,16 @@ static int ssl_do_post_handshake(SSL *ssl, const SSLMessage &msg) {
return 1; // Ignore the HelloRequest.
}
if (!ssl_can_renegotiate(ssl) ||
// Renegotiation is only supported at quiescent points in the application
// protocol, namely in HTTPS, just before reading the HTTP response.
// Require the record-layer be idle and avoid complexities of sending a
// handshake record while an application_data record is being written.
!ssl->s3->write_buffer.empty() ||
ssl->s3->write_shutdown != ssl_shutdown_none) {
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_RENEGOTIATION);
ssl->s3->renegotiate_pending = true;
if (ssl->renegotiate_mode == ssl_renegotiate_explicit) {
return 1; // Handle it later.
}
if (!SSL_renegotiate(ssl)) {
ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_NO_RENEGOTIATION);
return 0;
}
// Begin a new handshake.
if (ssl->s3->hs != nullptr) {
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
return 0;
}
ssl->s3->hs = ssl_handshake_new(ssl);
if (ssl->s3->hs == nullptr) {
return 0;
}
ssl->s3->total_renegotiations++;
return 1;
}
@@ -1012,6 +1000,11 @@ static int ssl_read_impl(SSL *ssl) {
}
while (ssl->s3->pending_app_data.empty()) {
if (ssl->s3->renegotiate_pending) {
ssl->s3->rwstate = SSL_ERROR_WANT_RENEGOTIATE;
return -1;
}
// Complete the current handshake, if any. False Start will cause
// |SSL_do_handshake| to return mid-handshake, so this may require multiple
// iterations.
@@ -1353,6 +1346,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
case SSL_ERROR_PENDING_TICKET:
case SSL_ERROR_EARLY_DATA_REJECTED:
case SSL_ERROR_WANT_CERTIFICATE_VERIFY:
case SSL_ERROR_WANT_RENEGOTIATE:
return ssl->s3->rwstate;
case SSL_ERROR_WANT_READ: {
@@ -1743,8 +1737,39 @@ long SSL_get_default_timeout(const SSL *ssl) {
int SSL_renegotiate(SSL *ssl) {
// Caller-initiated renegotiation is not supported.
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return 0;
if (!ssl->s3->renegotiate_pending) {
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return 0;
}
if (!ssl_can_renegotiate(ssl)) {
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_RENEGOTIATION);
return 0;
}
// Renegotiation is only supported at quiescent points in the application
// protocol, namely in HTTPS, just before reading the HTTP response.
// Require the record-layer be idle and avoid complexities of sending a
// handshake record while an application_data record is being written.
if (!ssl->s3->write_buffer.empty() ||
ssl->s3->write_shutdown != ssl_shutdown_none) {
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_RENEGOTIATION);
return 0;
}
// Begin a new handshake.
if (ssl->s3->hs != nullptr) {
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
return 0;
}
ssl->s3->hs = ssl_handshake_new(ssl);
if (ssl->s3->hs == nullptr) {
return 0;
}
ssl->s3->renegotiate_pending = false;
ssl->s3->total_renegotiations++;
return 1;
}
int SSL_renegotiate_pending(SSL *ssl) {
@@ -2226,36 +2251,17 @@ int SSL_CTX_add_cert_compression_alg(SSL_CTX *ctx, uint16_t alg_id,
ssl_cert_decompression_func_t decompress) {
assert(compress != nullptr || decompress != nullptr);
for (const auto *alg : ctx->cert_compression_algs.get()) {
if (alg->alg_id == alg_id) {
for (const auto &alg : ctx->cert_compression_algs) {
if (alg.alg_id == alg_id) {
return 0;
}
}
UniquePtr<CertCompressionAlg> alg = MakeUnique<CertCompressionAlg>();
if (alg == nullptr) {
return 0;
}
alg->alg_id = alg_id;
alg->compress = compress;
alg->decompress = decompress;
if (ctx->cert_compression_algs == nullptr) {
ctx->cert_compression_algs.reset(sk_CertCompressionAlg_new_null());
if (ctx->cert_compression_algs == nullptr) {
return 0;
}
}
if (!PushToStack(ctx->cert_compression_algs.get(), std::move(alg))) {
if (sk_CertCompressionAlg_num(ctx->cert_compression_algs.get()) == 0) {
ctx->cert_compression_algs.reset();
}
return 0;
}
return 1;
CertCompressionAlg alg;
alg.alg_id = alg_id;
alg.compress = compress;
alg.decompress = decompress;
return ctx->cert_compression_algs.Push(alg);
}
void SSL_CTX_set_tls_channel_id_enabled(SSL_CTX *ctx, int enabled) {
+8 -12
View File
@@ -2756,8 +2756,8 @@ static bool cert_compression_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
bool first = true;
CBB contents, algs;
for (const auto *alg : hs->ssl->ctx->cert_compression_algs.get()) {
if (alg->decompress == nullptr) {
for (const auto &alg : hs->ssl->ctx->cert_compression_algs) {
if (alg.decompress == nullptr) {
continue;
}
@@ -2767,7 +2767,7 @@ static bool cert_compression_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
return false;
}
first = false;
if (!CBB_add_u16(&algs, alg->alg_id)) {
if (!CBB_add_u16(&algs, alg.alg_id)) {
return false;
}
}
@@ -2794,8 +2794,8 @@ static bool cert_compression_parse_clienthello(SSL_HANDSHAKE *hs,
return true;
}
const size_t num_algs =
sk_CertCompressionAlg_num(hs->ssl->ctx->cert_compression_algs.get());
const SSL_CTX *ctx = hs->ssl->ctx.get();
const size_t num_algs = ctx->cert_compression_algs.size();
CBS alg_ids;
if (!CBS_get_u8_length_prefixed(contents, &alg_ids) ||
@@ -2823,9 +2823,8 @@ static bool cert_compression_parse_clienthello(SSL_HANDSHAKE *hs,
given_alg_ids[given_alg_idx++] = alg_id;
for (size_t i = 0; i < num_algs; i++) {
const auto *alg = sk_CertCompressionAlg_value(
hs->ssl->ctx->cert_compression_algs.get(), i);
if (alg->alg_id == alg_id && alg->compress != nullptr) {
const auto &alg = ctx->cert_compression_algs[i];
if (alg.alg_id == alg_id && alg.compress != nullptr) {
if (i < best_index) {
best_index = i;
}
@@ -2845,10 +2844,7 @@ static bool cert_compression_parse_clienthello(SSL_HANDSHAKE *hs,
if (best_index < num_algs &&
ssl_protocol_version(hs->ssl) >= TLS1_3_VERSION) {
hs->cert_compression_negotiated = true;
hs->cert_compression_alg_id =
sk_CertCompressionAlg_value(hs->ssl->ctx->cert_compression_algs.get(),
best_index)
->alg_id;
hs->cert_compression_alg_id = ctx->cert_compression_algs[best_index].alg_id;
}
return true;
+6 -6
View File
@@ -133,9 +133,9 @@ bool tls13_process_certificate(SSL_HANDSHAKE *hs, const SSLMessage &msg,
}
ssl_cert_decompression_func_t decompress = nullptr;
for (const auto* alg : ssl->ctx->cert_compression_algs.get()) {
if (alg->alg_id == alg_id) {
decompress = alg->decompress;
for (const auto &alg : ssl->ctx->cert_compression_algs) {
if (alg.alg_id == alg_id) {
decompress = alg.decompress;
break;
}
}
@@ -517,9 +517,9 @@ bool tls13_add_certificate(SSL_HANDSHAKE *hs) {
}
const CertCompressionAlg *alg = nullptr;
for (const auto *candidate : ssl->ctx->cert_compression_algs.get()) {
if (candidate->alg_id == hs->cert_compression_alg_id) {
alg = candidate;
for (const auto &candidate : ssl->ctx->cert_compression_algs) {
if (candidate.alg_id == hs->cert_compression_alg_id) {
alg = &candidate;
break;
}
}
+1 -1
View File
@@ -976,7 +976,7 @@ static enum ssl_hs_wait_t do_send_new_session_ticket(SSL_HANDSHAKE *hs) {
// the case of a small server write buffer. Consumers which don't write data
// to the client will need to do a zero-byte write if they wish to flush the
// tickets.
if (hs->ssl->ctx->quic_method != nullptr && sent_tickets) {
if (hs->ssl->quic_method != nullptr && sent_tickets) {
return ssl_hs_flush;
}
return ssl_hs_ok;