Changeset 8fff19a


Ignore:
Timestamp:
Mar 1, 2010, 8:33:48 PM (10 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
release-1.5
Children:
c4b5de8
Parents:
54e1fe4
git-author:
Anders Kaseorg <andersk@mit.edu> (02/07/10 23:08:47)
git-committer:
Nelson Elhage <nelhage@mit.edu> (03/01/10 20:33:48)
Message:
zcrypt: Add separate functions for zcrypting with a particular key.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zcrypt.c

    r54e1fe4 r8fff19a  
    6363#define M_SETKEY          5
    6464
    65 static void owl_zcrypt_string_to_schedule(char *keystring, des_key_schedule *schedule) {
     65static void owl_zcrypt_string_to_schedule(const char *keystring, des_key_schedule *schedule) {
    6666#ifdef HAVE_KERBEROS_IV
    6767  des_cblock key;
     
    8080char *owl_zcrypt_decrypt(const char *in, const char *class, const char *instance)
    8181{
    82   const char *inptr, *endptr;
    8382  char *fname, keystring[MAX_KEY];
    8483  FILE *fkey;
    85   des_key_schedule schedule;
    86   char *out;
    87   unsigned char input[8], output[8];
    88   int i, c1, c2;
    8984 
    9085  fname=GetZephyrVarKeyFile("zcrypt", class, instance);
     
    9893  fclose(fkey);
    9994
     95  return owl_zcrypt_decrypt_with_key(in, keystring);
     96}
     97
     98char *owl_zcrypt_decrypt_with_key(const char *in, const char *keystring)
     99{
     100  const char *inptr, *endptr;
     101  char *out;
     102  des_key_schedule schedule;
     103  unsigned char input[8], output[8];
     104  int i, c1, c2;
     105
    100106  out = owl_malloc(strlen(in) * 16 + 20);
     107
    101108  strcpy(out, "");
    102109
     
    127134  char *fname, keystring[MAX_KEY];
    128135  FILE *fkey;
    129   des_key_schedule schedule;
    130   char *out;
    131   unsigned char input[8], output[8];
    132   int size, length, i;
    133   const char *inbuff = NULL, *inptr;
    134   int num_blocks=0, last_block_size=0;
    135136
    136137  fname=GetZephyrVarKeyFile("zcrypt", class, instance);
     
    143144  }
    144145  fclose(fkey);
     146
     147  return owl_zcrypt_encrypt_with_key(in, keystring);
     148}
     149
     150char *owl_zcrypt_encrypt_with_key(const char *in, const char *keystring)
     151{
     152  des_key_schedule schedule;
     153  char *out;
     154  unsigned char input[8], output[8];
     155  int size, length, i;
     156  const char *inbuff = NULL, *inptr;
     157  int num_blocks=0, last_block_size=0;
    145158
    146159  owl_zcrypt_string_to_schedule(keystring, &schedule);
Note: See TracChangeset for help on using the changeset viewer.