* hadn't seen his code).
*/
+#include "postgres.h"
+
#include "px-crypt.h"
#define __set_errno(v)
#define __set_errno(val) errno = (val)
#endif
-#undef __CONST
-#ifdef __GNUC__
-#define __CONST __const
-#else
-#define __CONST
-#endif
-
#ifdef __i386__
#define BF_ASM 0 /* 1 */
#define BF_SCALE 1
(dst) = tmp; \
}
-static int BF_decode(BF_word *dst, __CONST char *src, int size)
+static int BF_decode(BF_word *dst, const char *src, int size)
{
unsigned char *dptr = (unsigned char *)dst;
unsigned char *end = dptr + size;
return 0;
}
-static void BF_encode(char *dst, __CONST BF_word *src, int size)
+static void BF_encode(char *dst, const BF_word *src, int size)
{
unsigned char *sptr = (unsigned char *)src;
unsigned char *end = sptr + size;
#endif
-static void BF_set_key(__CONST char *key, BF_key expanded, BF_key initial)
+static void BF_set_key(const char *key, BF_key expanded, BF_key initial)
{
- __CONST char *ptr = key;
+ const char *ptr = key;
int i, j;
BF_word tmp;
}
}
-char *_crypt_blowfish_rn(__CONST char *key, __CONST char *setting,
+char *_crypt_blowfish_rn(const char *key, const char *setting,
char *output, int size)
{
struct {
* alignment).
*/
+#include "postgres.h"
+
#include "px-crypt.h"
/* for ntohl/htonl */
#include
-
-/* We can't always assume gcc */
-#ifdef __GNUC__
-#define INLINE inline
-#endif
-
#define _PASSWORD_EFMT1 '_'
static uint8 IP[64] = {
static uint32 old_rawkey0,
old_rawkey1;
-static INLINE int
+static inline int
ascii_to_bin(char ch)
{
if (ch > 'z')
static int
des_cipher(const char *in, char *out, long salt, int count)
{
+ uint32 buffer[2];
uint32 l_out,
r_out,
rawl,
setup_salt(salt);
- rawl = ntohl(*((uint32 *) in)++);
- rawr = ntohl(*((uint32 *) in));
+ /* copy data to avoid assuming input is word-aligned */
+ memcpy(buffer, in, sizeof(buffer));
+
+ rawl = ntohl(buffer[0]);
+ rawr = ntohl(buffer[1]);
retval = do_des(rawl, rawr, &l_out, &r_out, count);
- *((uint32 *) out)++ = htonl(l_out);
- *((uint32 *) out) = htonl(r_out);
+ buffer[0] = htonl(l_out);
+ buffer[1] = htonl(r_out);
+
+ /* copy data to avoid assuming output is word-aligned */
+ memcpy(out, buffer, sizeof(buffer));
+
return (retval);
}
* may not be compiled always. -- marko
*/
+#include "postgres.h"
+
#include "px-crypt.h"
#include
#ifndef __set_errno
-#define __set_errno(val) errno = (val)
-#endif
-
-#undef __CONST
-#ifdef __GNUC__
-#define __CONST __const
-#else
-#define __CONST
+#define __set_errno(val) (errno = (val))
#endif
typedef unsigned int BF_word;
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char *_crypt_gensalt_traditional_rn(unsigned long count,
- __CONST char *input, int size, char *output, int output_size)
+ const char *input, int size, char *output, int output_size)
{
if (size < 2 || output_size < 2 + 1 || (count && count != 25)) {
if (output_size > 0) output[0] = '\0';
}
char *_crypt_gensalt_extended_rn(unsigned long count,
- __CONST char *input, int size, char *output, int output_size)
+ const char *input, int size, char *output, int output_size)
{
unsigned long value;
}
char *_crypt_gensalt_md5_rn(unsigned long count,
- __CONST char *input, int size, char *output, int output_size)
+ const char *input, int size, char *output, int output_size)
{
unsigned long value;
static unsigned char BF_itoa64[64 + 1] =
"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-static void BF_encode(char *dst, __CONST BF_word *src, int size)
+static void BF_encode(char *dst, const BF_word *src, int size)
{
unsigned char *sptr = (unsigned char *)src;
unsigned char *end = sptr + size;
}
char *_crypt_gensalt_blowfish_rn(unsigned long count,
- __CONST char *input, int size, char *output, int output_size)
+ const char *input, int size, char *output, int output_size)
{
if (size < 16 || output_size < 7 + 22 + 1 ||
(count && (count < 4 || count > 31))) {
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: internal.c,v 1.4 2001/08/21 00:42:41 momjian Exp $
+ * $Id: internal.c,v 1.5 2001/10/15 19:12:48 tgl Exp $
*/
{
SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr;
- SHA1Update(ctx, (const char *)data, dlen);
+ SHA1Update(ctx, data, dlen);
}
static void
if (TRIGGER_FIRED_BY_UPDATE(CurrentTriggerData->tg_event))
newtuple = CurrentTriggerData->tg_newtuple;
+#ifndef PG_FUNCTION_INFO_V1
/*
* Setting CurrentTriggerData to NULL prevents direct calls to trigger
* functions in queries. Normally, trigger functions have to be called
* by trigger manager code only.
*/
CurrentTriggerData = NULL;
+#endif
/* Connect to SPI manager */
if ((ret = SPI_connect()) < 0)