summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2004-01-27 03:44:45 +0000
committerMike Frysinger <vapier@gentoo.org>2004-01-27 03:44:45 +0000
commit41dedb215386b80f30ed5495f178ba51570cc633 (patch)
tree67cfc43a13c75eeba33e7cb6e38d941f96ae349b /dev-libs/libtomcrypt
parentver bump #39483 (diff)
downloadhistorical-41dedb215386b80f30ed5495f178ba51570cc633.tar.gz
historical-41dedb215386b80f30ed5495f178ba51570cc633.tar.bz2
historical-41dedb215386b80f30ed5495f178ba51570cc633.zip
forgot patch
Diffstat (limited to 'dev-libs/libtomcrypt')
-rw-r--r--dev-libs/libtomcrypt/files/ocb.c.patch208
1 files changed, 208 insertions, 0 deletions
diff --git a/dev-libs/libtomcrypt/files/ocb.c.patch b/dev-libs/libtomcrypt/files/ocb.c.patch
new file mode 100644
index 000000000000..c3a593c4d118
--- /dev/null
+++ b/dev-libs/libtomcrypt/files/ocb.c.patch
@@ -0,0 +1,208 @@
+--- ../libtomcrypt-0.93/ocb.c 2004-01-25 13:40:32.869240000 -0500
++++ ocb.c 2004-01-26 12:34:40.621438400 -0500
+@@ -34,8 +34,7 @@
+ int ocb_init(ocb_state *ocb, int cipher,
+ const unsigned char *key, unsigned long keylen, const unsigned char *nonce)
+ {
+- int x, y, z, m, p, err;
+- unsigned char tmp[MAXBLOCKSIZE];
++ int x, y, m, err;
+
+ _ARGCHK(ocb != NULL);
+ _ARGCHK(key != NULL);
+@@ -139,7 +138,7 @@
+ int ocb_encrypt(ocb_state *ocb, const unsigned char *pt, unsigned char *ct)
+ {
+ unsigned char Z[MAXBLOCKSIZE], tmp[MAXBLOCKSIZE];
+- int err, x, y;
++ int err, x;
+
+ _ARGCHK(ocb != NULL);
+ _ARGCHK(pt != NULL);
+@@ -178,7 +177,7 @@
+ int ocb_decrypt(ocb_state *ocb, const unsigned char *ct, unsigned char *pt)
+ {
+ unsigned char Z[MAXBLOCKSIZE], tmp[MAXBLOCKSIZE];
+- int err, x, y;
++ int err, x;
+
+ _ARGCHK(ocb != NULL);
+ _ARGCHK(pt != NULL);
+@@ -228,7 +227,7 @@
+
+ {
+ unsigned char Z[MAXBLOCKSIZE], Y[MAXBLOCKSIZE], X[MAXBLOCKSIZE];
+- int err, x, y;
++ int err, x;
+
+ _ARGCHK(ocb != NULL);
+ _ARGCHK(pt != NULL);
+@@ -247,7 +246,8 @@
+ shift_xor(ocb, X);
+ memcpy(Z, X, ocb->block_len);
+
+- X[ocb->block_len-1] ^= ptlen&255;
++ X[ocb->block_len-1] ^= (ptlen*8)&255;
++ X[ocb->block_len-2] ^= ((ptlen*8)>>8)&255;
+ for (x = 0; x < ocb->block_len; x++) {
+ X[x] ^= ocb->Lr[x];
+ }
+@@ -346,9 +346,16 @@
+ unsigned char *ct,
+ unsigned char *tag, unsigned long *taglen)
+ {
+- int err, n;
++ int err;
+ ocb_state ocb;
+
++ _ARGCHK(key != NULL);
++ _ARGCHK(nonce != NULL);
++ _ARGCHK(pt != NULL);
++ _ARGCHK(ct != NULL);
++ _ARGCHK(tag != NULL);
++ _ARGCHK(taglen != NULL);
++
+ if ((err = ocb_init(&ocb, cipher, key, keylen, nonce)) != CRYPT_OK) {
+ return err;
+ }
+@@ -378,9 +385,17 @@
+ const unsigned char *tag, unsigned long taglen,
+ int *res)
+ {
+- int err, n;
++ int err;
+ ocb_state ocb;
+
++
++ _ARGCHK(key != NULL);
++ _ARGCHK(nonce != NULL);
++ _ARGCHK(pt != NULL);
++ _ARGCHK(ct != NULL);
++ _ARGCHK(tag != NULL);
++ _ARGCHK(res != NULL);
++
+ if ((err = ocb_init(&ocb, cipher, key, keylen, nonce)) != CRYPT_OK) {
+ return err;
+ }
+@@ -412,84 +427,84 @@
+ unsigned char key[16], nonce[16], pt[32], ct[32], tag[16];
+ } tests[] = {
+
+- /* NULL message */
++ /* OCB-AES-128-0B */
+ {
+ 0,
+ /* key */
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ /* nonce */
+- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
++ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
+ /* pt */
+- { 0x00 },
++ { 0 },
+ /* ct */
+- { 0x00 },
++ { 0 },
+ /* tag */
+- { 0x04, 0xad, 0xa4, 0x5e, 0x94, 0x7b, 0xc5, 0xb6,
+- 0xe0, 0x0f, 0x4c, 0x8b, 0x80, 0x53, 0x90, 0x2d }
++ { 0x15, 0xd3, 0x7d, 0xd7, 0xc8, 0x90, 0xd5, 0xd6,
++ 0xac, 0xab, 0x92, 0x7b, 0xc0, 0xdc, 0x60, 0xee },
+ },
+-
+- /* one byte message */
++
++
++ /* OCB-AES-128-3B */
+ {
+- 1,
++ 3,
+ /* key */
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ /* nonce */
+- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
++ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
+ /* pt */
+- { 0x11 },
++ { 0x00, 0x01, 0x02 },
+ /* ct */
+- { 0x6f },
++ { 0xfc, 0xd3, 0x7d },
+ /* tag */
+- { 0xe2, 0x61, 0x42, 0x3e, 0xbb, 0x0e, 0x7f, 0x3b,
+- 0xa6, 0xdd, 0xf1, 0x3e, 0xe8, 0x0b, 0x7b, 0x00}
++ { 0x02, 0x25, 0x47, 0x39, 0xa5, 0xe3, 0x56, 0x5a,
++ 0xe2, 0xdc, 0xd6, 0x2c, 0x65, 0x97, 0x46, 0xba },
+ },
+
+- /* 16 byte message */
++ /* OCB-AES-128-16B */
+ {
+- 16,
++ 16,
+ /* key */
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ /* nonce */
+- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
++ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
+ /* pt */
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ /* ct */
+- { 0x6a, 0xaf, 0xac, 0x40, 0x6d, 0xfa, 0x87, 0x40,
+- 0x57, 0xc7, 0xdb, 0xe9, 0x6f, 0x1b, 0x39, 0x53 },
++ { 0x37, 0xdf, 0x8c, 0xe1, 0x5b, 0x48, 0x9b, 0xf3,
++ 0x1d, 0x0f, 0xc4, 0x4d, 0xa1, 0xfa, 0xf6, 0xd6 },
+ /* tag */
+- { 0xff, 0xbf, 0x96, 0x87, 0x72, 0xfe, 0xee, 0x59,
+- 0x08, 0x1f, 0xc7, 0x8c, 0x8f, 0xd9, 0x16, 0xc2 }
++ { 0xdf, 0xb7, 0x63, 0xeb, 0xdb, 0x5f, 0x0e, 0x71,
++ 0x9c, 0x7b, 0x41, 0x61, 0x80, 0x80, 0x04, 0xdf },
+ },
+
+- /* 17 byte message */
++ /* OCB-AES-128-20B */
+ {
+- 17,
++ 20,
+ /* key */
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ /* nonce */
+- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
++ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
+ /* pt */
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+- 0x10 },
++ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
++ 0x10, 0x11, 0x12, 0x13 },
+ /* ct */
+- { 0x8c, 0x94, 0xbd, 0xd4, 0x2d, 0xdd, 0x1c, 0x40,
+- 0xbe, 0xe0, 0x06, 0xb5, 0xab, 0x54, 0x3b, 0x00,
+- 0x20 },
++ { 0x01, 0xa0, 0x75, 0xf0, 0xd8, 0x15, 0xb1, 0xa4,
++ 0xe9, 0xc8, 0x81, 0xa1, 0xbc, 0xff, 0xc3, 0xeb,
++ 0x70, 0x03, 0xeb, 0x55},
+ /* tag */
+- { 0x0e, 0x72, 0x7c, 0x88, 0x73, 0xbb, 0x66, 0xd7,
+- 0x4a, 0x4f, 0xd4, 0x84, 0x83, 0xc7, 0x9a, 0x29 }
+-}
+-
++ { 0x75, 0x30, 0x84, 0x14, 0x4e, 0xb6, 0x3b, 0x77,
++ 0x0b, 0x06, 0x3c, 0x2e, 0x23, 0xcd, 0xa0, 0xbb },
++},
+ };
+
+ int err, x, idx, res;