Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/encoders/riscv32le/byte_xori.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def initialize
# the buffer being encoded.
#
def decoder_stub(state)
if state.badchars.to_s.include?("\x00")
if state.badchars.to_s.include?("\x00".b)
raise EncodingError, 'The RISC-V decoder stub inherently contains null bytes (auipc, ecall)'
end

Expand Down
4 changes: 2 additions & 2 deletions modules/encoders/riscv32le/longxor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def initialize
# the buffer being encoded.
#
def decoder_stub(state)
if state.badchars.to_s.include?("\x00")
if state.badchars.to_s.include?("\x00".b)
raise EncodingError, 'The RISC-V decoder stub inherently contains null bytes (auipc, ecall)'
end

Expand Down Expand Up @@ -84,7 +84,7 @@ def decoder_stub(state)
].pack('V*')

state.decoder_key_offset = decoder.length
decoder + "\x00\x00\x00\x00"
decoder + "\x00\x00\x00\x00".b
end

private
Expand Down
6 changes: 3 additions & 3 deletions modules/encoders/riscv32le/longxor_feedback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def initialize
# the buffer being encoded.
#
def decoder_stub(state)
if state.badchars.to_s.include?("\x00")
if state.badchars.to_s.include?("\x00".b)
raise EncodingError, 'The RISC-V decoder stub inherently contains null bytes (auipc, ecall)'
end

Expand Down Expand Up @@ -89,7 +89,7 @@ def decoder_stub(state)
].pack('V*')

state.decoder_key_offset = decoder.length
decoder + "\x00\x00\x00\x00"
decoder + "\x00\x00\x00\x00".b
end

#
Expand Down Expand Up @@ -120,7 +120,7 @@ def find_key_verify(buf, key_bytes, badchars)
feedback = key_bytes_to_integer(key_bytes)

buf.bytes.each_slice(4) do |bytes|
block = bytes.pack('C*').ljust(4, "\x00")
block = bytes.pack('C*').ljust(4, "\x00".b)
encoded_val = block.unpack1('V') ^ feedback
return false unless has_badchars?([encoded_val].pack('V'), badchars).nil?

Expand Down
4 changes: 2 additions & 2 deletions modules/encoders/riscv32le/longxor_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def initialize
# the buffer being encoded.
#
def decoder_stub(state)
if state.badchars.to_s.include?("\x00")
if state.badchars.to_s.include?("\x00".b)
raise EncodingError, 'The RISC-V decoder stub inherently contains null bytes (auipc, ecall)'
end

Expand Down Expand Up @@ -92,7 +92,7 @@ def decoder_stub(state)
].pack('V*')

state.decoder_key_offset = decoder.length
decoder + "\x00\x00\x00\x00"
decoder + "\x00\x00\x00\x00".b
end

#
Expand Down
2 changes: 1 addition & 1 deletion modules/encoders/riscv64le/byte_xori.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def initialize
# the buffer being encoded.
#
def decoder_stub(state)
if state.badchars.to_s.include?("\x00")
if state.badchars.to_s.include?("\x00".b)
raise EncodingError, 'The RISC-V decoder stub inherently contains null bytes (auipc, ecall)'
end

Expand Down
4 changes: 2 additions & 2 deletions modules/encoders/riscv64le/longxor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def initialize
# the buffer being encoded.
#
def decoder_stub(state)
if state.badchars.to_s.include?("\x00")
if state.badchars.to_s.include?("\x00".b)
raise EncodingError, 'The RISC-V decoder stub inherently contains null bytes (auipc, ecall)'
end

Expand Down Expand Up @@ -84,7 +84,7 @@ def decoder_stub(state)
].pack('V*')

state.decoder_key_offset = decoder.length
decoder + "\x00\x00\x00\x00"
decoder + "\x00\x00\x00\x00".b
end

private
Expand Down
6 changes: 3 additions & 3 deletions modules/encoders/riscv64le/longxor_feedback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def initialize
# the buffer being encoded.
#
def decoder_stub(state)
if state.badchars.to_s.include?("\x00")
if state.badchars.to_s.include?("\x00".b)
raise EncodingError, 'The RISC-V decoder stub inherently contains null bytes (auipc, ecall)'
end

Expand Down Expand Up @@ -89,7 +89,7 @@ def decoder_stub(state)
].pack('V*')

state.decoder_key_offset = decoder.length
decoder + "\x00\x00\x00\x00"
decoder + "\x00\x00\x00\x00".b
end

#
Expand Down Expand Up @@ -120,7 +120,7 @@ def find_key_verify(buf, key_bytes, badchars)
feedback = key_bytes_to_integer(key_bytes)

buf.bytes.each_slice(4) do |bytes|
block = bytes.pack('C*').ljust(4, "\x00")
block = bytes.pack('C*').ljust(4, "\x00".b)
encoded_val = block.unpack1('V') ^ feedback
return false unless has_badchars?([encoded_val].pack('V'), badchars).nil?

Expand Down
4 changes: 2 additions & 2 deletions modules/encoders/riscv64le/longxor_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def initialize
# the buffer being encoded.
#
def decoder_stub(state)
if state.badchars.to_s.include?("\x00")
if state.badchars.to_s.include?("\x00".b)
raise EncodingError, 'The RISC-V decoder stub inherently contains null bytes (auipc, ecall)'
end

Expand Down Expand Up @@ -92,7 +92,7 @@ def decoder_stub(state)
].pack('V*')

state.decoder_key_offset = decoder.length
decoder + "\x00\x00\x00\x00"
decoder + "\x00\x00\x00\x00".b
end

#
Expand Down
6 changes: 6 additions & 0 deletions spec/modules/encoders/riscv32le/byte_xori_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'spec_helper'
require_relative '../riscv_xor_encoder_examples'

RSpec.describe 'modules/encoders/riscv32le/byte_xori' do
it_behaves_like 'riscv byte_xori encoder', 'riscv32le/byte_xori'
end
6 changes: 6 additions & 0 deletions spec/modules/encoders/riscv32le/longxor_feedback_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'spec_helper'
require_relative '../riscv_xor_encoder_examples'

RSpec.describe 'modules/encoders/riscv32le/longxor_feedback' do
it_behaves_like 'riscv longxor_feedback encoder', 'riscv32le/longxor_feedback'
end
6 changes: 6 additions & 0 deletions spec/modules/encoders/riscv32le/longxor_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'spec_helper'
require_relative '../riscv_xor_encoder_examples'

RSpec.describe 'modules/encoders/riscv32le/longxor' do
it_behaves_like 'riscv longxor encoder', 'riscv32le/longxor'
end
6 changes: 6 additions & 0 deletions spec/modules/encoders/riscv32le/longxor_tag_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'spec_helper'
require_relative '../riscv_xor_encoder_examples'

RSpec.describe 'modules/encoders/riscv32le/longxor_tag' do
it_behaves_like 'riscv longxor_tag encoder', 'riscv32le/longxor_tag'
end
6 changes: 6 additions & 0 deletions spec/modules/encoders/riscv64le/byte_xori_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'spec_helper'
require_relative '../riscv_xor_encoder_examples'

RSpec.describe 'modules/encoders/riscv64le/byte_xori' do
it_behaves_like 'riscv byte_xori encoder', 'riscv64le/byte_xori'
end
6 changes: 6 additions & 0 deletions spec/modules/encoders/riscv64le/longxor_feedback_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'spec_helper'
require_relative '../riscv_xor_encoder_examples'

RSpec.describe 'modules/encoders/riscv64le/longxor_feedback' do
it_behaves_like 'riscv longxor_feedback encoder', 'riscv64le/longxor_feedback'
end
6 changes: 6 additions & 0 deletions spec/modules/encoders/riscv64le/longxor_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'spec_helper'
require_relative '../riscv_xor_encoder_examples'

RSpec.describe 'modules/encoders/riscv64le/longxor' do
it_behaves_like 'riscv longxor encoder', 'riscv64le/longxor'
end
6 changes: 6 additions & 0 deletions spec/modules/encoders/riscv64le/longxor_tag_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'spec_helper'
require_relative '../riscv_xor_encoder_examples'

RSpec.describe 'modules/encoders/riscv64le/longxor_tag' do
it_behaves_like 'riscv longxor_tag encoder', 'riscv64le/longxor_tag'
end
Loading
Loading