Subject: [COSE] Arrays vs maps at the top level

From: "Jim Schaad" <[email-masked]>
Date: Tue, 28 Jul 2015 06:55:31 -0700

As I stated in a previous response to Carsten that I was keeping the
question of arrays vs maps at the top level because I felt that there was
not a lot of strong arguments either way and it was a bit of a weak
consensus.

There have been a number of changes that we have made that have changed the
number of bytes of overhead.  This may change some people's opinions.  The
overhead differences are now as follows:

			MAP		ARRAY
Direct Encryption	12		10
Signature		12		10
MAC Direct		14		11

The removal of AAD, IV and TAG as independent fields makes the array size
smaller in those cases where it is not used.  The shrinkage is less for MAP
since the assumption of them not being there for recipient structures was
already built in.   The last time I did this analysis the sizes were
basically equal.  There is now an advantage for arrays in all cases.  For
encryption and mac - going from direct to any other key management technique
will increase the size of MAP w/o a corresponding increase in the size of
Array since all fields already exist for it.

Based on implementation experience, I have also found that doing the array
version is much simpler from a couple of perspectives.

- It is much easier to look at the array to see what is and what is not
present than for maps.  This has become very true with the loss of text
labels since the tag 1 is not unique.  It means different things in
different places.  This makes things harder to look at.

- It is easier to get a comparison routine working correctly.  Since maps
are randomly placed but arrays are fixed, it is simpler to do automated
comparisons.   There may still be issues with the protected/unprotected
maps.  But that is more likely to be under the program than library control
so it is easier to control from the outside.  There are still issues where
one may need to do sorting of these maps to do comparisons.  However
removing one layer of problems seems to be goodness.

- At the f2f, Carsten raised the fact that for an array version, since the
message type is in a fixed location, code can examine this value when it is
in an array and processing can be aborted at an earlier point if the message
structure type is not supported.

Based on these arguments and the new numbers, I want to move back to arrays
from maps for the top level objects.

Jim

---

From: Mike Jones <[email-masked]>
Date: Tue, 28 Jul 2015 15:48:29 +0000

Sounds reasonable. What would the structure of the top level arrays be?

-- Mike
________________________________
From: Jim Schaad<mailto:[email-masked]>
Sent: ‎7/‎28/‎2015 6:55 AM
To: [email-masked]<mailto:[email-masked]>
Subject: [COSE] Arrays vs maps at the top level

                        MAP             ARRAY
Direct Encryption       12              10
Signature               12              10
MAC Direct              14              11

Jim

_______________________________________________
COSE mailing list
[email-masked]
https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fwww.ietf.org%2fmailman%2flistinfo%2fcose&data=01%7c01%7cMichael.Jones%40microsoft.com%7c8f8e25f384c34d399a5e08d297542ef3%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=osT3Dn21g%2flV0L0erjQCWZsUxVoBNYRhRqCfN7cvRmM%3d

---

From: "Jim Schaad" <[email-masked]>
Date: Tue, 28 Jul 2015 09:33:52 -0700

The only change in the grammar is from map to array.  Nothing else is
re-ordered.

From: Mike Jones [mailto:[email-masked]] 
Sent: Tuesday, July 28, 2015 8:48 AM
To: Jim Schaad; [email-masked]
Subject: RE: [COSE] Arrays vs maps at the top level

-- Mike

  _____  

From: Jim Schaad <mailto:[email-masked]> 
Sent: ‎7/‎28/‎2015 6:55 AM
To: [email-masked] <mailto:[email-masked]> 
Subject: [COSE] Arrays vs maps at the top level

                        MAP             ARRAY
Direct Encryption       12              10
Signature               12              10
MAC Direct              14              11

Jim

_______________________________________________
COSE mailing list
[email-masked] <mailto:[email-masked]> 
https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fwww.ietf.or
g%2fmailman%2flistinfo%2fcose
<https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fwww.ietf.o
rg%2fmailman%2flistinfo%2fcose&data=01%7c01%7cMichael.Jones%40microsoft.com%
7c8f8e25f384c34d399a5e08d297542ef3%7c72f988bf86f141af91ab2d7cd011db47%7c1&sd
ata=osT3Dn21g%2flV0L0erjQCWZsUxVoBNYRhRqCfN7cvRmM%3d>
&data=01%7c01%7cMichael.Jones%40microsoft.com%7c8f8e25f384c34d399a5e08d29754
2ef3%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=osT3Dn21g%2flV0L0erjQCWZsU
xVoBNYRhRqCfN7cvRmM%3d

---

From: "Jim Schaad" <[email-masked]>
Date: Wed, 29 Jul 2015 07:24:19 -0700

The set of changes can be found in pull request #61

From: COSE [mailto:[email-masked]] On Behalf Of Jim Schaad
Sent: Tuesday, July 28, 2015 9:34 AM
To: 'Mike Jones'; [email-masked]
Subject: Re: [COSE] Arrays vs maps at the top level

From: Mike Jones [mailto:[email-masked]] 
Sent: Tuesday, July 28, 2015 8:48 AM
To: Jim Schaad; [email-masked] <mailto:[email-masked]> 
Subject: RE: [COSE] Arrays vs maps at the top level

-- Mike

  _____  

                        MAP             ARRAY
Direct Encryption       12              10
Signature               12              10
MAC Direct              14              11

Jim