Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions include/llvm/Transforms/Obfuscation/StringEncryption.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef __STRING_ENCRYPTION_H__
#define __STRING_ENCRYPTION_H__

// LLVM include
#include "llvm/Pass.h"

using namespace llvm;

namespace llvm {
Pass* createXorStringEncryption();
}

#endif
8 changes: 8 additions & 0 deletions lib/Transforms/IPO/PassManagerBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "llvm/Transforms/Obfuscation/Substitution.h"
#include "llvm/Transforms/Obfuscation/Flattening.h"
#include "llvm/Transforms/Obfuscation/BogusControlFlow.h"
#include "llvm/Transforms/Obfuscation/StringEncryption.h"
#include "llvm/PrngAESCtr.h"


Expand Down Expand Up @@ -73,6 +74,9 @@ BogusControlFlow("bcf",cl::init(false),cl::desc("Enable bogus control flow"));
static cl::opt<bool>
Substitution("sub",cl::init(false),cl::desc("Enable instruction substitutions"));

static cl::opt<bool>
StringEncryption("xse",cl::init(false),cl::desc("Enable string encryptions"));

static cl::opt<std::string>
AesSeed("aesSeed",cl::init(""),cl::desc("seed for the AES-CTR PRNG"));

Expand Down Expand Up @@ -188,9 +192,13 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
// Substitution
if(Substitution) MPM.add(createSubstitution());

if(StringEncryption) MPM.add(createXorStringEncryption());

return;
}

if(StringEncryption) MPM.add(createXorStringEncryption());

// Add LibraryInfo if we have some.
if (LibraryInfo) MPM.add(new TargetLibraryInfo(*LibraryInfo));

Expand Down
Loading