Remove functions which return strings
We don't want anything which does dynamic memory allocation in the library.
This commit is contained in:
parent
9ac6ab0f1c
commit
acae4e8438
3 changed files with 0 additions and 26 deletions
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace olm {
|
namespace olm {
|
||||||
|
|
||||||
|
@ -27,7 +26,6 @@ static const std::size_t IV_LENGTH = 16;
|
||||||
|
|
||||||
struct Curve25519PublicKey {
|
struct Curve25519PublicKey {
|
||||||
std::uint8_t public_key[KEY_LENGTH];
|
std::uint8_t public_key[KEY_LENGTH];
|
||||||
std::string to_string() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -87,23 +87,4 @@ std::uint8_t * store_array(
|
||||||
return destination + sizeof(T);
|
return destination + sizeof(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** convert an array of bytes to a string representation */
|
|
||||||
template<typename T>
|
|
||||||
std::string bytes_to_string(T start, T end) {
|
|
||||||
std::ostringstream ss;
|
|
||||||
ss << std::hex << std::setfill('0');
|
|
||||||
while (start != end) {
|
|
||||||
ss << std::setw(2) << static_cast<int>(*start++);
|
|
||||||
if (start != end) {
|
|
||||||
ss << ":";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
std::string bytes_to_string(T start, size_t len) {
|
|
||||||
return bytes_to_string(start, start+len);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace olm
|
} // namespace olm
|
||||||
|
|
|
@ -101,11 +101,6 @@ inline static void hmac_sha256_final(
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::string olm::Curve25519PublicKey::to_string() const {
|
|
||||||
return olm::bytes_to_string(std::begin(public_key),
|
|
||||||
std::end(public_key));
|
|
||||||
};
|
|
||||||
|
|
||||||
void olm::curve25519_generate_key(
|
void olm::curve25519_generate_key(
|
||||||
std::uint8_t const * random_32_bytes,
|
std::uint8_t const * random_32_bytes,
|
||||||
olm::Curve25519KeyPair & key_pair
|
olm::Curve25519KeyPair & key_pair
|
||||||
|
|
Loading…
Reference in a new issue