--- Entry 1 ---
Filename: build.gradle
Path: build.gradle
Content:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.androidApplication) apply false
}

--- Entry 2 ---
Filename: collected_project_code.txt
Path: collected_project_code.txt
Content:


--- Entry 3 ---
Filename: settings.gradle
Path: settings.gradle
Content:
pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.name = "KyberCryptoApp"
include ':app'


--- Entry 6 ---
Filename: build.gradle
Path: app\build.gradle
Content:
plugins {
    alias(libs.plugins.androidApplication)
}
android {
    namespace 'com.example.kybercryptoapp'
    compileSdk 34
    ndkVersion '23.1.7779620'

    defaultConfig {
        applicationId "com.example.kybercryptoapp"
        minSdk 21
        targetSdk 34
        versionCode 1
        versionName "1.0"

        ndk {
            abiFilters  'armeabi-v7a' // Ensure it matches the ABI of libarmmlib.a
        }

        externalNativeBuild {
            cmake {
                // Additional CMake configurations can be added here if needed
            }
        }

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.debug
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    externalNativeBuild {
        cmake {
            version '3.30.4'  // Ensure this matches your installed CMake version
            path 'src/main/cpp/CMakeLists.txt'  // Point to the CMake file
        }
    }
}

dependencies {
    implementation libs.appcompat
    implementation libs.material
    implementation libs.constraintlayout
    testImplementation libs.junit
    androidTestImplementation libs.androidx.test.ext.junit
    androidTestImplementation libs.espresso.core
}

--- Entry 7 ---
Filename: kyber_API.h
Path: app\distribution\libarmmlib\include\kyber_API.h
Content:

#ifndef KYBER_API_H
#define KYBER_API_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

// External variable declarations
extern uint8_t ekpke[1568];
extern uint8_t dkpke[1536];
extern uint8_t c[1568];

// Function prototypes
void keygeneration(uint8_t ekpke[], uint8_t dkpke[]);
void encryption(uint8_t ekpke[], uint8_t c[], uint16_t messg[]);
void decryption(uint8_t dkpke[], uint8_t c[], uint16_t messg[]);

#ifdef __cplusplus
}
#endif

#endif // KYBER_API_H

--- Entry 8 ---
Filename: ExampleInstrumentedTest.java
Path: app\src\androidTest\java\com\example\kybercryptoapp\ExampleInstrumentedTest.java
Content:
package com.example.kybercryptoapp;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
 * Instrumented test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    @Test
    public void useAppContext() {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
        assertEquals("com.example.kybercryptoapp", appContext.getPackageName());
    }
}

--- Entry 9 ---
Filename: CMakeLists.txt
Path: app\src\main\cpp\CMakeLists.txt
Content:
cmake_minimum_required(VERSION 3.10.2)
project(KyberCryptoApp)

# Enable Position Independent Code
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Include directories for Kyber
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../../distribution/libarmmlib/include")

# Define the shared library libarmmlib.so
add_library(armmlib SHARED IMPORTED)

set_target_properties(
        armmlib
        PROPERTIES IMPORTED_LOCATION
        "${CMAKE_CURRENT_SOURCE_DIR}/../../../distribution/libarmmlib/lib/${ANDROID_ABI}/libarmmlib.so"
)

# Create a shared library for JNI
add_library(
        native-lib
        SHARED
        native-lib.cpp
)

# Link against the shared Kyber library and Android log library
target_link_libraries(
        native-lib
        armmlib
        log
)

--- Entry 10 ---
Filename: kyber_API.h
Path: app\src\main\cpp\kyber_API.h
Content:

#ifndef KYBER_API_H
#define KYBER_API_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

// External variable declarations
extern uint8_t ekpke[1568];
extern uint8_t dkpke[1536];
extern uint8_t c[1568];

// Function prototypes
void keygeneration(uint8_t ekpke[], uint8_t dkpke[]);
void encryption(uint8_t ekpke[], uint8_t c[], uint16_t messg[]);
void decryption(uint8_t dkpke[], uint8_t c[], uint16_t messg[]);

#ifdef __cplusplus
}
#endif

#endif // KYBER_API_H

--- Entry 11 ---
Filename: native-lib.cpp
Path: app\src\main\cpp\native-lib.cpp
Content:
#include <jni.h>
#include <stdint.h>
#include "kyber_API.h"  // Ensure this path is correct based on your include directories

extern "C" {

// Define constants for array sizes
const int EKPKE_SIZE = 1568;
const int DKPKE_SIZE = 1536;
const int C_SIZE = 1568;
const int MESSAGE_SIZE = 256; // Adjust based on your needs

JNIEXPORT void JNICALL
Java_com_example_kybercryptoapp_MainActivity_keygenerationJNI(JNIEnv *env, jobject thiz, jbyteArray ekpke, jbyteArray dkpke) {
    uint8_t ekpke_native[EKPKE_SIZE];
    uint8_t dkpke_native[DKPKE_SIZE];

    // Convert Java byte arrays to C arrays
    env->GetByteArrayRegion(ekpke, 0, EKPKE_SIZE, reinterpret_cast<jbyte *>(ekpke_native));
    env->GetByteArrayRegion(dkpke, 0, DKPKE_SIZE, reinterpret_cast<jbyte *>(dkpke_native));

    // Call the keygeneration function from the library
    keygeneration(ekpke_native, dkpke_native);

    // Set the generated keys back to Java arrays
    env->SetByteArrayRegion(ekpke, 0, EKPKE_SIZE, reinterpret_cast<jbyte *>(ekpke_native));
    env->SetByteArrayRegion(dkpke, 0, DKPKE_SIZE, reinterpret_cast<jbyte *>(dkpke_native));
}

JNIEXPORT void JNICALL
Java_com_example_kybercryptoapp_MainActivity_encryptionJNI(JNIEnv *env, jobject thiz, jbyteArray ekpke, jbyteArray c, jshortArray messg) {
    uint8_t ekpke_native[EKPKE_SIZE];
    uint8_t c_native[C_SIZE];
    uint16_t messg_native[MESSAGE_SIZE];

    // Convert Java byte arrays to C arrays
    env->GetByteArrayRegion(ekpke, 0, EKPKE_SIZE, reinterpret_cast<jbyte *>(ekpke_native));
    env->GetByteArrayRegion(c, 0, C_SIZE, reinterpret_cast<jbyte *>(c_native));

    // Convert Java short array to C array
    env->GetShortArrayRegion(messg, 0, MESSAGE_SIZE, reinterpret_cast<jshort *>(messg_native));

    // Call the encryption function from the library
    encryption(ekpke_native, c_native, messg_native);

    // Set the encrypted data back to Java arrays
    env->SetByteArrayRegion(c, 0, C_SIZE, reinterpret_cast<jbyte *>(c_native));
    env->SetShortArrayRegion(messg, 0, MESSAGE_SIZE, reinterpret_cast<jshort *>(messg_native));
}

JNIEXPORT void JNICALL
Java_com_example_kybercryptoapp_MainActivity_decryptionJNI(JNIEnv *env, jobject thiz, jbyteArray dkpke, jbyteArray c, jshortArray messg) {
    uint8_t dkpke_native[DKPKE_SIZE];
    uint8_t c_native[C_SIZE];
    uint16_t messg_native[MESSAGE_SIZE];

    // Convert Java byte arrays to C arrays
    env->GetByteArrayRegion(dkpke, 0, DKPKE_SIZE, reinterpret_cast<jbyte *>(dkpke_native));
    env->GetByteArrayRegion(c, 0, C_SIZE, reinterpret_cast<jbyte *>(c_native));

    // Convert Java short array to C array
    env->GetShortArrayRegion(messg, 0, MESSAGE_SIZE, reinterpret_cast<jshort *>(messg_native));

    // Call the decryption function from the library
    decryption(dkpke_native, c_native, messg_native);

    // Set the decrypted data back to Java arrays
    env->SetByteArrayRegion(c, 0, C_SIZE, reinterpret_cast<jbyte *>(c_native));
    env->SetShortArrayRegion(messg, 0, MESSAGE_SIZE, reinterpret_cast<jshort *>(messg_native));
}

}

--- Entry 12 ---
Filename: MainActivity.java
Path: app\src\main\java\com\example\kybercryptoapp\MainActivity.java
Content:
package com.example.kybercryptoapp;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity {

    static {
        System.loadLibrary("armmlib");      // Load the Kyber library first
        System.loadLibrary("native-lib");   // Then load the JNI bridge library
    }

    // Native method declarations
    private native void keygenerationJNI(byte[] ekpke, byte[] dkpke);
    private native void encryptionJNI(byte[] ekpke, byte[] c, short[] messg);
    private native void decryptionJNI(byte[] dkpke, byte[] c, short[] messg);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        byte[] ekpke = new byte[1568];
        byte[] dkpke = new byte[1536];
        byte[] c = new byte[1568];
        short[] messg = new short[256];

        // Call the native keygeneration function
        keygenerationJNI(ekpke, dkpke);

        // Example encryption call
        encryptionJNI(ekpke, c, messg);

        // Example decryption call
        decryptionJNI(dkpke, c, messg);

        // Log or display the results as needed
        Log.d("MainActivity", "Key generation, encryption, and decryption complete");
    }
}

--- Entry 13 ---
Filename: ExampleUnitTest.java
Path: app\src\test\java\com\example\kybercryptoapp\ExampleUnitTest.java
Content:
package com.example.kybercryptoapp;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
public class ExampleUnitTest {
    @Test
    public void addition_isCorrect() {
        assertEquals(4, 2 + 2);
    }
}



error

                   com.example.kybercryptoapp           I  Debugger is no longer active
2024-10-08 12:21:40.041  2428-2435  art                     com.example.kybercryptoapp           I  Starting a blocking GC Instrumentation
2024-10-08 12:21:43.279  2453-2453  art                     com.example.kybercryptoapp           W  Unknown instruction set features for ARM CPU variant (generic) using conservative defaults
2024-10-08 12:21:45.520  2453-2453  AndroidRuntime          com.example.kybercryptoapp           D  Shutting down VM
2024-10-08 12:21:45.523  2453-2453  AndroidRuntime          com.example.kybercryptoapp           E  FATAL EXCEPTION: main
                                                                                                    Process: com.example.kybercryptoapp, PID: 2453
                                                                                                    java.lang.UnsatisfiedLinkError: dlopen failed: library "libc.so.6" not found
                                                                                                    	at java.lang.Runtime.loadLibrary0(Runtime.java:977)
                                                                                                    	at java.lang.System.loadLibrary(System.java:1530)
                                                                                                    	at com.example.kybercryptoapp.MainActivity.<clinit>(MainActivity.java:10)
                                                                                                    	at java.lang.Class.newInstance(Native Method)
                                                                                                    	at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
                                                                                                    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2538)
                                                                                                    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
                                                                                                    	at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                                    	at android.os.Looper.loop(Looper.java:154)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:6077)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
2024-10-08 12:21:58.568  2453-2460  art                     com.example.kybercryptoapp           I  Debugger is no longer active
2024-10-08 12:21:58.568  2453-2460  art                     com.example.kybercryptoapp           I  Starting a blocking GC Instrumentation



i am running it on windows FYI