centos 7
crypto weakness #319


Weakness Breakdown


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):

The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment.

File Name:



The highlighted line of code below is the trigger point of this particular Centos 7 crypto weakness.

 typedef void salsa20_func(struct salsa20_ctx *ctx,
			  unsigned length, uint8_t *dst,
			  const uint8_t *src);
static void
_test_salsa20(salsa20_func *crypt,
	      const struct tstring *key,
	      const struct tstring *iv,
	      const struct tstring *cleartext,
	      const struct tstring *ciphertext)
  struct salsa20_ctx ctx;
  uint8_t *data;
  unsigned length;

  ASSERT (cleartext->length == ciphertext->length);
  length = cleartext->length;

  ASSERT (iv->length == SALSA20_IV_SIZE);

  data = xalloc(length + 1);

  salsa20_set_key(&ctx, key->length, key->data);
  salsa20_set_iv(&ctx, iv->data);
  data[length] = 17;
  crypt(&ctx, length, data, cleartext->data);
  if (data[length] != 17)
      fprintf(stderr, "Encrypt of %u bytes wrote too much!\nInput:", length);
      fprintf(stderr, "\n");
  if (!MEMEQ(length, data, ciphertext->data))
      fprintf(stderr, "Encrypt failed:\nInput:");
      fprintf(stderr, "\nOutput: ");
      print_hex(length, data);
      fprintf(stderr, "\nExpected:");
      fprintf(stderr, "\n");
  salsa20_set_key(&ctx, key->length, key->data);
  salsa20_set_iv(&ctx, iv->data);
  crypt(&ctx, length, data, data);

  if (!MEMEQ(length, data, cleartext->data))
      fprintf(stderr, "Decrypt failed:\nInput:"); 

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.