summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdriaan de Jong <dejong@fox-it.com>2011-06-30 16:34:11 +0200
committerDavid Sommerseth <davids@redhat.com>2011-10-22 11:44:36 +0200
commita4da1fe776b774670948f00898d370da614960f5 (patch)
treec01d7ab792f07338a12c30d803f81cf7a7db8429
parent5fe5fe9e6264d45154a7ece8c85fa70173429ff8 (diff)
downloadopenvpn-a4da1fe776b774670948f00898d370da614960f5.tar.gz
openvpn-a4da1fe776b774670948f00898d370da614960f5.tar.xz
openvpn-a4da1fe776b774670948f00898d370da614960f5.zip
Modified base64 code in preparation for PolarSSL merge
- Renamed base64_decode and base64_encode to openvpn_* - Changed the contributor's name to UTF-8 Signed-off-by: Adriaan de Jong <dejong@fox-it.com> Acked-by: James Yonan <james@openvpn.net> Signed-off-by: David Sommerseth <davids@redhat.com>
-rw-r--r--base64.c6
-rw-r--r--base64.h6
-rw-r--r--misc.c6
-rw-r--r--ntlm.c2
-rw-r--r--pkcs11.c2
-rw-r--r--proxy.c2
-rw-r--r--ssl_openssl.c4
7 files changed, 14 insertions, 14 deletions
diff --git a/base64.c b/base64.c
index 95ccffc..303d773 100644
--- a/base64.c
+++ b/base64.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995-2001 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995-2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -47,7 +47,7 @@ static char base64_chars[] =
* length of *str.
*/
int
-base64_encode(const void *data, int size, char **str)
+openvpn_base64_encode(const void *data, int size, char **str)
{
char *s, *p;
int i;
@@ -125,7 +125,7 @@ token_decode(const char *token)
* decoded data written or -1 on error or overflow.
*/
int
-base64_decode(const char *str, void *data, int size)
+openvpn_base64_decode(const char *str, void *data, int size)
{
const char *p;
unsigned char *q;
diff --git a/base64.h b/base64.h
index 64439a0..28a9677 100644
--- a/base64.h
+++ b/base64.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -36,8 +36,8 @@
#if defined(ENABLE_HTTP_PROXY) || defined(ENABLE_PKCS11) || defined(ENABLE_CLIENT_CR) || defined(MANAGMENT_EXTERNAL_KEY)
-int base64_encode(const void *data, int size, char **str);
-int base64_decode(const char *str, void *data, int size);
+int openvpn_base64_encode(const void *data, int size, char **str);
+int openvpn_base64_decode(const char *str, void *data, int size);
#endif
diff --git a/misc.c b/misc.c
index 212a362..fd9c299 100644
--- a/misc.c
+++ b/misc.c
@@ -1494,8 +1494,8 @@ get_user_pass_cr (struct user_pass *up,
msg (M_INFO|M_NOPREFIX, "CHALLENGE: %s", auth_challenge);
if (!get_console_input ("Response:", BOOL_CAST(flags & GET_USER_PASS_STATIC_CHALLENGE_ECHO), response, USER_PASS_LEN))
msg (M_FATAL, "ERROR: could not read static challenge response from stdin");
- if (base64_encode(up->password, strlen(up->password), &pw64) == -1
- || base64_encode(response, strlen(response), &resp64) == -1)
+ if (openvpn_base64_encode(up->password, strlen(up->password), &pw64) == -1
+ || openvpn_base64_encode(response, strlen(response), &resp64) == -1)
msg (M_FATAL, "ERROR: could not base64-encode password/static_response");
buf_set_write (&packed_resp, (uint8_t*)up->password, USER_PASS_LEN);
buf_printf (&packed_resp, "SCRV1:%s:%s", pw64, resp64);
@@ -1617,7 +1617,7 @@ get_auth_challenge (const char *auth_challenge, struct gc_arena *gc)
if (!buf_parse(&b, ':', work, len))
return NULL;
ac->user = (char *) gc_malloc (strlen(work)+1, true, gc);
- base64_decode(work, (void*)ac->user, -1);
+ openvpn_base64_decode(work, (void*)ac->user, -1);
/* parse challenge text */
ac->challenge_text = string_alloc(BSTR(&b), gc);
diff --git a/ntlm.c b/ntlm.c
index 30d5d11..23416a7 100644
--- a/ntlm.c
+++ b/ntlm.c
@@ -237,7 +237,7 @@ ntlm_phase_3 (const struct http_proxy_info *p, const char *phase_2, struct gc_ar
/* pad to 21 bytes */
memset (md4_hash + 16, 0, 5);
- ret_val = base64_decode( phase_2, (void *)buf2, -1);
+ ret_val = openvpn_base64_decode( phase_2, (void *)buf2, -1);
if (ret_val < 0)
return NULL;
diff --git a/pkcs11.c b/pkcs11.c
index 5e051b8..7c0b90a 100644
--- a/pkcs11.c
+++ b/pkcs11.c
@@ -561,7 +561,7 @@ pkcs11_management_id_get (
goto cleanup;
}
- if (base64_encode (certificate_blob, certificate_blob_size, &internal_base64) == -1) {
+ if (openvpn_base64_encode (certificate_blob, certificate_blob_size, &internal_base64) == -1) {
msg (M_WARN, "PKCS#11: Cannot encode certificate");
goto cleanup;
}
diff --git a/proxy.c b/proxy.c
index 86f3d7d..5e74af2 100644
--- a/proxy.c
+++ b/proxy.c
@@ -192,7 +192,7 @@ make_base64_string2 (const uint8_t *str, int src_len, struct gc_arena *gc)
{
uint8_t *ret = NULL;
char *b64out = NULL;
- ASSERT (base64_encode ((const void *)str, src_len, &b64out) >= 0);
+ ASSERT (openvpn_base64_encode ((const void *)str, src_len, &b64out) >= 0);
ret = (uint8_t *) string_alloc (b64out, gc);
free (b64out);
return ret;
diff --git a/ssl_openssl.c b/ssl_openssl.c
index f85f81a..ca3f01d 100644
--- a/ssl_openssl.c
+++ b/ssl_openssl.c
@@ -552,7 +552,7 @@ rsa_priv_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, i
}
/* convert 'from' to base64 */
- if (base64_encode (from, flen, &in_b64) <= 0)
+ if (openvpn_base64_encode (from, flen, &in_b64) <= 0)
goto done;
/* call MI for signature */
@@ -563,7 +563,7 @@ rsa_priv_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, i
/* decode base64 signature to binary */
len = RSA_size(rsa);
- ret = base64_decode (out_b64, to, len);
+ ret = openvpn_base64_decode (out_b64, to, len);
/* verify length */
if (ret != len)