[PATCH 01/10] dssenh: refactor rsaenh - create new files.

shuai zhang wxsxsdz at gmail.com
Sun Nov 17 09:22:46 CST 2019


Hello everyone,
I'm implementing dssenh. I think the behaviour of dssenh is already
well-understood (at least for CPAcquireContext and CPReleaseContext)
through dssenh/tests. And I guess more than 65% of rsaenh's code can
be reused so I am trying to refactor rsaenh so that those codes can be
used by dssenh. Details are in the patch series (they are mostly
trivial copy/pastes).
Currently implemented CPAcquireContext and CPReleaseContext for dssenh.

Signed-off-by: Zhang Shuai <wxsxsdz at gmail.com>
---
 dlls/rsaenh/Makefile.in        |  3 ++-
 dlls/rsaenh/cryptoprovconfig.h | 31 +++++++++++++++++++++++++++++++
 dlls/rsaenh/cryptoprovutils.c  | 34 ++++++++++++++++++++++++++++++++++
 dlls/rsaenh/cryptoprovutils.h  | 29 +++++++++++++++++++++++++++++
 dlls/rsaenh/rsaenh.c           |  1 +
 5 files changed, 97 insertions(+), 1 deletion(-)
 create mode 100644 dlls/rsaenh/cryptoprovconfig.h
 create mode 100644 dlls/rsaenh/cryptoprovutils.c
 create mode 100644 dlls/rsaenh/cryptoprovutils.h

diff --git a/dlls/rsaenh/Makefile.in b/dlls/rsaenh/Makefile.in
index 80680d6622..dd8574fcaf 100644
--- a/dlls/rsaenh/Makefile.in
+++ b/dlls/rsaenh/Makefile.in
@@ -13,6 +13,7 @@ C_SRCS = \
  rc2.c \
  rc4.c \
  rsa.c \
- rsaenh.c
+ rsaenh.c \
+ cryptoprovutils.c

 RC_SRCS = rsrc.rc
diff --git a/dlls/rsaenh/cryptoprovconfig.h b/dlls/rsaenh/cryptoprovconfig.h
new file mode 100644
index 0000000000..79a93a85f4
--- /dev/null
+++ b/dlls/rsaenh/cryptoprovconfig.h
@@ -0,0 +1,31 @@
+/*
+ * dlls/rsaenh/cryptoprovconfig.h
+ * Definitions of some constants used by crypto provider.
+ * It is copied to build dir then included by cryptoprovutils.h,
+ * the build dir comes first in include search paths.
+ * So a new provider implementation only needs to provide its own
+ * cryptoprovconfig.h.
+ *
+ * Copyright 2002 TransGaming Technologies (David Hammerton)
+ * Copyright 2004 Mike McCormack for CodeWeavers
+ * Copyright 2004, 2005 Michael Jung
+ * Copyright 2007 Vijay Kiran Kamuju
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_CRYPTOPROVCONFIG_H
+#define __WINE_CRYPTOPROVCONFIG_H
+#endif /* __WINE_CRYPTOPROVCONFIG_H */
diff --git a/dlls/rsaenh/cryptoprovutils.c b/dlls/rsaenh/cryptoprovutils.c
new file mode 100644
index 0000000000..76ee7bbe86
--- /dev/null
+++ b/dlls/rsaenh/cryptoprovutils.c
@@ -0,0 +1,34 @@
+/*
+ * dlls/rsaenh/cryptoprovutils.c
+ * Utility functions to implement crypto privider.
+ *
+ * Copyright 2002 TransGaming Technologies (David Hammerton)
+ * Copyright 2004 Mike McCormack for CodeWeavers
+ * Copyright 2004, 2005 Michael Jung
+ * Copyright 2007 Vijay Kiran Kamuju
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "wincrypt.h"
+#include "handle.h"
+#include "cryptoprovutils.h"
+#include "wine/debug.h"
diff --git a/dlls/rsaenh/cryptoprovutils.h b/dlls/rsaenh/cryptoprovutils.h
new file mode 100644
index 0000000000..832b09e4ce
--- /dev/null
+++ b/dlls/rsaenh/cryptoprovutils.h
@@ -0,0 +1,29 @@
+/*
+ * dlls/rsaenh/cryptoprovutils.h
+ * Header of utility functions to implement crypto privider.
+ *
+ * Copyright 2002 TransGaming Technologies (David Hammerton)
+ * Copyright 2004 Mike McCormack for CodeWeavers
+ * Copyright 2004, 2005 Michael Jung
+ * Copyright 2007 Vijay Kiran Kamuju
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_CRYPTOPROVUTILS_H
+#define __WINE_CRYPTOPROVUTILS_H
+#include <cryptoprovconfig.h>
+#include "implglue.h"
+#endif /* __WINE_CRYPTOPROVUTILS_H */
diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c
index 9119d4be2d..f8fbd8071a 100644
--- a/dlls/rsaenh/rsaenh.c
+++ b/dlls/rsaenh/rsaenh.c
@@ -34,6 +34,7 @@
 #include "objbase.h"
 #include "rpcproxy.h"
 #include "aclapi.h"
+#include "cryptoprovutils.h"
 #include "wine/debug.h"

 WINE_DEFAULT_DEBUG_CHANNEL(crypt);
-- 
2.21.0



More information about the wine-devel mailing list