1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 04:11:35 +01:00

Moved endianness change functions to endianness.h.

This commit is contained in:
Matias Fontanini
2012-09-03 23:58:43 -03:00
parent 279940c398
commit 832a79a1e1
39 changed files with 482 additions and 557 deletions

View File

@@ -114,11 +114,11 @@ RC4EAPOL::RC4EAPOL(const uint8_t *buffer, uint32_t total_sz)
}
void RC4EAPOL::key_length(uint16_t new_key_length) {
_header.key_length = Utils::host_to_be(new_key_length);
_header.key_length = Endian::host_to_be(new_key_length);
}
void RC4EAPOL::replay_counter(uint16_t new_replay_counter) {
_header.replay_counter = Utils::host_to_be(new_replay_counter);
_header.replay_counter = Endian::host_to_be(new_replay_counter);
}
void RC4EAPOL::key_iv(const uint8_t *new_key_iv) {
@@ -149,7 +149,7 @@ void RC4EAPOL::write_body(uint8_t *buffer, uint32_t total_sz) {
uint32_t sz = sizeof(_header) + _key.size();
assert(total_sz >= sz);
if(_key.size())
_header.key_length = Utils::host_to_be(_key.size());
_header.key_length = Endian::host_to_be(_key.size());
std::memcpy(buffer, &_header, sizeof(_header));
buffer += sizeof(_header);
std::copy(_key.begin(), _key.end(), buffer);
@@ -183,11 +183,11 @@ void RSNEAPOL::RSNEAPOL::nonce(const uint8_t *new_nonce) {
}
void RSNEAPOL::rsc(uint64_t new_rsc) {
_header.rsc = Utils::host_to_be(new_rsc);
_header.rsc = Endian::host_to_be(new_rsc);
}
void RSNEAPOL::id(uint64_t new_id) {
_header.id = Utils::host_to_be(new_id);
_header.id = Endian::host_to_be(new_id);
}
void RSNEAPOL::mic(const uint8_t *new_mic) {
@@ -195,7 +195,7 @@ void RSNEAPOL::mic(const uint8_t *new_mic) {
}
void RSNEAPOL::wpa_length(uint16_t new_wpa_length) {
_header.wpa_length = Utils::host_to_be(new_wpa_length);
_header.wpa_length = Endian::host_to_be(new_wpa_length);
}
void RSNEAPOL::key(const key_type &new_key) {
@@ -220,7 +220,7 @@ void RSNEAPOL::write_body(uint8_t *buffer, uint32_t total_sz) {
assert(total_sz >= sz);
if(_key.size()) {
if(!_header.key_t) {
_header.key_length = Utils::host_to_be<uint16_t>(32);
_header.key_length = Endian::host_to_be<uint16_t>(32);
wpa_length(_key.size());
}
else if(_key.size()) {