[BACK]Return to crypt.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libcrypt

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libcrypt/crypt.c between version 1.26 and 1.26.20.1

version 1.26, 2007/01/17 23:24:22 version 1.26.20.1, 2009/05/13 19:18:28
Line 287  typedef union {
Line 287  typedef union {
         { C_block tblk; permute(cpp,&tblk,p,4); LOAD (d,d0,d1,tblk); }          { C_block tblk; permute(cpp,&tblk,p,4); LOAD (d,d0,d1,tblk); }
 #endif /* LARGEDATA */  #endif /* LARGEDATA */
   
 STATIC  init_des __P((void));  STATIC  init_des(void);
 STATIC  init_perm __P((C_block [64/CHUNKBITS][1<<CHUNKBITS],  STATIC  init_perm(C_block [64/CHUNKBITS][1<<CHUNKBITS],
                        const unsigned char [64], int, int));                         const unsigned char [64], int, int);
 #ifndef LARGEDATA  #ifndef LARGEDATA
 STATIC  permute __P((const unsigned char *, C_block *, C_block *, int));  STATIC  permute(const unsigned char *, C_block *, C_block *, int);
 #endif  #endif
 #ifdef DEBUG  #ifdef DEBUG
 STATIC  prtab __P((const char *, unsigned char *, int));  STATIC  prtab(const char *, unsigned char *, int);
 #endif  #endif
   
   
 #ifndef LARGEDATA  #ifndef LARGEDATA
 STATIC  STATIC
 permute(cp, out, p, chars_in)  permute(const unsigned char *cp, C_block *out, C_block *p, int chars_in)
         const unsigned char *cp;  
         C_block *out;  
         C_block *p;  
         int chars_in;  
 {  {
         DCL_BLOCK(D,D0,D1);          DCL_BLOCK(D,D0,D1);
         C_block *tp;          C_block *tp;
Line 479  static char cryptresult[1+4+4+11+1]; /* 
Line 475  static char cryptresult[1+4+4+11+1]; /* 
  * followed by an encryption produced by the "key" and "setting".   * followed by an encryption produced by the "key" and "setting".
  */   */
 char *  char *
 crypt(key, setting)  crypt(const char *key, const char *setting)
         const char *key;  
         const char *setting;  
 {  {
         char *encp;          char *encp;
         int32_t i;          int32_t i;
Line 597  static C_block KS[KS_SIZE];
Line 591  static C_block KS[KS_SIZE];
  * Set up the key schedule from the key.   * Set up the key schedule from the key.
  */   */
 int  int
 des_setkey(key)  des_setkey(const char *key)
         const char *key;  
 {  {
         DCL_BLOCK(K, K0, K1);          DCL_BLOCK(K, K0, K1);
         C_block *help, *ptabp;          C_block *help, *ptabp;
Line 632  des_setkey(key)
Line 625  des_setkey(key)
  * compiler and machine architecture.   * compiler and machine architecture.
  */   */
 int  int
 des_cipher(in, out, salt, num_iter)  des_cipher(const char *in, char *out, long salt, int num_iter)
         const char *in;  
         char *out;  
         long salt;  
         int num_iter;  
 {  {
         /* variables that we want in registers, most important first */          /* variables that we want in registers, most important first */
 #if defined(pdp11)  #if defined(pdp11)
Line 754  des_cipher(in, out, salt, num_iter)
Line 743  des_cipher(in, out, salt, num_iter)
  * done at compile time, if the compiler were capable of that sort of thing.   * done at compile time, if the compiler were capable of that sort of thing.
  */   */
 STATIC  STATIC
 init_des()  init_des(void)
 {  {
         int i, j;          int i, j;
         int32_t k;          int32_t k;
Line 898  init_des()
Line 887  init_des()
  * "perm" must be all-zeroes on entry to this routine.   * "perm" must be all-zeroes on entry to this routine.
  */   */
 STATIC  STATIC
 init_perm(perm, p, chars_in, chars_out)  init_perm(C_block perm[64/CHUNKBITS][1<<CHUNKBITS], const unsigned char p[64],
         C_block perm[64/CHUNKBITS][1<<CHUNKBITS];      int chars_in, int chars_out)
         const unsigned char p[64];  
         int chars_in, chars_out;  
 {  {
         int i, j, k, l;          int i, j, k, l;
   
Line 922  init_perm(perm, p, chars_in, chars_out)
Line 909  init_perm(perm, p, chars_in, chars_out)
  * "setkey" routine (for backwards compatibility)   * "setkey" routine (for backwards compatibility)
  */   */
 int  int
 setkey(key)  setkey(const char *key)
         const char *key;  
 {  {
         int i, j, k;          int i, j, k;
         C_block keyblock;          C_block keyblock;
Line 943  setkey(key)
Line 929  setkey(key)
  * "encrypt" routine (for backwards compatibility)   * "encrypt" routine (for backwards compatibility)
  */   */
 int  int
 encrypt(block, flag)  encrypt(char *block, int flag)
         char *block;  
         int flag;  
 {  {
         int i, j, k;          int i, j, k;
         C_block cblock;          C_block cblock;
Line 972  encrypt(block, flag)
Line 956  encrypt(block, flag)
   
 #ifdef DEBUG  #ifdef DEBUG
 STATIC  STATIC
 prtab(s, t, num_rows)  prtab(const char *s, unsigned char *t, int num_rows)
         const char *s;  
         unsigned char *t;  
         int num_rows;  
 {  {
         int i, j;          int i, j;
   
Line 994  prtab(s, t, num_rows)
Line 975  prtab(s, t, num_rows)
 #include <err.h>  #include <err.h>
   
 int  int
 main (int argc, char *argv[])  main(int argc, char *argv[])
 {  {
     if (argc < 2)      if (argc < 2)
         errx(1, "Usage: %s password [salt]\n", argv[0]);          errx(1, "Usage: %s password [salt]\n", argv[0]);

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.26.20.1

CVSweb <webmaster@jp.NetBSD.org>