<commit_before>#include <cryptopp/eccrypto.h>
#include <cryptopp/validate.h>

#include "de_quisquis_ec_impl_pp_CryptoppNative.h"
#include "curves.h"
#include "helpers.h"

extern "C" {

JNIEXPORT jbyteArray JNICALL Java_de_quisquis_ec_impl_pp_CryptoppNative_encrypt
  (JNIEnv *env, jclass theClass, jbyteArray plaintext, jbyteArray modulus,
   jbyteArray a, jbyteArray b, jbyteArray gX, jbyteArray gY, jbyteArray n,
   jbyteArray qX, jbyteArray qY) {

    CryptoPP::ECIES<CryptoPP::ECP>::Encryptor encrypter;
    initPublicKey(env, encrypter.AccessKey(),
                  modulus, a, b, gX, gY, n, qX, qY);

    jbyte *plainBytes = env->GetByteArrayElements(plaintext, NULL);
    if (plainBytes == NULL) {
        return NULL; // FIXME: check/throw exception
    }
    jsize plainLen = env->GetArrayLength(plaintext);
    size_t cipherLen = encrypter.CiphertextLength(plainLen);
    jbyteArray result = env->NewByteArray(cipherLen);
    if (result == NULL) {
	// FIXME: check/throw exception
    } else {
        jbyte *bytes = env->GetByteArrayElements(result, NULL);
        if (bytes == NULL) {
            // FIXME: check/throw exception
        } else {
            encrypter.Encrypt(GlobalRNG(), plainBytes, plainLen, bytes);
            env->ReleaseByteArrayElements(result, bytes, 0);
        }
    }
    env->ReleaseByteArrayElements(plaintext, plainBytes, JNI_ABORT);
}

} /* extern "C" */<commit_msg>Added missing return<commit_after>#include <cryptopp/eccrypto.h>
#include <cryptopp/validate.h>

#include "de_quisquis_ec_impl_pp_CryptoppNative.h"
#include "curves.h"
#include "helpers.h"

extern "C" {

JNIEXPORT jbyteArray JNICALL Java_de_quisquis_ec_impl_pp_CryptoppNative_encrypt
  (JNIEnv *env, jclass theClass, jbyteArray plaintext, jbyteArray modulus,
   jbyteArray a, jbyteArray b, jbyteArray gX, jbyteArray gY, jbyteArray n,
   jbyteArray qX, jbyteArray qY) {

    CryptoPP::ECIES<CryptoPP::ECP>::Encryptor encrypter;
    initPublicKey(env, encrypter.AccessKey(),
                  modulus, a, b, gX, gY, n, qX, qY);

    jbyte *plainBytes = env->GetByteArrayElements(plaintext, NULL);
    if (plainBytes == NULL) {
        return NULL; // FIXME: check/throw exception
    }
    jsize plainLen = env->GetArrayLength(plaintext);
    size_t cipherLen = encrypter.CiphertextLength(plainLen);
    jbyteArray result = env->NewByteArray(cipherLen);
    if (result == NULL) {
	// FIXME: check/throw exception
    } else {
        jbyte *bytes = env->GetByteArrayElements(result, NULL);
        if (bytes == NULL) {
            // FIXME: check/throw exception
        } else {
            encrypter.Encrypt(GlobalRNG(), plainBytes, plainLen, bytes);
            env->ReleaseByteArrayElements(result, bytes, 0);
        }
    }
    env->ReleaseByteArrayElements(plaintext, plainBytes, JNI_ABORT);
    return result;
}

} /* extern "C" */
{'fraction_non_alphanumeric': 0.11622191011235955, 'fraction_numerical': 0.0007022471910112359, 'mean_word_length': 3.515055467511886, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3168479', 'n_tokens_mistral': 990, 'n_tokens_neox': 971, 'n_words': 206}