summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/krb5/krb/copy_key.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/lib/krb5/krb/copy_key.c b/src/lib/krb5/krb/copy_key.c
new file mode 100644
index 000000000..0d6a2b61b
--- /dev/null
+++ b/src/lib/krb5/krb/copy_key.c
@@ -0,0 +1,38 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/mit-copyright.h>.
+ *
+ * krb5_copy_keyblock()
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char copy_key_c[] =
+"$Id$";
+#endif /* !lint & !SABER */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+#include <krb5/ext-proto.h>
+
+#include <errno.h>
+
+/*
+ * Copy a keyblock, including alloc'ed storage.
+ */
+krb5_error_code
+krb5_copy_keyblock(from, to)
+krb5_keyblock *from;
+krb5_keyblock *to;
+{
+ *to = *from;
+ to->contents = (krb5_octet *)malloc(to->length);
+ if (!to->contents)
+ return ENOMEM;
+ bcopy((char *)from->contents, (char *)to->contents, to->length);
+ return 0;
+}