* must define "OCStackResult res" for setting error code.
* */
#define PM_VERIFY_SUCCESS(tag, op, errCode, logLevel) { if (!(op)) \
- {OC_LOG((logLevel), tag, #op " failed!!"); res = errCode; goto bail;} }
+ {OIC_LOG((logLevel), tag, #op " failed!!"); res = errCode; goto bail;} }
/**
* @def PM_VERIFY_NON_NULL
* @brief Macro to verify argument is not equal to NULL.
* @note Invoking function must define "bail:" label for goto functionality to work correctly.
* */
#define PM_VERIFY_NON_NULL(tag, arg, errCode, logLevel) { if (NULL == (arg)) \
- { OC_LOG((logLevel), tag, #arg " is NULL"); res = errCode; goto bail;} }
+ { OIC_LOG((logLevel), tag, #arg " is NULL"); res = errCode; goto bail;} }
OCStackResult PMGeneratePairWiseCredentials(OicSecCredType_t type, size_t keySize,
const OicUuid_t *ptDeviceId,
if (NULL == ptDeviceId || NULL == firstDeviceId || NULL != *firstCred || \
NULL == secondDeviceId || NULL != *secondCred)
{
- OC_LOG(INFO, TAG, "Invalid params");
+ OIC_LOG(INFO, TAG, "Invalid params");
return OC_STACK_INVALID_PARAM;
}
if(!(keySize == OWNER_PSK_LENGTH_128 || keySize == OWNER_PSK_LENGTH_256))
{
- OC_LOG(INFO, TAG, "Invalid key size");
+ OIC_LOG(INFO, TAG, "Invalid key size");
return OC_STACK_INVALID_PARAM;
}
OCStackResult res = OC_STACK_ERROR;
{
if (NULL == certificateChain || chainLength == 0)
{
- OC_LOG(ERROR, TAG, "Error CreateCertificatePublicJWK: Invalid params");
+ OIC_LOG(ERROR, TAG, "Error CreateCertificatePublicJWK: Invalid params");
return NULL;
}
}
else
{
- OC_LOG(ERROR, TAG, "Error CreateCertificatePublicJWK: Invalid params");
+ OIC_LOG(ERROR, TAG, "Error CreateCertificatePublicJWK: Invalid params");
return NULL;
}
}
else
{
- OC_LOG(ERROR, TAG, "Error while memory allocation");
+ OIC_LOG(ERROR, TAG, "Error while memory allocation");
}
return certPubJWK;
}
{
if (NULL == privateKey)
{
- OC_LOG(ERROR, TAG, "Error privateKey is NULL");
+ OIC_LOG(ERROR, TAG, "Error privateKey is NULL");
return NULL;
}
const char firstPart[] = "{\"kty\":\"EC\",\"crv\":\"P-256\",\"d\":\"";
}
else
{
- OC_LOG(ERROR, TAG, "Error while memory allocation");
+ OIC_LOG(ERROR, TAG, "Error while memory allocation");
}
return certPrivJWK;
}
if (PKI_SUCCESS != GenerateKeyPair(&privKeyBA, &pubKeyBA))
{
- OC_LOG(ERROR, TAG, "Error generating keys.");
+ OIC_LOG(ERROR, TAG, "Error generating keys.");
return OC_STACK_ERROR;
}
if (PKI_SUCCESS != CKMIssueDeviceCertificate(subjName, NULL, NULL, pubKeyBA.data, cert))
{
- OC_LOG(ERROR, TAG, "Error generating certificate.");
+ OIC_LOG(ERROR, TAG, "Error generating certificate.");
return OC_STACK_ERROR;
}
if (B64_OK != b64Encode(privKeyBA.data, privKeyBA.len, privB64buf,
B64ENCODE_OUT_SAFESIZE(PRIVATE_KEY_SIZE) + 1, &privB64len))
{
- OC_LOG(ERROR, TAG, "Error while encoding key");
+ OIC_LOG(ERROR, TAG, "Error while encoding key");
return OC_STACK_ERROR;
}
if (PKI_SUCCESS != GetCAChain(chainLength , cert + 1))
{
- OC_LOG(ERROR, TAG, "Error getting CA certificate chain.");
+ OIC_LOG(ERROR, TAG, "Error getting CA certificate chain.");
return OC_STACK_ERROR;
}
if (B64_OK != b64Encode(cert[i].data, cert[i].len, certB64buf,
B64ENCODE_OUT_SAFESIZE(ISSUER_MAX_CERT_SIZE) + 1, &certB64len))
{
- OC_LOG(ERROR, TAG, "Error while encoding certificate");
+ OIC_LOG(ERROR, TAG, "Error while encoding certificate");
ret = OC_STACK_ERROR;
goto memclean;
}
*chainLength = 0;
if (OC_STACK_NO_MEMORY == ret)
{
- OC_LOG(ERROR, TAG, "Error while memory allocation");
+ OIC_LOG(ERROR, TAG, "Error while memory allocation");
}
return ret;
}
if (OC_STACK_OK != GenerateCertificateAndKeys(deviceId, &certificateChain,
&certChainLen, &privKey))
{
- OC_LOG(ERROR, TAG, "Error while generating credential data.");
+ OIC_LOG(ERROR, TAG, "Error while generating credential data.");
return OC_STACK_ERROR;
}
{
OICFree(publicJWK);
OICFree(privateJWK);
- OC_LOG(ERROR, TAG, "Error while converting keys to JWK format.");
+ OIC_LOG(ERROR, TAG, "Error while converting keys to JWK format.");
return OC_STACK_ERROR;
}
OICFree(privateJWK);
if (NULL == tempCred)
{
- OC_LOG(ERROR, TAG, "Error while generating credential.");
+ OIC_LOG(ERROR, TAG, "Error while generating credential.");
return OC_STACK_ERROR;
}
*cred = tempCred;