/*
- * Copyright (C) 2005-2011 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2013 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
/** \file crypt_common.c Crypto functions independent of openssl/libgcrypt. */
#include <regex.h>
-#include <stdbool.h>
#include "para.h"
#include "error.h"
#include "string.h"
-#include "crypt_backend.h"
#include "crypt.h"
+#include "crypt_backend.h"
/** If the key begins with this text, we treat it as an ssh key. */
#define KEY_TYPE_TXT "ssh-rsa"
break;
pos = strchr(Base64, ch);
- if (pos == 0) /* A non-base64 character. */
+ if (pos == NULL) /* A non-base64 character. */
return -E_BASE64;
switch (state) {
}
return 0;
}
-
-int sc_recv_buffer(struct stream_cipher_context *scc, char *buf, size_t size)
-{
- int n;
-
- assert(size);
- n = sc_recv_bin_buffer(scc, buf, size - 1);
- if (n >= 0)
- buf[n] = '\0';
- else
- *buf = '\0';
- return n;
-}
-
-int sc_send_buffer(struct stream_cipher_context *scc, char *buf)
-{
- return sc_send_bin_buffer(scc, buf, strlen(buf));
-}
-
-__printf_2_3 int sc_send_va_buffer(struct stream_cipher_context *scc,
- const char *fmt, ...)
-{
- char *msg;
- int ret;
-
- PARA_VSPRINTF(fmt, msg);
- ret = sc_send_buffer(scc, msg);
- free(msg);
- return ret;
-}