Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > d4a6745d7fbd92dfb64dce5e91e08f80 > files > 201

lib64meanwhile1-doc-1.0.2-1mdv2008.1.x86_64.rpm

\hypertarget{mw__cipher_8h}{
\section{mw\_\-cipher.h File Reference}
\label{mw__cipher_8h}\index{mw\_\-cipher.h@{mw\_\-cipher.h}}
}


{\tt \#include $<$glib.h$>$}\par
{\tt \#include \char`\"{}mw\_\-common.h\char`\"{}}\par
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{structmwCipher}{mwCipher}
\begin{CompactList}\small\item\em A cipher. \item\end{CompactList}\item 
struct \hyperlink{structmwCipherInstance}{mwCipherInstance}
\begin{CompactList}\small\item\em An instance of a cipher. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$($\ast$ \hyperlink{mw__cipher_8h_866fc29431a5cd1c3c49e9b1e8b09800}{mwCipherInstantiator} )(struct \hyperlink{structmwCipher}{mwCipher} $\ast$cipher, struct \hyperlink{structmwChannel}{mwChannel} $\ast$chan)
\begin{CompactList}\small\item\em Obtain an instance of a given cipher, which can be used for the processing of a single channel. \item\end{CompactList}\item 
typedef int($\ast$ \hyperlink{mw__cipher_8h_130909e22689a8b83c70572af9850bef}{mwCipherProcessor} )(struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$data)
\begin{CompactList}\small\item\em Process (encrypt or decrypt, depending) the given data. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{mw__cipher_8h_3d1e1cc055146237e1b8e638c5005a70}{mwCipherType} \{ \par
\hyperlink{mw__cipher_8h_3d1e1cc055146237e1b8e638c5005a70b67b342eb4ad1f28624235e7d2b1509b}{mwCipher\_\-RC2\_\-40} =  0x0000, 
\par
\hyperlink{mw__cipher_8h_3d1e1cc055146237e1b8e638c5005a70b9732b499466e669cf5f8de3e09770f8}{mwCipher\_\-RC2\_\-128} =  0x0001
 \}
\begin{CompactList}\small\item\em Common cipher types. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{mw__cipher_8h_4d6a169e214b8e6b60e6fb2e7c5c51bd}{mwCipher\_\-free} (struct \hyperlink{structmwCipher}{mwCipher} $\ast$cipher)
\begin{CompactList}\small\item\em destroy a cipher \item\end{CompactList}\item 
const char $\ast$ \hyperlink{mw__cipher_8h_2fe3c59366be8e33dea3ea8089f17309}{mwCipher\_\-getDesc} (struct \hyperlink{structmwCipher}{mwCipher} $\ast$cipher)
\item 
const char $\ast$ \hyperlink{mw__cipher_8h_57a44521a627c04f67fd26b6112c232e}{mwCipher\_\-getName} (struct \hyperlink{structmwCipher}{mwCipher} $\ast$cipher)
\item 
struct \hyperlink{structmwSession}{mwSession} $\ast$ \hyperlink{mw__cipher_8h_ca7df61aefa4a1eda2776c9d11d66c04}{mwCipher\_\-getSession} (struct \hyperlink{structmwCipher}{mwCipher} $\ast$cipher)
\item 
guint16 \hyperlink{mw__cipher_8h_9c78471afd459b09ddf5e544d9a07f56}{mwCipher\_\-getType} (struct \hyperlink{structmwCipher}{mwCipher} $\ast$cipher)
\item 
struct \hyperlink{structmwCipher}{mwCipher} $\ast$ \hyperlink{mw__cipher_8h_8994381485d3dd43b72933a6043c74cd}{mwCipher\_\-new\_\-RC2\_\-128} (struct \hyperlink{structmwSession}{mwSession} $\ast$s)
\item 
struct \hyperlink{structmwCipher}{mwCipher} $\ast$ \hyperlink{mw__cipher_8h_42e8c2c577767f23154b2c1f09fd15e0}{mwCipher\_\-new\_\-RC2\_\-40} (struct \hyperlink{structmwSession}{mwSession} $\ast$s)
\item 
struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ \hyperlink{mw__cipher_8h_0d03f56fb313094c1129a4e8086cfce3}{mwCipher\_\-newInstance} (struct \hyperlink{structmwCipher}{mwCipher} $\ast$cipher, struct \hyperlink{structmwChannel}{mwChannel} $\ast$channel)
\item 
struct \hyperlink{structmwEncryptItem}{mwEncryptItem} $\ast$ \hyperlink{mw__cipher_8h_68d12ba00aadc58033d326d3393c9a58}{mwCipherInstance\_\-accept} (struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci)
\begin{CompactList}\small\item\em Accept a cipher offered to our channel. \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_12cef66d5336ee880cdd812c2dbe7ff3}{mwCipherInstance\_\-accepted} (struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci, struct \hyperlink{structmwEncryptItem}{mwEncryptItem} $\ast$item)
\begin{CompactList}\small\item\em Indicates an offered cipher has been accepted. \item\end{CompactList}\item 
int \hyperlink{mw__cipher_8h_20e64408792db9e2845f8a7865eefe65}{mwCipherInstance\_\-decrypt} (struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$data)
\begin{CompactList}\small\item\em decrypt data \item\end{CompactList}\item 
int \hyperlink{mw__cipher_8h_fbdb09cd3991970596b9e7ad1865a4b5}{mwCipherInstance\_\-encrypt} (struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$data)
\begin{CompactList}\small\item\em encrypt data \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_302cdec8d916252920962bc7aefe39a4}{mwCipherInstance\_\-free} (struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci)
\begin{CompactList}\small\item\em destroy a cipher instance \item\end{CompactList}\item 
struct \hyperlink{structmwChannel}{mwChannel} $\ast$ \hyperlink{mw__cipher_8h_d1a85931da52a2d26072f92e046e5027}{mwCipherInstance\_\-getChannel} (struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci)
\begin{CompactList}\small\item\em reference the channel a cipher instance is attached to \item\end{CompactList}\item 
struct \hyperlink{structmwCipher}{mwCipher} $\ast$ \hyperlink{mw__cipher_8h_014d426ae329bf07cc3c49d46d7482b4}{mwCipherInstance\_\-getCipher} (struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci)
\begin{CompactList}\small\item\em reference the parent cipher of an instance \item\end{CompactList}\item 
struct \hyperlink{structmwEncryptItem}{mwEncryptItem} $\ast$ \hyperlink{mw__cipher_8h_c9b0176eb3578c5e0b5d1aefb75921c1}{mwCipherInstance\_\-offer} (struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci)
\begin{CompactList}\small\item\em Offer a cipher. \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_ca54b3578379f8f7e8a3497643d9ff52}{mwCipherInstance\_\-offered} (struct \hyperlink{structmwCipherInstance}{mwCipherInstance} $\ast$ci, struct \hyperlink{structmwEncryptItem}{mwEncryptItem} $\ast$item)
\begin{CompactList}\small\item\em Indicates a cipher has been offered to our channel. \item\end{CompactList}\end{CompactItemize}
\begin{Indent}{\bf }\par
\begin{CompactItemize}
\item 
void \hyperlink{mw__cipher_8h_1ea4d9e89089fcde39ff462a5404e704}{mwDecrypt} (const guchar $\ast$key, gsize keylen, guchar $\ast$iv, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$in, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$out)
\begin{CompactList}\small\item\em Decrypt data using an expanded form of the given key. \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_cb001137b268c78457e75185fdbbd9c9}{mwDecryptExpanded} (const int $\ast$ekey, guchar $\ast$iv, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$in, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$out)
\begin{CompactList}\small\item\em Decrypt data using an already expanded key. \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_4ff69a2373683cbecb91039dd1a46fa1}{mwEncrypt} (const guchar $\ast$key, gsize keylen, guchar $\ast$iv, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$in, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$out)
\begin{CompactList}\small\item\em Encrypt data using an expanded form of the given key. \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_934b08511236b5e8cf80c22acc937f51}{mwEncryptExpanded} (const int $\ast$ekey, guchar $\ast$iv, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$in, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$out)
\begin{CompactList}\small\item\em Encrypt data using an already-expanded key. \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_4164e217eb715d505ee0bb1d75d983f1}{mwIV\_\-init} (guchar $\ast$iv)
\begin{CompactList}\small\item\em Setup an Initialization Vector. \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_1fb65f55e064360183cee4bbe2a93c19}{mwKeyExpand} (int $\ast$ekey, const guchar $\ast$key, gsize keylen)
\begin{CompactList}\small\item\em Expand a variable-length key into a 128-byte key (represented as an an array of 64 ints). \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_4606773752ee1a6ff4a44c217a39e348}{mwKeyRandom} (guchar $\ast$key, gsize keylen)
\begin{CompactList}\small\item\em generate some pseudo-random bytes \item\end{CompactList}\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf }\par
\begin{CompactItemize}
\item 
void \hyperlink{mw__cipher_8h_796525794edf3887ab94eefb748bcf91}{mwMpi\_\-calculateDHShared} (struct \hyperlink{structmwMpi}{mwMpi} $\ast$shared\_\-key, struct \hyperlink{structmwMpi}{mwMpi} $\ast$remote\_\-key, struct \hyperlink{structmwMpi}{mwMpi} $\ast$private\_\-key)
\begin{CompactList}\small\item\em sets the shared key value based on the remote and private keys, using the Sametime Prime and Base \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_389f3d2f174e66810a92ee93d5035967}{mwMpi\_\-export} (struct \hyperlink{structmwMpi}{mwMpi} $\ast$i, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$o)
\begin{CompactList}\small\item\em Export a value into an opaque. \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_674f737698d67c52dce06f54151909ef}{mwMpi\_\-free} (struct \hyperlink{structmwMpi}{mwMpi} $\ast$i)
\begin{CompactList}\small\item\em destroy an mpi value \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_4dcaf6196943a70f723c828cab35f0c1}{mwMpi\_\-import} (struct \hyperlink{structmwMpi}{mwMpi} $\ast$i, struct \hyperlink{structmwOpaque}{mwOpaque} $\ast$o)
\begin{CompactList}\small\item\em Import a value from an opaque. \item\end{CompactList}\item 
struct \hyperlink{structmwMpi}{mwMpi} $\ast$ \hyperlink{mw__cipher_8h_b473b17d569e7566081cad121f75f23e}{mwMpi\_\-new} ()
\begin{CompactList}\small\item\em prepare a new mpi value \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_95e8808f20ea58c66014a052375c5fe4}{mwMpi\_\-randDHKeypair} (struct \hyperlink{structmwMpi}{mwMpi} $\ast$private\_\-key, struct \hyperlink{structmwMpi}{mwMpi} $\ast$public\_\-key)
\begin{CompactList}\small\item\em sets private to a randomly generated value, and calculates public using the Sametime Prime and Base \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_dd1ffe92fc1c256fa767a34d58433dd1}{mwMpi\_\-setDHBase} (struct \hyperlink{structmwMpi}{mwMpi} $\ast$i)
\begin{CompactList}\small\item\em set a big integer to the Sametime Base value \item\end{CompactList}\item 
void \hyperlink{mw__cipher_8h_892796c968b68d71e67b678a87504d20}{mwMpi\_\-setDHPrime} (struct \hyperlink{structmwMpi}{mwMpi} $\ast$i)
\begin{CompactList}\small\item\em set a big integer to the Sametime Prime value \item\end{CompactList}\end{CompactItemize}
\end{Indent}


\subsection{Typedef Documentation}
\hypertarget{mw__cipher_8h_866fc29431a5cd1c3c49e9b1e8b09800}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherInstantiator@{mwCipherInstantiator}}
\index{mwCipherInstantiator@{mwCipherInstantiator}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf mwCipherInstance}$\ast$($\ast$ {\bf mwCipherInstantiator})(struct {\bf mwCipher} $\ast$cipher, struct {\bf mwChannel} $\ast$chan)}}
\label{mw__cipher_8h_866fc29431a5cd1c3c49e9b1e8b09800}


Obtain an instance of a given cipher, which can be used for the processing of a single channel. 

\hypertarget{mw__cipher_8h_130909e22689a8b83c70572af9850bef}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherProcessor@{mwCipherProcessor}}
\index{mwCipherProcessor@{mwCipherProcessor}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ {\bf mwCipherProcessor})(struct {\bf mwCipherInstance} $\ast$ci, struct {\bf mwOpaque} $\ast$data)}}
\label{mw__cipher_8h_130909e22689a8b83c70572af9850bef}


Process (encrypt or decrypt, depending) the given data. 

The passed buffer may be freed in processing and be replaced with a freshly allocated buffer. The post-processed buffer must in turn be freed after use 

\subsection{Enumeration Type Documentation}
\hypertarget{mw__cipher_8h_3d1e1cc055146237e1b8e638c5005a70}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherType@{mwCipherType}}
\index{mwCipherType@{mwCipherType}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf mwCipherType}}}
\label{mw__cipher_8h_3d1e1cc055146237e1b8e638c5005a70}


Common cipher types. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{mwCipher\_\-RC2\_\-40@{mwCipher\_\-RC2\_\-40}!mw\_\-cipher.h@{mw\_\-cipher.h}}\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipher\_\-RC2\_\-40@{mwCipher\_\-RC2\_\-40}}\item[{\em 
\hypertarget{mw__cipher_8h_3d1e1cc055146237e1b8e638c5005a70b67b342eb4ad1f28624235e7d2b1509b}{
mwCipher\_\-RC2\_\-40}
\label{mw__cipher_8h_3d1e1cc055146237e1b8e638c5005a70b67b342eb4ad1f28624235e7d2b1509b}
}]\index{mwCipher\_\-RC2\_\-128@{mwCipher\_\-RC2\_\-128}!mw\_\-cipher.h@{mw\_\-cipher.h}}\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipher\_\-RC2\_\-128@{mwCipher\_\-RC2\_\-128}}\item[{\em 
\hypertarget{mw__cipher_8h_3d1e1cc055146237e1b8e638c5005a70b9732b499466e669cf5f8de3e09770f8}{
mwCipher\_\-RC2\_\-128}
\label{mw__cipher_8h_3d1e1cc055146237e1b8e638c5005a70b9732b499466e669cf5f8de3e09770f8}
}]\end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{mw__cipher_8h_4d6a169e214b8e6b60e6fb2e7c5c51bd}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipher\_\-free@{mwCipher\_\-free}}
\index{mwCipher\_\-free@{mwCipher\_\-free}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwCipher\_\-free (struct {\bf mwCipher} $\ast$ {\em cipher})}}
\label{mw__cipher_8h_4d6a169e214b8e6b60e6fb2e7c5c51bd}


destroy a cipher 

\hypertarget{mw__cipher_8h_2fe3c59366be8e33dea3ea8089f17309}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipher\_\-getDesc@{mwCipher\_\-getDesc}}
\index{mwCipher\_\-getDesc@{mwCipher\_\-getDesc}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ mwCipher\_\-getDesc (struct {\bf mwCipher} $\ast$ {\em cipher})}}
\label{mw__cipher_8h_2fe3c59366be8e33dea3ea8089f17309}


\hypertarget{mw__cipher_8h_57a44521a627c04f67fd26b6112c232e}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipher\_\-getName@{mwCipher\_\-getName}}
\index{mwCipher\_\-getName@{mwCipher\_\-getName}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ mwCipher\_\-getName (struct {\bf mwCipher} $\ast$ {\em cipher})}}
\label{mw__cipher_8h_57a44521a627c04f67fd26b6112c232e}


\hypertarget{mw__cipher_8h_ca7df61aefa4a1eda2776c9d11d66c04}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipher\_\-getSession@{mwCipher\_\-getSession}}
\index{mwCipher\_\-getSession@{mwCipher\_\-getSession}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwSession}$\ast$ mwCipher\_\-getSession (struct {\bf mwCipher} $\ast$ {\em cipher})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__cipher_8h_ca7df61aefa4a1eda2776c9d11d66c04}


\hypertarget{mw__cipher_8h_9c78471afd459b09ddf5e544d9a07f56}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipher\_\-getType@{mwCipher\_\-getType}}
\index{mwCipher\_\-getType@{mwCipher\_\-getType}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}guint16 mwCipher\_\-getType (struct {\bf mwCipher} $\ast$ {\em cipher})}}
\label{mw__cipher_8h_9c78471afd459b09ddf5e544d9a07f56}


\hypertarget{mw__cipher_8h_8994381485d3dd43b72933a6043c74cd}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipher\_\-new\_\-RC2\_\-128@{mwCipher\_\-new\_\-RC2\_\-128}}
\index{mwCipher\_\-new\_\-RC2\_\-128@{mwCipher\_\-new\_\-RC2\_\-128}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwCipher}$\ast$ mwCipher\_\-new\_\-RC2\_\-128 (struct {\bf mwSession} $\ast$ {\em s})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__cipher_8h_8994381485d3dd43b72933a6043c74cd}


\hypertarget{mw__cipher_8h_42e8c2c577767f23154b2c1f09fd15e0}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipher\_\-new\_\-RC2\_\-40@{mwCipher\_\-new\_\-RC2\_\-40}}
\index{mwCipher\_\-new\_\-RC2\_\-40@{mwCipher\_\-new\_\-RC2\_\-40}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwCipher}$\ast$ mwCipher\_\-new\_\-RC2\_\-40 (struct {\bf mwSession} $\ast$ {\em s})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__cipher_8h_42e8c2c577767f23154b2c1f09fd15e0}


\hypertarget{mw__cipher_8h_0d03f56fb313094c1129a4e8086cfce3}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipher\_\-newInstance@{mwCipher\_\-newInstance}}
\index{mwCipher\_\-newInstance@{mwCipher\_\-newInstance}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwCipherInstance}$\ast$ mwCipher\_\-newInstance (struct {\bf mwCipher} $\ast$ {\em cipher}, struct {\bf mwChannel} $\ast$ {\em channel})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__cipher_8h_0d03f56fb313094c1129a4e8086cfce3}


\hypertarget{mw__cipher_8h_68d12ba00aadc58033d326d3393c9a58}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherInstance\_\-accept@{mwCipherInstance\_\-accept}}
\index{mwCipherInstance\_\-accept@{mwCipherInstance\_\-accept}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwEncryptItem}$\ast$ mwCipherInstance\_\-accept (struct {\bf mwCipherInstance} $\ast$ {\em ci})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__cipher_8h_68d12ba00aadc58033d326d3393c9a58}


Accept a cipher offered to our channel. 

\hypertarget{mw__cipher_8h_12cef66d5336ee880cdd812c2dbe7ff3}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherInstance\_\-accepted@{mwCipherInstance\_\-accepted}}
\index{mwCipherInstance\_\-accepted@{mwCipherInstance\_\-accepted}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwCipherInstance\_\-accepted (struct {\bf mwCipherInstance} $\ast$ {\em ci}, struct {\bf mwEncryptItem} $\ast$ {\em item})}}
\label{mw__cipher_8h_12cef66d5336ee880cdd812c2dbe7ff3}


Indicates an offered cipher has been accepted. 

\hypertarget{mw__cipher_8h_20e64408792db9e2845f8a7865eefe65}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherInstance\_\-decrypt@{mwCipherInstance\_\-decrypt}}
\index{mwCipherInstance\_\-decrypt@{mwCipherInstance\_\-decrypt}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mwCipherInstance\_\-decrypt (struct {\bf mwCipherInstance} $\ast$ {\em ci}, struct {\bf mwOpaque} $\ast$ {\em data})}}
\label{mw__cipher_8h_20e64408792db9e2845f8a7865eefe65}


decrypt data 

\hypertarget{mw__cipher_8h_fbdb09cd3991970596b9e7ad1865a4b5}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherInstance\_\-encrypt@{mwCipherInstance\_\-encrypt}}
\index{mwCipherInstance\_\-encrypt@{mwCipherInstance\_\-encrypt}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mwCipherInstance\_\-encrypt (struct {\bf mwCipherInstance} $\ast$ {\em ci}, struct {\bf mwOpaque} $\ast$ {\em data})}}
\label{mw__cipher_8h_fbdb09cd3991970596b9e7ad1865a4b5}


encrypt data 

\hypertarget{mw__cipher_8h_302cdec8d916252920962bc7aefe39a4}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherInstance\_\-free@{mwCipherInstance\_\-free}}
\index{mwCipherInstance\_\-free@{mwCipherInstance\_\-free}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwCipherInstance\_\-free (struct {\bf mwCipherInstance} $\ast$ {\em ci})}}
\label{mw__cipher_8h_302cdec8d916252920962bc7aefe39a4}


destroy a cipher instance 

\hypertarget{mw__cipher_8h_d1a85931da52a2d26072f92e046e5027}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherInstance\_\-getChannel@{mwCipherInstance\_\-getChannel}}
\index{mwCipherInstance\_\-getChannel@{mwCipherInstance\_\-getChannel}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwChannel}$\ast$ mwCipherInstance\_\-getChannel (struct {\bf mwCipherInstance} $\ast$ {\em ci})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__cipher_8h_d1a85931da52a2d26072f92e046e5027}


reference the channel a cipher instance is attached to 

\hypertarget{mw__cipher_8h_014d426ae329bf07cc3c49d46d7482b4}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherInstance\_\-getCipher@{mwCipherInstance\_\-getCipher}}
\index{mwCipherInstance\_\-getCipher@{mwCipherInstance\_\-getCipher}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwCipher}$\ast$ mwCipherInstance\_\-getCipher (struct {\bf mwCipherInstance} $\ast$ {\em ci})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__cipher_8h_014d426ae329bf07cc3c49d46d7482b4}


reference the parent cipher of an instance 

\hypertarget{mw__cipher_8h_c9b0176eb3578c5e0b5d1aefb75921c1}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherInstance\_\-offer@{mwCipherInstance\_\-offer}}
\index{mwCipherInstance\_\-offer@{mwCipherInstance\_\-offer}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwEncryptItem}$\ast$ mwCipherInstance\_\-offer (struct {\bf mwCipherInstance} $\ast$ {\em ci})\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__cipher_8h_c9b0176eb3578c5e0b5d1aefb75921c1}


Offer a cipher. 

\hypertarget{mw__cipher_8h_ca54b3578379f8f7e8a3497643d9ff52}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwCipherInstance\_\-offered@{mwCipherInstance\_\-offered}}
\index{mwCipherInstance\_\-offered@{mwCipherInstance\_\-offered}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwCipherInstance\_\-offered (struct {\bf mwCipherInstance} $\ast$ {\em ci}, struct {\bf mwEncryptItem} $\ast$ {\em item})}}
\label{mw__cipher_8h_ca54b3578379f8f7e8a3497643d9ff52}


Indicates a cipher has been offered to our channel. 

\hypertarget{mw__cipher_8h_1ea4d9e89089fcde39ff462a5404e704}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwDecrypt@{mwDecrypt}}
\index{mwDecrypt@{mwDecrypt}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwDecrypt (const guchar $\ast$ {\em key}, gsize {\em keylen}, guchar $\ast$ {\em iv}, struct {\bf mwOpaque} $\ast$ {\em in}, struct {\bf mwOpaque} $\ast$ {\em out})}}
\label{mw__cipher_8h_1ea4d9e89089fcde39ff462a5404e704}


Decrypt data using an expanded form of the given key. 

\hypertarget{mw__cipher_8h_cb001137b268c78457e75185fdbbd9c9}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwDecryptExpanded@{mwDecryptExpanded}}
\index{mwDecryptExpanded@{mwDecryptExpanded}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwDecryptExpanded (const int $\ast$ {\em ekey}, guchar $\ast$ {\em iv}, struct {\bf mwOpaque} $\ast$ {\em in}, struct {\bf mwOpaque} $\ast$ {\em out})}}
\label{mw__cipher_8h_cb001137b268c78457e75185fdbbd9c9}


Decrypt data using an already expanded key. 

\hypertarget{mw__cipher_8h_4ff69a2373683cbecb91039dd1a46fa1}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwEncrypt@{mwEncrypt}}
\index{mwEncrypt@{mwEncrypt}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwEncrypt (const guchar $\ast$ {\em key}, gsize {\em keylen}, guchar $\ast$ {\em iv}, struct {\bf mwOpaque} $\ast$ {\em in}, struct {\bf mwOpaque} $\ast$ {\em out})}}
\label{mw__cipher_8h_4ff69a2373683cbecb91039dd1a46fa1}


Encrypt data using an expanded form of the given key. 

\hypertarget{mw__cipher_8h_934b08511236b5e8cf80c22acc937f51}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwEncryptExpanded@{mwEncryptExpanded}}
\index{mwEncryptExpanded@{mwEncryptExpanded}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwEncryptExpanded (const int $\ast$ {\em ekey}, guchar $\ast$ {\em iv}, struct {\bf mwOpaque} $\ast$ {\em in}, struct {\bf mwOpaque} $\ast$ {\em out})}}
\label{mw__cipher_8h_934b08511236b5e8cf80c22acc937f51}


Encrypt data using an already-expanded key. 

\hypertarget{mw__cipher_8h_4164e217eb715d505ee0bb1d75d983f1}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwIV\_\-init@{mwIV\_\-init}}
\index{mwIV\_\-init@{mwIV\_\-init}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwIV\_\-init (guchar $\ast$ {\em iv})}}
\label{mw__cipher_8h_4164e217eb715d505ee0bb1d75d983f1}


Setup an Initialization Vector. 

IV must be at least 8 bytes \hypertarget{mw__cipher_8h_1fb65f55e064360183cee4bbe2a93c19}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwKeyExpand@{mwKeyExpand}}
\index{mwKeyExpand@{mwKeyExpand}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwKeyExpand (int $\ast$ {\em ekey}, const guchar $\ast$ {\em key}, gsize {\em keylen})}}
\label{mw__cipher_8h_1fb65f55e064360183cee4bbe2a93c19}


Expand a variable-length key into a 128-byte key (represented as an an array of 64 ints). 

\hypertarget{mw__cipher_8h_4606773752ee1a6ff4a44c217a39e348}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwKeyRandom@{mwKeyRandom}}
\index{mwKeyRandom@{mwKeyRandom}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwKeyRandom (guchar $\ast$ {\em key}, gsize {\em keylen})}}
\label{mw__cipher_8h_4606773752ee1a6ff4a44c217a39e348}


generate some pseudo-random bytes 

\hypertarget{mw__cipher_8h_General}{}\subsection{Cipher Functions}\label{mw__cipher_8h_General}
These functions are reused where encryption is necessary outside of a channel (eg. session authentication)\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em keylen}]count of bytes to write into key \item[{\em key}]buffer to write keys into \end{description}
\end{Desc}
\hypertarget{mw__cipher_8h_796525794edf3887ab94eefb748bcf91}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwMpi\_\-calculateDHShared@{mwMpi\_\-calculateDHShared}}
\index{mwMpi\_\-calculateDHShared@{mwMpi\_\-calculateDHShared}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwMpi\_\-calculateDHShared (struct {\bf mwMpi} $\ast$ {\em shared\_\-key}, struct {\bf mwMpi} $\ast$ {\em remote\_\-key}, struct {\bf mwMpi} $\ast$ {\em private\_\-key})}}
\label{mw__cipher_8h_796525794edf3887ab94eefb748bcf91}


sets the shared key value based on the remote and private keys, using the Sametime Prime and Base 

\hypertarget{mw__cipher_8h_389f3d2f174e66810a92ee93d5035967}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwMpi\_\-export@{mwMpi\_\-export}}
\index{mwMpi\_\-export@{mwMpi\_\-export}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwMpi\_\-export (struct {\bf mwMpi} $\ast$ {\em i}, struct {\bf mwOpaque} $\ast$ {\em o})}}
\label{mw__cipher_8h_389f3d2f174e66810a92ee93d5035967}


Export a value into an opaque. 

\hypertarget{mw__cipher_8h_674f737698d67c52dce06f54151909ef}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwMpi\_\-free@{mwMpi\_\-free}}
\index{mwMpi\_\-free@{mwMpi\_\-free}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwMpi\_\-free (struct {\bf mwMpi} $\ast$ {\em i})}}
\label{mw__cipher_8h_674f737698d67c52dce06f54151909ef}


destroy an mpi value 

\hypertarget{mw__cipher_8h_4dcaf6196943a70f723c828cab35f0c1}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwMpi\_\-import@{mwMpi\_\-import}}
\index{mwMpi\_\-import@{mwMpi\_\-import}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwMpi\_\-import (struct {\bf mwMpi} $\ast$ {\em i}, struct {\bf mwOpaque} $\ast$ {\em o})}}
\label{mw__cipher_8h_4dcaf6196943a70f723c828cab35f0c1}


Import a value from an opaque. 

\hypertarget{mw__cipher_8h_b473b17d569e7566081cad121f75f23e}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwMpi\_\-new@{mwMpi\_\-new}}
\index{mwMpi\_\-new@{mwMpi\_\-new}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mwMpi}$\ast$ mwMpi\_\-new ()\hspace{0.3cm}{\tt  \mbox{[}read\mbox{]}}}}
\label{mw__cipher_8h_b473b17d569e7566081cad121f75f23e}


prepare a new mpi value 

\hypertarget{mw__cipher_8h_95e8808f20ea58c66014a052375c5fe4}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwMpi\_\-randDHKeypair@{mwMpi\_\-randDHKeypair}}
\index{mwMpi\_\-randDHKeypair@{mwMpi\_\-randDHKeypair}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwMpi\_\-randDHKeypair (struct {\bf mwMpi} $\ast$ {\em private\_\-key}, struct {\bf mwMpi} $\ast$ {\em public\_\-key})}}
\label{mw__cipher_8h_95e8808f20ea58c66014a052375c5fe4}


sets private to a randomly generated value, and calculates public using the Sametime Prime and Base 

\hypertarget{mw__cipher_8h_dd1ffe92fc1c256fa767a34d58433dd1}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwMpi\_\-setDHBase@{mwMpi\_\-setDHBase}}
\index{mwMpi\_\-setDHBase@{mwMpi\_\-setDHBase}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwMpi\_\-setDHBase (struct {\bf mwMpi} $\ast$ {\em i})}}
\label{mw__cipher_8h_dd1ffe92fc1c256fa767a34d58433dd1}


set a big integer to the Sametime Base value 

\hypertarget{mw__cipher_8h_892796c968b68d71e67b678a87504d20}{
\index{mw\_\-cipher.h@{mw\_\-cipher.h}!mwMpi\_\-setDHPrime@{mwMpi\_\-setDHPrime}}
\index{mwMpi\_\-setDHPrime@{mwMpi\_\-setDHPrime}!mw_cipher.h@{mw\_\-cipher.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void mwMpi\_\-setDHPrime (struct {\bf mwMpi} $\ast$ {\em i})}}
\label{mw__cipher_8h_892796c968b68d71e67b678a87504d20}


set a big integer to the Sametime Prime value