From e533b0dc8ef606aa808b38d2f49d9baf438dae47 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 13 May 2016 12:56:23 +0100 Subject: Give SHA256 functions C bindings --- src/utility.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/utility.cpp') diff --git a/src/utility.cpp b/src/utility.cpp index bc51cff..2217778 100644 --- a/src/utility.cpp +++ b/src/utility.cpp @@ -23,7 +23,7 @@ olm::Utility::Utility( size_t olm::Utility::sha256_length() { - return olm::SHA256_OUTPUT_LENGTH; + return SHA256_OUTPUT_LENGTH; } @@ -35,8 +35,8 @@ size_t olm::Utility::sha256( last_error = olm::ErrorCode::OUTPUT_BUFFER_TOO_SMALL; return std::size_t(-1); } - olm::sha256(input, input_length, output); - return olm::SHA256_OUTPUT_LENGTH; + crypto_sha256(input, input_length, output); + return SHA256_OUTPUT_LENGTH; } -- cgit v1.2.3 From f9139dfa6aea6ca8c4054a5b5fff9be484d978fa Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 16 May 2016 12:08:45 +0100 Subject: Convert error.hh to plain C --- src/utility.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/utility.cpp') diff --git a/src/utility.cpp b/src/utility.cpp index 2217778..2169e60 100644 --- a/src/utility.cpp +++ b/src/utility.cpp @@ -18,7 +18,7 @@ olm::Utility::Utility( -) : last_error(olm::ErrorCode::SUCCESS) { +) : last_error(OlmErrorCode::OLM_SUCCESS) { } @@ -32,7 +32,7 @@ size_t olm::Utility::sha256( std::uint8_t * output, std::size_t output_length ) { if (output_length < sha256_length()) { - last_error = olm::ErrorCode::OUTPUT_BUFFER_TOO_SMALL; + last_error = OlmErrorCode::OLM_OUTPUT_BUFFER_TOO_SMALL; return std::size_t(-1); } crypto_sha256(input, input_length, output); @@ -46,11 +46,11 @@ size_t olm::Utility::ed25519_verify( std::uint8_t const * signature, std::size_t signature_length ) { if (signature_length < olm::SIGNATURE_LENGTH) { - last_error = olm::ErrorCode::BAD_MESSAGE_MAC; + last_error = OlmErrorCode::OLM_BAD_MESSAGE_MAC; return std::size_t(-1); } if (!olm::ed25519_verify(key, message, message_length, signature)) { - last_error = olm::ErrorCode::BAD_MESSAGE_MAC; + last_error = OlmErrorCode::OLM_BAD_MESSAGE_MAC; return std::size_t(-1); } return std::size_t(0); -- cgit v1.2.3 From 444ef1f70687c340ba1b0b2a22d6e63c734d5f9e Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 20 May 2016 11:59:31 +0100 Subject: Prefix for internal symbols Give a load of internal symbols "_olm_" prefixes. This better delineates the public and private interfaces in the module, and helps avoid internal symbols leaking out and possibly being abused. --- src/utility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/utility.cpp') diff --git a/src/utility.cpp b/src/utility.cpp index 2169e60..67029c9 100644 --- a/src/utility.cpp +++ b/src/utility.cpp @@ -35,7 +35,7 @@ size_t olm::Utility::sha256( last_error = OlmErrorCode::OLM_OUTPUT_BUFFER_TOO_SMALL; return std::size_t(-1); } - crypto_sha256(input, input_length, output); + _olm_crypto_sha256(input, input_length, output); return SHA256_OUTPUT_LENGTH; } -- cgit v1.2.3