Hi,
I've managed to build Mozilla's nss/jss on Android 2.2/API8/ndk-r4b at
ubuntu 10.04.
When I try to generate the testing certificates on the Android emulator, I
got
W/dalvikvm(  284): ReferenceTable overflow (max=512)
W/dalvikvm(  284): Last 10 entries in JNI local reference table:
I can generate an empty db :
$ adb shell
# cd /data/local/msm/emptydb
# ls -l
-rw------- app_32   app_32     229376 2010-08-17 01:23 cert9.db
-rw------- app_32   app_32       1106 2010-08-17 01:23 pkcs11.txt
-rw------- app_32   app_32     294912 2010-08-17 01:23 key4.db
#
I copied the above db files to my linux box, use desktop version of nss/jss,
I can generate the testing certificates
and use certutil to see the certificates.
I am not familiar with the jss code, I looked at the jss java/c code(jss
4.3.1), I can not find the obvious leaks of "reference".

1)Is it possible to increase the size of ReferenceTable, let's say
(max=51200) ?
2) Can someone point me a direction where is the leaks of references ?

I've built fennec first by following the instructions at
https://wiki.mozilla.org/Mobile/Fennec/Android and got nss/nspr libraries
for ARMv5,
then I untar the jss-4.3.1 at the same location as nss, made some changes to
the config files and got libjss4.so for ARMv5.
Here is a piece of source code :
 String dbdir = "/data/local/msm/emptydb";
        String strPasswordFile = "/data/local/msm/passwords";
        SetupDBs.initDB(dbdir, strPasswordFile);
        String[] strArgs = {
         dbdir,
         strPasswordFile,
         "12345",
         "macubuntu",
         "SHA-256/RSA",
         "JSSCATestCert",
         "JSSTestServerCert",
         "JSSTestClientCert"
        };
        try {
            GenerateTestCert gtc = new GenerateTestCert();
            gtc.doIt(strArgs);
        } catch(Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
Here is the full output of "adb logcat" in more details:
D/dalvikvm(  277): Trying to load lib
/data/data/com.example.softtoken/lib/libjss4.so 0x43e37a78
D/dalvikvm(  277): Added shared lib
/data/data/com.example.softtoken/lib/libjss4.so 0x43e37a78
D/dalvikvm(  277): No JNI_OnLoad found in
/data/data/com.example.softtoken/lib/libjss4.so 0x43e37a78, skipping init
D/dalvikvm(  277): Trying to load lib
/data/data/com.example.softtoken/lib/libjss4.so 0x43e37a78
D/dalvikvm(  277): Shared lib
'/data/data/com.example.softtoken/lib/libjss4.so' already loaded in same CL
0x43e37a78
I/System.out(  277): main: jss library loaded
I/System.out(  277): ***FilePasswordCallback returns m1oZilla
I/ActivityManager(   58): Displayed activity
com.android.launcher/com.android.launcher2.Launcher: 47222 ms (total 47222
ms)
W/dalvikvm(  277): ReferenceTable overflow (max=512)
W/dalvikvm(  277): Last 10 entries in JNI local reference table:
W/dalvikvm(  277):   502: 0x43e77c50 cls=[B (20 bytes)
W/dalvikvm(  277):   503: 0x43e77c68 cls=[B (20 bytes)
W/dalvikvm(  277):   504: 0x43e77c80 cls=Ljava/lang/String; (28 bytes)
W/dalvikvm(  277):   505: 0x43e6c1b0 cls=Ljava/lang/Class;
'Lorg/mozilla/jss/pkcs11/PK11InternalTokenCert;' (164 bytes)
W/dalvikvm(  277):   506: 0x43e77d40
cls=Lorg/mozilla/jss/pkcs11/PK11InternalTokenCert; (20 bytes)
W/dalvikvm(  277):   507: 0x43e77e08 cls=[B (20 bytes)
W/dalvikvm(  277):   508: 0x43e77e20 cls=[B (20 bytes)
W/dalvikvm(  277):   509: 0x43e77e38 cls=Ljava/lang/String; (28 bytes)
W/dalvikvm(  277):   510: 0x43e6c1b0 cls=Ljava/lang/Class;
'Lorg/mozilla/jss/pkcs11/PK11InternalTokenCert;' (164 bytes)
W/dalvikvm(  277):   511: 0x43e77ef8
cls=Lorg/mozilla/jss/pkcs11/PK11InternalTokenCert; (20 bytes)
W/dalvikvm(  277): JNI local reference table summary (512 entries):
W/dalvikvm(  277):   104 of Ljava/lang/Class; 164B (4 unique)
W/dalvikvm(  277):   103 of Ljava/lang/String; 28B (103 unique)
W/dalvikvm(  277):     1 of [Ljava/lang/String; 28B
W/dalvikvm(  277):   202 of [B 20B (202 unique)
W/dalvikvm(  277):     1 of [Lorg/mozilla/jss/crypto/X509Certificate; 620B
W/dalvikvm(  277):   101 of Lorg/mozilla/jss/pkcs11/PK11InternalTokenCert;
20B (101 unique)
W/dalvikvm(  277): Memory held directly by tracked refs is 10248 bytes
E/dalvikvm(  277): Failed adding to JNI local ref table (has 512 entries)
I/dalvikvm(  277): "main" prio=5 tid=1 RUNNABLE
I/dalvikvm(  277):   | group="main" sCount=0 dsCount=0 s=N obj=0x4001d8e0
self=0xccb0
I/dalvikvm(  277):   | sysTid=277 nice=0 sched=0/0 cgrp=default
handle=-1345026008
I/dalvikvm(  277):   | schedstat=( 3452339153 891172842 121 )
I/dalvikvm(  277):   at org.mozilla.jss.CryptoManager.getPermCerts(Native
Method)
I/dalvikvm(  277):   at
com.example.softtoken.GenerateTestCert.doIt(GenerateTestCert.java:174)
I/dalvikvm(  277):   at
com.example.softtoken.Softtoken.onCreate(Softtoken.java:53)
I/dalvikvm(  277):   at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
I/dalvikvm(  277):   at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
I/dalvikvm(  277):   at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
I/dalvikvm(  277):   at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
I/dalvikvm(  277):   at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
I/dalvikvm(  277):   at android.os.Handler.dispatchMessage(Handler.java:99)
I/dalvikvm(  277):   at android.os.Looper.loop(Looper.java:123)
I/dalvikvm(  277):   at
android.app.ActivityThread.main(ActivityThread.java:4627)
I/dalvikvm(  277):   at java.lang.reflect.Method.invokeNative(Native Method)
I/dalvikvm(  277):   at java.lang.reflect.Method.invoke(Method.java:521)
I/dalvikvm(  277):   at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
I/dalvikvm(  277):   at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
I/dalvikvm(  277):   at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(  277):
E/dalvikvm(  277): VM aborting
I/DEBUG   (   30): *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*** ***
Thanks and regards.
mli
-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to