cmac.h
Functions
| Name | |
|---|---|
| int | wc_InitCmac(Cmac * cmac, const byte * key, word32 keySz, int type, void * unused) Cmac構造体をデフォルト値で初期化します |
| int | wc_InitCmac_ex(Cmac * cmac, const byte * key, word32 keySz, int type, void * unused, void * heap, int devId) Cmac構造体をデフォルト値で初期化します |
| int | wc_CmacUpdate(Cmac * cmac, const byte * in, word32 inSz) 暗号ベースメッセージ認証コード入力データを追加します |
| int | wc_CmacFinalNoFree(Cmac * cmac, byte * out, word32 * outSz) 暗号ベースメッセージ認証コードを使用して最終結果を生成し、コンテキストのクリーンアップを延期します。 |
| int | wc_CmacFinal(Cmac * cmac, byte * out, word32 * outSz) 暗号ベースメッセージ認証コードを使用して最終結果を生成し、wc_CmacFree()でコンテキストをクリーンアップします。 |
| int | wc_CmacFree(Cmac * cmac) CMACコンテキスト内の割り当てをクリーンアップします。 |
| int | wc_AesCmacGenerate(byte * out, word32 * outSz, const byte * in, word32 inSz, const byte * key, word32 keySz) CMACを生成するためのシングルショット関数 |
| int | wc_AesCmacVerify(const byte * check, word32 checkSz, const byte * in, word32 inSz, const byte * key, word32 keySz) CMACを検証するためのシングルショット関数 |
| int | wc_CMAC_Grow(Cmac * cmac, const byte * in, int inSz) ハードウェアがシングルショットを必要とし、更新をメモリにキャッシュする必要がある場合にWOLFSSL_HASH_KEEPでのみ使用されます |
Functions Documentation
function wc_InitCmac
int wc_InitCmac(
Cmac * cmac,
const byte * key,
word32 keySz,
int type,
void * unused
)
Cmac構造体をデフォルト値で初期化します
Parameters:
- cmac Cmac構造体へのポインタ
- key キーポインタ
- keySz キーポインタのサイズ(16、24、または32)
- type 常にWC_CMAC_AES = 1
- unused 使用されません。互換性に関する将来の使用の可能性のために存在します
See:
Return: 0 成功時
Example
Cmac cmac[1];
ret = wc_InitCmac(cmac, key, keySz, WC_CMAC_AES, NULL);
if (ret == 0) {
ret = wc_CmacUpdate(cmac, in, inSz);
}
if (ret == 0) {
ret = wc_CmacFinal(cmac, out, outSz);
}
function wc_InitCmac_ex
int wc_InitCmac_ex(
Cmac * cmac,
const byte * key,
word32 keySz,
int type,
void * unused,
void * heap,
int devId
)
Cmac構造体をデフォルト値で初期化します
Parameters:
- cmac Cmac構造体へのポインタ
- key キーポインタ
- keySz キーポインタのサイズ(16、24、または32)
- type 常にWC_CMAC_AES = 1
- unused 使用されません。互換性に関する将来の使用の可能性のために存在します
- heap 動的割り当てに使用されるヒープヒントへのポインタ。通常、静的メモリオプションで使用されます。NULLにできます。
- devId 暗号コールバックまたは非同期ハードウェアで使用するID。使用しない場合はINVALID_DEVID(-2)に設定します
See:
Return: 0 成功時
Example
Cmac cmac[1];
ret = wc_InitCmac_ex(cmac, key, keySz, WC_CMAC_AES, NULL, NULL, INVALID_DEVID);
if (ret == 0) {
ret = wc_CmacUpdate(cmac, in, inSz);
}
if (ret == 0) {
ret = wc_CmacFinal(cmac, out, &outSz);
}
function wc_CmacUpdate
int wc_CmacUpdate(
Cmac * cmac,
const byte * in,
word32 inSz
)
暗号ベースメッセージ認証コード入力データを追加します
Parameters:
- cmac Cmac構造体へのポインタ
- in 処理する入力データ
- inSz 入力データのサイズ
See:
Return: 0 成功時
Example
ret = wc_CmacUpdate(cmac, in, inSz);
function wc_CmacFinalNoFree
int wc_CmacFinalNoFree(
Cmac * cmac,
byte * out,
word32 * outSz
)
暗号ベースメッセージ認証コードを使用して最終結果を生成し、コンテキストのクリーンアップを延期します。
Parameters:
- cmac Cmac構造体へのポインタ
- out 結果を返すポインタ
- outSz 出力のポインタサイズ(入出力)
See:
Return: 0 成功時
Example
ret = wc_CmacFinalNoFree(cmac, out, &outSz);
(void)wc_CmacFree(cmac);
function wc_CmacFinal
int wc_CmacFinal(
Cmac * cmac,
byte * out,
word32 * outSz
)
暗号ベースメッセージ認証コードを使用して最終結果を生成し、wc_CmacFree()でコンテキストをクリーンアップします。
Parameters:
- cmac Cmac構造体へのポインタ
- out 結果を返すポインタ
- outSz 出力のポインタサイズ(入出力)
See:
Return: 0 成功時
Example
ret = wc_CmacFinal(cmac, out, &outSz);
function wc_CmacFree
int wc_CmacFree(
Cmac * cmac
)
CMACコンテキスト内の割り当てをクリーンアップします。
Parameters:
- cmac Cmac構造体へのポインタ
See:
Return: 0 成功時
Example
ret = wc_CmacFinalNoFree(cmac, out, &outSz);
(void)wc_CmacFree(cmac);
function wc_AesCmacGenerate
int wc_AesCmacGenerate(
byte * out,
word32 * outSz,
const byte * in,
word32 inSz,
const byte * key,
word32 keySz
)
CMACを生成するためのシングルショット関数
Parameters:
- out 結果を返すポインタ
- outSz 出力のポインタサイズ(入出力)
- in 処理する入力データ
- inSz 入力データのサイズ
- key キーポインタ
- keySz キーポインタのサイズ(16、24、または32)
See: wc_AesCmacVerify
Return: 0 成功時
Example
ret = wc_AesCmacGenerate(mac, &macSz, msg, msgSz, key, keySz);
function wc_AesCmacVerify
int wc_AesCmacVerify(
const byte * check,
word32 checkSz,
const byte * in,
word32 inSz,
const byte * key,
word32 keySz
)
CMACを検証するためのシングルショット関数
Parameters:
- check 検証するCMAC値
- checkSz checkバッファのサイズ
- in 処理する入力データ
- inSz 入力データのサイズ
- key キーポインタ
- keySz キーポインタのサイズ(16、24、または32)
See: wc_AesCmacGenerate
Return: 0 成功時
Example
ret = wc_AesCmacVerify(mac, macSz, msg, msgSz, key, keySz);
function wc_CMAC_Grow
int wc_CMAC_Grow(
Cmac * cmac,
const byte * in,
int inSz
)
ハードウェアがシングルショットを必要とし、更新をメモリにキャッシュする必要がある場合にWOLFSSL_HASH_KEEPでのみ使用されます
Parameters:
- in 処理する入力データ
- inSz 入力データのサイズ
Return: 0 成功時
Example
ret = wc_CMAC_Grow(cmac, in, inSz)
Source code
int wc_InitCmac(Cmac* cmac,
const byte* key, word32 keySz,
int type, void* unused);
int wc_InitCmac_ex(Cmac* cmac,
const byte* key, word32 keySz,
int type, void* unused, void* heap, int devId);
int wc_CmacUpdate(Cmac* cmac,
const byte* in, word32 inSz);
int wc_CmacFinalNoFree(Cmac* cmac,
byte* out, word32* outSz);
int wc_CmacFinal(Cmac* cmac,
byte* out, word32* outSz);
int wc_CmacFree(Cmac* cmac);
int wc_AesCmacGenerate(byte* out, word32* outSz,
const byte* in, word32 inSz,
const byte* key, word32 keySz);
int wc_AesCmacVerify(const byte* check, word32 checkSz,
const byte* in, word32 inSz,
const byte* key, word32 keySz);
int wc_CMAC_Grow(Cmac* cmac, const byte* in, int inSz);
Updated on 2025-12-12 at 03:08:17 +0000