base64.c   base64.c 
skipping to change at line 30 skipping to change at line 30
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA. * MA 02111-1307, USA.
*/ */
/* just the dirtiest part of code i ever made */ /* just the dirtiest part of code i ever made */
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "libssh/priv.h" #include "libssh/priv.h"
#include "libssh/buffer.h"
static char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" static char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz" "abcdefghijklmnopqrstuvwxyz"
"0123456789+/"; "0123456789+/";
/* Transformations */ /* Transformations */
#define SET_A(n, i) do { (n) |= ((i) & 63) <<18; } while (0) #define SET_A(n, i) do { (n) |= ((i) & 63) <<18; } while (0)
#define SET_B(n, i) do { (n) |= ((i) & 63) <<12; } while (0) #define SET_B(n, i) do { (n) |= ((i) & 63) <<12; } while (0)
#define SET_C(n, i) do { (n) |= ((i) & 63) << 6; } while (0) #define SET_C(n, i) do { (n) |= ((i) & 63) << 6; } while (0)
#define SET_D(n, i) do { (n) |= ((i) & 63); } while (0) #define SET_D(n, i) do { (n) |= ((i) & 63); } while (0)
skipping to change at line 58 skipping to change at line 59
/* First part: base64 to binary */ /* First part: base64 to binary */
/** /**
* @internal * @internal
* *
* @brief Translates a base64 string into a binary one. * @brief Translates a base64 string into a binary one.
* *
* @returns A buffer containing the decoded string, NULL if something went * @returns A buffer containing the decoded string, NULL if something went
* wrong (e.g. incorrect char). * wrong (e.g. incorrect char).
*/ */
BUFFER *base64_to_bin(const char *source) { ssh_buffer base64_to_bin(const char *source) {
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
unsigned char block[3]; unsigned char block[3];
char *base64; char *base64;
char *ptr; char *ptr;
size_t len; size_t len;
int equals; int equals;
base64 = strdup(source); base64 = strdup(source);
if (base64 == NULL) { if (base64 == NULL) {
return NULL; return NULL;
} }
 End of changes. 2 change blocks. 
2 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/