Giter Site home page Giter Site logo

doctor3w / hls-cryptography-accelerator Goto Github PK

View Code? Open in Web Editor NEW
16.0 4.0 3.0 978 KB

A crypto accelerator written for HLS to an FPGA that actually makes it slower than running it on your computer

Makefile 1.57% C 6.16% C++ 33.04% Assembly 38.32% Tcl 1.41% Shell 2.48% Python 0.11% TeX 16.91%
high-level-synthesis fpga-accelerator

hls-cryptography-accelerator's Introduction

HLS Crypto Accelerator: AES+RSA+SHA

This project is composed of three subprojects: AES, RSA, and SHA. Each of these projects were build for use on the Zedboard's Xilinx Zynq-7000.

AES

The entire AES implementation is in the aes directory:

  • aes.cpp: The optimized synthesizable AES CTR implementation.
  • aes.h: The header containing some definitions for the AES implementation including 128, 192, or 256 key sizes as well as the number of blocks that will be encrypted with the FPGA.
  • aes_test.cpp: The AES test file for csim.
  • aes-sw.c/aes-sw.h/test-sw.c: The embedded software optimized version from tiny-AES-c.
  • data: Directory containing the random bytes and the encrypted solutions.

The Makefile contains all the commands necessary to build the software.

  • make: Builds and runs the aes.cpp file.
  • make sw: Builds and runs the optimized AES program.
  • make fpga: Builds and runs the host file for communicating with the FPGA once the bitstream has been loaded.
  • make bitsream: Runs the bitstream making script.

Running vivado_hls -f run.tcl will synthesize the software.

RSA

The entire RSA implementation is in the rsa directory:

  • big_ap_int.h: header used to include ap_int safely.
  • bignum.h: header containing large number arithmetic library.
  • fpga_rsa.h, fpga_rsa.cc: top-level design under test
  • fpga_timer.h: wall-clock based timer for FPGA performance analysis.
  • sim_timer.h: CPU time based timer for software performance analysis.
  • host.h: small library for xillybus communication.
  • mpz_adapters.h: algorithms to convert between Bignum and mpz_t types.
  • pragmas.h: macros for controlling HLS pragmas
  • rsa.cc: main program, which encrypts a small message
  • rsa_config.h: contains macro definitions which define RSA key sizes and such.

There are some additional files as well:

  • data: a directory containing final benchmarking data.
  • format.sh: a formatting script.
  • bench: a benchmarking script.
  • gmp-link-directive and vivado-include two helper scripts which allow using the same makefile on both the ZedBoard and x86 machines.
  • run_bitstream.sh: modified bitstream script which takes a project name as a parameter.
  • run.tcl: main tcl file.

The Makefile contains all the command necessary to build the software:

  • make: builds optimized software version (rsa).
  • make MODE=FPGA_SIM: builds a software version which runs the synthesizable code (rsa-sim).
  • make MODE=FPGA_REAL: builds a software version which communicates with the FPGA (rsa-host).

Running vivado_hls -f run.tcl will generate rsa.prj. Running ./run_bitstream rsa will generate the bitstream, rsa.bit.

SHA

The entire HLS implementation can be found symlinked in the ecelinux directory:

  • SHA512.cpp/SHA512.h: Contains the SHA-512 implementation wrapped in the SHA512Hasher class
  • unix_cracker.cpp/unix_cracker.h: Contains the Unix crypt() implementation
  • main.cpp: The HLS entry point (dut())
  • helpers.cpp/helpers.h: Several basic helper functions
  • unix_cracker_test.cpp: The csim test program

The Zedboard's host program can be found in the zedboard directory.

Building

To generate the bitstream, run "vivado_hls run.tcl" in the ecelinux directory. Note you must be using the 2017 version. The bitstream can be generated afterwards with the ./run_bitstream.sh script.

To generate the Zedboard's host program, run make in the Zedboard directory.

Running

Flash the bitstream to a Zedboard, then excute the host program that was compiled in the previous step.

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.