Changeset 3daca13
- Timestamp:
- Sep 15, 2009, 4:22:39 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 191d5e7
- Parents:
- 1c89df8
- git-author:
- Anders Kaseorg <andersk@mit.edu> (09/14/09 23:52:36)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (09/15/09 16:22:39)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
r3d9f4d3 r3daca13 23 23 24 24 libzcrypt_a_SOURCES = zcrypt.c 25 libzcrypt_a_CFLAGS = -w26 25 27 26 CPPFLAGS = -I$(top_srcdir)/ \ -
zcrypt.c
r806f769 r3daca13 62 62 #define M_RANDOMIZE 4 63 63 #define M_SETKEY 5 64 65 static void owl_zcrypt_string_to_schedule(char *keystring, des_key_schedule schedule) { 66 #ifdef HAVE_KERBEROS_IV 67 des_cblock key; 68 #else 69 des_cblock _key, *key = &_key; 70 #endif 71 72 des_string_to_key(keystring, key); 73 des_key_sched(key, schedule); 74 } 64 75 65 76 /* The 'owl_zcrypt_decrypt' function was written by kretch for Owl. … … 74 85 char *fname, keystring[MAX_KEY]; 75 86 FILE *fkey; 76 des_cblock key;77 87 des_key_schedule schedule; 78 char input[8], output[9];88 unsigned char input[8], output[8]; 79 89 int i, c1, c2; 80 90 … … 83 93 fkey=fopen(fname, "r"); 84 94 if (!fkey) return(-1); 85 fgets(keystring, MAX_KEY-1, fkey); 95 if (!fgets(keystring, MAX_KEY-1, fkey)) { 96 fclose(fkey); 97 return -1; 98 } 86 99 fclose(fkey); 87 100 … … 89 102 90 103 output[0] = '\0'; /* In case no message at all */ 91 output[8] = '\0'; /* NULL at end will limit string length to 8 */ 92 93 des_string_to_key(keystring, key); 94 des_key_sched(key, schedule); 104 105 owl_zcrypt_string_to_schedule(keystring, schedule); 95 106 96 107 inptr=in; … … 103 114 inptr+=2; 104 115 } 105 des_ecb_encrypt(input, output, schedule, FALSE); 106 strcat(out, output); 107 } 108 109 if (output[0]) { 110 if (output[strlen(output)-1] != '\n') { 111 strcat(out, "\n"); 112 } 113 } else { 116 des_ecb_encrypt(&input, &output, schedule, FALSE); 117 strncat(out, (const char *)output, 8); 118 } 119 120 if (out[0] && out[strlen(out) - 1] != '\n') 114 121 strcat(out, "\n"); 115 }116 122 return(0); 117 123 } … … 120 126 char *fname, keystring[MAX_KEY]; 121 127 FILE *fkey; 122 des_cblock key;123 128 des_key_schedule schedule; 124 char input[8], output[8];129 unsigned char input[8], output[8]; 125 130 int size, length, i; 126 131 const char *inbuff = NULL, *inptr; … … 132 137 fkey=fopen(fname, "r"); 133 138 if (!fkey) return(-1); 134 fgets(keystring, MAX_KEY-1, fkey); 139 if (!fgets(keystring, MAX_KEY-1, fkey)) { 140 fclose(fkey); 141 return -1; 142 } 135 143 fclose(fkey); 136 144 137 des_string_to_key(keystring, key); 138 des_key_sched(key, schedule); 145 owl_zcrypt_string_to_schedule(keystring, schedule); 139 146 140 147 inbuff=in; … … 168 175 169 176 /* Encrypt and output the block */ 170 des_ecb_encrypt( input,output, schedule, TRUE);177 des_ecb_encrypt(&input, &output, schedule, TRUE); 171 178 172 179 for (i = 0; i < 8; i++) { … … 217 224 /* Scan file for a match */ 218 225 while (!feof(fsearch)) { 219 fgets(buffer, MAX_BUFF - 3, fsearch);226 if (!fgets(buffer, MAX_BUFF - 3, fsearch)) break; 220 227 for (i = 0; i < numsearch; i++) { 221 228 if (strncasecmp(varname[i], buffer, length[i]) == 0) { … … 263 270 } 264 271 265 static pid_t zephyrpipe_pid = 0; 266 267 #endif 272 #endif
Note: See TracChangeset
for help on using the changeset viewer.