pupsnow / as3crypto

Automatically exported from code.google.com/p/as3crypto
0 stars 0 forks source link

flex2.compiler.as3.SignatureExtension.SignatureGenerationFailed when compiling com.hurlant.crypto.symmetric.AESKey #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attempt to compile the current contents of the svn repo to a swc using compc

What is the expected output? 
A nicely compiled swc!

What do you see instead?
    [java] Loading configuration file
/Volumes/DATA/Applications/eclipse/plugins/com.powerflasher.fdt.shippedflex_3.3.
0.4852_1000/flex/frameworks/flex-config.xml
     [java]
/Volumes/DATA/work/osx_eclipse/SharifyLibraryCode/lib/src/as3crypto/com/hurlant/
crypto/symmetric/AESKey.as(214):
col: 23: Warning:
flex2.compiler.as3.SignatureExtension.SignatureGenerationFailed[node='ForStateme
nt',
level='warning',
cause='flex2.compiler.as3.SignatureAssertionRuntimeException: Unreachable
Codepath
     [java]     at
flex2.compiler.as3.SignatureEvaluator.ASSERT(SignatureEvaluator.java:369)
     [java]     at
flex2.compiler.as3.SignatureEvaluator.UNREACHABLE_CODEPATH(SignatureEvaluator.ja
va:357)
     [java]     at
flex2.compiler.as3.SignatureEvaluator.evaluate(SignatureEvaluator.java:1560)
     [java]     at
macromedia.asc.parser.ForStatementNode.evaluate(ForStatementNode.java:50)
     [java]     at
flash.swf.tools.as3.EvaluatorAdapter.evaluate(EvaluatorAdapter.java:338)
     [java]     at
flex2.compiler.as3.SignatureEvaluator.evaluate(SignatureEvaluator.java:1795)
     [java]     at
macromedia.asc.parser.StatementListNode.evaluate(StatementListNode.java:60)
     [java]     at
flex2.compiler.as3.SignatureEvaluator.evaluate(SignatureEvaluator.java:530)
     [java]     at
macromedia.asc.parser.ClassDefinitionNode.evaluate(ClassDefinitionNode.java:106)
     [java]     at
flash.swf.tools.as3.EvaluatorAdapter.evaluate(EvaluatorAdapter.java:338)
     [java]     at
flex2.compiler.as3.SignatureEvaluator.evaluate(SignatureEvaluator.java:1795)
     [java]     at
macromedia.asc.parser.StatementListNode.evaluate(StatementListNode.java:60)
     [java]     at
flex2.compiler.as3.SignatureEvaluator.evaluate(SignatureEvaluator.java:454)
     [java]     at macromedia.asc.parser.ProgramNode.evaluate(ProgramNode.java:80)
     [java]     at
flex2.compiler.as3.SignatureExtension.generateSignature(SignatureExtension.java:
270)
     [java]     at
flex2.compiler.as3.SignatureExtension.doSignatureGeneration(SignatureExtension.j
ava:174)
     [java]     at
flex2.compiler.as3.SignatureExtension.parse1(SignatureExtension.java:137)
     [java]     at flex2.compiler.as3.Compiler.parse1(Compiler.java:369)
     [java] ', column='23',
path='/Volumes/DATA/work/osx_eclipse/SharifyLibraryCode/lib/src/as3crypto/com/hu
rlant/crypto/symmetric/AESKey.as',
line='214']
     [java]             for (i=0;i<256;i++) {
     [java]                       ^
     [java]
/Volumes/DATA/work/osx_eclipse/SharifyLibraryCode/lib/bin/as3crypto.swc
(68870 bytes)

What version of the product are you using? On what operating system?
Latest from svn: r28

Please provide any additional information below.

I'm not sure what the syntax on line 204 does? Seems pretty strange! This
is a related bug on the flex sdk:

http://bugs.adobe.com/jira/browse/SDK-19201

But using the swc from here isn't working for me in this situation because
I'm running into other problems and need to debug within the source...

Original issue reported on code.google.com by kelvin.l...@gmail.com on 20 Aug 2009 at 5:00

GoogleCodeExporter commented 9 years ago
Attaching a patch which allows the code to compile properly. Not sure if it's a 
good
solution to the problem though. Basically replaces the vars that need to be
initialised with getters and in those getters calls a static init method which 
does
the initialisation stuff...

Original comment by kelvin.l...@gmail.com on 21 Aug 2009 at 2:51

Attachments:

GoogleCodeExporter commented 9 years ago
Based on comments from:

http://www.mail-archive.com/flashcoders@chattyfig.figleaf.com/msg47315.html

I have fixed up the AESKey.as file so that it is calling a staticInit() 
function that
initializes the ByteArray's. Attached is a patch of the changes.

Original comment by shawn.tu...@gmail.com on 4 Sep 2009 at 8:30

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
With what tool have you divided the patch from the source? how can i apply the 
patch?
can you provide the updated source somewhere?

Original comment by klingede...@yahoo.de on 8 Sep 2009 at 3:47

GoogleCodeExporter commented 9 years ago
My patch was generated via svn (using subclipse in Eclipse). Not sure about 
Shawn's
one but I guess it's the same... 

Original comment by kelvin.l...@gmail.com on 9 Sep 2009 at 2:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Shawn - I think your patch has an issue - around line 222, you're using 'j' to
initialize a loop variable, but the rest of the loop is using the 'i' variable:

+                       for (var j:uint = 0; i < _Rcon.length; i++) {
                                Rcon[i] = _Rcon[i];
                        }

When I changed the loop to use j exclusively, it was fine.  Can you repost your 
patch
with the fix?

Original comment by SilentCh...@gmail.com on 10 Sep 2009 at 10:45

GoogleCodeExporter commented 9 years ago
fixed patch attached :) needs some testing, though.

Original comment by gretel....@gmail.com on 22 Sep 2009 at 1:30

Attachments:

GoogleCodeExporter commented 9 years ago
above patch has now been tested by me and is working fine.

Original comment by gretel....@gmail.com on 22 Sep 2009 at 2:08

GoogleCodeExporter commented 9 years ago
Any idea when this will get merged into the trunk?

Original comment by Typi...@gmail.com on 30 Sep 2009 at 10:58

GoogleCodeExporter commented 9 years ago
The patch solution did not work in my case... no errors, but messed up AES
encryption/decryption.

What did work is putting a function declaration where it's missing in the 
original
code, then calling it right after. The rest of the code is intact.

private static var i:uint;
private static function staticInitializer():void {          
 Sbox = new ByteArray;
 InvSbox = new ByteArray;
 Xtime2Sbox = new ByteArray;
 Xtime3Sbox = new ByteArray;
 Xtime2 = new ByteArray;
 Xtime9 = new ByteArray;
 XtimeB = new ByteArray;
 XtimeD = new ByteArray;
 XtimeE = new ByteArray;
 for (i=0;i<256;i++) {
  Sbox[i] = _Sbox[i];
  InvSbox[i] = _InvSbox[i];
  Xtime2Sbox[i] = _Xtime2Sbox[i];
  Xtime3Sbox[i] = _Xtime3Sbox[i];
  Xtime2[i] = _Xtime2[i];
  Xtime9[i] = _Xtime9[i];
  XtimeB[i] = _XtimeB[i];
  XtimeD[i] = _XtimeD[i];
  XtimeE[i] = _XtimeE[i];
 }
 Rcon = new ByteArray;
 for (i=0;i<_Rcon.length;i++) {
  Rcon[i] = _Rcon[i];
 }
}
staticInitializer();

Tested encrypting/decrypting AES.
Hope this can help.

Original comment by cont...@a-neko.eu on 9 Oct 2009 at 9:17

GoogleCodeExporter commented 9 years ago
a.neko.systems's solution worked for me. odd error. initially tried to call an 
init
in the constructor then had to re-read what a "static initializer" really is

Original comment by Dominic....@gmail.com on 11 Feb 2010 at 10:19

GoogleCodeExporter commented 9 years ago
a.neko.system: thanks tons.  That solution worked for me as well.

Original comment by agae...@gmail.com on 9 Dec 2010 at 10:28

GoogleCodeExporter commented 9 years ago
Seems this issue is still there... the solution described by a.neko works!

Original comment by JohnPMil...@gmail.com on 21 Sep 2011 at 3:05