harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ruth Cao" <ruoshe...@gmail.com>
Subject [classlib][security]different behavior between Harmony and RI in MessageDigest.digest(byte[], int, int)
Date Tue, 23 Jan 2007 10:50:04 GMT
Hello all,

I've found that MessageDigest_Impl1Test in security module, the following
test case[1] passes on Harmony but fails on *RI*. RI throws
NullPointerException here.

Is it a non-bug difference or a bug? Would any security expert give some
suggestions?

Thanks in advance.

[1] public class MyMessageDigest1 extends MessageDigest {

    public boolean runEngineReset = false;
    public boolean runEngineDigest = false;
    public boolean runEngineUpdate1 = false;
    public boolean runEngineUpdate2 = false;

    public MyMessageDigest1() {
        super(null);
    }

    public MyMessageDigest1(String algorithm) {
        super(algorithm);
    }

    public void engineReset() {
        runEngineReset = true;
    }

    public byte[] engineDigest() {
        runEngineDigest = true;
        return null;
    }

    public void engineUpdate(byte arg0) {
        runEngineUpdate1 = true;
    }

    public void engineUpdate(byte[] arg0, int arg1, int arg2) {
        runEngineUpdate2 = true;
    }
}

public void testDigestbyteArrayintint() throws Exception {
        MyMessageDigest1 md = new MyMessageDigest1("ABC");
        byte[] b = {1, 2, 3, 4, 5};
        assertEquals("incorrect result", 0, md.digest(b, 2, 3));
//$NON-NLS-1$
}

-- 
Best regards,

Ruth Cao
China Software Development Lab, IBM

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message