summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-12-20 14:13:07 +0000
committertb <>2023-12-20 14:13:07 +0000
commitd3fcaa162cb88112f0549f75c28cc3465f0a2592 (patch)
tree6d3621cd2e0b14b6816c8e4b97170dac07fd5650 /src
parentcbe4260b8ca7744bd3b905002278099bf5e9cc0a (diff)
downloadopenbsd-d3fcaa162cb88112f0549f75c28cc3465f0a2592.tar.gz
openbsd-d3fcaa162cb88112f0549f75c28cc3465f0a2592.tar.bz2
openbsd-d3fcaa162cb88112f0549f75c28cc3465f0a2592.zip
Rename outl into out_len throughout the file
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/evp/evp_enc.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c
index b993c1b82f..b7cba33aa1 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.70 2023/12/20 14:11:41 tb Exp $ */ 1/* $OpenBSD: evp_enc.c,v 1.71 2023/12/20 14:13:07 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 *
@@ -193,31 +193,31 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
193} 193}
194 194
195int 195int
196EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 196EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len,
197 const unsigned char *in, int inl) 197 const unsigned char *in, int inl)
198{ 198{
199 if (ctx->encrypt) 199 if (ctx->encrypt)
200 return EVP_EncryptUpdate(ctx, out, outl, in, inl); 200 return EVP_EncryptUpdate(ctx, out, out_len, in, inl);
201 201
202 return EVP_DecryptUpdate(ctx, out, outl, in, inl); 202 return EVP_DecryptUpdate(ctx, out, out_len, in, inl);
203} 203}
204 204
205int 205int
206EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 206EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
207{ 207{
208 if (ctx->encrypt) 208 if (ctx->encrypt)
209 return EVP_EncryptFinal_ex(ctx, out, outl); 209 return EVP_EncryptFinal_ex(ctx, out, out_len);
210 210
211 return EVP_DecryptFinal_ex(ctx, out, outl); 211 return EVP_DecryptFinal_ex(ctx, out, out_len);
212} 212}
213 213
214int 214int
215EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 215EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
216{ 216{
217 if (ctx->encrypt) 217 if (ctx->encrypt)
218 return EVP_EncryptFinal_ex(ctx, out, outl); 218 return EVP_EncryptFinal_ex(ctx, out, out_len);
219 219
220 return EVP_DecryptFinal_ex(ctx, out, outl); 220 return EVP_DecryptFinal_ex(ctx, out, out_len);
221} 221}
222 222
223int 223int
@@ -295,7 +295,7 @@ evp_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len,
295} 295}
296 296
297int 297int
298EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 298EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len,
299 const unsigned char *in, int inl) 299 const unsigned char *in, int inl)
300{ 300{
301 const int block_size = ctx->cipher->block_size; 301 const int block_size = ctx->cipher->block_size;
@@ -303,7 +303,7 @@ EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
303 int partial_len = ctx->partial_len; 303 int partial_len = ctx->partial_len;
304 int len = 0, total_len = 0; 304 int len = 0, total_len = 0;
305 305
306 *outl = 0; 306 *out_len = 0;
307 307
308 if ((block_size & block_mask) != 0) 308 if ((block_size & block_mask) != 0)
309 return 0; 309 return 0;
@@ -315,10 +315,10 @@ EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
315 return 1; 315 return 1;
316 316
317 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0) 317 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0)
318 return evp_cipher(ctx, out, outl, in, inl); 318 return evp_cipher(ctx, out, out_len, in, inl);
319 319
320 if (partial_len == 0 && (inl & block_mask) == 0) 320 if (partial_len == 0 && (inl & block_mask) == 0)
321 return evp_cipher(ctx, out, outl, in, inl); 321 return evp_cipher(ctx, out, out_len, in, inl);
322 322
323 /* XXX - check that block_size > partial_len. */ 323 /* XXX - check that block_size > partial_len. */
324 if (block_size > sizeof(ctx->buf)) { 324 if (block_size > sizeof(ctx->buf)) {
@@ -373,28 +373,28 @@ EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
373 memcpy(ctx->buf, &in[inl], partial_len); 373 memcpy(ctx->buf, &in[inl], partial_len);
374 ctx->partial_len = partial_len; 374 ctx->partial_len = partial_len;
375 375
376 *outl = total_len; 376 *out_len = total_len;
377 377
378 return 1; 378 return 1;
379} 379}
380 380
381int 381int
382EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 382EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
383{ 383{
384 return EVP_EncryptFinal_ex(ctx, out, outl); 384 return EVP_EncryptFinal_ex(ctx, out, out_len);
385} 385}
386 386
387int 387int
388EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 388EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
389{ 389{
390 const int block_size = ctx->cipher->block_size; 390 const int block_size = ctx->cipher->block_size;
391 int partial_len = ctx->partial_len; 391 int partial_len = ctx->partial_len;
392 int pad; 392 int pad;
393 393
394 *outl = 0; 394 *out_len = 0;
395 395
396 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0) 396 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0)
397 return evp_cipher(ctx, out, outl, NULL, 0); 397 return evp_cipher(ctx, out, out_len, NULL, 0);
398 398
399 /* XXX - check that block_size > partial_len. */ 399 /* XXX - check that block_size > partial_len. */
400 if (block_size > sizeof(ctx->buf)) { 400 if (block_size > sizeof(ctx->buf)) {
@@ -415,18 +415,18 @@ EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
415 pad = block_size - partial_len; 415 pad = block_size - partial_len;
416 memset(&ctx->buf[partial_len], pad, pad); 416 memset(&ctx->buf[partial_len], pad, pad);
417 417
418 return evp_cipher(ctx, out, outl, ctx->buf, block_size); 418 return evp_cipher(ctx, out, out_len, ctx->buf, block_size);
419} 419}
420 420
421int 421int
422EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 422EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len,
423 const unsigned char *in, int inl) 423 const unsigned char *in, int inl)
424{ 424{
425 const int block_size = ctx->cipher->block_size; 425 const int block_size = ctx->cipher->block_size;
426 const int block_mask = block_size - 1; 426 const int block_mask = block_size - 1;
427 int len = 0, total_len = 0; 427 int len = 0, total_len = 0;
428 428
429 *outl = 0; 429 *out_len = 0;
430 430
431 if ((block_size & block_mask) != 0) 431 if ((block_size & block_mask) != 0)
432 return 0; 432 return 0;
@@ -438,10 +438,10 @@ EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
438 return 1; 438 return 1;
439 439
440 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0) 440 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0)
441 return evp_cipher(ctx, out, outl, in, inl); 441 return evp_cipher(ctx, out, out_len, in, inl);
442 442
443 if ((ctx->flags & EVP_CIPH_NO_PADDING) != 0) 443 if ((ctx->flags & EVP_CIPH_NO_PADDING) != 0)
444 return EVP_EncryptUpdate(ctx, out, outl, in, inl); 444 return EVP_EncryptUpdate(ctx, out, out_len, in, inl);
445 445
446 if (block_size > sizeof(ctx->final)) { 446 if (block_size > sizeof(ctx->final)) {
447 EVPerror(EVP_R_BAD_BLOCK_LENGTH); 447 EVPerror(EVP_R_BAD_BLOCK_LENGTH);
@@ -482,28 +482,28 @@ EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
482 return 0; 482 return 0;
483 total_len += len; 483 total_len += len;
484 484
485 *outl = total_len; 485 *out_len = total_len;
486 486
487 return 1; 487 return 1;
488} 488}
489 489
490int 490int
491EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 491EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
492{ 492{
493 return EVP_DecryptFinal_ex(ctx, out, outl); 493 return EVP_DecryptFinal_ex(ctx, out, out_len);
494} 494}
495 495
496int 496int
497EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 497EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
498{ 498{
499 const int block_size = ctx->cipher->block_size; 499 const int block_size = ctx->cipher->block_size;
500 int partial_len = ctx->partial_len; 500 int partial_len = ctx->partial_len;
501 int i, pad, plain_len; 501 int i, pad, plain_len;
502 502
503 *outl = 0; 503 *out_len = 0;
504 504
505 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0) 505 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0)
506 return evp_cipher(ctx, out, outl, NULL, 0); 506 return evp_cipher(ctx, out, out_len, NULL, 0);
507 507
508 if ((ctx->flags & EVP_CIPH_NO_PADDING) != 0) { 508 if ((ctx->flags & EVP_CIPH_NO_PADDING) != 0) {
509 if (partial_len != 0) { 509 if (partial_len != 0) {
@@ -540,7 +540,7 @@ EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
540 } 540 }
541 541
542 memcpy(out, ctx->final, plain_len); 542 memcpy(out, ctx->final, plain_len);
543 *outl = plain_len; 543 *out_len = plain_len;
544 544
545 return 1; 545 return 1;
546} 546}