Skip to content

Commit

Permalink
Merge pull request #30 from SergeyBel/issue-29
Browse files Browse the repository at this point in the history
add extra compile flags
  • Loading branch information
SergeyBel authored Nov 10, 2020
2 parents 398cfe5 + d7fce7f commit c9139ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
FLAGS = -Wall -Wextra

all: clean build_test build_debug build_profile build_release

build_test:
g++ -g -pthread ./src/AES.cpp ./tests/tests.cpp /usr/lib/libgtest.a -o bin/test
g++ $(FLAGS) -g -pthread ./src/AES.cpp ./tests/tests.cpp /usr/lib/libgtest.a -o bin/test

build_debug:
g++ -g ./src/AES.cpp ./dev/main.cpp -o bin/debug
g++ $(FLAGS) -g ./src/AES.cpp ./dev/main.cpp -o bin/debug

build_profile:
g++ -pg ./src/AES.cpp ./dev/main.cpp -o bin/profile
g++ $(FLAGS) -pg ./src/AES.cpp ./dev/main.cpp -o bin/profile

build_release:
g++ -O2 ./src/AES.cpp ./dev/main.cpp -o bin/release
g++ $(FLAGS) -O2 ./src/AES.cpp ./dev/main.cpp -o bin/release

clean:
rm -rf bin
Expand Down
2 changes: 1 addition & 1 deletion dev/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <iostream>
#include "../src/AES.h"

int main(int argc, char *argv[])
int main()
{
cout << "Aes dev" << endl;
return 0;
Expand Down
6 changes: 2 additions & 4 deletions src/AES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,8 @@ void AES::SubBytes(unsigned char **state)

void AES::ShiftRow(unsigned char **state, int i, int n) // shift row i on n positions
{
unsigned char t;
int k, j, index;
unsigned char *tmp = new unsigned char[Nb];
for (j = 0; j < Nb; j++) {
for (int j = 0; j < Nb; j++) {
tmp[j] = state[i][(j + n) % Nb];
}
memcpy(state[i], tmp, Nb * sizeof(unsigned char));
Expand Down Expand Up @@ -521,7 +519,7 @@ void AES::XorBlocks(unsigned char *a, unsigned char * b, unsigned char *c, unsig

void AES::printHexArray (unsigned char a[], unsigned int n)
{
for (int i = 0; i < n; i++) {
for (unsigned int i = 0; i < n; i++) {
printf("%02x ", a[i]);
}
}
Expand Down

0 comments on commit c9139ed

Please sign in to comment.