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

88 lines
4.5 KiB
C
Raw Normal View History

/*!
\ingroup ChaCha20Poly1305
\brief Chacha20 Stream暗号を使用してChacha20 Stream暗号を使用してOutput BufferTextに入力メッセージInPleaintextを暗号化しますPoly-1305OutauthTagに格納します
\return 0
\return BAD_FUNC_ARG
\param inKey 使32
\param inIv 使12IVを含むバッファへのポインタ
\param inAAD AAD
\param inAADLen AADの長さ
\param inPlaintext
\param inPlaintextLen
\param outCiphertext
_Example_
\code
byte key[] = { // initialize 32 byte key };
byte iv[] = { // initialize 12 byte key };
byte inAAD[] = { // initialize AAD };
byte plain[] = { // initialize message to encrypt };
byte cipher[sizeof(plain)];
byte authTag[16];
int ret = wc_ChaCha20Poly1305_Encrypt(key, iv, inAAD, sizeof(inAAD),
plain, sizeof(plain), cipher, authTag);
if(ret != 0) {
// error running encrypt
}
\endcode
\sa wc_ChaCha20Poly1305_Decrypt
\sa wc_ChaCha_*
\sa wc_Poly1305*
*/
int wc_ChaCha20Poly1305_Encrypt(
const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE],
const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE],
const byte* inAAD, const word32 inAADLen,
const byte* inPlaintext, const word32 inPlaintextLen,
byte* outCiphertext,
byte outAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE]);
/*!
\ingroup ChaCha20Poly1305
\brief Chacha20 Stream暗号を使用してChacha20 Stream暗号を使用してOutpleAntextに入力された暗号文の入力を復号化しますPoly-1305INAUTHTAGをINAADで生成された認証
\return 0
\return BAD_FUNC_ARG
\return MAC_CMP_FAILED_E INAUTHTAGと一致しない場合に返されます
\param inKey 使32
\param inIv 使12IVを含むバッファへのポインタ
\param inAAD AAD
\param inAADLen AADの長さ
\param inCiphertext
\param outCiphertextLen
\param inAuthTag 16
_Example_
\code
byte key[] = { // initialize 32 byte key };
byte iv[] = { // initialize 12 byte key };
byte inAAD[] = { // initialize AAD };
byte cipher[] = { // initialize with received ciphertext };
byte authTag[16] = { // initialize with received authentication tag };
byte plain[sizeof(cipher)];
int ret = wc_ChaCha20Poly1305_Decrypt(key, iv, inAAD, sizeof(inAAD),
cipher, sizeof(cipher), plain, authTag);
if(ret == MAC_CMP_FAILED_E) {
// error during authentication
} else if( ret != 0) {
// error with function arguments
}
\endcode
\sa wc_ChaCha20Poly1305_Encrypt
\sa wc_ChaCha_*
\sa wc_Poly1305*
*/
int wc_ChaCha20Poly1305_Decrypt(
const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE],
const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE],
const byte* inAAD, const word32 inAADLen,
const byte* inCiphertext, const word32 inCiphertextLen,
const byte inAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE],
byte* outPlaintext);