Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
61bcdefg committed Dec 6, 2022
1 parent b269c59 commit 6497be7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 22 deletions.
67 changes: 45 additions & 22 deletions llvm/lib/Transforms/Obfuscation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
add_llvm_component_library(LLVMObfuscation
FunctionCallObfuscate.cpp
CryptoUtils.cpp
BogusControlFlow.cpp
SubstituteImpl.cpp
Substitution.cpp
Flattening.cpp
Utils.cpp
SplitBasicBlocks.cpp
AntiClassDump.cpp
AntiDebugging.cpp
AntiHooking.cpp
StringEncryption.cpp
IndirectBranch.cpp
FunctionWrapper.cpp
ConstantEncryption.cpp
Obfuscation.cpp
DEPENDS
intrinsics_gen
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
add_llvm_component_library(LLVMObfuscation
FunctionCallObfuscate.cpp
CryptoUtils.cpp
BogusControlFlow.cpp
SubstituteImpl.cpp
Substitution.cpp
Flattening.cpp
Utils.cpp
SplitBasicBlocks.cpp
AntiClassDump.cpp
AntiDebugging.cpp
AntiHooking.cpp
StringEncryption.cpp
IndirectBranch.cpp
FunctionWrapper.cpp
ConstantEncryption.cpp
Obfuscation.cpp
DEPENDS
intrinsics_gen

LINK_COMPONENTS
Linker
)
LINK_COMPONENTS
Linker
)
else()
add_llvm_component_library(LLVMObfuscation
FunctionCallObfuscate.cpp
CryptoUtils.cpp
BogusControlFlow.cpp
SubstituteImpl.cpp
Substitution.cpp
Flattening.cpp
Utils.cpp
SplitBasicBlocks.cpp
AntiClassDump.cpp
AntiDebugging.cpp
AntiHooking.cpp
StringEncryption.cpp
IndirectBranch.cpp
FunctionWrapper.cpp
ConstantEncryption.cpp
Obfuscation.cpp
DEPENDS
intrinsics_gen
)
endif()
execute_process(
COMMAND git log -1 --format=%H
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Transforms/Obfuscation/ConstantEncryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ struct ConstantEncryption : public ModulePass {
if (!(cryptoutils->get_range(100) <= ObfProbRate))
continue;
for (unsigned i = 0; i < I.getNumOperands(); i++) {
if (isa<SwitchInst>(&I) && i != 0)
break;
Value *Op = I.getOperand(i);
if (isa<ConstantInt>(Op))
HandleConstantIntOperand(&I, i);
Expand All @@ -97,6 +99,8 @@ struct ConstantEncryption : public ModulePass {
continue;
for (unsigned int i = 0; i < I.getNumOperands(); i++)
if (ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(i))) {
if (isa<SwitchInst>(&I) && i != 0)
break;
GlobalVariable *GV = new GlobalVariable(
M, CI->getType(), false,
GlobalValue::LinkageTypes::PrivateLinkage,
Expand Down

0 comments on commit 6497be7

Please sign in to comment.