Re: mindterm copyright (more opensslish stuff)
Steve Langasek wrote:
> This is what puzzled me about this question. If the old code was C and
> the new code is entirely Java, are there enough recognizable portions of
> the old code left to be able to call mindterm a derivative work of
> libdes? Algorithms are not copyrightable, and there are only so many
> ways to implement DES. How strong is the case for claiming that mindterm
> is covered by the license of the libdes C library?
I've taken perl code and written C code based on it that would, I think,
hold up in a court of law as a derivative work, if the judge were
technically capable. I've also taken perl code and written C code from
it that would probably not. Given that it can go either way, and since
the author of the code seems to feel that it is a derivative work, I
think we have to assume that it is in this case, as that is the worst
case assumption. Here are some small code samples, FWIW:
public synchronized void encrypt(byte[] src, int srcOff, byte[] dest, int dest
int[] out = new int[2];
int iv0 = IV0;
int iv1 = IV1;
int end = srcOff + len;
for(int si = srcOff, di = destOff; si < end; si += 8, di += 8) {
iv0 ^= ((src[si] & 0xff) | ((src[si + 1] & 0xff) << 8) |
((src[si + 2] & 0xff) << 16) | ((src[si + 3] & 0xff) << 24));
iv1 ^= ((src[si + 4] & 0xff) | ((src[si + 5] & 0xff) << 8) |
((src[si + 6] & 0xff) << 16) | ((src[si + 7] & 0xff) << 24));
encrypt(iv0, iv1, out);
iv0 = out[0];
iv1 = out[1];
dest[di] = (byte)( iv0 & 0xff);
dest[di+1] = (byte)((iv0 >>> 8 ) & 0xff);
dest[di+2] = (byte)((iv0 >>> 16) & 0xff);
dest[di+3] = (byte)((iv0 >>> 24) & 0xff);
dest[di+4] = (byte)( iv1 & 0xff);
dest[di+5] = (byte)((iv1 >>> 8 ) & 0xff);
dest[di+6] = (byte)((iv1 >>> 16) & 0xff);
dest[di+7] = (byte)((iv1 >>> 24) & 0xff);
}
IV0 = iv0;
IV1 = iv1;
}
void des_cbc_encrypt(DESContext *ks, unsigned char *iv,
unsigned char *dest, const unsigned char *src,
unsigned int len)
{
word32 iv0, iv1, out[2];
unsigned int i;
assert((len & 7) == 0);
iv0 = GET_32BIT_LSB_FIRST(iv);
iv1 = GET_32BIT_LSB_FIRST(iv + 4);
for (i = 0; i < len; i += 8)
{
iv0 ^= GET_32BIT_LSB_FIRST(src + i);
iv1 ^= GET_32BIT_LSB_FIRST(src + i + 4);
des_encrypt(iv0, iv1, out, ks, 1);
iv0 = out[0];
iv1 = out[1];
PUT_32BIT_LSB_FIRST(dest + i, iv0);
PUT_32BIT_LSB_FIRST(dest + i + 4, iv1);
}
PUT_32BIT_LSB_FIRST(iv, iv0);
PUT_32BIT_LSB_FIRST(iv + 4, iv1);
}
The main encrypt functions that these two call have a similar degree of
commonaility, but are too large to include here.
--
see shy jo
Reply to: