Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions source/jst_functions.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/jst_functions.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID Detected License Issue

Snippet with 'Apache-2.0' file license found (606 lines) Location: source/jst_functions.c (link unavailable) Component: rdk/components/generic/jst/rdk/components/generic/jst@rdk-dev-2101 Download: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/jst/+archive/rdk-dev-2101.tar.gz
following copyright and licenses apply:

Copyright 2018 RDK Management
Expand Down Expand Up @@ -500,7 +500,8 @@
char* token;
char* sig2verify;
char* alg;

duk_size_t sig2verify_len =0;

BIO* bio = NULL;
X509* cert = NULL;
EVP_PKEY * key = NULL;
Expand All @@ -517,6 +518,11 @@
RETURN_FALSE;
}

/* Use duk_get_lstring to get the true binary length of the signature.
* strlen() would truncate at the first null byte, which is almost always
* present in a raw RSA signature, causing EVP_VerifyFinal to fail. */
sig2verify = duk_get_lstring(ctx, 2, &sig2verify_len);

//open certificate file
if(memcmp(filepath, "file://", sizeof("file://")-1) != 0)
{
Expand Down Expand Up @@ -573,19 +579,20 @@
RETURN_FALSE;
}


if(EVP_VerifyInit (md_ctx, mdtype))
{
if(EVP_VerifyUpdate (md_ctx, token, strlen(token)))
{
err = EVP_VerifyFinal(md_ctx, (unsigned char *)sig2verify, (unsigned int)strlen(sig2verify), key);
if(err < 0)
err = EVP_VerifyFinal(md_ctx, (unsigned char *)sig2verify, (unsigned int)sig2verify_len, key);
if(err == 1)
{
CosaPhpExtLog("openssl_verify_with_cert: EVP_VerifyFinal failed error:%d\n", err);
ok = 1;
CosaPhpExtLog("openssl_verify_with_cert: EVP_VerifyFinal success\n");
}
else
{
ok = 1;
CosaPhpExtLog("openssl_verify_with_cert: EVP_VerifyFinal success\n");
CosaPhpExtLog("openssl_verify_with_cert: EVP_VerifyFinal failed error:%d\n", err);
}
Comment thread
ashutoshharry marked this conversation as resolved.
}
else
Expand Down
Loading