summaryrefslogtreecommitdiff
path: root/lib/libcrypto/evp
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2018-02-17 16:54:09 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2018-02-17 16:54:09 +0000
commit9694251f1cdf7ad63f8e56ab03744f1b3818ef67 (patch)
tree96a2b1e550d92cddf463ca50be546bca02c780e2 /lib/libcrypto/evp
parentb55b5369df17254364597ea3759cfa2749679234 (diff)
Provide EVP_CIPHER_CTX_reset().
Rides previous minor bump.
Diffstat (limited to 'lib/libcrypto/evp')
-rw-r--r--lib/libcrypto/evp/evp.h3
-rw-r--r--lib/libcrypto/evp/evp_enc.c42
2 files changed, 27 insertions, 18 deletions
diff --git a/lib/libcrypto/evp/evp.h b/lib/libcrypto/evp/evp.h
index 148e15274f3..aec6fa4249a 100644
--- a/lib/libcrypto/evp/evp.h
+++ b/lib/libcrypto/evp/evp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: evp.h,v 1.56 2018/02/17 14:55:31 jsing Exp $ */
+/* $OpenBSD: evp.h,v 1.57 2018/02/17 16:54:08 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -644,6 +644,7 @@ void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a);
+int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *a);
int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);
int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);
int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
diff --git a/lib/libcrypto/evp/evp_enc.c b/lib/libcrypto/evp/evp_enc.c
index 1b1e9da9011..de7c690ca79 100644
--- a/lib/libcrypto/evp/evp_enc.c
+++ b/lib/libcrypto/evp/evp_enc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: evp_enc.c,v 1.37 2017/11/28 06:55:49 tb Exp $ */
+/* $OpenBSD: evp_enc.c,v 1.38 2018/02/17 16:54:08 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -75,18 +75,6 @@
#define M_do_cipher(ctx, out, in, inl) ctx->cipher->do_cipher(ctx, out, in, inl)
-void
-EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
-{
- memset(ctx, 0, sizeof(EVP_CIPHER_CTX));
-}
-
-EVP_CIPHER_CTX *
-EVP_CIPHER_CTX_new(void)
-{
- return calloc(1, sizeof(EVP_CIPHER_CTX));
-}
-
int
EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv, int enc)
@@ -548,13 +536,33 @@ EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
return (1);
}
+EVP_CIPHER_CTX *
+EVP_CIPHER_CTX_new(void)
+{
+ return calloc(1, sizeof(EVP_CIPHER_CTX));
+}
+
void
EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
{
- if (ctx) {
- EVP_CIPHER_CTX_cleanup(ctx);
- free(ctx);
- }
+ if (ctx == NULL)
+ return;
+
+ EVP_CIPHER_CTX_cleanup(ctx);
+
+ free(ctx);
+}
+
+void
+EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
+{
+ memset(ctx, 0, sizeof(EVP_CIPHER_CTX));
+}
+
+int
+EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *a)
+{
+ return EVP_CIPHER_CTX_cleanup(a);
}
int