You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a Javacard applet. I'm using Proguard because I have almost no memory on that card. I also optimize aggressively because of this. Proguard will overload functions, which is fine, but if an overloaded function has a different return type from another function, then the converter (which turns the JAR into something that the card understands) will throw an error.
I want proguard to overload functions, except when they have different return types.
My rules:
-verbose
-allowaccessmodification
-optimizeaggressively
-dontwarn java.lang.Class
-repackageclasses com.example
-optimizationpasses 10
-keepattributes Exceptions
-optimizations !code/simplification/arithmetic,!code/simplification/cast
-useuniqueclassmembernames
-keep public class com.example.MyApplet {
public static void install(byte[], short, byte);
public void process(javacard.framework.APDU);
public void processToolkit(short);
public void uninstall();
}
Below is an example. I'm concerned with the bottom functions:
publicclassMyAppletextendsAppletimplementsToolkitInterface, AppletEvent {
byte[] timerIds = newbyte[3];
MyApplet() {}
publicvoidconfigureToolkit() {
ToolkitRegistrytoolkitRegistry = ToolkitRegistrySystem.getEntry();
for(bytei = 0; i < (byte) timerIds.length; i++ {
timerIds[i] = toolkitRegistry.allocateTimer();
}
toolkitRegistry.setEvent(EVENT_PROFILE_DOWNLOAD);
}
publicstaticvoidinstall(byte[] bArray, shortbOffset, bytebLength) {
MyAppletapplet = MyApplet();
applet.register();
applet.configureToolkit();
}
publicvoidprocess(APDUapdu) {}
publicvoidprocessToolkit(shortevent) {
switch(event)
caseEVENT_PROFILE_DOWNLOAD:
for(bytei = 0; i < (byte) timerIds.length; i++ {
startTimer(timerIds[i], i);
}
break;
caseEVENT_TIMER_EXPIRATION:
bytetimerId = getTimerId();
startTimer(timerId, (byte) 5);
break;
default:
break;
}
}
publicvoiduninstall() {}
// If these are not inlined, they will get the same name.// But they have different return typesvoidstartTimer(bytetimerId, byteseconds) {
// impl
}
bytegetTimerId() {
// impl
}
}
Most of the time these types of functions are inlined. But assume that for some reason these functions cannot be inlined.
The text was updated successfully, but these errors were encountered:
I'm working on a Javacard applet. I'm using Proguard because I have almost no memory on that card. I also optimize aggressively because of this. Proguard will overload functions, which is fine, but if an overloaded function has a different return type from another function, then the converter (which turns the JAR into something that the card understands) will throw an error.
I want proguard to overload functions, except when they have different return types.
My rules:
Below is an example. I'm concerned with the bottom functions:
Most of the time these types of functions are inlined. But assume that for some reason these functions cannot be inlined.
The text was updated successfully, but these errors were encountered: