\hypertarget{cbc__mac_8h_source}{}\doxysection{cbc\+\_\+mac.\+h}
\label{cbc__mac_8h_source}\index{opencrypto/cbc\_mac.h@{opencrypto/cbc\_mac.h}}
\mbox{\hyperlink{cbc__mac_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00001}00001 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2014 The FreeBSD Foundation}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00003}00003 \textcolor{comment}{ * Copyright (c) 2018, iXsystems Inc.}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00004}00004 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00005}00005 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00006}00006 \textcolor{comment}{ * This software was developed by Sean Eric Fagan, with lots of references}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00007}00007 \textcolor{comment}{ * to existing AES-\/CCM (gmac) code.}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00008}00008 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00009}00009 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00010}00010 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00011}00011 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00012}00012 \textcolor{comment}{ * 1.  Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00013}00013 \textcolor{comment}{ *     notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00014}00014 \textcolor{comment}{ * 2.  Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00015}00015 \textcolor{comment}{ *     notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00016}00016 \textcolor{comment}{ *     documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00017}00017 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00018}00018 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00019}00019 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00020}00020 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00021}00021 \textcolor{comment}{ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00022}00022 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00023}00023 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00024}00024 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00025}00025 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00026}00026 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00027}00027 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00028}00028 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00029}00029 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00030}00030 \textcolor{comment}{ *      \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00031}00031 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00032}00032 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00034}00034 \textcolor{preprocessor}{\#ifndef \_CBC\_CCM\_H}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00035}00035 \textcolor{preprocessor}{\# define \_CBC\_CCM\_H}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00036}00036 }
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00037}00037 \textcolor{preprocessor}{\# include <sys/types.h>}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00038}00038 \textcolor{preprocessor}{\# include <crypto/rijndael/rijndael.h>}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00039}00039 }
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00040}\mbox{\hyperlink{cbc__mac_8h_a93cc12cc210e8f3e682726362cba4573}{00040}} \textcolor{preprocessor}{\# define CCM\_CBC\_BLOCK\_LEN      16      }\textcolor{comment}{/* 128 bits */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00041}\mbox{\hyperlink{cbc__mac_8h_a266ff6348a467a5fd4e7104cf26d6ab5}{00041}} \textcolor{preprocessor}{\# define CCM\_CBC\_MAX\_DIGEST\_LEN 16}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00042}\mbox{\hyperlink{cbc__mac_8h_aa6333cc149f505690168c5d631504b85}{00042}} \textcolor{preprocessor}{\# define CCM\_CBC\_MIN\_DIGEST\_LEN 4}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00044}00044 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00045}00045 \textcolor{comment}{ * This is the authentication context structure;}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00046}00046 \textcolor{comment}{ * the encryption one is similar.}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00047}00047 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00048}\mbox{\hyperlink{structaes__cbc__mac__ctx}{00048}} \textcolor{keyword}{struct }\mbox{\hyperlink{structaes__cbc__mac__ctx}{aes\_cbc\_mac\_ctx}} \{}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00049}\mbox{\hyperlink{structaes__cbc__mac__ctx_aaa5f06890323184375d275053d6ac2c8}{00049}}         uint8\_t         \mbox{\hyperlink{structaes__cbc__mac__ctx_aaa5f06890323184375d275053d6ac2c8}{staging\_block}}[\mbox{\hyperlink{cbc__mac_8h_a93cc12cc210e8f3e682726362cba4573}{CCM\_CBC\_BLOCK\_LEN}}];}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00050}\mbox{\hyperlink{structaes__cbc__mac__ctx_af4daf4fbd6aac9888269ac54e7958bc4}{00050}}         uint8\_t         \mbox{\hyperlink{structaes__cbc__mac__ctx_af4daf4fbd6aac9888269ac54e7958bc4}{block}}[\mbox{\hyperlink{cbc__mac_8h_a93cc12cc210e8f3e682726362cba4573}{CCM\_CBC\_BLOCK\_LEN}}];}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00051}\mbox{\hyperlink{structaes__cbc__mac__ctx_aca9b789e8120db44db240c29ac5cb8e2}{00051}}         \textcolor{keywordtype}{int}             \mbox{\hyperlink{structaes__cbc__mac__ctx_aca9b789e8120db44db240c29ac5cb8e2}{blockIndex}};}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00052}\mbox{\hyperlink{structaes__cbc__mac__ctx_a2a05a43ca920c9a10d81a8cef44d240c}{00052}}         \textcolor{keywordtype}{int}             \mbox{\hyperlink{structaes__cbc__mac__ctx_a2a05a43ca920c9a10d81a8cef44d240c}{nonceLength}}; \textcolor{comment}{/* This one is in bytes, not bits! */}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00053}\mbox{\hyperlink{structaes__cbc__mac__ctx_a5154c0f097df9184a446a1c25d7ec63a}{00053}}         \textcolor{keyword}{const} uint8\_t   *\mbox{\hyperlink{structaes__cbc__mac__ctx_a5154c0f097df9184a446a1c25d7ec63a}{nonce}};}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00054}00054         \textcolor{comment}{/* AES state data */}}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00055}\mbox{\hyperlink{structaes__cbc__mac__ctx_ab35eacc1a7c5ebf06a061c32c13ae485}{00055}}         \textcolor{keywordtype}{int}             \mbox{\hyperlink{structaes__cbc__mac__ctx_ab35eacc1a7c5ebf06a061c32c13ae485}{rounds}};}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00056}\mbox{\hyperlink{structaes__cbc__mac__ctx_a134a2b899c7bed15794dffbc37bc436f}{00056}}         uint32\_t        \mbox{\hyperlink{structaes__cbc__mac__ctx_a134a2b899c7bed15794dffbc37bc436f}{keysched}}[4*(RIJNDAEL\_MAXNR+1)];}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00057}00057 \};}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00059}00059 \textcolor{keywordtype}{void} \mbox{\hyperlink{cbc__mac_8h_a551e1c52bb4744ba021a3d4ab8ae68ff}{AES\_CBC\_MAC\_Init}}(\textcolor{keywordtype}{void} *);}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00060}00060 \textcolor{keywordtype}{void} \mbox{\hyperlink{cbc__mac_8h_aa788980ac4075ee0654064432c0716a5}{AES\_CBC\_MAC\_Setkey}}(\textcolor{keywordtype}{void} *, \textcolor{keyword}{const} uint8\_t *, u\_int);}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00061}00061 \textcolor{keywordtype}{void} \mbox{\hyperlink{cbc__mac_8h_a9001b0be4c33c38473369a9d4e6f59a6}{AES\_CBC\_MAC\_Reinit}}(\textcolor{keywordtype}{void} *, \textcolor{keyword}{const} uint8\_t *, u\_int);}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00062}00062 \textcolor{keywordtype}{int} \mbox{\hyperlink{cbc__mac_8h_a72b67177b7bb76ecb4216fc38ba57863}{AES\_CBC\_MAC\_Update}}(\textcolor{keywordtype}{void} *, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *, u\_int);}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00063}00063 \textcolor{keywordtype}{void} \mbox{\hyperlink{cbc__mac_8h_a034398fc80f05f650da76e8f5d8bed36}{AES\_CBC\_MAC\_Final}}(uint8\_t *, \textcolor{keywordtype}{void} *);}
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00064}00064 }
\DoxyCodeLine{\Hypertarget{cbc__mac_8h_source_l00065}00065 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* \_CBC\_CCM\_H */}\textcolor{preprocessor}{}}

\end{DoxyCode}
