#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "xyssl-0.9/include/xyssl/havege.h"
#include "xyssl-0.9/include/xyssl/bignum.h"
#include "xyssl-0.9/include/xyssl/rsa.h"
#include "xyssl-0.9/include/xyssl/sha2.h"
#include "xyssl-0.9/include/xyssl/aes.h"
Go to the source code of this file.
Defines | |
#define | PATH xyssl-0.9/include/xyssl |
#define | MODE_ENCRYPT 0 |
#define | MODE_DECRYPT 1 |
#define | MAXDATASIZE 4096 |
#define | KEY_SIZE 1024 |
#define | EXPONENT 65537 |
#define | RSA_EN 0 |
#define | RSA_DE 1 |
Functions | |
int | read_known_host_file (char *pubkey, char *hname, char *filename) |
int | read_encrypted_file (char *enfile, char *string, unsigned char *passphase) |
int | rsa_encryption (char *publickey, char *plaintext, char *ciphertext) |
int | rsa_decryption (char *ciphertext, char *plaintext, char *privatekeyfile) |
int | initiate_migration_process (int sockfd, int *nonce, char *publickey, char *privatekey, unsigned char *aes_key) |
int | reply_migration_process (int new_fd, int *nonce, char *publickey, char *privatekey, unsigned char *aes_key) |
void | generate_AES_key (char *key) |
int | generate_encrypt_send_AES_key (int sockfd, int *nonce, unsigned char *key, char *publickey, char *privkey) |
int | receive_decrypt_AES_key (int new_fd, int *nonce, unsigned char *key, char *privkey, char *publickey) |
int | aes_en_de (int mode, char *infile, char *outfile, unsigned char *AES_key, int *nonce, int sockfd) |
int | send_AES_en_MA (int sockfd, int *nonce, char *outfile, char *peer_pubkey) |
int | receive_AES_en_MA (int new_fd, int *nonce, char *infile, char *privatekey) |
int | receiving_verifying_MA_RSA (int sockfd, char *privkeyfile) |
int | receiving_decrypting_MA_RSA (int new_fd, char *privkeyfile) |
int | generate_RSA_keys_plaintext (char *pubkeyfile, char *privkeyfile) |
int | generate_RSA_keys_ciphertext (char *pubkeyfile, char *privkeyfile, unsigned char *passphrase) |
#define EXPONENT 65537 |
Definition at line 25 of file interface.h.
Referenced by generate_RSA_keys_ciphertext(), generate_RSA_keys_plaintext(), and main().
#define KEY_SIZE 1024 |
Definition at line 24 of file interface.h.
Referenced by generate_RSA_keys_ciphertext(), generate_RSA_keys_plaintext(), and main().
#define MAXDATASIZE 4096 |
Definition at line 22 of file interface.h.
#define MODE_DECRYPT 1 |
Definition at line 21 of file interface.h.
Referenced by aes_en_de(), and main().
#define MODE_ENCRYPT 0 |
Definition at line 20 of file interface.h.
Referenced by aes_en_de(), and main().
#define PATH xyssl-0.9/include/xyssl |
Definition at line 9 of file interface.h.
#define RSA_DE 1 |
Definition at line 28 of file interface.h.
Referenced by rsa_decryption().
#define RSA_EN 0 |
Definition at line 27 of file interface.h.
Referenced by rsa_encryption().
int aes_en_de | ( | int | mode, | |
char * | infile, | |||
char * | outfile, | |||
unsigned char * | AES_key, | |||
int * | nonce, | |||
int | sockfd | |||
) |
Definition at line 1122 of file interface.c.
References aes_crypt_ecb(), AES_DECRYPT, AES_ENCRYPT, aes_setkey_dec(), aes_setkey_enc(), append_nonce_to_MA(), extract_nonce_from_MA(), int, MODE_DECRYPT, MODE_ENCRYPT, sha2_finish(), sha2_hmac_finish(), sha2_hmac_starts(), sha2_hmac_update(), sha2_starts(), and sha2_update().
Referenced by auth_rece_send_msg(), generate_RSA_keys_ciphertext(), read_encrypted_file(), and rece_de_msg().
void generate_AES_key | ( | char * | key | ) |
Definition at line 1099 of file interface.c.
References havege_init(), and havege_rand().
Referenced by initiate_migration_process(), and reply_migration_process().
int generate_encrypt_send_AES_key | ( | int | sockfd, | |
int * | nonce, | |||
unsigned char * | key, | |||
char * | publickey, | |||
char * | privkey | |||
) |
int generate_RSA_keys_ciphertext | ( | char * | pubkeyfile, | |
char * | privkeyfile, | |||
unsigned char * | passphrase | |||
) |
Definition at line 1752 of file interface.c.
References aes_en_de(), rsa_context::D, rsa_context::DP, rsa_context::DQ, rsa_context::E, EXPONENT, havege_init(), havege_rand(), KEY_SIZE, mpi_write_file(), rsa_context::N, rsa_context::P, rsa_context::Q, rsa_context::QP, rsa_gen_key(), rsa_init(), and RSA_PKCS_V15.
Referenced by main().
int generate_RSA_keys_plaintext | ( | char * | pubkeyfile, | |
char * | privkeyfile | |||
) |
Definition at line 1693 of file interface.c.
References rsa_context::D, rsa_context::DP, rsa_context::DQ, rsa_context::E, EXPONENT, havege_init(), havege_rand(), KEY_SIZE, mpi_write_file(), rsa_context::N, rsa_context::P, rsa_context::Q, rsa_context::QP, rsa_gen_key(), rsa_init(), and RSA_PKCS_V15.
Referenced by main().
int initiate_migration_process | ( | int | sockfd, | |
int * | nonce, | |||
char * | publickey, | |||
char * | privatekey, | |||
unsigned char * | aes_key | |||
) |
Definition at line 432 of file interface.c.
References generate_AES_key(), havege_init(), havege_rand(), md5(), rsa_decryption(), rsa_encryption(), and send.
Referenced by auth_rece_send_msg().
int read_encrypted_file | ( | char * | enfile, | |
char * | string, | |||
unsigned char * | passphase | |||
) |
Definition at line 398 of file interface.c.
References aes_en_de(), and f.
Referenced by MC_Initialize().
int read_known_host_file | ( | char * | pubkey, | |
char * | hname, | |||
char * | filename | |||
) |
Definition at line 329 of file interface.c.
Referenced by auth_conn_rece_key(), and auth_rece_send_msg().
Definition at line 1555 of file interface.c.
References rsa_decryption(), and size.
Referenced by rece_de_msg().
int receive_decrypt_AES_key | ( | int | new_fd, | |
int * | nonce, | |||
unsigned char * | key, | |||
char * | privkey, | |||
char * | publickey | |||
) |
int reply_migration_process | ( | int | new_fd, | |
int * | nonce, | |||
char * | publickey, | |||
char * | privatekey, | |||
unsigned char * | aes_key | |||
) |
Definition at line 777 of file interface.c.
References generate_AES_key(), md5(), rsa_decryption(), rsa_encryption(), and send.
Referenced by auth_conn_rece_key().
int rsa_decryption | ( | char * | ciphertext, | |
char * | plaintext, | |||
char * | privatekeyfile | |||
) |
Definition at line 133 of file interface.c.
References rsa_context::D, rsa_context::DP, rsa_context::DQ, rsa_context::E, rsa_context::len, mpi_msb(), mpi_read_mystring(), rsa_context::N, rsa_context::P, P, rsa_context::Q, rsa_context::QP, rsa_check_privkey(), RSA_DE, rsa_init(), rsa_pkcs1_decrypt(), RSA_PKCS_V15, and separate_key_parts().
Referenced by initiate_migration_process(), receive_AES_en_MA(), and reply_migration_process().
int rsa_encryption | ( | char * | publickey, | |
char * | plaintext, | |||
char * | ciphertext | |||
) |
Definition at line 91 of file interface.c.
References rsa_context::E, rsa_context::len, mpi_msb(), mpi_read_mystring(), rsa_context::N, rsa_check_pubkey(), RSA_EN, rsa_init(), rsa_pkcs1_encrypt(), RSA_PKCS_V15, and separate_key_parts().
Referenced by initiate_migration_process(), reply_migration_process(), and send_AES_en_MA().
Definition at line 1419 of file interface.c.
References int, rsa_encryption(), send, and size.
Referenced by auth_rece_send_msg().