diff options
author | Graham Leggett <minfrin@apache.org> | 2019-06-10 21:05:45 +0000 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2019-06-10 21:05:45 +0000 |
commit | ce175a3b1dedc6fc104b4e1cef4db8cedc6fbfa6 (patch) | |
tree | cd2f1659675ea30456a507fda6589f9d37e4aaa8 /include/private | |
parent | 01efe754afc08798211e5dccbc07966a3d9a04fd (diff) | |
download | apr-ce175a3b1dedc6fc104b4e1cef4db8cedc6fbfa6.tar.gz |
apr_crypto_prng: Move openssl specific code into apr_crypto_openssl.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1860984 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/private')
-rw-r--r-- | include/private/apr_crypto_internal.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/private/apr_crypto_internal.h b/include/private/apr_crypto_internal.h index b73477a3e..f300caae5 100644 --- a/include/private/apr_crypto_internal.h +++ b/include/private/apr_crypto_internal.h @@ -27,6 +27,16 @@ extern "C" { #if APU_HAVE_CRYPTO +/** + * Structure representing the streaming context for the CPRNG. + */ +typedef struct cprng_stream_ctx_t cprng_stream_ctx_t; + +/** + * Key size for the CPRNG. + */ +#define CPRNG_KEY_SIZE 32 + struct apr_crypto_driver_t { /** name */ @@ -363,6 +373,33 @@ struct apr_crypto_driver_t { apr_status_t (*key)(apr_crypto_key_t **key, const apr_crypto_key_rec_t *rec, const apr_crypto_t *f, apr_pool_t *p); + /** + * @brief Create the context for encrypting the CPRNG stream. + * @param pctx The pointer where the context will be returned. + * @param f The crypto context to use. + * @param cipher The cipher to use. + * @param pool The pool to use. + */ + apr_status_t (*cprng_stream_ctx_make)(cprng_stream_ctx_t **pctx, apr_crypto_t *f, + apr_crypto_cipher_e cipher, apr_pool_t *pool); + + /** + * @brief Free the context for encrypting the CPRNG stream. + * @param ctx The context to free. + */ + void (*cprng_stream_ctx_free)(cprng_stream_ctx_t *ctx); + + /** + * @brief Return further encrypted bytes, rekeying as necessary. + * @param pctx The context. + * @param key The key to use while rekeying. + * @param to Encrypted bytes are written here. + * @param n Length of encrypted bytes. + * @param z The IV to use. + */ + apr_status_t (*cprng_stream_ctx_bytes)(cprng_stream_ctx_t **pctx, unsigned char *key, + unsigned char *to, apr_size_t n, const unsigned char *z); + }; #if APU_HAVE_OPENSSL |