1 Star 0 Fork 10

src-oepkgs-oE-rv/libsrtp

forked from src-openEuler/libsrtp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
libsrtp-sha1-name-fix.patch 5.76 KB
一键复制 编辑 原始数据 按行查看 历史
dogsheng 提交于 2019-11-19 11:50 . Package init
diff -rup libsrtp-1.5.0/crypto/hash/hmac.c libsrtp-1.5.0/crypto/hash/hmac.c
--- libsrtp-1.5.0/crypto/hash/hmac.c 2014-10-13 10:35:33.000000000 -0400
+++ libsrtp-1.5.0/crypto/hash/hmac.c 2014-10-31 09:15:20.666474444 -0400
@@ -141,10 +141,10 @@ hmac_init(hmac_ctx_t *state, const uint8
debug_print(mod_hmac, "ipad: %s", octet_string_hex_string(ipad, 64));
/* initialize sha1 context */
- sha1_init(&state->init_ctx);
+ crypto_sha1_init(&state->init_ctx);
/* hash ipad ^ key */
- sha1_update(&state->init_ctx, ipad, 64);
+ crypto_sha1_update(&state->init_ctx, ipad, 64);
memcpy(&state->ctx, &state->init_ctx, sizeof(sha1_ctx_t));
return err_status_ok;
@@ -165,7 +165,7 @@ hmac_update(hmac_ctx_t *state, const uin
octet_string_hex_string(message, msg_octets));
/* hash message into sha1 context */
- sha1_update(&state->ctx, message, msg_octets);
+ crypto_sha1_update(&state->ctx, message, msg_octets);
return err_status_ok;
}
@@ -183,7 +183,7 @@ hmac_compute(hmac_ctx_t *state, const vo
/* hash message, copy output into H */
hmac_update(state, (const uint8_t*)message, msg_octets);
- sha1_final(&state->ctx, H);
+ crypto_sha1_final(&state->ctx, H);
/*
* note that we don't need to debug_print() the input, since the
@@ -193,16 +193,16 @@ hmac_compute(hmac_ctx_t *state, const vo
octet_string_hex_string((uint8_t *)H, 20));
/* re-initialize hash context */
- sha1_init(&state->ctx);
+ crypto_sha1_init(&state->ctx);
/* hash opad ^ key */
- sha1_update(&state->ctx, (uint8_t *)state->opad, 64);
+ crypto_sha1_update(&state->ctx, (uint8_t *)state->opad, 64);
/* hash the result of the inner hash */
- sha1_update(&state->ctx, (uint8_t *)H, 20);
+ crypto_sha1_update(&state->ctx, (uint8_t *)H, 20);
/* the result is returned in the array hash_value[] */
- sha1_final(&state->ctx, hash_value);
+ crypto_sha1_final(&state->ctx, hash_value);
/* copy hash_value to *result */
for (i=0; i < tag_len; i++)
diff -rup libsrtp-1.5.0/crypto/hash/sha1.c libsrtp-1.5.0/crypto/hash/sha1.c
--- libsrtp-1.5.0/crypto/hash/sha1.c 2014-10-13 10:35:33.000000000 -0400
+++ libsrtp-1.5.0/crypto/hash/sha1.c 2014-10-31 09:15:20.667474449 -0400
@@ -77,12 +77,12 @@ uint32_t SHA_K2 = 0x8F1BBCDC; /* Kt fo
uint32_t SHA_K3 = 0xCA62C1D6; /* Kt for 60 <= t <= 79 */
void
-sha1(const uint8_t *msg, int octets_in_msg, uint32_t hash_value[5]) {
+crypto_sha1(const uint8_t *msg, int octets_in_msg, uint32_t hash_value[5]) {
sha1_ctx_t ctx;
- sha1_init(&ctx);
- sha1_update(&ctx, msg, octets_in_msg);
- sha1_final(&ctx, hash_value);
+ crypto_sha1_init(&ctx);
+ crypto_sha1_update(&ctx, msg, octets_in_msg);
+ crypto_sha1_final(&ctx, hash_value);
}
@@ -99,7 +99,7 @@ sha1(const uint8_t *msg, int octets_in_
*/
void
-sha1_core(const uint32_t M[16], uint32_t hash_value[5]) {
+crypto_sha1_core(const uint32_t M[16], uint32_t hash_value[5]) {
uint32_t H0;
uint32_t H1;
uint32_t H2;
@@ -186,7 +186,7 @@ sha1_core(const uint32_t M[16], uint32_t
}
void
-sha1_init(sha1_ctx_t *ctx) {
+crypto_sha1_init(sha1_ctx_t *ctx) {
/* initialize state vector */
ctx->H[0] = 0x67452301;
@@ -204,7 +204,7 @@ sha1_init(sha1_ctx_t *ctx) {
}
void
-sha1_update(sha1_ctx_t *ctx, const uint8_t *msg, int octets_in_msg) {
+crypto_sha1_update(sha1_ctx_t *ctx, const uint8_t *msg, int octets_in_msg) {
int i;
uint8_t *buf = (uint8_t *)ctx->M;
@@ -229,7 +229,7 @@ sha1_update(sha1_ctx_t *ctx, const uint8
debug_print(mod_sha1, "(update) running sha1_core()", NULL);
- sha1_core(ctx->M, ctx->H);
+ crypto_sha1_core(ctx->M, ctx->H);
} else {
@@ -252,7 +252,7 @@ sha1_update(sha1_ctx_t *ctx, const uint8
*/
void
-sha1_final(sha1_ctx_t *ctx, uint32_t *output) {
+crypto_sha1_final(sha1_ctx_t *ctx, uint32_t *output) {
uint32_t A, B, C, D, E, TEMP;
uint32_t W[80];
int i, t;
diff -rup libsrtp-1.5.0/crypto/include/sha1.h libsrtp-1.5.0/crypto/include/sha1.h
--- libsrtp-1.5.0/crypto/include/sha1.h 2014-10-13 10:35:33.000000000 -0400
+++ libsrtp-1.5.0/crypto/include/sha1.h 2014-10-31 09:16:10.367733196 -0400
@@ -103,7 +103,7 @@ typedef struct {
*/
void
-sha1(const uint8_t *message, int octets_in_msg, uint32_t output[5]);
+crypto_sha1(const uint8_t *message, int octets_in_msg, uint32_t output[5]);
/*
* sha1_init(&ctx) initializes the SHA1 context ctx
@@ -117,13 +117,13 @@ sha1(const uint8_t *message, int octets
*/
void
-sha1_init(sha1_ctx_t *ctx);
+crypto_sha1_init(sha1_ctx_t *ctx);
void
-sha1_update(sha1_ctx_t *ctx, const uint8_t *M, int octets_in_msg);
+crypto_sha1_update(sha1_ctx_t *ctx, const uint8_t *M, int octets_in_msg);
void
-sha1_final(sha1_ctx_t *ctx, uint32_t output[5]);
+crypto_sha1_final(sha1_ctx_t *ctx, uint32_t output[5]);
/*
* The sha1_core function is INTERNAL to SHA-1, but it is declared
@@ -141,7 +141,7 @@ sha1_final(sha1_ctx_t *ctx, uint32_t out
*/
void
-sha1_core(const uint32_t M[16], uint32_t hash_value[5]);
+crypto_sha1_core(const uint32_t M[16], uint32_t hash_value[5]);
#endif /* else OPENSSL */
diff -rup libsrtp-1.5.0/crypto/test/sha1_driver.c libsrtp-1.5.0/crypto/test/sha1_driver.c
--- libsrtp-1.5.0/crypto/test/sha1_driver.c 2014-10-13 10:35:33.000000000 -0400
+++ libsrtp-1.5.0/crypto/test/sha1_driver.c 2014-10-31 09:15:20.668474454 -0400
@@ -113,9 +113,9 @@ sha1_test_case_validate(const hash_test_
if (test_case->data_len > MAX_HASH_DATA_LEN)
return err_status_bad_param;
- sha1_init(&ctx);
- sha1_update(&ctx, test_case->data, test_case->data_len);
- sha1_final(&ctx, hash_value);
+ crypto_sha1_init(&ctx);
+ crypto_sha1_update(&ctx, test_case->data, test_case->data_len);
+ crypto_sha1_final(&ctx, hash_value);
if (0 == memcmp(test_case->hash, hash_value, 20)) {
#if VERBOSE
printf("PASSED: reference value: %s\n",
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-oepkgs-oe-rv/libsrtp.git
git@gitee.com:src-oepkgs-oe-rv/libsrtp.git
src-oepkgs-oe-rv
libsrtp
libsrtp
master

搜索帮助