Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp95304lqp; Mon, 10 Jun 2024 20:14:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXXK7OEOpZeZmXm4WALz0AcnU6yPc8UlTYyUyh36Jn6AA67NFQG2uR66yopa127ROW9wbiqdBnfTpaWG+gsst52CiwvkGkTtczO6YKfA== X-Google-Smtp-Source: AGHT+IGNNsLttnqG0AO/PDwzum8MPwt8TxdqaGqNfVHLEM52y1tkPuqgb3mfbNJSolZNM+zX05Xp X-Received: by 2002:a05:6214:53c7:b0:6b0:65dd:4b7e with SMTP id 6a1803df08f44-6b065dd4cc2mr103745846d6.42.1718075655999; Mon, 10 Jun 2024 20:14:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718075655; cv=pass; d=google.com; s=arc-20160816; b=RRUC2yH2GGgDVwTw98jQWI3TFbVRsaC2TrGxRDrzJrJISiAVlY6CP4WVhecwi4xnjh irkc9Jzxl4y5lRKfUxPXSYfe91QnMoG+Vg5es0te4alZ7IbBoinn9+ZqX7Ruy7cE3RXT 99yNo9rlnLJV+gePvzepEm/ztTbZgwRJpDL3q0ptA3Falnp6rWvpllfdHlqTAGczl0Pr WKNrFe36iSWqGuh4F8uihO+rUcLIM8oT6ZzZeXKKaKk/da0K+s1UQ6ImvSmOkz7w21XL BiBfnUWYDEnbjn0zKjvW1h3jXXQh4ytZ/c6HLwefmwxR6D4I/Pl8bnG1zhjO2hM/KSTK sn7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OjrGI1JPVenYYCdkyhoZ3An74Jqsl54RUqVivDKQ140=; fh=7F9uEzyGFDXVngr97EAQtjgo9Q8P0xJdH8kXHjj5EcQ=; b=TqntdHk1yIoMS83tl4Ik6AWTBLv7tht/a23y3WPHQdfSbVfm80ZRo2rIHN1Zd0Fu6d R4hUGwpcDXeYfgVRMt/YOVVvBMZv6aRLEH2sx+oBjdM4ciuVSwuP0FqJvC58MDXnZ5Rx y2nWEQ7cvA6Tjh+7HBJIl0yjgXQX7IXBb/5jOtbzl4dCMV0nZ5/DlWsLQRh4A0LLAaX4 Ug3Fh/O742R0ul+l2+fphv5OZNSgKbsBmz8am4ue2kGXgyRW0AzLgolhHo5lvP8YGJga nyvtaLcm+5xDW5I+8ORI/T8jv4WJPSJfWPKafIPtwAUkifFwEU53WsWV+WxaYSZ0Vdzq vjlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NLzAwj3Q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4872-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4872-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6b08c5b34f2si6627676d6.575.2024.06.10.20.14.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 20:14:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4872-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NLzAwj3Q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4872-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4872-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B2D671C21AD2 for ; Tue, 11 Jun 2024 03:14:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 38BE516F8F3; Tue, 11 Jun 2024 03:14:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NLzAwj3Q" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E80C07E782; Tue, 11 Jun 2024 03:14:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718075651; cv=none; b=H1nj6ApWCFSS6+zejrtfCqxvATq3eA1pwCdiQRLJpL8CJLff9nk44NsNrRqCWp9LGJ0NF9xvDqN+bEaPKVonw+LTTkrTqPMJHK4OEBx33RDC98PH9Wcf4RjSqiMfUh8ERSi0zzfuaF0BEDUwLyDOc3DeS5APmF89m2w/b9QQbZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718075651; c=relaxed/simple; bh=mbLv1uH2SZYJsLfBUYXgs87kE41hXHw1r1WdE9F1N8c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=L8bYz5neY6AouKLaA51eG4ECbpxKUxXfbk0FL+5IbXl8SUu41uDrnwU77d2c8J+CkVk9rNNzgpaTPgvgUrSYjSbuxQXbu8u/tk3s/EzHkN8WthAci0B4iq5DhZxv5TNsuAN8dsmyJYZTIHIoDicZmto7hEZG08DOcEXMQQbAztk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NLzAwj3Q; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE838C2BBFC; Tue, 11 Jun 2024 03:14:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718075650; bh=mbLv1uH2SZYJsLfBUYXgs87kE41hXHw1r1WdE9F1N8c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NLzAwj3Q7cuqOrIBmQCoD309Oia4DvkXjzRhFz6WEvf2FFKM2GNjA/mb1UBMH02B1 xH+lTl2C2R6KuTB0CidmE/RB0/eDRIfsZqwPmyQ4GDiWW4AD2CcZYPcqE+qmIghEns 7wP1bTRbGiDy/rzyBpadzaF6EioxRsRNruXdMWgoFF0DfWWsvFIyoTkBUwK9zAI8gt 1PH2Q7xMGt/Q5MziAJHxjxLEzy8ElPCi/FvSCK3bp/MH7qxX+sWnciFZlWSwEnPQ3w 3Q32bWqqNqcIEWwVJN9pcteBwpJ3SWrpXhnMOnobkgjIrKt9SAXUtfLDgzTGr5pOwr //9KmDYX2vrDA== Date: Mon, 10 Jun 2024 20:14:08 -0700 From: Eric Biggers To: kamlesh@ti.com Cc: herbert@gondor.apana.org.au, kristo@kernel.org, will@kernel.org, akpm@linux-foundation.org, davem@davemloft.net, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, vigneshr@ti.com, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: Re: [PATCH v3 1/6] lib: add ISO 3309 model crc64 Message-ID: <20240611031408.GB2557@sol.localdomain> References: <20240524-mcrc64-upstream-v3-0-24b94d8e8578@ti.com> <20240524-mcrc64-upstream-v3-1-24b94d8e8578@ti.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240524-mcrc64-upstream-v3-1-24b94d8e8578@ti.com> On Thu, May 30, 2024 at 05:54:23PM +0530, kamlesh@ti.com wrote: > diff --git a/lib/crc64.c b/lib/crc64.c > index 61ae8dfb6a1c..40369dd26812 100644 > --- a/lib/crc64.c > +++ b/lib/crc64.c > @@ -22,6 +22,11 @@ > * x^24 + x^23 + x^22 + x^21 + x^19 + x^17 + x^13 + x^12 + x^10 + x^9 + > * x^7 + x^4 + x + 1 > * > + * crc64iso3309table[256] table is from the ISO-3309:1991 specification > + * polynomial defined as, > + * > + * x^64 + x^4 + x^3 + x + 1 > + * > * crc64rocksoft[256] table is from the Rocksoft specification polynomial > * defined as, > * > @@ -63,6 +68,28 @@ u64 __pure crc64_be(u64 crc, const void *p, size_t len) > } > EXPORT_SYMBOL_GPL(crc64_be); > > +/** > + * crc64_iso3309_generic - Calculate bitwise ISO3309 CRC64 > + * @crc: seed value for computation. 0 for a new CRC calculation, or the > + * previous crc64 value if computing incrementally. > + * @p: pointer to buffer over which CRC64 is run > + * @len: length of buffer @p > + */ > +u64 __pure crc64_iso3309_generic(u64 crc, const void *p, size_t len) > +{ > + size_t i, t; > + > + const unsigned char *_p = p; > + > + for (i = 0; i < len; i++) { > + t = ((crc >> 56) ^ (*_p++)) & 0xFF; > + crc = crc64iso3309table[t] ^ (crc << 8); > + } > + > + return crc; > +} > +EXPORT_SYMBOL_GPL(crc64_iso3309_generic); Putting this in lib/ seems premature, given that this is only used by crypto/crc64_iso3309_generic.c. - Eric