/[pkg-mixmaster]/trunk/Mix/Src/mix.h
ViewVC logotype

Contents of /trunk/Mix/Src/mix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download)
Wed Oct 31 08:19:51 2001 UTC (11 years, 7 months ago) by rabbi
File MIME type: text/plain
File size: 24236 byte(s)
Initial revision
1 /* Mixmaster version 3 -- (C) 1999 Anonymizer Inc.
2
3 Mixmaster may be redistributed and modified under certain conditions.
4 This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
5 ANY KIND, either express or implied. See the file COPYRIGHT for
6 details.
7
8
9 Mixmaster Library API
10 =====================
11
12 The Mixmaster library consists of a set of high-level functions that
13 generate or process remailer messages, lower-level functions that
14 manipulate data in various ways, and a number of functions that
15 provide an interface to the underlying cryptographic library.
16 Generally, a return value of 0 indicates success, and -1 an error.
17
18
19 Initialization
20 ==============
21
22 int mix_init(char mixdir[]);
23
24 This funtion initializes internal data of the Mixmaster library,
25 such as the random number generator. This should be the first call
26 to the Mixmaster library. It returns 0 on success. If the random
27 number generator cannot be initialized, mix_init() terminates.
28
29 The variable mixdir determines where the Mixmaster configuration
30 files and the message pool are located. If mixdir is NULL, the
31 library will use the directory specified in the environment variable
32 $MIXPATH, the directory given at compile time if it exists, and the
33 directory ~/Mix otherwise.
34
35
36 void mix_exit(void);
37
38 A program must call mix_exit before exiting. This function writes back
39 the state of the random number generator.
40
41
42 Using the Mixmaster DLL
43 =======================
44
45 In textmode applications, mix_init() can be used as described above.
46 In graphical applications, these functions are not needed. Instead,
47 the function rnd_mouse() should be called whenever the program gets
48 WM_MOUSEMOVE or other messages:
49
50 int rnd_mouse(UINT i, WPARAM w, LPARAM l);
51
52 All events that a window gets may be passed to this function. It
53 will extract the inherent randomness in user interaction, especially
54 in mouse movements. It returns 100 if it has accumulated enough
55 randomness to perform cryptographic operations, and a number between
56 0 and 99 otherwise. This number can be used to provide graphical
57 feedback on the progress of initializing the random number generator
58 while asking the user to move the mouse. A runtime error will occur
59 if any cryptographic functions are used before rnd_mouse() has
60 signalled success.
61
62
63 Message I/O
64 ===========
65
66 The library uses dynamically allocated buffers for messages and other
67 data. Functions for buffer manipulation are described in section
68 "Buffers" below.
69
70
71 BUFFER *buf_new(void);
72
73 Buffers must be initialized before they can be used. buf_new() returns
74 a pointer to a newly initialized buffer.
75
76
77 int buf_free(BUFFER *buf);
78
79 When a buffer is no longer needed, it should be freed. This function
80 returns the memory used for the buffer to the operating system.
81
82
83 int buf_read(BUFFER *message, FILE *infile);
84
85 This function reads data from a stream and appends them to the buffer.
86
87 Return values:
88 0 on success,
89 1 if the file is too large to store it in a buffer,
90 -1 if no data could be read.
91
92
93 int buf_write(BUFFER *message, FILE *outfile);
94
95 This function writes the entire buffer to the output stream.
96
97 Return values:
98 0 if the buffer could be written completely,
99 -1 otherwise.
100
101
102 Remailer Messages
103 =================
104
105 int mix_encrypt(int type, BUFFER *message, char *chain, int numcopies,
106 BUFFER *feedback);
107
108 This function creates a Mixmaster message and stores it the Mixmaster
109 message pool.
110
111 The type is one of the following:
112
113 MSG_MAIL electronic mail message
114 MSG_POST Usenet news article
115 MSG_NULL dummy message, will be discarded
116
117 *chain is a string consisting of a comma-seperated list of remailer
118 names that the message will be sent through. '*' means that a remailer
119 will be chosen at random. If *chain is NULL, mix_encrypt() will use the
120 default chain.
121
122 numcopies is a number between 1 and 10 that indicates how many
123 (redundant) copies of the message should be sent. If numcopies is 0,
124 the default value will be used. The default values for *chain and
125 numcopies are read from the configuration file.
126
127 If *feedback is not NULL, mix_encrypt() will write the chain(s) that
128 have been selected as newline-separated strings, or a textual error
129 message to *feedback. This text can be presented to the user as
130 feedback.
131
132 Return values:
133 0 on success,
134 -1 if the message could not be created.
135
136
137 int mix_decrypt(BUFFER *message);
138
139 This is the remailer function, which reads Mixmaster and Cypherpunk
140 remailer messages as well as help file and key requests. Remailer
141 messages are decrypted and stored in the message pool. Replies to
142 information requests are sent immediately.
143
144 Return values:
145 0 if the message has been processed successfully,
146 1 if the message is of an unknown type,
147 -1 if the message could not be processed.
148
149
150 int mix_send(void);
151
152 This function causes the messages in the pool to be sent. Depending on
153 the configuration, mix_send() may send only a certain fraction of the
154 messages in the pool.
155
156 Return value: The size of the pool after the messages have been sent.
157
158
159 void mix_regular(int force);
160
161 This function is responsible for regular actions of the remailer such
162 as sending messages from the pool, getting mail from POP3 servers and
163 expiring log files.
164
165
166 Nymserver Client Functions
167 ==========================
168
169 The nymserver functions use user_pass() to get the passphrase for
170 opening the nym database.
171
172 int nym_config(int mode, char *nym, char *nymserver, BUFFER *pseudonym,
173 char *sendchain, int sendnumcopies, BUFFER *chains,
174 BUFFER *options);
175
176 Create, modify or delete a nym. mode is one of NYM_CREATE, NYM_MODIFY and
177 NYM_DELETE.
178
179 nym is the pseudonymous address or its local part. In the latter case,
180 nymserver must contain a string that selects a nymserver.
181
182 pseudonym is a text string or NULL.
183
184 sendchain and sendnumcopies are the chain and number of copies of
185 the Mixmaster message sent to the nymserver.
186
187 chains contains a list of reply blocks, consisting of "To:",
188 "Newsgroups:", "Null:", "Latency:", "Chain:" and arbitracy header lines
189 such as "Subject:". The "Chain:" line contains a remailer selection
190 string for type 1 remailers. The reply blocks are separated by empty
191 lines.
192
193 options contains nymserver options (any of "acksend", "signsend",
194 "fixedsize", "disable", "fingerkey" with a "+" or "-" prefix) or is NULL.
195
196
197 int nym_encrypt(BUFFER *msg, char *nym, int type);
198
199 Prepare the message msg of type MSG_MAIL or MSG_POST to be sent using
200 the nym. After successful encryption, msg contains a message of type
201 MSG_MAIL addressed to the nymserver.
202
203
204 int nym_decrypt(BUFFER *msg, char *nym, BUFFER *log);
205
206 Decrypt nymserver replies and PGP messages. If msg contains a nymserver
207 reply, the the recipient nym is stored in nym (unless nym is NULL), and
208 msg is replaced with the plaintext message in the Unix mail folder
209 format.
210
211 If log is not NULL, nym_decrypt will compute a unique ID for each
212 message and append it to log. If the ID already is contained in log,
213 it will return an empty msg buffer.
214
215
216 Lowel-Level Remailer Functions
217 ==============================
218
219 t1_decrypt(BUFFER *in);
220
221 Decrypts and processes a Cypherpunk remailer message.
222
223
224 t2_decrypt(BUFFER *in);
225
226 Decrypts and processes a Mixmaster remailer message.
227
228
229 int mix_pool(BUFFER *msg, int type, long latent);
230
231 Adds the message msg of type MSG_MAIL or MSG_POST to the pool.
232 latent is 0 or the message latency in seconds.
233
234
235 OpenPGP encryption
236 ==================
237
238 int pgp_encrypt(int mode, BUFFER *message, BUFFER *encr,
239 BUFFER *sigid, BUFFER *pass, char *pubring,
240 char *secring);
241
242 This function encrypts and singed a message according to OpenPGP (RFC 2440).
243
244 mode is the bitwise or of on of PGP_ENCRYPT, PGP_CONVENTIONAL and PGP_SIGN,
245 and any of PGP_TEXT, PGP_REMAIL and PGP_NOARMOR.
246
247 PGP_CONVENTIONAL: the message is encrypted conventionally, using
248 the passphrase encr. If PGP_NCONVENTIONAL is used instead,
249 the new OpenPGP format is used.
250 PGP_ENCRYPT: public key encryption is used. The message is encrypted to
251 the first public key on the keyring a User ID of which contains
252 the substring encr. encr may contain several lines with one
253 address substring each.
254 PGP_SIGN: the message is signed with the first key from the secret
255 key ring whose user ID contains sigid as a substring, or the
256 first key if sigid is NULL.
257 PGP_TEXT: message is treated as text, without PGP_TEXT as binary.
258 PGP_DETACHEDSIG: signature will not include the signed message.
259 PGP_REMAIL: a random offset is subtracted from signature dates, and the
260 ASCII armor is made to mimic PGP.
261 PGP_NOARMOR: message armor is not applied.
262
263 If none of PGP_SIGN, PGP_CONVENTIONAL and PGP_ENCRYPT is set, the
264 message is only compressed and armored.
265
266 pubring and secring can be NULL or specify the name of a key ring.
267
268 Return values:
269 0 on success,
270 -1 no matching key found,
271 PGP_PASS bad signature passphrase.
272
273
274 int pgp_mailenc(int mode, BUFFER *message, char *sigid,
275 BUFFER *pass, char *pubring, char *secring);
276
277 This function encrypts and signs an RFC 822 e-mail message according to
278 RFC 2015 (OpenPGP/MIME). Signatures without encryption on non-MIME messages
279 are "cleartext" signatures.
280
281
282 int pgp_decrypt(BUFFER *message, BUFFER *pass, BUFFER *sig, char *pubring,
283 char *secring);
284
285 This function decrypts the OpenPGP message and verifies its signature.
286 pass must contain the passphrase if message is conventionally encrypted
287 or the secret key is protected by a passphrase. Otherwise it can be
288 NULL.
289
290 If message is a detached signature, sig must contain the signed data.
291 It sig is NULL, the message will be decrypted without singature
292 verification.
293
294 pgp_getmsg() writes a string containing the signing time and
295 signator's user ID or the key ID of the unknown signature key to sig.
296
297 pubring and secring can be NULL or specify the name of a key ring.
298
299 Return values:
300 PGP_OK on success,
301 PGP_ERR the message can't be read,
302 PGP_PASS bad passphrase,
303 PGP_NOMSG message is not an OpenPGP message,
304 PGP_SIGOK success, and signature has been verified,
305 PGP_SIGNKEY can't verify signature,
306 PGP_SIGBAD bad signature,
307 PGP_NODATA OpenPGP message does not contain user data.
308
309
310 int pgp_keygen(int algo, int bits, BUFFER *userid, BUFFER *pass, char *pubring,
311 char *secring, int remail);
312
313 Generate a new key pair with given userid, encrypt the secret key with
314 pass if not NULL. Use a fake date if remail is not zero. Assume an
315 encrypted secring if remail == 2. algo is PGP_ES_RSA or PGP_E_ELG.
316
317
318 Buffers
319 =======
320
321 Buffers contain binary data of arbitrary length. You can append data
322 to buffers, clear buffers, and read data from buffers sequentially.
323 As data are appended to a buffer, memory is allocated dynamically.
324
325 typedef unsigned char byte;
326
327 typedef struct
328 {
329 byte *data;
330 long length;
331 long ptr;
332 long size;
333 byte sensitive;
334 } BUFFER;
335
336 For a buffer *b, b->data is a pointer to at least b->length+1 bytes of
337 memory. b->data[b->length] is guaranteed to contain a null byte, so that
338 string functions can be used directly on buffers that contain text.
339
340 ptr is a counter for reading data from the buffer. b->data[b->ptr] is
341 the first data byte that has not been read (0 <= ptr <= length).
342
343 If sensitive is 1, the buffer contents will be overwritten before the
344 memory is released.
345
346
347 int buf_reset(BUFFER *buf);
348
349 This function empties the buffer and returns the memory it has used to
350 the operating system. It does not free the buffer itself.
351
352
353 int buf_clear(BUFFER *buf);
354
355 buf_clear() empties the buffer but does not free the memory it uses.
356 This function should be used if data of a similar size will be stored
357 to the buffer later.
358
359
360 int buf_eq(BUFFER *buf1, BUFFER *buf2);
361
362 Return values:
363 1 if the buffers contain identical data,
364 0 otherwise.
365
366
367 int buf_append(BUFFER *buf, byte *msg, int len);
368
369 This is the most basic function for appending data to a buffer. It is
370 called by all other functions that write to buffers. buf_append()
371 appends len bytes pointed to by msg to buf. New memory will be
372 allocated for the buffer if necessary.
373
374 If msg is NULL, the buffer is increased by len bytes, but no
375 guarantee is made about the contents of the appended bytes.
376
377 Return value:
378 0 on success,
379 does not return if allocation of memory fails.
380
381
382 int buf_appendc(BUFFER *buf, byte b);
383 appends the byte b to buf.
384
385
386 int buf_appends(BUFFER *buf, char *s);
387 appends the null-terminated string s to buf.
388
389
390 int buf_appendf(BUFFER *buf, char *fmt, ...);
391 appends formatted output to buf.
392
393
394 int buf_sets(BUFFER *buf, char *s);
395 sets buf to contain the null-terminated string s.
396
397
398 int buf_setf(BUFFER *buf, char *fmt, ...);
399 sets buf to contain the formatted output.
400
401
402 int buf_nl(BUFFER *buf);
403 appends a newline character to buf.
404
405
406 int buf_cat(BUFFER *buf, BUFFER *f);
407 appends the entire contents of f to buf.
408
409
410 int buf_rest(BUFFER *buf, BUFFER *f);
411 appends the unread data from f to buf.
412
413
414 int buf_set(BUFFER *buf, BUFFER *f);
415 sets buf to a copy of the contents of f.
416
417
418 int buf_move(BUFFER *buf, BUFFER *f);
419 sets buf to the contents of f, and resets f. This is equivalent to
420 buf_set(buf, f); buf_reset(f); but more efficient.
421
422
423 int buf_appendrnd(BUFFER *buf, int n);
424 appends n cryptographically strong pseudo-random bytes to buf.
425
426
427 int buf_setrnd(BUFFER *buf, int n);
428 places n cryptographically strong pseudo-random bytes in buf.
429
430
431 int buf_appendzero(BUFFER *buf, int n);
432 appends n null bytes to buf.
433
434
435 int buf_pad(BUFFER *buf, int size);
436 pads the buffer with cryptographically strong pseudo-random data to
437 length size. Aborts if size < buf->length.
438
439
440 int buf_appendi(BUFFER *b, int i);
441 appends the two bytes representing i in big-endian byte order to buf.
442
443
444 int buf_appendi_lo(BUFFER *b, int i);
445 appends the two bytes representing i in little-endian byte order to buf.
446
447
448 int buf_appendl(BUFFER *buf, long l);
449 appends the four bytes representing l in big-endian byte order to buf.
450
451
452 int buf_appendl_lo(BUFFER *buf, long l);
453 appends the four bytes representing l in little-endian byte order to buf.
454
455
456 int buf_prepare(BUFFER *buf, int size);
457 sets buf to contain size bytes of arbitrary data.
458
459
460 int buf_get(BUFFER *buf, BUFFER *t, int n);
461
462 This function sets buffer t to contain n bytes read from buf.
463
464 Return values:
465 0 on success,
466 -1 if buf does not contain n unread bytes.
467
468
469 int buf_getc(BUFFER *buf);
470 reads one byte from buf. Returns -1 if buf contains no unread data,
471 the byte otherwise.
472
473
474 int buf_geti(BUFFER *buf);
475 reads two bytes from buf. Returns -1 if buf buf does not contain two
476 unread bytes, the integer represented by the bytes in big-endian
477 byte order otherwise.
478
479
480 int buf_geti_lo(BUFFER *buf);
481 reads two bytes from buf. Returns -1 if buf buf does not contain two
482 unread bytes, the integer represented by the bytes in little-endian
483 byte order otherwise.
484
485
486 long buf_getl(BUFFER *buf);
487 reads four bytes from buf. Returns -1 if buf buf does not contain four
488 unread bytes, the integer represented by the bytes in big-endian
489 byte order otherwise.
490
491
492 long buf_getl_lo(BUFFER *buf);
493 reads four bytes from buf. Returns -1 if buf buf does not contain four
494 unread bytes, the integer represented by the bytes in little-endian
495 byte order otherwise.
496
497
498 void buf_ungetc(BUFFER *buf);
499 restores one character for reading.
500
501
502 int buf_appendb(BUFFER *buf, BUFFER *p);
503 appends p (with length information) to buf.
504
505
506 int buf_getb(BUFFER *buf, BUFFER *p);
507 gets lenght information, then p from buf.
508
509
510 int buf_getline(BUFFER *buf, BUFFER *line);
511
512 This function reads one line of text from buf, and stores it (without
513 the trailing newline) in the buffer line.
514
515 Return values:
516 0 if a line of text has been read,
517 1 if the line read is empty,
518 -1 if buf contains no unread data.
519
520
521 int buf_lookahead(BUFFER *buf, BUFFER *line);
522
523 This function reads one line of text from buf, and stores it (without
524 the trailing newline) in the buffer line, without increasing the read
525 counter.
526
527 Return values:
528 0 if a line of text has been read,
529 1 if the line read is empty,
530 -1 if buf contains no unread data.
531
532
533 int buf_chop(BUFFER *buf);
534
535 buf is assumed to contain one line of text. A trailing newline and any
536 other lines of text buf may contain are removed.
537
538
539 int buf_getheader(BUFFER *buf, BUFFER *field, BUFFER *content);
540
541 This function reads a RFC 822 header line from buf. The field name of
542 the header line without the colon is stored in field, the line's
543 contents in content.
544
545 Returns:
546 0 on success,
547 1 at end of header,
548 -1 if buf contains no unread data.
549
550
551 int buf_appendheader(BUFFER *buffer, BUFFER *field, BUFFER *content);
552
553 This function appends the RFC 822 header consisting of field and content
554 to buffer.
555
556
557 int buf_rewind(BUFFER *buf);
558
559 This function sets the read conter of buf to the start of the buffer
560 (equivalent to buf->ptr = 0).
561
562
563 Randomness
564 ==========
565
566 byte rnd_byte(void);
567 returns a random byte.
568
569
570 int rnd_number(int n);
571 returns a random number in 0 .. n-1.
572
573
574 int rnd_bytes(byte *b, int n);
575 stores n random bytes at b.
576
577
578 Interface to the crypto library PRNG
579 ====================================
580
581 int rnd_init(void);
582
583 initializes the PRNG from the random seed file. Called from mix_init().
584 Return values:
585 0 on success,
586 -1 on error.
587
588
589 int rnd_final(void);
590
591 writes the random seed file and ends the PRNG. Called from mix_exit().
592 Return values:
593 0 on success,
594 -1 on error.
595
596
597 int rnd_seed(void);
598 seeds the PRNG, using console input if necessary.
599
600
601 void rnd_update(byte *b, int n);
602 adds n bytes from b to the PRNG, unless b == NULL, and adds randomness
603 from the system environment.
604
605
606 extern int rnd_state;
607 An application may set rnd_state = RND_WILLSEED before executing
608 mix_init() to indicate that it will seed the PRNG later by making calls
609 to rnd_update() and then to rnd_initialized(). In that case,
610 rnd_seed() will not ask for user input. [This is what the DLL startup code
611 does internally.]
612
613
614 String comparison
615 =================
616
617 These functions operate on null-terminated strings. They return truth
618 values.
619
620
621 int streq(const char *s1, const char *s2);
622
623 Return values:
624 1 if the strings s1 and s2 are equal,
625 0 otherwise.
626
627
628 int strieq(const char *s1, const char *s2);
629
630 Return values:
631 1 if the strings s1 and s2 are equal except for case,
632 0 otherwise.
633
634
635 int strleft(const char *s, const char *keyword);
636
637 Return values:
638 1 if keyword is the left part of s,
639 0 otherwise.
640
641
642 int strileft(const char *s, const char *keyword);
643
644 Return values:
645 1 if keyword is the left part of s, except for case,
646 0 otherwise.
647
648
649 int strfind(const char *s, const char *keyword);
650
651 Return values:
652 1 if keyword is contained in s,
653 0 otherwise.
654
655
656 int strifind(const char *s, const char *keyword);
657
658 Return values:
659 1 if keyword is contained in s, except for case,
660 0 otherwise.
661
662
663 RFC 822 Addresses
664 =================
665
666 void rfc822_addr(BUFFER *destination, BUFFER *list);
667 stores a list of RFC 822 addresses from destination in list, separated
668 by newlines.
669
670 void rfc822_name(BUFFER *line, BUFFER *name);
671 stores the name given in the RFC 822 address in line in name.
672
673
674 Files and Pipes
675 ===============
676
677 int mixfile(char path[PATHMAX], const char *name);
678 stores the path to a given file in the Mixmaster directory in path[].
679
680
681 FILE *mix_openfile(const char *name, const char *a);
682 opens a file in the Mixmaster directory.
683
684
685 LOCK *lockfile(char *filename);
686 creates and locks a lockfile associated with filename.
687
688
689 int unlockfile(LOCK *lock);
690 releases the lock and deletes the lockfile.
691
692
693 int lock(FILE *f);
694 sets a lock on a file.
695
696
697 int unlock(FILE *f);
698 releases a lock on a file.
699
700
701 FILE *openpipe(const char *prog);
702 opens a pipe.
703
704
705 int closepipe(FILE *p);
706 closes a pipe.
707
708
709 int sendmail(BUFFER *message, BUFFER *address, const char *from);
710
711 This function sends a mail message. The From: line and the destination
712 address may be contained in the message; in that case address and from
713 must be NULL. address is checked against the destination block list.
714
715
716 Printable Encoding
717 ==================
718
719 int encode(BUFFER *buf, int linelen);
720
721 buf is encoded in base 64 encoding [RFC 1421]. If linelen > 0, the
722 resulting text is broken into lines of linelen characters.
723
724 Return value: 0.
725
726
727 int decode(BUFFER *in, BUFFER *out);
728
729 This function reads the unread data from in, as long as it is valid
730 base 64 encoded text, and stores the decoded data in out.
731
732 Return values:
733 0 if the in could be decoded to the end,
734 -1 otherwise.
735
736
737 int hdr_encode(BUFFER *in, int n);
738
739 Encodes a header line according to the MIME standard. The header is
740 broken into lines of at most n characters.
741
742
743 int mail_encode(BUFFER *in, int encoding);
744
745 Encodes the mail headers of a message, and encodes the body according
746 to encoding MIME_7BIT or MIME_8BIT.
747
748
749 void id_encode(byte id[16], byte *s);
750 stores the hexadecimal representation of id in s.
751
752
753 void id_decode(byte *s, byte id[16]);
754 sets id to the value of the hexadecimal string s.
755
756
757 Compression
758 ===========
759
760 int buf_zip(BUFFER *buf, BUFFER *f, int b);
761
762 compresses buffer f using GZIP with b bits (or a default value, if
763 b == 0), and appends the result to buf.
764
765 Return values:
766 0 on success,
767 -1 on error.
768
769
770 int buf_unzip(BUFFER *buf, int type);
771
772 uncompresses a GZIP [RFC 1952] compressed buffer. If type == 1, uncompress
773 a ZLIBĀ [RFC 1950] compressed buffer.
774
775 Return values:
776 0 on success,
777 -1 on error.
778
779
780 **************************************************************************/
781
782 #ifndef _MIXLIB_H
783 #define _MIXLIB_H
784
785 #include <stdio.h>
786 #ifdef WIN32
787 #include <windows.h>
788 #endif
789
790 typedef unsigned char byte;
791
792 typedef struct {
793 byte *data;
794 long length;
795 long ptr;
796 long size;
797 byte sensitive;
798 } BUFFER;
799
800 int mix_init(char *);
801 void mix_exit(void);
802 void rnd_update(byte *b, int n);
803 void rnd_initialized(void);
804 #ifdef WIN32
805 int rnd_mouse(UINT i, WPARAM w, LPARAM l);
806 #endif
807
808 BUFFER *buf_new(void);
809 int buf_free(BUFFER *buf);
810 int buf_read(BUFFER *message, FILE *infile);
811 int buf_write(BUFFER *message, FILE *outfile);
812
813 #define MSG_MAIL 1
814 #define MSG_POST 2
815 #define MSG_NULL 0
816
817 extern char MIXDIR[];
818
819 int mix_encrypt(int type, BUFFER *message, char *chain, int numcopies,
820 BUFFER *feedback);
821 int mix_decrypt(BUFFER *message);
822 int mix_send(void);
823
824 #define FORCE_POOL 1
825 #define FORCE_POP3 2
826 #define FORCE_DAILY 4
827 int mix_regular(int force);
828 int mix_daemon(void);
829
830 #ifdef USE_PGP
831
832 #define NYM_CREATE 0
833 #define NYM_MODIFY 1
834 #define NYM_DELETE 2
835
836 int nym_config(int mode, char *nym, char *nymserver, BUFFER *pseudonym,
837 char *sendchain, int sendnumcopies, BUFFER *chains,
838 BUFFER *options);
839 int nym_encrypt(BUFFER *msg, char *nym, int type);
840 int nym_decrypt(BUFFER *msg, char *nym, BUFFER *log);
841
842 #define PGP_SIGN 1
843 #define PGP_ENCRYPT 2
844 #define PGP_CONVENTIONAL 4
845 #define PGP_REMAIL 8
846 #define PGP_TEXT 16
847 #define PGP_NOARMOR 32
848 #define PGP_DETACHEDSIG 64
849 #define PGP_NCONVENTIONAL 128
850 #define PGP_CONV3DES 256
851 #define PGP_CONVCAST 512
852
853 /* error codes */
854 #define PGP_OK 0 /* valid message, not signed */
855 #define PGP_SIGOK 1 /* valid signature */
856 #define PGP_NOMSG 2 /* is not an OpenPGP message */
857 #define PGP_NODATA 3 /* OpenPGP packet does not contain user data */
858 #define PGP_SIGNKEY 4 /* can't verify signature */
859 #define PGP_ERR -1 /* can't read message, no matching key found */
860 #define PGP_PASS -2 /* bad passphrase */
861 #define PGP_SIGBAD -3 /* bad signature */
862
863
864 /* algorithms */
865 #define PGP_ANY 0
866 #define PGP_ES_RSA 1
867 #define PGP_E_ELG 16
868 #define PGP_S_DSA 17
869
870 int pgp_encrypt(int mode, BUFFER *message, BUFFER *encr, BUFFER *sigid,
871 BUFFER *pass, char *pubring, char *secring);
872 int pgp_decrypt(BUFFER *message, BUFFER *pass, BUFFER *sig, char *pubring,
873 char *secring);
874 int pgp_keygen(int algo, int bits, BUFFER *userid, BUFFER *pass,
875 char *pubring, char *secring, int remail);
876 #endif
877 #endif

  ViewVC Help
Powered by ViewVC 1.1.5