[Pkg-ocaml-maint-commits] [ocamlnet] 01/02: Add patch from upstream to support Nettle 3.4+
Mehdi Dogguy
mehdi at moszumanska.debian.org
Sat Jan 27 19:37:50 UTC 2018
This is an automated email from the git hooks/post-receive script.
mehdi pushed a commit to branch master
in repository ocamlnet.
commit 20a54b7c635e623dd05da6ab97af8c343f31f46c
Author: Mehdi Dogguy <mehdi at debian.org>
Date: Sat Jan 27 20:22:39 2018 +0100
Add patch from upstream to support Nettle 3.4+
---
debian/changelog | 7 +
debian/patches/0010-Support-for-nettle-3.4.patch | 185 +++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 193 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index df7044e..d8f8dda 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ocamlnet (4.1.2-3) UNRELEASED; urgency=medium
+
+ * Team upload.
+ * Add patch from upstream to support Nettle 3.4+ (Closes: #887577)
+
+ -- Mehdi Dogguy <mehdi at debian.org> Sat, 27 Jan 2018 20:21:39 +0100
+
ocamlnet (4.1.2-2) unstable; urgency=medium
[ Dimitri John Ledkov ]
diff --git a/debian/patches/0010-Support-for-nettle-3.4.patch b/debian/patches/0010-Support-for-nettle-3.4.patch
new file mode 100644
index 0000000..8bae681
--- /dev/null
+++ b/debian/patches/0010-Support-for-nettle-3.4.patch
@@ -0,0 +1,185 @@
+From: Mehdi Dogguy <mehdi at debian.org>
+Date: Sat, 27 Jan 2018 20:19:53 +0100
+Subject: Support for nettle-3.4
+
+Upstream: https://gitlab.camlcity.org/gerd/lib-ocamlnet3/commit/a23ef6b4941243063ae2c1bcc7e08cd839725820
+---
+ src/nettls-gnutls/gnutls.descr | 25 -------------------------
+ src/nettls-gnutls/nettle.c | 19 +++++++++++++++++--
+ src/nettls-gnutls/nettle.descr | 2 ++
+ tools/stubgen.ml | 15 ++++++++++++++-
+ 4 files changed, 33 insertions(+), 28 deletions(-)
+
+diff --git a/src/nettls-gnutls/gnutls.descr b/src/nettls-gnutls/gnutls.descr
+index 4f5708d..68cd1ea 100644
+--- a/src/nettls-gnutls/gnutls.descr
++++ b/src/nettls-gnutls/gnutls.descr
+@@ -29,7 +29,6 @@ let types =
+ "gnutls_x509_crl_t", abstract_ptr "gnutls_x509_crl_deinit";
+ "gnutls_x509_crt_t", abstract_ptr "gnutls_x509_crt_deinit";
+ (* "gnutls_x509_crq_t", `Abstract_ptr; (* in x509.h *) *)
+- "gnutls_openpgp_keyring_t", abstract_ptr "gnutls_openpgp_keyring_deinit";
+ "gnutls_certificate_credentials_t", abstract_ptr "gnutls_certificate_free_credentials";
+ "gnutls_anon_server_credentials_t", abstract_ptr "gnutls_anon_free_server_credentials";
+ "gnutls_anon_client_credentials_t", abstract_ptr "gnutls_anon_free_client_credentials";
+@@ -37,8 +36,6 @@ let types =
+ "gnutls_srp_client_credentials_t", abstract_ptr "gnutls_srp_free_client_credentials";
+ "gnutls_psk_server_credentials_t", abstract_ptr "gnutls_psk_free_server_credentials";
+ "gnutls_psk_client_credentials_t", abstract_ptr "gnutls_psk_free_client_credentials";
+- (* "gnutls_openpgp_crt_t", `Abstract_ptr; *)
+- (* "gnutls_openpgp_privkey_t", `Abstract_ptr; *)
+ (* "gnutls_pkcs11_privkey_t", `Abstract_ptr; *)
+
+ (* "gnutls_datum_t", `Abstract_ptr; *)
+@@ -143,10 +140,6 @@ let types =
+ "?GNUTLS_VERIFY_|DISABLE_CRL_CHECKS";
+ ];
+
+- "gnutls_openpgp_crt_status_t",
+- `Enum [ "GNUTLS_OPENPGP_|CERT";
+- "GNUTLS_OPENPGP_|CERT_FINGERPRINT"
+- ];
+ "gnutls_close_request_t", `Enum [ "GNUTLS_SHUT_|RDWR";
+ "GNUTLS_SHUT_|WR";
+ ];
+@@ -1059,14 +1052,6 @@ let functions =
+ gnutls_x509_crl_t array crl_list, \
+ crl_list array_size crl_list_size)";
+ (* NB: crls are copied by this function *)
+-(*
+- "gnutls_certificate_get_openpgp_keyring",
+- [ "sc", `In, "gnutls_certificate_credentials_t";
+- "keyring", `Out, "gnutls_openpgp_keyring_t";
+- "result", `Return_ignore, "void";
+- ],
+- [ ];
+- *)
+
+
+ (**********************************************************************)
+@@ -1219,16 +1204,6 @@ let functions =
+ uint max_bits, \
+ uint max_depth)";
+
+- (**********************************************************************)
+- (* OpenPGP details *)
+- (**********************************************************************)
+-
+- standard
+- "void gnutls_openpgp_send_cert \
+- (gnutls_session_t session, gnutls_openpgp_crt_status_t status)";
+-
+-
+-
+ (**********************************************************************)
+ (* SRP *)
+ (**********************************************************************)
+diff --git a/src/nettls-gnutls/nettle.c b/src/nettls-gnutls/nettle.c
+index 62f9996..77d00ff 100644
+--- a/src/nettls-gnutls/nettle.c
++++ b/src/nettls-gnutls/nettle.c
+@@ -98,6 +98,7 @@ static const char *net_nettle_cipher_name(net_nettle_cipher_t cipher) {
+ return cipher->name;
+ }
+
++#ifndef HAVE_FUN_nettle_get_ciphers
+ #ifndef HAVE_FUN_nettle_ciphers
+ const struct nettle_cipher * const nettle_ciphers[] = {
+ &nettle_aes128,
+@@ -122,13 +123,19 @@ const struct nettle_cipher * const nettle_ciphers[] = {
+ NULL
+ };
+ #endif
+-
++#endif
+
+ static void net_nettle_ciphers(net_nettle_cipher_t **ciphers,
+ size_t *n) {
+ size_t k;
++ const struct nettle_cipher * const *nciphers;
++#ifdef HAVE_FUN_nettle_get_ciphers
++ nciphers = nettle_get_ciphers();
++#else
++ nciphers = nettle_ciphers;
++#endif
+ k = 0;
+- while (nettle_ciphers[k] != NULL) k++;
++ while (nciphers[k] != NULL) k++;
+ *ciphers = (net_nettle_cipher_t *) nettle_ciphers;
+ *n = k;
+ }
+@@ -337,6 +344,7 @@ static void net_nettle_hash_digest(net_nettle_hash_t hash,
+ hash->digest(ctx, length, dst);
+ }
+
++#ifndef HAVE_FUN_nettle_get_hashes
+ #ifndef HAVE_FUN_nettle_hashes
+ const struct nettle_hash * const nettle_hashes[] = {
+ &nettle_md2,
+@@ -347,10 +355,17 @@ const struct nettle_hash * const nettle_hashes[] = {
+ NULL
+ };
+ #endif
++#endif
+
+ static void net_nettle_hashes(net_nettle_hash_t **hashes,
+ size_t *n) {
+ size_t k;
++ const struct nettle_hash * const *nhashes;
++#ifdef HAVE_FUN_nettle_get_hashes
++ nhashes = nettle_get_hashes();
++#else
++ nhashes = nettle_hashes;
++#endif
+ k = 0;
+ while (nettle_hashes[k] != NULL) k++;
+ *hashes = (net_nettle_hash_t *) nettle_hashes;
+diff --git a/src/nettls-gnutls/nettle.descr b/src/nettls-gnutls/nettle.descr
+index 0320dfb..82d7d9a 100644
+--- a/src/nettls-gnutls/nettle.descr
++++ b/src/nettls-gnutls/nettle.descr
+@@ -137,7 +137,9 @@ let optional_types =
+ [ "nettle_cipher_func" ]
+ let optional_functions =
+ [ "nettle_ciphers"; (* actually a variable *)
++ "nettle_get_ciphers";
+ "nettle_hashes"; (* actually a variable *)
++ "nettle_get_hashes";
+ ]
+
+
+diff --git a/tools/stubgen.ml b/tools/stubgen.ml
+index 2433b23..3cd35c4 100644
+--- a/tools/stubgen.ml
++++ b/tools/stubgen.ml
+@@ -683,8 +683,21 @@ let gen_flags c mli ml tyname cases ~optional =
+ let gen_same_as c mli ml old_tyname tyname =
+ fprintf mli "type %s = %s\n" tyname old_tyname;
+ fprintf ml "type %s = %s\n" tyname old_tyname;
++ (* (* this generates gcc warnings: *)
+ fprintf c "#define wrap_%s wrap_%s\n" tyname old_tyname;
+ fprintf c "#define unwrap_%s unwrap_%s\n" tyname old_tyname
++ *)
++ fprintf c "/************** %s *************/\n\n" tyname;
++ fprintf c "static value wrap_%s(%s x) {\n" tyname tyname;
++ fprintf c " %s y;\n" old_tyname;
++ fprintf c " y = (%s) x;\n" old_tyname;
++ fprintf c " return wrap_%s(y);\n" old_tyname;
++ fprintf c "}\n\n";
++ fprintf c "static %s unwrap_%s(value v) {\n" tyname tyname;
++ fprintf c " %s y;\n" old_tyname;
++ fprintf c " y = unwrap_%s(v);\n" old_tyname;
++ fprintf c " return (%s) y;\n" tyname;
++ fprintf c "}\n\n"
+
+ (**********************************************************************)
+ (* Functions *)
+@@ -804,7 +817,7 @@ let rec translate_type_to_c name ty =
+ | _ ->
+ ty, `Unsupported in
+ let c_ty1 =
+- if is_const then "const " ^ c_ty else c_ty in
++ if is_const && tag <> `Unsupported then "const " ^ c_ty else c_ty in
+ (c_ty1, tag)
+
+
diff --git a/debian/patches/series b/debian/patches/series
index 09c054e..67fa924 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@
0007-Fix-distclean-target.patch
0008-Ship-cmx-files-to-fix-reverse-depends-FTBFS.patch
0009-ocaml-4.05-support-for-O_KEEPEXEC.patch
+0010-Support-for-nettle-3.4.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/ocamlnet.git
More information about the Pkg-ocaml-maint-commits
mailing list