svn rev #21605: branches/aes-ccm/src/lib/crypto/dk/

lhoward@MIT.EDU lhoward at MIT.EDU
Fri Dec 26 19:49:00 EST 2008


http://src.mit.edu/fisheye/changelog/krb5/?cs=21605
Commit By: lhoward
Log Message:
Support 64-bit adata lengths



Changed Files:
U   branches/aes-ccm/src/lib/crypto/dk/dk_ccm.c
Modified: branches/aes-ccm/src/lib/crypto/dk/dk_ccm.c
===================================================================
--- branches/aes-ccm/src/lib/crypto/dk/dk_ccm.c	2008-12-26 23:54:50 UTC (rev 21604)
+++ branches/aes-ccm/src/lib/crypto/dk/dk_ccm.c	2008-12-27 00:48:57 UTC (rev 21605)
@@ -103,14 +103,16 @@
 }
 
 static krb5_error_code
-encode_a_len(krb5_data *a, unsigned int adata_len)
+encode_a_len(krb5_data *a, krb5_ui_8 adata_len)
 {
     size_t len;
     unsigned char *p;
 
-    if (adata_len > (1 << 16) - (1 << 8))
+    if (adata_len > (1LL << 32))
+	len = 10;
+    else if (adata_len > (1LL << 16) - (1LL << 8))
 	len = 6;
-    else if (adata_len > 0)
+    else if (adata_len)
 	len = 2;
     else
 	len = 0;
@@ -133,6 +135,18 @@
 	p[4] = (adata_len >> 8 ) & 0xFF;
 	p[5] = (adata_len      ) & 0xFF;
 	break;
+    case 10:
+	p[0] = 0xFF;
+	p[1] = 0xFF;
+	p[2] = (adata_len >> 56) & 0xFF;
+	p[3] = (adata_len >> 48) & 0xFF;
+	p[4] = (adata_len >> 40) & 0xFF;
+	p[5] = (adata_len >> 32) & 0xFF;
+	p[6] = (adata_len >> 24) & 0xFF;
+	p[7] = (adata_len >> 16) & 0xFF;
+	p[8] = (adata_len >> 8 ) & 0xFF;
+	p[9] = (adata_len      ) & 0xFF;
+	break;
     }
 
     a->length = len;
@@ -159,7 +173,7 @@
     unsigned int header_len = 0;
     unsigned int trailer_len = 0;
     unsigned int payload_len = 0;
-    unsigned int adata_len = 0;
+    krb5_ui_8 adata_len = 0;
     unsigned char flags = 0;
     krb5_data nonce, cksum, ivec;
     krb5_cksumtype cksumtype;
@@ -378,7 +392,8 @@
     size_t i, num_sign_data = 0;
     unsigned int header_len = 0;
     unsigned int trailer_len = 0;
-    unsigned int actual_adata_len = 0, actual_payload_len = 0;
+    krb5_ui_8 actual_adata_len = 0;
+    unsigned int actual_payload_len = 0;
     unsigned int payload_len = 0;
     unsigned char flags = 0;
     krb5_data cksum, ivec;




More information about the cvs-krb5 mailing list