Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string encryption pass #18

Open
wants to merge 12 commits into
base: llvm-3.4
Choose a base branch
from
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