/*
- * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2000-2019 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Flora License, Version 1.1 (the License);
* you may not use this file except in compliance with the License.
};
-int __initialized = _UNINITIALIZED;
-
-void __init_crypto()
-{
- if (__initialized != _INITIALIZED) {
- ERR_load_crypto_strings();
- OpenSSL_add_all_algorithms();
- __initialized = _INITIALIZED;
- }
-}
-
int __get_random_bytes(char *output, int random_len)
{
FILE *fp = fopen("/dev/urandom", "r");
{
int ret = DRMTEST_SUCCESS;
DH *pDH = NULL;
+ BIGNUM *p = NULL, *g = NULL;
if ((pDH = DH_new()) == NULL) {
printf("...FAIL: DH_new() error");
goto error;
}
- BN_hex2bn(&(pDH->p), dh_key_p_hex);
- BN_hex2bn(&(pDH->g), dh_key_g_hex);
+ BN_hex2bn(&p, dh_key_p_hex);
+ BN_hex2bn(&g, dh_key_g_hex);
+ DH_set0_pqg(pDH, p, nullptr, g);
/* Set a to run with normal modexp and b to use constant time */
- pDH->flags &= ~DH_FLAG_NO_EXP_CONSTTIME;
+ DH_clear_flags(pDH, DH_FLAG_NO_EXP_CONSTTIME);
// Generate DH Key
if (!DH_generate_key(pDH)) {
int _get_dh_hex_pubkey(const DH *pkey, char **dh_pubkey)
{
- *dh_pubkey = BN_bn2hex(pkey->pub_key);
+ *dh_pubkey = BN_bn2hex(DH_get0_pub_key(pkey));
return DRMTEST_SUCCESS;
}