1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

remove the code for xcode, not required.

This commit is contained in:
winlin 2015-03-10 18:33:32 +08:00
parent b3aed2cb59
commit 24616e15b5
2 changed files with 1 additions and 10 deletions

View file

@ -73,7 +73,7 @@ namespace _srs_internal
int __openssl_HMACsha256(HMAC_CTX* ctx, const void* data, int data_size, void* digest, unsigned int* digest_size) int __openssl_HMACsha256(HMAC_CTX* ctx, const void* data, int data_size, void* digest, unsigned int* digest_size)
{ {
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
#ifndef SRS_OSX
if (HMAC_Update(ctx, (unsigned char *) data, data_size) < 0) { if (HMAC_Update(ctx, (unsigned char *) data, data_size) < 0) {
ret = ERROR_OpenSslSha256Update; ret = ERROR_OpenSslSha256Update;
return ret; return ret;
@ -83,10 +83,6 @@ namespace _srs_internal
ret = ERROR_OpenSslSha256Final; ret = ERROR_OpenSslSha256Final;
return ret; return ret;
} }
#else
HMAC_Update(ctx, (unsigned char *) data, data_size);
HMAC_Final(ctx, (unsigned char *) digest, digest_size);
#endif
return ret; return ret;
} }
@ -120,15 +116,10 @@ namespace _srs_internal
// @remark, if no key, use EVP_Digest to digest, // @remark, if no key, use EVP_Digest to digest,
// for instance, in python, hashlib.sha256(data).digest(). // for instance, in python, hashlib.sha256(data).digest().
HMAC_CTX_init(&ctx); HMAC_CTX_init(&ctx);
#ifndef SRS_OSX
if (HMAC_Init_ex(&ctx, __key, key_size, EVP_sha256(), NULL) < 0) { if (HMAC_Init_ex(&ctx, __key, key_size, EVP_sha256(), NULL) < 0) {
ret = ERROR_OpenSslSha256Init; ret = ERROR_OpenSslSha256Init;
return ret; return ret;
} }
#else
HMAC_Init_ex(&ctx, __key, key_size, EVP_sha256(), NULL);
#endif
ret = __openssl_HMACsha256(&ctx, data, data_size, __digest, &digest_size); ret = __openssl_HMACsha256(&ctx, data, data_size, __digest, &digest_size);
HMAC_CTX_cleanup(&ctx); HMAC_CTX_cleanup(&ctx);