Skip to content

Commit

Permalink
fix: cieengin.c: fix openssl compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
M0Rf30 committed Jun 16, 2024
1 parent c2140e5 commit be6a300
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions libs/sign-sdk/src/CIEEngine.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "CIEEngineHelper.h"

unsigned char *cie_certificate;
const unsigned char *cie_certificate;
unsigned long cie_certlen;
unsigned char *cie_pin;
unsigned long cie_pinlen;
Expand Down Expand Up @@ -53,8 +53,9 @@ static const ENGINE_CMD_DEFN cie_engine_cmd_defns[] = {
{0, NULL, NULL, 0}};

// Make Digest Info
int makeDigestInfo(int algid, unsigned char *pbtDigest, size_t btDigestLen,
unsigned char *pbtDigestInfo, size_t *pbtDigestInfoLen) {
int makeDigestInfo(int algid, const unsigned char *pbtDigest,
size_t btDigestLen, unsigned char *pbtDigestInfo,
size_t *pbtDigestInfoLen) {
size_t requestedLen;
switch (algid) {
case NID_sha1:
Expand Down Expand Up @@ -202,7 +203,7 @@ static int cie_pkey_rsa_sign(EVP_PKEY_CTX *evp_pkey_ctx, unsigned char *sig,
printf("call cie_pkey_rsa_sign\n");

EVP_PKEY *pkey;
RSA *rsa;
const RSA *rsa;
const EVP_MD *sig_md;

printf(
Expand Down Expand Up @@ -308,14 +309,16 @@ EC_KEY_METHOD *cie_get_ec_key_method(void) {
int (*orig_sign)(int, const unsigned char *, int, unsigned char *,
unsigned int *, const BIGNUM *, const BIGNUM *, EC_KEY *) =
NULL;
ECDSA_SIG *(*do_sign)(const unsigned char *, int, const BIGNUM *,
const BIGNUM *, EC_KEY *) = NULL;

compute_key_fn ossl_ecdh_compute_key;

// alloc_ec_ex_index();
if (!ops) {
ops = EC_KEY_METHOD_new((EC_KEY_METHOD *)EC_KEY_OpenSSL());
EC_KEY_METHOD_get_sign(ops, &orig_sign, NULL, NULL);
EC_KEY_METHOD_set_sign(ops, orig_sign, NULL, &orig_sign);
EC_KEY_METHOD_set_sign(ops, orig_sign, NULL, do_sign);
EC_KEY_METHOD_get_compute_key(ops, &ossl_ecdh_compute_key);
EC_KEY_METHOD_set_compute_key(ops, cie_ecdh_compute_key);

Expand Down

0 comments on commit be6a300

Please sign in to comment.