Hello Nikos,
> Did you compile on these systems?
Yes. Using portage on Gentoo, with help from distcc on my main box.
> What is the output of make check for nettle and gnutls?
Compiled manually to check this. The make check test passed
successfully for both nettle and gnutls.
I was using GNUTLS_CIPHER_AES_256_CBC
After changing that to GNUTLS_CIPHER_AES_256_GCM, I don't get the
"Floating point exception".
I've attached 2 files.
test_gnutls.c uses GNUTLS_CIPHER_AES_256_GCM and works on both Fedora
25 x86_64 and Gentoo ARMv7 HardFP
test_gnutls2.c uses GNUTLS_CIPHER_AES_256_CBC and works only on Fedora 25 x86_64
Can you please check what I'm doing wrong?
Thanks
Mandar Joshi
//gcc -g -o test_gnutls2 test_gnutls2.c `pkg-config --cflags --libs gnutls`
#include <stdio.h>
#include <string.h>
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
int main (int argc, char *argv[]) {
gnutls_cipher_hd_t encrypt_handle, decrypt_handle;
gnutls_datum_t key;
key.data = "wxyzwxyzwxyzwxyzwxyzwxyzwxyzwxyz";
key.size = 32;
char input_text[16];;
char encrypted_text[16];
char decrypted_text[16];
char read_text[16];
memset (input_text, 0, 16);
memset (encrypted_text, 0, 16);
memset (decrypted_text, 0, 16);
memset (read_text, 0, 16);
strcpy (input_text, "Test Text");
printf ("Init: %d\n", gnutls_cipher_init (&encrypt_handle, GNUTLS_CIPHER_AES_256_CBC, &key, NULL));
printf ("Encrypt: %d\n", gnutls_cipher_encrypt2 (encrypt_handle, input_text, 16, encrypted_text, 16));
FILE *encrypted_file = fopen ("encrypted.cbc", "wb");
fwrite (encrypted_text, 16, 1, encrypted_file);
fclose (encrypted_file);
FILE *read_file = fopen ("encrypted.cbc", "rb");
fread (read_text, 16, 1, read_file);
fclose (read_file);
printf ("Init: %d\n", gnutls_cipher_init (&decrypt_handle, GNUTLS_CIPHER_AES_256_CBC, &key, NULL));
printf ("Decrypt: %d\n", gnutls_cipher_decrypt2 (decrypt_handle, read_text, 16 , decrypted_text, 16));
printf ("Input Text: %s\nDecrypted Text: %s\n", input_text, decrypted_text);
return 0;
}
//gcc -g -o test_gnutls test_gnutls.c `pkg-config --cflags --libs gnutls`
#include <stdio.h>
#include <string.h>
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
int main (int argc, char *argv[]) {
gnutls_cipher_hd_t encrypt_handle, decrypt_handle;
gnutls_datum_t key;
key.data = "wxyzwxyzwxyzwxyzwxyzwxyzwxyzwxyz";
key.size = 32;
char input_text[16];;
char encrypted_text[16];
char decrypted_text[16];
char read_text[16];
memset (input_text, 0, 16);
memset (encrypted_text, 0, 16);
memset (decrypted_text, 0, 16);
memset (read_text, 0, 16);
strcpy (input_text, "Test Text");
printf ("Init: %d\n", gnutls_cipher_init (&encrypt_handle, GNUTLS_CIPHER_AES_256_GCM, &key, NULL));
printf ("Encrypt: %d\n", gnutls_cipher_encrypt2 (encrypt_handle, input_text, 16, encrypted_text, 16));
FILE *encrypted_file = fopen ("encrypted.cbc", "wb");
fwrite (encrypted_text, 16, 1, encrypted_file);
fclose (encrypted_file);
FILE *read_file = fopen ("encrypted.cbc", "rb");
fread (read_text, 16, 1, read_file);
fclose (read_file);
printf ("Init: %d\n", gnutls_cipher_init (&decrypt_handle, GNUTLS_CIPHER_AES_256_GCM, &key, NULL));
printf ("Decrypt: %d\n", gnutls_cipher_decrypt2 (decrypt_handle, read_text, 16 , decrypted_text, 16));
printf ("Input Text: %s\nDecrypted Text: %s\n", input_text, decrypted_text);
return 0;
}
_______________________________________________
Gnutls-help mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnutls-help