diff options
author | Jack Lloyd <[email protected]> | 2016-12-11 15:28:38 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-12-18 16:48:24 -0500 |
commit | f3cb3edb512bdcab498d825886c3366c341b3f78 (patch) | |
tree | 645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/tls/sessions_sql | |
parent | c1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff) |
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency,
eg make_u32bit becomes make_uint32. The old typedefs remain for now
since probably lots of application code uses them.
Diffstat (limited to 'src/lib/tls/sessions_sql')
-rw-r--r-- | src/lib/tls/sessions_sql/tls_session_manager_sql.cpp | 20 | ||||
-rw-r--r-- | src/lib/tls/sessions_sql/tls_session_manager_sql.h | 6 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp b/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp index 049c12df1..594822829 100644 --- a/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp +++ b/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp @@ -55,16 +55,16 @@ Session_Manager_SQL::Session_Manager_SQL(std::shared_ptr<SQL_Database> db, if(stmt->step()) { - std::pair<const byte*, size_t> salt = stmt->get_blob(0); + std::pair<const uint8_t*, size_t> salt = stmt->get_blob(0); const size_t iterations = stmt->get_size_t(1); const size_t check_val_db = stmt->get_size_t(2); - secure_vector<byte> x = pbkdf->pbkdf_iterations(32 + 2, + secure_vector<uint8_t> x = pbkdf->pbkdf_iterations(32 + 2, passphrase, salt.first, salt.second, iterations); - const size_t check_val_created = make_u16bit(x[0], x[1]); + const size_t check_val_created = make_uint16(x[0], x[1]); m_session_key.assign(x.begin() + 2, x.end()); if(check_val_created != check_val_db) @@ -79,16 +79,16 @@ Session_Manager_SQL::Session_Manager_SQL(std::shared_ptr<SQL_Database> db, // new database case - std::vector<byte> salt = unlock(rng.random_vec(16)); + std::vector<uint8_t> salt = unlock(rng.random_vec(16)); size_t iterations = 0; - secure_vector<byte> x = pbkdf->pbkdf_timed(32 + 2, + secure_vector<uint8_t> x = pbkdf->pbkdf_timed(32 + 2, passphrase, salt.data(), salt.size(), std::chrono::milliseconds(100), iterations); - size_t check_val = make_u16bit(x[0], x[1]); + size_t check_val = make_uint16(x[0], x[1]); m_session_key.assign(x.begin() + 2, x.end()); auto stmt = m_db->new_statement("insert into tls_sessions_metadata values(?1, ?2, ?3)"); @@ -101,7 +101,7 @@ Session_Manager_SQL::Session_Manager_SQL(std::shared_ptr<SQL_Database> db, } } -bool Session_Manager_SQL::load_from_session_id(const std::vector<byte>& session_id, +bool Session_Manager_SQL::load_from_session_id(const std::vector<uint8_t>& session_id, Session& session) { auto stmt = m_db->new_statement("select session from tls_sessions where session_id = ?1"); @@ -110,7 +110,7 @@ bool Session_Manager_SQL::load_from_session_id(const std::vector<byte>& session_ while(stmt->step()) { - std::pair<const byte*, size_t> blob = stmt->get_blob(0); + std::pair<const uint8_t*, size_t> blob = stmt->get_blob(0); try { @@ -137,7 +137,7 @@ bool Session_Manager_SQL::load_from_server_info(const Server_Information& server while(stmt->step()) { - std::pair<const byte*, size_t> blob = stmt->get_blob(0); + std::pair<const uint8_t*, size_t> blob = stmt->get_blob(0); try { @@ -152,7 +152,7 @@ bool Session_Manager_SQL::load_from_server_info(const Server_Information& server return false; } -void Session_Manager_SQL::remove_entry(const std::vector<byte>& session_id) +void Session_Manager_SQL::remove_entry(const std::vector<uint8_t>& session_id) { auto stmt = m_db->new_statement("delete from tls_sessions where session_id = ?1"); diff --git a/src/lib/tls/sessions_sql/tls_session_manager_sql.h b/src/lib/tls/sessions_sql/tls_session_manager_sql.h index 24e2be7c3..f22d01172 100644 --- a/src/lib/tls/sessions_sql/tls_session_manager_sql.h +++ b/src/lib/tls/sessions_sql/tls_session_manager_sql.h @@ -48,13 +48,13 @@ class BOTAN_DLL Session_Manager_SQL : public Session_Manager Session_Manager_SQL& operator=(const Session_Manager_SQL&) = delete; - bool load_from_session_id(const std::vector<byte>& session_id, + bool load_from_session_id(const std::vector<uint8_t>& session_id, Session& session) override; bool load_from_server_info(const Server_Information& info, Session& session) override; - void remove_entry(const std::vector<byte>& session_id) override; + void remove_entry(const std::vector<uint8_t>& session_id) override; size_t remove_all() override; @@ -67,7 +67,7 @@ class BOTAN_DLL Session_Manager_SQL : public Session_Manager void prune_session_cache(); std::shared_ptr<SQL_Database> m_db; - secure_vector<byte> m_session_key; + secure_vector<uint8_t> m_session_key; RandomNumberGenerator& m_rng; size_t m_max_sessions; std::chrono::seconds m_session_lifetime; |