diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/filters/modes/cbc/cbc.cpp | 2 | ||||
-rw-r--r-- | src/filters/modes/cts/cts.cpp | 26 | ||||
-rw-r--r-- | src/hash/gost_3411/gost_3411.cpp | 14 | ||||
-rw-r--r-- | src/mac/x919_mac/x919_mac.cpp | 2 | ||||
-rw-r--r-- | src/pk_pad/emsa4/emsa4.cpp | 2 |
5 files changed, 25 insertions, 21 deletions
diff --git a/src/filters/modes/cbc/cbc.cpp b/src/filters/modes/cbc/cbc.cpp index b0c3493e7..822b76030 100644 --- a/src/filters/modes/cbc/cbc.cpp +++ b/src/filters/modes/cbc/cbc.cpp @@ -173,7 +173,7 @@ void CBC_Decryption::buffered_block(const byte input[], u32bit length) xor_buf(temp, state, cipher->BLOCK_SIZE); for(u32bit i = 1; i < to_proc; ++i) - xor_buf(temp + i * cipher->BLOCK_SIZE, + xor_buf(&temp[i * cipher->BLOCK_SIZE], input + (i-1) * cipher->BLOCK_SIZE, cipher->BLOCK_SIZE); diff --git a/src/filters/modes/cts/cts.cpp b/src/filters/modes/cts/cts.cpp index 8504bbc0d..f39c4be36 100644 --- a/src/filters/modes/cts/cts.cpp +++ b/src/filters/modes/cts/cts.cpp @@ -74,10 +74,10 @@ void CTS_Encryption::write(const byte input[], u32bit length) if(length == 0) return; - encrypt(buffer); + encrypt(&buffer[0]); if(length > cipher->BLOCK_SIZE) { - encrypt(buffer + cipher->BLOCK_SIZE); + encrypt(&buffer[cipher->BLOCK_SIZE]); while(length > 2*cipher->BLOCK_SIZE) { encrypt(input); @@ -88,7 +88,7 @@ void CTS_Encryption::write(const byte input[], u32bit length) } else { - copy_mem(&buffer[0], buffer + cipher->BLOCK_SIZE, cipher->BLOCK_SIZE); + copy_mem(&buffer[0], &buffer[cipher->BLOCK_SIZE], cipher->BLOCK_SIZE); position = cipher->BLOCK_SIZE; } buffer.copy(position, input, length); @@ -106,8 +106,8 @@ void CTS_Encryption::end_msg() xor_buf(state, buffer, cipher->BLOCK_SIZE); cipher->encrypt(state); SecureVector<byte> cn = state; - clear_mem(buffer + position, buffer.size() - position); - encrypt(buffer + cipher->BLOCK_SIZE); + clear_mem(&buffer[position], buffer.size() - position); + encrypt(&buffer[cipher->BLOCK_SIZE]); send(cn, position - cipher->BLOCK_SIZE); } @@ -158,7 +158,7 @@ void CTS_Decryption::set_iv(const InitializationVector& iv) */ void CTS_Decryption::decrypt(const byte block[]) { - cipher->decrypt(block, temp); + cipher->decrypt(block, &temp[0]); xor_buf(temp, state, cipher->BLOCK_SIZE); send(temp, cipher->BLOCK_SIZE); state.copy(block, cipher->BLOCK_SIZE); @@ -180,7 +180,7 @@ void CTS_Decryption::write(const byte input[], u32bit length) decrypt(buffer); if(length > cipher->BLOCK_SIZE) { - decrypt(buffer + cipher->BLOCK_SIZE); + decrypt(&buffer[cipher->BLOCK_SIZE]); while(length > 2*cipher->BLOCK_SIZE) { decrypt(input); @@ -191,7 +191,7 @@ void CTS_Decryption::write(const byte input[], u32bit length) } else { - copy_mem(&buffer[0], buffer + cipher->BLOCK_SIZE, cipher->BLOCK_SIZE); + copy_mem(&buffer[0], &buffer[cipher->BLOCK_SIZE], cipher->BLOCK_SIZE); position = cipher->BLOCK_SIZE; } buffer.copy(position, input, length); @@ -204,11 +204,15 @@ void CTS_Decryption::write(const byte input[], u32bit length) void CTS_Decryption::end_msg() { cipher->decrypt(buffer, temp); - xor_buf(temp, buffer + cipher->BLOCK_SIZE, position - cipher->BLOCK_SIZE); + xor_buf(temp, &buffer[cipher->BLOCK_SIZE], position - cipher->BLOCK_SIZE); + SecureVector<byte> xn = temp; - copy_mem(buffer + position, xn + (position - cipher->BLOCK_SIZE), + + copy_mem(&buffer[position], + &xn[position - cipher->BLOCK_SIZE], buffer.size() - position); - cipher->decrypt(buffer + cipher->BLOCK_SIZE, temp); + + cipher->decrypt(&buffer[cipher->BLOCK_SIZE], temp); xor_buf(temp, state, cipher->BLOCK_SIZE); send(temp, cipher->BLOCK_SIZE); send(xn, position - cipher->BLOCK_SIZE); diff --git a/src/hash/gost_3411/gost_3411.cpp b/src/hash/gost_3411/gost_3411.cpp index ee43514d5..b460de29c 100644 --- a/src/hash/gost_3411/gost_3411.cpp +++ b/src/hash/gost_3411/gost_3411.cpp @@ -82,7 +82,7 @@ void GOST_34_11::compress_n(const byte input[], u32bit blocks) byte S[32] = { 0 }; u64bit U[4], V[4]; - load_be(U, hash, 4); + load_be(U, &hash[0], 4); load_be(V, input + 32*i, 4); for(u32bit j = 0; j != 4; ++j) @@ -95,7 +95,7 @@ void GOST_34_11::compress_n(const byte input[], u32bit blocks) key[4*l+k] = get_byte(l, U[k]) ^ get_byte(l, V[k]); cipher.set_key(key, 32); - cipher.encrypt(hash + 8*j, S + 8*j); + cipher.encrypt(&hash[8*j], S + 8*j); if(j == 3) break; @@ -169,7 +169,7 @@ void GOST_34_11::compress_n(const byte input[], u32bit blocks) S[30] = S2[0]; S[31] = S2[1]; - xor_buf(S, hash, 32); + xor_buf(S, &hash[0], 32); // 61 rounds of psi S2[ 0] = S[ 2] ^ S[ 6] ^ S[14] ^ S[20] ^ S[22] ^ S[26] ^ S[28] ^ S[30]; @@ -223,17 +223,17 @@ void GOST_34_11::final_result(byte out[]) if(position) { clear_mem(&buffer[0] + position, buffer.size() - position); - compress_n(buffer, 1); + compress_n(&buffer[0], 1); } SecureVector<byte> length_buf(32); const u64bit bit_count = count * 8; - store_le(bit_count, length_buf); + store_le(bit_count, &length_buf[0]); SecureVector<byte> sum_buf = sum; - compress_n(length_buf, 1); - compress_n(sum_buf, 1); + compress_n(&length_buf[0], 1); + compress_n(&sum_buf[0], 1); copy_mem(out, &hash[0], 32); diff --git a/src/mac/x919_mac/x919_mac.cpp b/src/mac/x919_mac/x919_mac.cpp index 975b195f6..0515dbee9 100644 --- a/src/mac/x919_mac/x919_mac.cpp +++ b/src/mac/x919_mac/x919_mac.cpp @@ -17,7 +17,7 @@ namespace Botan { void ANSI_X919_MAC::add_data(const byte input[], u32bit length) { u32bit xored = std::min(8 - position, length); - xor_buf(state + position, input, xored); + xor_buf(&state[position], input, xored); position += xored; if(position < 8) return; diff --git a/src/pk_pad/emsa4/emsa4.cpp b/src/pk_pad/emsa4/emsa4.cpp index b056d7c27..a647a521d 100644 --- a/src/pk_pad/emsa4/emsa4.cpp +++ b/src/pk_pad/emsa4/emsa4.cpp @@ -110,7 +110,7 @@ bool EMSA4::verify(const MemoryRegion<byte>& const_coded, if(salt_offset == 0) return false; - SecureVector<byte> salt(DB + salt_offset, DB.size() - salt_offset); + SecureVector<byte> salt(&DB[salt_offset], DB.size() - salt_offset); for(u32bit j = 0; j != 8; ++j) hash->update(0); |