svn rev #23535: trunk/src/lib/krb5/krb/
tsitkova@MIT.EDU
tsitkova at MIT.EDU
Tue Dec 29 11:41:09 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=23535
Commit By: tsitkova
Log Message:
Functions in enc_helper.c serve different code blocks. Split them.
Changed Files:
U trunk/src/lib/krb5/krb/Makefile.in
U trunk/src/lib/krb5/krb/enc_helper.c
A trunk/src/lib/krb5/krb/enc_keyhelper.c
Modified: trunk/src/lib/krb5/krb/Makefile.in
===================================================================
--- trunk/src/lib/krb5/krb/Makefile.in 2009-12-29 02:56:46 UTC (rev 23534)
+++ trunk/src/lib/krb5/krb/Makefile.in 2009-12-29 16:41:08 UTC (rev 23535)
@@ -37,6 +37,7 @@
decrypt_tk.o \
deltat.o \
enc_helper.o \
+ enc_keyhelper.o \
encode_kdc.o \
encrypt_tk.o \
fast.o \
@@ -129,6 +130,7 @@
$(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 @@
$(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 \
Modified: trunk/src/lib/krb5/krb/enc_helper.c
===================================================================
--- trunk/src/lib/krb5/krb/enc_helper.c 2009-12-29 02:56:46 UTC (rev 23534)
+++ trunk/src/lib/krb5/krb/enc_helper.c 2009-12-29 16:41:08 UTC (rev 23535)
@@ -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.
@@ -23,12 +25,17 @@
* 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 @@
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;
-}
Added: trunk/src/lib/krb5/krb/enc_keyhelper.c
===================================================================
--- trunk/src/lib/krb5/krb/enc_keyhelper.c (rev 0)
+++ trunk/src/lib/krb5/krb/enc_keyhelper.c 2009-12-29 16:41:08 UTC (rev 23535)
@@ -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;
+}
More information about the cvs-krb5
mailing list