OLD | NEW |
1 /* crypto/evp/bio_enc.c */ | 1 /* crypto/evp/bio_enc.c */ |
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 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 BIO_copy_next_retry(b); | 354 BIO_copy_next_retry(b); |
355 break; | 355 break; |
356 case BIO_C_GET_CIPHER_CTX: | 356 case BIO_C_GET_CIPHER_CTX: |
357 c_ctx=(EVP_CIPHER_CTX **)ptr; | 357 c_ctx=(EVP_CIPHER_CTX **)ptr; |
358 (*c_ctx)= &(ctx->cipher); | 358 (*c_ctx)= &(ctx->cipher); |
359 b->init=1; | 359 b->init=1; |
360 break; | 360 break; |
361 case BIO_CTRL_DUP: | 361 case BIO_CTRL_DUP: |
362 dbio=(BIO *)ptr; | 362 dbio=(BIO *)ptr; |
363 dctx=(BIO_ENC_CTX *)dbio->ptr; | 363 dctx=(BIO_ENC_CTX *)dbio->ptr; |
364 » » memcpy(&(dctx->cipher),&(ctx->cipher),sizeof(ctx->cipher)); | 364 » » EVP_CIPHER_CTX_init(&dctx->cipher); |
365 » » dbio->init=1; | 365 » » ret = EVP_CIPHER_CTX_copy(&dctx->cipher,&ctx->cipher); |
| 366 » » if (ret) |
| 367 » » » dbio->init=1; |
366 break; | 368 break; |
367 default: | 369 default: |
368 ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 370 ret=BIO_ctrl(b->next_bio,cmd,num,ptr); |
369 break; | 371 break; |
370 } | 372 } |
371 return(ret); | 373 return(ret); |
372 } | 374 } |
373 | 375 |
374 static long enc_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) | 376 static long enc_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) |
375 { | 377 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 return; | 419 return; |
418 | 420 |
419 b->init=1; | 421 b->init=1; |
420 ctx=(BIO_ENC_CTX *)b->ptr; | 422 ctx=(BIO_ENC_CTX *)b->ptr; |
421 EVP_CipherInit_ex(&(ctx->cipher),c,NULL, k,i,e); | 423 EVP_CipherInit_ex(&(ctx->cipher),c,NULL, k,i,e); |
422 | 424 |
423 if (b->callback != NULL) | 425 if (b->callback != NULL) |
424 b->callback(b,BIO_CB_CTRL,(const char *)c,BIO_CTRL_SET,e,1L); | 426 b->callback(b,BIO_CB_CTRL,(const char *)c,BIO_CTRL_SET,e,1L); |
425 } | 427 } |
426 | 428 |
OLD | NEW |