Commit 60bc3826 authored by Geoff Simmons's avatar Geoff Simmons

Get rid of cipher_ctx_reset() (apparently not needed).

parent abdca673
...@@ -150,21 +150,6 @@ derive_prenonce(unsigned char *prk, unsigned char *prenonce, char *errmsg) ...@@ -150,21 +150,6 @@ derive_prenonce(unsigned char *prk, unsigned char *prenonce, char *errmsg)
return 0; return 0;
} }
static EVP_CIPHER_CTX *
cipher_ctx_params(EVP_CIPHER_CTX *ctx, int enc, char *errmsg)
{
AN(ctx);
AN(errmsg);
(void)EVP_CIPHER_CTX_set_padding(ctx, 0);
if (EVP_CipherInit_ex(ctx, EVP_aes_128_gcm(), NULL, NULL, NULL, enc)
!= 1) {
mk_error(errmsg);
return (NULL);
}
return ctx;
}
EVP_CIPHER_CTX * EVP_CIPHER_CTX *
cipher_ctx_init(int enc, char *errmsg) cipher_ctx_init(int enc, char *errmsg)
{ {
...@@ -176,20 +161,15 @@ cipher_ctx_init(int enc, char *errmsg) ...@@ -176,20 +161,15 @@ cipher_ctx_init(int enc, char *errmsg)
mk_error(errmsg); mk_error(errmsg);
return (NULL); return (NULL);
} }
return cipher_ctx_params(ctx, enc, errmsg);
}
EVP_CIPHER_CTX * (void)EVP_CIPHER_CTX_set_padding(ctx, 0);
cipher_ctx_reset(EVP_CIPHER_CTX *ctx, int enc, char *errmsg)
{
AN(ctx);
AN(errmsg);
if (EVP_CIPHER_CTX_reset(ctx) != 1) { if (EVP_CipherInit_ex(ctx, EVP_aes_128_gcm(), NULL, NULL, NULL, enc)
!= 1) {
mk_error(errmsg); mk_error(errmsg);
return (NULL); return (NULL);
} }
return cipher_ctx_params(ctx, enc, errmsg); return ctx;
} }
ssize_t ssize_t
......
...@@ -114,15 +114,6 @@ int derive_prenonce(unsigned char prk[SHA256_LEN], ...@@ -114,15 +114,6 @@ int derive_prenonce(unsigned char prk[SHA256_LEN],
*/ */
EVP_CIPHER_CTX * cipher_ctx_init(int enc, char errmsg[ERRMSG_LEN]); EVP_CIPHER_CTX * cipher_ctx_init(int enc, char errmsg[ERRMSG_LEN]);
/*
* Returns ctx reset for en-/decrypting a new record. ctx MUST have been
* previously initialized with cipher_ctx_init().
*
* Returns NULL on failure.
*/
EVP_CIPHER_CTX * cipher_ctx_reset(EVP_CIPHER_CTX *ctx, int enc,
char errmsg[ERRMSG_LEN]);
/* Finalize an EVP_CIPHER_CTX. */ /* Finalize an EVP_CIPHER_CTX. */
static inline void static inline void
cipher_ctx_fini(EVP_CIPHER_CTX *ctx) cipher_ctx_fini(EVP_CIPHER_CTX *ctx)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment