Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit525e60b

Browse files
committed
Fix compilation of uuid-ossp
This module had a dependency on pgcrypto's md5.c that got removed byb67b57a. Instead of the code from pgcrypto, this code can just use thenew cryptohash routines for MD5 as a drop-in replacement, so let's justdo this switch. This has also the merit to simplify a bit thecompilation of uuid-ossp.This requires --with-uuid to be reproduced, and I have used e2fs as away to reproduce the failure, then test this commit.Per reports from buildfarm members longfin, florican and sifaka.Discussion:https://postgr.es/m/X9GToVd3QmWeNvj8@paquier.xyz
1 parentb67b57a commit525e60b

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

‎configure

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8307,12 +8307,12 @@ if test "$with_uuid" = bsd ; then
83078307

83088308
$as_echo "#define HAVE_UUID_BSD 1" >>confdefs.h
83098309

8310-
UUID_EXTRA_OBJS="md5.osha1.o"
8310+
UUID_EXTRA_OBJS="sha1.o"
83118311
elif test "$with_uuid" = e2fs ; then
83128312

83138313
$as_echo "#define HAVE_UUID_E2FS 1" >>confdefs.h
83148314

8315-
UUID_EXTRA_OBJS="md5.osha1.o"
8315+
UUID_EXTRA_OBJS="sha1.o"
83168316
elif test "$with_uuid" = ossp ; then
83178317

83188318
$as_echo "#define HAVE_UUID_OSSP 1" >>confdefs.h

‎configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,10 +921,10 @@ fi
921921

922922
if test "$with_uuid" = bsd ; then
923923
AC_DEFINE([HAVE_UUID_BSD],1,[Define to 1 if you have BSD UUID support.])
924-
UUID_EXTRA_OBJS="md5.osha1.o"
924+
UUID_EXTRA_OBJS="sha1.o"
925925
elif test "$with_uuid" = e2fs ; then
926926
AC_DEFINE([HAVE_UUID_E2FS],1,[Define to 1 if you have E2FS UUID support.])
927-
UUID_EXTRA_OBJS="md5.osha1.o"
927+
UUID_EXTRA_OBJS="sha1.o"
928928
elif test "$with_uuid" = ossp ; then
929929
AC_DEFINE([HAVE_UUID_OSSP],1,[Define to 1 if you have OSSP UUID support.])
930930
UUID_EXTRA_OBJS=""

‎contrib/uuid-ossp/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pgcrypto_src = $(top_srcdir)/contrib/pgcrypto
1919

2020
PG_CPPFLAGS = -I$(pgcrypto_src)
2121

22-
EXTRA_CLEAN =md5.csha1.c
22+
EXTRA_CLEAN = sha1.c
2323

2424
ifdefUSE_PGXS
2525
PG_CONFIG = pg_config
@@ -32,5 +32,5 @@ include $(top_builddir)/src/Makefile.global
3232
include$(top_srcdir)/contrib/contrib-global.mk
3333
endif
3434

35-
md5.csha1.c:% :$(pgcrypto_src)/%
35+
sha1.c:% :$(pgcrypto_src)/%
3636
rm -f$@&&$(LN_S)$<.

‎contrib/uuid-ossp/uuid-ossp.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include"postgres.h"
1515

1616
#include"fmgr.h"
17+
#include"common/cryptohash.h"
1718
#include"port/pg_bswap.h"
1819
#include"utils/builtins.h"
1920
#include"utils/uuid.h"
@@ -44,7 +45,6 @@
4445
* so we use a copy of the ones from pgcrypto. Not needed with OSSP, though.
4546
*/
4647
#ifndefHAVE_UUID_OSSP
47-
#include"md5.h"
4848
#include"sha1.h"
4949
#endif
5050

@@ -324,13 +324,17 @@ uuid_generate_internal(int v, unsigned char *ns, const char *ptr, int len)
324324

325325
if (v==3)
326326
{
327-
MD5_CTXctx;
327+
pg_cryptohash_ctx*ctx=pg_cryptohash_create(PG_MD5);
328328

329-
MD5Init(&ctx);
330-
MD5Update(&ctx,ns,sizeof(uu));
331-
MD5Update(&ctx, (unsignedchar*)ptr,len);
329+
if (pg_cryptohash_init(ctx)<0)
330+
elog(ERROR,"could not initialize %s context","MD5");
331+
if (pg_cryptohash_update(ctx,ns,sizeof(uu))<0||
332+
pg_cryptohash_update(ctx, (unsignedchar*)ptr,len)<0)
333+
elog(ERROR,"could not update %s context","MD5");
332334
/* we assume sizeof MD5 result is 16, same as UUID size */
333-
MD5Final((unsignedchar*)&uu,&ctx);
335+
if (pg_cryptohash_final(ctx, (unsignedchar*)&uu)<0)
336+
elog(ERROR,"could not finalize %s context","MD5");
337+
pg_cryptohash_free(ctx);
334338
}
335339
else
336340
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp