---
title: hmac_sha1_init
description: "使用派生密钥初始化hmac_sha1计算上下文结构。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengaccel/encryp-decryp/ug_kacc_crypto/kunpengaccel_kacccrypt_16_0009.html
sourcePath: /source/zh/kunpengaccel/encryp-decryp/ug_kacc_crypto/kunpengaccel_kacccrypt_16_0009.html
indexId: 86062b53db2596b208c7a5047e4f9ca289232691eed0f348fd1796e32827746988
---
# hmac_sha1_init

使用派生密钥初始化hmac_sha1计算上下文结构。

int hmac_sha1_init(sha1_hmac_ctx_t *ctx, sha1_hmac_key_data_t *kd);

#### 参数

| 参数名 | 描述 | 取值范围 | 输入/输出 |
| --- | --- | --- | --- |
| ctx | hmac\_sha1上下文结构体。 | 非空 | 输出 |
| kd | 派生密钥，通过hmac\_sha1\_key\_data生成后传入。 | 非空 | 输入 |


#### 返回值

- 成功：返回值为0。
- 失败：返回值小于0。
