diff options
| author | tb <> | 2023-12-15 13:33:10 +0000 |
|---|---|---|
| committer | tb <> | 2023-12-15 13:33:10 +0000 |
| commit | 91f0929d2c7ad1ec24ae9123ef2be5e7c5787ac1 (patch) | |
| tree | e0584621de6e2cb27a3101e4eb6ac7acf12dc8c1 /src | |
| parent | dc811119bba0ac592a81d974de7ca51069887396 (diff) | |
| download | openbsd-91f0929d2c7ad1ec24ae9123ef2be5e7c5787ac1.tar.gz openbsd-91f0929d2c7ad1ec24ae9123ef2be5e7c5787ac1.tar.bz2 openbsd-91f0929d2c7ad1ec24ae9123ef2be5e7c5787ac1.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.c | 14 |
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 | */ | ||
| 249 | int | 261 | int |
| 250 | EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, | 262 | EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, |
| 251 | unsigned int inl) | 263 | unsigned int inl) |
