int ret;
ckmc_cert_list_s *start = NULL;
ckmc_cert_list_s *plist = NULL;
- CKM::CertificateShPtrVector::const_iterator it;
- for(it = certVector.begin(); it != certVector.end(); it++) {
- CKM::RawBuffer rawBuffer = (*it)->getDER();
+ for(const auto &e : certVector) {
+ CKM::RawBuffer rawBuffer = e->getDER();
ckmc_cert_s *pcert = NULL;
ret = ckmc_cert_new(rawBuffer.data(), rawBuffer.size(), CKMC_FORM_DER, &pcert);
if(pcert == NULL) {
return CKMC_ERROR_INVALID_PARAMETER;
}
- int ret = CKMC_ERROR_UNKNOWN;
int tmpOcspStatus = -1;
CKM::ManagerShPtr mgr = CKM::Manager::create();
CKM::CertificateShPtrVector ckmCertChain = _toCkmCertificateVector(pcert_chain_list);
- ret = mgr->ocspCheck(ckmCertChain, tmpOcspStatus);
+ int ret = mgr->ocspCheck(ckmCertChain, tmpOcspStatus);
*ocsp_status = to_ckmc_ocsp_status(tmpOcspStatus);
return to_ckmc_error(ret);
}
{
ckmc_key_s *pkey;
- if(raw_key == NULL || key_size <= 0 || ppkey == NULL) {
+ if(raw_key == NULL || key_size == 0 || ppkey == NULL) {
return CKMC_ERROR_INVALID_PARAMETER;
}
{
ckmc_raw_buffer_s *pbuff;
- if(data == NULL || size <= 0 || ppbuffer == NULL) {
+ if(data == NULL || size == 0 || ppbuffer == NULL) {
return CKMC_ERROR_INVALID_PARAMETER;
}
{
ckmc_cert_s *pcert;
- if(raw_cert == NULL || cert_size <= 0 || ppcert == NULL) {
+ if(raw_cert == NULL || cert_size == 0 || ppcert == NULL) {
return CKMC_ERROR_INVALID_PARAMETER;
}
LogWarning("Not finalized");
ThrowMsg(Exception::NotFinalized, "Not finalized");
}
- BUF_MEM *bptr = 0;
+ BUF_MEM *bptr = nullptr;
BIO_get_mem_ptr(m_b64, &bptr);
- if (bptr == 0) {
+ if (!bptr) {
LogError("Bio internal error");
ThrowMsg(Exception::InternalError, "Bio internal error");
}
RawBuffer asymmetricHelper(int (*cryptoFn)(int, const unsigned char*, unsigned char*, RSA*, int),
- const std::string logPrefix,
+ const std::string &logPrefix,
const EvpShPtr &pkey,
const CryptoAlgorithm &alg,
const RawBuffer &data)
{
validateParams<IsSignVerify>(alg);
- int rsa_padding = NOT_DEFINED;
- const EVP_MD *md_algo = NULL;
-
HashAlgorithm hashTmp = HashAlgorithm::NONE;
alg.getParam(ParamName::SV_HASH_ALGO, hashTmp);
- md_algo = getMdAlgo(hashTmp);
+ const EVP_MD *md_algo = getMdAlgo(hashTmp);
RSAPaddingAlgorithm rsaPad = RSAPaddingAlgorithm::NONE;
alg.getParam(ParamName::SV_RSA_PADDING, rsaPad);
- rsa_padding = getRsaPadding(rsaPad);
+ int rsa_padding = getRsaPadding(rsaPad);
//
// if((privateKey.getType() != KeyType::KEY_RSA_PRIVATE) &&
int tmpDataType = 0;
Name name;
Label label, accessorLabel;
- std::string user;
buffer.Deserialize(command);
buffer.Deserialize(msgID);
ASN1_GENERALIZEDTIME *nextupd = NULL;
int use_ssl = 0;
int ocspStatus = -1;
- int i = 0 ,tmpIdx = 0;
+ int i = 0;
long nsec = MAX_VALIDITY_PERIOD, maxage = -1;
char subj_buf[256];
int reason = 0;
if(trustedCerts != NULL) {
trustedStore = X509_STORE_new();
- for(tmpIdx=0; tmpIdx<sk_X509_num(trustedCerts); tmpIdx++) {
+ for(int tmpIdx=0; tmpIdx<sk_X509_num(trustedCerts); tmpIdx++) {
X509_STORE_add_cert(trustedStore, sk_X509_value(trustedCerts, tmpIdx));
}
X509_STORE_add_cert(trustedStore, issuer);
class MathHandler : public XML::Parser::ElementHandler
{
public:
- MathHandler() : m_valueSet(false), m_powerFactor(1) {}
+ MathHandler() : m_valueSet(false), m_value(0), m_powerFactor(1) {}
virtual void Start(const XML::Parser::Attributes &attr) {
const auto & it = attr.find("powerFactor");
// simple input arg parser
for (int i=1; i<argc-1; i++)
{
- long int uid;
if(!strcmp(argv[i], "-d"))
{
+ long int uid;
if(parseLong(argv[i+1], uid) || uid<0) {
cerr << "parameter error: invalid UID provided to the -d option" << endl;
exit(-2);