-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
286 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: build-macos-latest | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
|
||
|
||
jobs: | ||
build: | ||
# The CMake configure and build commands are platform agnostic and should work equally | ||
# well on Windows or Mac. You can convert this to a matrix build if you need | ||
# cross-platform coverage. | ||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
compiler: [gcc, clang] | ||
include: | ||
- compiler: gcc | ||
cc: gcc | ||
cxx: g++ | ||
- compiler: clang | ||
cc: clang | ||
cxx: clang++ | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Install libraries | ||
run: | | ||
checkPkgAndInstall() | ||
{ | ||
while [ $# -ne 0 ] | ||
do | ||
rm -f '/usr/local/bin/2to3' | ||
if brew ls --versions $1 ; then | ||
brew upgrade $1 | ||
else | ||
brew install $1 | ||
fi | ||
shift | ||
done | ||
} | ||
checkPkgAndInstall cunit | ||
- name: Create Build Environment | ||
# Some projects don't allow in-source building, so create a separate build directory | ||
# We'll use this as our working directory for all subsequent commands | ||
run: cmake -E make_directory ${{github.workspace}}/build | ||
|
||
- name: Configure CMake | ||
# Use a bash shell so we can use the same syntax for environment variable | ||
# access regardless of the host operating system | ||
shell: bash | ||
working-directory: ${{github.workspace}}/build | ||
# Note the current convention is to use the -S and -B options here to specify source | ||
# and build directories, but this is only available with CMake 3.13 and higher. | ||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 | ||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE | ||
|
||
- name: Build | ||
working-directory: ${{github.workspace}}/build | ||
shell: bash | ||
# Execute the build. You can specify a specific target with "--target <NAME>" | ||
run: cmake --build . --config $BUILD_TYPE | ||
|
||
- name: Test | ||
working-directory: ${{github.workspace}}/build | ||
shell: bash | ||
# Execute tests defined by the CMake configuration. | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
run: ctest -C $BUILD_TYPE --output-on-failure --test-dir tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: build-ubuntu-latest | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
|
||
|
||
jobs: | ||
build: | ||
# The CMake configure and build commands are platform agnostic and should work equally | ||
# well on Windows or Mac. You can convert this to a matrix build if you need | ||
# cross-platform coverage. | ||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
compiler: [gcc, clang] | ||
include: | ||
- compiler: gcc | ||
cc: gcc | ||
cxx: g++ | ||
- compiler: clang | ||
cc: clang | ||
cxx: clang++ | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Install libraries | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install cmake libcunit1 libcunit1-doc libcunit1-dev | ||
- name: Create Build Environment | ||
# Some projects don't allow in-source building, so create a separate build directory | ||
# We'll use this as our working directory for all subsequent commands | ||
run: cmake -E make_directory ${{github.workspace}}/build | ||
|
||
- name: Configure CMake | ||
# Use a bash shell so we can use the same syntax for environment variable | ||
# access regardless of the host operating system | ||
shell: bash | ||
working-directory: ${{github.workspace}}/build | ||
# Note the current convention is to use the -S and -B options here to specify source | ||
# and build directories, but this is only available with CMake 3.13 and higher. | ||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 | ||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE | ||
|
||
- name: Build | ||
working-directory: ${{github.workspace}}/build | ||
shell: bash | ||
# Execute the build. You can specify a specific target with "--target <NAME>" | ||
run: cmake --build . --config $BUILD_TYPE | ||
|
||
- name: Test | ||
working-directory: ${{github.workspace}}/build | ||
shell: bash | ||
# Execute tests defined by the CMake configuration. | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
run: ctest -C $BUILD_TYPE --output-on-failure --test-dir tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*- | ||
* Copyright (c) 2013 - 2020 Rozhuk Ivan <[email protected]> | ||
* Copyright (c) 2013-2024 Rozhuk Ivan <[email protected]> | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
|
@@ -54,10 +54,15 @@ | |
#ifdef _WINDOWS | ||
# define EINVAL ERROR_INVALID_PARAMETER | ||
#else | ||
# include <sys/param.h> | ||
# include <sys/types.h> | ||
# include <inttypes.h> | ||
#endif | ||
|
||
#ifndef nitems /* SIZEOF() */ | ||
# define nitems(__val) (sizeof(__val) / sizeof(__val[0])) | ||
#endif | ||
|
||
#include "math/elliptic_curve.h" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*- | ||
* Copyright (c) 2016-2023 Rozhuk Ivan <[email protected]> | ||
* Copyright (c) 2016-2024 Rozhuk Ivan <[email protected]> | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
|
@@ -38,11 +38,6 @@ | |
#define __GOST3411_2012_H__INCLUDED__ | ||
|
||
#include <sys/param.h> | ||
#ifdef __linux__ | ||
# include <endian.h> | ||
#else | ||
# include <sys/endian.h> | ||
#endif | ||
#include <sys/types.h> | ||
#include <string.h> /* bcopy, bzero, memcpy, memmove, memset, strerror... */ | ||
#include <inttypes.h> | ||
|
@@ -60,6 +55,14 @@ | |
# include <immintrin.h> /* AVX */ | ||
#endif | ||
|
||
#ifndef __unused | ||
# define __unused __attribute__((__unused__)) | ||
#endif | ||
|
||
#ifndef nitems /* SIZEOF() */ | ||
# define nitems(__val) (sizeof(__val) / sizeof(__val[0])) | ||
#endif | ||
|
||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER) | ||
# define GOST3411_2012_ALIGN(__n) __declspec(align(__n)) /* DECLSPEC_ALIGN() */ | ||
#else /* GCC/clang */ | ||
|
@@ -1728,18 +1731,18 @@ gost3411_2012_init(const size_t bits, gost3411_2012_ctx_p ctx) { | |
__get_cpuid_count(1, 0, &eax, &ebx, &ecx, &edx); | ||
# ifdef __SSE4_1__ | ||
ctx->use_sse |= (ecx & (((uint32_t)1) << 19)); | ||
# elifdef __SSSE3__ | ||
# elif defined(__SSSE3__) | ||
ctx->use_sse |= (ecx & (((uint32_t)1) << 9)); | ||
# elifdef __SSE3__ | ||
# elif defined(__SSE3__) | ||
ctx->use_sse |= (ecx & (((uint32_t)1) << 0)); | ||
# elifdef __SSE2__ | ||
# elif defined(__SSE2__) | ||
ctx->use_sse |= (edx & (((uint32_t)1) << 26)); | ||
# endif | ||
#endif | ||
#ifdef __AVX2__ | ||
__get_cpuid_count(7, 0, &eax, &ebx, &ecx, &edx); | ||
ctx->use_avx |= (ebx & (((uint32_t)1) << 5)); /* AVX2. */ | ||
#elifdef __AVX__ | ||
#elif defined(__AVX__) | ||
__get_cpuid_count(1, 0, &eax, &ebx, &ecx, &edx); | ||
ctx->use_avx |= (ecx & (((uint32_t)1) << 28)); /* AVX. */ | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*- | ||
* Copyright (c) 2003-2023 Rozhuk Ivan <[email protected]> | ||
* Copyright (c) 2003-2024 Rozhuk Ivan <[email protected]> | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
|
@@ -39,6 +39,10 @@ | |
#include <string.h> /* bcopy, bzero, memcpy, memmove, memset, strerror... */ | ||
#include <inttypes.h> | ||
|
||
#ifndef nitems /* SIZEOF() */ | ||
# define nitems(__val) (sizeof(__val) / sizeof(__val[0])) | ||
#endif | ||
|
||
static void *(*volatile md5_memset_volatile)(void*, int, size_t) = memset; | ||
#define md5_bzero(__mem, __size) md5_memset_volatile((__mem), 0x00, (__size)) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*- | ||
* Copyright (c) 2003-2023 Rozhuk Ivan <[email protected]> | ||
* Copyright (c) 2003-2024 Rozhuk Ivan <[email protected]> | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
|
@@ -65,11 +65,6 @@ | |
#define __SHA1_H__INCLUDED__ | ||
|
||
#include <sys/param.h> | ||
#ifdef __linux__ | ||
# include <endian.h> | ||
#else | ||
# include <sys/endian.h> | ||
#endif | ||
#include <sys/types.h> | ||
#include <string.h> /* bcopy, bzero, memcpy, memmove, memset, strerror... */ | ||
#include <inttypes.h> | ||
|
@@ -84,6 +79,14 @@ | |
# include <immintrin.h> /* AVX */ | ||
#endif | ||
|
||
#ifndef bswap64 | ||
# define bswap64 __builtin_bswap64 | ||
#endif | ||
|
||
#ifndef nitems /* SIZEOF() */ | ||
# define nitems(__val) (sizeof(__val) / sizeof(__val[0])) | ||
#endif | ||
|
||
#if defined(__SHA__) && defined(__SSSE3__) && defined(__SSE4_1__) | ||
# include <shaintrin.h> | ||
# define SHA1_ENABLE_SIMD 1 | ||
|
@@ -185,11 +188,11 @@ sha1_init(sha1_ctx_p ctx) { | |
ctx->use_sse = 0; | ||
# ifdef __SSE4_1__ | ||
ctx->use_sse |= (ecx & (((uint32_t)1) << 19)); | ||
# elifdef __SSSE3__ | ||
# elif defined(__SSSE3__) | ||
ctx->use_sse |= (ecx & (((uint32_t)1) << 9)); | ||
# elifdef __SSE3__ | ||
# elif defined(__SSE3__) | ||
ctx->use_sse |= (ecx & (((uint32_t)1) << 0)); | ||
# elifdef __SSE2__ | ||
# elif defined(__SSE2__) | ||
ctx->use_sse |= (edx & (((uint32_t)1) << 26)); | ||
# endif | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*- | ||
* Copyright (c) 2013-2023 Rozhuk Ivan <[email protected]> | ||
* Copyright (c) 2013-2024 Rozhuk Ivan <[email protected]> | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
|
@@ -35,11 +35,6 @@ | |
#define __SHA2_H__INCLUDED__ | ||
|
||
#include <sys/param.h> | ||
#ifdef __linux__ | ||
# include <endian.h> | ||
#else | ||
# include <sys/endian.h> | ||
#endif | ||
#include <sys/types.h> | ||
#include <string.h> /* bcopy, bzero, memcpy, memmove, memset, strerror... */ | ||
#include <inttypes.h> | ||
|
@@ -56,6 +51,14 @@ | |
# define SHA2_ENABLE_SIMD 1 | ||
#endif | ||
|
||
#ifndef bswap64 | ||
# define bswap64 __builtin_bswap64 | ||
#endif | ||
|
||
#ifndef nitems /* SIZEOF() */ | ||
# define nitems(__val) (sizeof(__val) / sizeof(__val[0])) | ||
#endif | ||
|
||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER) | ||
# define SHA2_ALIGN(__n) __declspec(align(__n)) /* DECLSPEC_ALIGN() */ | ||
#else /* GCC/clang */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*- | ||
* Copyright (c) 2013 - 2017 Rozhuk Ivan <[email protected]> | ||
* Copyright (c) 2013-2024 Rozhuk Ivan <[email protected]> | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
|
@@ -52,6 +52,9 @@ | |
# include <inttypes.h> | ||
# include <string.h> /* bcopy, bzero, memcpy, memmove, memset, strnlen, strerror... */ | ||
# include <stdio.h> /* snprintf, fprintf */ | ||
# ifndef __unused | ||
# define __unused __attribute__((__unused__)) | ||
# endif | ||
#endif | ||
|
||
|
||
|
Oops, something went wrong.