Coder Social home page Coder Social logo

aes-c's Introduction

AES IMPLEMENTATION

This repository contains an AES Implementation wrote in C with MASK countermeasure.

Build

Compile your source code with gcc compiler:

gcc aes.c -o aes

Usage

In order to use this AES implementation you should include the AES library to your project:

#include "aes.c"

Once you have included the library, it's important to initialize a random seed to your project that will be used for AES randomness.

srand(time(0));

There's a list of the main functions for using the AES implementation.

  • keyExpansion: Pass a key to do the AES key schedule in order to do all the keys for the rounds.
  • cipher: Cipher the input.
  • invCipher: Decipher the input.

Example

There's an example about how to use this implementation:

int main(){
  srand(time(0));

  uint8_t key[4][4]={
  {0x2b,0x7e,0x15,0x16},
  {0x28,0xae,0xd2,0xa6},
  {0xab,0xf7,0x15,0x88},
  {0x09,0xcf,0x4f,0x3c}};

  uint8_t in[4][4]={
  {0x32,0x43,0xf6,0xa8},
  {0x88,0x5a,0x30,0x8d},
  {0x31,0x31,0x98,0xa2},
  {0xe0,0x37,0x07,0x34}};

  uint8_t out1[4][4]={0};
  uint8_t out2[4][4]={0};

  uint8_t expanded[(nr+1)*4][4];

  keyExpansion(key,expanded,nk);
  cipher(in,out1,expanded);
  invCipher(out1,out2,expanded);
}

Countermeasures

The MASK countermeasure applied attempts to protect implementations of cryptographic algorithms.

Protects against common power analysis type attacks:

  • SPA: Side channel attack in which the attacker studies the power consumption of a cryptographic hardware devices.
  • DPA: Differential power analysis attack is an exploit based on an analysis of the correlation between the electricity usage of a chip in a smart card and the encryption key it contains.

Inspiration

A project inspired by:

  • Announcing the ADVANCED ENCRYPTION STANDARD (AES).
  • An Implementation of DES and AES, Secure against Some Attacks.

Future work

  • Conversion of the implementation to an AES White-Box crypto implementation.
  • Rework functions to a best implemented ones.

Authors

Implemented by Joan Calabrés.

aes-c's People

Contributors

jcalabres avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

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.