49
50
unsigned char *macend; /* free() these. */
53
typedef struct s_CommitMsg {
54
unsigned char *raw; /* The base64-decoded data; must be free()d */
55
unsigned char *enckey;
57
unsigned char *hashkey;
61
typedef struct s_KeyMsg {
62
unsigned char *raw; /* The base64-decoded data; must be free()d */
66
typedef struct s_RevealSigMsg {
67
unsigned char *raw; /* The base64-decoded data; must be free()d */
70
unsigned char *encsig;
72
unsigned char mac[20];
75
typedef struct s_SignatureMsg {
76
unsigned char *raw; /* The base64-decoded data; must be free()d */
77
unsigned char *encsig;
79
unsigned char mac[20];
52
82
/* Dump an unsigned int to a FILE * */
53
83
void dump_int(FILE *stream, const char *title, unsigned int val);
65
95
/* Deallocate a KeyExchMsg and all of the data it points to */
66
96
void free_keyexch(KeyExchMsg keyexch);
98
/* Parse a D-H Commit Message into a newly-allocated CommitMsg structure */
99
CommitMsg parse_commit(const char *msg);
68
101
/* Parse a Data Message into a newly-allocated DataMsg structure */
69
102
DataMsg parse_datamsg(const char *msg);
104
/* Deallocate a CommitMsg and all of the data it points to */
105
void free_commit(CommitMsg cmsg);
107
/* Parse a Reveal Signature Message into a newly-allocated RevealSigMsg
109
RevealSigMsg parse_revealsig(const char *msg);
111
/* Deallocate a RevealSigMsg and all of the data it points to */
112
void free_revealsig(RevealSigMsg rmsg);
114
/* Parse a Signature Message into a newly-allocated SignatureMsg structure */
115
SignatureMsg parse_signature(const char *msg);
117
/* Deallocate a SignatureMsg and all of the data it points to */
118
void free_signature(SignatureMsg smsg);
120
/* Parse a D-H Key Message into a newly-allocated KeyMsg structure */
121
KeyMsg parse_key(const char *msg);
123
/* Deallocate a KeyMsg and all of the data it points to */
124
void free_key(KeyMsg cmsg);
71
126
/* Recalculate the MAC on the message, base64-encode the resulting MAC'd
72
127
* message, and put on the appropriate header and footer. Return a
73
128
* newly-allocated pointer to the result, which the caller will have to
77
132
/* Assemble a new Data Message from its pieces. Return a
78
133
* newly-allocated string containing the base64 representation. */
79
char *assemble_datamsg(unsigned char mackey[20], unsigned int sender_keyid,
80
unsigned int rcpt_keyid, gcry_mpi_t y, unsigned char ctr[8],
81
unsigned char *encmsg, size_t encmsglen, unsigned char *mackeys,
134
char *assemble_datamsg(unsigned char mackey[20], int flags,
135
unsigned int sender_keyid, unsigned int rcpt_keyid, gcry_mpi_t y,
136
unsigned char ctr[8], unsigned char *encmsg, size_t encmsglen,
137
unsigned char *mackeys, size_t mackeyslen);
84
139
/* Deallocate a DataMsg and all of the data it points to */
85
140
void free_datamsg(DataMsg datamsg);