aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-09-01 14:32:26 +0200
committerDaniel P. Berrangé <berrange@redhat.com>2023-11-07 14:54:56 +0000
commite158f8e92df5782f41b61adb6fa43bed70879f7f (patch)
tree9e7c2bbff8e83059c7015285151debe544674c58 /crypto
parent462ad017ed76889d46696a3581e1b52343f9b683 (diff)
downloadqemu-e158f8e92df5782f41b61adb6fa43bed70879f7f.zip
qemu-e158f8e92df5782f41b61adb6fa43bed70879f7f.tar.gz
qemu-e158f8e92df5782f41b61adb6fa43bed70879f7f.tar.bz2
crypto/rsakey-builtin.c.inc: Clean up two error paths
When qcrypto_builtin_rsa_public_key_parse() is about to fail, but no error has been set, it makes one up. Actually, there's just one way to fail without setting an error. Set it there instead. Same for qcrypto_builtin_rsa_private_key_parse(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/rsakey-builtin.c.inc8
1 files changed, 2 insertions, 6 deletions
diff --git a/crypto/rsakey-builtin.c.inc b/crypto/rsakey-builtin.c.inc
index aeeacc8..46cc7af 100644
--- a/crypto/rsakey-builtin.c.inc
+++ b/crypto/rsakey-builtin.c.inc
@@ -88,15 +88,13 @@ static QCryptoAkCipherRSAKey *qcrypto_builtin_rsa_public_key_parse(
goto error;
}
if (seq_length != 0) {
+ error_setg(errp, "Invalid RSA public key");
goto error;
}
return rsa;
error:
- if (errp && !*errp) {
- error_setg(errp, "Invalid RSA public key");
- }
qcrypto_akcipher_rsakey_free(rsa);
return NULL;
}
@@ -169,15 +167,13 @@ static QCryptoAkCipherRSAKey *qcrypto_builtin_rsa_private_key_parse(
return rsa;
}
if (seq_length != 0) {
+ error_setg(errp, "Invalid RSA private key");
goto error;
}
return rsa;
error:
- if (errp && !*errp) {
- error_setg(errp, "Invalid RSA private key");
- }
qcrypto_akcipher_rsakey_free(rsa);
return NULL;
}