From eb531fdd490b5b870e56d2ff9802c4bc5cee7237 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 14 Nov 2018 22:49:28 -0800 Subject: poly1305: specialize to wireguard Signed-off-by: Jason A. Donenfeld --- src/crypto/zinc/poly1305/poly1305-x86_64.pl | 31 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src/crypto/zinc/poly1305/poly1305-x86_64.pl') diff --git a/src/crypto/zinc/poly1305/poly1305-x86_64.pl b/src/crypto/zinc/poly1305/poly1305-x86_64.pl index b2d014b..8de1d1f 100644 --- a/src/crypto/zinc/poly1305/poly1305-x86_64.pl +++ b/src/crypto/zinc/poly1305/poly1305-x86_64.pl @@ -1,11 +1,13 @@ -#! /usr/bin/env perl -# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. +#!/usr/bin/env perl +# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause # -# Licensed under the OpenSSL license (the "License"). You may not use -# this file except in compliance with the License. You can obtain a copy -# in the file LICENSE in the source distribution or at -# https://www.openssl.org/source/license.html - +# Copyright (C) 2017-2018 Samuel Neves . All Rights Reserved. +# Copyright (C) 2006-2017 CRYPTOGAMS by . All Rights Reserved. +# +# This code is taken from the OpenSSL project but the author, Andy Polyakov, +# has relicensed it under the licenses specified in the SPDX header above. +# The original headers, including the original license headers, are +# included below for completeness. # # ==================================================================== # Written by Andy Polyakov for the OpenSSL @@ -63,7 +65,7 @@ # (***) strangely enough performance seems to vary from core to core, # listed result is best case; -$flavour = shift; +$flavour = "linux"; # shift; $output = shift; if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } @@ -71,8 +73,7 @@ $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $kernel=0; $kernel=1 if ($flavour =~ /linux/); $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; -( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or -( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or +( $xlate="${dir}../perlasm/x86_64-xlate.pl" and -f $xlate) or die "can't locate x86_64-xlate.pl"; if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` @@ -163,7 +164,7 @@ $code.=<<___; .quad 0x3ffffffffff,0x3ffffffffff,0x3ffffffffff,0x3ffffffffff ___ } -$code.=<<___; +$code.=<<___ if (!$kernel); .asciz "Poly1305 for x86_64, CRYPTOGAMS by " .align 16 ___ @@ -4219,6 +4220,14 @@ $code.=<<___ if ($avx>2); ___ } +open SELF,$0; +while() { + next if (/^#!/); + last if (!s/^#/\/\// and !/^$/); + print; +} +close SELF; + foreach (split('\n',$code)) { s/\`([^\`]*)\`/eval($1)/ge; s/%r([a-z]+)#d/%e$1/g; -- cgit v1.2.3