Skip to content

Commit

Permalink
fix type consistency in jni wrapper code (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
vixentael authored and Lagovas committed Oct 31, 2017
1 parent 5919a24 commit 982b7a5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions jni/themis_cell.c
Expand Up @@ -74,10 +74,10 @@ JNIEXPORT jobjectArray JNICALL Java_com_cossacklabs_themis_SecureCell_encrypt(JN
switch (mode)
{
case MODE_SEAL:
res = themis_secure_cell_encrypt_seal(key_buf, key_length, context_buf, context_length, data_buf, data_length, NULL, &encrypted_data_length);
res = themis_secure_cell_encrypt_seal((uint8_t *)key_buf, key_length, (uint8_t *)context_buf, context_length, (uint8_t *)data_buf, data_length, NULL, &encrypted_data_length);
break;
case MODE_TOKEN_PROTECT:
res = themis_secure_cell_encrypt_token_protect(key_buf, key_length, context_buf, context_length, data_buf, data_length, NULL, &additional_data_length, NULL, &encrypted_data_length);
res = themis_secure_cell_encrypt_token_protect((uint8_t *)key_buf, key_length, (uint8_t *)context_buf, context_length, (uint8_t *)data_buf, data_length, NULL, &additional_data_length, NULL, &encrypted_data_length);
break;
case MODE_CONTEXT_IMPRINT:
if (!context)
Expand All @@ -86,7 +86,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_cossacklabs_themis_SecureCell_encrypt(JN
goto err;
}

res = themis_secure_cell_encrypt_context_imprint(key_buf, key_length, data_buf, data_length, context_buf, context_length, NULL, &encrypted_data_length);
res = themis_secure_cell_encrypt_context_imprint((uint8_t *)key_buf, key_length, (uint8_t *)data_buf, data_length, (uint8_t *)context_buf, context_length, NULL, &encrypted_data_length);
break;
default:
goto err;
Expand Down Expand Up @@ -129,10 +129,10 @@ JNIEXPORT jobjectArray JNICALL Java_com_cossacklabs_themis_SecureCell_encrypt(JN
switch (mode)
{
case MODE_SEAL:
res = themis_secure_cell_encrypt_seal(key_buf, key_length, context_buf, context_length, data_buf, data_length, encrypted_data_buf, &encrypted_data_length);
res = themis_secure_cell_encrypt_seal((uint8_t *)key_buf, key_length, (uint8_t *)context_buf, context_length, (uint8_t *)data_buf, data_length, (uint8_t *)encrypted_data_buf, &encrypted_data_length);
break;
case MODE_TOKEN_PROTECT:
res = themis_secure_cell_encrypt_token_protect(key_buf, key_length, context_buf, context_length, data_buf, data_length, additional_data_buf, &additional_data_length, encrypted_data_buf, &encrypted_data_length);
res = themis_secure_cell_encrypt_token_protect((uint8_t *)key_buf, key_length, (uint8_t *)context_buf, context_length, (uint8_t *)data_buf, data_length, (uint8_t *)additional_data_buf, &additional_data_length, (uint8_t *)encrypted_data_buf, &encrypted_data_length);
break;
case MODE_CONTEXT_IMPRINT:
if (!context)
Expand All @@ -141,7 +141,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_cossacklabs_themis_SecureCell_encrypt(JN
goto err;
}

res = themis_secure_cell_encrypt_context_imprint(key_buf, key_length, data_buf, data_length, context_buf, context_length, encrypted_data_buf, &encrypted_data_length);
res = themis_secure_cell_encrypt_context_imprint((uint8_t *)key_buf, key_length, (uint8_t *)data_buf, data_length, (uint8_t *)context_buf, context_length, (uint8_t *)encrypted_data_buf, &encrypted_data_length);
break;
default:
goto err;
Expand Down Expand Up @@ -269,7 +269,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_cossacklabs_themis_SecureCell_decrypt(JNIE
switch (mode)
{
case MODE_SEAL:
res = themis_secure_cell_decrypt_seal(key_buf, key_length, context_buf, context_length, encrypted_data_buf, encrypted_data_length, NULL, &data_length);
res = themis_secure_cell_decrypt_seal((uint8_t *)key_buf, key_length, (uint8_t *)context_buf, context_length, (uint8_t *)encrypted_data_buf, encrypted_data_length, NULL, &data_length);
break;
case MODE_TOKEN_PROTECT:
if (!additional_data_buf)
Expand All @@ -278,7 +278,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_cossacklabs_themis_SecureCell_decrypt(JNIE
goto err;
}

res = themis_secure_cell_decrypt_token_protect(key_buf, key_length, context_buf, context_length, encrypted_data_buf, encrypted_data_length, additional_data_buf, additional_data_length, NULL, &data_length);
res = themis_secure_cell_decrypt_token_protect((uint8_t *)key_buf, key_length, (uint8_t *)context_buf, context_length, (uint8_t *)encrypted_data_buf, encrypted_data_length, (uint8_t *)additional_data_buf, additional_data_length, NULL, &data_length);
break;
case MODE_CONTEXT_IMPRINT:
if (!context)
Expand All @@ -287,7 +287,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_cossacklabs_themis_SecureCell_decrypt(JNIE
goto err;
}

res = themis_secure_cell_encrypt_context_imprint(key_buf, key_length, encrypted_data_buf, encrypted_data_length, context_buf, context_length, NULL, &data_length);
res = themis_secure_cell_encrypt_context_imprint((uint8_t *)key_buf, key_length, (uint8_t *)encrypted_data_buf, encrypted_data_length, (uint8_t *)context_buf, context_length, NULL, &data_length);
break;
default:
goto err;
Expand All @@ -313,7 +313,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_cossacklabs_themis_SecureCell_decrypt(JNIE
switch (mode)
{
case MODE_SEAL:
res = themis_secure_cell_decrypt_seal(key_buf, key_length, context_buf, context_length, encrypted_data_buf, encrypted_data_length, data_buf, &data_length);
res = themis_secure_cell_decrypt_seal((uint8_t *)key_buf, key_length, (uint8_t *)context_buf, context_length, (uint8_t *)encrypted_data_buf, encrypted_data_length, (uint8_t *)data_buf, &data_length);
break;
case MODE_TOKEN_PROTECT:
if (!additional_data_buf)
Expand All @@ -322,7 +322,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_cossacklabs_themis_SecureCell_decrypt(JNIE
goto err;
}

res = themis_secure_cell_decrypt_token_protect(key_buf, key_length, context_buf, context_length, encrypted_data_buf, encrypted_data_length, additional_data_buf, additional_data_length, data_buf, &data_length);
res = themis_secure_cell_decrypt_token_protect((uint8_t *)key_buf, key_length, (uint8_t *)context_buf, context_length, (uint8_t *)encrypted_data_buf, encrypted_data_length, (uint8_t *)additional_data_buf, additional_data_length, (uint8_t *)data_buf, &data_length);
break;
case MODE_CONTEXT_IMPRINT:
if (!context)
Expand All @@ -331,7 +331,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_cossacklabs_themis_SecureCell_decrypt(JNIE
goto err;
}

res = themis_secure_cell_encrypt_context_imprint(key_buf, key_length, encrypted_data_buf, encrypted_data_length, context_buf, context_length, data_buf, &data_length);
res = themis_secure_cell_encrypt_context_imprint((uint8_t *)key_buf, key_length, (uint8_t *)encrypted_data_buf, encrypted_data_length, (uint8_t *)context_buf, context_length, (uint8_t *)data_buf, &data_length);
break;
default:
goto err;
Expand Down
4 changes: 2 additions & 2 deletions jni/themis_keygen.c
Expand Up @@ -82,10 +82,10 @@ JNIEXPORT jobjectArray JNICALL Java_com_cossacklabs_themis_KeypairGenerator_gene
switch (key_type)
{
case KEYTYPE_EC:
res = themis_gen_ec_key_pair(priv_buf, &private_length, pub_buf, &public_length);
res = themis_gen_ec_key_pair((uint8_t *)priv_buf, &private_length, (uint8_t *)pub_buf, &public_length);
break;
case KEYTYPE_RSA:
res = themis_gen_rsa_key_pair(priv_buf, &private_length, pub_buf, &public_length);
res = themis_gen_rsa_key_pair((uint8_t *)priv_buf, &private_length, (uint8_t *)pub_buf, &public_length);
break;
default:
(*env)->ReleaseByteArrayElements(env, public, pub_buf, 0);
Expand Down
8 changes: 4 additions & 4 deletions jni/themis_message.c
Expand Up @@ -69,11 +69,11 @@ JNIEXPORT jbyteArray JNICALL Java_com_cossacklabs_themis_SecureMessage_process(J

if (is_wrap)
{
res = themis_secure_message_wrap(priv_buf, private_length, pub_buf, public_length, message_buf, message_length, NULL, &output_length);
res = themis_secure_message_wrap((uint8_t *)priv_buf, private_length, (uint8_t *)pub_buf, public_length, (uint8_t *)message_buf, message_length, NULL, &output_length);
}
else
{
res = themis_secure_message_unwrap(priv_buf, private_length, pub_buf, public_length, message_buf, message_length, NULL, &output_length);
res = themis_secure_message_unwrap((uint8_t *)priv_buf, private_length, (uint8_t *)pub_buf, public_length, (uint8_t *)message_buf, message_length, NULL, &output_length);
}

if (THEMIS_BUFFER_TOO_SMALL != res)
Expand All @@ -95,11 +95,11 @@ JNIEXPORT jbyteArray JNICALL Java_com_cossacklabs_themis_SecureMessage_process(J

if (is_wrap)
{
res = themis_secure_message_wrap(priv_buf, private_length, pub_buf, public_length, message_buf, message_length, output_buf, &output_length);
res = themis_secure_message_wrap((uint8_t *)priv_buf, private_length, (uint8_t *)pub_buf, public_length, (uint8_t *)message_buf, message_length, (uint8_t *)output_buf, &output_length);
}
else
{
res = themis_secure_message_unwrap(priv_buf, private_length, pub_buf, public_length, message_buf, message_length, output_buf, &output_length);
res = themis_secure_message_unwrap((uint8_t *)priv_buf, private_length, (uint8_t *)pub_buf, public_length, (uint8_t *)message_buf, message_length, (uint8_t *)output_buf, &output_length);
}

err:
Expand Down

0 comments on commit 982b7a5

Please sign in to comment.