summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-12-15 13:33:10 +0000
committertb <>2023-12-15 13:33:10 +0000
commit150cb2d757cac1a44068bbda820f9aefd1c67494 (patch)
treee0584621de6e2cb27a3101e4eb6ac7acf12dc8c1 /src
parent21316bd190bc144c08df39f1ffe220ce6e2aa856 (diff)
downloadopenbsd-150cb2d757cac1a44068bbda820f9aefd1c67494.tar.gz
openbsd-150cb2d757cac1a44068bbda820f9aefd1c67494.tar.bz2
openbsd-150cb2d757cac1a44068bbda820f9aefd1c67494.zip
Document EVP_Cipher() in code
EVP_Cipher() is an implementation detail of EVP_Cipher{Update,Final}(). Behavior depends on EVP_CIPH_FLAG_CUSTOM_CIPHER being set on ctx->cipher. If the flag is set, do_cipher() operates in update mode if in != NULL and in final mode if in == NULL. It returns the number of bytes written to out (which may be 0) or -1 on error. If the flag is not set, do_cipher() assumes properly aligned data and that padding is handled correctly by the caller. Most do_cipher() methods will silently produce garbage and succeed. Returns 1 on success, 0 on error. ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/evp/evp_enc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c
index 4c00b0ee0a..e8944dc9a4 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.59 2023/12/15 13:28:30 tb Exp $ */ 1/* $OpenBSD: evp_enc.c,v 1.60 2023/12/15 13:33:10 tb 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 *
@@ -246,6 +246,18 @@ EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
246 return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 0); 246 return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 0);
247} 247}
248 248
249/*
250 * EVP_Cipher() is an implementation detail of EVP_Cipher{Update,Final}().
251 * Behavior depends on EVP_CIPH_FLAG_CUSTOM_CIPHER being set on ctx->cipher.
252 *
253 * If the flag is set, do_cipher() operates in update mode if in != NULL and
254 * in final mode if in == NULL. It returns the number of bytes written to out
255 * (which may be 0) or -1 on error.
256 *
257 * If the flag is not set, do_cipher() assumes properly aligned data and that
258 * padding is handled correctly by the caller. Most do_cipher() methods will
259 * silently produce garbage and succeed. Returns 1 on success, 0 on error.
260 */
249int 261int
250EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, 262EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in,
251 unsigned int inl) 263 unsigned int inl)