From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emagii.se (www.emagii.com [185.133.207.17]) by sourceware.org (Postfix) with ESMTPS id 20B663858D33 for ; Thu, 16 Feb 2023 20:40:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 20B663858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=emagii.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=emagii.com Received: from valinor.ownit.se (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id 51A9F1201F5; Thu, 16 Feb 2023 21:40:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emagii.com; s=default; t=1676580010; bh=T2U3kOkP6/GotN6fGuytfSBYPcqURjxh+6pt1hSAlI8=; h=From:To:Subject; b=0h3en175nDIM+ocN06/umAsgcntDCgWA/DpI5469DES5gBC2a2KvAGnhCq1yyyzsS Zfzj9V/C198vuf5htxZyueqTbVQdWP1CInrrZGyuTPJkcMefdERu8SwJ1FUQJBGbDd lZC8Wk/+/+MWXgvxFPKT3ZO3YZbasW2nzKHaQGmk= Authentication-Results: emagii.beebytevps.io; spf=pass (sender IP is 84.55.68.216) smtp.mailfrom=binutils@emagii.com smtp.helo=valinor.ownit.se Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) From: binutils@emagii.com To: binutils@sourceware.org Cc: nickc@redhat.com, Ulf Samuelsson Subject: [PATCH v0 1/6] CRC64 header Date: Thu, 16 Feb 2023 21:40:01 +0100 Message-Id: <20230216204006.1977-2-binutils@emagii.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230216204006.1977-1-binutils@emagii.com> References: <20230216204006.1977-1-binutils@emagii.com> X-PPP-Message-ID: <167658001059.3912005.16846190151205862828@localhost.localdomain> X-PPP-Vhost: emagii.com X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_FAIL,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Ulf Samuelsson Signed-off-by: Ulf Samuelsson --- ld/checksum.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 ld/checksum.h diff --git a/ld/checksum.h b/ld/checksum.h new file mode 100755 index 00000000000..49a2aedd04b --- /dev/null +++ b/ld/checksum.h @@ -0,0 +1,48 @@ +/* + * Library: libcrc + * Author: Lammert Bies + * + * This file is licensed under the MIT License as stated below + * + * Copyright (c) 2016 Lammert Bies + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef CHECKSUM_H +#define CHECKSUM_H + +#include +#include + +#define CRC_POLY_64 0x42F0E1EBA9EA3693ull +#define CRC_POLY_64_ISO 0xD800000000000000ull + +#define CRC_START_64 0x0000000000000000ull +#define CRC_START_64_INV 0xFFFFFFFFFFFFFFFFull + +#define CRC_ADDRESS "___CRC64___" +#define CRC_START "___CRC64_START___" +#define CRC_END "___CRC64_END___" + +bfd_vma crc_64 (const unsigned char *input_str, size_t num_bytes); +bfd_vma crc_64_inv(const unsigned char *input_str, size_t num_bytes); + +#endif /* CHECKSUM_H */ -- 2.17.1