[DRE-commits] [ruby-rbnacl] 01/03: d/p/0006-fix-blake2b_state-struct-size.patch: Add patch from Ubuntu to pad blake2b_state struct declaration for libsodium 1.0.13.

Unit 193 unit193-guest at moszumanska.debian.org
Thu Aug 31 10:42:44 UTC 2017


This is an automated email from the git hooks/post-receive script.

unit193-guest pushed a commit to branch master
in repository ruby-rbnacl.

commit b7a40f2ef1d0d6cc8512885bf3f15a34d11a79dc
Author: Unit 193 <unit193 at ubuntu.com>
Date:   Thu Aug 31 06:26:51 2017 -0400

    d/p/0006-fix-blake2b_state-struct-size.patch: Add patch from Ubuntu to pad blake2b_state struct declaration for libsodium 1.0.13.
    
    Thanks: Steve Langasek for the patch.
    Closes: #871093
---
 .../0006-fix-blake2b_state-struct-size.patch       | 30 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 31 insertions(+)

diff --git a/debian/patches/0006-fix-blake2b_state-struct-size.patch b/debian/patches/0006-fix-blake2b_state-struct-size.patch
new file mode 100644
index 0000000..9b9b7b0
--- /dev/null
+++ b/debian/patches/0006-fix-blake2b_state-struct-size.patch
@@ -0,0 +1,30 @@
+Description: pad blake2b_state struct declaration for libsodium 1.0.13
+ libsodium 1.0.13 includes a bugfix to the alignment of the
+ crypto_generichash_blake2b_state struct, which was supposed to be declared
+ CRYPTO_ALIGN(64).  Non-obviously, this refers to 64 *byte* alignment, not
+ 64 *bit* alignment, and accordingly, initialization functions that try to
+ zero out a struct will walk off the end and scribble on memory if the struct
+ they're passed isn't padded out to a multiple of 64.
+ .
+ The size of this struct rounds up to 384 bytes (6*64).  On a 32-bit system
+ (where sizeof(size_t) == 4), the declared members of the struct only add
+ up to 357 bytes.  Add 27 bytes of padding to our allocated struct, so that
+ we allocate enough memory for either 32-bit or 64-bit architectures.
+ (Ideally we would just declare an alignment for the struct the same as we do
+ in GCC, but this doesn't appear to be supported in ffi.)
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+
+Index: ruby-rbnacl-5.0.0/lib/rbnacl/hash/blake2b.rb
+===================================================================
+--- ruby-rbnacl-5.0.0.orig/lib/rbnacl/hash/blake2b.rb
++++ ruby-rbnacl-5.0.0/lib/rbnacl/hash/blake2b.rb
+@@ -175,7 +175,8 @@
+                :f, [:uint64, 2],
+                :buf, [:uint8, 2 * 128],
+                :buflen, :size_t,
+-               :last_node, :uint8
++               :last_node, :uint8,
++               :padding, [:uint8, 27]
+       end
+     end
+   end
diff --git a/debian/patches/series b/debian/patches/series
index 4e1c902..d01fca6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ disable-devel-gems
 0003-Drop-usage-of-git-in-gemspec.patch
 0004-Drop-gem-dependency-on-rbnacl-libsodium.patch
 0005-Drop-development-dependency-on-bundler.patch
+0006-fix-blake2b_state-struct-size.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-rbnacl.git



More information about the Pkg-ruby-extras-commits mailing list