diff options
author | David Benjamin <davidben@google.com> | 2018-09-22 19:35:12 -0500 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2018-10-01 17:34:53 +0000 |
commit | 419144adce049b5341bd94d355c52d099eac56e3 (patch) | |
tree | 046b37e507990429658d1858af655bc9155ff3ba /crypto/bio | |
parent | 217bfd3c96b04c6f1001924d202f4181a617ea6b (diff) | |
download | boringssl-419144adce049b5341bd94d355c52d099eac56e3.zip boringssl-419144adce049b5341bd94d355c52d099eac56e3.tar.gz boringssl-419144adce049b5341bd94d355c52d099eac56e3.tar.bz2 |
Fix undefined function pointer casts in {d2i,i2d}_Foo_{bio,fp}
Lacking C++, this instead adds a mess of macros. With this done, all the
function-pointer-munging "_of" macros in asn1.h can also be removed.
Update-Note: A number of *really* old and unused ASN.1 macros were
removed.
Bug: chromium:785442
Change-Id: Iab260d114c7d8cdf0429759e714d91ce3f3c04b2
Reviewed-on: https://boringssl-review.googlesource.com/32106
Reviewed-by: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <alangley@gmail.com>
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bio.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/bio/bio.c b/crypto/bio/bio.c index 3e788b8..881c14e 100644 --- a/crypto/bio/bio.c +++ b/crypto/bio/bio.c @@ -177,6 +177,19 @@ int BIO_write(BIO *bio, const void *in, int inl) { return ret; } +int BIO_write_all(BIO *bio, const void *data, size_t len) { + const uint8_t *data_u8 = data; + while (len > 0) { + int ret = BIO_write(bio, data_u8, len > INT_MAX ? INT_MAX : (int)len); + if (ret <= 0) { + return 0; + } + data_u8 += ret; + len -= ret; + } + return 1; +} + int BIO_puts(BIO *bio, const char *in) { return BIO_write(bio, in, strlen(in)); } |