mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-18 06:33:43 -04:00
perf util: Remove SHA-1 code
Now that the SHA-1 code is no longer used, remove it. Signed-off-by: Eric Biggers <ebiggers@kernel.org> Tested-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Fangrui Song <maskray@sourceware.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jason A. Donenfeld <Jason@zx2c4.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Pablo Galindo <pablogsal@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
f136fc491b
commit
e35dd81017
@@ -2,7 +2,6 @@
|
||||
#include "tests.h"
|
||||
#include "util/blake2s.h"
|
||||
#include "util/debug.h"
|
||||
#include "util/sha1.h"
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <stdlib.h>
|
||||
@@ -18,48 +17,6 @@ static int test_strreplace(char needle, const char *haystack,
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
#define MAX_LEN 512
|
||||
|
||||
/* Test sha1() for all lengths from 0 to MAX_LEN inclusively. */
|
||||
static int test_sha1(void)
|
||||
{
|
||||
u8 data[MAX_LEN];
|
||||
size_t digests_size = (MAX_LEN + 1) * SHA1_DIGEST_SIZE;
|
||||
u8 *digests;
|
||||
u8 digest_of_digests[SHA1_DIGEST_SIZE];
|
||||
/*
|
||||
* The correctness of this value was verified by running this test with
|
||||
* sha1() replaced by OpenSSL's SHA1().
|
||||
*/
|
||||
static const u8 expected_digest_of_digests[SHA1_DIGEST_SIZE] = {
|
||||
0x74, 0xcd, 0x4c, 0xb9, 0xd8, 0xa6, 0xd5, 0x95, 0x22, 0x8b,
|
||||
0x7e, 0xd6, 0x8b, 0x7e, 0x46, 0x95, 0x31, 0x9b, 0xa2, 0x43,
|
||||
};
|
||||
size_t i;
|
||||
|
||||
digests = malloc(digests_size);
|
||||
TEST_ASSERT_VAL("failed to allocate digests", digests != NULL);
|
||||
|
||||
/* Generate MAX_LEN bytes of data. */
|
||||
for (i = 0; i < MAX_LEN; i++)
|
||||
data[i] = i;
|
||||
|
||||
/* Calculate a SHA-1 for each length 0 through MAX_LEN inclusively. */
|
||||
for (i = 0; i <= MAX_LEN; i++)
|
||||
sha1(data, i, &digests[i * SHA1_DIGEST_SIZE]);
|
||||
|
||||
/* Calculate digest of all digests calculated above. */
|
||||
sha1(digests, digests_size, digest_of_digests);
|
||||
|
||||
free(digests);
|
||||
|
||||
/* Check for the expected result. */
|
||||
TEST_ASSERT_VAL("wrong output from sha1()",
|
||||
memcmp(digest_of_digests, expected_digest_of_digests,
|
||||
SHA1_DIGEST_SIZE) == 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Maximum data length tested by test_blake2s() */
|
||||
#define MAX_DATA_LEN 512
|
||||
|
||||
@@ -131,8 +88,6 @@ static int test_blake2s(void)
|
||||
|
||||
static int test__util(struct test_suite *t __maybe_unused, int subtest __maybe_unused)
|
||||
{
|
||||
int ret;
|
||||
|
||||
TEST_ASSERT_VAL("empty string", test_strreplace(' ', "", "123", ""));
|
||||
TEST_ASSERT_VAL("no match", test_strreplace('5', "123", "4", "123"));
|
||||
TEST_ASSERT_VAL("replace 1", test_strreplace('3', "123", "4", "124"));
|
||||
@@ -140,10 +95,6 @@ static int test__util(struct test_suite *t __maybe_unused, int subtest __maybe_u
|
||||
TEST_ASSERT_VAL("replace long", test_strreplace('a', "abcabc", "longlong",
|
||||
"longlongbclonglongbc"));
|
||||
|
||||
ret = test_sha1();
|
||||
if (ret != TEST_OK)
|
||||
return ret;
|
||||
|
||||
return test_blake2s();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user