Simple AES chat program
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
740 B

#ifndef COMM_H
#define COMM_H
#include <sys/types.h>
#include <sys/socket.h>
#include <gmp.h>
#include <stdint.h>
struct sock_params
int sock;
struct sockaddr *addr;
socklen_t addrlen;
struct addrinfo *freeme;
struct elgamal
mpz_t m;
mpz_t g;
mpz_t p;
mpz_t x;
struct session
uint32_t key[60];
struct sock_params params;
struct elgamal eg;
gmp_randstate_t rs;
char last_sent_enc[16];
char last_recv_enc[16];
void sess_init(struct session *sess);
void sess_destroy(struct session *sess);
int do_resolve(char *address, char *portstr, struct sock_params *params);
void do_unresolve(struct sock_params params);
int do_connect(struct session *sess);
int do_receive(struct session *sess);