Subject: [P2PSIP] StoredData and its Signature

From: Michael Chen <[email-masked]>
Date: Fri, 30 Oct 2009 14:03:48 -0800

Cullen,

The definition of StoredData the opening of Section 6 and its Signature 
in Section 6.1 are confusing:

        struct {
          uint32                  length;
          uint64                  storage_time;
          uint32                  lifetime;
          StoredDataValue         value;
          Signature               signature;
        } StoredData;

   The contents of this structure are as follows:

   length
      The length of the rest of the structure in octets.
   ...

   value
      The data value itself, as described in Section 6.2.

   signature
      A signature over the data value.  Section 6.1 describes the
      signature computation.  The element is formatted as described in
      Section 5.3.4

 6.1. Data Signature Computation

   Each StoredData ....  The input to the signature algorithm is:

      resource_id + kind + StoredData + SignerIdentity

   Where these values are:
   ...

   StoredData
      The contents of the stored data value, as described in the
      previous sections, with the lifetime set to 0.

1) "length" seems to suggest it equals (sizeof(StoredData) - 
sizeof(length)), which means the size of StoredDataValue and Signature 
must be obtained before signing. No big deal, but the text should more 
explicit and precise. Suggestion:

   length
      The size of the StoredData structure in octets excluding the size
      of length itself.

2) The big problem is the signature input. In Section 6 the term "data 
value" appears in both the definition of "value" and "signature", seems 
to suggest that the 3rd input block for the signature only refer to the 
"value" field.  In Section 6.1, the instruction of setting "lifetime" to 
0 before signing suggest the signature includes the rest of the fields 
PLUS the signature itself (the 3rd input block is "+ StoredData +").

If I am not mistaken, the correct definition for the signature input 
should be:

    resource_id + kind + storage_time + lifetime + value + SignerIdentity

The fact that "length" includes the size of the signature is somewhat 
awkward to be in the input. Excluding it does not degrade the security 
of the signature.  If it is up to me, instead of setting "lifetime" to 0 
before signing, why not exclude it all together?

3) "SignerIdentity" in this section should refer to its definition in 
Section 5.3.4 to prevent people from reading it as simply a 20-byte SHA1 
hash value.

   SignerIdentity
      The signer identity as defined in Section 5.3.4, which MUST include
      a hash of the signer's certificate.

Thanks

--Michael

---

From: jc <[email-masked]>
Date: Sat, 31 Oct 2009 02:16:13 -0400

On Oct 30, 2009, at 6:03 PM, Michael Chen wrote:

> Cullen,
>
> The definition of StoredData the opening of Section 6 and its  
> Signature in Section 6.1 are confusing:
>
>       struct {
>         uint32                  length;
>         uint64                  storage_time;
>         uint32                  lifetime;
>         StoredDataValue         value;
>         Signature               signature;
>       } StoredData;
>
> 1) "length" seems to suggest it equals (sizeof(StoredData) - sizeof 
> (length)), which means the size of StoredDataValue and Signature  
> must be obtained before signing. No big deal, but the text should  
> more explicit and precise. Suggestion:
>
>  length

The wording is wrong and it should be simply "length = sizeof 
(StoredData)" because "the length is the size in octets of StoredData  
excluding all other fields". Please correct me if I am wrong, it's late.

>
> 2) The big problem is the signature input. In Section 6 the term  
> "data value" appears in both the definition of "value" and  
> "signature", seems to suggest that the 3rd input block for the  
> signature only refer to the "value" field.  In Section 6.1, the  
> instruction of setting "lifetime" to 0 before signing suggest the  
> signature includes the rest of the fields PLUS the signature itself  
> (the 3rd input block is "+ StoredData +").
>
> The fact that "length" includes the size of the signature is  
> somewhat awkward to be in the input. Excluding it does not degrade  
> the security of the signature.  If it is up to me, instead of  
> setting "lifetime" to 0 before signing, why not exclude it all  
> together?

Where does the length field include the sizeof(signature)? See above.

>
> 3) "SignerIdentity" in this section should refer to its definition  
> in Section 5.3.4 to prevent people from reading it as simply a 20- 
> byte SHA1 hash value.
>
>  SignerIdentity
> _______________________________________________
> P2PSIP mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/p2psip

---

From: Michael Chen <[email-masked]>
Date: Sat, 31 Oct 2009 06:51:43 -0800

Julian,

The StoredData structure includes the signature, so the draft's definition:

  length
    The length of the >>**rest**<< of the structure in octets.

would mean it includes the signature.

--Michael

jc wrote:
>> sizeof(length)), which means the size of StoredDataValue and 
>> Signature must be obtained before signing. No big deal, but the text 
>> should more explicit and precise. Suggestion:
>>
>>  length
> The wording is wrong and it should be simply "length = 
> sizeof(StoredData)" because "the length is the size in octets of 
> StoredData excluding all other fields". Please correct me if I am 
> wrong, it's late.
>
>>
>> awkward to be in the input. Excluding it does not degrade the 
>> security of the signature.  If it is up to me, instead of setting 
>> "lifetime" to 0 before signing, why not exclude it all together?
>
>> Section 5.3.4 to prevent people from reading it as simply a 20-byte 
>> SHA1 hash value.
>>
>>  SignerIdentity

---

From: Michael Chen <[email-masked]>
Date: Sat, 31 Oct 2009 07:51:44 -0800

Julian,

Reading into it more, I am suggesting the following minimalist correction:

A) The definintion of 'length' Section 6 should be:

   length
      The size of the StoredData structure excluding 'length' and 'signature'.

B) In Section 6.1, the input to the signature algorithm should be:

      resource_id + kind + stored_data + SignerIdentity

   Where these values are:
   ...

   stored_data
      The contents of the StoredData structure excluding the 'signature' as
      described in the previous sections, with the lifetime set to 0.

   SignerIdentity

It is an obvious style of this draft that a length value of a structure 
never includes the bytes occupied by the length itself.

Thanks

--Michael