From c1b34e9d1f637ea7ce1b455e85d47920d8fec5d2 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Thu, 8 Nov 1990 15:26:49 +0000 Subject: [PATCH] change bcopy to memcpy remove unnecessary copy to tmpcontents git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1430 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kdb/encrypt_key.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/lib/kdb/encrypt_key.c b/src/lib/kdb/encrypt_key.c index 75dab396d..990a2be90 100644 --- a/src/lib/kdb/encrypt_key.c +++ b/src/lib/kdb/encrypt_key.c @@ -35,26 +35,21 @@ krb5_keyblock *out; along with the encrypted key */ krb5_error_code retval; - krb5_octet *tmpcontents; out->keytype = in->keytype; out->length = krb5_encrypt_size(in->length, eblock->crypto_entry); - if (!(tmpcontents = (krb5_octet *)calloc(1, out->length))) - return ENOMEM; - bcopy((char *) in->contents, (char *)tmpcontents, in->length); out->length += sizeof(out->length); out->contents = (krb5_octet *)malloc(out->length); if (!out->contents) { out->contents = 0; out->length = 0; - xfree(tmpcontents); return ENOMEM; } /* copy in real length */ - bcopy((char *)&in->length, (char *)out->contents, sizeof(out->length)); + memcpy((char *)out->contents, (char *)&in->length, sizeof(out->length)); /* and arrange for encrypted key */ - if (retval = krb5_encrypt((krb5_pointer) tmpcontents, + if (retval = krb5_encrypt((krb5_pointer) in->contents, (krb5_pointer) (((char *) out->contents) + sizeof(out->length)), in->length, eblock, 0)) { @@ -62,6 +57,5 @@ krb5_keyblock *out; out->contents = 0; out->length = 0; } - xfree(tmpcontents); return retval; } -- 2.26.2