[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU gsasl branch, master, updated. gsasl-1-4-1-11-g1e99724
From: |
Simon Josefsson |
Subject: |
[SCM] GNU gsasl branch, master, updated. gsasl-1-4-1-11-g1e99724 |
Date: |
Tue, 02 Mar 2010 23:31:24 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gsasl".
http://git.savannah.gnu.org/cgit/gsasl.git/commit/?id=1e997246848357390e65b09244efc351d300393e
The branch, master has been updated
via 1e997246848357390e65b09244efc351d300393e (commit)
from b8b7067f1a47f3bbeb87fdd6df130f81e01316d5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1e997246848357390e65b09244efc351d300393e
Author: Simon Josefsson <address@hidden>
Date: Wed Mar 3 00:31:17 2010 +0100
GS2: Add ASN.1 helpers.
-----------------------------------------------------------------------
Summary of changes:
lib/gs2/gs2asn1.c | 77 ++++++++++++++++++++++++++++++++++++
lib/gs2/{gs2helper.h => gs2asn1.h} | 15 ++++---
2 files changed, 85 insertions(+), 7 deletions(-)
create mode 100644 lib/gs2/gs2asn1.c
copy lib/gs2/{gs2helper.h => gs2asn1.h} (76%)
diff --git a/lib/gs2/gs2asn1.c b/lib/gs2/gs2asn1.c
new file mode 100644
index 0000000..b889846
--- /dev/null
+++ b/lib/gs2/gs2asn1.c
@@ -0,0 +1,77 @@
+/* gs2asn1.h --- ASN.1 helper functions for GS2
+ * Copyright (C) 2010 Simon Josefsson
+ * Copyright (C) 2002, 2004, 2006, 2008, 2009, 2010 Free Software
+ * Foundation, Inc.
+ *
+ * This file is part of GNU SASL Library.
+ *
+ * GNU SASL Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * GNU SASL Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GNU SASL Library; if not, write to the Free
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "gs2asn1.h"
+
+/* The following function is copied from GNU Libtasn1 (under
+ LGPLv2.1+) lib/decoding.c:asn1_get_length_der. It is renamed for
+ namespace reasons, and uses better types and error codes. */
+
+ssize_t
+gs2_asn1_get_length_der (const char *der, size_t der_len, size_t *len)
+{
+ ssize_t ans;
+ size_t k, punt;
+
+ *len = 0;
+ if (der_len <= 0)
+ return -3;
+
+ if (!(der[0] & 128))
+ {
+ /* short form */
+ *len = 1;
+ return (unsigned char) der[0];
+ }
+ else
+ {
+ /* Long form */
+ k = (unsigned char) der[0] & 0x7F;
+ punt = 1;
+ if (k)
+ { /* definite length method */
+ ans = 0;
+ while (punt <= k && punt < der_len)
+ {
+ ssize_t last = ans;
+
+ ans = ans * 256 + (unsigned char) der[punt++];
+ if (ans < last)
+ /* we wrapped around, no bignum support... */
+ return -2;
+ }
+ }
+ else
+ { /* indefinite length method */
+ ans = -1;
+ }
+
+ *len = punt;
+ return ans;
+ }
+}
diff --git a/lib/gs2/gs2helper.h b/lib/gs2/gs2asn1.h
similarity index 76%
copy from lib/gs2/gs2helper.h
copy to lib/gs2/gs2asn1.h
index ec0b604..8c77f0c 100644
--- a/lib/gs2/gs2helper.h
+++ b/lib/gs2/gs2asn1.h
@@ -1,4 +1,4 @@
-/* gs2helper.h --- GS2 helper functions for missing GSS-API interface.
+/* gs2asn1.h --- ASN.1 helper functions for GS2
* Copyright (C) 2010 Simon Josefsson
*
* This file is part of GNU SASL Library.
@@ -20,12 +20,13 @@
*
*/
-#ifndef GS2_HELPER_H
-# define GS2_HELPER_H
+#ifndef GS2_ASN1_H
+# define GS2_ASN1_H
-extern OM_uint32
-gss_inquiry_mech_for_saslname (OM_uint32 *minor_status,
- const gss_buffer_t sasl_mech_name,
- gss_OID *mech_type);
+#include <stddef.h> /* size_t */
+#include <unistd.h> /* ssize_t */
+
+ssize_t
+gs2_asn1_get_length_der (const char *der, size_t der_len, size_t *len);
#endif
hooks/post-receive
--
GNU gsasl
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU gsasl branch, master, updated. gsasl-1-4-1-11-g1e99724,
Simon Josefsson <=