alpine 3.6
crypto weakness #32

4

Weakness Breakdown


Definition:

This weakness involves creating non-standard or non-tested algorithms, using weak algorithms or applying cryptographic algorithms incorrectly. Algorithms that were once considered safe are commonly later found to be unsafe, as the algorithms were broken.

Warning code(s):

These keysizes are too small given today's computers.

File Name:

libressl/src/libressl-2.5.5/crypto/evp/e_rc2.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 crypto weakness.

 	NULL
};

static const EVP_CIPHER r2_40_cbc_cipher = {
	NID_rc2_40_cbc,
	8, 5 /* 40 bit */, 8,
	EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
	rc2_init_key,
	rc2_cbc_cipher,
	NULL,
	sizeof(EVP_RC2_KEY),
	rc2_set_asn1_type_and_iv,
	rc2_get_asn1_type_and_iv,
	rc2_ctrl,
	NULL
};

const EVP_CIPHER *
EVP_rc2_64_cbc(void)
{
	return (&r2_64_cbc_cipher);
}

const EVP_CIPHER *
EVP_rc2_40_cbc(void)
{
	return (&r2_40_cbc_cipher);
}

static int
rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	RC2_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx),
	    key, data(ctx)->key_bits);
	return 1;
}

static int
rc2_meth_to_magic(EVP_CIPHER_CTX *e)
{
	int i;

	EVP_CIPHER_CTX_ctrl(e, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i);
	if (i == 128)
		return (RC2_128_MAGIC);
	else if (i == 64)
		return (RC2_64_MAGIC);
	else if (i == 40)
		return (RC2_40_MAGIC); 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.