Skip to content

Commit

Permalink
cryptocipher: allow setIV to set only the cipher length
Browse files Browse the repository at this point in the history
  • Loading branch information
gganis committed Dec 21, 2018
1 parent 5e7a5e6 commit c42212e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/XrdCrypto/XrdCryptoCipher.cc
Expand Up @@ -58,7 +58,7 @@ bool XrdCryptoCipher::IsValid()
//____________________________________________________________________________
void XrdCryptoCipher::SetIV(int l, const char *iv)
{
// Set IV from l bytes at iv
// Set IV from l bytes at iv. If !iv, sets the IV length.

ABSTRACTMETHOD("XrdCryptoCipher::SetIV");
}
Expand Down
14 changes: 7 additions & 7 deletions src/XrdCrypto/XrdCryptosslCipher.cc
Expand Up @@ -963,20 +963,20 @@ XrdSutBucket *XrdCryptosslCipher::AsBucket()
//____________________________________________________________________________
void XrdCryptosslCipher::SetIV(int l, const char *iv)
{
// Set IV from l bytes at iv
// Set IV from l bytes at iv. If !iv, sets the IV length.

if (fIV) {
delete[] fIV;
fIV = 0;
lIV = 0;
}

if (iv && l > 0) {
fIV = new char[l];
if (fIV) {
memcpy(fIV,iv,l);
lIV = l;
if (l > 0) {
if (iv) {
fIV = new char[l];
if (fIV) memcpy(fIV,iv,l);
}
lIV = l;
}
}

Expand Down Expand Up @@ -1127,5 +1127,5 @@ int XrdCryptosslCipher::MaxIVLength() const
{
// Return the max cipher IV length

return EVP_MAX_IV_LENGTH;
return (lIV > 0) ? lIV : EVP_MAX_IV_LENGTH;
}

0 comments on commit c42212e

Please sign in to comment.