diff options
author | Adam Langley <agl@chromium.org> | 2014-07-18 20:28:40 +0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-07-18 21:22:05 +0400 |
commit | 37a623cf2932b8e7de6c6d58d1a6ce81c4b9f56e (patch) | |
tree | ac2d47055eda660506fea42862aa4b7ae1715db5 /crypto/bio | |
parent | b5d725df63695aa7298126ea9eb12320d7e25dfd (diff) |
Have BIO_get_mem_data return a size_t and uint8_t*
Change-Id: I883f9c3527b572a2140ae4899cf4409cdc25c6dc
Reviewed-on: https://boringssl-review.googlesource.com/1261
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bio_mem.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/crypto/bio/bio_mem.c b/crypto/bio/bio_mem.c index 4d047cfe..457c2e04 100644 --- a/crypto/bio/bio_mem.c +++ b/crypto/bio/bio_mem.c @@ -254,7 +254,7 @@ static long mem_ctrl(BIO *bio, int cmd, long num, void *ptr) { ret = (long)b->length; if (ptr != NULL) { pptr = (char **)ptr; - *pptr = (char *)&(b->data[0]); + *pptr = (char *)&b->data[0]; } break; case BIO_C_SET_BUF_MEM: @@ -297,6 +297,19 @@ static const BIO_METHOD mem_method = { const BIO_METHOD *BIO_s_mem(void) { return &mem_method; } +int BIO_mem_contents(const BIO *bio, const uint8_t **out_contents, + size_t *out_len) { + const BUF_MEM *b; + if (bio->method != &mem_method) { + return 0; + } + + b = (BUF_MEM *)bio->ptr; + *out_contents = (uint8_t *)b->data; + *out_len = b->length; + return 1; +} + long BIO_get_mem_data(BIO *bio, char **contents) { return BIO_ctrl(bio, BIO_CTRL_INFO, 0, (char *) contents); } |