Skip to content

Commit

Permalink
don't crash if no keyed checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoward committed Dec 17, 2015
1 parent dfba8b4 commit 3548924
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/krb5/crypto.c
Expand Up @@ -2115,13 +2115,18 @@ krb5_crypto_length(krb5_context context,
*len = 0;
return 0;
case KRB5_CRYPTO_TYPE_TRAILER:
*len = CHECKSUMSIZE(crypto->et->keyed_checksum);
if (crypto->et->flags & F_AEAD)
*len = crypto->et->blocksize;
else
*len = CHECKSUMSIZE(crypto->et->keyed_checksum);
return 0;
case KRB5_CRYPTO_TYPE_CHECKSUM:
if (crypto->et->keyed_checksum)
*len = CHECKSUMSIZE(crypto->et->keyed_checksum);
else
else if (crypto->et->checksum)
*len = CHECKSUMSIZE(crypto->et->checksum);
else
return KRB5_PROG_SUMTYPE_NOSUPP;
return 0;
}
krb5_set_error_message(context, EINVAL,
Expand Down

0 comments on commit 3548924

Please sign in to comment.