Print this page
first pass

Split Close
Expand all
Collapse all
          --- old/usr/src/common/crypto/arcfour/sun4v/arcfour_crypt.c
          +++ new/usr/src/common/crypto/arcfour/sun4v/arcfour_crypt.c
↓ open down ↓ 21 lines elided ↑ open up ↑
  22   22  /*
  23   23   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   */
  25   25  
  26   26  #include "../arcfour.h"
  27   27  
  28   28  /* Initialize the key stream 'key' using the key value */
  29   29  void
  30   30  arcfour_key_init(ARCFour_key *key, uchar_t *keyval, int keyvallen)
  31   31  {
  32      -/* EXPORT DELETE START */
  33      -
  34   32          uchar_t ext_keyval[256];
  35   33          uchar_t tmp;
  36   34          int i, j;
  37   35  
  38   36          for (i = j = 0; i < 256; i++, j++) {
  39   37                  if (j == keyvallen)
  40   38                          j = 0;
  41   39  
  42   40                  ext_keyval[i] = keyval[j];
  43   41          }
↓ open down ↓ 2 lines elided ↑ open up ↑
  46   44  
  47   45          j = 0;
  48   46          for (i = 0; i < 256; i++) {
  49   47                  j = (j + key->arr[i] + ext_keyval[i]) % 256;
  50   48                  tmp = key->arr[i];
  51   49                  key->arr[i] = key->arr[j];
  52   50                  key->arr[j] = tmp;
  53   51          }
  54   52          key->i = 0;
  55   53          key->j = 0;
  56      -
  57      -/* EXPORT DELETE END */
  58   54  }
  59   55  
  60   56  
  61   57  /*
  62   58   * Encipher 'in' using 'key.
  63   59   * in and out can point to the same location
  64   60   */
  65   61  void
  66   62  arcfour_crypt(ARCFour_key *key, uchar_t *in, uchar_t *out, size_t len)
  67   63  {
  68   64          size_t ii;
  69   65          unsigned long long in0, merge = 0, merge0 = 0, merge1, mask = 0;
  70   66          uchar_t i, j, *base, jj, *base1, tmp;
  71   67          unsigned int tmp0, tmp1, i_accum, shift = 0, i1;
  72   68  
  73      -
  74      -/* EXPORT DELETE START */
  75   69          int index;
  76   70  
  77   71          base = key->arr;
  78   72  
  79   73          index = (((uintptr_t)in) & 0x7);
  80   74  
  81   75          /* Get the 'in' on an 8-byte alignment */
  82   76          if (index > 0) {
  83   77                  i = key->i;
  84   78                  j = key->j;
↓ open down ↓ 507 lines elided ↑ open up ↑
 592  586                          base[j] = (uchar_t)tmp0;
 593  587  
 594  588                          tmp0 += tmp1;
 595  589                          tmp0 = tmp0 & 0xff;
 596  590                          out[ii] = in[ii] ^ base[tmp0];
 597  591                  }
 598  592                  key->i = i;
 599  593                  key->j = j;
 600  594          }
 601  595  #endif /* sun4v */
 602      -
 603      -/* EXPORT DELETE END */
 604  596  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX