Package: ruby-rbnacl
Version: 5.0.0-1
Followup-For: Bug #871093
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu artful ubuntu-patch autopkgtest

The build failure is caused by a bugfix change in libsodium 1.0.13 that
changed the alignment (and therefore the size) of the blake2b_state struct. 
Please find attached a patch for this issue.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru ruby-rbnacl-5.0.0/debian/patches/fix-blake2b_state-struct-size.patch 
ruby-rbnacl-5.0.0/debian/patches/fix-blake2b_state-struct-size.patch
--- ruby-rbnacl-5.0.0/debian/patches/fix-blake2b_state-struct-size.patch        
1969-12-31 16:00:00.000000000 -0800
+++ ruby-rbnacl-5.0.0/debian/patches/fix-blake2b_state-struct-size.patch        
2017-08-30 21:05:40.000000000 -0700
@@ -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.langa...@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 -Nru ruby-rbnacl-5.0.0/debian/patches/series 
ruby-rbnacl-5.0.0/debian/patches/series
--- ruby-rbnacl-5.0.0/debian/patches/series     2017-07-08 23:57:19.000000000 
-0700
+++ ruby-rbnacl-5.0.0/debian/patches/series     2017-08-30 20:51:40.000000000 
-0700
@@ -3,3 +3,4 @@
 0003-Drop-usage-of-git-in-gemspec.patch
 0004-Drop-gem-dependency-on-rbnacl-libsodium.patch
 0005-Drop-development-dependency-on-bundler.patch
+fix-blake2b_state-struct-size.patch

Reply via email to