Files
wolfssl/doc/dox_comments/header_files-ja/siphash.h

125 lines
4.5 KiB
C
Raw Normal View History

/*!
\ingroup SipHash
\brief MacサイズのキーでSiphashを初期化します
\return 0
\return BAD_FUNC_ARG SiphashまたはキーがNULLのときに返されます
\return BAD_FUNC_ARG OUTSZが8でも16でもない場合に返されます
\param siphash Macingに使用するサイプハッシュ構造へのポインタ
\param key 16
_Example_
\code
SipHash siphash[1];
unsigned char key[16] = { ... };
byte macSz = 8; // 8 or 16
if ((ret = wc_InitSipHash(siphash, key, macSz)) != 0) {
WOLFSSL_MSG("wc_InitSipHash failed");
}
else if ((ret = wc_SipHashUpdate(siphash, data, len)) != 0) {
WOLFSSL_MSG("wc_SipHashUpdate failed");
}
else if ((ret = wc_SipHashFinal(siphash, mac, macSz)) != 0) {
WOLFSSL_MSG("wc_SipHashFinal failed");
}
\endcode
\sa wc_SipHash
\sa wc_SipHashUpdate
\sa wc_SipHashFinal
*/
int wc_InitSipHash(SipHash* siphash, const unsigned char* key,
unsigned char outSz);
/*!
\ingroup SipHash
\brief LENの提供されたバイト配列を絶えずハッシュするように呼び出すことができます
\return 0 Macにデータを追加したら
\return BAD_FUNC_ARG Siphashがnullのとき返されました
\return BAD_FUNC_ARG inneがnullのとき返されInszはゼロではありません
\param siphash Macingに使用するサイプハッシュ構造へのポインタ
\param in
_Example_
\code
SipHash siphash[1];
byte data[] = { Data to be MACed };
word32 len = sizeof(data);
if ((ret = wc_InitSipHash(siphash, key, macSz)) != 0) {
WOLFSSL_MSG("wc_InitSipHash failed");
}
else if ((ret = wc_SipHashUpdate(siphash, data, len)) != 0) {
WOLFSSL_MSG("wc_SipHashUpdate failed");
}
else if ((ret = wc_SipHashFinal(siphash, mac, macSz)) != 0) {
WOLFSSL_MSG("wc_SipHashFinal failed");
}
\endcode
\sa wc_SipHash
\sa wc_InitSipHash
\sa wc_SipHashFinal
*/
int wc_SipHashUpdate(SipHash* siphash, const unsigned char* in,
word32 inSz);
/*!
\ingroup SipHash
\brief Macingを確定します
\return 0
\return BAD_FUNC_ARG SiphashのOUTがNULLのときに返されます
\return BAD_FUNC_ARG OUTSZが初期化された値と同じではない場合に返されます
\param siphash Macingに使用するサイプハッシュ構造へのポインタ
\param out MAC値を保持するためのバイト配列
_Example_
\code
SipHash siphash[1];
byte mac[8] = { ... }; // 8 or 16 bytes
byte macSz = sizeof(mac);
if ((ret = wc_InitSipHash(siphash, key, macSz)) != 0) {
WOLFSSL_MSG("wc_InitSipHash failed");
}
else if ((ret = wc_SipHashUpdate(siphash, data, len)) != 0) {
WOLFSSL_MSG("wc_SipHashUpdate failed");
}
else if ((ret = wc_SipHashFinal(siphash, mac, macSz)) != 0) {
WOLFSSL_MSG("wc_SipHashFinal failed");
}
\endcode
\sa wc_SipHash
\sa wc_InitSipHash
\sa wc_SipHashUpdate
*/
int wc_SipHashFinal(SipHash* siphash, unsigned char* out,
unsigned char outSz);
/*!
\ingroup SipHash
\brief Siphashを使用してデータを1ショットしてMACを計算します
\return 0 Macingに成功したときに返されました
\return BAD_FUNC_ARG OUTがNULLのときに返されます
\return BAD_FUNC_ARG inneがnullのとき返されInszはゼロではありません
\return BAD_FUNC_ARG OUTSZが8でも16でもない場合に返されます
\param key 16
\param in
\param inSz
\param out MAC値を保持するためのバイト配列
_Example_
\code
unsigned char key[16] = { ... };
byte data[] = { Data to be MACed };
word32 len = sizeof(data);
byte mac[8] = { ... }; // 8 or 16 bytes
byte macSz = sizeof(mac);
if ((ret = wc_SipHash(key, data, len, mac, macSz)) != 0) {
WOLFSSL_MSG("wc_SipHash failed");
}
\endcode
\sa wc_InitSipHash
\sa wc_SipHashUpdate
\sa wc_SipHashFinal
*/
int wc_SipHash(const unsigned char* key, const unsigned char* in,
word32 inSz, unsigned char* out, unsigned char outSz);