New upstream version 5.2.5188

This commit is contained in:
geos_one
2025-08-08 12:40:03 +02:00
parent b1e9cf955b
commit e8b2c75644
5730 changed files with 1430965 additions and 238433 deletions

94
3rdparty/BLAKE2/bench/bench.c vendored Normal file
View File

@@ -0,0 +1,94 @@
/*
BLAKE2 reference source code package - benchmark tool
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
your option. The terms of these licenses can be found at:
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int crypto_hash( unsigned char *out, const unsigned char *in, unsigned long long inlen );
static int bench_cmp( const void *x, const void *y )
{
const int64_t *ix = ( const int64_t * )x;
const int64_t *iy = ( const int64_t * )y;
return *ix - *iy;
}
#if defined(__amd64__) || defined(__x86_64__)
static unsigned long long cpucycles( void ) {
unsigned long long result;
__asm__ __volatile__(
".byte 15;.byte 49\n"
"shlq $32,%%rdx\n"
"orq %%rdx,%%rax\n"
: "=a" ( result ) :: "%rdx"
);
return result;
}
#elif defined(__i386__)
static unsigned long long cpucycles( void ) {
unsigned long long result;
__asm__ __volatile__( ".byte 15;.byte 49;" : "=A" ( result ) );
return result;
}
#elif defined(_MSC_VER)
#include <intrin.h>
static unsigned long long cpucycles( void ) {
return __rdtsc();
}
#else
#error "Don't know how to count cycles on this platform!"
#endif
void bench()
{
#define BENCH_TRIALS 32
#define BENCH_MAXLEN 1536
static unsigned char in[4096];
static unsigned long long median[4096 + 1];
int i, j;
printf( "#bytes median per byte\n" );
/* 1 ... BENCH_MAXLEN */
for( j = 0; j <= 4096; ++j )
{
uint64_t cycles[BENCH_TRIALS + 1];
for( i = 0; i <= BENCH_TRIALS; ++i )
{
cycles[i] = cpucycles();
crypto_hash( in, in, j );
}
for( i = 0; i < BENCH_TRIALS; ++i )
cycles[i] = cycles[i + 1] - cycles[i];
qsort( cycles, BENCH_TRIALS, sizeof( uint64_t ), bench_cmp );
median[j] = cycles[BENCH_TRIALS / 2];
}
for( j = 0; j <= BENCH_MAXLEN; j += 8 )
printf( "%5d, %7.2f\n", j, ( double )median[j] / j );
printf( "#2048 %6llu %7.2f\n", median[2048], ( double )median[2048] / 2048.0 );
printf( "#4096 %6llu %7.2f\n", median[4096], ( double )median[4096] / 4096.0 );
printf( "#long long %7.2f\n", ( double )( median[4096] - median[2048] ) / 2048.0 );
}
int main()
{
bench();
return 0;
}

19
3rdparty/BLAKE2/bench/do.gplot vendored Normal file
View File

@@ -0,0 +1,19 @@
maxx = 256
set xrange [1:maxx]
set xlabel "bytes "
set ylabel "cycles"
set xtics 0,32,maxx
set grid
set key left
#set terminal png
#set output "plotcycles.png"
set terminal pdfcairo
set output "plotcycles.pdf"
plot "blake2b.data" using 1:2 with lines title "BLAKE2b"
replot "blake2s.data" using 1:2 with lines title "BLAKE2s"
replot "md5.data" using 1:2 with lines title "MD5"
set output "plotcycles.pdf"
replot

20
3rdparty/BLAKE2/bench/makefile vendored Normal file
View File

@@ -0,0 +1,20 @@
CC=gcc
# std to gnu99 to support inline asm
CFLAGS=-O3 -march=native -Wall -Wextra -DSUPERCOP # -DHAVE_XOP # uncomment on XOP-enabled CPUs
FILES=bench.c
all: bench
bench: bench.c
$(CC) $(FILES) $(CFLAGS) ../sse/blake2b.c -o blake2b
$(CC) $(FILES) $(CFLAGS) ../sse/blake2s.c -o blake2s
$(CC) $(FILES) $(CFLAGS) md5.c -o md5 -lcrypto -lz
plot: bench
./blake2b > blake2b.data
./blake2s > blake2s.data
./md5 > md5.data
gnuplot do.gplot
clean:
rm -f blake2b blake2s md5 plotcycles.pdf blake2b.data blake2s.data md5.data

22
3rdparty/BLAKE2/bench/md5.c vendored Normal file
View File

@@ -0,0 +1,22 @@
/*
BLAKE2 reference source code package - benchmark tool
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
your option. The terms of these licenses can be found at:
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
#include <stddef.h>
#include <openssl/md5.h>
int crypto_hash( unsigned char *out, const unsigned char *in, unsigned long long inlen )
{
MD5( in, inlen, out );
return 0;
}