mirror of
https://github.com/GOSTSec/vanitygen
synced 2025-02-07 12:24:20 +00:00
Use newer OpenSSL APIs to hash OpenCL programs, to eliminate deprecation
warnings in some cases.
This commit is contained in:
parent
4700be088f
commit
d665689430
20
oclengine.c
20
oclengine.c
@ -26,7 +26,7 @@
|
|||||||
#include <openssl/ec.h>
|
#include <openssl/ec.h>
|
||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
#include <openssl/md5.h>
|
#include <openssl/evp.h>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <OpenCL/cl.h>
|
#include <OpenCL/cl.h>
|
||||||
@ -487,23 +487,25 @@ vg_ocl_hash_program(vg_ocl_context_t *vocp, const char *opts,
|
|||||||
const char *program, size_t size,
|
const char *program, size_t size,
|
||||||
unsigned char *hash_out)
|
unsigned char *hash_out)
|
||||||
{
|
{
|
||||||
MD5_CTX ctx;
|
EVP_MD_CTX *mdctx;
|
||||||
cl_platform_id pid;
|
cl_platform_id pid;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
MD5_Init(&ctx);
|
mdctx = EVP_MD_CTX_create();
|
||||||
|
EVP_DigestInit_ex(mdctx, EVP_md5(), NULL);
|
||||||
pid = vg_ocl_device_getplatform(vocp->voc_ocldid);
|
pid = vg_ocl_device_getplatform(vocp->voc_ocldid);
|
||||||
str = vg_ocl_platform_getstr(pid, CL_PLATFORM_NAME);
|
str = vg_ocl_platform_getstr(pid, CL_PLATFORM_NAME);
|
||||||
MD5_Update(&ctx, str, strlen(str) + 1);
|
EVP_DigestUpdate(mdctx, str, strlen(str) + 1);
|
||||||
str = vg_ocl_platform_getstr(pid, CL_PLATFORM_VERSION);
|
str = vg_ocl_platform_getstr(pid, CL_PLATFORM_VERSION);
|
||||||
MD5_Update(&ctx, str, strlen(str) + 1);
|
EVP_DigestUpdate(mdctx, str, strlen(str) + 1);
|
||||||
str = vg_ocl_device_getstr(vocp->voc_ocldid, CL_DEVICE_NAME);
|
str = vg_ocl_device_getstr(vocp->voc_ocldid, CL_DEVICE_NAME);
|
||||||
MD5_Update(&ctx, str, strlen(str) + 1);
|
EVP_DigestUpdate(mdctx, str, strlen(str) + 1);
|
||||||
if (opts)
|
if (opts)
|
||||||
MD5_Update(&ctx, opts, strlen(opts) + 1);
|
EVP_DigestUpdate(mdctx, opts, strlen(opts) + 1);
|
||||||
if (size)
|
if (size)
|
||||||
MD5_Update(&ctx, program, size);
|
EVP_DigestUpdate(mdctx, program, size);
|
||||||
MD5_Final(hash_out, &ctx);
|
EVP_DigestFinal_ex(mdctx, hash_out, NULL);
|
||||||
|
EVP_MD_CTX_destroy(mdctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user