Latest update.
This commit is contained in:
@@ -28,9 +28,10 @@
|
||||
# the cost of 15/12% regression on Cortex-A5/A7, it's even possible
|
||||
# to improve Cortex-A9 result, but then A5/A7 loose more than 20%;
|
||||
|
||||
$flavour = shift;
|
||||
if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; }
|
||||
else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} }
|
||||
# $output is the last argument if it looks like a file (it has an extension)
|
||||
# $flavour is the first argument if it doesn't look like a file
|
||||
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
|
||||
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
|
||||
|
||||
if ($flavour && $flavour ne "void") {
|
||||
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
||||
@@ -38,9 +39,10 @@ if ($flavour && $flavour ne "void") {
|
||||
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
|
||||
die "can't locate arm-xlate.pl";
|
||||
|
||||
open STDOUT,"| \"$^X\" $xlate $flavour $output";
|
||||
open STDOUT,"| \"$^X\" $xlate $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
} else {
|
||||
open STDOUT,">$output";
|
||||
$output and open STDOUT,">$output";
|
||||
}
|
||||
|
||||
($ctx,$inp,$len,$padbit)=map("r$_",(0..3));
|
||||
|
||||
@@ -35,15 +35,18 @@
|
||||
# i.e. measured result is worse than expected, presumably binary
|
||||
# translator is not almighty;
|
||||
|
||||
$flavour=shift;
|
||||
$output=shift;
|
||||
# $output is the last argument if it looks like a file (it has an extension)
|
||||
# $flavour is the first argument if it doesn't look like a file
|
||||
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
|
||||
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
|
||||
|
||||
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
||||
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
|
||||
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
|
||||
die "can't locate arm-xlate.pl";
|
||||
|
||||
open OUT,"| \"$^X\" $xlate $flavour $output";
|
||||
open OUT,"| \"$^X\" $xlate $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
my ($ctx,$inp,$len,$padbit) = map("x$_",(0..3));
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
# time dependent on input length. This module on the other hand is free
|
||||
# from such limitation.
|
||||
|
||||
$output=pop;
|
||||
open STDOUT,">$output";
|
||||
$output=pop and open STDOUT,">$output";
|
||||
|
||||
($CTXA,$INPB,$LEN,$PADBIT)=("A4","B4","A6","B6");
|
||||
($H0,$H1,$H2,$H3,$H4,$H4a)=("A8","B8","A10","B10","B2",$LEN);
|
||||
|
||||
@@ -56,7 +56,11 @@
|
||||
#
|
||||
######################################################################
|
||||
|
||||
$flavour = shift || "o32"; # supported flavours are o32,n32,64,nubi32,nubi64
|
||||
# $output is the last argument if it looks like a file (it has an extension)
|
||||
# $flavour is the first argument if it doesn't look like a file
|
||||
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
|
||||
# supported flavours are o32,n32,64,nubi32,nubi64, default is o32
|
||||
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : "o32";
|
||||
|
||||
die "MIPS64 only" unless ($flavour =~ /64|n32/i);
|
||||
|
||||
@@ -431,7 +435,7 @@ poly1305_emit:
|
||||
___
|
||||
}
|
||||
|
||||
$output=pop and open STDOUT,">$output";
|
||||
$output and open STDOUT,">$output";
|
||||
print $code;
|
||||
close STDOUT;
|
||||
|
||||
@@ -52,7 +52,10 @@
|
||||
# not, not one usable in the context. Improvement is ~40% over -m64
|
||||
# result above and is ~1.43 on little-endian systems.
|
||||
|
||||
$flavour = shift;
|
||||
# $output is the last argument if it looks like a file (it has an extension)
|
||||
# $flavour is the first argument if it doesn't look like a file
|
||||
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
|
||||
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
|
||||
|
||||
if ($flavour =~ /64/) {
|
||||
$SIZE_T =8;
|
||||
@@ -79,7 +82,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
||||
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
|
||||
die "can't locate ppc-xlate.pl";
|
||||
|
||||
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
|
||||
open STDOUT,"| $^X $xlate $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
|
||||
$FRAME=24*$SIZE_T;
|
||||
|
||||
|
||||
@@ -27,7 +27,10 @@
|
||||
# POWER7 3.50/+30%
|
||||
# POWER8 3.75/+10%
|
||||
|
||||
$flavour = shift;
|
||||
# $output is the last argument if it looks like a file (it has an extension)
|
||||
# $flavour is the first argument if it doesn't look like a file
|
||||
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
|
||||
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
|
||||
|
||||
if ($flavour =~ /64/) {
|
||||
$SIZE_T =8;
|
||||
@@ -54,7 +57,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
||||
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
|
||||
die "can't locate ppc-xlate.pl";
|
||||
|
||||
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
|
||||
open STDOUT,"| $^X $xlate $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
|
||||
$LOCALS=6*$SIZE_T;
|
||||
$FRAME=$LOCALS+6*8+18*8;
|
||||
|
||||
@@ -47,7 +47,10 @@ use FindBin qw($Bin);
|
||||
use lib "$Bin/../..";
|
||||
use perlasm::s390x qw(:DEFAULT :LD :GE :EI :MI1 :VX AUTOLOAD LABEL INCLUDE);
|
||||
|
||||
my $flavour = shift;
|
||||
# $output is the last argument if it looks like a file (it has an extension)
|
||||
# $flavour is the first argument if it doesn't look like a file
|
||||
my $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
|
||||
my $flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
|
||||
|
||||
my ($z,$SIZE_T);
|
||||
if ($flavour =~ /3[12]/) {
|
||||
@@ -58,9 +61,6 @@ if ($flavour =~ /3[12]/) {
|
||||
$SIZE_T=8;
|
||||
}
|
||||
|
||||
my $output;
|
||||
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {}
|
||||
|
||||
my $stdframe=16*$SIZE_T+4*8;
|
||||
my $sp="%r15";
|
||||
|
||||
|
||||
@@ -41,17 +41,16 @@
|
||||
# (***) Multi-process benchmark saturates at ~12.5x single-process
|
||||
# result on 8-core processor, or ~21GBps per 2.85GHz socket.
|
||||
|
||||
my $output = pop;
|
||||
open STDOUT,">$output";
|
||||
# $output is the last argument if it looks like a file (it has an extension)
|
||||
my $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
|
||||
|
||||
open STDOUT,">$output" if $output;
|
||||
|
||||
my ($ctx,$inp,$len,$padbit,$shl,$shr) = map("%i$_",(0..5));
|
||||
my ($r0,$r1,$r2,$r3,$s1,$s2,$s3,$h4) = map("%l$_",(0..7));
|
||||
my ($h0,$h1,$h2,$h3, $t0,$t1,$t2) = map("%o$_",(0..5,7));
|
||||
my ($d0,$d1,$d2,$d3) = map("%g$_",(1..4));
|
||||
|
||||
my $output = pop;
|
||||
open STDOUT,">$stdout";
|
||||
|
||||
$code.=<<___;
|
||||
#include "sparc_arch.h"
|
||||
|
||||
|
||||
@@ -47,8 +47,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
||||
push(@INC,"${dir}","${dir}../../perlasm");
|
||||
require "x86asm.pl";
|
||||
|
||||
$output=pop;
|
||||
open STDOUT,">$output";
|
||||
$output=pop and open STDOUT,">$output";
|
||||
|
||||
&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386");
|
||||
|
||||
|
||||
@@ -63,9 +63,10 @@
|
||||
# (***) strangely enough performance seems to vary from core to core,
|
||||
# listed result is best case;
|
||||
|
||||
$flavour = shift;
|
||||
$output = shift;
|
||||
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
|
||||
# $output is the last argument if it looks like a file (it has an extension)
|
||||
# $flavour is the first argument if it doesn't look like a file
|
||||
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
|
||||
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
|
||||
|
||||
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
|
||||
|
||||
@@ -94,7 +95,8 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\"";
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
my ($ctx,$inp,$len,$padbit)=("%rdi","%rsi","%rdx","%rcx");
|
||||
|
||||
+11
-12
@@ -29,22 +29,21 @@ IF[{- !$disabled{asm} -}]
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
SOURCE[../../libcrypto]=poly1305_ameth.c poly1305_meth.c poly1305.c $POLY1305ASM
|
||||
SOURCE[../../libcrypto]=poly1305_ameth.c poly1305.c $POLY1305ASM
|
||||
DEFINE[../../libcrypto]=$POLY1305DEF
|
||||
|
||||
GENERATE[poly1305-sparcv9.S]=asm/poly1305-sparcv9.pl $(PERLASM_SCHEME)
|
||||
GENERATE[poly1305-sparcv9.S]=asm/poly1305-sparcv9.pl
|
||||
INCLUDE[poly1305-sparcv9.o]=..
|
||||
GENERATE[poly1305-x86.s]=asm/poly1305-x86.pl \
|
||||
$(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(PROCESSOR)
|
||||
GENERATE[poly1305-x86_64.s]=asm/poly1305-x86_64.pl $(PERLASM_SCHEME)
|
||||
GENERATE[poly1305-ppc.s]=asm/poly1305-ppc.pl $(PERLASM_SCHEME)
|
||||
GENERATE[poly1305-ppcfp.s]=asm/poly1305-ppcfp.pl $(PERLASM_SCHEME)
|
||||
GENERATE[poly1305-armv4.S]=asm/poly1305-armv4.pl $(PERLASM_SCHEME)
|
||||
GENERATE[poly1305-x86.s]=asm/poly1305-x86.pl
|
||||
GENERATE[poly1305-x86_64.s]=asm/poly1305-x86_64.pl
|
||||
GENERATE[poly1305-ppc.s]=asm/poly1305-ppc.pl
|
||||
GENERATE[poly1305-ppcfp.s]=asm/poly1305-ppcfp.pl
|
||||
GENERATE[poly1305-armv4.S]=asm/poly1305-armv4.pl
|
||||
INCLUDE[poly1305-armv4.o]=..
|
||||
GENERATE[poly1305-armv8.S]=asm/poly1305-armv8.pl $(PERLASM_SCHEME)
|
||||
GENERATE[poly1305-armv8.S]=asm/poly1305-armv8.pl
|
||||
INCLUDE[poly1305-armv8.o]=..
|
||||
GENERATE[poly1305-mips.S]=asm/poly1305-mips.pl $(PERLASM_SCHEME)
|
||||
GENERATE[poly1305-mips.S]=asm/poly1305-mips.pl
|
||||
INCLUDE[poly1305-mips.o]=..
|
||||
GENERATE[poly1305-c64xplus.S]=asm/poly1305-c64xplus.pl $(PERLASM_SCHEME)
|
||||
GENERATE[poly1305-c64xplus.S]=asm/poly1305-c64xplus.pl
|
||||
INCLUDE[poly1305-s390x.o]=..
|
||||
GENERATE[poly1305-s390x.S]=asm/poly1305-s390x.pl $(PERLASM_SCHEME)
|
||||
GENERATE[poly1305-s390x.S]=asm/poly1305-s390x.pl
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (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
|
||||
*/
|
||||
#include <openssl/evp.h>
|
||||
#include "internal/evp_int.h"
|
||||
#include "internal/poly1305.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include "poly1305_local.h"
|
||||
|
||||
/* typedef EVP_MAC_IMPL */
|
||||
struct evp_mac_impl_st {
|
||||
POLY1305 *ctx; /* poly1305 context */
|
||||
};
|
||||
|
||||
static EVP_MAC_IMPL *poly1305_new(void)
|
||||
{
|
||||
EVP_MAC_IMPL *ctx;
|
||||
|
||||
if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL
|
||||
|| (ctx->ctx = OPENSSL_zalloc(sizeof(POLY1305))) == NULL) {
|
||||
OPENSSL_free(ctx);
|
||||
return 0;
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static void poly1305_free(EVP_MAC_IMPL *ctx)
|
||||
{
|
||||
if (ctx != NULL) {
|
||||
OPENSSL_free(ctx->ctx);
|
||||
OPENSSL_free(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
static EVP_MAC_IMPL *poly1305_dup(const EVP_MAC_IMPL *src)
|
||||
{
|
||||
EVP_MAC_IMPL *dst;
|
||||
|
||||
dst = poly1305_new();
|
||||
if (dst == NULL)
|
||||
return NULL;
|
||||
|
||||
*dst->ctx = *src->ctx;
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
static size_t poly1305_size(EVP_MAC_IMPL *ctx)
|
||||
{
|
||||
return POLY1305_DIGEST_SIZE;
|
||||
}
|
||||
|
||||
static int poly1305_init(EVP_MAC_IMPL *ctx)
|
||||
{
|
||||
/* initialize the context in MAC_ctrl function */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int poly1305_update(EVP_MAC_IMPL *ctx, const unsigned char *data,
|
||||
size_t datalen)
|
||||
{
|
||||
POLY1305 *poly_ctx = ctx->ctx;
|
||||
|
||||
/* poly1305 has nothing to return in its update function */
|
||||
Poly1305_Update(poly_ctx, data, datalen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int poly1305_final(EVP_MAC_IMPL *ctx, unsigned char *out)
|
||||
{
|
||||
POLY1305 *poly_ctx = ctx->ctx;
|
||||
|
||||
Poly1305_Final(poly_ctx, out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int poly1305_ctrl(EVP_MAC_IMPL *ctx, int cmd, va_list args)
|
||||
{
|
||||
POLY1305 *poly_ctx = ctx->ctx;
|
||||
unsigned char *key;
|
||||
size_t keylen;
|
||||
|
||||
switch (cmd) {
|
||||
case EVP_MAC_CTRL_SET_KEY:
|
||||
key = va_arg(args, unsigned char *);
|
||||
keylen = va_arg(args, size_t);
|
||||
|
||||
if (keylen != POLY1305_KEY_SIZE) {
|
||||
EVPerr(EVP_F_POLY1305_CTRL, EVP_R_INVALID_KEY_LENGTH);
|
||||
return 0;
|
||||
}
|
||||
Poly1305_Init(poly_ctx, key);
|
||||
return 1;
|
||||
default:
|
||||
return -2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int poly1305_ctrl_int(EVP_MAC_IMPL *ctx, int cmd, ...)
|
||||
{
|
||||
int rv;
|
||||
va_list args;
|
||||
|
||||
va_start(args, cmd);
|
||||
rv = poly1305_ctrl(ctx, cmd, args);
|
||||
va_end(args);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int poly1305_ctrl_str_cb(void *ctx, int cmd, void *buf, size_t buflen)
|
||||
{
|
||||
return poly1305_ctrl_int(ctx, cmd, buf, buflen);
|
||||
}
|
||||
|
||||
static int poly1305_ctrl_str(EVP_MAC_IMPL *ctx,
|
||||
const char *type, const char *value)
|
||||
{
|
||||
if (value == NULL)
|
||||
return 0;
|
||||
if (strcmp(type, "key") == 0)
|
||||
return EVP_str2ctrl(poly1305_ctrl_str_cb, ctx, EVP_MAC_CTRL_SET_KEY,
|
||||
value);
|
||||
if (strcmp(type, "hexkey") == 0)
|
||||
return EVP_hex2ctrl(poly1305_ctrl_str_cb, ctx, EVP_MAC_CTRL_SET_KEY,
|
||||
value);
|
||||
return -2;
|
||||
}
|
||||
|
||||
const EVP_MAC poly1305_meth = {
|
||||
EVP_MAC_POLY1305,
|
||||
poly1305_new,
|
||||
poly1305_dup,
|
||||
poly1305_free,
|
||||
poly1305_size,
|
||||
poly1305_init,
|
||||
poly1305_update,
|
||||
poly1305_final,
|
||||
poly1305_ctrl,
|
||||
poly1305_ctrl_str
|
||||
};
|
||||
Reference in New Issue
Block a user