aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/modes/aead/ccm
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/modes/aead/ccm')
-rw-r--r--src/lib/modes/aead/ccm/ccm.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/modes/aead/ccm/ccm.cpp b/src/lib/modes/aead/ccm/ccm.cpp
index 50fc38738..7fd92e149 100644
--- a/src/lib/modes/aead/ccm/ccm.cpp
+++ b/src/lib/modes/aead/ccm/ccm.cpp
@@ -118,7 +118,7 @@ void CCM_Mode::encode_length(size_t len, byte out[])
BOTAN_ASSERT(len_bytes < sizeof(size_t), "Length field fits");
for(size_t i = 0; i != len_bytes; ++i)
- out[i] = get_byte(sizeof(size_t)-i, len);
+ out[len_bytes-1-i] = get_byte(sizeof(size_t)-1-i, len);
BOTAN_ASSERT((len >> (len_bytes*8)) == 0, "Message length fits in field");
}