\hypertarget{classtheo_1_1obf_1_1reloc__transform__pass__t}{}\doxysection{theo\+::obf\+::reloc\+\_\+transform\+\_\+pass\+\_\+t Class Reference}
\label{classtheo_1_1obf_1_1reloc__transform__pass__t}\index{theo::obf::reloc\_transform\_pass\_t@{theo::obf::reloc\_transform\_pass\_t}}


this pass is like the next\+\_\+inst\+\_\+pass, however, relocations are encrypted with transformations instead of the address of the next instruction. this pass only runs at the instruction level and appends transformations into the reloc\+\_\+t object of the instruction symbol.  




{\ttfamily \#include $<$reloc\+\_\+transform\+\_\+pass.\+hpp$>$}

Inheritance diagram for theo\+::obf\+::reloc\+\_\+transform\+\_\+pass\+\_\+t\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{dc/d39/classtheo_1_1obf_1_1reloc__transform__pass__t}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{classtheo_1_1obf_1_1reloc__transform__pass__t_a24e122f6be18a88ea1809252ab3ec0b9}{run}} (\mbox{\hyperlink{classtheo_1_1decomp_1_1symbol__t}{decomp\+::symbol\+\_\+t}} $\ast$sym)
\begin{DoxyCompactList}\small\item\em virtual method which must be implimented by the pass that inherits this class. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \mbox{\hyperlink{classtheo_1_1obf_1_1reloc__transform__pass__t}{reloc\+\_\+transform\+\_\+pass\+\_\+t}} $\ast$ \mbox{\hyperlink{classtheo_1_1obf_1_1reloc__transform__pass__t_a89aa46da5f721057cd8cf5189207d464}{get}} ()
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
this pass is like the next\+\_\+inst\+\_\+pass, however, relocations are encrypted with transformations instead of the address of the next instruction. this pass only runs at the instruction level and appends transformations into the reloc\+\_\+t object of the instruction symbol. 

given the following code\+: \begin{DoxyVerb}mov rax, &MessageBoxA
\end{DoxyVerb}
 this pass will generate a random number of transformations to encrypt the address of \char`\"{}\+Message\+Box\+A\char`\"{}. These transformations will then be applied by theodosius internally when resolving relocations. \begin{DoxyVerb}mov rax, enc_MessageBoxA
xor rax, 0x389284324
add rax, 0x345332567
ror rax, 0x5353
\end{DoxyVerb}


\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classtheo_1_1obf_1_1reloc__transform__pass__t_a89aa46da5f721057cd8cf5189207d464}\label{classtheo_1_1obf_1_1reloc__transform__pass__t_a89aa46da5f721057cd8cf5189207d464}} 
\index{theo::obf::reloc\_transform\_pass\_t@{theo::obf::reloc\_transform\_pass\_t}!get@{get}}
\index{get@{get}!theo::obf::reloc\_transform\_pass\_t@{theo::obf::reloc\_transform\_pass\_t}}
\doxysubsubsection{\texorpdfstring{get()}{get()}}
{\footnotesize\ttfamily \mbox{\hyperlink{classtheo_1_1obf_1_1reloc__transform__pass__t}{reloc\+\_\+transform\+\_\+pass\+\_\+t}} $\ast$ theo\+::obf\+::reloc\+\_\+transform\+\_\+pass\+\_\+t\+::get (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}


\begin{DoxyCode}{0}
\DoxyCodeLine{34                                                     \{}
\DoxyCodeLine{35   \textcolor{keyword}{static} reloc\_transform\_pass\_t obj;}
\DoxyCodeLine{36   \textcolor{keywordflow}{return} \&obj;}
\DoxyCodeLine{37 \}}

\end{DoxyCode}
\mbox{\Hypertarget{classtheo_1_1obf_1_1reloc__transform__pass__t_a24e122f6be18a88ea1809252ab3ec0b9}\label{classtheo_1_1obf_1_1reloc__transform__pass__t_a24e122f6be18a88ea1809252ab3ec0b9}} 
\index{theo::obf::reloc\_transform\_pass\_t@{theo::obf::reloc\_transform\_pass\_t}!run@{run}}
\index{run@{run}!theo::obf::reloc\_transform\_pass\_t@{theo::obf::reloc\_transform\_pass\_t}}
\doxysubsubsection{\texorpdfstring{run()}{run()}}
{\footnotesize\ttfamily void theo\+::obf\+::reloc\+\_\+transform\+\_\+pass\+\_\+t\+::run (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classtheo_1_1decomp_1_1symbol__t}{decomp\+::symbol\+\_\+t}} $\ast$}]{sym }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



virtual method which must be implimented by the pass that inherits this class. 


\begin{DoxyParams}{Parameters}
{\em sym} & a symbol of the same type of m\+\_\+sym\+\_\+type.\\
\hline
\end{DoxyParams}


Implements \mbox{\hyperlink{classtheo_1_1obf_1_1pass__t_acfadc013ff0754d66a18baffdb1a61d1}{theo\+::obf\+::pass\+\_\+t}}.


\begin{DoxyCode}{0}
\DoxyCodeLine{39                                                     \{}
\DoxyCodeLine{40   std::optional<recomp::reloc\_t*> reloc;}
\DoxyCodeLine{41   \textcolor{keywordflow}{if} (!(reloc = has\_legit\_reloc(sym)).has\_value())}
\DoxyCodeLine{42     \textcolor{keywordflow}{return};}
\DoxyCodeLine{43 }
\DoxyCodeLine{44   spdlog::info(\textcolor{stringliteral}{"{}adding transformations to relocation in symbol: \{\}"{}},}
\DoxyCodeLine{45                sym-\/>name());}
\DoxyCodeLine{46 }
\DoxyCodeLine{47   xed\_error\_enum\_t err;}
\DoxyCodeLine{48   xed\_decoded\_inst\_t inst;}
\DoxyCodeLine{49   xed\_state\_t istate\{XED\_MACHINE\_MODE\_LONG\_64, XED\_ADDRESS\_WIDTH\_64b\};}
\DoxyCodeLine{50   xed\_decoded\_inst\_zero\_set\_mode(\&inst, \&istate);}
\DoxyCodeLine{51 }
\DoxyCodeLine{52   \textcolor{keywordflow}{if} ((err = xed\_decode(\&inst, sym-\/>data().data(), sym-\/>data().size())) !=}
\DoxyCodeLine{53       XED\_ERROR\_NONE) \{}
\DoxyCodeLine{54     spdlog::error(\textcolor{stringliteral}{"{}failed to decode instruction, reason: \{\} in symbol: \{\}"{}},}
\DoxyCodeLine{55                   xed\_error\_enum\_t2str(err), sym-\/>name());}
\DoxyCodeLine{56 }
\DoxyCodeLine{57     assert(err == XED\_ERROR\_NONE);}
\DoxyCodeLine{58   \}}
\DoxyCodeLine{59 }
\DoxyCodeLine{60   \textcolor{keyword}{auto} transforms\_bytes = \mbox{\hyperlink{namespacetheo_1_1obf_1_1transform_a416c6c93ce55a4ab9f70592951d15704}{transform::generate}}(\&inst, reloc.value(), 3, 6);}
\DoxyCodeLine{61   sym-\/>data().insert(sym-\/>data().end(), transforms\_bytes.begin(),}
\DoxyCodeLine{62                      transforms\_bytes.end());}
\DoxyCodeLine{63 \};}

\end{DoxyCode}


The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
include/obf/passes/\mbox{\hyperlink{reloc__transform__pass_8hpp}{reloc\+\_\+transform\+\_\+pass.\+hpp}}\item 
src/obf/passes/\mbox{\hyperlink{reloc__transform__pass_8cpp}{reloc\+\_\+transform\+\_\+pass.\+cpp}}\end{DoxyCompactItemize}
