Changeset a52eeb1


Ignore:
Timestamp:
Feb 9, 2010, 9:49:44 PM (15 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
Children:
ae50abc
Parents:
dacb555
git-author:
Anders Kaseorg <andersk@mit.edu> (02/07/10 23:08:47)
git-committer:
Anders Kaseorg <andersk@mit.edu> (02/09/10 21:49:44)
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

    rdacb555 ra52eeb1  
    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.