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

102 lines
4.3 KiB
C
Raw Normal View History

/*!
\ingroup Poly1305
\brief Poly1305コンテキスト構造のキーを設定しWC_POLY1305FINALでメッセージハッシュを生成した後に新しいキーを設定する必要があります
\return 0 Poly1305構造の初期化
\return BAD_FUNC_ARG 32Poly1305コンテキストがNULLの場合
\param ctx Poly1305構造へのポインタ
\param key 使
_Example_
\code
Poly1305 enc;
byte key[] = { initialize with 32 byte key to use for hashing };
wc_Poly1305SetKey(&enc, key, sizeof(key));
\endcode
\sa wc_Poly1305Update
\sa wc_Poly1305Final
*/
int wc_Poly1305SetKey(Poly1305* poly1305, const byte* key,
word32 kySz);
/*!
\ingroup Poly1305
\brief Poly1305構造を持つハッシュにメッセージを更新します
\return 0
\return BAD_FUNC_ARG Poly1305構造がNULLの場合に返されます
\param ctx HASHにメッセージを更新するためのPoly1305構造へのポインタ
\param m
_Example_
\code
Poly1305 enc;
byte key[] = { }; // initialize with 32 byte key to use for encryption
byte msg[] = { }; // initialize with message to hash
wc_Poly1305SetKey(&enc, key, sizeof(key));
if( wc_Poly1305Update(key, msg, sizeof(msg)) != 0 ) {
// error updating message to hash
}
\endcode
\sa wc_Poly1305SetKey
\sa wc_Poly1305Final
*/
int wc_Poly1305Update(Poly1305* poly1305, const byte* m, word32 bytes);
/*!
\ingroup Poly1305
\brief MACに格納します
\return 0 Macの計算に成功した
\return BAD_FUNC_ARG Poly1305構造がNULLの場合に返されます
\param ctx MACを生成するためのPoly1305構造へのポインタ
_Example_
\code
Poly1305 enc;
byte mac[POLY1305_DIGEST_SIZE]; // space for a 16 byte mac
byte key[] = { }; // initialize with 32 byte key to use for encryption
byte msg[] = { }; // initialize with message to hash
wc_Poly1305SetKey(&enc, key, sizeof(key));
wc_Poly1305Update(key, msg, sizeof(msg));
if ( wc_Poly1305Final(&enc, mac) != 0 ) {
// error computing final MAC
}
\endcode
\sa wc_Poly1305SetKey
\sa wc_Poly1305Update
*/
int wc_Poly1305Final(Poly1305* poly1305, byte* tag);
/*!
\ingroup Poly1305
\brief TLS AEADパディング方式を使用してMACPoly1305構造体を取ります
\return 0
\return BAD_FUNC_ARG CTXINPUTTAGがNULLの場合NULLでADDSZが0より大きい場合TAGSZがWC_POLY1305_MAC_SZより小さい場合に返されます
\param ctx Poly1305構造物
\param additional 使
\param addSz
\param input
\param sz
\param tag
_Example_
\code
Poly1305 ctx;
byte key[] = { }; // initialize with 32 byte key to use for hashing
byte additional[] = { }; // initialize with additional data
byte msg[] = { }; // initialize with message
byte tag[16];
wc_Poly1305SetKey(&ctx, key, sizeof(key));
if(wc_Poly1305_MAC(&ctx, additional, sizeof(additional), (byte*)msg,
sizeof(msg), tag, sizeof(tag)) != 0)
{
// Handle the error
}
\endcode
\sa wc_Poly1305SetKey
\sa wc_Poly1305Update
\sa wcPoly1305Final
*/
int wc_Poly1305_MAC(Poly1305* ctx, byte* additional, word32 addSz,
byte* input, word32 sz, byte* tag, word32 tagSz);