Changeset 9a0d25d


Ignore:
Timestamp:
Feb 3, 2019, 8:58:44 PM (5 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master
Children:
40def31a, 7aa6811, 8861654, c2a8e22, 35cdda2
Parents:
238c3a5
git-author:
Anders Kaseorg <andersk@mit.edu> (01/31/19 02:09:10)
git-committer:
Anders Kaseorg <andersk@mit.edu> (02/03/19 20:58:44)
Message:
Migrate to “new” OpenSSL DES API

The new API was added in OpenSSL 0.9.7.  The old API was removed in
OpenSSL 1.1.0.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r238c3a5 r9a0d25d  
    8282AC_CHECK_FUNCS([use_default_colors])
    8383AC_CHECK_FUNCS([resizeterm], [], [AC_MSG_ERROR([No resizeterm found])])
    84 AC_CHECK_FUNCS([des_string_to_key DES_string_to_key], [HAVE_DES_STRING_TO_KEY=1])
    85 AC_CHECK_FUNCS([des_ecb_encrypt DES_ecb_encrypt], [HAVE_DES_ECB_ENCRYPT=1])
    86 AC_CHECK_FUNCS([des_key_sched DES_key_sched], [HAVE_DES_KEY_SCHED=1])
     84AC_CHECK_FUNCS([DES_string_to_key], [HAVE_DES_STRING_TO_KEY=1])
     85AC_CHECK_FUNCS([DES_ecb_encrypt], [HAVE_DES_ECB_ENCRYPT=1])
     86AC_CHECK_FUNCS([DES_key_sched], [HAVE_DES_KEY_SCHED=1])
    8787
    8888dnl Checks for header files.
  • zcrypt.c

    r238c3a5 r9a0d25d  
    9595};
    9696
    97 static void owl_zcrypt_string_to_schedule(char *keystring, des_key_schedule *schedule) {
    98   des_cblock key;
    99 
    100   des_string_to_key(keystring, &key);
    101   des_key_sched(&key, *schedule);
     97static void owl_zcrypt_string_to_schedule(char *keystring, DES_key_schedule *schedule) {
     98  DES_cblock key;
     99
     100  DES_string_to_key(keystring, &key);
     101  DES_key_sched(&key, schedule);
    102102}
    103103
     
    720720int do_encrypt_des(const char *keyfile, const char *in, int length, FILE *outfile)
    721721{
    722   des_key_schedule schedule;
     722  DES_key_schedule schedule;
    723723  unsigned char input[8], output[8];
    724724  const char *inptr;
     
    766766
    767767    /* Encrypt and output the block */
    768     des_ecb_encrypt(&input, &output, schedule, TRUE);
     768    DES_ecb_encrypt(&input, &output, &schedule, TRUE);
    769769    block_to_ascii(output, outfile);
    770770
     
    905905
    906906int do_decrypt_des(const char *keyfile) {
    907   des_key_schedule schedule;
     907  DES_key_schedule schedule;
    908908  unsigned char input[8], output[8];
    909909  char tmp[9];
     
    915915    have a NULL-terminated string we can call printf/strlen on.
    916916
    917     We don't pass 'tmp' to des_ecb_encrypt directly, because it's
     917    We don't pass 'tmp' to DES_ecb_encrypt directly, because it's
    918918    prototyped as taking 'unsigned char[8]', and this avoids a stupid
    919919    cast.
     
    933933  while (read_ascii_block(input))
    934934  {
    935     des_ecb_encrypt(&input, &output, schedule, FALSE);
     935    DES_ecb_encrypt(&input, &output, &schedule, FALSE);
    936936    memcpy(tmp, output, 8);
    937937    printf("%s", tmp);
Note: See TracChangeset for help on using the changeset viewer.