00001 /*********************************************************************** 00002 * 00003 * KRYPTOS - Educational software for teaching cryptography 00004 * For more information, see http://www.kryptosproject.org/ 00005 * Submissions may be sent to kryptos@gmu.edu (see web site for details) 00006 * 00007 * 00008 * Copyright (c) 2002-2006 George Mason University 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining 00011 * a copy of this software and associated documentation files (the 00012 * "Software"), to deal in the Software without restriction, including 00013 * without limitation the rights to use, copy, modify, merge, publish, 00014 * distribute, sublicense, and/or sell copies of the Software, and to 00015 * permit persons to whom the Software is furnished to do so, subject 00016 * to the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be 00019 * included in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00024 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 00025 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00026 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00027 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00028 * 00029 ***********************************************************************/ 00030 00031 #pragma once 00032 #include "stdafx.h" 00033 #include "KryptosTimer.h" 00034 #include <string> 00035 00036 using namespace std; 00037 00043 class CCryptoLink : 00044 public CObject 00045 { 00046 public: 00047 CCryptoLink(void); 00048 00049 //DECLARE_DYNCREATE(CCryptoLink); 00050 00051 virtual ~CCryptoLink(void); 00052 00053 __int64 GetCycles(); 00055 CKryptosTimer overallTimer; 00056 00058 CKryptosTimer internalTimer; 00059 00065 static int ntz(unsigned i) 00066 /* Count the number of trailing zeroes in integer i. */ 00067 { 00068 int rval = 0; 00069 while ((i & 1) == 0) { 00070 i >>= 1; 00071 rval++; 00072 } 00073 return rval; 00074 } 00075 00077 virtual void ProcessMACVer() = 0; 00079 virtual void ProcessMACGen() = 0; 00081 virtual void ProcessHash() = 0; 00083 virtual void ProcessHashVerify() = 0; 00088 virtual bool processVerify() = 0; 00090 virtual void processSign() = 0; 00092 virtual void processPK() = 0; 00097 virtual BOOL processRequest(DWORD numPumps,DWORD sizePumps,DWORD m_lastPump) = 0; 00104 virtual string ByteToHexString(byte *out, int bytesize) = 0; 00110 virtual byte *GetIV( int bytesize) = 0; 00111 00113 CString TimingDetails; 00114 };