Skip to content

Commit

Permalink
Update CgRPC to v1.12.0 and BoringSSL to 10.0.4 (I guess?). This chan…
Browse files Browse the repository at this point in the history
…ge requires Swift 4.1 and Ruby (with the 'xcodeproj' gem) installed to compile if building via SPM.

To cut through the noise, here are the non-vendored files with changes:

- Makefile
- Package.swift
- SwiftGRPC.podspec
- fix-project-settings.rb
- vendor-boringssl.sh

While at it, I have also re-run RootsEncoder.
  • Loading branch information
MrMage committed May 29, 2018
1 parent 53c32e4 commit 75940a4
Show file tree
Hide file tree
Showing 1,430 changed files with 177,138 additions and 164,827 deletions.
998 changes: 282 additions & 716 deletions Assets/roots.pem

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

CFLAGS = -Xcc -ISources/BoringSSL/include
CFLAGS = -Xcc -ISources/BoringSSL/include -Xcc -DPB_FIELD_16BIT=1

all:
swift build -v $(CFLAGS)
Expand All @@ -8,8 +8,7 @@ all:

project:
swift package generate-xcodeproj
# Optional: set the generated project's indentation settings.
-ruby fix-indentation-settings.rb || echo "Consider running 'sudo gem install xcodeproj' to automatically set correct indentation settings for the generated project."
@ruby fix-project-settings.rb || echo "ERROR: Please install Ruby and the 'xcodeproj' gem to automatically fix the Xcode project's settings."

test: all
swift test -v $(CFLAGS)
Expand Down
4 changes: 3 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ let package = Package(
dependencies: ["SwiftGRPC", "Commander"],
path: "Sources/Examples/Simple"),
.testTarget(name: "SwiftGRPCTests", dependencies: ["SwiftGRPC"])
])
],
cLanguageStandard: .gnu11,
cxxLanguageStandard: .cxx11)
87 changes: 0 additions & 87 deletions Sources/BoringSSL/crypto/aes/internal.h

This file was deleted.

9 changes: 7 additions & 2 deletions Sources/BoringSSL/crypto/asn1/a_bitstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

#include <openssl/asn1.h>

#include <limits.h>
#include <string.h>

#include <openssl/err.h>
Expand Down Expand Up @@ -139,6 +140,11 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
goto err;
}

if (len > INT_MAX) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_STRING_TOO_LONG);
goto err;
}

if ((a == NULL) || ((*a) == NULL)) {
if ((ret = M_ASN1_BIT_STRING_new()) == NULL)
return (NULL);
Expand Down Expand Up @@ -211,8 +217,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
if (a->data == NULL)
c = (unsigned char *)OPENSSL_malloc(w + 1);
else
c = (unsigned char *)OPENSSL_realloc_clean(a->data,
a->length, w + 1);
c = (unsigned char *)OPENSSL_realloc(a->data, w + 1);
if (c == NULL) {
OPENSSL_PUT_ERROR(ASN1, ERR_R_MALLOC_FAILURE);
return 0;
Expand Down
15 changes: 15 additions & 0 deletions Sources/BoringSSL/crypto/asn1/a_d2i_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,21 @@ void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x)
}
#endif

typedef struct asn1_const_ctx_st
{
const unsigned char *p;/* work char pointer */
int eos; /* end of sequence read for indefinite encoding */
int error; /* error code to use when returning an error */
int inf; /* constructed if 0x20, indefinite is 0x21 */
int tag; /* tag from last 'get object' */
int xclass; /* class from last 'get object' */
long slen; /* length of last 'get object' */
const unsigned char *max; /* largest value of p allowed */
const unsigned char *q;/* temporary variable */
const unsigned char **pp;/* variable */
int line; /* used in error processing */
} ASN1_const_CTX;

#define HEADER_SIZE 8
#define ASN1_CHUNK_INITIAL_SIZE (16 * 1024)
static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
Expand Down
29 changes: 20 additions & 9 deletions Sources/BoringSSL/crypto/asn1/a_enum.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

#include <openssl/asn1.h>

#include <limits.h>
#include <string.h>

#include <openssl/err.h>
Expand Down Expand Up @@ -110,7 +111,6 @@ int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a)
{
int neg = 0, i;
long r = 0;

if (a == NULL)
return (0L);
Expand All @@ -120,20 +120,31 @@ long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a)
else if (i != V_ASN1_ENUMERATED)
return -1;

if (a->length > (int)sizeof(long)) {
OPENSSL_COMPILE_ASSERT(sizeof(uint64_t) >= sizeof(long),
long_larger_than_uint64_t);

if (a->length > (int)sizeof(uint64_t)) {
/* hmm... a bit ugly */
return (0xffffffffL);
return -1;
}
if (a->data == NULL)
return 0;

for (i = 0; i < a->length; i++) {
r <<= 8;
r |= (unsigned char)a->data[i];
uint64_t r64 = 0;
if (a->data != NULL) {
for (i = 0; i < a->length; i++) {
r64 <<= 8;
r64 |= (unsigned char)a->data[i];
}

if (r64 > LONG_MAX) {
return -1;
}
}

long r = (long) r64;
if (neg)
r = -r;
return (r);

return r;
}

ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai)
Expand Down
2 changes: 1 addition & 1 deletion Sources/BoringSSL/crypto/asn1/a_gentm.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int asn1_generalizedtime_to_tm(struct tm *tm, const ASN1_GENERALIZEDTIME *d)
if (a[o] == 'Z')
o++;
else if ((a[o] == '+') || (a[o] == '-')) {
int offsign = a[o] == '-' ? -1 : 1, offset = 0;
int offsign = a[o] == '-' ? 1 : -1, offset = 0;
o++;
if (o + 4 > l)
goto err;
Expand Down
3 changes: 3 additions & 0 deletions Sources/BoringSSL/crypto/asn1/a_i2d_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, void *x)
int i, j = 0, n, ret = 1;

n = i2d(x, NULL);
if (n <= 0)
return 0;

b = (char *)OPENSSL_malloc(n);
if (b == NULL) {
OPENSSL_PUT_ERROR(ASN1, ERR_R_MALLOC_FAILURE);
Expand Down
27 changes: 19 additions & 8 deletions Sources/BoringSSL/crypto/asn1/a_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include <openssl/asn1.h>

#include <string.h>
#include <limits.h>

#include <openssl/err.h>
#include <openssl/mem.h>
Expand Down Expand Up @@ -385,7 +386,6 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
long ASN1_INTEGER_get(const ASN1_INTEGER *a)
{
int neg = 0, i;
long r = 0;

if (a == NULL)
return (0L);
Expand All @@ -395,20 +395,31 @@ long ASN1_INTEGER_get(const ASN1_INTEGER *a)
else if (i != V_ASN1_INTEGER)
return -1;

if (a->length > (int)sizeof(long)) {
OPENSSL_COMPILE_ASSERT(sizeof(uint64_t) >= sizeof(long),
long_larger_than_uint64_t);

if (a->length > (int)sizeof(uint64_t)) {
/* hmm... a bit ugly, return all ones */
return -1;
}
if (a->data == NULL)
return 0;

for (i = 0; i < a->length; i++) {
r <<= 8;
r |= (unsigned char)a->data[i];
uint64_t r64 = 0;
if (a->data != NULL) {
for (i = 0; i < a->length; i++) {
r64 <<= 8;
r64 |= (unsigned char)a->data[i];
}

if (r64 > LONG_MAX) {
return -1;
}
}

long r = (long) r64;
if (neg)
r = -r;
return (r);

return r;
}

ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
Expand Down
Loading

0 comments on commit 75940a4

Please sign in to comment.