[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.116 and 1.117

version 1.116, 2020/03/13 03:17:07 version 1.117, 2020/04/03 04:27:03
Line 55 
Line 55 
         int     plaintext;          int     plaintext;
         int     encrypt;          int     encrypt;
         EVP_CIPHER_CTX *evp;          EVP_CIPHER_CTX *evp;
         struct chachapoly_ctx cp_ctx; /* XXX union with evp? */          struct chachapoly_ctx *cp_ctx;
         struct aesctr_ctx ac_ctx; /* XXX union with evp? */          struct aesctr_ctx ac_ctx; /* XXX union with evp? */
         const struct sshcipher *cipher;          const struct sshcipher *cipher;
 };  };
Line 265 
Line 265 
   
         cc->cipher = cipher;          cc->cipher = cipher;
         if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) {          if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) {
                 ret = chachapoly_init(&cc->cp_ctx, key, keylen);                  cc->cp_ctx = chachapoly_new(key, keylen);
                   ret = cc->cp_ctx != NULL ? 0 : SSH_ERR_INVALID_ARGUMENT;
                 goto out;                  goto out;
         }          }
         if ((cc->cipher->flags & CFLAG_NONE) != 0) {          if ((cc->cipher->flags & CFLAG_NONE) != 0) {
Line 341 
Line 342 
    const u_char *src, u_int len, u_int aadlen, u_int authlen)     const u_char *src, u_int len, u_int aadlen, u_int authlen)
 {  {
         if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) {          if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) {
                 return chachapoly_crypt(&cc->cp_ctx, seqnr, dest, src,                  return chachapoly_crypt(cc->cp_ctx, seqnr, dest, src,
                     len, aadlen, authlen, cc->encrypt);                      len, aadlen, authlen, cc->encrypt);
         }          }
         if ((cc->cipher->flags & CFLAG_NONE) != 0) {          if ((cc->cipher->flags & CFLAG_NONE) != 0) {
Line 404 
Line 405 
     const u_char *cp, u_int len)      const u_char *cp, u_int len)
 {  {
         if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0)          if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0)
                 return chachapoly_get_length(&cc->cp_ctx, plenp, seqnr,                  return chachapoly_get_length(cc->cp_ctx, plenp, seqnr,
                     cp, len);                      cp, len);
         if (len < 4)          if (len < 4)
                 return SSH_ERR_MESSAGE_INCOMPLETE;                  return SSH_ERR_MESSAGE_INCOMPLETE;
Line 417 
Line 418 
 {  {
         if (cc == NULL)          if (cc == NULL)
                 return;                  return;
         if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0)          if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) {
                 explicit_bzero(&cc->cp_ctx, sizeof(cc->cp_ctx));                  chachapoly_free(cc->cp_ctx);
         else if ((cc->cipher->flags & CFLAG_AESCTR) != 0)                  cc->cp_ctx = NULL;
           } else if ((cc->cipher->flags & CFLAG_AESCTR) != 0)
                 explicit_bzero(&cc->ac_ctx, sizeof(cc->ac_ctx));                  explicit_bzero(&cc->ac_ctx, sizeof(cc->ac_ctx));
 #ifdef WITH_OPENSSL  #ifdef WITH_OPENSSL
         EVP_CIPHER_CTX_free(cc->evp);          EVP_CIPHER_CTX_free(cc->evp);

Legend:
Removed from v.1.116  
changed lines
  Added in v.1.117