Package: libmcrypt4
Version: 2.5.7-4
Severity: normal

As the subject says, it has problems with test
vectors from RFC2144.

The one with 128-bit succeeds, but 80 and 40-bit
keys fail.

----------------------------------------------
#include <stdio.h>
#include <mcrypt.h>
#include <string.h>

unsigned char plain [] = {
        0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF
};

unsigned char key5 [] = {
        0x01, 0x23, 0x45, 0x67, 0x12, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

unsigned char key10 [] = {
        0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
        0x23, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

unsigned char key16 [] = {
        0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
        0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9A
};

//// rfc2144
// 16: 23 8B 4F E5 84 7E 44 B2
// 10: EB 6A 71 1A 2C 02 27 1B
//  5: 7A C8 16 D1 6E 9B 30 2E

#define KLEN 10
unsigned char *key = key10;


int main()
{
        int err, i;
        unsigned char buf[64];
        MCRYPT ctx;
        ctx = mcrypt_module_open("cast-128", NULL, "ecb", NULL);
        if (ctx == (void *) MCRYPT_FAILED) {
                printf("not found\n");
                return 1;
        }
        err = mcrypt_generic_init(ctx, key, KLEN, NULL);
        if (err != 0) {
                printf("mcrypt_generic_init err=%d\n", err);
                return 1;
        }
        memcpy(buf, plain, 8);
        err = mcrypt_generic(ctx, buf, 8);
        if (err != 0) {
                printf("mcrypt_generic err=%d\n", err);
                return 1;
        }
        err = mcrypt_generic_end(ctx);
        if (err != 0) {
                printf("mcrypt_generic_end err=%d\n", err);
                return 1;
        }
        for (i = 0; i < 8; i++) {
                printf("%02x ", buf[i]);
        }
        printf("\n");
        return 0;
}

----------------------------------------------

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.11-rc5
Locale: LANG=et_EE.UTF-8, LC_CTYPE=et_EE.UTF-8 (charmap=UTF-8)

Versions of packages libmcrypt4 depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to