-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandmaps.cpp
More file actions
33 lines (31 loc) · 1.16 KB
/
randmaps.cpp
File metadata and controls
33 lines (31 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "declares.h"
data_t f(data_t x, u64 fi)
{
functioncalls++;
IppStatus status;
int srclen;
srclen = 16;
Ipp8u pSrc[16];
Ipp8u pDst[16];
x &= mask;
data_t y;
for (size_t i = 0; i < 16; i++)
{
pSrc[i] = 0;
pDst[i] = 0;
}
memcpy(pSrc, &x, sizeof(data_t));
memcpy(&pSrc[8], &fi, sizeof(fi));
status = ippsAESEncryptECB(pSrc, pDst, srclen, pCtx1);
switch (status)
{
case ippStsNoErr: /*cout << "ippStsNoErr: Indicates no error." << endl;*/ break;
case ippStsNullPtrErr: cout << "ippStsNullPtrErr: Indicates an error condition if the specified pointer is NULL." << endl; break;
case ippStsLengthErr: cout << "ippStsLengthErr: Indicates an error condition if the input data stream length is less than or equal to zero." << endl; break;
case ippStsUnderRunErr: cout << "ippStsUnderRunErr: Indicates an error condition if srclen is not divisible by cipher block size." << endl; break;
case ippStsContextMatchErr: cout << "ippStsContextMatchErr: Indicates an error condition if the context parameter does not match the operation." << endl; break;
default: break;
}
memcpy(&y, pDst, sizeof(data_t));
return ((y & mask) ^ x);
}