Add OpenSSL BIO method that writes to a std::string. (issue 286263006)

334 views
Skip to first unread message

ma...@chromium.org

unread,
May 16, 2014, 6:54:17 PM5/16/14
to rsl...@chromium.org, chromium...@chromium.org
Reviewers: Ryan Sleevi,

Message:
Wasn't sure if this should go in crypto/ or just stick in c/common/net,
wdyt?

Description:
Add OpenSSL BIO method that writes to a std::string.

BUG=none

Please review this at https://codereview.chromium.org/286263006/

SVN Base: svn://svn.chromium.org/chrome/trunk/src

Affected files (+157, -0 lines):
M crypto/crypto.gyp
M crypto/crypto.gypi
A crypto/openssl_bio_string.h
A crypto/openssl_bio_string.cc
A crypto/openssl_bio_string_unittest.cc


rsl...@chromium.org

unread,
May 19, 2014, 7:25:44 PM5/19/14
to ma...@chromium.org, chromium...@chromium.org
I'm fine landing in crypto/


https://codereview.chromium.org/286263006/diff/40001/crypto/openssl_bio_string.cc
File crypto/openssl_bio_string.cc (right):

https://codereview.chromium.org/286263006/diff/40001/crypto/openssl_bio_string.cc#newcode60
crypto/openssl_bio_string.cc:60: namespace crypto {
nit: I tend to like this on between lines 8-9, rather than requiring the
unnamed namespace be entirely self-constrained.

https://codereview.chromium.org/286263006/diff/40001/crypto/openssl_bio_string.h
File crypto/openssl_bio_string.h (right):

https://codereview.chromium.org/286263006/diff/40001/crypto/openssl_bio_string.h#newcode12
crypto/openssl_bio_string.h:12: typedef struct bio_st BIO;
// From <openssl/bio.h>

https://codereview.chromium.org/286263006/diff/40001/crypto/openssl_bio_string.h#newcode16
crypto/openssl_bio_string.h:16: BIO* CRYPTO_EXPORT
BIO_new_string(std::string* out);
Document

// Creates a new BIO that can be used with OpenSSL's
// various output functions, and which will write all output
// directly into |out|. This is primarily intended as a
// utility to reduce the amount of copying and separate
// allocations when performing extensive string modifications
// or streaming within OpenSSL.
//
// Note: |out| must remain valid for the duration of the BIO.

https://codereview.chromium.org/286263006/

ma...@chromium.org

unread,
May 19, 2014, 8:22:24 PM5/19/14
to rsl...@chromium.org, chromium...@chromium.org
On 2014/05/19 23:25:44, Ryan Sleevi wrote:
> nit: I tend to like this on between lines 8-9, rather than requiring
the unnamed
> namespace be entirely self-constrained.

Done.
On 2014/05/19 23:25:44, Ryan Sleevi wrote:
> // From <openssl/bio.h>

Done.

https://codereview.chromium.org/286263006/diff/40001/crypto/openssl_bio_string.h#newcode16
crypto/openssl_bio_string.h:16: BIO* CRYPTO_EXPORT
BIO_new_string(std::string* out);
On 2014/05/19 23:25:44, Ryan Sleevi wrote:
> Document

> // Creates a new BIO that can be used with OpenSSL's
> // various output functions, and which will write all output
> // directly into |out|. This is primarily intended as a
> // utility to reduce the amount of copying and separate
> // allocations when performing extensive string modifications
> // or streaming within OpenSSL.
> //
> // Note: |out| must remain valid for the duration of the BIO.

Thanks, done.

https://codereview.chromium.org/286263006/

ma...@chromium.org

unread,
May 20, 2014, 10:10:47 PM5/20/14
to rsl...@chromium.org, chromium...@chromium.org
ping in case you missed this one

https://codereview.chromium.org/286263006/

rsl...@chromium.org

unread,
May 21, 2014, 5:12:23 PM5/21/14
to ma...@chromium.org, chromium...@chromium.org

commi...@chromium.org

unread,
May 21, 2014, 5:17:09 PM5/21/14
to ma...@chromium.org, rsl...@chromium.org, chromium...@chromium.org
Reply all
Reply to author
Forward
0 new messages