milenage 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/milenage/version.rb +1 -1
- data/lib/milenage.rb +7 -7
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a58308dce3a4bfd0782b478c4017bba1b6b782c7
|
4
|
+
data.tar.gz: 94933fbdcdeb6511d61322cfe4bdac97caa2d489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d174c7a74b5fc4f7ba80059d3ede6ccc19f1be33d3df984cb788c5735ff77b64fe97e254edfc94837b69d080ca66ab8e62d2fc2cfc5280e5b28017813e16617
|
7
|
+
data.tar.gz: e391e215150a6a1805286999a6affbfd5f389c20369a25673ce2917e2cf50b2866105a73428c4f98567361fd37811973b206054bc1f897cf40816da3479c8b13
|
data/README.md
CHANGED
data/lib/milenage/version.rb
CHANGED
data/lib/milenage.rb
CHANGED
@@ -45,7 +45,7 @@ module Milenage
|
|
45
45
|
# the same API as `OpenSSL::Cipher`, if this is not the case, you may
|
46
46
|
# need to overload {#enc} as well to match the API.
|
47
47
|
def initialize(key)
|
48
|
-
fail "KEY must be 128 bits" unless key.
|
48
|
+
fail "KEY must be 128 bits" unless key.each_byte.to_a.length == 16
|
49
49
|
@key = key
|
50
50
|
@c = [0, 1, 2, 4, 8].map { |i| [0, i].pack("Q>2") }
|
51
51
|
@r = [64, 0, 32, 64, 96]
|
@@ -57,7 +57,7 @@ module Milenage
|
|
57
57
|
# Either this or {#opc=} must be called before any of the security
|
58
58
|
# functions are evaluated.
|
59
59
|
def op=(op)
|
60
|
-
fail "OP must be 128 bits" unless op.
|
60
|
+
fail "OP must be 128 bits" unless op.each_byte.to_a.length == 16
|
61
61
|
@opc = xor(enc(op), op)
|
62
62
|
end
|
63
63
|
|
@@ -68,7 +68,7 @@ module Milenage
|
|
68
68
|
# Either this or {#op=} must be called before any of the security
|
69
69
|
# functions are evaluated.
|
70
70
|
def opc=(opc)
|
71
|
-
fail "OPc must be 128 bits" unless opc.
|
71
|
+
fail "OPc must be 128 bits" unless opc.each_byte.to_a.length == 16
|
72
72
|
@opc = opc
|
73
73
|
end
|
74
74
|
|
@@ -124,14 +124,14 @@ module Milenage
|
|
124
124
|
|
125
125
|
def step_0(rand)
|
126
126
|
fail "Must set OP or OPc before calculating hashes" unless @opc
|
127
|
-
fail "RAND must be 128 bits" unless rand.
|
127
|
+
fail "RAND must be 128 bits" unless rand.each_byte.to_a.length == 16
|
128
128
|
enc(xor(rand, @opc))
|
129
129
|
end
|
130
130
|
|
131
131
|
def step_a(rand, sqn, amf)
|
132
132
|
fail "Must set OP or OPc before calculating hashes" unless @opc
|
133
|
-
fail "SQN must be 48 bits" unless sqn.
|
134
|
-
fail "AMF must be 16 bits" unless amf.
|
133
|
+
fail "SQN must be 48 bits" unless sqn.each_byte.to_a.length == 6
|
134
|
+
fail "AMF must be 16 bits" unless amf.each_byte.to_a.length == 2
|
135
135
|
tmp = (sqn + amf + sqn + amf)
|
136
136
|
tmp = xor(tmp, @opc)
|
137
137
|
tmp = roll(tmp, @r[0])
|
@@ -170,7 +170,7 @@ module Milenage
|
|
170
170
|
end
|
171
171
|
|
172
172
|
def xor(a, b)
|
173
|
-
a.
|
173
|
+
a.each_byte.to_a.zip(b.bytes).map do |a, b|
|
174
174
|
a ^ b
|
175
175
|
end.pack("c*")
|
176
176
|
end
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: milenage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Caldwell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: yard
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Ruby implementation of the Milenage algorithm
|
@@ -73,7 +73,7 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
76
|
+
- ".gitignore"
|
77
77
|
- Gemfile
|
78
78
|
- LICENSE.txt
|
79
79
|
- README.md
|
@@ -92,12 +92,12 @@ require_paths:
|
|
92
92
|
- lib
|
93
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|