From patchwork Thu Sep 21 13:06:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 724813 Delivered-To: patch@linaro.org Received: by 2002:adf:ea87:0:b0:31d:da82:a3b4 with SMTP id s7csp465755wrm; Thu, 21 Sep 2023 06:07:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFqcxHZ+jvkIXtSju0jUjOh/OXz9zhNPR+lG0e5gR8usAJHuAKyr/H9iMn0bJVYDAk//89 X-Received: by 2002:a17:906:738d:b0:99b:4668:865f with SMTP id f13-20020a170906738d00b0099b4668865fmr4715564ejl.10.1695301620811; Thu, 21 Sep 2023 06:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695301620; cv=none; d=google.com; s=arc-20160816; b=e62bA6v8Q7m1aleiMXFky/TIr5S/d62zIIpyM/5Ilgo7s9Gsknq0M3u3rnmRzwuvOR G0mu5Fip3IzaQwofesQ90YkSsJQMc7/VhdAZ4ZMvWaCaQq8SobpRtuGNSDHL+ZBZIsSK Rul8DTCwAYThrZS53RXURoyho5k9TuGtzdPankIXxtFMsgkbgAzGo4hu7+m/Pn5E8y0D O1MeI2Z5PHAmPN4lyvSKKlGO3oAAsklDPUb74zQaWOMTPtnGosmBVgDI/VCtN1bLOBSH /5tOgkN9x4Xfs2RhmRq7emxowW9RX2yf+jlMTihnK2jHDW1CTv8O0BQgp4RNjy1W0ysZ DMwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=utt+WLd/fdt8TisiItgdBgGDxhWwu+3pxrYYM0TGTi4=; fh=rJtIiWzkCr5V2GvQGQWdJX+wkLY3kEXmUtQZbZqt0f0=; b=onZRcmiqOZSMqDj0B8wneDpRygWg37i+CZD6GrRQ8XOPU17RjDgMsC4gOFtbDvvqDR WjTo3uBXEIeo2Pw85drjOOEMF8TV3vU9Pxz3aHjUP+4sd4kStsd8UIj2SjoVin+VvDDH gfZW3G4bVV0aVqEMKd6Wi+UyPZESHhPh0EShCPVYEsyao1A55/aEgsa9SbAZM6q2H5SO 0GvqirhTxovRTvRqmA+grrSXE5bjWbOdrMMi9XyaPLYLA98lhpd7t10UJtfw392S0l9g lbeFrqoGuOWWxrMV/POu1Q5tFPG7qe7rUHmqwbeyywge7es/CKU/yKRr8qX9tbESqn3R Gu5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nkq2NRzo; spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b20-20020a170906195400b00993211b85acsi1259628eje.216.2023.09.21.06.07.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 06:07:00 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nkq2NRzo; spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6BB31385B534 for ; Thu, 21 Sep 2023 13:06:59 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 34C4A3856DD6 for ; Thu, 21 Sep 2023 13:06:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 34C4A3856DD6 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-99357737980so114142266b.2 for ; Thu, 21 Sep 2023 06:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695301586; x=1695906386; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=utt+WLd/fdt8TisiItgdBgGDxhWwu+3pxrYYM0TGTi4=; b=Nkq2NRzo2nlXkCmWdBqsnwrtBkqXSI/EZvN9+2jDiAvdWYKWw2AOb+B230h6ivYz6N TUEyWvJdslNagTfFhUakkZ2nJsHejEKUylGxJnYXFVHIZZffE0G2IieVgc7O8t2OzI+b uftR5Y7Ydfpx2fe4Ze89n6x+QP8PhQKZdtRa5m9S3bWHKyNTxtLOIfkLX2x9qO59j7Rv YfABkn+8qBazMr7iZHMz9WLFZkUmlYqygVHWAVi8Ewy3yhCOrYqEBVDioWcmHknXO06U pb3y1N7eXIbdqTVOQ6+rLhVWVOcyQmoa6D3+15sbpWg6l9T+FcrtCyFb3QZ9ESmaDqBE eJrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695301586; x=1695906386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=utt+WLd/fdt8TisiItgdBgGDxhWwu+3pxrYYM0TGTi4=; b=fnjUY9Z7YaMW31FLgdoxZZgqztSHJChPgvjcdlaHrH+dnoR0fyha66JWUugKIlrEsR BuszSFM05YwbvfngQTCT7UIi3ChsNOOzMPuNAeIsRJrsPsr8baF5fTepzJASCtNA4PpD F1d8xm6DTtkiBhHCm/9ub8D0pueYVPPtN//hGIlpyXRxg2ibp4zQS8LlsB/sOv/12fU+ q+kDZSG/vIFnJiZjU3H+Z3rga2mnJd06ji4pDZyMq1vxvXCG8AKALQDW2KnMqX8lx7oh FolK9eT7tslQQEalr5oFXZt0udLgTc1O/1HzfEWf0tLQsRjwYgPCQiGkTAmXA7LBZvJq l2tQ== X-Gm-Message-State: AOJu0YxOUK9yPSRIvzcL30QZUnHWkc/T8+a8QX3iVaraRICERpsXm4mW VrRDbS6hQpjYwN7dIcg93Ys4ci4J86C4WfNx4kFizwYOaQM= X-Received: by 2002:a17:907:778c:b0:9a1:bd53:b23 with SMTP id ky12-20020a170907778c00b009a1bd530b23mr5036875ejc.14.1695301585697; Thu, 21 Sep 2023 06:06:25 -0700 (PDT) Received: from ubuntu-vm.. (static-212-193-78-212.thenetworkfactory.nl. [212.78.193.212]) by smtp.gmail.com with ESMTPSA id gx10-20020a170906f1ca00b0099cb349d570sm1024169ejb.185.2023.09.21.06.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 06:06:24 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Adhemerval Zanella Subject: [PATCH 1/2] sparc: Remove optimize md5, sha256, and sha512 Date: Thu, 21 Sep 2023 13:06:16 +0000 Message-Id: <20230921130617.468601-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230921130617.468601-1-adhemerval.zanella@linaro.org> References: <20230921130617.468601-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org The libcrypt was maked to be phase out on 2.38, and a better project already exist that provide both compatibility and better API (libxcrypt). The sparc optimizations add the burden to extra build-many-glibcs.py configurations. Checked on sparc64 and sparcv9. --- scripts/build-many-glibcs.py | 4 +- .../sparc/sparc32/sparcv9/multiarch/Makefile | 8 -- .../sparc32/sparcv9/multiarch/md5-block.c | 1 - .../sparc32/sparcv9/multiarch/md5-crop.S | 1 - .../sparc32/sparcv9/multiarch/sha256-block.c | 1 - .../sparc32/sparcv9/multiarch/sha256-crop.S | 1 - .../sparc32/sparcv9/multiarch/sha512-block.c | 1 - .../sparc32/sparcv9/multiarch/sha512-crop.S | 1 - sysdeps/sparc/sparc64/multiarch/Makefile | 8 -- sysdeps/sparc/sparc64/multiarch/md5-block.c | 29 ---- sysdeps/sparc/sparc64/multiarch/md5-crop.S | 109 --------------- .../sparc/sparc64/multiarch/sha256-block.c | 32 ----- sysdeps/sparc/sparc64/multiarch/sha256-crop.S | 100 -------------- .../sparc/sparc64/multiarch/sha512-block.c | 32 ----- sysdeps/sparc/sparc64/multiarch/sha512-crop.S | 130 ------------------ 15 files changed, 1 insertion(+), 457 deletions(-) delete mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/md5-block.c delete mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/md5-crop.S delete mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-block.c delete mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-crop.S delete mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-block.c delete mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-crop.S delete mode 100644 sysdeps/sparc/sparc64/multiarch/md5-block.c delete mode 100644 sysdeps/sparc/sparc64/multiarch/md5-crop.S delete mode 100644 sysdeps/sparc/sparc64/multiarch/sha256-block.c delete mode 100644 sysdeps/sparc/sparc64/multiarch/sha256-crop.S delete mode 100644 sysdeps/sparc/sparc64/multiarch/sha512-block.c delete mode 100644 sysdeps/sparc/sparc64/multiarch/sha512-crop.S diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py index 57a5c48b16..72c0aa6b8f 100755 --- a/scripts/build-many-glibcs.py +++ b/scripts/build-many-glibcs.py @@ -431,9 +431,7 @@ class Context(object): {'variant': 'disable-multi-arch', 'arch': 'sparcv9', 'ccopts': '-m32 -mlong-double-128 -mcpu=v9', - 'cfg': ['--disable-multi-arch']}, - {'variant': 'enable-crypt', - 'cfg': ['--enable-crypt']}]) + 'cfg': ['--disable-multi-arch']}]) self.add_config(arch='x86_64', os_name='linux-gnu', gcc_cfg=['--with-multilib-list=m64,m32,mx32'], diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile index a6d08f3a00..d35f95e8e2 100644 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile +++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile @@ -1,11 +1,3 @@ -ifeq ($(subdir),crypt) -libcrypt-sysdep_routines += md5-crop sha256-crop sha512-crop -endif - -ifeq ($(subdir),locale) -localedef-aux += md5-crop -endif - ifeq ($(subdir),string) sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \ memset-niagara1 memcpy-niagara4 memset-niagara4 \ diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/md5-block.c b/sysdeps/sparc/sparc32/sparcv9/multiarch/md5-block.c deleted file mode 100644 index 3765cabae7..0000000000 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/md5-block.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/md5-crop.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/md5-crop.S deleted file mode 100644 index 11a3a81482..0000000000 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/md5-crop.S +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-block.c b/sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-block.c deleted file mode 100644 index 600c602b61..0000000000 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-block.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-crop.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-crop.S deleted file mode 100644 index 4895405853..0000000000 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/sha256-crop.S +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-block.c b/sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-block.c deleted file mode 100644 index 7c7c54e5a6..0000000000 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-block.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-crop.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-crop.S deleted file mode 100644 index cc74a99d3c..0000000000 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/sha512-crop.S +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/sparc/sparc64/multiarch/Makefile b/sysdeps/sparc/sparc64/multiarch/Makefile index eaf758e7aa..5dcd7bbb0e 100644 --- a/sysdeps/sparc/sparc64/multiarch/Makefile +++ b/sysdeps/sparc/sparc64/multiarch/Makefile @@ -1,11 +1,3 @@ -ifeq ($(subdir),crypt) -libcrypt-sysdep_routines += md5-crop sha256-crop sha512-crop -endif - -ifeq ($(subdir),locale) -localedef-aux += md5-crop -endif - ifeq ($(subdir),string) sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \ memset-niagara1 memcpy-niagara4 memset-niagara4 \ diff --git a/sysdeps/sparc/sparc64/multiarch/md5-block.c b/sysdeps/sparc/sparc64/multiarch/md5-block.c deleted file mode 100644 index 7c1a3a368f..0000000000 --- a/sysdeps/sparc/sparc64/multiarch/md5-block.c +++ /dev/null @@ -1,29 +0,0 @@ -#include - -#define __md5_process_block __md5_process_block_generic -extern void __md5_process_block_generic (const void *buffer, size_t len, - struct md5_ctx *ctx); - -#include - -#undef __md5_process_block - -extern void __md5_process_block_crop (const void *buffer, size_t len, - struct md5_ctx *ctx); -static bool cpu_supports_md5(int hwcap) -{ - unsigned long cfr; - - if (!(hwcap & HWCAP_SPARC_CRYPTO)) - return false; - - __asm__ ("rd %%asr26, %0" : "=r" (cfr)); - if (cfr & (1 << 4)) - return true; - - return false; -} - -extern void __md5_process_block (const void *buffer, size_t len, - struct md5_ctx *ctx); -sparc_libc_ifunc(__md5_process_block, cpu_supports_md5(hwcap) ? __md5_process_block_crop : __md5_process_block_generic); diff --git a/sysdeps/sparc/sparc64/multiarch/md5-crop.S b/sysdeps/sparc/sparc64/multiarch/md5-crop.S deleted file mode 100644 index 53c27d677d..0000000000 --- a/sysdeps/sparc/sparc64/multiarch/md5-crop.S +++ /dev/null @@ -1,109 +0,0 @@ -/* MD5 using sparc crypto opcodes. - Copyright (C) 2012-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#define ASI_PL 0x88 - -#define MD5 \ - .word 0x81b02800; - - .text - .align 32 -ENTRY(__md5_process_block_crop) - /* %o0=buffer, %o1=len, %o2=CTX */ - ld [%o2 + 0x10], %g1 - add %g1, %o1, %o4 - st %o4, [%o2 + 0x10] - clr %o5 - cmp %o4, %g1 - movlu %icc, 1, %o5 -#ifdef __arch64__ - srlx %o1, 32, %o4 - add %o5, %o4, %o5 -#endif - ld [%o2 + 0x14], %o4 - add %o4, %o5, %o4 - st %o4, [%o2 + 0x14] - lda [%o2] ASI_PL, %f0 - add %o2, 0x4, %g1 - lda [%g1] ASI_PL, %f1 - add %o2, 0x8, %g1 - andcc %o0, 0x7, %g0 - lda [%g1] ASI_PL, %f2 - add %o2, 0xc, %g1 - bne,pn %xcc, 10f - lda [%g1] ASI_PL, %f3 - -1: - ldd [%o0 + 0x00], %f8 - ldd [%o0 + 0x08], %f10 - ldd [%o0 + 0x10], %f12 - ldd [%o0 + 0x18], %f14 - ldd [%o0 + 0x20], %f16 - ldd [%o0 + 0x28], %f18 - ldd [%o0 + 0x30], %f20 - ldd [%o0 + 0x38], %f22 - - MD5 - - subcc %o1, 64, %o1 - bne,pt %xcc, 1b - add %o0, 0x40, %o0 - -5: - sta %f0, [%o2] ASI_PL - add %o2, 0x4, %g1 - sta %f1, [%g1] ASI_PL - add %o2, 0x8, %g1 - sta %f2, [%g1] ASI_PL - add %o2, 0xc, %g1 - retl - sta %f3, [%g1] ASI_PL -10: - alignaddr %o0, %g0, %o0 - - ldd [%o0 + 0x00], %f10 -1: - ldd [%o0 + 0x08], %f12 - ldd [%o0 + 0x10], %f14 - ldd [%o0 + 0x18], %f16 - ldd [%o0 + 0x20], %f18 - ldd [%o0 + 0x28], %f20 - ldd [%o0 + 0x30], %f22 - ldd [%o0 + 0x38], %f24 - ldd [%o0 + 0x40], %f26 - - faligndata %f10, %f12, %f8 - faligndata %f12, %f14, %f10 - faligndata %f14, %f16, %f12 - faligndata %f16, %f18, %f14 - faligndata %f18, %f20, %f16 - faligndata %f20, %f22, %f18 - faligndata %f22, %f24, %f20 - faligndata %f24, %f26, %f22 - - MD5 - - subcc %o1, 64, %o1 - fsrc2 %f26, %f10 - bne,pt %xcc, 1b - add %o0, 0x40, %o0 - - ba,a,pt %xcc, 5b -END(__md5_process_block_crop) diff --git a/sysdeps/sparc/sparc64/multiarch/sha256-block.c b/sysdeps/sparc/sparc64/multiarch/sha256-block.c deleted file mode 100644 index 9d65315a5a..0000000000 --- a/sysdeps/sparc/sparc64/multiarch/sha256-block.c +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define __sha256_process_block __sha256_process_block_generic -extern void __sha256_process_block_generic (const void *buffer, size_t len, - struct sha256_ctx *ctx); - -#include - -#undef __sha256_process_block - -extern void __sha256_process_block_crop (const void *buffer, size_t len, - struct sha256_ctx *ctx); - -static bool cpu_supports_sha256(int hwcap) -{ - unsigned long cfr; - - if (!(hwcap & HWCAP_SPARC_CRYPTO)) - return false; - - __asm__ ("rd %%asr26, %0" : "=r" (cfr)); - if (cfr & (1 << 6)) - return true; - - return false; -} - -extern void __sha256_process_block (const void *buffer, size_t len, - struct sha256_ctx *ctx); -sparc_libc_ifunc (__sha256_process_block, - cpu_supports_sha256(hwcap) ? __sha256_process_block_crop - : __sha256_process_block_generic); diff --git a/sysdeps/sparc/sparc64/multiarch/sha256-crop.S b/sysdeps/sparc/sparc64/multiarch/sha256-crop.S deleted file mode 100644 index f7d0a7e7dc..0000000000 --- a/sysdeps/sparc/sparc64/multiarch/sha256-crop.S +++ /dev/null @@ -1,100 +0,0 @@ -/* SHA256 using sparc crypto opcodes. - Copyright (C) 2012-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#define SHA256 \ - .word 0x81b02840; - - .text - .align 32 -ENTRY(__sha256_process_block_crop) - /* %o0=buffer, %o1=len, %o2=CTX */ - ldx [%o2 + 0x20], %g1 - add %g1, %o1, %g1 - stx %g1, [%o2 + 0x20] - - ld [%o2 + 0x00], %f0 - ld [%o2 + 0x04], %f1 - ld [%o2 + 0x08], %f2 - ld [%o2 + 0x0c], %f3 - ld [%o2 + 0x10], %f4 - ld [%o2 + 0x14], %f5 - andcc %o1, 0x7, %g0 - ld [%o2 + 0x18], %f6 - bne,pn %xcc, 10f - ld [%o2 + 0x1c], %f7 - -1: - ldd [%o0 + 0x00], %f8 - ldd [%o0 + 0x08], %f10 - ldd [%o0 + 0x10], %f12 - ldd [%o0 + 0x18], %f14 - ldd [%o0 + 0x20], %f16 - ldd [%o0 + 0x28], %f18 - ldd [%o0 + 0x30], %f20 - ldd [%o0 + 0x38], %f22 - - SHA256 - - subcc %o1, 0x40, %o1 - bne,pt %xcc, 1b - add %o0, 0x40, %o0 - -5: - st %f0, [%o2 + 0x00] - st %f1, [%o2 + 0x04] - st %f2, [%o2 + 0x08] - st %f3, [%o2 + 0x0c] - st %f4, [%o2 + 0x10] - st %f5, [%o2 + 0x14] - st %f6, [%o2 + 0x18] - retl - st %f7, [%o2 + 0x1c] -10: - alignaddr %o0, %g0, %o0 - - ldd [%o0 + 0x00], %f10 -1: - ldd [%o0 + 0x08], %f12 - ldd [%o0 + 0x10], %f14 - ldd [%o0 + 0x18], %f16 - ldd [%o0 + 0x20], %f18 - ldd [%o0 + 0x28], %f20 - ldd [%o0 + 0x30], %f22 - ldd [%o0 + 0x38], %f24 - ldd [%o0 + 0x40], %f26 - - faligndata %f10, %f12, %f8 - faligndata %f12, %f14, %f10 - faligndata %f14, %f16, %f12 - faligndata %f16, %f18, %f14 - faligndata %f18, %f20, %f16 - faligndata %f20, %f22, %f18 - faligndata %f22, %f24, %f20 - faligndata %f24, %f26, %f22 - - SHA256 - - subcc %o1, 0x40, %o1 - fsrc2 %f26, %f10 - bne,pt %xcc, 1b - add %o0, 0x40, %o0 - - ba,a,pt %xcc, 5b -END(__sha256_process_block_crop) diff --git a/sysdeps/sparc/sparc64/multiarch/sha512-block.c b/sysdeps/sparc/sparc64/multiarch/sha512-block.c deleted file mode 100644 index 2863e05d09..0000000000 --- a/sysdeps/sparc/sparc64/multiarch/sha512-block.c +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define __sha512_process_block __sha512_process_block_generic -extern void __sha512_process_block_generic (const void *buffer, size_t len, - struct sha512_ctx *ctx); - -#include - -#undef __sha512_process_block - -extern void __sha512_process_block_crop (const void *buffer, size_t len, - struct sha512_ctx *ctx); - -static bool cpu_supports_sha512(int hwcap) -{ - unsigned long cfr; - - if (!(hwcap & HWCAP_SPARC_CRYPTO)) - return false; - - __asm__ ("rd %%asr26, %0" : "=r" (cfr)); - if (cfr & (1 << 6)) - return true; - - return false; -} - -extern void __sha512_process_block (const void *buffer, size_t len, - struct sha512_ctx *ctx); -sparc_libc_ifunc (__sha512_process_block, - cpu_supports_sha512(hwcap) ? __sha512_process_block_crop - : __sha512_process_block_generic); diff --git a/sysdeps/sparc/sparc64/multiarch/sha512-crop.S b/sysdeps/sparc/sparc64/multiarch/sha512-crop.S deleted file mode 100644 index 035f99f469..0000000000 --- a/sysdeps/sparc/sparc64/multiarch/sha512-crop.S +++ /dev/null @@ -1,130 +0,0 @@ -/* SHA512 using sparc crypto opcodes. - Copyright (C) 2012-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#define SHA512 \ - .word 0x81b02860; - - .text - .align 32 -ENTRY(__sha512_process_block_crop) - /* %o0=buffer, %o1=len, %o2=CTX */ - ldx [%o2 + 0x48], %g1 - add %g1, %o1, %o4 - stx %o4, [%o2 + 0x48] - cmp %o4, %g1 - bgeu,pt %xcc, 1f - nop - ldx [%o2 + 0x40], %g1 - add %g1, 1, %g1 - stx %g1, [%o2 + 0x40] - -1: ldd [%o2 + 0x00], %f0 - ldd [%o2 + 0x08], %f2 - ldd [%o2 + 0x10], %f4 - ldd [%o2 + 0x18], %f6 - ldd [%o2 + 0x20], %f8 - ldd [%o2 + 0x28], %f10 - andcc %o1, 0x7, %g0 - ldd [%o2 + 0x30], %f12 - bne,pn %xcc, 10f - ldd [%o2 + 0x38], %f14 - -1: - ldd [%o0 + 0x00], %f16 - ldd [%o0 + 0x08], %f18 - ldd [%o0 + 0x10], %f20 - ldd [%o0 + 0x18], %f22 - ldd [%o0 + 0x20], %f24 - ldd [%o0 + 0x28], %f26 - ldd [%o0 + 0x30], %f28 - ldd [%o0 + 0x38], %f30 - ldd [%o0 + 0x40], %f32 - ldd [%o0 + 0x48], %f34 - ldd [%o0 + 0x50], %f36 - ldd [%o0 + 0x58], %f38 - ldd [%o0 + 0x60], %f40 - ldd [%o0 + 0x68], %f42 - ldd [%o0 + 0x70], %f44 - ldd [%o0 + 0x78], %f46 - - SHA512 - - subcc %o1, 0x80, %o1 - bne,pt %xcc, 1b - add %o0, 0x80, %o0 - -5: - std %f0, [%o2 + 0x00] - std %f2, [%o2 + 0x08] - std %f4, [%o2 + 0x10] - std %f6, [%o2 + 0x18] - std %f8, [%o2 + 0x20] - std %f10, [%o2 + 0x28] - std %f12, [%o2 + 0x30] - retl - std %f14, [%o2 + 0x38] -10: - alignaddr %o0, %g0, %o0 - - ldd [%o0 + 0x00], %f18 -1: - ldd [%o0 + 0x08], %f20 - ldd [%o0 + 0x10], %f22 - ldd [%o0 + 0x18], %f24 - ldd [%o0 + 0x20], %f26 - ldd [%o0 + 0x28], %f28 - ldd [%o0 + 0x30], %f30 - ldd [%o0 + 0x38], %f32 - ldd [%o0 + 0x40], %f34 - ldd [%o0 + 0x48], %f36 - ldd [%o0 + 0x50], %f38 - ldd [%o0 + 0x58], %f40 - ldd [%o0 + 0x60], %f42 - ldd [%o0 + 0x68], %f44 - ldd [%o0 + 0x70], %f46 - ldd [%o0 + 0x78], %f48 - ldd [%o0 + 0x80], %f50 - - faligndata %f18, %f20, %f16 - faligndata %f20, %f22, %f18 - faligndata %f22, %f24, %f20 - faligndata %f24, %f26, %f22 - faligndata %f26, %f28, %f24 - faligndata %f28, %f30, %f26 - faligndata %f30, %f32, %f28 - faligndata %f32, %f34, %f30 - faligndata %f34, %f36, %f32 - faligndata %f36, %f38, %f34 - faligndata %f38, %f40, %f36 - faligndata %f40, %f42, %f38 - faligndata %f42, %f44, %f40 - faligndata %f44, %f46, %f42 - faligndata %f46, %f48, %f44 - faligndata %f48, %f50, %f46 - - SHA512 - - subcc %o1, 0x80, %o1 - fsrc2 %f50, %f18 - bne,pt %xcc, 1b - add %o0, 0x80, %o0 - - ba,a,pt %xcc, 5b -END(__sha512_process_block_crop)