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

Diff for /src/usr.bin/ssh/cipher-chachapoly.c between version 1.8 and 1.9

version 1.8, 2016/08/03 05:41:57 version 1.9, 2020/04/03 04:27:03
Line 26 
Line 26 
 #include "ssherr.h"  #include "ssherr.h"
 #include "cipher-chachapoly.h"  #include "cipher-chachapoly.h"
   
 int  struct chachapoly_ctx {
 chachapoly_init(struct chachapoly_ctx *ctx,          struct chacha_ctx main_ctx, header_ctx;
     const u_char *key, u_int keylen)  };
   
   struct chachapoly_ctx *
   chachapoly_new(const u_char *key, u_int keylen)
 {  {
           struct chachapoly_ctx *ctx;
   
         if (keylen != (32 + 32)) /* 2 x 256 bit keys */          if (keylen != (32 + 32)) /* 2 x 256 bit keys */
                 return SSH_ERR_INVALID_ARGUMENT;                  return NULL;
           if ((ctx = calloc(1, sizeof(*ctx))) == NULL)
                   return NULL;
         chacha_keysetup(&ctx->main_ctx, key, 256);          chacha_keysetup(&ctx->main_ctx, key, 256);
         chacha_keysetup(&ctx->header_ctx, key + 32, 256);          chacha_keysetup(&ctx->header_ctx, key + 32, 256);
         return 0;          return ctx;
   }
   
   void
   chachapoly_free(struct chachapoly_ctx *cpctx)
   {
           freezero(cpctx, sizeof(*cpctx));
 }  }
   
 /*  /*

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9