Fix whitespace errors

This commit is contained in:
Christian Hohnstaedt 2023-12-30 11:01:11 +01:00
parent b9622f8a15
commit 0c1c00962f
23 changed files with 67 additions and 70 deletions

View File

@ -141,4 +141,3 @@ void pk11_attlist::reset()
attlen = 0;
}

View File

@ -61,7 +61,7 @@ void pki_key::autoIntName(const QString &file)
void pki_key::d2i(QByteArray &ba)
{
EVP_PKEY *k = (EVP_PKEY*)d2i_bytearray(D2I_VOID(d2i_PUBKEY), ba);
pki_openssl_error();
pki_openssl_error();
if (k) {
if (key)
EVP_PKEY_free(key);
@ -75,19 +75,19 @@ void pki_key::d2i_old(QByteArray &ba, int type)
p = p1 = (const unsigned char *)ba.constData();
EVP_PKEY *k = d2i_PublicKey(type, NULL, &p1, ba.size());
pki_openssl_error();
pki_openssl_error();
if (k) {
if (key)
EVP_PKEY_free(key);
key = k;
}
ba = ba.mid(p1-p);
ba = ba.mid(p1-p);
}
QByteArray pki_key::i2d() const
{
return i2d_bytearray(I2D_VOID(i2d_PUBKEY), key);
return i2d_bytearray(I2D_VOID(i2d_PUBKEY), key);
}
void pki_key::write_SSH2_ed25519_private(BIO *b,

View File

@ -122,7 +122,7 @@ class pki_lookup
void flush()
{
qDeleteAll(lookup);
lookup.clear();
lookup.clear();
}
};
#endif

View File

@ -63,7 +63,7 @@ void pki_pkcs7::signBio(pki_x509 *crt, BIO *bio)
signer = NULL;
while (signer != NULL ) {
sk_X509_push(certstack, signer->getCert());
openssl_error();
openssl_error();
if (signer == signer->getSigner() )
signer = NULL;
else
@ -91,7 +91,7 @@ void pki_pkcs7::signCert(pki_x509 *crt, pki_x509 *contCert)
BioByteArray bba;
i2d_X509_bio(bba, contCert->getCert());
signBio(crt, bba);
openssl_error();
openssl_error();
}
void pki_pkcs7::writeP7(XFile &file, bool PEM)
@ -122,7 +122,7 @@ void pki_pkcs7::append_certs(PKCS7 *myp7, const QString &name)
pki_openssl_error();
if (myp7 == NULL)
if (myp7 == NULL)
return;
setFilename(name);

View File

@ -302,7 +302,7 @@ static QString old_eKeyUse2QString(int old)
{
QStringList sl;
for (int i = 0; i < extkeyuse_nid.size(); i++) {
for (int i = 0; i < extkeyuse_nid.size(); i++) {
if (old & (1<<i)) {
sl << OBJ_nid2sn(extkeyuse_nid[i]);
}
@ -431,7 +431,7 @@ void pki_temp::writeTemp(XFile &file) const
void pki_temp::writeDefault(const QString &dirname) const
{
XFile file(get_dump_filename(dirname, ".xca"));
file.open_write();
file.open_write();
writeTemp(file);
}
@ -490,7 +490,7 @@ void pki_temp::fromPEM_BIO(BIO *bio, const QString &name)
QByteArray ba;
QString msg;
char *nm = NULL, *header = NULL;
unsigned char *data = NULL;
unsigned char *data = NULL;
long len;
PEM_read_bio(bio, &nm, &header, &data, &len);

View File

@ -190,8 +190,7 @@ pki_x509 *pki_x509::findIssuer()
pki_x509 *an_issuer = Store.lookupPki<pki_x509>(q.value(0));
qDebug() << "Possibvle Issuer of" << *this << *an_issuer << an_issuer->getNotAfter();
if (!an_issuer) {
qDebug("Certificate with id %d not found",
q.value(0).toInt());
qDebug("Certificate with id %d not found", q.value(0).toInt());
continue;
}
if (verify_only(an_issuer)) {
@ -331,7 +330,7 @@ void pki_x509::load_token(pkcs11 &p11, CK_OBJECT_HANDLE object)
void pki_x509::d2i(QByteArray &ba)
{
X509 *c = (X509*)d2i_bytearray(D2I_VOID(d2i_X509), ba);
X509 *c = (X509*)d2i_bytearray(D2I_VOID(d2i_X509), ba);
if (c) {
X509_free(cert);
cert = c;
@ -418,10 +417,10 @@ void pki_x509::deleteFromToken()
pk11_attlist pki_x509::objectAttributes()
{
pk11_attlist attrs;
attrs <<
pk11_attr_ulong(CKA_CLASS, CKO_CERTIFICATE) <<
pk11_attr_ulong(CKA_CERTIFICATE_TYPE, CKC_X_509) <<
pk11_attr_data(CKA_VALUE, i2d());
attrs <<
pk11_attr_ulong(CKA_CLASS, CKO_CERTIFICATE) <<
pk11_attr_ulong(CKA_CERTIFICATE_TYPE, CKC_X_509) <<
pk11_attr_data(CKA_VALUE, i2d());
return attrs;
}
@ -461,7 +460,7 @@ int pki_x509::renameOnToken(const slotid &slot, const QString &name)
pk11_attr_data label(CKA_LABEL, name.toUtf8());
tkInfo ti = p11.tokenInfo();
if (p11.tokenLogin(ti.label(), false).isNull())
return 0;
return 0;
p11.storeAttribute(label, objs[0]);
return 1;
}

View File

@ -303,7 +303,7 @@ QString pki_x509req::getAttribute(int nid) const
count = X509_ATTRIBUTE_count(att);
for (int j = 0; j < count; j++)
ret << asn1ToQString(X509_ATTRIBUTE_get0_type(att, j)->
value.asn1_string);
value.asn1_string);
return ret.join(", ");
}

View File

@ -258,7 +258,7 @@ bool x509revList::sqlUpdate(QVariant caId)
return false;
}
merged = false;
merged = false;
TransCommit();
return true;
}

View File

@ -226,7 +226,7 @@ static const char *asn1Type2Name(int type)
{
#define ASN1_GEN_STR(x,y) { x,y }
struct {
const char *strnam;
const char *strnam;
int tag;
} tags[] = {
ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
@ -332,10 +332,10 @@ genName2conf(GENERAL_NAME *gen, QString tag, QString *single, QString *sect)
arg(p[0]).arg(p[1]).arg(p[2]).arg(p[3]);
return true;
} else if(gen->d.ip->length == 8) {
*single = QString("IP:%1.%2.%3.%4/%5.%6.%7.%8").
arg(p[0]).arg(p[1]).arg(p[2]).arg(p[3]).
arg(p[4]).arg(p[5]).arg(p[6]).arg(p[7]);
return true;
*single = QString("IP:%1.%2.%3.%4/%5.%6.%7.%8").
arg(p[0]).arg(p[1]).arg(p[2]).arg(p[3]).
arg(p[4]).arg(p[5]).arg(p[6]).arg(p[7]);
return true;
} else if(gen->d.ip->length == 16) {
*single = "IP:" + ipv6_from_binary(gen->d.ip->data);
return true;
@ -482,7 +482,7 @@ bool x509v3ext::parse_ainfo(QString *single, QString *adv) const
{
bool retval = true;
QString sect, ret;
QString tag = OBJ_nid2sn(nid());
QString tag = OBJ_nid2sn(nid());
QStringList sl;
int i;
@ -632,11 +632,11 @@ static void gen_cpol_notice(QString tag, USERNOTICE *notice, QString *adv)
QStringList sl;
int i;
*adv += QString("organization=%1\n").
arg(asn1ToQString(ref->organization, true));
arg(asn1ToQString(ref->organization, true));
for (i = 0; i < sk_ASN1_INTEGER_num(ref->noticenos); i++) {
a1int num(sk_ASN1_INTEGER_value(ref->noticenos, i));
sl << num.toDec();
}
}
if (sl.size())
*adv += QString("noticeNumbers=%1\n").
arg(sl.join(", "));
@ -661,7 +661,7 @@ static bool gen_cpol_qual_sect(QString tag, POLICYINFO *pinfo, QString *adv)
for (i = 0; i < sk_POLICYQUALINFO_num(quals); i++) {
POLICYQUALINFO *qualinfo = sk_POLICYQUALINFO_value(quals, i);
switch (OBJ_obj2nid(qualinfo->pqualid)) {
switch (OBJ_obj2nid(qualinfo->pqualid)) {
case NID_id_qt_cps:
polsect += QString("CPS.%1=%2\n").arg(i).
arg(asn1ToQString(qualinfo->d.cpsuri, true));
@ -778,7 +778,7 @@ bool x509v3ext::parse_bitstring(QString *single, QString *adv) const
else if (adv)
*adv = QString("%1=%2\n").arg(OBJ_nid2sn(nid())).arg(ret) +*adv;
ASN1_BIT_STRING_free(bs);
return true;
return true;
}
bool x509v3ext::parse_sKeyId(QString *, QString *adv) const

View File

@ -191,7 +191,7 @@ void CertTreeView::caProperties()
pki_temp *templ = Store.lookupPki<pki_temp>(tmplId);
ui.temp->insertPkiItems(Store.getAll<pki_temp>());
ui.temp->setNullItem(tr("No template"));
ui.temp->setNullItem(tr("No template"));
ui.temp->setCurrentIndex(0);
if (templ)
ui.temp->setCurrentPkiItem(templ);
@ -201,9 +201,9 @@ void CertTreeView::caProperties()
if (dlg->exec()) {
templ = ui.temp->currentPkiItem();
tmplId = templ ? templ->getSqlItemId() : QVariant();
tmplId = templ ? templ->getSqlItemId() : QVariant();
cert->setTemplateSqlId(tmplId);
cert->setCrlDays(ui.days->value());
cert->setCrlDays(ui.days->value());
certs()->updateCaProperties(cert);
columnsChanged();
@ -242,5 +242,5 @@ ExportDialog *CertTreeView::exportDialog(const QModelIndexList &indexes)
tr("X509 Certificates ( *.pem *.cer *.crt *.p12 *.pfx *.p7b )"),
indexes, QPixmap(":certImg"),
pki_export::select(x509, basemodel->exportFlags(indexes)),
"certexport");
"certexport");
}

View File

@ -183,7 +183,7 @@ void KeyTreeView::toToken()
}
} catch (errorEx &err) {
XCA_ERROR(err);
}
}
delete card;
}

View File

@ -98,7 +98,7 @@ void MainWindow::init_menu()
update_history_menu();
connect(historyMenu, SIGNAL(triggered(QAction*)),
this, SLOT(open_database(QAction*)));
this, SLOT(open_database(QAction*)));
file = menuBar()->addMenu(tr("&File"));

View File

@ -299,7 +299,7 @@ void MainWindow::initToken()
p11.initToken(slot, pin.constUchar(), pin.size(), label);
} catch (errorEx &err) {
XCA_ERROR(err);
}
}
}
void MainWindow::changePin(bool so)
@ -315,7 +315,7 @@ void MainWindow::changePin(bool so)
p11.changePin(slot, so);
} catch (errorEx &err) {
XCA_ERROR(err);
}
}
}
void MainWindow::changeSoPin()
@ -336,7 +336,7 @@ void MainWindow::initPin()
p11.initPin(slot);
} catch (errorEx &err) {
XCA_ERROR(err);
}
}
}
@ -406,7 +406,7 @@ void MainWindow::manageToken()
}
} catch (errorEx &err) {
XCA_ERROR(err);
}
}
delete card;
delete cert;
delete dlgi;

View File

@ -40,12 +40,11 @@ class tipMenu : public QMenu
tipMenu(QString n, QWidget *w) : QMenu(n, w) {}
bool event (QEvent * e)
{
if (e->type() == QEvent::ToolTip && activeAction() &&
activeAction()->toolTip() != activeAction()->text()) {
const QHelpEvent *helpEvent = static_cast <QHelpEvent *>(e);
QToolTip::showText(helpEvent->globalPos(),
activeAction()->toolTip());
if (e->type() == QEvent::ToolTip && activeAction() &&
activeAction()->toolTip() != activeAction()->text()) {
const QHelpEvent *helpEvent = static_cast <QHelpEvent *>(e);
QToolTip::showText(helpEvent->globalPos(),
activeAction()->toolTip());
} else {
QToolTip::hideText();
}

View File

@ -92,7 +92,7 @@ QList<nameEdit> NewX509::setupExplicitInputs(NIDlist nid_list,
}
label->setClickText(OBJ_nid2sn(nid));
connect(label, SIGNAL(doubleClicked(QString)),
MainWindow::getResolver(), SLOT(searchOid(QString)));
MainWindow::getResolver(), SLOT(searchOid(QString)));
edit = new QLineEdit(parent);
setupLineEditByNid(nid, edit);
edits << nameEdit(nid, edit, label);
@ -133,15 +133,15 @@ NewX509::NewX509(QWidget *w) : XcaDetail(w)
extDNlist->setInfoLabel(extDNinfo);
connect(extDNlist->itemDelegateForColumn(1),
SIGNAL(setupLineEdit(const QString &, QLineEdit *)),
this, SLOT(setupExtDNwidget(const QString &, QLineEdit *)));
this, SLOT(setupExtDNwidget(const QString &, QLineEdit *)));
connect(subAltName, SIGNAL(textChanged(const QString &)),
this, SLOT(checkSubAltName(const QString &)));
this, SLOT(checkSubAltName(const QString &)));
connect(issAltName, SIGNAL(textChanged(const QString &)),
this, SLOT(checkIssAltName(const QString &)));
this, SLOT(checkIssAltName(const QString &)));
connect(crlDist, SIGNAL(textChanged(const QString &)),
this, SLOT(checkCrlDist(const QString &)));
this, SLOT(checkCrlDist(const QString &)));
connect(authInfAcc, SIGNAL(textChanged(const QString &)),
this, SLOT(checkAuthInfAcc(const QString &)));
this, SLOT(checkAuthInfAcc(const QString &)));
if (keymodel)
connect(keymodel, SIGNAL(keyDone(pki_key*)),
this, SLOT(newKeyDone(pki_key*)));
@ -237,7 +237,7 @@ NewX509::NewX509(QWidget *w) : XcaDetail(w)
QString tt = w->toolTip();
if (Settings["translate_dn"])
text.swap(tooltip);
text.swap(tooltip);
if (!tt.isEmpty())
tooltip = QString("%1 (%2)").arg(tt).arg(tooltip);
@ -1071,7 +1071,7 @@ int NewX509::validateExtensions(QString nconf, QString &result)
el.clear();
if (fromReqCB->isChecked() && copyReqExtCB->isChecked()) {
req_el = getSelectedReq()->getV3ext();
for (int i=0; i<req_el.count(); i++) {
for (int i=0; i<req_el.count(); i++) {
if (ctx_cert && ctx_cert->addV3ext(req_el[i], true))
el += req_el[i];
}
@ -1317,7 +1317,7 @@ void NewX509::accept()
reject();
}
return;
}
}
if (hashAlgo->count() > 0 && hashAlgo->current().isInsecure()) {
gotoTab(0);
xcaWarningBox msg(this, tr("The currently selected hash algorithm '%1' is insecure and should not be used.").arg(hashAlgo->current().name()));

View File

@ -297,6 +297,6 @@ extList NewX509::getExtDuplicates()
}
}
}
}
return el_dup;
}

View File

@ -40,6 +40,6 @@ class PwDialog: public QDialog, public Ui::PwDialog
class PwDialogUI: public PwDialogUI_i
{
enum open_result execute(pass_info *p, Passwd *passwd,
bool write = false, bool abort = false);
bool write = false, bool abort = false);
};
#endif

View File

@ -131,7 +131,7 @@ const x509revList &RevocationList::getRevList()
void RevocationList::on_addRev_clicked()
{
Revocation *revoke = new Revocation(QModelIndexList(), this);
if (revoke->exec()) {
if (revoke->exec()) {
x509rev revit = revoke->getRevocation();
revList << revit;
addRevItem(certList, revit, revList.size(), issuer);
@ -150,8 +150,8 @@ void RevocationList::on_delRev_clicked()
certList->takeTopLevelItem(idx);
rev.setSerial(a1int(current->text(Cserial)));
idx = revList.indexOf(rev);
if (idx != -1)
revList.takeAt(idx);
if (idx != -1)
revList.takeAt(idx);
}
void RevocationList::on_editRev_clicked()
@ -169,14 +169,14 @@ void RevocationList::on_certList_itemDoubleClicked(QTreeWidgetItem *current)
rev.setSerial(a1int(current->text(Cserial)));
idx = revList.indexOf(rev);
if (idx == -1)
if (idx == -1)
return;
rev = revList[idx];
Revocation *revoke = new Revocation(QModelIndexList(), this);
revoke->setRevocation(rev);
if (revoke->exec()) {
if (revoke->exec()) {
a1time a1 = rev.getDate();
rev = revoke->getRevocation();
rev.setDate(a1);

View File

@ -125,5 +125,5 @@ ExportDialog *TempTreeView::exportDialog(const QModelIndexList &indexes)
tr("XCA Templates ( *.xca )"),
indexes, QPixmap(":tempImg"),
pki_export::select(tmpl, basemodel->exportFlags(indexes)),
"templateexport");
"templateexport");
}

View File

@ -49,7 +49,7 @@ bool XcaProxyModel::lessThan(const QModelIndex &left,
}
bool XcaProxyModel::filterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent) const
const QModelIndex &sourceParent) const
{
if (!sourceModel())
return false;

View File

@ -460,7 +460,7 @@ void XcaTreeView::contextMenu(QContextMenuEvent *e, QMenu *parent, int col)
}
if (!shown)
allHeaders[0]->show = true;
delete menu;
delete menu;
delete parent;
showHideSections();
}

View File

@ -109,7 +109,7 @@ public:
}
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role) const;
int role) const;
bool insertRows(int row, int count,
const QModelIndex &parent = QModelIndex());
bool removeRows(int row, int count,

View File

@ -82,7 +82,7 @@ void v3ext::setupLineEdit(const QString &s, QLineEdit *l)
} else if (s == "URI") {
tt = tr("A uniform resource indicator");
QRegularExpression rx("[a-z][a-z0-9\\.\\+\\-]*://.*");
v = new QRegularExpressionValidator(rx, this);
v = new QRegularExpressionValidator(rx, this);
} else if (s == "DNS") {
if (nid == NID_subject_alt_name)
tt = tr("A DNS domain name or 'copycn'");
@ -100,7 +100,7 @@ void v3ext::setupLineEdit(const QString &s, QLineEdit *l)
l->setText(QString("copy"));
l->setReadOnly(true);
QRegularExpression rx("copy");
v = new QRegularExpressionValidator(rx, this);
v = new QRegularExpressionValidator(rx, this);
}
l->setToolTip(tt);
l->setValidator(v);