]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Use platform-independent types for ocb data_coutn and message_count.
authorNiels Möller <nisse@lysator.liu.se>
Thu, 8 Jan 2026 19:56:07 +0000 (20:56 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 8 Jan 2026 19:56:07 +0000 (20:56 +0100)
ChangeLog
ocb.c
ocb.h

index a827c7696415d92d0c0bc081c43c7c26b0100b8f..070b94d741d5a8a728dd676113f990eefc38cf8f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-01-08  Niels Möller  <nisse@lysator.liu.se>
+
+       * ocb.h (struct ocb_ctx): Change types of data_count and
+       message_count to uint32_t and uint64_t, respectively, from size_t.
+       Makes the implementation limits on the size of associated data and
+       cleartext be platform independent.
+
 2026-01-02  Niels Möller  <nisse@lysator.liu.se>
 
        * sexp.c (sexp_iterator_exit_list): Rewrite to not recurse via
diff --git a/ocb.c b/ocb.c
index 22ddf915b1ffd4e87ce74445f333fd9d85eb1287..f0efaa26ea5666b1762dfb01c4b885974675866f 100644 (file)
--- a/ocb.c
+++ b/ocb.c
@@ -67,7 +67,7 @@ ocb_set_key (struct ocb_key *key, const void *cipher, nettle_cipher_func *f)
 /* Add x^k L[2], where k is the number of trailing zero bits in i. */
 static void
 update_offset(const struct ocb_key *key,
-             union nettle_block16 *offset, size_t i)
+             union nettle_block16 *offset, uint64_t i)
 {
   if (i & 1)
     block16_xor (offset, &key->L[2]);
@@ -132,7 +132,7 @@ ocb_set_nonce (struct ocb_ctx *ctx,
 
 static void
 ocb_fill_n (const struct ocb_key *key,
-           union nettle_block16 *offset, size_t count,
+           union nettle_block16 *offset, uint64_t count,
            size_t n, union nettle_block16 *o)
 {
   assert (n > 0);
diff --git a/ocb.h b/ocb.h
index dbcf4c8aaceb4373d9d6607fce543c8ddf44a3fb..6586b4dce76afd36b68c67540a73073478bc1cd7 100644 (file)
--- a/ocb.h
+++ b/ocb.h
@@ -79,8 +79,8 @@ struct ocb_ctx {
   /* Authentication for the message */
   union nettle_block16 checksum;
   /* Count of processed blocks. */
-  size_t data_count;
-  size_t message_count;
+  uint32_t data_count;
+  uint64_t message_count;
 };
 
 void