Skip to content

Commit

Permalink
slighty less bogus overloading of encrypt callback
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoward committed Dec 17, 2015
1 parent 2ff90ac commit b36bab6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
16 changes: 8 additions & 8 deletions lib/krb5/crypto-aead.c
Expand Up @@ -78,10 +78,10 @@ _krb5_evp_cipher_aead(krb5_context context,
c = encryptp ? &ctx->ectx : &ctx->dctx;

/* Set IV and (if decrypting) tag */
ret = (*et->encrypt)(context, dkey,
encryptp ? NULL : tiv->data.data,
encryptp ? 0 : tiv->data.length,
encryptp, 0, ivec);
ret = (*et->aead_control)(context, dkey,
encryptp ? NULL : tiv->data.data,
encryptp ? 0 : tiv->data.length,
encryptp, 0, ivec);
if (ret)
return ret;

Expand Down Expand Up @@ -114,10 +114,10 @@ _krb5_evp_cipher_aead(krb5_context context,
goto failure;

/* Copy out updated IV and get the tag if encrypting */
ret = (*et->encrypt)(context, dkey,
encryptp ? tiv->data.data : NULL,
encryptp ? tiv->data.length : 0,
encryptp, 0, ivec);
ret = (*et->aead_control)(context, dkey,
encryptp ? tiv->data.data : NULL,
encryptp ? tiv->data.length : 0,
encryptp, 0, ivec);
if (ret)
return ret;

Expand Down
6 changes: 3 additions & 3 deletions lib/krb5/crypto-aes-gcm.c
Expand Up @@ -49,7 +49,7 @@
* set and invocation will fail).
*/
krb5_error_code
_krb5_evp_encrypt_gcm(krb5_context context,
_krb5_evp_control_gcm(krb5_context context,
struct _krb5_key_data *key,
void *data,
size_t len,
Expand Down Expand Up @@ -166,7 +166,7 @@ struct _krb5_encryption_type _krb5_enctype_aes128_gcm_128 = {
NULL, /* should never be called */
NULL, /* should never be called */
F_DERIVED | F_SP800_108_KDF | F_ENC_THEN_CKSUM | F_AEAD,
_krb5_evp_encrypt_gcm,
_krb5_evp_control_gcm,
16,
AES_CMAC_PRF
};
Expand All @@ -182,7 +182,7 @@ struct _krb5_encryption_type _krb5_enctype_aes256_gcm_128 = {
NULL, /* should never be called */
NULL, /* should never be called */
F_DERIVED | F_SP800_108_KDF | F_ENC_THEN_CKSUM | F_AEAD,
_krb5_evp_encrypt_gcm,
_krb5_evp_control_gcm,
16,
AES_CMAC_PRF
};
1 change: 1 addition & 0 deletions lib/krb5/crypto.h
Expand Up @@ -126,6 +126,7 @@ struct _krb5_encryption_type {
* the AEAD cipher's initialization vector and MAC. See
* _krb5_evp_encrypt_gcm() for an example.
*/
#define aead_control encrypt
krb5_error_code (*encrypt)(krb5_context context,
struct _krb5_key_data *key,
void *data, size_t len,
Expand Down

0 comments on commit b36bab6

Please sign in to comment.