public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug libgcj/23768] New: doFinal() methods in javax.crypto.Cipher incorrectly resetting cipher state @ 2005-09-07 18:34 qianzwang at yahoo dot com 2005-09-07 18:36 ` [Bug classpath/23768] " pinskia at gcc dot gnu dot org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: qianzwang at yahoo dot com @ 2005-09-07 18:34 UTC (permalink / raw) To: gcc-bugs The JCE spec for Cipher.doFinal states: "Upon finishing, this method resets this cipher object to the state it was in when previously initialized via a call to init. That is, the object is reset and available to encrypt or decrypt (depending on the operation mode that was specified in the call to init) more data." However, the various doFinal() methods of the Cipher class reset the cipher to an uninitialized state. Subsequent calls to update() or doFinal() result in an IllegalStateException. The Cipher class contains the following in several doFinal methods: ... if (state != ENCRYPT_MODE && state != DECRYPT_MODE) { throw new IllegalStateException("neither encrypting nor decrypting"); } state = INITIAL_STATE; ... The state of the cipher should not be set to INITIAL_STATE after doFinal but remain either in ENCRYPT_MODE or DECRYPT_MODE. All of the doFinal methods are affected by this bug. This is my first bug report here, so please let me know if more information is needed such as an executable example. I'm also not sure (since I didn't see it in the bug writing guidelines) whether I sould attach a patch for this bug. The same problem also exists in the latest Classpath codebase. -- Summary: doFinal() methods in javax.crypto.Cipher incorrectly resetting cipher state Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libgcj AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: qianzwang at yahoo dot com CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23768 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug classpath/23768] doFinal() methods in javax.crypto.Cipher incorrectly resetting cipher state 2005-09-07 18:34 [Bug libgcj/23768] New: doFinal() methods in javax.crypto.Cipher incorrectly resetting cipher state qianzwang at yahoo dot com @ 2005-09-07 18:36 ` pinskia at gcc dot gnu dot org 2005-09-07 18:36 ` pinskia at gcc dot gnu dot org 2005-09-08 5:49 ` csm at gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-09-07 18:36 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- Component|libgcj |classpath Product|gcc |classpath Version|4.0.1 |0.18 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23768 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug classpath/23768] doFinal() methods in javax.crypto.Cipher incorrectly resetting cipher state 2005-09-07 18:34 [Bug libgcj/23768] New: doFinal() methods in javax.crypto.Cipher incorrectly resetting cipher state qianzwang at yahoo dot com 2005-09-07 18:36 ` [Bug classpath/23768] " pinskia at gcc dot gnu dot org @ 2005-09-07 18:36 ` pinskia at gcc dot gnu dot org 2005-09-08 5:49 ` csm at gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-09-07 18:36 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- CC| |bug-classpath at gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23768 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug classpath/23768] doFinal() methods in javax.crypto.Cipher incorrectly resetting cipher state 2005-09-07 18:34 [Bug libgcj/23768] New: doFinal() methods in javax.crypto.Cipher incorrectly resetting cipher state qianzwang at yahoo dot com 2005-09-07 18:36 ` [Bug classpath/23768] " pinskia at gcc dot gnu dot org 2005-09-07 18:36 ` pinskia at gcc dot gnu dot org @ 2005-09-08 5:49 ` csm at gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: csm at gnu dot org @ 2005-09-08 5:49 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From csm at gnu dot org 2005-09-08 05:49 ------- Confirmed. The doFinal methods should leave 'state' as-is, as the reporter suggests. It is up to CipherSpi subclasses to reset themselves when their 'engineDoFinal' methods are called. -- What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |csm at gnu dot org |dot org | Status|UNCONFIRMED |ASSIGNED Ever Confirmed| |1 Last reconfirmed|0000-00-00 00:00:00 |2005-09-08 05:49:10 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23768 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-09-08 5:49 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-09-07 18:34 [Bug libgcj/23768] New: doFinal() methods in javax.crypto.Cipher incorrectly resetting cipher state qianzwang at yahoo dot com 2005-09-07 18:36 ` [Bug classpath/23768] " pinskia at gcc dot gnu dot org 2005-09-07 18:36 ` pinskia at gcc dot gnu dot org 2005-09-08 5:49 ` csm at gnu dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).