diff options
author | Jack Lloyd <[email protected]> | 2017-09-15 12:41:59 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-15 12:41:59 -0400 |
commit | 92245ad040b8f0e08a4a57137be5739e5c7bfbdc (patch) | |
tree | b7f05cb85c1028a728ca4f87228b42634da1f0c9 /src/lib/modes | |
parent | 3ad91d3c8c06cf77e69b9a1c80fce236f660956b (diff) |
Change wide block OCB
Ted Krovetz confirmed there were bugs in the reference code for
blocks > 128 bits so these values should be the correct ones.
Diffstat (limited to 'src/lib/modes')
-rw-r--r-- | src/lib/modes/aead/ocb/ocb.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/lib/modes/aead/ocb/ocb.cpp b/src/lib/modes/aead/ocb/ocb.cpp index 4eb8089b5..e580c95d9 100644 --- a/src/lib/modes/aead/ocb/ocb.cpp +++ b/src/lib/modes/aead/ocb/ocb.cpp @@ -210,11 +210,7 @@ OCB_Mode::update_nonce(const uint8_t nonce[], size_t nonce_len) secure_vector<uint8_t> nonce_buf(BS); copy_mem(&nonce_buf[BS - nonce_len], nonce, nonce_len); - #if 0 nonce_buf[0] = ((tag_size()*8) % (BS*8)) << (BS <= 16 ? 1 : 0); - #else - nonce_buf[0] = (tag_size()*8) << (BS <= 16 ? 1 : 0); - #endif nonce_buf[BS - nonce_len - 1] ^= 1; @@ -249,7 +245,6 @@ OCB_Mode::update_nonce(const uint8_t nonce[], size_t nonce_len) | 1024 | 524355 | 352 | 9 | +----------+---------+-------+---------+ */ -#if 0 if(BS == 16) { for(size_t i = 0; i != BS / 2; ++i) @@ -270,30 +265,6 @@ OCB_Mode::update_nonce(const uint8_t nonce[], size_t nonce_len) for(size_t i = 0; i != BS / 2; ++i) nonce_buf.push_back(nonce_buf[i] ^ nonce_buf[i+22]); } -#else - nonce_buf.insert(nonce_buf.end(), nonce_buf.begin(), nonce_buf.end()); - - if(BS == 16) - { - for(size_t i = BS; i != BS + (BS / 2); ++i) - nonce_buf[i] ^= nonce_buf[i+1]; - } - else if(BS == 24) - { - for(size_t i = BS; i != BS + (BS / 2); ++i) - nonce_buf[i] ^= nonce_buf[i+5]; - } - else if(BS == 32) - { - for(size_t i = BS; i != BS + (BS / 2); ++i) - nonce_buf[i] ^= (nonce_buf[i] << 1) ^ (nonce_buf[i+1] >> 7); - } - else if(BS == 64) - { - for(size_t i = BS; i != BS + (BS / 2); ++i) - nonce_buf[i] ^= nonce_buf[i+22]; - } -#endif m_stretch = nonce_buf; } |