aboutsummaryrefslogtreecommitdiff
path: root/src/base64.cpp
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-05-24 13:33:33 +0100
committerRichard van der Hoff <richard@matrix.org>2016-05-24 13:33:33 +0100
commit2e7800cf650197f4b8998ef8ac24d08daa316a2f (patch)
tree1f9e5e06b755f929c7bad363b77eaafdd21d706c /src/base64.cpp
parentb1c5732fc8c89ee9217d0f54408f860565fa01f4 (diff)
parent2fd28a66824bda7b86c08b065736009c39761987 (diff)
Merge branch 'rav/c_bindings'
Diffstat (limited to 'src/base64.cpp')
-rw-r--r--src/base64.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/base64.cpp b/src/base64.cpp
index 66f512b..bbfb210 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);
+}