\hypertarget{blowfish_8h}{\section{include/beecrypt/blowfish.h File Reference} \label{blowfish_8h}\index{include/beecrypt/blowfish.\-h@{include/beecrypt/blowfish.\-h}} } Blowfish block cipher. {\ttfamily \#include \char`\"{}beecrypt/beecrypt.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}beecrypt/blowfishopt.\-h\char`\"{}}\\* Include dependency graph for blowfish.\-h\-: \nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=350pt]{blowfish_8h__incl} \end{center} \end{figure} This graph shows which files directly or indirectly include this file\-: \nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=228pt]{blowfish_8h__dep__incl} \end{center} \end{figure} \subsection*{Data Structures} \begin{DoxyCompactItemize} \item struct \hyperlink{structblowfishParam}{blowfish\-Param} \begin{DoxyCompactList}\small\item\em Holds all the parameters necessary for the Blowfish cipher. \end{DoxyCompactList}\end{DoxyCompactItemize} \subsection*{Macros} \begin{DoxyCompactItemize} \item \#define \hyperlink{blowfish_8h_a320de9881e6c7560cd5b13828c420d5a}{B\-L\-O\-W\-F\-I\-S\-H\-R\-O\-U\-N\-D\-S}~16 \item \#define \hyperlink{blowfish_8h_aa638e9cb3cbf0ad5b94a25fdb9eb64c6}{B\-L\-O\-W\-F\-I\-S\-H\-P\-S\-I\-Z\-E}~(\hyperlink{blowfish_8h_a320de9881e6c7560cd5b13828c420d5a}{B\-L\-O\-W\-F\-I\-S\-H\-R\-O\-U\-N\-D\-S}+2) \end{DoxyCompactItemize} \subsection*{Functions} \begin{DoxyCompactItemize} \item int \hyperlink{blowfish_8h_acce3d0c95c67c98202e851063604819e}{blowfish\-Setup} (\hyperlink{structblowfishParam}{blowfish\-Param} $\ast$, const \hyperlink{api_8h_ab8ef12fab634c171394422d0ee8baf94}{byte} $\ast$, size\-\_\-t, \hyperlink{group__BC__m_gace10d4c0b0409d35c6a703d6445fc558}{cipher\-Operation}) \begin{DoxyCompactList}\small\item\em The function performs the cipher's key expansion. \end{DoxyCompactList}\item int \hyperlink{blowfish_8h_a56566a49f33043d7a443a7bbbcd7bd5f}{blowfish\-Set\-I\-V} (\hyperlink{structblowfishParam}{blowfish\-Param} $\ast$, const \hyperlink{api_8h_ab8ef12fab634c171394422d0ee8baf94}{byte} $\ast$iv) \begin{DoxyCompactList}\small\item\em This function sets the Initialization Vector. \end{DoxyCompactList}\item int \hyperlink{blowfish_8h_a8bd243fafbf7c52359f19ab04de13c42}{blowfish\-Set\-C\-T\-R} (\hyperlink{structblowfishParam}{blowfish\-Param} $\ast$, const \hyperlink{api_8h_ab8ef12fab634c171394422d0ee8baf94}{byte} $\ast$nivz, size\-\_\-t counter) \item int \hyperlink{blowfish_8h_a2b48ab4a1793739d266308d1033aee70}{blowfish\-Encrypt} (\hyperlink{structblowfishParam}{blowfish\-Param} $\ast$, uint32\-\_\-t $\ast$, const uint32\-\_\-t $\ast$) \begin{DoxyCompactList}\small\item\em This function performs the Blowfish encryption; it encrypts one block of 64 bits. \end{DoxyCompactList}\item int \hyperlink{blowfish_8h_a6339ebc5b30a93680c152076ddd5f033}{blowfish\-Decrypt} (\hyperlink{structblowfishParam}{blowfish\-Param} $\ast$, uint32\-\_\-t $\ast$, const uint32\-\_\-t $\ast$) \begin{DoxyCompactList}\small\item\em This function performs the Blowfish decryption; it Rderypts one block of 64 bits. \end{DoxyCompactList}\item uint32\-\_\-t $\ast$ \hyperlink{blowfish_8h_ae2137286429679c247215465d99342c5}{blowfish\-Feedback} (\hyperlink{structblowfishParam}{blowfish\-Param} $\ast$) \end{DoxyCompactItemize} \subsection*{Variables} \begin{DoxyCompactItemize} \item const \hyperlink{structblockCipher}{block\-Cipher} \hyperlink{blowfish_8h_a58839854cfc0f9bcafd4b79ffd8e9d91}{blowfish} \begin{DoxyCompactList}\small\item\em Holds the full A\-P\-I description of the Blowfish algorithm. \end{DoxyCompactList}\end{DoxyCompactItemize} \subsection{Detailed Description} Blowfish block cipher. For more information on this blockcipher, see\-: \char`\"{}\-Applied Cryptography\char`\"{}, second edition Bruce Schneier Wiley \& Sons Also see \href{http://www.counterpane.com/blowfish.html}{\tt http\-://www.\-counterpane.\-com/blowfish.\-html} \begin{DoxyAuthor}{Author} Bob Deblier \href{mailto:bob.deblier@telenet.be}{\tt bob.\-deblier@telenet.\-be} \end{DoxyAuthor} \subsection{Macro Definition Documentation} \hypertarget{blowfish_8h_aa638e9cb3cbf0ad5b94a25fdb9eb64c6}{\index{blowfish.\-h@{blowfish.\-h}!B\-L\-O\-W\-F\-I\-S\-H\-P\-S\-I\-Z\-E@{B\-L\-O\-W\-F\-I\-S\-H\-P\-S\-I\-Z\-E}} \index{B\-L\-O\-W\-F\-I\-S\-H\-P\-S\-I\-Z\-E@{B\-L\-O\-W\-F\-I\-S\-H\-P\-S\-I\-Z\-E}!blowfish.h@{blowfish.\-h}} \subsubsection[{B\-L\-O\-W\-F\-I\-S\-H\-P\-S\-I\-Z\-E}]{\setlength{\rightskip}{0pt plus 5cm}\#define B\-L\-O\-W\-F\-I\-S\-H\-P\-S\-I\-Z\-E~({\bf B\-L\-O\-W\-F\-I\-S\-H\-R\-O\-U\-N\-D\-S}+2)}}\label{blowfish_8h_aa638e9cb3cbf0ad5b94a25fdb9eb64c6} \hypertarget{blowfish_8h_a320de9881e6c7560cd5b13828c420d5a}{\index{blowfish.\-h@{blowfish.\-h}!B\-L\-O\-W\-F\-I\-S\-H\-R\-O\-U\-N\-D\-S@{B\-L\-O\-W\-F\-I\-S\-H\-R\-O\-U\-N\-D\-S}} \index{B\-L\-O\-W\-F\-I\-S\-H\-R\-O\-U\-N\-D\-S@{B\-L\-O\-W\-F\-I\-S\-H\-R\-O\-U\-N\-D\-S}!blowfish.h@{blowfish.\-h}} \subsubsection[{B\-L\-O\-W\-F\-I\-S\-H\-R\-O\-U\-N\-D\-S}]{\setlength{\rightskip}{0pt plus 5cm}\#define B\-L\-O\-W\-F\-I\-S\-H\-R\-O\-U\-N\-D\-S~16}}\label{blowfish_8h_a320de9881e6c7560cd5b13828c420d5a} \subsection{Function Documentation} \hypertarget{blowfish_8h_a6339ebc5b30a93680c152076ddd5f033}{\index{blowfish.\-h@{blowfish.\-h}!blowfish\-Decrypt@{blowfish\-Decrypt}} \index{blowfish\-Decrypt@{blowfish\-Decrypt}!blowfish.h@{blowfish.\-h}} \subsubsection[{blowfish\-Decrypt}]{\setlength{\rightskip}{0pt plus 5cm}blowfish\-Decrypt ( \begin{DoxyParamCaption} \item[{{\bf blowfish\-Param} $\ast$}]{bp, } \item[{uint32\-\_\-t $\ast$}]{dst, } \item[{const uint32\-\_\-t $\ast$}]{src} \end{DoxyParamCaption} )}}\label{blowfish_8h_a6339ebc5b30a93680c152076ddd5f033} This function performs the Blowfish decryption; it Rderypts one block of 64 bits. \begin{DoxyParams}{Parameters} {\em bp} & The cipher's parameter block. \\ \hline {\em dst} & The cleartext; should be aligned on 32-\/bit boundary. \\ \hline {\em src} & The ciphertext; should be aligned on 32-\/bit boundary. \\ \hline \end{DoxyParams} \begin{DoxyRetVals}{Return values} {\em 0} & on success. \\ \hline \end{DoxyRetVals} \hypertarget{blowfish_8h_a2b48ab4a1793739d266308d1033aee70}{\index{blowfish.\-h@{blowfish.\-h}!blowfish\-Encrypt@{blowfish\-Encrypt}} \index{blowfish\-Encrypt@{blowfish\-Encrypt}!blowfish.h@{blowfish.\-h}} \subsubsection[{blowfish\-Encrypt}]{\setlength{\rightskip}{0pt plus 5cm}blowfish\-Encrypt ( \begin{DoxyParamCaption} \item[{{\bf blowfish\-Param} $\ast$}]{bp, } \item[{uint32\-\_\-t $\ast$}]{dst, } \item[{const uint32\-\_\-t $\ast$}]{src} \end{DoxyParamCaption} )}}\label{blowfish_8h_a2b48ab4a1793739d266308d1033aee70} This function performs the Blowfish encryption; it encrypts one block of 64 bits. \begin{DoxyParams}{Parameters} {\em bp} & The cipher's parameter block. \\ \hline {\em dst} & The ciphertext; should be aligned on 32-\/bit boundary. \\ \hline {\em src} & The cleartext; should be aligned on 32-\/bit boundary. \\ \hline \end{DoxyParams} \begin{DoxyRetVals}{Return values} {\em 0} & on success. \\ \hline \end{DoxyRetVals} \hypertarget{blowfish_8h_ae2137286429679c247215465d99342c5}{\index{blowfish.\-h@{blowfish.\-h}!blowfish\-Feedback@{blowfish\-Feedback}} \index{blowfish\-Feedback@{blowfish\-Feedback}!blowfish.h@{blowfish.\-h}} \subsubsection[{blowfish\-Feedback}]{\setlength{\rightskip}{0pt plus 5cm}uint32\-\_\-t$\ast$ blowfish\-Feedback ( \begin{DoxyParamCaption} \item[{{\bf blowfish\-Param} $\ast$}]{} \end{DoxyParamCaption} )}}\label{blowfish_8h_ae2137286429679c247215465d99342c5} \hypertarget{blowfish_8h_a8bd243fafbf7c52359f19ab04de13c42}{\index{blowfish.\-h@{blowfish.\-h}!blowfish\-Set\-C\-T\-R@{blowfish\-Set\-C\-T\-R}} \index{blowfish\-Set\-C\-T\-R@{blowfish\-Set\-C\-T\-R}!blowfish.h@{blowfish.\-h}} \subsubsection[{blowfish\-Set\-C\-T\-R}]{\setlength{\rightskip}{0pt plus 5cm}int blowfish\-Set\-C\-T\-R ( \begin{DoxyParamCaption} \item[{{\bf blowfish\-Param} $\ast$}]{, } \item[{const {\bf byte} $\ast$}]{nivz, } \item[{size\-\_\-t}]{counter} \end{DoxyParamCaption} )}}\label{blowfish_8h_a8bd243fafbf7c52359f19ab04de13c42} \hypertarget{blowfish_8h_a56566a49f33043d7a443a7bbbcd7bd5f}{\index{blowfish.\-h@{blowfish.\-h}!blowfish\-Set\-I\-V@{blowfish\-Set\-I\-V}} \index{blowfish\-Set\-I\-V@{blowfish\-Set\-I\-V}!blowfish.h@{blowfish.\-h}} \subsubsection[{blowfish\-Set\-I\-V}]{\setlength{\rightskip}{0pt plus 5cm}int blowfish\-Set\-I\-V ( \begin{DoxyParamCaption} \item[{{\bf blowfish\-Param} $\ast$}]{bp, } \item[{const {\bf byte} $\ast$}]{iv} \end{DoxyParamCaption} )}}\label{blowfish_8h_a56566a49f33043d7a443a7bbbcd7bd5f} This function sets the Initialization Vector. \begin{DoxyNote}{Note} This function is only useful in block chaining or feedback modes. \end{DoxyNote} \begin{DoxyParams}{Parameters} {\em bp} & The cipher's parameter block. \\ \hline {\em iv} & The initialization vector; may be null. \\ \hline \end{DoxyParams} \begin{DoxyRetVals}{Return values} {\em 0} & on success. \\ \hline \end{DoxyRetVals} \hypertarget{blowfish_8h_acce3d0c95c67c98202e851063604819e}{\index{blowfish.\-h@{blowfish.\-h}!blowfish\-Setup@{blowfish\-Setup}} \index{blowfish\-Setup@{blowfish\-Setup}!blowfish.h@{blowfish.\-h}} \subsubsection[{blowfish\-Setup}]{\setlength{\rightskip}{0pt plus 5cm}int blowfish\-Setup ( \begin{DoxyParamCaption} \item[{{\bf blowfish\-Param} $\ast$}]{bp, } \item[{const {\bf byte} $\ast$}]{key, } \item[{size\-\_\-t}]{keybits, } \item[{{\bf cipher\-Operation}}]{op} \end{DoxyParamCaption} )}}\label{blowfish_8h_acce3d0c95c67c98202e851063604819e} The function performs the cipher's key expansion. \begin{DoxyParams}{Parameters} {\em bp} & The cipher's parameter block. \\ \hline {\em key} & The key value. \\ \hline {\em keybits} & The number of bits in the key; legal values are\-: 32 to 448, in multiples of 8. \\ \hline {\em op} & E\-N\-C\-R\-Y\-P\-T or D\-E\-C\-R\-Y\-P\-T. \\ \hline \end{DoxyParams} \begin{DoxyRetVals}{Return values} {\em 0} & on success. \\ \hline {\em -\/1} & on failure. \\ \hline \end{DoxyRetVals} \subsection{Variable Documentation} \hypertarget{blowfish_8h_a58839854cfc0f9bcafd4b79ffd8e9d91}{\index{blowfish.\-h@{blowfish.\-h}!blowfish@{blowfish}} \index{blowfish@{blowfish}!blowfish.h@{blowfish.\-h}} \subsubsection[{blowfish}]{\setlength{\rightskip}{0pt plus 5cm}blowfish}}\label{blowfish_8h_a58839854cfc0f9bcafd4b79ffd8e9d91} Holds the full A\-P\-I description of the Blowfish algorithm.