support passing in NULL as the cipher_state/ivec
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12453 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -181,12 +181,14 @@ krb5_c_decrypt(krb5_context context,
|
||||
{
|
||||
krb5_error_code ret;
|
||||
krb5_crypto crypto;
|
||||
size_t blocksize;
|
||||
|
||||
ret = krb5_crypto_init(context, &key, input->enctype, &crypto);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (ivec) {
|
||||
size_t blocksize;
|
||||
|
||||
ret = krb5_crypto_getblocksize(context, crypto, &blocksize);
|
||||
if (ret) {
|
||||
krb5_crypto_destroy(context, crypto);
|
||||
@@ -197,10 +199,12 @@ krb5_c_decrypt(krb5_context context,
|
||||
krb5_crypto_destroy(context, crypto);
|
||||
return EINVAL; /* XXX */
|
||||
}
|
||||
}
|
||||
|
||||
ret = krb5_decrypt_ivec(context, crypto, usage,
|
||||
input->ciphertext.data, input->ciphertext.length,
|
||||
output, ivec->data);
|
||||
output,
|
||||
ivec ? ivec->data : NULL);
|
||||
|
||||
krb5_crypto_destroy(context, crypto);
|
||||
|
||||
@@ -217,12 +221,14 @@ krb5_c_encrypt(krb5_context context,
|
||||
{
|
||||
krb5_error_code ret;
|
||||
krb5_crypto crypto;
|
||||
size_t blocksize;
|
||||
|
||||
ret = krb5_crypto_init(context, key, 0, &crypto);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (ivec) {
|
||||
size_t blocksize;
|
||||
|
||||
ret = krb5_crypto_getblocksize(context, crypto, &blocksize);
|
||||
if (ret) {
|
||||
krb5_crypto_destroy(context, crypto);
|
||||
@@ -233,10 +239,12 @@ krb5_c_encrypt(krb5_context context,
|
||||
krb5_crypto_destroy(context, crypto);
|
||||
return EINVAL; /* XXX */
|
||||
}
|
||||
}
|
||||
|
||||
ret = krb5_encrypt_ivec(context, crypto, usage,
|
||||
input->data, input->length,
|
||||
&output->ciphertext, ivec->data);
|
||||
&output->ciphertext,
|
||||
ivec ? ivec->data : NULL);
|
||||
output->kvno = 0;
|
||||
krb5_crypto_getenctype(context, crypto, &output->enctype);
|
||||
|
||||
|
Reference in New Issue
Block a user