From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-in5.apple.com (mail-out5.apple.com [17.151.62.27]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3C88C1A1DEC for ; Tue, 30 Aug 2016 07:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1472566193; x=2336479793; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-transfer-encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MON2esRO8+A0hnFaKdDjEMfZBwOm2C8gLp3BwAjODF0=; b=BAZGCOeV15Af6z/IzHMCLwsuloKqFh+XO+tZYM25QFxppufhSLq4CeY9907E6Fih hXOf4SRR/6MaVEIrLuv6twwfgAegUp1gWjoHr99eRN8ZL1sUsmY2LWCNaPiD+c7p ilXTIsgG6vfuIKQ/8kXBUeDudnrC/nTiBGiwOwvZrYCa7XcJf04Ak7xXGpZU1Wwt Zh+CFscW4OAMK3UK0l4R1nGVQ1W6GutDRMic3DHYne/bKi9Od5ZAGcnk5UczTLKf Y57jd/qmNv7b4vy6pm+wNchDdOVDHWr8AacOGQHOvtq/oMt2gSn9lnvQo15gT15A lh48abTWCfj9qy1CpuYH4w==; Received: from relay6.apple.com (relay6.apple.com [17.128.113.90]) by mail-in5.apple.com (Apple Secure Mail Relay) with SMTP id 53.17.07273.1B395C75; Tue, 30 Aug 2016 07:09:53 -0700 (PDT) X-AuditID: 11973e13-f794a6d000001c69-10-57c593b1f503 Received: from nwk-mmpp-sz13.apple.com (nwk-mmpp-sz13.apple.com [17.128.115.216]) by relay6.apple.com (Apple SCV relay) with SMTP id 6A.3A.04954.1B395C75; Tue, 30 Aug 2016 07:09:53 -0700 (PDT) MIME-version: 1.0 Received: from [17.153.31.137] by nwk-mmpp-sz13.apple.com (Oracle Communications Messaging Server 8.0.1.1.0 64bit (built Jun 15 2016)) with ESMTPSA id <0OCQ00AZD7CG5R10@nwk-mmpp-sz13.apple.com>; Tue, 30 Aug 2016 07:09:53 -0700 (PDT) Sender: afish@apple.com From: Andrew Fish In-reply-to: Date: Tue, 30 Aug 2016 07:09:53 -0700 Cc: Michael Zimmermann , edk2-devel Message-id: <91B24DF7-4F53-4DEF-A600-755A69368B79@apple.com> References: To: valerij zaporogeci X-Mailer: Apple Mail (2.3112) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsUi2FAYpbtx8tFwg5/blS32HDrKbDF36lNW i8f/2pkdmD12zrrL7tE9+x9LAFMUl01Kak5mWWqRvl0CV8bGuYEFB6Uqjt5fy9bAeFO0i5GT Q0LAROL6lbXsELaYxIV769m6GLk4hAT2Mko8nziVDaZowfJbTBCJQ4wSdzregHXwCghK/Jh8 j6WLkYODWUBe4uB5WZAws4CWxPdHrSwQ9e8YJVZuWwNWLywgLvHuzCZmCFtS4vr1WWBxNgFl iRXzP4DZnALBEsd/HAarYRFQlTh+9REzxPxIifZ1KhBrbSTWfrjJCDH/AaPEpqVPwOpFBHQk Dt6/yAxxtKzEvg0LoB7Ywiax6IT+BEaRWUjOnoVw9iwkZy9gZF7FKJSbmJmjm5lnqpdYUJCT qpecn7uJERT40+2EdzCeXmV1iFGAg1GJh9fC6Ui4EGtiWXFl7iFGaQ4WJXHejVuAQgLpiSWp 2ampBalF8UWlOanFhxiZODilGhg3ck2Vylm78vj7CJmYnufXLz+ra80KTptYVn3PpOESh2Hj scL9yTmi1znc2sWCuia3z1joGr53l9Vrlx8HPzYybTQO3mvHud3gRWBu/aNHKi9VH01YGrNc Kedcw0TGu9ePXmI5sUqeIWfHsTDp3Xyzn9zfGNJjNJ9TbJ/5qqj0eYsvTUtQeN6oxFKckWio xVxUnAgAL+N6G10CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjkeLIzCtJLcpLzFFi42IRbCi+obtx8tFwg93/ZC32HDrKbDF36lNW i8f/2pkdmD12zrrL7tE9+x9LAFMUl01Kak5mWWqRvl0CV8bGuYEFB6Uqjt5fy9bAeFO0i5GT Q0LARGLB8ltMELaYxIV769m6GLk4hAQOMUrc6XjDDpLgFRCU+DH5HksXIwcHs4C8xMHzsiBh ZgEtie+PWlkg6t8xSqzctgasXlhAXOLdmU3MELakxPXrs8DibALKEivmfwCzOQWCJY7/OAxW wyKgKnH86iNmiPmREu3rVCDW2kis/XCTEWL+A0aJTUufgNWLCOhIHLx/kRniaFmJfRsWsE1g FJyF5NRZCKfOQnLqAkbmVYwCRak5iZVmeokFBTmpesn5uZsYwaFaGLWDsWG51SFGAQ5GJR7e CS5HwoVYE8uKK3OBYcHBrCTCu3DS0XAh3pTEyqrUovz4otKc1OJDjMlA909klhJNzgfGUV5J vKGJiYGJsbGZsbG5iTlpwkrivD/eA20VSE8sSc1OTS1ILYLZwsTBKdXAKL9LMUtlX+nqLYvD /dw3Xf9QcUWs0/ySX9GFrOwrRzpWnmRxTzv8WbvyXSqjYe3nB6fz8362PlVbs85724WI7b++ md+4NrGeeVptyCR5uyOZQRMu1AhMFN+z9rG83JtMt1/OHA5XHxV2yVxfatDEwpU2vWVrTgRP 5UzP5TNfX/pw4NVSk9qnd5VYijMSDbWYi4oTAQua40CZAgAA Subject: Re: Crc32 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2016 14:09:54 -0000 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII > On Aug 30, 2016, at 6:32 AM, valerij zaporogeci wrote: > > Thank you. > But the polynomial value for CCITT crc32 is 104c11db7, not its tail 04c11db7. The spec does not say it is a CCITT, it states it uses the CCITT algorithm with a seed polynomial of 0x04c11db7. > And this whole mess with all those online calculators was the exact > reson I asked here. Because they mostly give WRONG result. As your > example. It's easy to check it's wrong. Because for example leading > zeroes in the message MUST not change the Crc32. > Here we have: > for 01 -> CD39D477 > for 00 01 -> D71E16AC > and so on. > Also, it's obvious that Crc32(1) would be a polynomial without the > most significant non-zero bit, thus crc32 from 1 by the polynomial > 104c11db7 would be 04c11b7. > The only online calculator so far giving right results is here: > https://ghsi.de/CRC/index.php?Polynom=100000100110000010001110110110111&Message=0104c11db7 > > I wrote function following the mathematics of the Crc and it gives > results exactly like in the above calculator. > It's fun to imagine what happens with such an incompatibilty for > example in case of GPT header. > As far as I can tell this is used in a lot of real world things: HDLC, ANSI X3.66, ITU-T V.42, Ethernet, Serial ATA, MPEG-2, PKZIP, Gzip, Bzip2, PNG,[36] many others[1] I think Ken added this to the spec in the last millennium. Ken's background was networking and Windows X86 HAL so I'm assuming he picked the same CRC as Ethernet? It is always possible we could have botched the math some place along the way and not noticed as we are self consistent so everything appears to work. Thanks, Andrew Fish [1] https://en.wikipedia.org/wiki/Cyclic_redundancy_check > 2016-08-30 14:08 GMT+03:00, Michael Zimmermann : >> well as u already said, the spec says it uses 'a standard CCITT32 CRC >> algorithm with a seed polynomial value of 0x04c11db7' >> >> this is the implementation which confirms it: >> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/RuntimeDxe/Crc32.c >> >> after testing it it indeed produces CCITT32 results like this online >> generator: >> http://g6auc.me.uk/CRC32/index.html >> >> Thanks >> Michael >> >> On Tue, Aug 30, 2016 at 2:54 AM, valerij zaporogeci >> wrote: >> >>> Hi, all. >>> Yet another dumb question from me. >>> UEFI specification has Crc32 calculation service and uses Crc32 in >>> several places. but it only humbly mentions in the note somewhere in >>> the description of System Table about what exact one it wants. Namely >>> it states that the polynomial seed is 04c11db7. And that's all. >>> My question is - does really the specification means the 33-bit >>> polynomial >>> 104c11db7? And is the algorithm just a plain remainder calculation >>> without any additional pre/post processing of it? So that for example >>> Crc32 of the 4-byte sequence b16b00b5 would be >>> 8c1f0a7c? >>> Thank you. >>> _______________________________________________ >>> edk2-devel mailing list >>> edk2-devel@lists.01.org >>> https://lists.01.org/mailman/listinfo/edk2-devel >>> >> > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel