| 1404 | } |
| 1405 | |
| 1406 | bool ClBinary::decryptElf(const char* binaryIn, size_t size, char** decryptBin, size_t* decryptSize, |
| 1407 | int* encryptCode) { |
| 1408 | *decryptBin = nullptr; |
| 1409 | #if defined(HAVE_BLOWFISH_H) |
| 1410 | int outBufSize = 0; |
| 1411 | if (amd::isEncryptedBIF(binaryIn, (int)size, &outBufSize)) { |
| 1412 | char* outBuf = new (std::nothrow) char[outBufSize]; |
| 1413 | if (outBuf == nullptr) { |
| 1414 | return false; |
| 1415 | } |
| 1416 | |
| 1417 | // Decrypt |
| 1418 | int outDataSize = 0; |
| 1419 | if (!amd::oclDecrypt(binaryIn, (int)size, outBuf, outBufSize, &outDataSize)) { |
| 1420 | delete[] outBuf; |
| 1421 | DevLogError("Cannot Decrypt Image \n"); |
| 1422 | return false; |
| 1423 | } |
| 1424 | |
| 1425 | *decryptBin = reinterpret_cast<char*>(outBuf); |
| 1426 | *decryptSize = outDataSize; |
| 1427 | *encryptCode = 1; |
| 1428 | } |
| 1429 | #endif |
| 1430 | return true; |
| 1431 | } |
| 1432 | |
| 1433 | bool ClBinary::setElfIn() { |
| 1434 | if (elfIn_) return true; |
no outgoing calls
no test coverage detected