tools build: Switch to new openssl API for test-libcrypto
Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an error when it encounters the deprecated function MD5_Init() and the others. The error would be interpreted as missing libcrypto, while in reality it is not. Fixes: 6e8ccb4f624a73c5 ("tools/bpf: properly account for libbfd variations") Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: bpf@vger.kernel.org Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Ingo Molnar <mingo@redhat.com> Cc: John Fastabend <john.fastabend@gmail.com> Cc: KP Singh <kpsingh@kernel.org> Cc: llvm@lists.linux.dev Cc: Martin KaFai Lau <martin.lau@linux.dev> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Nick Terrell <terrelln@fb.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Quentin Monnet <quentin@isovalent.com> Cc: Song Liu <song@kernel.org> Cc: Stanislav Fomichev <sdf@google.com> Link: https://lore.kernel.org/r/20220719170555.2576993-4-roberto.sassu@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
73f8ec5992
commit
5b245985a6
@ -1,16 +1,23 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#include <openssl/evp.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
MD5_CTX context;
|
EVP_MD_CTX *mdctx;
|
||||||
unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];
|
unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];
|
||||||
unsigned char dat[] = "12345";
|
unsigned char dat[] = "12345";
|
||||||
|
unsigned int digest_len;
|
||||||
|
|
||||||
MD5_Init(&context);
|
mdctx = EVP_MD_CTX_new();
|
||||||
MD5_Update(&context, &dat[0], sizeof(dat));
|
if (!mdctx)
|
||||||
MD5_Final(&md[0], &context);
|
return 0;
|
||||||
|
|
||||||
|
EVP_DigestInit_ex(mdctx, EVP_md5(), NULL);
|
||||||
|
EVP_DigestUpdate(mdctx, &dat[0], sizeof(dat));
|
||||||
|
EVP_DigestFinal_ex(mdctx, &md[0], &digest_len);
|
||||||
|
EVP_MD_CTX_free(mdctx);
|
||||||
|
|
||||||
SHA1(&dat[0], sizeof(dat), &md[0]);
|
SHA1(&dat[0], sizeof(dat), &md[0]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user