You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Tony Reix (JIRA)" <ji...@apache.org> on 2015/06/26 15:36:04 UTC

[jira] [Commented] (HADOOP-12106) JceAesCtrCryptoCodec.java may have an issue with Cypher.update(ByteBuffer, ByteBuffer)

    [ https://issues.apache.org/jira/browse/HADOOP-12106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14602880#comment-14602880 ] 

Tony Reix commented on HADOOP-12106:
------------------------------------

Adding some more traces arount doFinal() :

System.out.println("@ JceAesCtrCryptoCodec.process: 1" + " Typically code will not get here" + " contextReset= " + contextReset);
System.out.println("@ JceAesCtrCryptoCodec.process: BEFORE cipher.doFinal" + " inBuffer= " + inBuffer.toString() + " outBuffer= " +  outBuffer.toString());
          int m = cipher.doFinal(inBuffer, outBuffer);
System.out.println("@ JceAesCtrCryptoCodec.process: 0" + " m= " + m );
System.out.println("@ JceAesCtrCryptoCodec.process: AFTER cipher.doFinal" + " inBuffer= " + inBuffer.toString() + " outBuffer= " +  outBuffer.toString());


 I've got:

@ CryptoOutputStream.encrypt:
  inBuffer  = java.nio.DirectByteBuffer[pos=0 lim=3235 cap=8192]
  outBuffer= java.nio.DirectByteBuffer[pos=0 lim=8192 cap=8192]
@ JceAesCtrCryptoCodec.encrypt: 0
@ JceAesCtrCryptoCodec.process: BEFORE cipher.update
  inBuffer  = java.nio.DirectByteBuffer[pos=0 lim=3235 cap=8192]
  outBuffer= java.nio.DirectByteBuffer[pos=0 lim=8192 cap=8192]

@ JceAesCtrCryptoCodec.process: 0 n= 3232 inputSize= 3235

@ JceAesCtrCryptoCodec.process: AFTER  cipher.update
  inBuffer  = java.nio.DirectByteBuffer[pos=3235 lim=3235 cap=8192]
  outBuffer= java.nio.DirectByteBuffer[pos=3232 lim=8192 cap=8192]

@ JceAesCtrCryptoCodec.process: 1 Typically code will not get here
               contextReset= true
@ JceAesCtrCryptoCodec.process: BEFORE cipher.doFinal
  inBuffer  = java.nio.DirectByteBuffer[pos=3235 lim=3235 cap=8192]
  outBuffer= java.nio.DirectByteBuffer[pos=3232 lim=8192 cap=8192]

@ JceAesCtrCryptoCodec.process: 0 m= 0

@ JceAesCtrCryptoCodec.process: AFTER  cipher.doFinal
  inBuffer  = java.nio.DirectByteBuffer[pos=3235 lim=3235 cap=8192]
  outBuffer= java.nio.DirectByteBuffer[pos=3232 lim=8192 cap=8192]


doFinal() did NOTHING

Maybe because inBuffer : [pos=3235 == lim=3235 ?!?!!
  Nothing to do ?

Cipher.doFinal()) documentation says:
"All input.remaining() bytes starting at input.position() are processed.
 ... Upon return, the input buffer's position will be equal to its
limit; its limit will not have changed. The output buffer's position
will have advanced by n, where n is the value returned by this method;
the output buffer's limit will not have changed. "

> JceAesCtrCryptoCodec.java may have an issue with Cypher.update(ByteBuffer, ByteBuffer)
> --------------------------------------------------------------------------------------
>
>                 Key: HADOOP-12106
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12106
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.6.0, 2.7.0
>         Environment: Hadoop 2.60 and 2.7+
>  - AIX/PowerPC/IBMJVM
>  - Ubuntu/i386/IBMJVM
>            Reporter: Tony Reix
>         Attachments: mvn.Test.TestCryptoStreamsForLocalFS.res20.AIX.Errors, mvn.Test.TestCryptoStreamsForLocalFS.res20.Ubuntu-i386.IBMJVM.Errors, mvn.Test.TestCryptoStreamsForLocalFS.res22.OpenJDK.Errors
>
>
> On AIX (IBM JVM available only), many sub-tests of :
>    org.apache.hadoop.crypto.TestCryptoStreamsForLocalFS
> fail:
>  Tests run: 13, Failures: 5, Errors: 1, Skipped: 
>   - testCryptoIV
>   - testSeek
>   - testSkip
>   - testAvailable
>   - testPositionedRead
> When testing SAME exact code on Ubuntu/i386 :
>   - with OpenJDK, all tests are OK
>   - with IBM JVM, tests randomly fail.
> The issue may be in the IBM JVM, or in some Hadoop code that not perfectly handles differences due to different IBM JVM.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)