From 0b731363d373a993645cd01061fc8ee911fc0593 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Wed, 24 Oct 2001 18:34:04 +0000 Subject: [PATCH] * t_encrypt.c: Argument to krb5_c_encrypt_length must be size_t instead of int (which is the length in krb5_data) or unaligned access occurs on Dec OSF machines. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13845 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/ChangeLog | 6 ++++++ src/lib/crypto/t_encrypt.c | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib/crypto/ChangeLog b/src/lib/crypto/ChangeLog index 820fef4c2..0b9da85a6 100644 --- a/src/lib/crypto/ChangeLog +++ b/src/lib/crypto/ChangeLog @@ -1,3 +1,9 @@ +2001-10-24 Ezra Peisach + + * t_encrypt.c: Argument to krb5_c_encrypt_length must be size_t + instead of int (which is the length in krb5_data) or unaligned + access occurs on Dec OSF machines. + 2001-10-23 Sam Hartman * Makefile.in (RUN_SETUP): Include so make check works correctly diff --git a/src/lib/crypto/t_encrypt.c b/src/lib/crypto/t_encrypt.c index bf7cfca94..6cdfc21c6 100644 --- a/src/lib/crypto/t_encrypt.c +++ b/src/lib/crypto/t_encrypt.c @@ -57,6 +57,7 @@ int main () { krb5_context context ; krb5_data in, out, check; int i; + size_t len; krb5_enc_data enc_out; krb5_error_code retval; krb5_keyblock key; @@ -74,8 +75,12 @@ int main () { printf ("Testing enctype %d\n", enctype); test ("Generating random key", krb5_c_make_random_key (context, enctype, &key)); - enc_out.ciphertext = out; - krb5_c_encrypt_length (context, key.enctype, in.length, &enc_out.ciphertext.length); + enc_out.ciphertext.data = out.data; + enc_out.ciphertext.length = out.length; + /* We use an intermediate `len' because size_t may be different size + than `int' */ + krb5_c_encrypt_length (context, key.enctype, in.length, &len); + enc_out.ciphertext.length = len; test ("Encrypting", krb5_c_encrypt (context, &key, 7, 0, &in, &enc_out)); test ("Decrypting", -- 2.26.2