diff options
author | Richard van der Hoff <richard@matrix.org> | 2016-05-18 17:13:39 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-05-23 18:55:06 +0100 |
commit | c57b2b71c5a1314e79a0ee110ed9e1168a70b921 (patch) | |
tree | 88db5fd44bcb95d557b3679d1f7bf08471726950 /src/base64.cpp | |
parent | a1855b99b92d2081aed477686d843d1d1f56d3b8 (diff) |
C bindings for base64 functions
Diffstat (limited to 'src/base64.cpp')
-rw-r--r-- | src/base64.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/base64.cpp b/src/base64.cpp index 66f512b..920119e 100644 --- a/src/base64.cpp +++ b/src/base64.cpp @@ -12,9 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include "olm/base64.h" #include "olm/base64.hh" - namespace { static const std::uint8_t ENCODE_BASE64[64] = { @@ -134,3 +134,34 @@ std::uint8_t const * olm::decode_base64( } return input + input_length; } + + +// implementations of base64.h + +size_t olm_encode_base64_length( + size_t input_length +) { + return olm::encode_base64_length(input_length); +} + +size_t olm_encode_base64( + uint8_t const * input, size_t input_length, + uint8_t * output +) { + uint8_t * r = olm::encode_base64(input, input_length, output); + return r - output; +} + +size_t olm_decode_base64_length( + size_t input_length +) { + return olm::decode_base64_length(input_length); +} + +size_t olm_decode_base64( + uint8_t const * input, size_t input_length, + uint8_t * output +) { + olm::decode_base64(input, input_length, output); + return olm::decode_base64_length(input_length); +} |