# # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2013 Saso Kiselkov. All rights reserved. # include $(SRC)/lib/Makefile.lib # Hammerhead: SPARC CAPDIR removed - amd64 only SUBDIRS = $(MACH64) HDRS = md4.h md5.h sha1.h sha2.h skein.h HDRDIR = common all : TARGET= all clean : TARGET= clean clobber : TARGET= clobber install : TARGET= install .KEEP_STATE: .PARALLEL: $(SUBDIRS) all clean clobber install: \ $(CAPDIR) .WAIT $(SUBDIRS) install_h: $(ROOTHDRS) check: $(CHECKHDRS) $(CAPDIR) \ $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) FRC: include $(SRC)/lib/Makefile.targ # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2013 Saso Kiselkov. All rights reserved. # Copyright (c) 2018, Joyent, Inc. # LIBS = $(DYNLIB) SRCS = $(COMDIR)/edonr/edonr.c \ $(COMDIR)/md4/md4.c \ $(COMDIR)/md5/md5.c \ $(COMDIR)/sha1/sha1.c \ $(COMDIR)/sha2/sha2.c \ $(COMDIR)/skein/skein.c \ $(COMDIR)/skein/skein_block.c \ $(COMDIR)/skein/skein_iv.c COMDIR = $(SRC)/common/crypto SRCDIR = ../common MAPFILEDIR = $(SRCDIR) CFLAGS += $(CCVERBOSE) # Hammerhead: Add uts/common for sys/sha1_consts.h and sys/sha2_consts.h CPPFLAGS += -I$(SRCDIR) -I$(SRC)/uts/common LDLIBS += -lc # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2013 Saso Kiselkov. All rights reserved. # Copyright 2019 Peter Tribble. # COMDIR = $(SRC)/common/crypto pics/%.o: $(COMDIR)/edonr/%.c $(COMPILE.c) -I$(COMDIR)/edonr -o $@ $< $(POST_PROCESS_O) pics/%.o: $(COMDIR)/md4/%.c $(COMPILE.c) -I$(COMDIR)/md4 -o $@ $< $(POST_PROCESS_O) pics/%.o: $(COMDIR)/md5/%.c $(COMPILE.c) -I$(COMDIR)/md5 -o $@ $< $(POST_PROCESS_O) pics/%.o: $(COMDIR)/sha1/%.c $(COMPILE.c) -I$(COMDIR)/sha1 -o $@ $< $(POST_PROCESS_O) pics/sha1_asm.o: $(COMDIR)/sha1/sparc/$(PLATFORM)/sha1_asm.s $(COMPILE.s) -o pics/sha1_asm.o \ $(COMDIR)/sha1/sparc/$(PLATFORM)/sha1_asm.s $(POST_PROCESS_S_O) pics/%.o: $(COMDIR)/sha2/%.c $(COMPILE.c) -I$(COMDIR)/sha2 -o $@ $< $(POST_PROCESS_O) pics/%.o: $(COMDIR)/skein/%.c $(COMPILE.c) -I$(COMDIR)/skein -o $@ $< $(POST_PROCESS_O) include $(SRC)/lib/Makefile.targ # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2013 Saso Kiselkov. All rights reserved. # LIBRARY = libmd.a VERS = .1 OBJECTS = edonr.o md4.o md5.o sha1.o sha2.o \ skein.o skein_block.o skein_iv.o include $(SRC)/lib/Makefile.lib include $(SRC)/lib/Makefile.rootfs include $(SRC)/lib/Makefile.lib.64 include ../Makefile.com # Hammerhead: Disable symbol capabilities (requires illumos ld -z symbolcap) # Using generic x86_64 implementations only - no SHA-NI hardware acceleration # TODO: Consider adding GNU ifunc support for CPU feature dispatch #CAPFILES = pics/sha1-ni.o \ # pics/sha256-ni.o EXTPICS = pics/md5_amd64.o \ pics/sha512-x86_64.o \ pics/sha256-x86_64.o \ pics/sha1-x86_64.o CLEANFILES += $(EXTPICS) \ $(EXTPICS:pics/%.o=%.S) \ $(EXTPICS:pics/%.o=%.s) pics/sha1-ni.o.objcap : CAPFILE = capabilities/sha.cap pics/sha256-ni.o.objcap : CAPFILE = capabilities/sha.cap # This prevents from including C source: AS_CPPFLAGS += -D_ASM .KEPP_STATE: all: $(LIBS) install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTCOMPATLINKS64) pics/%.o: %.s $(COMPILE.s) -o $@ ${@F:.o=.s} $(POST_PROCESS_O) pics/%.o: %.S $(COMPILE.s) -o $@ ${@F:.o=.S} $(POST_PROCESS_O) pics/%.o: $(SRC)/common/crypto/sha1/amd64/%.S $(COMPILE.s) -o $@ $< $(POST_PROCESS_O) pics/%.o: $(SRC)/common/crypto/sha2/amd64/%.S $(COMPILE.s) -o $@ $< $(POST_PROCESS_O) pics/%.o.objcap: pics/%.o $(LD) -r -o $@ -Wl,-M$(CAPFILE) $(BREDUCE) $< $(POST_PROCESS_O) pics/%.o.symcap: pics/%.o.objcap $(LD) -r -o $@ -z symbolcap $< md5_amd64.S: $(COMDIR)/md5/amd64/md5_amd64.pl $(PERL) $? $@ sha1-x86_64.S: $(COMDIR)/sha1/amd64/sha1-x86_64.pl $(PERL) $? $@ sha512-x86_64.S: $(COMDIR)/sha2/amd64/sha512-x86_64.pl $(PERL) $? $@ sha256-x86_64.S: $(COMDIR)/sha2/amd64/sha512-x86_64.pl $(PERL) $? $@ include ../Makefile.targ # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright 2018 Joyent, Inc. # $mapfile_version 2 CAPABILITY shani { MACHINE = i86pc; HW_1 = SSE2 SSSE3 SSE4.1; # # To avoid a chicken and egg problem with ld, we refer to the # SHA hardware cap value by its numeric value rather than the name. # This allows us to deal with the fact that we're almost # certainly building this on a system before the capability was # known. # HW_2 = 0x100000; }; # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # include $(SRC)/lib/Makefile.lib # Each target directory is responsible for making a symbol capabilities object. # Hammerhead: amd64 only - no SPARC subdirs SUBDIRS = all : TARGET= all clean : TARGET= clean clobber : TARGET= clobber install : TARGET= install .KEEP_STATE: .PARALLEL: $(SUBDIRS) all clean clobber install: \ $(SUBDIRS) $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) FRC: # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # #include ../../../Makefile.com MAPFILE-CAP = ../common/mapfile-cap MAPOPT-CAP = $(MAPFILE-CAP:%=-Wl,-M%) OBJCAP = pics/objcap.o SYMCAP = pics/symcap.o CLOBBERFILES += $(OBJCAP) $(SYMCAP) # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # # # libmd provides two families of optimized functions for SPARC platforms, # one for sun4u, and one for sun4v. Previous implementations provided # these families as libmd_psr.so.1 libraries, triggered by tagging libmd.so.1 # as an auxiliary filter. These psr filtees were installed under # /usr/platform/sun4u/lib, and numerous symlinks were established to provide # the necessary $PLATFORM names, ie: # # /usr/platform/SUNW,Ultra-2/lib/libmd_psr.so.1 -> ../../../sun4u # /usr/platform/SUNW,Ultra-4/lib/libmd_psr.so.1 -> ../../../sun4u # .... # # and: # # /usr/platform/SUNW,Netra-CP3060/lib/libmd_psr.so.1 -> ../../sun4v # /usr/platform/SUNW,Netra-CP3260/lib/libmd_psr.so.1 -> ../../sun4v/ # .... # # The objects that made up these filtees are now combined into one relocatable # object, pics/objcap.o, using ../common/mapfile-cap. This mapfile identifies # the machine hardware name, together with establishing the global symbols that # should be exported to define each family. # # This object capabilities relocatable object is then translated into a symbol # capabilities relocatable object, pics/symcap.o. # # The sun4u and sun4v families of symbol capabilities object are eventually # included in the final build of libmd.so.1. $(SYMCAP): $(OBJCAP) $(OBJCAP): $(PICS) $(PICS): pics # Combine all pic objects into one relocatable object. Assign any capabilities # to this object, and define the interface. pics/objcap.o: $(PICS) $(MAPFILE-CAP) $(LD) -r -o $@ $(MAPOPT-CAP) $(BREDUCE) $(PICS) # Convert the combined object capabilities object into a symbol capabilities # object. pics/symcap.o: $(OBJCAP) $(LD) -r -o $@ -z symbolcap $(OBJCAP) include ../../../Makefile.targ # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2013 Saso Kiselkov. All rights reserved. # Copyright (c) 2018, Joyent, Inc. # # # MAPFILE HEADER START # # WARNING: STOP NOW. DO NOT MODIFY THIS FILE. # Object versioning must comply with the rules detailed in # # usr/src/lib/README.mapfiles # # You should not be making modifications here until you've read the most current # copy of that file. If you need help, contact a gatekeeper for guidance. # # MAPFILE HEADER END # $mapfile_version 2 # Note: # # SHA256Update, SHA384Update, and SHA512Update are all # weak aliases for SHA2Update. # # SHA256Final, SHA384Final, and SHA512Final are all # weak aliases for SHA2Final # # We use NODYNSORT to keep the weak aliases out of the .SUNW_dymsymsort # ELF section. As a result, ld will put the two main symbols in. # SYMBOL_VERSION ILLUMOS_0.1 { global: Skein1024_Final; Skein1024_Final_Pad; Skein1024_Init; Skein1024_InitExt; Skein1024_Output; Skein1024_Update; Skein_256_Final; Skein_256_Final_Pad; Skein_256_Init; Skein_256_InitExt; Skein_256_Output; Skein_256_Update; Skein_512_Final; Skein_512_Final_Pad; Skein_512_Init; Skein_512_InitExt; Skein_512_Output; Skein_512_Update; EdonRFinal; EdonRHash; EdonRInit; EdonRUpdate; } SUNW_1.1; SYMBOL_VERSION SUNW_1.1 { global: MD4Final; MD4Init; MD4Update; md5_calc; MD5Final { FLAGS = NODIRECT; }; # Addr interpose from testsuite MD5Init { FLAGS = NODIRECT; }; # Addr interpose from testsuite MD5Update { FLAGS = NODIRECT; }; # Addr interpose from testsuite SHA1Final; SHA1Init; SHA1Update; SHA256Final { FLAGS = NODYNSORT; }; SHA256Init; SHA256Update { FLAGS = NODYNSORT; }; SHA2Final; SHA2Init; SHA2Update; SHA384Final { FLAGS = NODYNSORT; }; SHA384Init; SHA384Update { FLAGS = NODYNSORT; }; SHA512Final { FLAGS = NODYNSORT; }; SHA512Init; SHA512Update { FLAGS = NODYNSORT; }; }; SYMBOL_VERSION ILLUMOSprivate { global: $if _ELF64 && _x86 # # We use hardware capabilities to define multiple versions of # the block processing functions for some of the SHA functions. # Unfortunately, that requires these to be global symbols, even # though we don't want them to be. As such, they remain in a # private version and hopefully some day will be removed. These # symbols are not exposed in any meaningful way in a header file # so no application should actually end up requiring this # section. # sha1_block_data_order; SHA256TransformBlocks; $endif local: *; }; /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _MD4_H #define _MD4_H #include #endif /* _MD4_H */ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _MD5_H #define _MD5_H /* * MD5.H - header file for MD5C.C */ /* * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All * rights reserved. * * License to copy and use this software is granted provided that it * is identified as the "RSA Data Security, Inc. MD5 Message-Digest * Algorithm" in all material mentioning or referencing this software * or this function. * * License is also granted to make and use derivative works provided * that such works are identified as "derived from the RSA Data * Security, Inc. MD5 Message-Digest Algorithm" in all material * mentioning or referencing the derived work. * * RSA Data Security, Inc. makes no representations concerning either * the merchantability of this software or the suitability of this * software for any particular purpose. It is provided "as is" * without express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this * documentation and/or software. */ #include #ifdef __cplusplus extern "C" { #endif void md5_calc(void *, const void*, unsigned int); #ifdef __cplusplus } #endif #endif /* _MD5_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SHA1_H #define _SHA1_H #include #endif /* _SHA1_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SHA2_H #define _SHA2_H #include #endif /* _SHA2_H */ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2013 Saso Kiselkov. All rights reserved. */ #ifndef _SKEIN_H #define _SKEIN_H #include #endif /* _SKEIN_H */ #!/bin/sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # Copyright 2013 Saso Kiselkov. All rights reserved. find_files "s.*" usr/src/common/crypto/edonr find_files "s.*" usr/src/common/crypto/md4 find_files "s.*" usr/src/common/crypto/md5 find_files "s.*" usr/src/common/crypto/sha1 find_files "s.*" usr/src/common/crypto/sha2 find_files "s.*" usr/src/common/crypto/skein