[xmlsec] several patches from Roumen
- From: Aleksey Sanin <aleksey src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [xmlsec] several patches from Roumen
- Date: Wed, 12 May 2010 20:33:03 +0000 (UTC)
commit ade45584c2cb4da73eabc8a7e6c94326960ef2a9
Author: Aleksey Sanin <aleksey aleksey com>
Date: Wed May 12 13:34:00 2010 -0700
several patches from Roumen
ChangeLog | 5 ++++
Makefile.am | 8 +++---
configure.in | 12 +++++++--
src/gcrypt/app.c | 2 +-
src/gcrypt/asn1.c | 2 +-
src/mscrypto/Makefile.am | 2 +-
src/mscrypto/app.c | 4 ---
src/mscrypto/certkeys.c | 4 ---
src/mscrypto/ciphers.c | 5 ----
src/mscrypto/crypto.c | 21 +++++++++++++++-
src/mscrypto/digests.c | 2 +
src/mscrypto/keysstore.c | 4 ---
src/mscrypto/kw_aes.c | 4 ---
src/mscrypto/kw_des.c | 3 --
src/mscrypto/mingw-crypt32.def | 2 +
src/mscrypto/private.h | 4 +++
src/mscrypto/signatures.c | 4 ---
src/mscrypto/x509.c | 4 ---
src/mscrypto/x509vfy.c | 4 ---
src/mscrypto/xmlsec-mingw.h | 53 +++++++++++++++++++++++++++++++++-------
20 files changed, 93 insertions(+), 56 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 73a661b..9db2952 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-12 Aleksey Sanin <aleksey aleksey com>
+ * Several patches from Roumen: support NSS/NSPR from seamonkey
+ package; reorder libxmlsec as dep. lib for mingw; fix gcrypt/src/asn1.h
+ include; fix Unicode build for mingw
+
2010-05-10 Aleksey Sanin <aleksey aleksey com>
* Added RSA/SHA1/SHA256/SHA384/SHA512/MD5/RIPEMD160 for xmlsec-gcrypt
* Added DSA/SHA1 for xmlsec-gcrypt
diff --git a/Makefile.am b/Makefile.am
index 70f86eb..32fec02 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -124,7 +124,7 @@ check-keys: $(TEST_APP)
@($(PRECHECK_COMMANDS) && \
$(SHELL) ./tests/testrun.sh \
$(ABS_SRCDIR)/tests/testKeys.sh \
- $(XMLSEC_CRYPTO) \
+ $(DEFAULT_CRYPTO) \
$(ABS_SRCDIR)/tests \
$(ABS_BUILDDIR)/$(TEST_APP) \
der \
@@ -134,7 +134,7 @@ check-dsig: $(TEST_APP)
@($(PRECHECK_COMMANDS) && \
$(SHELL) ./tests/testrun.sh \
$(ABS_SRCDIR)/tests/testDSig.sh \
- $(XMLSEC_CRYPTO) \
+ $(DEFAULT_CRYPTO) \
$(ABS_SRCDIR)/tests \
$(ABS_BUILDDIR)/$(TEST_APP) \
der \
@@ -144,7 +144,7 @@ check-enc: $(TEST_APP)
@($(PRECHECK_COMMANDS) && \
$(SHELL) ./tests/testrun.sh \
$(ABS_SRCDIR)/tests/testEnc.sh \
- $(XMLSEC_CRYPTO) \
+ $(DEFAULT_CRYPTO) \
$(ABS_SRCDIR)/tests \
$(ABS_BUILDDIR)/$(TEST_APP) \
der \
@@ -154,7 +154,7 @@ check-xkms: $(TEST_APP)
@($(PRECHECK_COMMANDS) && \
$(SHELL) ./tests/testrun.sh \
$(ABS_SRCDIR)/tests/testXKMS.sh \
- $(XMLSEC_CRYPTO) \
+ $(DEFAULT_CRYPTO) \
$(ABS_SRCDIR)/tests \
$(ABS_BUILDDIR)/$(TEST_APP) \
der \
diff --git a/configure.in b/configure.in
index e3b700c..7154213 100644
--- a/configure.in
+++ b/configure.in
@@ -543,8 +543,8 @@ dnl
dnl 2 overrides 1
dnl
dnl ==========================================================================
-
XMLSEC_NO_NSS="1"
+SEAMONKEY_MIN_VERSION="1.0"
MOZILLA_MIN_VERSION="1.4"
NSS_MIN_VERSION="3.9"
NSPR_MIN_VERSION="4.4.1"
@@ -567,16 +567,22 @@ if test "z$with_nss" = "zno" -o "z$with_nspr" = "zno" ; then
AC_MSG_CHECKING(for NSS libraries)
AC_MSG_RESULT(no)
NSS_FOUND="without"
-elif test "z$with_nss" = "z" -a "z$with_nspr" = "z" -a "z$with_mozilla_ver" = "z" -a "z$PKGCONFIG_FOUND" = "zyes" ; then
+elif test "z$with_nss" = "z" -a "z$with_nspr" = "z" -a "z$with_mozilla_ver" = "z" -a "z$with_seamonkey_ver" = "z" -a "z$PKGCONFIG_FOUND" = "zyes" ; then
dnl
dnl Mozilla's NSS/NSPR are distributed under different names
dnl in different distribution:
+ dnl seamonkey-nspr and seamonkey-nss
dnl mozilla-nspr and mozilla-nss
dnl xulrunner-nspr and xulrunner-nss
dnl nspr and nss
dnl We are going to try all options
dnl
if test "z$NSS_FOUND" = "zno" ; then
+ PKG_CHECK_MODULES(NSS, seamonkey-nspr >= $SEAMONKEY_MIN_VERSION seamonkey-nss >= $SEAMONKEY_MIN_VERSION,
+ [NSS_FOUND=yes NSPR_PACKAGE=seamonkey-nspr NSS_PACKAGE=seamonkey-nss],
+ [NSS_FOUND=no])
+ fi
+ if test "z$NSS_FOUND" = "zno" ; then
PKG_CHECK_MODULES(NSS, mozilla-nspr >= $MOZILLA_MIN_VERSION mozilla-nss >= $MOZILLA_MIN_VERSION,
[NSS_FOUND=yes NSPR_PACKAGE=mozilla-nspr NSS_PACKAGE=mozilla-nss],
[NSS_FOUND=no])
@@ -587,7 +593,7 @@ elif test "z$with_nss" = "z" -a "z$with_nspr" = "z" -a "z$with_mozilla_ver" = "z
[NSS_FOUND=no])
fi
if test "z$NSS_FOUND" = "zno" ; then
- PKG_CHECK_MODULES(NSS, nspr >= $MOZILLA_MIN_VERSION nss >= $MOZILLA_MIN_VERSION,
+ PKG_CHECK_MODULES(NSS, nspr >= $NSPR_MIN_VERSION nss >= $NSS_MIN_VERSION,
[NSS_FOUND=yes NSPR_PACKAGE=nspr NSS_PACKAGE=nss],
[NSS_FOUND=no])
fi
diff --git a/src/gcrypt/app.c b/src/gcrypt/app.c
index 505b602..b911ca6 100644
--- a/src/gcrypt/app.c
+++ b/src/gcrypt/app.c
@@ -20,7 +20,7 @@
#include <xmlsec/gcrypt/app.h>
#include <xmlsec/gcrypt/crypto.h>
-#include "src/gcrypt/asn1.h"
+#include "asn1.h"
/**
* xmlSecGCryptAppInit:
diff --git a/src/gcrypt/asn1.c b/src/gcrypt/asn1.c
index 795d2eb..612fe72 100644
--- a/src/gcrypt/asn1.c
+++ b/src/gcrypt/asn1.c
@@ -18,7 +18,7 @@
#include <xmlsec/gcrypt/crypto.h>
-#include "src/gcrypt/asn1.h"
+#include "asn1.h"
/**************************************************************************
*
diff --git a/src/mscrypto/Makefile.am b/src/mscrypto/Makefile.am
index eaac795..5cea654 100644
--- a/src/mscrypto/Makefile.am
+++ b/src/mscrypto/Makefile.am
@@ -46,10 +46,10 @@ libxmlsec1_mscrypto_la_SOURCES += ../strings.c
endif
libxmlsec1_mscrypto_la_LIBADD = \
- ../libxmlsec1.la \
$(MSCRYPTO_LIBS) \
$(LIBXSLT_LIBS) \
$(LIBXML_LIBS) \
+ ../libxmlsec1.la \
$(NULL)
libxmlsec1_mscrypto_la_DEPENDENCIES = \
diff --git a/src/mscrypto/app.c b/src/mscrypto/app.c
index 2a90b9f..92894d9 100644
--- a/src/mscrypto/app.c
+++ b/src/mscrypto/app.c
@@ -26,10 +26,6 @@
#include <xmlsec/mscrypto/x509.h>
#include "private.h"
-#if defined(__MINGW32__)
-# include "xmlsec-mingw.h"
-#endif
-
/* I don't see any other way then to use a global var to get the
* config info to the mscrypto keysstore :( WK
diff --git a/src/mscrypto/certkeys.c b/src/mscrypto/certkeys.c
index 15cc420..90daa82 100644
--- a/src/mscrypto/certkeys.c
+++ b/src/mscrypto/certkeys.c
@@ -32,10 +32,6 @@
#include <xmlsec/mscrypto/x509.h>
#include "private.h"
-#if defined(__MINGW32__)
-# include "xmlsec-mingw.h"
-#endif
-
// GOST CSP don't support keys duplicating, so we use NT4 analogs for these...
#ifndef XMLSEC_NO_GOST
#ifndef XMLSEC_MSCRYPTO_NT4
diff --git a/src/mscrypto/ciphers.c b/src/mscrypto/ciphers.c
index 0590cbe..ea2edcd 100644
--- a/src/mscrypto/ciphers.c
+++ b/src/mscrypto/ciphers.c
@@ -24,11 +24,6 @@
#include "private.h"
-#if defined(__MINGW32__)
-# include "xmlsec-mingw.h"
-#endif
-
-
/**************************************************************************
*
* Internal MSCrypto Block cipher CTX
diff --git a/src/mscrypto/crypto.c b/src/mscrypto/crypto.c
index 4a45ce7..82ab101 100644
--- a/src/mscrypto/crypto.c
+++ b/src/mscrypto/crypto.c
@@ -26,7 +26,26 @@
#include "private.h"
#if defined(__MINGW32__)
-# include "xmlsec-mingw.h"
+/* NOTE mingw.org project don't define any xxx_s function and may
+ * be never will define them.
+ *
+ * In this file is save to use non _s function as into destination
+ * buffer program code copy empty string and the size of source buffer
+ * (XMLSEC_MSCRYPTO_ERROR_MSG_BUFFER_SIZE=4096) is enough for any
+ * encoding. Also program code don't check result of _s functions.
+ */
+
+static int
+strcpy_s(char *dest, size_t n, const char *src) {
+ strcpy(dest, src);
+ return(0);
+}
+
+static int
+wcscpy_s(wchar_t *dest, size_t n, const wchar_t *src) {
+ wcscpy(dest, src);
+ return(0);
+}
#endif
#define XMLSEC_CONTAINER_NAME_A "xmlsec-key-container"
diff --git a/src/mscrypto/digests.c b/src/mscrypto/digests.c
index 4d0338a..9394afd 100644
--- a/src/mscrypto/digests.c
+++ b/src/mscrypto/digests.c
@@ -88,11 +88,13 @@ static xmlSecMSCryptoProviderInfo xmlSecMSCryptoProviderInfo_Md5[] = {
{ NULL, 0 }
};
+#ifndef XMLSEC_NO_GOST
static xmlSecMSCryptoProviderInfo xmlSecMSCryptoProviderInfo_Gost[] = {
{ MAGPRO_CSP, PROV_MAGPRO_GOST },
{ CRYPTOPRO_CSP, PROV_CRYPTOPRO_GOST },
{ NULL, 0 }
};
+#endif /*ndef XMLSEC_NO_GOST*/
static int
xmlSecMSCryptoDigestCheckId(xmlSecTransformPtr transform) {
diff --git a/src/mscrypto/keysstore.c b/src/mscrypto/keysstore.c
index 8454a79..33f0cd2 100644
--- a/src/mscrypto/keysstore.c
+++ b/src/mscrypto/keysstore.c
@@ -40,10 +40,6 @@
#include <xmlsec/mscrypto/certkeys.h>
#include "private.h"
-#if defined(__MINGW32__)
-# include "xmlsec-mingw.h"
-#endif
-
#define XMLSEC_MSCRYPTO_APP_DEFAULT_CERT_STORE_NAME_A "MY"
#define XMLSEC_MSCRYPTO_APP_DEFAULT_CERT_STORE_NAME_W L"MY"
#ifdef UNICODE
diff --git a/src/mscrypto/kw_aes.c b/src/mscrypto/kw_aes.c
index c9c8344..14e96d5 100644
--- a/src/mscrypto/kw_aes.c
+++ b/src/mscrypto/kw_aes.c
@@ -24,10 +24,6 @@
#include "../kw_aes_des.h"
#include "private.h"
-#if defined(__MINGW32__)
-# include "xmlsec-mingw.h"
-#endif
-
#ifndef XMLSEC_NO_AES
diff --git a/src/mscrypto/kw_des.c b/src/mscrypto/kw_des.c
index c043d28..6ef356d 100644
--- a/src/mscrypto/kw_des.c
+++ b/src/mscrypto/kw_des.c
@@ -30,9 +30,6 @@
#include "../kw_aes_des.h"
#include "private.h"
-#if defined(__MINGW32__)
-# include "xmlsec-mingw.h"
-#endif
/*********************************************************************
*
diff --git a/src/mscrypto/mingw-crypt32.def b/src/mscrypto/mingw-crypt32.def
index e299115..4ba99b2 100644
--- a/src/mscrypto/mingw-crypt32.def
+++ b/src/mscrypto/mingw-crypt32.def
@@ -19,11 +19,13 @@ IMPORTS
CertGetCertificateChain 32 = crypt32.CertGetCertificateChain
CertGetCertificateContextProperty 16 = crypt32.CertGetCertificateContextProperty
CertGetNameStringA 24 = crypt32.CertGetNameStringA
+ CertGetNameStringW 24 = crypt32.CertGetNameStringW
CertGetPublicKeyLength 8 = crypt32.CertGetPublicKeyLength
CertNameToStrA 20 = crypt32.CertNameToStrA
CertNameToStrW 20 = crypt32.CertNameToStrW
CertOpenStore 20 = crypt32.CertOpenStore
CertOpenSystemStoreA 8 = crypt32.CertOpenSystemStoreA
+ CertOpenSystemStoreW 8 = crypt32.CertOpenSystemStoreW
CertStrToNameA 28 = crypt32.CertStrToNameA
CertStrToNameW 28 = crypt32.CertStrToNameW
CertVerifySubjectCertificateContext 12 = crypt32.CertVerifySubjectCertificateContext
diff --git a/src/mscrypto/private.h b/src/mscrypto/private.h
index d56332d..11479bf 100644
--- a/src/mscrypto/private.h
+++ b/src/mscrypto/private.h
@@ -16,6 +16,10 @@
#error "private.h file contains private xmlsec definitions and should not be used outside xmlsec or xmlsec-<crypto> libraries"
#endif /* XMLSEC_PRIVATE */
+#if defined(__MINGW32__)
+# include "xmlsec-mingw.h"
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
diff --git a/src/mscrypto/signatures.c b/src/mscrypto/signatures.c
index 53c10d1..2c51f09 100644
--- a/src/mscrypto/signatures.c
+++ b/src/mscrypto/signatures.c
@@ -30,10 +30,6 @@
#include "private.h"
-#if defined(__MINGW32__)
-# include "xmlsec-mingw.h"
-#endif
-
/**************************************************************************
*
* Internal MSCrypto signatures ctx
diff --git a/src/mscrypto/x509.c b/src/mscrypto/x509.c
index 584f91a..5ae025f 100644
--- a/src/mscrypto/x509.c
+++ b/src/mscrypto/x509.c
@@ -42,10 +42,6 @@
#include <xmlsec/mscrypto/certkeys.h>
#include "private.h"
-#if defined(__MINGW32__)
-# include "xmlsec-mingw.h"
-#endif
-
/*************************************************************************
*
diff --git a/src/mscrypto/x509vfy.c b/src/mscrypto/x509vfy.c
index ab6fe0f..cf31787 100644
--- a/src/mscrypto/x509vfy.c
+++ b/src/mscrypto/x509vfy.c
@@ -35,10 +35,6 @@
#include <xmlsec/mscrypto/x509.h>
#include "private.h"
-#if defined(__MINGW32__)
-# include "xmlsec-mingw.h"
-#endif
-
/**************************************************************************
*
* Internal MSCRYPTO X509 store CTX
diff --git a/src/mscrypto/xmlsec-mingw.h b/src/mscrypto/xmlsec-mingw.h
index 85391e4..ef5d2ae 100644
--- a/src/mscrypto/xmlsec-mingw.h
+++ b/src/mscrypto/xmlsec-mingw.h
@@ -4,14 +4,57 @@
* This is free software; see Copyright file in the source
* distribution for preciese wording.
*
- * Copyright (C) 2007 Roumen Petrov.
+ * Copyright (C) 2007,2010 Roumen Petrov.
*/
#ifndef __XMLSEC_MSCRYPTO_XMLSEC_MINGW_H__
#define __XMLSEC_MSCRYPTO_XMLSEC_MINGW_H__
+#ifndef XMLSEC_PRIVATE
+#error "xmlsec-mingw.h file contains private xmlsec definitions for mingw build and should not be used outside xmlsec or xmlsec-<crypto> libraries"
+#endif /* XMLSEC_PRIVATE */
+
/*defines*/
+
+#ifndef ALG_SID_HMAC
+# define ALG_SID_HMAC 9
+#endif
+
+#ifndef ALG_SID_SHA_256
+# define ALG_SID_SHA_256 12
+#endif
+
+#ifndef ALG_SID_SHA_384
+# define ALG_SID_SHA_384 13
+#endif
+
+#ifndef ALG_SID_SHA_512
+# define ALG_SID_SHA_512 14
+#endif
+
+#ifndef CALG_HMAC
+# define CALG_HMAC (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_HMAC)
+#endif
+
+#ifndef CALG_SHA_256
+# define CALG_SHA_256 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_SHA_256)
+#endif
+
+#ifndef CALG_SHA_384
+# define CALG_SHA_384 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_SHA_384)
+#endif
+
+#ifndef CALG_SHA_512
+# define CALG_SHA_512 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_SHA_512)
+#endif
+
+
+#ifndef KP_OAEP_PARAMS
+# define KP_OAEP_PARAMS 36
+#endif
+
+
#ifndef CERT_CLOSE_STORE_FORCE_FLAG
# define CERT_CLOSE_STORE_FORCE_FLAG 1
#endif
@@ -141,14 +184,6 @@ BOOL WINAPI CertStrToNameW(DWORD,LPCWSTR,DWORD,void*,BYTE*,DWORD*,LPC
#define CertStrToName CertStrToNameA
#endif
-DWORD WINAPI CertNameToStrA(DWORD,PCERT_NAME_BLOB,DWORD,LPCSTR,DWORD);
-DWORD WINAPI CertNameToStrW(DWORD,PCERT_NAME_BLOB,DWORD,LPCWSTR,DWORD);
-#ifdef UNICODE
-#define CertNameToStr CertNameToStrA
-#else
-#define CertNameToStr CertNameToStrW
-#endif
-
BOOL WINAPI CertCompareCertificateName(DWORD,PCERT_NAME_BLOB,PCERT_NAME_BLOB);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]