]> granicus.if.org Git - transmission/commit
#4400, #5462: Move BASE64 helpers to crypto-utils
authorMike Gelfand <mikedld@mikedld.com>
Thu, 4 Dec 2014 19:58:34 +0000 (19:58 +0000)
committerMike Gelfand <mikedld@mikedld.com>
Thu, 4 Dec 2014 19:58:34 +0000 (19:58 +0000)
commit5c43b5c23c9e35965b12a5a409dfeab8103ca1dc
treeb6c89db96b291df552554ecf4e88d0b253bcf400
parent117ab3e8d2ae64933b09e3ee2419bdcccdd73733
#4400, #5462: Move BASE64 helpers to crypto-utils

On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing BASE64 encoding and decoding to crypto-utils.{c,h}. OpenSSL-
related functionality is moved to crypto-utils-openssl.c.

Add new functions to be implemented by crypto backends:
* tr_base64_encode_impl - encode from binary to BASE64,
* tr_base64_decode_impl - decode from BASE64 to binary.

Change `tr_base64_encode` and `tr_base64_decode` functions to expect
non-negative input data length which is considered real and never adjusted.
To process null-terminated strings (which was achieved before by passing 0
or -1 as input data length), add new `tr_base64_encode_str` and
`tr_base64_decode_str` functions which do not accept input data length as
an argument but calculate it on their own.
13 files changed:
daemon/remote.c
libtransmission/crypto-test.c
libtransmission/crypto-utils-openssl.c
libtransmission/crypto-utils.c
libtransmission/crypto-utils.h
libtransmission/libtransmission-test.c
libtransmission/rename-test.c
libtransmission/rpc-server.c
libtransmission/rpcimpl.c
libtransmission/utils-test.c
libtransmission/utils.c
libtransmission/utils.h
qt/add-data.cc