tem_ruby 0.11 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/lib/tem/definitions/isa.rb +1 -0
- data/lib/tem/secpack.rb +15 -4
- data/tem_ruby.gemspec +2 -2
- data/test/tem_unit/test_tem_bound_secpack.rb +12 -2
- data/test/tem_unit/test_tem_branching.rb +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/tem/definitions/isa.rb
CHANGED
data/lib/tem/secpack.rb
CHANGED
@@ -111,16 +111,27 @@ class Tem::SecPack
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
-
# Methods for interacting with the plaintext content of a SECpack.
|
115
|
-
|
116
|
-
def
|
114
|
+
# Methods for interacting with the plaintext content of a SECpack.
|
115
|
+
|
116
|
+
def get_bytes(label, byte_count)
|
117
|
+
expand_extra_bytes
|
118
|
+
raise "Unknown label #{label}" unless addr = @labels[label]
|
119
|
+
bytes = @body[addr, byte_count]
|
120
|
+
#trim_extra_bytes
|
121
|
+
bytes
|
122
|
+
end
|
123
|
+
|
124
|
+
def set_bytes(label, bytes)
|
117
125
|
expand_extra_bytes
|
118
126
|
raise "Unknown label #{label}" unless addr = @labels[label]
|
119
|
-
bytes = Tem::Abi.send :"to_#{abi_type}", value
|
120
127
|
@body[addr, bytes.length] = bytes
|
121
128
|
#trim_extra_bytes
|
122
129
|
end
|
123
130
|
|
131
|
+
def set_value(label, abi_type, value)
|
132
|
+
set_bytes label, Tem::Abi.send(:"to_#{abi_type}", value)
|
133
|
+
end
|
134
|
+
|
124
135
|
def get_value(label, abi_type)
|
125
136
|
expand_extra_bytes
|
126
137
|
raise "Unknown label #{label}" unless addr = @labels[label]
|
data/tem_ruby.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{tem_ruby}
|
5
|
-
s.version = "0.11"
|
5
|
+
s.version = "0.11.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Victor Costan"]
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Tem_ruby", "--main", "README"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{tem}
|
19
|
-
s.rubygems_version = %q{1.3.
|
19
|
+
s.rubygems_version = %q{1.3.4}
|
20
20
|
s.summary = %q{TEM (Trusted Execution Module) driver, written in and for ruby.}
|
21
21
|
s.test_files = ["test/builders/test_abi_builder.rb", "test/tem_unit/test_tem_alu.rb", "test/tem_unit/test_tem_bound_secpack.rb", "test/tem_unit/test_tem_branching.rb", "test/tem_unit/test_tem_crypto_asymmetric.rb", "test/tem_unit/test_tem_crypto_hash.rb", "test/tem_unit/test_tem_crypto_pstore.rb", "test/tem_unit/test_tem_crypto_random.rb", "test/tem_unit/test_tem_emit.rb", "test/tem_unit/test_tem_memory.rb", "test/tem_unit/test_tem_memory_compare.rb", "test/tem_unit/test_tem_output.rb", "test/tem_unit/test_tem_yaml_secpack.rb", "test/test_driver.rb", "test/test_exceptions.rb", "test/transport/test_auto_configurator.rb", "test/transport/test_java_card_mixin.rb", "test/transport/test_jcop_remote.rb"]
|
22
22
|
|
@@ -42,8 +42,18 @@ module TemBoundSecpackTestCase
|
|
42
42
|
assert_equal 0, bound_sec.get_value(:plain, :tem_ushort),
|
43
43
|
'SecPack plaintext corrupted during binding'
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
# HACK: cheating knowing that yaml_roundtrip will be false and true to
|
46
|
+
# test both set_value/get_value and set_bytes/get_bytes
|
47
|
+
if yaml_roundtrip
|
48
|
+
bound_sec.set_value :mess_place, :tem_ubyte,
|
49
|
+
bound_sec.get_value(:mess_place, :tem_ubyte) + 1
|
50
|
+
else
|
51
|
+
bytes = bound_sec.get_bytes(:mess_place, 4)
|
52
|
+
bytes[0] += 1
|
53
|
+
assert_equal 4, bytes.length, "get_bytes didn't find 4 bytes to mess with"
|
54
|
+
bound_sec.set_bytes :mess_place, bytes
|
55
|
+
end
|
56
|
+
|
47
57
|
assert_raise(RuntimeError, "secpack validation isn't working") do
|
48
58
|
@tem.execute bound_sec
|
49
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tem_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Costan
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
requirements: []
|
187
187
|
|
188
188
|
rubyforge_project: tem
|
189
|
-
rubygems_version: 1.3.
|
189
|
+
rubygems_version: 1.3.4
|
190
190
|
signing_key:
|
191
191
|
specification_version: 3
|
192
192
|
summary: TEM (Trusted Execution Module) driver, written in and for ruby.
|