[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.57 and 1.58

version 1.57, 2002/05/30 08:07:31 version 1.58, 2002/06/04 23:05:49
Line 552 
Line 552 
                 if (evplen == 0)                  if (evplen == 0)
                         return;                          return;
                 if (evplen != len)                  if (evplen != len)
                         fatal("%s: wrong iv length %d != %d", __FUNCTION__,                          fatal("%s: wrong iv length %d != %d", __func__,
                             evplen, len);                              evplen, len);
   
 #if OPENSSL_VERSION_NUMBER < 0x00907000L  #if OPENSSL_VERSION_NUMBER < 0x00907000L
Line 561 
Line 561 
   
                         aesc = EVP_CIPHER_CTX_get_app_data(&cc->evp);                          aesc = EVP_CIPHER_CTX_get_app_data(&cc->evp);
                         if (aesc == NULL)                          if (aesc == NULL)
                                 fatal("%s: no rijndael context", __FUNCTION__);                                  fatal("%s: no rijndael context", __func__);
                         civ = aesc->r_iv;                          civ = aesc->r_iv;
                 } else                  } else
 #endif  #endif
Line 572 
Line 572 
         case SSH_CIPHER_3DES: {          case SSH_CIPHER_3DES: {
                 struct ssh1_3des_ctx *desc;                  struct ssh1_3des_ctx *desc;
                 if (len != 24)                  if (len != 24)
                         fatal("%s: bad 3des iv length: %d", __FUNCTION__, len);                          fatal("%s: bad 3des iv length: %d", __func__, len);
                 desc = EVP_CIPHER_CTX_get_app_data(&cc->evp);                  desc = EVP_CIPHER_CTX_get_app_data(&cc->evp);
                 if (desc == NULL)                  if (desc == NULL)
                         fatal("%s: no 3des context", __FUNCTION__);                          fatal("%s: no 3des context", __func__);
                 debug3("%s: Copying 3DES IV", __FUNCTION__);                  debug3("%s: Copying 3DES IV", __func__);
                 memcpy(iv, desc->k1.iv, 8);                  memcpy(iv, desc->k1.iv, 8);
                 memcpy(iv + 8, desc->k2.iv, 8);                  memcpy(iv + 8, desc->k2.iv, 8);
                 memcpy(iv + 16, desc->k3.iv, 8);                  memcpy(iv + 16, desc->k3.iv, 8);
                 return;                  return;
         }          }
         default:          default:
                 fatal("%s: bad cipher %d", __FUNCTION__, c->number);                  fatal("%s: bad cipher %d", __func__, c->number);
         }          }
         memcpy(iv, civ, len);          memcpy(iv, civ, len);
 }  }
Line 609 
Line 609 
   
                         aesc = EVP_CIPHER_CTX_get_app_data(&cc->evp);                          aesc = EVP_CIPHER_CTX_get_app_data(&cc->evp);
                         if (aesc == NULL)                          if (aesc == NULL)
                                 fatal("%s: no rijndael context", __FUNCTION__);                                  fatal("%s: no rijndael context", __func__);
                         div = aesc->r_iv;                          div = aesc->r_iv;
                 } else                  } else
 #endif  #endif
Line 621 
Line 621 
                 struct ssh1_3des_ctx *desc;                  struct ssh1_3des_ctx *desc;
                 desc = EVP_CIPHER_CTX_get_app_data(&cc->evp);                  desc = EVP_CIPHER_CTX_get_app_data(&cc->evp);
                 if (desc == NULL)                  if (desc == NULL)
                         fatal("%s: no 3des context", __FUNCTION__);                          fatal("%s: no 3des context", __func__);
                 debug3("%s: Installed 3DES IV", __FUNCTION__);                  debug3("%s: Installed 3DES IV", __func__);
                 memcpy(desc->k1.iv, iv, 8);                  memcpy(desc->k1.iv, iv, 8);
                 memcpy(desc->k2.iv, iv + 8, 8);                  memcpy(desc->k2.iv, iv + 8, 8);
                 memcpy(desc->k3.iv, iv + 16, 8);                  memcpy(desc->k3.iv, iv + 16, 8);
                 return;                  return;
         }          }
         default:          default:
                 fatal("%s: bad cipher %d", __FUNCTION__, c->number);                  fatal("%s: bad cipher %d", __func__, c->number);
         }          }
         memcpy(div, iv, evplen);          memcpy(div, iv, evplen);
 }  }
Line 652 
Line 652 
                 struct ssh1_3des_ctx *desc;                  struct ssh1_3des_ctx *desc;
                 desc = EVP_CIPHER_CTX_get_app_data(&cc->evp);                  desc = EVP_CIPHER_CTX_get_app_data(&cc->evp);
                 if (desc == NULL)                  if (desc == NULL)
                         fatal("%s: no 3des context", __FUNCTION__);                          fatal("%s: no 3des context", __func__);
                 plen = EVP_X_STATE_LEN(desc->k1);                  plen = EVP_X_STATE_LEN(desc->k1);
                 if (dat == NULL)                  if (dat == NULL)
                         return (3*plen);                          return (3*plen);
Line 681 
Line 681 
                 struct ssh1_3des_ctx *desc;                  struct ssh1_3des_ctx *desc;
                 desc = EVP_CIPHER_CTX_get_app_data(&cc->evp);                  desc = EVP_CIPHER_CTX_get_app_data(&cc->evp);
                 if (desc == NULL)                  if (desc == NULL)
                         fatal("%s: no 3des context", __FUNCTION__);                          fatal("%s: no 3des context", __func__);
                 plen = EVP_X_STATE_LEN(desc->k1);                  plen = EVP_X_STATE_LEN(desc->k1);
                 memcpy(EVP_X_STATE(desc->k1), dat, plen);                  memcpy(EVP_X_STATE(desc->k1), dat, plen);
                 memcpy(EVP_X_STATE(desc->k2), dat + plen, plen);                  memcpy(EVP_X_STATE(desc->k2), dat + plen, plen);

Legend:
Removed from v.1.57  
changed lines
  Added in v.1.58