Re: [lamps] [CMP Updates] position of hashAlg in certStatus

"Blumenthal, Uri - 0553 - MITLL" <uri@ll.mit.edu> Tue, 31 August 2021 16:38 UTC

Return-Path: <prvs=5877d293de=uri@ll.mit.edu>
X-Original-To: spasm@ietfa.amsl.com
Delivered-To: spasm@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4556D3A1C48 for <spasm@ietfa.amsl.com>; Tue, 31 Aug 2021 09:38:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.795
X-Spam-Level:
X-Spam-Status: No, score=-1.795 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=0.1, MIME_QP_LONG_LINE=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SpZwI1_83yHj for <spasm@ietfa.amsl.com>; Tue, 31 Aug 2021 09:38:09 -0700 (PDT)
Received: from MX2.LL.MIT.EDU (mx2.ll.mit.edu [129.55.12.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3B7B63A1C6E for <spasm@ietf.org>; Tue, 31 Aug 2021 09:38:08 -0700 (PDT)
Received: from LLE2K16-HYBRD02.mitll.ad.local (lle2k16-hybrd02.llan.ll.mit.edu [172.25.5.146]) by MX2.LL.MIT.EDU (8.16.1.2/8.16.1.2) with ESMTPS id 17VGbxRk400360 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 31 Aug 2021 09:37:59 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector5401; d=microsoft.com; cv=none; b=1uXtGecyi/e/UYrJODJoIaiTcJsIBP8pNs9eL8u/abCIjbuo80BXPLuFmS+NFPD3YDT4xQCJFA8zjczo4/Uc0c0enqH4GwMIBtrJ4aQqLPQEg/fKkIZVMU7VI2unZ7DtvomCIkhv4LMfgX2zmOChj0TsOmYfSye29uH6edD3oQWq16sEvj55VNVZbgF/CJ5XX08bzGsLIuu6FazsMLisGNJ3hCUstglpks7THwtFC1Ao5YxLqIKdNsRLkeG6wGw9vglfsMetlED440FgDl8ysW2pkyma7IKKX4gNsalIRGImzKyKXLWxlIroCCUlv7aEf9h4mSvCa/TY6QFFzwOTgg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector5401; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/zANc4CY4lLSP1xWMKTdifAdRhSWMubjS2QYtzq5iS4=; b=g2XiHkGPB0v4NkeM/BQV5L4L5yi6mzkn06M/g4qS/UP5rrbie2A/9L2NwhNjXcGc58gooFiXEOjxxxjDxk1ANNHEeN4L93o98LJh1Dvoze9geF/mrcDbYHM5eKdI9nshGXAmebusDZiXtoNbsUrscCHTMTbrOHkPpMZ9aLOFEMJol3xj8AC+wNGcOYvZF2zPBWvDTwO+wsXg5bqzciTVneZrSw6jLL1rIsW1egjkervO1dM9Hnft9dWmkj4Vx93tRldHTzIZrbMKiCMuGY6+IuSOfwbTHzbWvIVk9bcteuTsBbRNwn6eR9m1I8WOAaqHneQfmiwaW8dFTSiVJmD1oQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ll.mit.edu; dmarc=pass action=none header.from=ll.mit.edu; dkim=pass header.d=ll.mit.edu; arc=none
From: "Blumenthal, Uri - 0553 - MITLL" <uri@ll.mit.edu>
To: Russ Housley <housley@vigilsec.com>, "Brockhaus, Hendrik" <hendrik.brockhaus@siemens.com>
CC: "spasm@ietf.org" <spasm@ietf.org>, "david.von.oheimb@siemens.com" <david.von.oheimb@siemens.com>, John Gray <John.Gray@entrust.com>
Thread-Topic: [lamps] [CMP Updates] position of hashAlg in certStatus
Thread-Index: AdeeYf4qJoncXhwQRYWt5DPU7d+LUgAGIhOAAAJu2kAAADwSAP//v6aA
Date: Tue, 31 Aug 2021 16:37:56 +0000
Message-ID: <2C38904D-F103-4089-8CAB-B61B1EC9856A@ll.mit.edu>
References: <AM0PR10MB24186D6DC7AF50CCC6576D93FECC9@AM0PR10MB2418.EURPRD10.PROD.OUTLOOK.COM> <B0E72BB3-4744-4DC6-869C-F5A6EAE0AE2B@vigilsec.com> <AM0PR10MB2418CD3F8BD68890B1CA6DE1FECC9@AM0PR10MB2418.EURPRD10.PROD.OUTLOOK.COM> <690E4FC1-7D4E-4FE2-83C1-55DB9A62127C@vigilsec.com>
In-Reply-To: <690E4FC1-7D4E-4FE2-83C1-55DB9A62127C@vigilsec.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/16.52.21080801
authentication-results: vigilsec.com; dkim=none (message not signed) header.d=none;vigilsec.com; dmarc=none action=none header.from=ll.mit.edu;
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 66fa6ccf-bdf8-47ed-c70b-08d96c9dafa8
x-ms-traffictypediagnostic: BN1P110MB0756:
x-microsoft-antispam-prvs: <BN1P110MB0756DCF72AED5AE742CD9E9F90CC9@BN1P110MB0756.NAMP110.PROD.OUTLOOK.COM>
x-ms-oob-tlc-oobclassifiers: OLM:10000;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: 8R39c+jwWolXQRXbbq7G/M1HEzaIapecnZVBmVnUmcb3NeHo7yYhh5CG0KXNHUaScwPoUDQ9Iw8QB+JBMGY9cEAhIkTFwaeeoY22V0NmhpbYSahjCAnVhrWIncfLO+Al6Cuxl7HxqnR0gB3Vh3P/D4MPiA+DRUC8Smyjc0gtoVpYXrI2NMpvx2QOfVyKVggDgFsEWgkvOhn/gVO/B1mDbSuBQMzMUK2DkFn6i440bmjzDww8Ao6JE4cmnPbIHPck7EbDEReQ9yhPlXz1LhzvlKxLxBCgu6QXxx1ZTlweXHeIfUdW9fL9kGu0DgUcspVkzQ23W0dtqpfSAgMdN7Qk+Lf27HJ+i6NDbyvdHFDAoPwyTPKZihI8DPxz9bLZTuNakZ56nR8Y6Z994XOtm8svGPXl6WRezMv28WPO/mW6MNicxAoJJaoWWyf7hmFxD539m1azJFCLHNuU9A/hUhZc0DaBFtdLRfZ4Df3MMGgEBVOtlUmFbon1EpQ19nRWFbDU7IniZmCMg6/75fdm27urqDV0l9iGJAnGh4Lc6cfreXJAMZ5PRtYjU/vqY/TY5McmiVEhrcG7rd/BEvBAWPBQTzGxOyiai/X3ZaVCubxCksGeK7wg0N0fdV5dzPwPLR26tXo6QKu/ORkANq4IgUQ1Otnr44btdKBx2otDOdf7t+UZMI6lwmd//lrtYVZZufbLDO9+bRJhXsi5YjHi4AKxRlWYcoa+I5Ffq6CPJpK1cLFp2YWRgzR/fyV2kv7DGlc3gECCWcHW4GgfhO8Y+Y5owA==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN1P110MB0706.NAMP110.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(71200400001)(54906003)(6512007)(83380400001)(38070700005)(76116006)(5660300002)(64756008)(110136005)(8936002)(66616009)(86362001)(66476007)(186003)(33656002)(26005)(38100700002)(508600001)(66946007)(8676002)(66556008)(75432002)(99936003)(966005)(2906002)(166002)(6506007)(4326008)(2616005)(122000001)(66446008)(15650500001)(53546011)(6486002)(11970500015)(45980500001); DIR:OUT; SFP:1102;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: ZPrRD/UzMzPp0fVB/xYC+DCsUIiUoQCyXXogCkxpcmLc7ApVcruxh+ekBK0zeLHBfwCVPOnQ1gDU2OAVb1WfjI8S07HOUSCWBukbtKAOaxX+jS6o0DKOJpR65k4KKn0LHtUuUbFW83NX8R6BwhPnxJKjJ2xOQQOB5ElQQAMzXzDVJY4yvrJEiPUpNmrrjt5roIQfH0RhAv8ZRcuGavI5W4bwIxj6xFT6Qoxv3KRhkhS/sAKEeA6LAgmk/XZ9iufmS9HjZVOtmFwx2zH4J43giSjGt3VnEnJrQrEvugCrD4nARrOiZ1m+vZGQpoEjdUdiSYjVDEBsfqRWJFvVGKH5GYgRvQVmpOptpUw23rETYOkWSsxjjxjxP9qHfWRkBHjJwjXywSG3cgpBbSqOT2qVP/EeBLOCfom8se5Tg5S17MS+rRdoItjbmiC603wLoHBbbYWZrQ2oXHuRpV7IlIu7swjawcPTdTr8JfsJAiZOFppcp+MyRK0Yy9D029oLO1S5MfTLnQLzL7BCN5lzn0xMpHyiQgRiqz6hp4ul87NaJubtI8dZkATiIjB36LJCm4/xVLXB8JAbwjp9sVCsYY0RQeou/vRNn9ocx89oGkkQgOOjfL1EckyP34kbbKIGiWHJJj+cpZES8aFTkmaHeUZOqgDaWfmirIC99zHkyLpJaD7HR0EBMGnOpN2xIMt45xTV4V3Mi8znRg3PTIr1TuhwKw==
x-ms-exchange-transport-forked: True
Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg="sha256"; boundary="B_3713258275_264195277"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: BN1P110MB0706.NAMP110.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: 66fa6ccf-bdf8-47ed-c70b-08d96c9dafa8
X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Aug 2021 16:37:56.0775 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 83d1efe3-698e-4819-911b-0a8fbe79d01c
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1P110MB0756
X-OriginatorOrg: ll.mit.edu
X-Proofpoint-GUID: D3ZVYMKvV-oU-bRvy5m86C7fcwR0Cz5q
X-Proofpoint-ORIG-GUID: D3ZVYMKvV-oU-bRvy5m86C7fcwR0Cz5q
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-31_07:2021-08-31, 2021-08-31 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108310089
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/4EYCtBed29YeL-sIcS9PAhoT5Oc>
Subject: Re: [lamps] [CMP Updates] position of hashAlg in certStatus
X-BeenThere: spasm@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "This is a venue for discussion of doing Some Pkix And SMime \(spasm\) work." <spasm.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/spasm>, <mailto:spasm-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/spasm/>
List-Post: <mailto:spasm@ietf.org>
List-Help: <mailto:spasm-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/spasm>, <mailto:spasm-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 31 Aug 2021 16:38:24 -0000

Hendrik:

 

John's proposal compiles.  Your new one does too.

 

I have a mild preference for John's proposal because the bit on the wire are the same as CMPv1 when the hashAlg field is absent.

 

For the sake of purity, I would prefer Hendrik’s variant. 

 

Also, I’m not sure it’s good if some of CMPv2 messages parse OK by CMPv1 decoder, and others fail. That’s another argument in favor of Hendrik’s.



On Aug 31, 2021, at 12:25 PM, Brockhaus, Hendrik <hendrik.brockhaus@siemens.com> wrote:

 

Russ

 

Thank you for this explanation.

 

Would this mean, that Johns proposal should look like this?
   CertStatus ::= SEQUENCE {
      certHash        OCTET STRING,
      certReqId       INTEGER,
      statusInfo [0]  PKIStatusInfo OPTIONAL,
      hashAlg    [1]  AlgorithmIdentifier OPTIONAL
   }
 

Do you have any preference for the current test or for Johns proposal?

 

- Hendrik

 

Gesendet: Dienstag, 31. August 2021 17:12
An: Brockhaus, Hendrik (T RDA CST SEA-DE) <hendrik.brockhaus@siemens.com>


 

Hendrik:

 

David's proposal will not compile.  The OSS compiler produces this error with that syntax:

 

   line 62 (TestModule): A0100E: Duplicate tag in type CertStatus: element 'statusInfo' (line 61) and element 'hashAlg' (line 62).

 

   C0043I: 1 error message, 0 warning messages and 0 informatory messages issued.

 

The reason for this error is that the two optional elements are both SEQUENCEs.  So, when decoding, if only one of the optional SEQUENCEs is present, it cannot figure out which one it is.

 

The use of the [0] allows the decoder to tell the two SEQUENCEs apart.

 

Russ

 

 




On Aug 31, 2021, at 8:21 AM, Brockhaus, Hendrik <hendrik.brockhaus@siemens.com> wrote:

 

Russ

 

Currently we receive valuable feedback from John Gray on the CMP Updates draft.

 

One proposal from John is on moving the hashAlg field in the certStatus sequence from the first to the last position. Please see his arguments in this email tread below.

 

Current syntax:
   CertStatus ::= SEQUENCE {
      hashAlg [0] AlgorithmIdentifier OPTIONAL
      certHash    OCTET STRING,
      certReqId   INTEGER,
      statusInfo  PKIStatusInfo OPTIONAL,
   }
 

Johns proposal:
   CertStatus ::= SEQUENCE {
      certHash    OCTET STRING,
      certReqId   INTEGER,
      statusInfo  PKIStatusInfo OPTIONAL,
      hashAlg [0] AlgorithmIdentifier OPTIONAL
   }
 

Davids proposal:
   CertStatus ::= SEQUENCE {
      certHash    OCTET STRING,
      certReqId   INTEGER,
      statusInfo  PKIStatusInfo OPTIONAL,
      hashAlg     AlgorithmIdentifier OPTIONAL
   }
 

We are uncertain what the best approach from an ASN.1 syntax parsing perspective is. What is your opinion?

 

Hendrik

 

 

Von: Brockhaus, Hendrik (T RDA CST SEA-DE) 
Gesendet: Dienstag, 31. August 2021 14:07
An: John Gray <John.Gray@entrust.com>



Von: David von Oheimb <David.von.Oheimb@siemens.com> 
Gesendet: Donnerstag, 26. August 2021 22:43
An: John Gray <John.Gray@entrust.com>



On 26.08.21 11:26, Brockhaus, Hendrik (T RDA CST SEA-DE) wrote:

 

Von: John Gray <John.Gray@entrust.com> 
Gesendet: Mittwoch, 25. August 2021 18:35
An: von Oheimb, David (T RDA CST SEA-DE) <david.von.oheimb@siemens.com>; Brockhaus, Hendrik (T RDA CST SEA-DE) <hendrik.brockhaus@siemens.com>
Cc: ietf-hendrikb@h.mailbouncer.info; Kretschmer, Andreas (T RDA CST SEA-DE) <andreas.kretschmer@siemens.com>
Betreff: RE: [EXTERNAL] Re: CMP Updates and Lightweight CMP Profile

 

Thanks for the updates.

 

I continued to review the document today as well.   Here are some more comments:

 

Section 2.10 -  CertStatus update.  I was wondering if adding the optional tagged element as the last element *might* make a difference:

 

For now it is defined as:

 

Replace the ASN.1 Syntax of CertStatus with the following text:

 

      CertStatus ::= SEQUENCE {

         hashAlg [0] AlgorithmIdentifier OPTIONAL,

         certHash    OCTET STRING,

         certReqId   INTEGER,

         statusInfo  PKIStatusInfo OPTIONAL

      }

 

 

I would have expected that adding something new would be added like this:

 
Replace the ASN.1 Syntax of CertStatus with the following text:
 
      CertStatus ::= SEQUENCE {
         certHash    OCTET STRING,
         certReqId   INTEGER,
         statusInfo  PKIStatusInfo OPTIONAL,
         hashAlg [0] AlgorithmIdentifier OPTIONAL
      }
 

If a CMPv2 server received the hashAlg as the last element, it might still work, but would fail in the first case.   However, I know you say if the hashAlg is included then it must use the pvno of version 3, so the order doesn’t really matter.   I just thought that for someone implementing it, it might be a bit easier to check if the tag exists after the existing parsing (at the end), rather than checking if it exists on the first element.  It would mean no parsing logic has to change until it reaches the last element.   However, I suppose the counter argument would be that if hashAlg is included first, but it isn’t supported then an older server would fail faster which is probably a desirable property.       

 

[Bro] This is a interesting point we also thought about. Here are some thoughts we had.

First of all, we think the binary ASN.1 of a certConf message produced by a client only knowing the original cmp2000 without hashAlg does not differ between from a client knowing the hashAlg field, but not using it. 
This should be the case when placing the hashAlg field at the first as well as at the last position of the sequence.

Second, we took the OOBCertHash type as an example and therefore decided for placing the hashAlg field also at the first position.

        OOBCertHash ::= SEQUENCE {

            hashAlg     [0] AlgorithmIdentifier     OPTIONAL,

            certId      [1] CertId                  OPTIONAL,

            hashVal         BIT STRING

        }

Third, the hash algorithm OID is required before calculating the hash value. Therefore, it is the logical order to have hashAlg first.

Theses were the thoughts we had for placing hashAlg in the first position, but they are no strict reasons to do it this way round. 
I cannot say, if your arguments still hold true from an implementation perspective. @David, maybe you can comment on the more implementation related issues.

I am not an ASN.1 expert, but as far as I understand from using its OpenSSL implementation, it should not make much difference whether to fail earlier or later in case the bits do not fit with the expected structure.
At least for the CMP implementation, which simply uses the ASN.1 parser, there would be no noticeable difference since either the parsing of the whole structure (including its total sequence length) succeeds or not.
If a receiver expects a structure encoded as in CMPv2 but gets an encoding for CMPv3, I think due to the presence of the "[0]" tag, parsing will fail even if the hashAlg fields is at the end with not value being present.
A backward-compatible definition might look like this:
      CertStatus ::= SEQUENCE {
         certHash    OCTET STRING,
         certReqId   INTEGER,
         statusInfo  PKIStatusInfo OPTIONAL,
         hashAlg     AlgorithmIdentifier OPTIONAL
      }
but supposedly we cannot do this because it would be ambiguous whether the optional statusInfo or hashAlg field is present.
To me, the main point is a conceptual one: the hashAlg needs to "seen" before the certHash, so it is logical to have them in this order.

[Bro] I am also no ASN.1 expert, but Russ is. Therefore, I will forward the question to him to get his advice. As statusInfo and hashAlg have different types, it may also work without tagging.

 

_______________________________________________
Spasm mailing list
Spasm@ietf.org
https://www.ietf.org/mailman/listinfo/spasm