Bacula Encryption Update: Crypto API and Message Digest Refactor

22 Aug 2005, 21:31 PDT

In the interest of providing visibility into my on-going work, I will be posting regular snapshots of my encryption support diffs, along with some hopefully understandable explanations.

To get the project started, I've modified the OpenSSL autoconf macros to define an additional preprocessor directive, HAVE_CRYPTO. In conjunction with this, I've started implementing the abstract cryptography API in src/lib/crypto.c. As with the TLS implementation, I am attempting to abstract the details of OpenSSL from the rest of the Bacula codebase.

One of the first steps necessary to implement signed message digests is a refactoring of the digest code used by the file daemon. I've created a new digest API in src/lib/crypto.c, and updated all clients of the previous digest API. The new implementation supports MD5 and SHA-1 hashes for both basic digests and signing. If OpenSSL 0.9.8 is available, SHA-512 is used for signed digests.

Additionally, I've migrated the OpenSSL initialization code to crypto.c, and added code for reading -- and signing with -- PEM-encoded x509 certificates and RSA and DSA private keys. I've also added encryption configuration options to the various daemons.

If you would like to take a look at the current patchset in all its glory, you can find it here: bacula-crypto-1.diff.gz

The next task on my list is storage of signed message digests and per-session symmetric keys in both the catalog and volume. I will be out on holiday next week, but I hope to have another patchset available shortly after I return.