正在显示
2 个修改的文件
包含
1 行增加
和
10 行删除
@@ -73,7 +73,7 @@ namespace _srs_internal | @@ -73,7 +73,7 @@ namespace _srs_internal | ||
73 | int __openssl_HMACsha256(HMAC_CTX* ctx, const void* data, int data_size, void* digest, unsigned int* digest_size) | 73 | int __openssl_HMACsha256(HMAC_CTX* ctx, const void* data, int data_size, void* digest, unsigned int* digest_size) |
74 | { | 74 | { |
75 | int ret = ERROR_SUCCESS; | 75 | int ret = ERROR_SUCCESS; |
76 | -#ifndef SRS_OSX | 76 | + |
77 | if (HMAC_Update(ctx, (unsigned char *) data, data_size) < 0) { | 77 | if (HMAC_Update(ctx, (unsigned char *) data, data_size) < 0) { |
78 | ret = ERROR_OpenSslSha256Update; | 78 | ret = ERROR_OpenSslSha256Update; |
79 | return ret; | 79 | return ret; |
@@ -83,10 +83,6 @@ namespace _srs_internal | @@ -83,10 +83,6 @@ namespace _srs_internal | ||
83 | ret = ERROR_OpenSslSha256Final; | 83 | ret = ERROR_OpenSslSha256Final; |
84 | return ret; | 84 | return ret; |
85 | } | 85 | } |
86 | -#else | ||
87 | - HMAC_Update(ctx, (unsigned char *) data, data_size); | ||
88 | - HMAC_Final(ctx, (unsigned char *) digest, digest_size); | ||
89 | -#endif | ||
90 | 86 | ||
91 | return ret; | 87 | return ret; |
92 | } | 88 | } |
@@ -120,15 +116,10 @@ namespace _srs_internal | @@ -120,15 +116,10 @@ namespace _srs_internal | ||
120 | // @remark, if no key, use EVP_Digest to digest, | 116 | // @remark, if no key, use EVP_Digest to digest, |
121 | // for instance, in python, hashlib.sha256(data).digest(). | 117 | // for instance, in python, hashlib.sha256(data).digest(). |
122 | HMAC_CTX_init(&ctx); | 118 | HMAC_CTX_init(&ctx); |
123 | - | ||
124 | -#ifndef SRS_OSX | ||
125 | if (HMAC_Init_ex(&ctx, __key, key_size, EVP_sha256(), NULL) < 0) { | 119 | if (HMAC_Init_ex(&ctx, __key, key_size, EVP_sha256(), NULL) < 0) { |
126 | ret = ERROR_OpenSslSha256Init; | 120 | ret = ERROR_OpenSslSha256Init; |
127 | return ret; | 121 | return ret; |
128 | } | 122 | } |
129 | -#else | ||
130 | - HMAC_Init_ex(&ctx, __key, key_size, EVP_sha256(), NULL); | ||
131 | -#endif | ||
132 | 123 | ||
133 | ret = __openssl_HMACsha256(&ctx, data, data_size, __digest, &digest_size); | 124 | ret = __openssl_HMACsha256(&ctx, data, data_size, __digest, &digest_size); |
134 | HMAC_CTX_cleanup(&ctx); | 125 | HMAC_CTX_cleanup(&ctx); |
-
请 注册 或 登录 后发表评论