[BACK]Return to cipher.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/cipher.c between version 1.2 and 1.3

version 1.2, 1999/09/26 21:02:15 version 1.3, 1999/09/26 22:53:25
Line 71 
Line 71 
   /* memcpy(&iv1, iv2, 8); */   /* Note how iv1 == iv2 on entry and exit. */    /* memcpy(&iv1, iv2, 8); */   /* Note how iv1 == iv2 on entry and exit. */
 }  }
   
 #ifdef WITH_BLOWFISH  
 /*  /*
  * SSH uses a variation on Blowfish, all bytes must be swapped before   * SSH uses a variation on Blowfish, all bytes must be swapped before
  * and after encryption/decryption. Thus the swap_bytes stuff (yuk).   * and after encryption/decryption. Thus the swap_bytes stuff (yuk).
Line 104 
Line 103 
       *dst++ = t.i;        *dst++ = t.i;
     }      }
 }  }
 #endif /* WITH_BLOWFISH */  
   
 void (*cipher_attack_detected)(const char *fmt, ...) = fatal;  void (*cipher_attack_detected)(const char *fmt, ...) = fatal;
   
Line 136 
Line 134 
 #else  #else
   "no rc4",    "no rc4",
 #endif  #endif
 #ifdef WITH_BLOWFISH  
   "blowfish"    "blowfish"
 #else  
   "no blowfish"  
 #endif  
 };  };
   
 /* Returns a bit mask indicating which ciphers are supported by this  /* Returns a bit mask indicating which ciphers are supported by this
Line 158 
Line 152 
 #ifdef WITH_RC4  #ifdef WITH_RC4
   mask |= 1 << SSH_CIPHER_RC4;    mask |= 1 << SSH_CIPHER_RC4;
 #endif  #endif
 #ifdef WITH_BLOWFISH  
   mask |= 1 << SSH_CIPHER_BLOWFISH;    mask |= 1 << SSH_CIPHER_BLOWFISH;
 #endif  
   return mask;    return mask;
 }  }
   
Line 259 
Line 251 
       break;        break;
 #endif /* WITH_RC4 */  #endif /* WITH_RC4 */
   
 #ifdef WITH_BLOWFISH  
     case SSH_CIPHER_BLOWFISH:      case SSH_CIPHER_BLOWFISH:
       BF_set_key(&context->u.bf.key, keylen, padded);        BF_set_key(&context->u.bf.key, keylen, padded);
       memset(context->u.bf.iv, 0, 8);        memset(context->u.bf.iv, 0, 8);
       break;        break;
 #endif /* WITH_BLOWFISH */  
   
     default:      default:
       fatal("cipher_set_key: unknown cipher: %d", cipher);        fatal("cipher_set_key: unknown cipher: %d", cipher);
Line 306 
Line 296 
       break;        break;
 #endif /* WITH_RC4 */  #endif /* WITH_RC4 */
   
 #ifdef WITH_BLOWFISH  
     case SSH_CIPHER_BLOWFISH:      case SSH_CIPHER_BLOWFISH:
       swap_bytes(src, dest, len);        swap_bytes(src, dest, len);
       BF_cbc_encrypt(dest, dest, len,        BF_cbc_encrypt(dest, dest, len,
                      &context->u.bf.key, context->u.bf.iv, BF_ENCRYPT);                       &context->u.bf.key, context->u.bf.iv, BF_ENCRYPT);
       swap_bytes(dest, dest, len);        swap_bytes(dest, dest, len);
       break;        break;
 #endif /* WITH_BLOWFISH */  
   
     default:      default:
       fatal("cipher_encrypt: unknown cipher: %d", context->type);        fatal("cipher_encrypt: unknown cipher: %d", context->type);
Line 357 
Line 345 
       break;        break;
 #endif /* WITH_RC4 */  #endif /* WITH_RC4 */
   
 #ifdef WITH_BLOWFISH  
     case SSH_CIPHER_BLOWFISH:      case SSH_CIPHER_BLOWFISH:
       detect_cbc_attack(src, len);        detect_cbc_attack(src, len);
       swap_bytes(src, dest, len);        swap_bytes(src, dest, len);
Line 365 
Line 352 
                      &context->u.bf.key, context->u.bf.iv, BF_DECRYPT);                       &context->u.bf.key, context->u.bf.iv, BF_DECRYPT);
       swap_bytes(dest, dest, len);        swap_bytes(dest, dest, len);
       break;        break;
 #endif /* WITH_BLOWFISH */  
   
     default:      default:
       fatal("cipher_decrypt: unknown cipher: %d", context->type);        fatal("cipher_decrypt: unknown cipher: %d", context->type);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3