Skip to content

Commit

Permalink
Fix crash when an unsupported cipher is configured.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Jul 5, 2013
1 parent 3f64380 commit 9a1817b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/filed/crypto.c
Expand Up @@ -68,6 +68,10 @@ bool crypto_session_start(JCR *jcr)

/** Create per-job session encryption context */
jcr->crypto.pki_session = crypto_session_new(cipher, jcr->crypto.pki_recipients);
if (!jcr->crypto.pki_session) {
Jmsg(jcr, M_FATAL, 0, _("Cannot create a new crypto session probably unsupported cipher configured.\n"));
return false;
}

/** Get the session data size */
if (!crypto_session_encode(jcr->crypto.pki_session, (uint8_t *)0, &size)) {
Expand All @@ -90,6 +94,7 @@ bool crypto_session_start(JCR *jcr)
/** Allocate the encryption/decryption buffer */
jcr->crypto.crypto_buf = get_memory(CRYPTO_CIPHER_MAX_BLOCK_SIZE);
}

return true;
}

Expand Down

0 comments on commit 9a1817b

Please sign in to comment.