- Timestamp:
- Mar 17, 2010, 11:30:31 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 88f0dae
- Parents:
- 6d7f2a8
- git-author:
- Nelson Elhage <nelhage@ksplice.com> (03/17/10 21:15:18)
- git-committer:
- Nelson Elhage <nelhage@ksplice.com> (03/17/10 23:30:31)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zcrypt.c
r6d7f2a8 re832a52 52 52 } ZWRITEOPTIONS; 53 53 54 char *GetZephyrVarKeyFile(c har *whoami, char *class,char *instance);55 int ParseCryptSpec(c har *spec,char **keyfile);54 char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance); 55 int ParseCryptSpec(const char *spec, const char **keyfile); 56 56 char *BuildArgString(char **argv, int start, int end); 57 char *read_keystring(c har *keyfile);58 59 int do_encrypt(int zephyr, c har *class,char *instance,60 ZWRITEOPTIONS *zoptions, c har* keyfile, int cipher);61 int do_encrypt_des(c har *keyfile,char *in, int len, FILE *out);62 int do_encrypt_aes(c har *keyfile,char *in, int len, FILE *out);63 64 int do_decrypt(c har *keyfile, int cipher);65 int do_decrypt_aes(c har *keyfile);66 int do_decrypt_des(c har *keyfile);57 char *read_keystring(const char *keyfile); 58 59 int do_encrypt(int zephyr, const char *class, const char *instance, 60 ZWRITEOPTIONS *zoptions, const char* keyfile, int cipher); 61 int do_encrypt_des(const char *keyfile, const char *in, int len, FILE *out); 62 int do_encrypt_aes(const char *keyfile, const char *in, int len, FILE *out); 63 64 int do_decrypt(const char *keyfile, int cipher); 65 int do_decrypt_aes(const char *keyfile); 66 int do_decrypt_des(const char *keyfile); 67 67 68 68 … … 81 81 82 82 typedef struct { 83 int (*encrypt)(c har *keyfile,char *in, int len, FILE *out);84 int (*decrypt)(c har *keyfile);83 int (*encrypt)(const char *keyfile, const char *in, int len, FILE *out); 84 int (*decrypt)(const char *keyfile); 85 85 } cipher_pair; 86 86 … … 104 104 { 105 105 char *cryptspec = NULL; 106 c har *keyfile;106 const char *keyfile; 107 107 int cipher; 108 108 int error = FALSE; … … 333 333 } 334 334 335 int ParseCryptSpec(c har *spec,char **keyfile) {335 int ParseCryptSpec(const char *spec, const char **keyfile) { 336 336 int cipher = CIPHER_DES; 337 337 char *cipher_name = strdup(spec); … … 402 402 #define MAX_SEARCH 3 403 403 /* Find the class/instance in the .crypt-table */ 404 char *GetZephyrVarKeyFile(c har *whoami, char *class,char *instance)404 char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance) 405 405 { 406 406 char *keyfile = NULL; … … 491 491 492 492 /* Open a pipe to zwrite */ 493 FILE *GetZephyrPipe(c har *class, char *instance,ZWRITEOPTIONS *zoptions)493 FILE *GetZephyrPipe(const char *class, const char *instance, const ZWRITEOPTIONS *zoptions) 494 494 { 495 495 int fildes[2]; 496 496 pid_t pid; 497 497 FILE *result; 498 c har *argv[20];498 const char *argv[20]; 499 499 int argc = 0; 500 500 … … 547 547 } 548 548 close(fildes[0]); 549 execvp(argv[0], argv);549 execvp(argv[0], (char **)argv); 550 550 fprintf(stderr, "Exec error: could not run zwrite\n"); 551 551 exit(0); … … 642 642 } 643 643 644 char *read_keystring(c har *keyfile) {644 char *read_keystring(const char *keyfile) { 645 645 char *keystring; 646 646 FILE *fkey = fopen(keyfile, "r"); … … 661 661 /* Encrypt stdin, with prompt if isatty, and send to stdout, or to zwrite 662 662 if zephyr is set. */ 663 int do_encrypt(int zephyr, c har *class,char *instance,664 ZWRITEOPTIONS *zoptions, c har*keyfile, int cipher)663 int do_encrypt(int zephyr, const char *class, const char *instance, 664 ZWRITEOPTIONS *zoptions, const char *keyfile, int cipher) 665 665 { 666 666 FILE *outfile = stdout; … … 696 696 } 697 697 698 int do_encrypt_des(c har *keyfile,char *in, int length, FILE *outfile)698 int do_encrypt_des(const char *keyfile, const char *in, int length, FILE *outfile) 699 699 { 700 700 des_key_schedule schedule; 701 701 unsigned char input[8], output[8]; 702 c har *inptr;702 const char *inptr; 703 703 int num_blocks, last_block_size; 704 704 char *keystring; … … 756 756 } 757 757 758 int do_encrypt_aes(c har *keyfile,char *in, int length, FILE *outfile)758 int do_encrypt_aes(const char *keyfile, const char *in, int length, FILE *outfile) 759 759 { 760 760 char *out; … … 832 832 833 833 /* Decrypt stdin */ 834 int do_decrypt(c har *keyfile, int cipher)834 int do_decrypt(const char *keyfile, int cipher) 835 835 { 836 836 return ciphers[cipher].decrypt(keyfile); 837 837 } 838 838 839 int do_decrypt_aes(c har *keyfile) {839 int do_decrypt_aes(const char *keyfile) { 840 840 char *in, *out; 841 841 int length; … … 865 865 } 866 866 867 int do_decrypt_des(c har *keyfile) {867 int do_decrypt_des(const char *keyfile) { 868 868 des_key_schedule schedule; 869 869 unsigned char input[8], output[8];
Note: See TracChangeset
for help on using the changeset viewer.