     cudaMalloc((void **)&secretGpu, nBytes);
 
 
-    cudaMalloc((void **)&msgGpu, (msg_size/matrix_size) * sizeof(float *));
     printf("msg_size/matrix_size: %d \n", msg_size/matrix_size);
-
-
-
-    cudaMalloc((void **)&resultGpu, (msg_size/matrix_size) * sizeof(float *));
+    printf("\nmsg_vector_list[1]: %d\n", *msg_vector_list[1]);
+
+
+    cudaMalloc((void **)&resultGpu, nBytes);
+    cudaMalloc((void **)&msgGpu, nBytes);
 
 
     cudaMemcpy(secretGpu, *SKey, nBytes, cudaMemcpyHostToDevice);


#define ASCII_CHARS 128

__global__ void mtxEncrypt(float *secretKey, float *msg, float *result, int matrix_dims) {
    int tx = threadIdx.x;
    int ty = threadIdx.y;
    float Pvalue = 0;
  
  //  printf("secretKey: %3.1f, *secretKey: %3.1f, &secretKey: %3.1f, *msg: %3.1f\n", secretKey, *secretKey, &secretKey, *msg);
    for (int k = 0; k < matrix_dims; ++k) {
   //     printf("secretkey[k]: %    
        float secretElement = secretKey[ty * matrix_dims + k];
        float msgElement = msg[k * matrix_dims + tx];
        
  //      printf("\nMultiplying %f by %f: \n", secretElement, msgElement);
        Pvalue  += secretElement * msgElement;
    }
    
//    printf("PValue: %d", (int)Pvalue%ASCII_CHARS);
    result[ty * matrix_dims + tx] = (int)Pvalue%ASCII_CHARS;
}

void secretKey(float **SKey, float **invSKey, int matrix_dims) {
    int k,z;
    //*SKey = malloc((matrix_dims*sizeof(*SKey)) + matrix_dims*matrix_dims*sizeof(int **));
    //*invSKey = malloc(matrix_dims*matrix_dims*sizeof(int *));

    float xSKey[4][4] = {{8, 6, 9, 5},
                {6, 9, 5, 10},

    printf("2\n");
    for (z = 0; z < msg_size/matrix_size; z++) {
        results[z] = (float *)malloc(matrix_size * sizeof(float));
        memset(results[z], 0, nBytes);
    }
    printf("3\n");

    cudaDeviceProp deviceProp;
    cudaGetDeviceProperties(&deviceProp, 0);
