Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > d1d38291248b5ff58339d3d2ddb22ecd > files > 1104

lib64beecrypt-devel-4.2.1-13.mga4.x86_64.rpm

\hypertarget{dsa_8h}{\section{include/beecrypt/dsa.h File Reference}
\label{dsa_8h}\index{include/beecrypt/dsa.\-h@{include/beecrypt/dsa.\-h}}
}


Digital Signature Algorithm, as specified by N\-I\-S\-T F\-I\-P\-S 186.  


{\ttfamily \#include \char`\"{}beecrypt/dlkp.\-h\char`\"{}}\\*
Include dependency graph for dsa.\-h\-:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{dsa_8h__incl}
\end{center}
\end{figure}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef \hyperlink{structdldp__p}{dldp\-\_\-p} \hyperlink{dsa_8h_a101dc535937173652cd69c04f5f0383f}{dsaparam}
\item 
typedef \hyperlink{structdlpk__p}{dlpk\-\_\-p} \hyperlink{dsa_8h_a42e7021ed621afc5269b827dbc2d5677}{dsapub}
\item 
typedef \hyperlink{structdlkp__p}{dlkp\-\_\-p} \hyperlink{dsa_8h_ae83b8c80466cb3c71c77b3f01207cae2}{dsakp}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{dsa_8h_a8233bc3b4467867e0256e97688808d58}{dsasign} (const \hyperlink{structmpbarrett}{mpbarrett} $\ast$p, const \hyperlink{structmpbarrett}{mpbarrett} $\ast$q, const \hyperlink{structmpnumber}{mpnumber} $\ast$g, \hyperlink{structrandomGeneratorContext}{random\-Generator\-Context} $\ast$, const \hyperlink{structmpnumber}{mpnumber} $\ast$hm, const \hyperlink{structmpnumber}{mpnumber} $\ast$x, \hyperlink{structmpnumber}{mpnumber} $\ast$r, \hyperlink{structmpnumber}{mpnumber} $\ast$s)
\begin{DoxyCompactList}\small\item\em This function performs a raw D\-S\-A signature. \end{DoxyCompactList}\item 
int \hyperlink{dsa_8h_a072071da4da5af51d7a23805cf4ef3a7}{dsavrfy} (const \hyperlink{structmpbarrett}{mpbarrett} $\ast$p, const \hyperlink{structmpbarrett}{mpbarrett} $\ast$q, const \hyperlink{structmpnumber}{mpnumber} $\ast$g, const \hyperlink{structmpnumber}{mpnumber} $\ast$hm, const \hyperlink{structmpnumber}{mpnumber} $\ast$y, const \hyperlink{structmpnumber}{mpnumber} $\ast$r, const \hyperlink{structmpnumber}{mpnumber} $\ast$s)
\begin{DoxyCompactList}\small\item\em This function performs a raw D\-S\-A verification. \end{DoxyCompactList}\item 
int \hyperlink{dsa_8h_ad7479bccc344d29a8402a95998342e9a}{dsaparam\-Make} (\hyperlink{dsa_8h_a101dc535937173652cd69c04f5f0383f}{dsaparam} $\ast$, \hyperlink{structrandomGeneratorContext}{random\-Generator\-Context} $\ast$, size\-\_\-t)
\begin{DoxyCompactList}\small\item\em This function generates a set of D\-S\-A parameters. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Digital Signature Algorithm, as specified by N\-I\-S\-T F\-I\-P\-S 186. F\-I\-P\-S 186 specifies the D\-S\-A algorithm as having a large prime $p$, a cofactor $q$ and a generator $g$ of a subgroup of $\mathds{Z}^{*}_p$ with order $q$. The private and public key values are $x$ and $y$ respectively.

\begin{DoxyAuthor}{Author}
Bob Deblier \href{mailto:bob.deblier@telenet.be}{\tt bob.\-deblier@telenet.\-be} 
\end{DoxyAuthor}


\subsection{Typedef Documentation}
\hypertarget{dsa_8h_ae83b8c80466cb3c71c77b3f01207cae2}{\index{dsa.\-h@{dsa.\-h}!dsakp@{dsakp}}
\index{dsakp@{dsakp}!dsa.h@{dsa.\-h}}
\subsubsection[{dsakp}]{\setlength{\rightskip}{0pt plus 5cm}typedef {\bf dlkp\-\_\-p} {\bf dsakp}}}\label{dsa_8h_ae83b8c80466cb3c71c77b3f01207cae2}
\hypertarget{dsa_8h_a101dc535937173652cd69c04f5f0383f}{\index{dsa.\-h@{dsa.\-h}!dsaparam@{dsaparam}}
\index{dsaparam@{dsaparam}!dsa.h@{dsa.\-h}}
\subsubsection[{dsaparam}]{\setlength{\rightskip}{0pt plus 5cm}typedef {\bf dldp\-\_\-p} {\bf dsaparam}}}\label{dsa_8h_a101dc535937173652cd69c04f5f0383f}
\hypertarget{dsa_8h_a42e7021ed621afc5269b827dbc2d5677}{\index{dsa.\-h@{dsa.\-h}!dsapub@{dsapub}}
\index{dsapub@{dsapub}!dsa.h@{dsa.\-h}}
\subsubsection[{dsapub}]{\setlength{\rightskip}{0pt plus 5cm}typedef {\bf dlpk\-\_\-p} {\bf dsapub}}}\label{dsa_8h_a42e7021ed621afc5269b827dbc2d5677}


\subsection{Function Documentation}
\hypertarget{dsa_8h_ad7479bccc344d29a8402a95998342e9a}{\index{dsa.\-h@{dsa.\-h}!dsaparam\-Make@{dsaparam\-Make}}
\index{dsaparam\-Make@{dsaparam\-Make}!dsa.h@{dsa.\-h}}
\subsubsection[{dsaparam\-Make}]{\setlength{\rightskip}{0pt plus 5cm}int dsaparam\-Make (
\begin{DoxyParamCaption}
\item[{{\bf dsaparam} $\ast$}]{dp, }
\item[{{\bf random\-Generator\-Context} $\ast$}]{rgc, }
\item[{size\-\_\-t}]{psize}
\end{DoxyParamCaption}
)}}\label{dsa_8h_ad7479bccc344d29a8402a95998342e9a}


This function generates a set of D\-S\-A parameters. 

This function calls dldp\-\_\-pgoq\-Make with appropriate parameters, i.\-e. qsize = 160 bits and cofactor = 1.


\begin{DoxyParams}{Parameters}
{\em dp} & The parameters to be generated. \\
\hline
{\em rgc} & The random generator context. \\
\hline
{\em psize} & The size of prime parameter p; psize must be $>$= 512 and $<$= 1024, and be a multiple of 64. \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success. \\
\hline
{\em -\/1} & on failure. \\
\hline
\end{DoxyRetVals}
\hypertarget{dsa_8h_a8233bc3b4467867e0256e97688808d58}{\index{dsa.\-h@{dsa.\-h}!dsasign@{dsasign}}
\index{dsasign@{dsasign}!dsa.h@{dsa.\-h}}
\subsubsection[{dsasign}]{\setlength{\rightskip}{0pt plus 5cm}int dsasign (
\begin{DoxyParamCaption}
\item[{const {\bf mpbarrett} $\ast$}]{p, }
\item[{const {\bf mpbarrett} $\ast$}]{q, }
\item[{const {\bf mpnumber} $\ast$}]{g, }
\item[{{\bf random\-Generator\-Context} $\ast$}]{rgc, }
\item[{const {\bf mpnumber} $\ast$}]{hm, }
\item[{const {\bf mpnumber} $\ast$}]{x, }
\item[{{\bf mpnumber} $\ast$}]{r, }
\item[{{\bf mpnumber} $\ast$}]{s}
\end{DoxyParamCaption}
)}}\label{dsa_8h_a8233bc3b4467867e0256e97688808d58}


This function performs a raw D\-S\-A signature. 

Signing equations\-:

\begin{DoxyItemize}
\item $r=(g^{k}\ \textrm{mod}\ p)\ \textrm{mod}\ q$ \item $s=k^{-1}(h(m)+xr)\ \textrm{mod}\ q$\end{DoxyItemize}

\begin{DoxyParams}{Parameters}
{\em p} & The prime. \\
\hline
{\em q} & The cofactor. \\
\hline
{\em g} & The generator. \\
\hline
{\em rgc} & The pseudo-\/random generator context. \\
\hline
{\em hm} & The hash to be signed. \\
\hline
{\em x} & The private key value. \\
\hline
{\em r} & The signature's {\itshape r} value. \\
\hline
{\em s} & The signature's {\itshape s} value. \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success. \\
\hline
{\em -\/1} & on failure. \\
\hline
\end{DoxyRetVals}
\hypertarget{dsa_8h_a072071da4da5af51d7a23805cf4ef3a7}{\index{dsa.\-h@{dsa.\-h}!dsavrfy@{dsavrfy}}
\index{dsavrfy@{dsavrfy}!dsa.h@{dsa.\-h}}
\subsubsection[{dsavrfy}]{\setlength{\rightskip}{0pt plus 5cm}int dsavrfy (
\begin{DoxyParamCaption}
\item[{const {\bf mpbarrett} $\ast$}]{p, }
\item[{const {\bf mpbarrett} $\ast$}]{q, }
\item[{const {\bf mpnumber} $\ast$}]{g, }
\item[{const {\bf mpnumber} $\ast$}]{hm, }
\item[{const {\bf mpnumber} $\ast$}]{y, }
\item[{const {\bf mpnumber} $\ast$}]{r, }
\item[{const {\bf mpnumber} $\ast$}]{s}
\end{DoxyParamCaption}
)}}\label{dsa_8h_a072071da4da5af51d7a23805cf4ef3a7}


This function performs a raw D\-S\-A verification. 

Verifying equations\-: \begin{DoxyItemize}
\item Check $0<r<q$ and $0<s<q$ \item $w=s^{-1}\ \textrm{mod}\ q$ \item $u_1=w \cdot h(m)\ \textrm{mod}\ q$ \item $u_2=rw\ \textrm{mod}\ q$ \item $v=(g^{u_1}y^{u_2}\ \textrm{mod}\ p)\ \textrm{mod}\ q$ \item Check $v=r$\end{DoxyItemize}

\begin{DoxyParams}{Parameters}
{\em p} & The prime. \\
\hline
{\em q} & The cofactor. \\
\hline
{\em g} & The generator. \\
\hline
{\em hm} & The digest to be verified. \\
\hline
{\em y} & The public key value. \\
\hline
{\em r} & The signature's {\itshape r} value. \\
\hline
{\em s} & The signature's {\itshape s} value. \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 1} & on success. \\
\hline
{\em 0} & on failure. \\
\hline
\end{DoxyRetVals}