Subject: CMS: Comment on checksum algorithm.

From: Dr Stephen Henson <[email-masked]>
Date: Sat, 14 Nov 1998 23:35:11 +0000

Couple of comments re the checksum algorithm:

> 12.6.1  Sum of Sums Key Checksum
> 
>    The Sum of Sums [SUM] key checksum algorithm is:
> 
>    1.  Initialize two 16 bit integers, sum1 and sum2, to zero.
>    2.  Loop through the octets of the content-encryption key, most
>        significant octet to least significant octet.
>        2a.  Create a 16 bit integer, called temp, by concatenating
>             eight zero bits and the key octet.
>        2b.  sum1 = sum1 + temp.
>        2c.  sum2 = sum2 + sum1.
>    3.  Use sum2 as the checksum value.
> 

IMHO "most significant octet to least significant octet" might be
considered ambiguous. Perhaps "first to last octet" (assuming that's
what it means) would be clearer.

I assume 2a this is just setting temp to the value of the key octet
(i.e. treat key octet as an unsigned 8 bit integer).

Finally isn't the whole thing equivalent to:

{n*K_1 + (n-1)*K_2 + ... + K_n} mod 2^16

Where an K_i represents the i'th octet of an n byte key? Or am I
misinterpreting something?

Steve.
-- 
Dr Stephen N. Henson. UK based freelance Cryptographic Consultant. 
For info see homepage at http://www.drh-consultancy.demon.co.uk/
Email: [email-masked]
PGP key: via homepage.

---

From: EKR <[email-masked]>
Date: 14 Nov 1998 16:44:17 -0800

> what it means) would be clearer.
It might be ambiguous, but so is 'first to last', IMHO.

How about 
'most significant (leftmost) to least significant (rightmost) octet'

> misinterpreting something?
It certainly looks like it to me.

-Ekr

-- 
[Eric Rescorla                                   [email-masked]]

---

From: Paul Hoffman / IMC <[email-masked]>
Date: Sat, 14 Nov 1998 17:15:17 -0800

>'most significant (leftmost) to least significant (rightmost) octet'

Er, I really don't like "left" and "right", since a fair number of people
in the world write from right to left. I propose:

most significant (first) octet to least significant (last) octet

--Paul Hoffman, Director
--Internet Mail Consortium

---

From: Dr Stephen Henson <[email-masked]>
Date: Sun, 15 Nov 1998 03:00:18 +0000

> most significant (first) octet to least significant (last) octet

Yes I'll go with that. "First" and "last" were the terms used in a
similar (but not identical) algorithm mentioned in the PKCS#11 spec.

Steve.