>>The man pages says  for EncryptInit "It is possible to set all parameters 
>>to NULL except type in an initial call and supply the remaining parameters 
>>in subsequent calls, all of which have type set to NULL.  This is done 
>>when the default cipher parameters are not appropriate."
>>
>>Does that mean you should call EncryptInit with a null IV, then again with 
>>a IV? Or can you just set the ctx->iv value directly?
>>
>
>You should avoid accessing structure elements where possible.
>
>You can call EncryptInit with a null key and IV and later set them but
>you don't have to. This is normally done so that additional calls such
>as changing the key length in variable ciphers can be made.

What are the functions to set the IV ? I see that there are
EVP_CIPHER_CTX_set_key_length() and some others function . Would it be
proper to add a function EVP_CIPHER_CTX_set_iv() ?

the pseudo code I would then have is

after key exchange:
        ...
        EVP_CIPHER_CTX  g_ctx; // only one ctx for this example
        ...
        ...
        EVP_EncryptInit(&myctx,EVP_des_cbc(),key,NULL);
        ...
        ...


per packet function:
        ...
        get_iv_from_packet(packet,myiv);
        ...
        EVP_CIPHER_CTX_set_iv(g_ctx,myiv);
        ...
        EVP_EncryptUpdate(g_ctx,.........);
        EVP_EncryptFinal(g_ctx,........);





>>Also is it possible to copy the CTX variable after it has been init'ed and 
>>use a copy of it with calls to EncryptUpdate, EncryptFinal?
>
>
>Possible yes, but it may cause problems in future versions of OpenSSL
>where the EVP_CIPHER_CTX structure is no longer "flat" and which may use 
>crypto hardware.
>
>In future some kind of EVP_CIPHER_CTX_copy() function will be used to do 
>this portably.
>
>Steve.


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to