xref: /openbmc/linux/tools/build/feature/test-libcrypto.c (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1*b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
28ee46460SStephane Eranian #include <openssl/sha.h>
38ee46460SStephane Eranian #include <openssl/md5.h>
48ee46460SStephane Eranian 
58ee46460SStephane Eranian int main(void)
68ee46460SStephane Eranian {
78ee46460SStephane Eranian 	MD5_CTX context;
88ee46460SStephane Eranian 	unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];
98ee46460SStephane Eranian 	unsigned char dat[] = "12345";
108ee46460SStephane Eranian 
118ee46460SStephane Eranian 	MD5_Init(&context);
128ee46460SStephane Eranian 	MD5_Update(&context, &dat[0], sizeof(dat));
138ee46460SStephane Eranian 	MD5_Final(&md[0], &context);
148ee46460SStephane Eranian 
158ee46460SStephane Eranian 	SHA1(&dat[0], sizeof(dat), &md[0]);
168ee46460SStephane Eranian 
178ee46460SStephane Eranian 	return 0;
188ee46460SStephane Eranian }
19