From a65aa31183bbb0775fa2d760943510ce6a2a7d4e Mon Sep 17 00:00:00 2001 From: John Kohl Date: Mon, 29 Jan 1990 14:47:57 +0000 Subject: [PATCH] add roundup, encrypt_size, keyblock_size git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@175 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/krb5/encryption.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/include/krb5/encryption.h b/src/include/krb5/encryption.h index 7ffb99133..1f0774ad7 100644 --- a/src/include/krb5/encryption.h +++ b/src/include/krb5/encryption.h @@ -98,4 +98,15 @@ typedef struct _krb5_checksum_entry { #define ETYPE_IS_LOCAL(etype) (etype & 0x8000) #define CKSUMTYPE_IS_LOCAL(cksumtype) (cksumtype & 0x8000) +#ifndef krb5_roundup +/* round x up to nearest multiple of y */ +#define krb5_roundup(x, y) ((((x) + (y) - 1)/(y))*(y)) +#endif /* roundup */ + +/* macro function definitions to help clean up code */ +#define krb5_encrypt_size(length, crypto) \ + krb5_roundup((length)+(crypto)->pad_minimum, (crypto)->block_length) + +#define krb5_keyblock_size(blockp) (sizeof(*blockp)+blockp->length-1) + #endif /* __KRB5_ENCRYPTION__ */ -- 2.26.2