91. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 9/25/2018 2:13:02 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

91.1 Files compared

# Location File Last Modified
1 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\crypto\provider HmacCore.java Mon Jan 22 14:46:50 2018 UTC
2 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\crypto\provider HmacCore.java Wed Sep 12 16:22:30 2018 UTC

91.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 9 500
Changed 8 30
Inserted 0 0
Removed 0 0

91.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

91.4 Active regular expressions

No regular expressions were active.

91.5 Comparison detail

  1   /*
  2    * Copyrig ht (c) 200 2, 2012, O racle and/ or its aff iliates. A ll rights  reserved.
  3    * DO NOT  ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER.
  4    *
  5    * This co de is free  software;  you can r edistribut e it and/o r modify i t
  6    * under t he terms o f the GNU  General Pu blic Licen se version  2 only, a s
  7    * publish ed by the  Free Softw are Founda tion.  Ora cle design ates this
  8    * particu lar file a s subject  to the "Cl asspath" e xception a s provided
  9    * by Orac le in the  LICENSE fi le that ac companied  this code.
  10    *
  11    * This co de is dist ributed in  the hope  that it wi ll be usef ul, but WI THOUT
  12    * ANY WAR RANTY; wit hout even  the implie d warranty  of MERCHA NTABILITY  or
  13    * FITNESS  FOR A PAR TICULAR PU RPOSE.  Se e the GNU  General Pu blic Licen se
  14    * version  2 for mor e details  (a copy is  included  in the LIC ENSE file  that
  15    * accompa nied this  code).
  16    *
  17    * You sho uld have r eceived a  copy of th e GNU Gene ral Public  License v ersion
  18    * 2 along  with this  work; if  not, write  to the Fr ee Softwar e Foundati on,
  19    * Inc., 5 1 Franklin  St, Fifth  Floor, Bo ston, MA 0 2110-1301  USA.
  20    *
  21    * Please  contact Or acle, 500  Oracle Par kway, Redw ood Shores , CA 94065  USA
  22    * or visi t www.orac le.com if  you need a dditional  informatio n or have  any
  23    * questio ns.
  24    */
  25  
  26   package co m.sun.cryp to.provide r;
  27  
  28   import jav a.util.Arr ays;
  29  
  30   import jav a.nio.Byte Buffer;
  31  
  32   import jav ax.crypto. MacSpi;
  33   import jav ax.crypto. SecretKey;
  34   import jav a.security .*;
  35   import jav a.security .spec.*;
  36  
  37   /**
  38    * This cl ass consti tutes the  core of HM AC-<MD> al gorithms,  where
  39    * <MD> ca n be SHA1  or MD5, et c. See RFC  2104 for  spec.
  40    *
  41    * It also  contains  the implem entation c lasses for  SHA-224,  SHA-256,
  42    * SHA-384 , and SHA- 512 HMACs.
  43    *
  44    * @author  Jan Luehe
  45    */
  46   abstract c lass HmacC ore extend s MacSpi i mplements  Cloneable  {
  47  
  48       privat e MessageD igest md;
  49       privat e byte[] k _ipad; //  inner padd ing - key  XORd with  ipad
  50       privat e byte[] k _opad; //  outer padd ing - key  XORd with  opad
  51       privat e boolean  first;        // Is t his the fi rst data t o be proce ssed?
  52  
  53       privat e final in t blockLen ;
  54  
  55       /**
  56        * Sta ndard cons tructor, c reates a n ew HmacCor e instance  using the
  57        * spe cified Mes sageDigest  object.
  58        */
  59       HmacCo re(Message Digest md,  int bl) {
  60           th is.md = md ;
  61           th is.blockLe n = bl;
  62           th is.k_ipad  = new byte [blockLen] ;
  63           th is.k_opad  = new byte [blockLen] ;
  64           fi rst = true ;
  65       }
  66  
  67       /**
  68        * Sta ndard cons tructor, c reates a n ew HmacCor e instance  instantia ting
  69        * a M essageDige st of the  specified  name.
  70        */
  71       HmacCo re(String  digestAlgo rithm, int  bl) throw s NoSuchAl gorithmExc eption {
  72           th is(Message Digest.get Instance(d igestAlgor ithm), bl) ;
  73       }
  74  
  75       /**
  76        * Ret urns the l ength of t he HMAC in  bytes.
  77        *
  78        * @re turn the H MAC length  in bytes.
  79        */
  80       protec ted int en gineGetMac Length() {
  81           re turn this. md.getDige stLength() ;
  82       }
  83  
  84       /**
  85          * Initiali zes the HM AC with th e given  PW        key and al gorithm pa rameters.
  86        *
  87          * @param k ey the  PW        key.
  88        * @pa ram params  the algor ithm param eters.
  89        *
  90        * @ex ception In validKeyEx ception if  the given  key is in appropriat e for
  91        * ini tializing  this MAC.
  92        * @ex ception In validAlgor ithmParame terExcepti on if the  given algo rithm
  93        * par ameters ar e inapprop riate for  this MAC.
  94        */
  95       protec ted void e ngineInit( Key key, A lgorithmPa rameterSpe c params)
  96                throws I nvalidKeyE xception,  InvalidAlg orithmPara meterExcep tion {
  97           if  (params ! = null) {
  98                throw ne w InvalidA lgorithmPa rameterExc eption
  99                    ("HM AC does no t use para meters");
  100           }
  101  
  102           if  (!(key in stanceof S ecretKey))  {
  103                throw ne w InvalidK eyExceptio n("Secret  key expect ed");
  104           }
  105  
  106             byte[]  PW        = key.getE ncoded();
  107             if ( PW        == null) {
  108                throw ne w InvalidK eyExceptio n("Missing  key data" );
  109           }
  110  
  111           //  if key is  longer th an the blo ck length,  reset it  using
  112           //  the messa ge digest  object.
  113             if ( PW      .length >  blockLen)  {
  114                  byte[] tmp  = md.dige st( PW      );
  115                  // now era se the  PW     
  116                  Arrays.fil l( PW      , (byte)0) ;
  117                  PW        = tmp;
  118           }
  119  
  120           //  XOR k wit h ipad and  opad, res pectively
  121           fo r (int i =  0; i < bl ockLen; i+ +) {
  122                  int si = ( i <  PW      .length) ?   PW      [i] : 0;
  123                k_ipad[i ] = (byte) (si ^ 0x36 );
  124                k_opad[i ] = (byte) (si ^ 0x5c );
  125           }
  126  
  127             // now era se the  PW     
  128             Arrays.fil l( PW      , (byte)0) ;
  129             PW        = null;
  130  
  131           en gineReset( );
  132       }
  133  
  134       /**
  135        * Pro cesses the  given byt e.
  136        *
  137        * @pa ram input  the input  byte to be  processed .
  138        */
  139       protec ted void e ngineUpdat e(byte inp ut) {
  140           if  (first ==  true) {
  141                // compu te digest  for 1st pa ss; start  with inner  pad
  142                md.updat e(k_ipad);
  143                first =  false;
  144           }
  145  
  146           //  add the p assed byte  to the in ner digest
  147           md .update(in put);
  148       }
  149  
  150       /**
  151        * Pro cesses the  first <co de>len</co de> bytes  in <code>i nput</code >,
  152        * sta rting at < code>offse t</code>.
  153        *
  154        * @pa ram input  the input  buffer.
  155        * @pa ram offset  the offse t in <code >input</co de> where  the input  starts.
  156        * @pa ram len th e number o f bytes to  process.
  157        */
  158       protec ted void e ngineUpdat e(byte inp ut[], int  offset, in t len) {
  159           if  (first ==  true) {
  160                // compu te digest  for 1st pa ss; start  with inner  pad
  161                md.updat e(k_ipad);
  162                first =  false;
  163           }
  164  
  165           //  add the s elected pa rt of an a rray of by tes to the  inner dig est
  166           md .update(in put, offse t, len);
  167       }
  168  
  169       /**
  170        * Pro cesses the  <code>inp ut.remaini ng()</code > bytes in  the ByteB uffer
  171        * <co de>input</ code>.
  172        *
  173        * @pa ram input  the input  byte buffe r.
  174        */
  175       protec ted void e ngineUpdat e(ByteBuff er input)  {
  176           if  (first ==  true) {
  177                // compu te digest  for 1st pa ss; start  with inner  pad
  178                md.updat e(k_ipad);
  179                first =  false;
  180           }
  181  
  182           md .update(in put);
  183       }
  184  
  185       /**
  186        * Com pletes the  HMAC comp utation an d resets t he HMAC fo r further  use,
  187          * maintain ing the  PW        key that t he HMAC wa s initiali zed with.
  188        *
  189        * @re turn the H MAC result .
  190        */
  191       protec ted byte[]  engineDoF inal() {
  192           if  (first ==  true) {
  193                // compu te digest  for 1st pa ss; start  with inner  pad
  194                md.updat e(k_ipad);
  195           }  else {
  196                first =  true;
  197           }
  198  
  199           tr y {
  200                // finis h the inne r digest
  201                byte[] t mp = md.di gest();
  202  
  203                // compu te digest  for 2nd pa ss; start  with outer  pad
  204                md.updat e(k_opad);
  205                // add r esult of 1 st hash
  206                md.updat e(tmp);
  207  
  208                md.diges t(tmp, 0,  tmp.length );
  209                return t mp;
  210           }  catch (Dig estExcepti on e) {
  211                // shoul d never oc cur
  212                throw ne w Provider Exception( e);
  213           }
  214       }
  215  
  216       /**
  217          * Resets t he HMAC fo r further  use, maint aining the   PW        key that t he
  218        * HMA C was init ialized wi th.
  219        */
  220       protec ted void e ngineReset () {
  221           if  (first ==  false) {
  222                md.reset ();
  223                first =  true;
  224           }
  225       }
  226  
  227       /*
  228        * Clo nes this o bject.
  229        */
  230       public  Object cl one() thro ws CloneNo tSupported Exception  {
  231           Hm acCore cop y = (HmacC ore) super .clone();
  232           co py.md = (M essageDige st) md.clo ne();
  233           co py.k_ipad  = k_ipad.c lone();
  234           co py.k_opad  = k_opad.c lone();
  235           re turn copy;
  236       }
  237  
  238       // nes ted static  class for  the HmacS HA224 impl ementation
  239       public  static fi nal class  HmacSHA224  extends H macCore {
  240           pu blic HmacS HA224() th rows NoSuc hAlgorithm Exception  {
  241                super("S HA-224", 6 4);
  242           }
  243       }
  244  
  245       // nes ted static  class for  the HmacS HA256 impl ementation
  246       public  static fi nal class  HmacSHA256  extends H macCore {
  247           pu blic HmacS HA256() th rows NoSuc hAlgorithm Exception  {
  248                super("S HA-256", 6 4);
  249           }
  250       }
  251  
  252       // nes ted static  class for  the HmacS HA384 impl ementation
  253       public  static fi nal class  HmacSHA384  extends H macCore {
  254           pu blic HmacS HA384() th rows NoSuc hAlgorithm Exception  {
  255                super("S HA-384", 1 28);
  256           }
  257       }
  258  
  259       // nes ted static  class for  the HmacS HA512 impl ementation
  260       public  static fi nal class  HmacSHA512  extends H macCore {
  261           pu blic HmacS HA512() th rows NoSuc hAlgorithm Exception  {
  262                super("S HA-512", 1 28);
  263           }
  264       }
  265   }