[openssh-commits] [openssh] 06/11: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Oct 31 10:04:36 AEDT 2017


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit d2135474344335a7c6ee643b6ade6db400fa76ee
Author: djm at openbsd.org@openbsd.org <djm at openbsd.org@openbsd.org>
Date:   Fri Oct 27 01:01:17 2017 +0000

    upstream commit
    
    whitespace at EOL (lots)
    
    OpenBSD-Commit-ID: 757257dd44116794ee1b5a45c6724973de181747
---
 umac.c | 106 ++++++++++++++++++++++++++++++++---------------------------------
 1 file changed, 53 insertions(+), 53 deletions(-)

diff --git a/umac.c b/umac.c
index 9f2187c9..26bfd905 100644
--- a/umac.c
+++ b/umac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umac.c,v 1.12 2017/05/31 08:09:45 markus Exp $ */
+/* $OpenBSD: umac.c,v 1.13 2017/10/27 01:01:17 djm Exp $ */
 /* -----------------------------------------------------------------------
  * 
  * umac.c -- C Implementation UMAC Message Authentication
@@ -21,7 +21,7 @@
  * Comments should be directed to Ted Krovetz (tdk at acm.org)                                        
  *                                                                   
  * ---------------------------------------------------------------------- */
- 
+
  /* ////////////////////// IMPORTANT NOTES /////////////////////////////////
   *
   * 1) This version does not work properly on messages larger than 16MB
@@ -47,7 +47,7 @@
   * produced under gcc with optimizations set -O3 or higher. Dunno why.
   *
   /////////////////////////////////////////////////////////////////////// */
- 
+
 /* ---------------------------------------------------------------------- */
 /* --- User Switches ---------------------------------------------------- */
 /* ---------------------------------------------------------------------- */
@@ -187,11 +187,11 @@ static void kdf(void *bufp, aes_int_key key, UINT8 ndx, int nbytes)
     UINT8 out_buf[AES_BLOCK_LEN];
     UINT8 *dst_buf = (UINT8 *)bufp;
     int i;
-    
+
     /* Setup the initial value */
     in_buf[AES_BLOCK_LEN-9] = ndx;
     in_buf[AES_BLOCK_LEN-1] = i = 1;
-        
+
     while (nbytes >= AES_BLOCK_LEN) {
         aes_encryption(in_buf, out_buf, key);
         memcpy(dst_buf,out_buf,AES_BLOCK_LEN);
@@ -222,10 +222,10 @@ typedef struct {
 static void pdf_init(pdf_ctx *pc, aes_int_key prf_key)
 {
     UINT8 buf[UMAC_KEY_LEN];
-    
+
     kdf(buf, prf_key, 0, UMAC_KEY_LEN);
     aes_key_setup(buf, pc->prf_key);
-    
+
     /* Initialize pdf and cache */
     memset(pc->nonce, 0, sizeof(pc->nonce));
     aes_encryption(pc->nonce, pc->cache, pc->prf_key);
@@ -238,7 +238,7 @@ static void pdf_gen_xor(pdf_ctx *pc, const UINT8 nonce[8], UINT8 buf[8])
      * of the AES output. If last time around we returned the ndx-1st
      * element, then we may have the result in the cache already.
      */
-     
+
 #if (UMAC_OUTPUT_LEN == 4)
 #define LOW_BIT_MASK 3
 #elif (UMAC_OUTPUT_LEN == 8)
@@ -255,7 +255,7 @@ static void pdf_gen_xor(pdf_ctx *pc, const UINT8 nonce[8], UINT8 buf[8])
 #endif
     *(UINT32 *)t.tmp_nonce_lo = ((const UINT32 *)nonce)[1];
     t.tmp_nonce_lo[3] &= ~LOW_BIT_MASK; /* zero last bit */
-    
+
     if ( (((UINT32 *)t.tmp_nonce_lo)[0] != ((UINT32 *)pc->nonce)[1]) ||
          (((const UINT32 *)nonce)[0] != ((UINT32 *)pc->nonce)[0]) )
     {
@@ -263,7 +263,7 @@ static void pdf_gen_xor(pdf_ctx *pc, const UINT8 nonce[8], UINT8 buf[8])
         ((UINT32 *)pc->nonce)[1] = ((UINT32 *)t.tmp_nonce_lo)[0];
         aes_encryption(pc->nonce, pc->cache, pc->prf_key);
     }
-    
+
 #if (UMAC_OUTPUT_LEN == 4)
     *((UINT32 *)buf) ^= ((UINT32 *)pc->cache)[ndx];
 #elif (UMAC_OUTPUT_LEN == 8)
@@ -302,7 +302,7 @@ static void pdf_gen_xor(pdf_ctx *pc, const UINT8 nonce[8], UINT8 buf[8])
  * The routine nh_init() initializes the nh_ctx data structure and        
  * must be called once, before any other PDF routine.                     
  */
- 
+
  /* The "nh_aux" routines do the actual NH hashing work. They
   * expect buffers to be multiples of L1_PAD_BOUNDARY. These routines
   * produce output for all STREAMS NH iterations in one call, 
@@ -340,7 +340,7 @@ static void nh_aux(void *kp, const void *dp, void *hp, UINT32 dlen)
     const UINT32 *d = (const UINT32 *)dp;
     UINT32 d0,d1,d2,d3,d4,d5,d6,d7;
     UINT32 k0,k1,k2,k3,k4,k5,k6,k7;
-    
+
     h = *((UINT64 *)hp);
     do {
         d0 = LOAD_UINT32_LITTLE(d+0); d1 = LOAD_UINT32_LITTLE(d+1);
@@ -353,7 +353,7 @@ static void nh_aux(void *kp, const void *dp, void *hp, UINT32 dlen)
         h += MUL64((k1 + d1), (k5 + d5));
         h += MUL64((k2 + d2), (k6 + d6));
         h += MUL64((k3 + d3), (k7 + d7));
-        
+
         d += 8;
         k += 8;
     } while (--c);
@@ -421,7 +421,7 @@ static void nh_aux(void *kp, const void *dp, void *hp, UINT32 dlen)
     UINT32 d0,d1,d2,d3,d4,d5,d6,d7;
     UINT32 k0,k1,k2,k3,k4,k5,k6,k7,
         k8,k9,k10,k11,k12,k13,k14,k15;
-    
+
     h1 = *((UINT64 *)hp);
     h2 = *((UINT64 *)hp + 1);
     h3 = *((UINT64 *)hp + 2);
@@ -434,26 +434,26 @@ static void nh_aux(void *kp, const void *dp, void *hp, UINT32 dlen)
         d6 = LOAD_UINT32_LITTLE(d+6); d7 = LOAD_UINT32_LITTLE(d+7);
         k8 = *(k+8); k9 = *(k+9); k10 = *(k+10); k11 = *(k+11);
         k12 = *(k+12); k13 = *(k+13); k14 = *(k+14); k15 = *(k+15);
-        
+
         h1 += MUL64((k0 + d0), (k4 + d4));
         h2 += MUL64((k4 + d0), (k8 + d4));
         h3 += MUL64((k8 + d0), (k12 + d4));
-        
+
         h1 += MUL64((k1 + d1), (k5 + d5));
         h2 += MUL64((k5 + d1), (k9 + d5));
         h3 += MUL64((k9 + d1), (k13 + d5));
-        
+
         h1 += MUL64((k2 + d2), (k6 + d6));
         h2 += MUL64((k6 + d2), (k10 + d6));
         h3 += MUL64((k10 + d2), (k14 + d6));
-        
+
         h1 += MUL64((k3 + d3), (k7 + d7));
         h2 += MUL64((k7 + d3), (k11 + d7));
         h3 += MUL64((k11 + d3), (k15 + d7));
-        
+
         k0 = k8; k1 = k9; k2 = k10; k3 = k11;
         k4 = k12; k5 = k13; k6 = k14; k7 = k15;
-        
+
         d += 8;
         k += 8;
     } while (--c);
@@ -477,7 +477,7 @@ static void nh_aux(void *kp, const void *dp, void *hp, UINT32 dlen)
     UINT32 k0,k1,k2,k3,k4,k5,k6,k7,
         k8,k9,k10,k11,k12,k13,k14,k15,
         k16,k17,k18,k19;
-    
+
     h1 = *((UINT64 *)hp);
     h2 = *((UINT64 *)hp + 1);
     h3 = *((UINT64 *)hp + 2);
@@ -492,31 +492,31 @@ static void nh_aux(void *kp, const void *dp, void *hp, UINT32 dlen)
         k8 = *(k+8); k9 = *(k+9); k10 = *(k+10); k11 = *(k+11);
         k12 = *(k+12); k13 = *(k+13); k14 = *(k+14); k15 = *(k+15);
         k16 = *(k+16); k17 = *(k+17); k18 = *(k+18); k19 = *(k+19);
-        
+
         h1 += MUL64((k0 + d0), (k4 + d4));
         h2 += MUL64((k4 + d0), (k8 + d4));
         h3 += MUL64((k8 + d0), (k12 + d4));
         h4 += MUL64((k12 + d0), (k16 + d4));
-        
+
         h1 += MUL64((k1 + d1), (k5 + d5));
         h2 += MUL64((k5 + d1), (k9 + d5));
         h3 += MUL64((k9 + d1), (k13 + d5));
         h4 += MUL64((k13 + d1), (k17 + d5));
-        
+
         h1 += MUL64((k2 + d2), (k6 + d6));
         h2 += MUL64((k6 + d2), (k10 + d6));
         h3 += MUL64((k10 + d2), (k14 + d6));
         h4 += MUL64((k14 + d2), (k18 + d6));
-        
+
         h1 += MUL64((k3 + d3), (k7 + d7));
         h2 += MUL64((k7 + d3), (k11 + d7));
         h3 += MUL64((k11 + d3), (k15 + d7));
         h4 += MUL64((k15 + d3), (k19 + d7));
-        
+
         k0 = k8; k1 = k9; k2 = k10; k3 = k11;
         k4 = k12; k5 = k13; k6 = k14; k7 = k15;
         k8 = k16; k9 = k17; k10 = k18; k11 = k19;
-        
+
         d += 8;
         k += 8;
     } while (--c);
@@ -541,7 +541,7 @@ static void nh_transform(nh_ctx *hc, const UINT8 *buf, UINT32 nbytes)
  */
 {
     UINT8 *key;
-  
+
     key = hc->nh_key + hc->bytes_hashed;
     nh_aux(key, buf, hc->state, nbytes);
 }
@@ -613,7 +613,7 @@ static void nh_update(nh_ctx *hc, const UINT8 *buf, UINT32 nbytes)
 /* even multiple of HASH_BUF_BYTES.                                       */
 {
     UINT32 i,j;
-    
+
     j = hc->next_data_empty;
     if ((j + nbytes) >= HASH_BUF_BYTES) {
         if (j) {
@@ -711,10 +711,10 @@ static void nh(nh_ctx *hc, const UINT8 *buf, UINT32 padded_len,
  */
 {
     UINT32 nbits;
-    
+
     /* Initialize the hash state */
     nbits = (unpadded_len << 3);
-    
+
     ((UINT64 *)result)[0] = nbits;
 #if (UMAC_OUTPUT_LEN >= 8)
     ((UINT64 *)result)[1] = nbits;
@@ -725,7 +725,7 @@ static void nh(nh_ctx *hc, const UINT8 *buf, UINT32 padded_len,
 #if (UMAC_OUTPUT_LEN == 16)
     ((UINT64 *)result)[3] = nbits;
 #endif
-    
+
     nh_aux(hc->nh_key, buf, result, padded_len);
 }
 
@@ -802,13 +802,13 @@ static UINT64 poly64(UINT64 cur, UINT64 key, UINT64 data)
            x_lo,
            x_hi;
     UINT64 X,T,res;
-    
+
     X =  MUL64(key_hi, cur_lo) + MUL64(cur_hi, key_lo);
     x_lo = (UINT32)X;
     x_hi = (UINT32)(X >> 32);
-    
+
     res = (MUL64(key_hi, cur_hi) + x_hi) * 59 + MUL64(key_lo, cur_lo);
-     
+
     T = ((UINT64)x_lo << 32);
     res += T;
     if (res < T)
@@ -832,7 +832,7 @@ static void poly_hash(uhash_ctx_t hc, UINT32 data_in[])
 {
     int i;
     UINT64 *data=(UINT64*)data_in;
-    
+
     for (i = 0; i < STREAMS; i++) {
         if ((UINT32)(data[i] >> 32) == 0xfffffffful) {
             hc->poly_accum[i] = poly64(hc->poly_accum[i], 
@@ -862,7 +862,7 @@ static UINT64 ip_aux(UINT64 t, UINT64 *ipkp, UINT64 data)
     t = t + ipkp[1] * (UINT64)(UINT16)(data >> 32);
     t = t + ipkp[2] * (UINT64)(UINT16)(data >> 16);
     t = t + ipkp[3] * (UINT64)(UINT16)(data);
-    
+
     return t;
 }
 
@@ -870,7 +870,7 @@ static UINT32 ip_reduce_p36(UINT64 t)
 {
 /* Divisionless modular reduction */
     UINT64 ret;
-    
+
     ret = (t & m36) + 5 * (t >> 36);
     if (ret >= p36)
         ret -= p36;
@@ -888,7 +888,7 @@ static void ip_short(uhash_ctx_t ahc, UINT8 *nh_res, u_char *res)
 {
     UINT64 t;
     UINT64 *nhp = (UINT64 *)nh_res;
-    
+
     t  = ip_aux(0,ahc->ip_keys, nhp[0]);
     STORE_UINT32_BIG((UINT32 *)res+0, ip_reduce_p36(t) ^ ahc->ip_trans[0]);
 #if (UMAC_OUTPUT_LEN >= 8)
@@ -958,13 +958,13 @@ static void uhash_init(uhash_ctx_t ahc, aes_int_key prf_key)
 {
     int i;
     UINT8 buf[(8*STREAMS+4)*sizeof(UINT64)];
-    
+
     /* Zero the entire uhash context */
     memset(ahc, 0, sizeof(uhash_ctx));
 
     /* Initialize the L1 hash */
     nh_init(&ahc->hash, prf_key);
-    
+
     /* Setup L2 hash variables */
     kdf(buf, prf_key, 2, sizeof(buf));    /* Fill buffer with index 1 key */
     for (i = 0; i < STREAMS; i++) {
@@ -978,7 +978,7 @@ static void uhash_init(uhash_ctx_t ahc, aes_int_key prf_key)
         ahc->poly_key_8[i] &= ((UINT64)0x01ffffffu << 32) + 0x01ffffffu;
         ahc->poly_accum[i] = 1;  /* Our polyhash prepends a non-zero word */
     }
-    
+
     /* Setup L3-1 hash variables */
     kdf(buf, prf_key, 3, sizeof(buf)); /* Fill buffer with index 2 key */
     for (i = 0; i < STREAMS; i++)
@@ -988,7 +988,7 @@ static void uhash_init(uhash_ctx_t ahc, aes_int_key prf_key)
                                                   sizeof(ahc->ip_keys));
     for (i = 0; i < STREAMS*4; i++)
         ahc->ip_keys[i] %= p36;  /* Bring into Z_p36 */
-    
+
     /* Setup L3-2 hash variables    */
     /* Fill buffer with index 4 key */
     kdf(ahc->ip_trans, prf_key, 4, STREAMS * sizeof(UINT32));
@@ -1006,7 +1006,7 @@ static uhash_ctx_t uhash_alloc(u_char key[])
     uhash_ctx_t ctx;
     u_char bytes_to_add;
     aes_int_key prf_key;
-    
+
     ctx = (uhash_ctx_t)malloc(sizeof(uhash_ctx)+ALLOC_BOUNDARY);
     if (ctx) {
         if (ALLOC_BOUNDARY) {
@@ -1029,7 +1029,7 @@ static int uhash_free(uhash_ctx_t ctx)
 {
 /* Free memory allocated by uhash_alloc */
     u_char bytes_to_sub;
-    
+
     if (ctx) {
         if (ALLOC_BOUNDARY) {
             bytes_to_sub = *((u_char *)ctx - 1);
@@ -1050,12 +1050,12 @@ static int uhash_update(uhash_ctx_t ctx, const u_char *input, long len)
     UWORD bytes_hashed, bytes_remaining;
     UINT64 result_buf[STREAMS];
     UINT8 *nh_result = (UINT8 *)&result_buf;
-    
+
     if (ctx->msg_len + len <= L1_KEY_LEN) {
         nh_update(&ctx->hash, (const UINT8 *)input, len);
         ctx->msg_len += len;
     } else {
-    
+
          bytes_hashed = ctx->msg_len % L1_KEY_LEN;
          if (ctx->msg_len == L1_KEY_LEN)
              bytes_hashed = L1_KEY_LEN;
@@ -1128,7 +1128,7 @@ static int uhash(uhash_ctx_t ahc, u_char *msg, long len, u_char *res)
     UINT8 nh_result[STREAMS*sizeof(UINT64)];
     UINT32 nh_len;
     int extra_zeroes_needed;
-        
+
     /* If the message to be hashed is no longer than L1_HASH_LEN, we skip
      * the polyhash.
      */
@@ -1161,7 +1161,7 @@ static int uhash(uhash_ctx_t ahc, u_char *msg, long len, u_char *res)
 
         ip_long(ahc, res);
     }
-    
+
     uhash_reset(ahc);
     return 1;
 }
@@ -1220,7 +1220,7 @@ struct umac_ctx *umac_new(const u_char key[])
     struct umac_ctx *ctx, *octx;
     size_t bytes_to_add;
     aes_int_key prf_key;
-    
+
     octx = ctx = xcalloc(1, sizeof(*ctx) + ALLOC_BOUNDARY);
     if (ctx) {
         if (ALLOC_BOUNDARY) {
@@ -1234,7 +1234,7 @@ struct umac_ctx *umac_new(const u_char key[])
         uhash_init(&ctx->hash, prf_key);
         explicit_bzero(prf_key, sizeof(prf_key));
     }
-        
+
     return (ctx);
 }
 
@@ -1245,7 +1245,7 @@ int umac_final(struct umac_ctx *ctx, u_char tag[], const u_char nonce[8])
 {
     uhash_final(&ctx->hash, (u_char *)tag);
     pdf_gen_xor(&ctx->pdf, (const UINT8 *)nonce, (UINT8 *)tag);
-    
+
     return (1);
 }
 
@@ -1270,7 +1270,7 @@ int umac(struct umac_ctx *ctx, u_char *input,
 {
     uhash(&ctx->hash, input, len, (u_char *)tag);
     pdf_gen_xor(&ctx->pdf, (UINT8 *)nonce, (UINT8 *)tag);
-    
+
     return (1);
 }
 #endif

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list