Subject: crypt vs crypto
To: None <current-users@netbsd.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: current-users
Date: 11/27/2000 15:23:09
I've just been trying to make an install floppy with ssh=>need libcrypto 
and struck the problem that ed/cbc.c:76 uses:

/* Hide the calls to the primitive encryption routines. */
#define DES_KEY(buf) \
        if (des_setkey(buf)) \ 
                des_error("des_setkey");
#define DES_XFORM(buf) \ 
        if (des_cipher(buf, buf, 0L, (inverse ? -1 : 1))) \
                des_error("des_cipher");

and des_setkey is only defined in libcrypt. libcrypto has no function of
that name, though des_set_key sounds awfully close. If I link both libcrypt
and libcrypto, then crypt is multiply defined.


des_setkey is declared in unistd.h under "Implementation-defined
extensions":
int      des_setkey __P((const char *key));

des_set_key is declared eg in openssl/des.h:
int des_set_key(const_des_cblock *key,des_key_schedule schedule);


Would it be a reasonable idea to add

int
des_setkey(const char *key)
{
  int ans;
  des_key_schedule schedule;

  int=des_set_key(key,schedule);
  memcpy(key,&schedule,sizeof(key));

  return ans;
}

or rather, something which is actually correct, to libcrypto so that it can
replace libcrypt?

Cheers,

Patrick