/*************************************************************************** * Copyright (C) 2006 * * * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ /** @author Svetlin Manavski */ #include #include "aesCudaUtils.h" #include "utilsBox.h" #include using namespace std; const int INPUTSIZE = 33*1024*1024; bool MODE = 1; //handler extern "C" int aesHost(unsigned char* result, const unsigned char* inData, int inputSize, const unsigned char* key, int keySize, bool toEncrypt); int main(int argc, char *argv[]) { try { unsigned numPairs = commandLineManager(argc, argv); unsigned aesType = static_cast(atoi(argv[2])); unsigned ekSize=240; if (aesType != 256) ekSize = 176; //per ogni coppia di file di input e di chiave svolge l'operazione for (unsigned cnt=0; cnt(h_Input), modUsefulData, myExpKey, sizeof(myExpKey), MODE); if ( errorReturned == -1 ) throw string("aesHost: cannot use an input size minor of 256\n"); if ( errorReturned == -11 ) throw string("aesHost: cannot use an input size not multiple of 256\n"); if ( errorReturned == -2 ) throw string("aesHost: cannot use an expanded key size different from 240 or 176\n"); if ( errorReturned == -3 ) throw string("aesHost: some input not allocated\n"); cout << "\n###############################################################\n\n"; char numFile[10000]; sprintf(numFile, "%d", cnt); string nameOutFile("output_"); nameOutFile.append(numFile); nameOutFile.append(".dat"); //scrittura risultati in uscita writeToFile(nameOutFile, reinterpret_cast(h_Result), usefulData, INPUTSIZE); delete[] h_Result; delete[] h_Input; } } catch(string ex){ cout << "Exception occurred: " << ex << endl; } return EXIT_SUCCESS; }