diff options
author | jsing <> | 2018-02-17 16:54:08 +0000 |
---|---|---|
committer | jsing <> | 2018-02-17 16:54:08 +0000 |
commit | c65f1d5336d2fc48bd39e9eec37ea975c4b3d24d (patch) | |
tree | 7564c54622d8d908f7d60ba66b30da981d656c6e | |
parent | d8ed1c903e9bcc095d51f3a1d640a1acc258eba0 (diff) | |
download | openbsd-c65f1d5336d2fc48bd39e9eec37ea975c4b3d24d.tar.gz openbsd-c65f1d5336d2fc48bd39e9eec37ea975c4b3d24d.tar.bz2 openbsd-c65f1d5336d2fc48bd39e9eec37ea975c4b3d24d.zip |
Provide EVP_CIPHER_CTX_reset().
Rides previous minor bump.
-rw-r--r-- | src/lib/libcrypto/Symbols.list | 1 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/evp.h | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/evp_enc.c | 42 |
3 files changed, 28 insertions, 18 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index 85c65a8ca8..aeafb88492 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
@@ -1216,6 +1216,7 @@ EVP_CIPHER_CTX_key_length | |||
1216 | EVP_CIPHER_CTX_new | 1216 | EVP_CIPHER_CTX_new |
1217 | EVP_CIPHER_CTX_nid | 1217 | EVP_CIPHER_CTX_nid |
1218 | EVP_CIPHER_CTX_rand_key | 1218 | EVP_CIPHER_CTX_rand_key |
1219 | EVP_CIPHER_CTX_reset | ||
1219 | EVP_CIPHER_CTX_set_app_data | 1220 | EVP_CIPHER_CTX_set_app_data |
1220 | EVP_CIPHER_CTX_set_flags | 1221 | EVP_CIPHER_CTX_set_flags |
1221 | EVP_CIPHER_CTX_set_key_length | 1222 | EVP_CIPHER_CTX_set_key_length |
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index 148e15274f..aec6fa4249 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp.h,v 1.56 2018/02/17 14:55:31 jsing Exp $ */ | 1 | /* $OpenBSD: evp.h,v 1.57 2018/02/17 16:54:08 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -644,6 +644,7 @@ void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); | |||
644 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | 644 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); |
645 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); | 645 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); |
646 | void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a); | 646 | void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a); |
647 | int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *a); | ||
647 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); | 648 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); |
648 | int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); | 649 | int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); |
649 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); | 650 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); |
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index 1b1e9da901..de7c690ca7 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_enc.c,v 1.37 2017/11/28 06:55:49 tb Exp $ */ | 1 | /* $OpenBSD: evp_enc.c,v 1.38 2018/02/17 16:54:08 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -75,18 +75,6 @@ | |||
75 | 75 | ||
76 | #define M_do_cipher(ctx, out, in, inl) ctx->cipher->do_cipher(ctx, out, in, inl) | 76 | #define M_do_cipher(ctx, out, in, inl) ctx->cipher->do_cipher(ctx, out, in, inl) |
77 | 77 | ||
78 | void | ||
79 | EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) | ||
80 | { | ||
81 | memset(ctx, 0, sizeof(EVP_CIPHER_CTX)); | ||
82 | } | ||
83 | |||
84 | EVP_CIPHER_CTX * | ||
85 | EVP_CIPHER_CTX_new(void) | ||
86 | { | ||
87 | return calloc(1, sizeof(EVP_CIPHER_CTX)); | ||
88 | } | ||
89 | |||
90 | int | 78 | int |
91 | EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | 79 | EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
92 | const unsigned char *key, const unsigned char *iv, int enc) | 80 | 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) | |||
548 | return (1); | 536 | return (1); |
549 | } | 537 | } |
550 | 538 | ||
539 | EVP_CIPHER_CTX * | ||
540 | EVP_CIPHER_CTX_new(void) | ||
541 | { | ||
542 | return calloc(1, sizeof(EVP_CIPHER_CTX)); | ||
543 | } | ||
544 | |||
551 | void | 545 | void |
552 | EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) | 546 | EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) |
553 | { | 547 | { |
554 | if (ctx) { | 548 | if (ctx == NULL) |
555 | EVP_CIPHER_CTX_cleanup(ctx); | 549 | return; |
556 | free(ctx); | 550 | |
557 | } | 551 | EVP_CIPHER_CTX_cleanup(ctx); |
552 | |||
553 | free(ctx); | ||
554 | } | ||
555 | |||
556 | void | ||
557 | EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) | ||
558 | { | ||
559 | memset(ctx, 0, sizeof(EVP_CIPHER_CTX)); | ||
560 | } | ||
561 | |||
562 | int | ||
563 | EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *a) | ||
564 | { | ||
565 | return EVP_CIPHER_CTX_cleanup(a); | ||
558 | } | 566 | } |
559 | 567 | ||
560 | int | 568 | int |