mirror of
https://github.com/transmission/transmission.git
synced 2025-12-25 04:45:56 +00:00
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.
This commit is contained in:
@@ -287,22 +287,6 @@ char* tr_strdup_printf (const char * fmt, ...) TR_GNUC_PRINTF (1, 2)
|
||||
char * tr_strdup_vprintf (const char * fmt,
|
||||
va_list args) TR_GNUC_MALLOC;
|
||||
|
||||
/**
|
||||
* @brief Translate a block of bytes into base64
|
||||
* @return a newly-allocated string that can be freed with tr_free ()
|
||||
*/
|
||||
char* tr_base64_encode (const void * input,
|
||||
int inlen,
|
||||
int * outlen) TR_GNUC_MALLOC;
|
||||
|
||||
/**
|
||||
* @brief Translate a block of bytes from base64 into raw form
|
||||
* @return a newly-allocated string that can be freed with tr_free ()
|
||||
*/
|
||||
char* tr_base64_decode (const void * input,
|
||||
int inlen,
|
||||
int * outlen) TR_GNUC_MALLOC;
|
||||
|
||||
/** @brief Portability wrapper for strlcpy () that uses the system implementation if available */
|
||||
size_t tr_strlcpy (char * dst, const void * src, size_t siz);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user