From 419144adce049b5341bd94d355c52d099eac56e3 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sat, 22 Sep 2018 19:35:12 -0500 Subject: 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 Reviewed-by: Adam Langley --- crypto/bio/bio.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'crypto/bio') 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)); } -- cgit v1.1