/home/dko/Projects/mobilec/tags/MobileC-v1.10.10/src/security/interface.h File Reference

#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/sha1.h"
#include "xyssl-0.9/include/xyssl/aes.h"
#include "xyssl-0.9/include/xyssl/md5.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

static void mystrncpy (char *dest, char *src, int start_index, int length)
int read_known_host_file (char *pubkey, char *hname, char *filename)
static void separate_key_parts (char *pubkey, char *N, char *E, char *D, char *P, char *Q, char *DP, char *DQ, char *QP)
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)
static 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)
static int append_nonce_to_MA (int *my_nonce, char *MA_file)
static int extract_nonce_from_MA (int sockfd, int *my_nonce, char *MA_file)
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 Documentation

#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().


Function Documentation

int aes_en_de ( int  mode,
char *  infile,
char *  outfile,
unsigned char *  AES_key,
int nonce,
int  sockfd 
)
static int append_nonce_to_MA ( int my_nonce,
char *  MA_file 
) [static]
static int extract_nonce_from_MA ( int  sockfd,
int my_nonce,
char *  MA_file 
) [static]
static void generate_AES_key ( char *  key  )  [static]

Definition at line 1089 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 
)
int generate_RSA_keys_plaintext ( char *  pubkeyfile,
char *  privkeyfile 
)
int initiate_migration_process ( int  sockfd,
int nonce,
char *  publickey,
char *  privatekey,
unsigned char *  aes_key 
)
static void mystrncpy ( char *  dest,
char *  src,
int  start_index,
int  length 
) [static]
int read_encrypted_file ( char *  enfile,
char *  string,
unsigned char *  passphase 
)

Definition at line 388 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 319 of file interface.c.

Referenced by auth_conn_rece_key(), and auth_rece_send_msg().

int receive_AES_en_MA ( int  new_fd,
int nonce,
char *  infile,
char *  privatekey 
)

Definition at line 1546 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 receiving_decrypting_MA_RSA ( int  new_fd,
char *  privkeyfile 
)
int receiving_verifying_MA_RSA ( int  sockfd,
char *  privkeyfile 
)
int reply_migration_process ( int  new_fd,
int nonce,
char *  publickey,
char *  privatekey,
unsigned char *  aes_key 
)

Definition at line 767 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 
)
int rsa_encryption ( char *  publickey,
char *  plaintext,
char *  ciphertext 
)
int send_AES_en_MA ( int  sockfd,
int nonce,
char *  outfile,
char *  peer_pubkey 
)

Definition at line 1410 of file interface.c.

References int, rsa_encryption(), send, and size.

Referenced by auth_rece_send_msg().

static void separate_key_parts ( char *  pubkey,
char *  N,
char *  E,
char *  D,
char *  P,
char *  Q,
char *  DP,
char *  DQ,
char *  QP 
) [static]

Generated on Wed Mar 17 15:31:58 2010 for Mobile-C by  doxygen 1.6.1