Skip to content

Commit

Permalink
Update vendored gRPC-core to v1.19.0 (#417)
Browse files Browse the repository at this point in the history
* Update vendored gRPC-core to v1.19.1

This commit also fixes a few minor problems in the vendoring
scripts and updates a call in shim/channel.c to use a modified API.

* Update ClientCancellingTests to give clients more time to cancel before the server finishes streaming.

* Update Roots.swift to use the latest roots.pem from gRPC.

* Test update: expand and update stop sending after an error is received.

* Revert "Test update: expand and update stop sending after an error is received."

This reverts commit d99e82a.

* Add `SleepingEchoProvider`.

* Updating podspec. gRPC-Core dependency is v1.19.0.

There was no podspec published for gRPC-Core v1.19.1
but it has no changes in the C layer: vendoring v1.19.0
yields the same code as vendoring v1.19.1.

* Changes from running "make project-carthage"
  • Loading branch information
timburks authored Apr 11, 2019
1 parent c140c96 commit ece94e8
Show file tree
Hide file tree
Showing 546 changed files with 61,657 additions and 36,577 deletions.
498 changes: 305 additions & 193 deletions Assets/roots.pem

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "98434c1f1d687ff5a24d2cabfbd19b5c7d2d7a2f",
"version": "1.13.0"
"revision": "29a9f2aca71c8afb07e291336f1789337ce235dd",
"version": "1.13.2"
}
},
{
Expand Down Expand Up @@ -60,8 +60,8 @@
"repositoryURL": "https://github.com/apple/swift-protobuf.git",
"state": {
"branch": null,
"revision": "ab98c52b5166593ad1ae0df246463266df151cfa",
"version": "1.3.1"
"revision": "6520fb185db88c0774a929acea1f7d5981a30d3a",
"version": "1.4.0"
}
}
]
Expand Down
61 changes: 33 additions & 28 deletions Sources/BoringSSL/crypto/asn1/a_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,40 +347,45 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,

int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
{
int j, k;
unsigned int i;
unsigned char buf[sizeof(long) + 1];
long d;

a->type = V_ASN1_INTEGER;
if (a->length < (int)(sizeof(long) + 1)) {
if (a->data != NULL)
OPENSSL_free(a->data);
if ((a->data =
(unsigned char *)OPENSSL_malloc(sizeof(long) + 1)) != NULL)
OPENSSL_memset((char *)a->data, 0, sizeof(long) + 1);
if (v >= 0) {
return ASN1_INTEGER_set_uint64(a, (uint64_t) v);
}
if (a->data == NULL) {
OPENSSL_PUT_ERROR(ASN1, ERR_R_MALLOC_FAILURE);
return (0);

if (!ASN1_INTEGER_set_uint64(a, 0 - (uint64_t) v)) {
return 0;
}
d = v;
if (d < 0) {
d = -d;
a->type = V_ASN1_NEG_INTEGER;

a->type = V_ASN1_NEG_INTEGER;
return 1;
}

int ASN1_INTEGER_set_uint64(ASN1_INTEGER *out, uint64_t v)
{
uint8_t *const newdata = OPENSSL_malloc(sizeof(uint64_t));
if (newdata == NULL) {
OPENSSL_PUT_ERROR(ASN1, ERR_R_MALLOC_FAILURE);
return 0;
}

for (i = 0; i < sizeof(long); i++) {
if (d == 0)
OPENSSL_free(out->data);
out->data = newdata;
v = CRYPTO_bswap8(v);
memcpy(out->data, &v, sizeof(v));

out->type = V_ASN1_INTEGER;

size_t leading_zeros;
for (leading_zeros = 0; leading_zeros < sizeof(uint64_t) - 1;
leading_zeros++) {
if (out->data[leading_zeros] != 0) {
break;
buf[i] = (int)d & 0xff;
d >>= 8;
}
}
j = 0;
for (k = i - 1; k >= 0; k--)
a->data[j++] = buf[k];
a->length = j;
return (1);

out->length = sizeof(uint64_t) - leading_zeros;
OPENSSL_memmove(out->data, out->data + leading_zeros, out->length);

return 1;
}

long ASN1_INTEGER_get(const ASN1_INTEGER *a)
Expand Down
46 changes: 24 additions & 22 deletions Sources/BoringSSL/crypto/asn1/a_mbstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,19 @@
#include <openssl/err.h>
#include <openssl/mem.h>

#include "asn1_locl.h"

static int traverse_string(const unsigned char *p, int len, int inform,
int (*rfunc) (unsigned long value, void *in),
int (*rfunc) (uint32_t value, void *in),
void *arg);
static int in_utf8(unsigned long value, void *arg);
static int out_utf8(unsigned long value, void *arg);
static int type_str(unsigned long value, void *arg);
static int cpy_asc(unsigned long value, void *arg);
static int cpy_bmp(unsigned long value, void *arg);
static int cpy_univ(unsigned long value, void *arg);
static int cpy_utf8(unsigned long value, void *arg);
static int is_printable(unsigned long value);
static int in_utf8(uint32_t value, void *arg);
static int out_utf8(uint32_t value, void *arg);
static int type_str(uint32_t value, void *arg);
static int cpy_asc(uint32_t value, void *arg);
static int cpy_bmp(uint32_t value, void *arg);
static int cpy_univ(uint32_t value, void *arg);
static int cpy_utf8(uint32_t value, void *arg);
static int is_printable(uint32_t value);

/*
* These functions take a string in UTF8, ASCII or multibyte form and a mask
Expand Down Expand Up @@ -100,7 +102,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
unsigned char *p;
int nchar;
char strbuf[32];
int (*cpyfunc) (unsigned long, void *) = NULL;
int (*cpyfunc) (uint32_t, void *) = NULL;
if (len == -1)
len = strlen((const char *)in);
if (!mask)
Expand Down Expand Up @@ -253,10 +255,10 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
*/

static int traverse_string(const unsigned char *p, int len, int inform,
int (*rfunc) (unsigned long value, void *in),
int (*rfunc) (uint32_t value, void *in),
void *arg)
{
unsigned long value;
uint32_t value;
int ret;
while (len) {
if (inform == MBSTRING_ASC) {
Expand All @@ -267,8 +269,8 @@ static int traverse_string(const unsigned char *p, int len, int inform,
value |= *p++;
len -= 2;
} else if (inform == MBSTRING_UNIV) {
value = ((unsigned long)*p++) << 24;
value |= ((unsigned long)*p++) << 16;
value = ((uint32_t)*p++) << 24;
value |= ((uint32_t)*p++) << 16;
value |= *p++ << 8;
value |= *p++;
len -= 4;
Expand All @@ -292,7 +294,7 @@ static int traverse_string(const unsigned char *p, int len, int inform,

/* Just count number of characters */

static int in_utf8(unsigned long value, void *arg)
static int in_utf8(uint32_t value, void *arg)
{
int *nchar;
nchar = arg;
Expand All @@ -302,7 +304,7 @@ static int in_utf8(unsigned long value, void *arg)

/* Determine size of output as a UTF8 String */

static int out_utf8(unsigned long value, void *arg)
static int out_utf8(uint32_t value, void *arg)
{
int *outlen;
outlen = arg;
Expand All @@ -315,7 +317,7 @@ static int out_utf8(unsigned long value, void *arg)
* "mask".
*/

static int type_str(unsigned long value, void *arg)
static int type_str(uint32_t value, void *arg)
{
unsigned long types;
types = *((unsigned long *)arg);
Expand All @@ -335,7 +337,7 @@ static int type_str(unsigned long value, void *arg)

/* Copy one byte per character ASCII like strings */

static int cpy_asc(unsigned long value, void *arg)
static int cpy_asc(uint32_t value, void *arg)
{
unsigned char **p, *q;
p = arg;
Expand All @@ -347,7 +349,7 @@ static int cpy_asc(unsigned long value, void *arg)

/* Copy two byte per character BMPStrings */

static int cpy_bmp(unsigned long value, void *arg)
static int cpy_bmp(uint32_t value, void *arg)
{
unsigned char **p, *q;
p = arg;
Expand All @@ -360,7 +362,7 @@ static int cpy_bmp(unsigned long value, void *arg)

/* Copy four byte per character UniversalStrings */

static int cpy_univ(unsigned long value, void *arg)
static int cpy_univ(uint32_t value, void *arg)
{
unsigned char **p, *q;
p = arg;
Expand All @@ -375,7 +377,7 @@ static int cpy_univ(unsigned long value, void *arg)

/* Copy to a UTF8String */

static int cpy_utf8(unsigned long value, void *arg)
static int cpy_utf8(uint32_t value, void *arg)
{
unsigned char **p;
int ret;
Expand All @@ -387,7 +389,7 @@ static int cpy_utf8(unsigned long value, void *arg)
}

/* Return 1 if the character is permitted in a PrintableString */
static int is_printable(unsigned long value)
static int is_printable(uint32_t value)
{
int ch;
if (value > 0x7f)
Expand Down
24 changes: 13 additions & 11 deletions Sources/BoringSSL/crypto/asn1/a_utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
#include <openssl/err.h>
#include <openssl/mem.h>

#include "asn1_locl.h"

/* UTF8 utilities */

/*
Expand All @@ -70,10 +72,10 @@
* incorrectly (not minimal length).
*/

int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
int UTF8_getc(const unsigned char *str, int len, uint32_t *val)
{
const unsigned char *p;
unsigned long value;
uint32_t value;
int ret;
if (len <= 0)
return 0;
Expand Down Expand Up @@ -112,7 +114,7 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
|| ((p[2] & 0xc0) != 0x80)
|| ((p[3] & 0xc0) != 0x80))
return -3;
value = ((unsigned long)(*p++ & 0x7)) << 18;
value = ((uint32_t)(*p++ & 0x7)) << 18;
value |= (*p++ & 0x3f) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
Expand All @@ -127,9 +129,9 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
|| ((p[3] & 0xc0) != 0x80)
|| ((p[4] & 0xc0) != 0x80))
return -3;
value = ((unsigned long)(*p++ & 0x3)) << 24;
value |= ((unsigned long)(*p++ & 0x3f)) << 18;
value |= ((unsigned long)(*p++ & 0x3f)) << 12;
value = ((uint32_t)(*p++ & 0x3)) << 24;
value |= ((uint32_t)(*p++ & 0x3f)) << 18;
value |= ((uint32_t)(*p++ & 0x3f)) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
if (value < 0x200000)
Expand All @@ -144,10 +146,10 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
|| ((p[4] & 0xc0) != 0x80)
|| ((p[5] & 0xc0) != 0x80))
return -3;
value = ((unsigned long)(*p++ & 0x1)) << 30;
value |= ((unsigned long)(*p++ & 0x3f)) << 24;
value |= ((unsigned long)(*p++ & 0x3f)) << 18;
value |= ((unsigned long)(*p++ & 0x3f)) << 12;
value = ((uint32_t)(*p++ & 0x1)) << 30;
value |= ((uint32_t)(*p++ & 0x3f)) << 24;
value |= ((uint32_t)(*p++ & 0x3f)) << 18;
value |= ((uint32_t)(*p++ & 0x3f)) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
if (value < 0x4000000)
Expand All @@ -167,7 +169,7 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
* most 6 characters.
*/

int UTF8_putc(unsigned char *str, int len, unsigned long value)
int UTF8_putc(unsigned char *str, int len, uint32_t value)
{
if (!str)
len = 6; /* Maximum we will need */
Expand Down
3 changes: 3 additions & 0 deletions Sources/BoringSSL/crypto/asn1/asn1_locl.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ int asn1_generalizedtime_to_tm(struct tm *tm, const ASN1_GENERALIZEDTIME *d);
void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
int combine);

int UTF8_getc(const unsigned char *str, int len, uint32_t *val);
int UTF8_putc(unsigned char *str, int len, uint32_t value);


#if defined(__cplusplus)
} /* extern C */
Expand Down
Loading

0 comments on commit ece94e8

Please sign in to comment.