diff options
author | John Carr <jfc@mit.edu> | 1991-12-06 13:18:16 +0000 |
---|---|---|
committer | John Carr <jfc@mit.edu> | 1991-12-06 13:18:16 +0000 |
commit | ae5ad7d5ad644bf9102d720b2279da3359b70d2d (patch) | |
tree | b027afe204efc7e83a7b65307f9db79b1267db56 /src/lib/kdb/decrypt_key.c | |
parent | 8f908720f3a6940ac452f48e46f9fb9fea9f3ea7 (diff) | |
download | krb5-ae5ad7d5ad644bf9102d720b2279da3359b70d2d.tar.gz krb5-ae5ad7d5ad644bf9102d720b2279da3359b70d2d.tar.xz krb5-ae5ad7d5ad644bf9102d720b2279da3359b70d2d.zip |
Store the length field of the encrypted key in network byte order
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2195 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/kdb/decrypt_key.c')
-rw-r--r-- | src/lib/kdb/decrypt_key.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/kdb/decrypt_key.c b/src/lib/kdb/decrypt_key.c index d99156af42..811727b355 100644 --- a/src/lib/kdb/decrypt_key.c +++ b/src/lib/kdb/decrypt_key.c @@ -47,11 +47,11 @@ krb5_encrypt_block *eblock; const krb5_encrypted_keyblock *in; krb5_keyblock *out; { + int length; krb5_error_code retval; /* the encrypted version is stored as the unencrypted key length - (in host byte order), followed by the encrypted key. - */ + (4 bytes, MSB first) followed by the encrypted key. */ out->keytype = in->keytype; out->length = krb5_encrypt_size(in->length-sizeof(in->length), eblock->crypto_entry); @@ -62,7 +62,11 @@ krb5_keyblock *out; return ENOMEM; } /* copy out the real length count */ - memcpy((char *)&out->length, (char *)in->contents, sizeof(out->length)); + length = ((unsigned char *)in->contents)[0] << 24; + length += ((unsigned char *)in->contents)[1] << 16; + length += ((unsigned char *)in->contents)[2] << 8; + length += ((unsigned char *)in->contents)[3]; + out->length = length; /* remember the contents of the encrypted version has a sizeof(in->length) integer length of the real embedded key, followed by the |