-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [BUGFIX] Use ls-qpack 0.11.1 - [OPTIMIZATION] Generate random bytes in batches. - Change loss_bits transport parameter ID to 0x1057 following latest draft. - Randomize period with which PINGs are sent to elicit ACKs. - Some refactoring and code cleanup.
- Loading branch information
Dmitri Tikhonov
committed
Jan 16, 2020
1 parent
a1ed99c
commit 10c4107
Showing
19 changed files
with
128 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */ | ||
#include <openssl/rand.h> | ||
#include <stdint.h> | ||
|
||
#include "lsquic_crand.h" | ||
|
||
|
||
#define OFF_MASK(crand_) ((sizeof((crand_)->rand_buf) * 2) - 1) | ||
|
||
|
||
uint8_t | ||
lsquic_crand_get_nybble (struct crand *crand) | ||
{ | ||
uint8_t byte; | ||
|
||
if (crand->nybble_off == 0) | ||
RAND_bytes(crand->rand_buf, sizeof(crand->rand_buf)); | ||
|
||
byte = crand->rand_buf[crand->nybble_off / 2]; | ||
if (crand->nybble_off & 1) | ||
byte >>= 4; | ||
else | ||
byte &= 0xF; | ||
crand->nybble_off += 1; | ||
crand->nybble_off &= OFF_MASK(crand); | ||
return byte; | ||
} | ||
|
||
|
||
uint8_t | ||
lsquic_crand_get_byte (struct crand *crand) | ||
{ | ||
uint8_t byte; | ||
|
||
if (crand->nybble_off & 1) | ||
return (lsquic_crand_get_nybble(crand) << 4) | ||
| lsquic_crand_get_nybble(crand); | ||
else | ||
{ | ||
if (crand->nybble_off == 0) | ||
RAND_bytes(crand->rand_buf, sizeof(crand->rand_buf)); | ||
byte = crand->rand_buf[crand->nybble_off / 2]; | ||
crand->nybble_off += 2; | ||
crand->nybble_off &= OFF_MASK(crand); | ||
return byte; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */ | ||
/* | ||
* lsquic_crand.h -- cached random bytes | ||
* | ||
* The idea is to reduce number of calls to RAND_bytes() | ||
*/ | ||
|
||
#ifndef LSQUIC_CRAND_H | ||
#define LSQUIC_CRAND_H 1 | ||
|
||
struct crand | ||
{ | ||
unsigned nybble_off; /* Increments 2 per byte */ | ||
uint8_t rand_buf[256]; /* Must be power of two */ | ||
}; | ||
|
||
uint8_t | ||
lsquic_crand_get_nybble (struct crand *); | ||
|
||
uint8_t | ||
lsquic_crand_get_byte (struct crand *); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.