change bcopy to memcpy
authorJohn Kohl <jtkohl@mit.edu>
Thu, 8 Nov 1990 15:26:49 +0000 (15:26 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Thu, 8 Nov 1990 15:26:49 +0000 (15:26 +0000)
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

index 75dab396d84a16ffac8b29629dfb95df5f65469c..990a2be90b121ec198617da61dc4a75b478107d3 100644 (file)
@@ -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;
 }