mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-08-06 19:38:58 +00:00
Fix iOS compilation errors: add CC_SHA384 and fix size_tVar types
This commit is contained in:
parent
1a0f5ec675
commit
5b65ee20cb
2 changed files with 9 additions and 5 deletions
|
|
@ -164,7 +164,7 @@ internal fun pluginAesEncrypt(
|
|||
}
|
||||
|
||||
val tagBytes = ByteArray(16)
|
||||
val tagLengthVar = alloc<kotlinx.cinterop.size_tVar>()
|
||||
val tagLengthVar = alloc<platform.posix.size_tVar>()
|
||||
tagLengthVar.value = 16UL
|
||||
|
||||
tagBytes.usePinned { pinnedTag ->
|
||||
|
|
@ -199,7 +199,7 @@ internal fun pluginAesEncrypt(
|
|||
var finalData: ByteArray? = null
|
||||
|
||||
memScoped {
|
||||
val dataOutMoved = alloc<kotlinx.cinterop.size_tVar>()
|
||||
val dataOutMoved = alloc<platform.posix.size_tVar>()
|
||||
|
||||
var options = 0U
|
||||
if (isEcb) {
|
||||
|
|
@ -310,7 +310,7 @@ internal fun pluginAesDecrypt(
|
|||
}
|
||||
}
|
||||
|
||||
val tagLengthVar = alloc<kotlinx.cinterop.size_tVar>()
|
||||
val tagLengthVar = alloc<platform.posix.size_tVar>()
|
||||
tagLengthVar.value = 16UL
|
||||
|
||||
val finalStatus = CCCryptorGCMFinal(
|
||||
|
|
@ -343,7 +343,7 @@ internal fun pluginAesDecrypt(
|
|||
var finalData: ByteArray? = null
|
||||
|
||||
memScoped {
|
||||
val dataOutMoved = alloc<kotlinx.cinterop.size_tVar>()
|
||||
val dataOutMoved = alloc<platform.posix.size_tVar>()
|
||||
|
||||
var options = 0U
|
||||
if (isEcb) {
|
||||
|
|
@ -472,6 +472,7 @@ private fun normalizeDigestAlgorithm(algorithm: String): String {
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalForeignApi::class)
|
||||
private fun normalizePbkdf2Prf(algorithm: String) =
|
||||
when (algorithm.normalizedAlgorithmToken().removePrefix("HMAC")) {
|
||||
"SHA1" -> kCCPRFHmacAlgSHA1
|
||||
|
|
@ -481,6 +482,7 @@ private fun normalizePbkdf2Prf(algorithm: String) =
|
|||
else -> error("Unsupported PBKDF2 hash algorithm: $algorithm")
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalForeignApi::class)
|
||||
private fun normalizeHmacAlgorithm(algorithm: String) =
|
||||
when (algorithm.normalizedAlgorithmToken().removePrefix("HMAC")) {
|
||||
"MD5" -> kCCHmacAlgMD5 to CC_MD5_DIGEST_LENGTH.toInt()
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ enum {
|
|||
CC_MD5_DIGEST_LENGTH = 16,
|
||||
CC_SHA1_DIGEST_LENGTH = 20,
|
||||
CC_SHA256_DIGEST_LENGTH = 32,
|
||||
CC_SHA384_DIGEST_LENGTH = 48,
|
||||
CC_SHA512_DIGEST_LENGTH = 64,
|
||||
};
|
||||
|
||||
|
|
@ -21,6 +22,7 @@ typedef enum {
|
|||
unsigned char *CC_MD5(const void *data, CC_LONG len, unsigned char *md);
|
||||
unsigned char *CC_SHA1(const void *data, CC_LONG len, unsigned char *md);
|
||||
unsigned char *CC_SHA256(const void *data, CC_LONG len, unsigned char *md);
|
||||
unsigned char *CC_SHA384(const void *data, CC_LONG len, unsigned char *md);
|
||||
unsigned char *CC_SHA512(const void *data, CC_LONG len, unsigned char *md);
|
||||
|
||||
void CCHmac(
|
||||
|
|
@ -48,7 +50,7 @@ enum {
|
|||
|
||||
int CCKeyDerivationPBKDF(
|
||||
CCPBKDFAlgorithm algorithm,
|
||||
const char *password,
|
||||
const void *password,
|
||||
size_t passwordLen,
|
||||
const uint8_t *salt,
|
||||
size_t saltLen,
|
||||
|
|
|
|||
Loading…
Reference in a new issue