Coder Social home page Coder Social logo

sha2-le's Introduction

This project is about SHA256 and SHA512 implementations and optimizations

The focus of this project is creating an optimized code for IBM POWER architecture, especifically using ABI v2 (Little Endian), aka ppc64le.

This is a generic project and self-contained now. We are going to start backporting it to different Languages and JIT projects. Our initial target at this moment is the following list:

  • OpenJDK
  • nettle
  • Cryptopp
  • ...

sha2-le's People

Contributors

brenoleitao avatar igorsnunes avatar leitao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

gut power9bsd

sha2-le's Issues

Undefined behavior in tests.c

When compiling with sanitizer flags -fsanitize=address,undefined the following errors are displayed:

tests.c:28:5: runtime error: left shift of 134217728 by 30 places cannot be represented in type 'int'
tests.c:28:5: runtime error: left shift of 134217728 by 19 places cannot be represented in type 'int'
tests.c:28:5: runtime error: left shift of 134217728 by 10 places cannot be represented in type 'int'
tests.c:29:8: runtime error: left shift of 134217728 by 26 places cannot be represented in type 'int'
tests.c:29:8: runtime error: left shift of 134217728 by 21 places cannot be represented in type 'int'
tests.c:29:8: runtime error: left shift of 134217728 by 7 places cannot be represented in type 'int'
./bin/test256_ll_intrinsics
./bin/test256_ll_asm
./bin/test512
tests.c:63:5: runtime error: shift exponent 63 is too large for 32-bit type 'int'
tests.c:63:5: runtime error: shift exponent 56 is too large for 32-bit type 'int'
tests.c:64:8: runtime error: left shift of 4611686018427387904 by 45 places cannot be represented in type 'long int'
tests.c:64:8: runtime error: left shift of 4611686018427387904 by 3 places cannot be represented in type 'long int'
tests.c:65:5: runtime error: left shift of 4611686018427387904 by 36 places cannot be represented in type 'long int'
tests.c:65:5: runtime error: left shift of 4611686018427387904 by 30 places cannot be represented in type 'long int'
tests.c:65:5: runtime error: left shift of 4611686018427387904 by 25 places cannot be represented in type 'long int'
tests.c:66:5: runtime error: left shift of 4611686018427387904 by 50 places cannot be represented in type 'long int'
tests.c:66:5: runtime error: left shift of 4611686018427387904 by 46 places cannot be represented in type 'long int'
tests.c:66:5: runtime error: left shift of 4611686018427387904 by 23 places cannot be represented in type 'long int'

Solve -O3 issues on vectorized variant

Currently (3f25bf2) when compiling with ´-O3thesha256_hwoutputs wrong results for inputs bigger than a block andsha512_hw` is raising segmentation faults.

The issue is due to the inline assembly found inside of calc_compression function.

Allow big inputs

Big inputs (bigger than 3mb) are not allowed by the OS (probably because we are using static vector allocation).

sha256_compress_ppc.o does not export any symbols

I think there's something missing from the assembly source file generated using the toolchain. It appears the symbol is present but it is not exported.

$ m4 common.m4 sha256_compress_ppc.m4 > sha256_compress.s
$ as -mpower8 sha256_compress.s -o sha256_compress.o
$ g++ test.cxx -o test.exe sha256_compress.o
/home/noloader/tmp/cc6pWEuv.o: In function `main':
test.cxx:(.text+0x88): undefined reference to `sha256_compress_ppc(unsigned int*, unsigned char const*, unsigned int const*)'
collect2: error: ld returned 1 exit status

And then:

$ nm -D sha256_compress.o
nm: sha256_compress.o: no symbols
$ objdump --disassemble sha256_compress.o

sha256_compress.o:     file format elf64-powerpcle

Disassembly of section .text:

0000000000000000 <sha256_compress_ppc>:
   0:   50 ff 00 38     li      r0,-176
   4:   ce 01 a1 7f     stvx    v29,r1,r0
   8:   60 ff 00 38     li      r0,-160
   c:   ce 01 81 7f     stvx    v28,r1,r0
   ...
 744:   d0 ff 00 38     li      r0,-48
 748:   ce 00 a1 7e     lvx     v21,r1,r0
 74c:   e0 ff 00 38     li      r0,-32
 750:   ce 00 81 7e     lvx     v20,r1,r0
 754:   20 00 80 4e     blr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.