]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Modified base64 code in preparation for PolarSSL merge
authorAdriaan de Jong <dejong@fox-it.com>
Thu, 30 Jun 2011 14:34:11 +0000 (16:34 +0200)
committerDavid Sommerseth <davids@redhat.com>
Sat, 22 Oct 2011 09:44:36 +0000 (11:44 +0200)
 - 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>
base64.c
base64.h
misc.c
ntlm.c
pkcs11.c
proxy.c
ssl_openssl.c

index 95ccffcde9b61d7034834f3b762a845edbb95876..303d773a97cd51558e1527a62a658656f14db5fc 100644 (file)
--- 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;
index 64439a0f1cbb20025369d35b41f17ce3aba89b32..28a9677c46a586536369f1d1710d3c3285683ad4 100644 (file)
--- 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 212a362784804f49e287a9cb7af0f74ffbea69af..fd9c299021e813955660cbb97062f467a618e201 100644 (file)
--- 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 30d5d117198b73d4940e5c1139b469e7826ed458..23416a75f8e57ea0e34890e5b4849f7d91814086 100644 (file)
--- 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;
 
index 5e051b856d8175b1c876e0051a34556bd045da89..7c0b90a91ca34bafe9406c93bbc5f4fd930b49bf 100644 (file)
--- 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 86f3d7d3497e75a031a757122b4a8234c7227843..5e74af2e61bd3df1cd159186cbd82814bd30712d 100644 (file)
--- 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;
index f85f81a9e6ebbe40f769c3f72e0b66ddc57e4b75..ca3f01d9c3196f85ec6a2203ccda91d696cc7a7a 100644 (file)
@@ -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)