~ubuntu-branches/ubuntu/oneiric/libotr/oneiric-security

« back to all changes in this revision

Viewing changes to toolkit/parse.h

  • Committer: Bazaar Package Importer
  • Author(s): Thibaut VARENE
  • Date: 2006-01-02 19:52:18 UTC
  • mfrom: (2.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20060102195218-wb8803196y9mycx6
Tags: 3.0.0-2
Fix typo: "malformed messahes" (Closes: #345400)

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
typedef struct s_DataMsg {
37
37
    unsigned char *raw;         /* The base64-decoded data; must be free()d */
38
38
    size_t rawlen;
 
39
    int flags;
39
40
    unsigned int sender_keyid;
40
41
    unsigned int rcpt_keyid;
41
42
    gcry_mpi_t y;
49
50
    unsigned char *macend;      /*   free() these. */
50
51
} * DataMsg;
51
52
 
 
53
typedef struct s_CommitMsg {
 
54
    unsigned char *raw;         /* The base64-decoded data; must be free()d */
 
55
    unsigned char *enckey;
 
56
    size_t enckeylen;
 
57
    unsigned char *hashkey;
 
58
    size_t hashkeylen;
 
59
} * CommitMsg;
 
60
 
 
61
typedef struct s_KeyMsg {
 
62
    unsigned char *raw;         /* The base64-decoded data; must be free()d */
 
63
    gcry_mpi_t y;
 
64
} * KeyMsg;
 
65
 
 
66
typedef struct s_RevealSigMsg {
 
67
    unsigned char *raw;         /* The base64-decoded data; must be free()d */
 
68
    unsigned char *key;
 
69
    size_t keylen;
 
70
    unsigned char *encsig;
 
71
    size_t encsiglen;
 
72
    unsigned char mac[20];
 
73
} * RevealSigMsg;
 
74
 
 
75
typedef struct s_SignatureMsg {
 
76
    unsigned char *raw;         /* The base64-decoded data; must be free()d */
 
77
    unsigned char *encsig;
 
78
    size_t encsiglen;
 
79
    unsigned char mac[20];
 
80
} * SignatureMsg;
 
81
 
52
82
/* Dump an unsigned int to a FILE * */
53
83
void dump_int(FILE *stream, const char *title, unsigned int val);
54
84
 
65
95
/* Deallocate a KeyExchMsg and all of the data it points to */
66
96
void free_keyexch(KeyExchMsg keyexch);
67
97
 
 
98
/* Parse a D-H Commit Message into a newly-allocated CommitMsg structure */
 
99
CommitMsg parse_commit(const char *msg);
 
100
 
68
101
/* Parse a Data Message into a newly-allocated DataMsg structure */
69
102
DataMsg parse_datamsg(const char *msg);
70
103
 
 
104
/* Deallocate a CommitMsg and all of the data it points to */
 
105
void free_commit(CommitMsg cmsg);
 
106
 
 
107
/* Parse a Reveal Signature Message into a newly-allocated RevealSigMsg
 
108
 * structure */
 
109
RevealSigMsg parse_revealsig(const char *msg);
 
110
 
 
111
/* Deallocate a RevealSigMsg and all of the data it points to */
 
112
void free_revealsig(RevealSigMsg rmsg);
 
113
 
 
114
/* Parse a Signature Message into a newly-allocated SignatureMsg structure */
 
115
SignatureMsg parse_signature(const char *msg);
 
116
 
 
117
/* Deallocate a SignatureMsg and all of the data it points to */
 
118
void free_signature(SignatureMsg smsg);
 
119
 
 
120
/* Parse a D-H Key Message into a newly-allocated KeyMsg structure */
 
121
KeyMsg parse_key(const char *msg);
 
122
 
 
123
/* Deallocate a KeyMsg and all of the data it points to */
 
124
void free_key(KeyMsg cmsg);
 
125
 
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
76
131
 
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,
82
 
        size_t mackeyslen);
 
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);
83
138
 
84
139
/* Deallocate a DataMsg and all of the data it points to */
85
140
void free_datamsg(DataMsg datamsg);