]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Functions in enc_helper.c serve different code blocks. Split them
authorZhanna Tsitkov <tsitkova@mit.edu>
Tue, 29 Dec 2009 16:41:08 +0000 (16:41 +0000)
committerZhanna Tsitkov <tsitkova@mit.edu>
Tue, 29 Dec 2009 16:41:08 +0000 (16:41 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23535 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/Makefile.in
src/lib/krb5/krb/enc_helper.c
src/lib/krb5/krb/enc_keyhelper.c [new file with mode: 0644]

index 507be6e805deea113b3cfa847d8f8b79beb0b440..2cdeb02ba271eb54b8656c5d1193d37fd4d8039c 100644 (file)
@@ -37,6 +37,7 @@ STLIBOBJS= \
        decrypt_tk.o    \
        deltat.o        \
         enc_helper.o   \
+        enc_keyhelper.o        \
        encode_kdc.o    \
        encrypt_tk.o    \
        fast.o \
@@ -129,6 +130,7 @@ OBJS=       $(OUTPRE)addr_comp.$(OBJEXT)    \
        $(OUTPRE)decrypt_tk.$(OBJEXT)   \
        $(OUTPRE)deltat.$(OBJEXT)       \
         $(OUTPRE)enc_helper.$(OBJEXT)  \
+        $(OUTPRE)enc_keyhelper.$(OBJEXT)       \
        $(OUTPRE)encode_kdc.$(OBJEXT)   \
        $(OUTPRE)encrypt_tk.$(OBJEXT)   \
        $(OUTPRE)fast.$(OBJEXT) \
@@ -222,6 +224,7 @@ SRCS=       $(srcdir)/addr_comp.c   \
        $(srcdir)/decrypt_tk.c  \
        $(srcdir)/deltat.c      \
        $(srcdir)/enc_helper.c  \
+       $(srcdir)/enc_keyhelper.c       \
        $(srcdir)/encode_kdc.c  \
        $(srcdir)/encrypt_tk.c  \
        $(srcdir)/fast.c \
index 41d2f00f7c57b71ea9589743fa67e96f9dcf6492..0a45857d1617aaf4c00661937d3f50ba736d1197 100644 (file)
@@ -1,5 +1,7 @@
 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
 /*
+ * lib/krb5/krb/enc_helper.c
+ *
  * Copyright (C) 1998 by the FundsXpress, INC.
  *
  * All rights reserved.
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * krb5_encrypt_helper()
+ *
  */
 
 #include "k5-int.h"
 
 krb5_error_code
-krb5_encrypt_helper(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *plain, krb5_enc_data *cipher)
+krb5_encrypt_helper(krb5_context context,
+                    const krb5_keyblock *key, krb5_keyusage usage,
+                    const krb5_data *plain, krb5_enc_data *cipher)
 {
     krb5_error_code ret;
     size_t enclen;
@@ -48,29 +55,3 @@ krb5_encrypt_helper(krb5_context context, const krb5_keyblock *key, krb5_keyusag
 
     return(ret);
 }
-
-krb5_error_code
-krb5_encrypt_keyhelper(krb5_context context, krb5_key key, krb5_keyusage usage,
-                       const krb5_data *plain, krb5_enc_data *cipher)
-{
-    krb5_enctype enctype;
-    krb5_error_code ret;
-    size_t enclen;
-
-    enctype = krb5_k_key_enctype(context, key);
-    ret = krb5_c_encrypt_length(context, enctype, plain->length, &enclen);
-    if (ret != 0)
-        return ret;
-
-    cipher->ciphertext.length = enclen;
-    cipher->ciphertext.data = malloc(enclen);
-    if (cipher->ciphertext.data == NULL)
-        return ENOMEM;
-    ret = krb5_k_encrypt(context, key, usage, 0, plain, cipher);
-    if (ret) {
-        free(cipher->ciphertext.data);
-        cipher->ciphertext.data = NULL;
-    }
-
-    return ret;
-}
diff --git a/src/lib/krb5/krb/enc_keyhelper.c b/src/lib/krb5/krb/enc_keyhelper.c
new file mode 100644 (file)
index 0000000..43db716
--- /dev/null
@@ -0,0 +1,59 @@
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ * lib/krb5/krb/enc_keyhelper.c
+ *
+ * Copyright (C) 1998 by the FundsXpress, INC.
+ *
+ * All rights reserved.
+ *
+ * Export of this software from the United States of America may require
+ * a specific license from the United States Government.  It is the
+ * responsibility of any person or organization contemplating export to
+ * obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of FundsXpress. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  FundsXpress makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * krb5_encrypt_keyhelper()
+ *
+ */
+
+#include "k5-int.h"
+
+krb5_error_code
+krb5_encrypt_keyhelper(krb5_context context, krb5_key key, krb5_keyusage usage,
+                       const krb5_data *plain, krb5_enc_data *cipher)
+{
+    krb5_enctype enctype;
+    krb5_error_code ret;
+    size_t enclen;
+
+    enctype = krb5_k_key_enctype(context, key);
+    ret = krb5_c_encrypt_length(context, enctype, plain->length, &enclen);
+    if (ret != 0)
+        return ret;
+
+    cipher->ciphertext.length = enclen;
+    cipher->ciphertext.data = malloc(enclen);
+    if (cipher->ciphertext.data == NULL)
+        return ENOMEM;
+    ret = krb5_k_encrypt(context, key, usage, 0, plain, cipher);
+    if (ret) {
+        free(cipher->ciphertext.data);
+        cipher->ciphertext.data = NULL;
+    }
+
+    return ret;
+}