Skip to content

Commit d23c2a5

Browse files
committed
Merge pull request #81 from ebfe/fix-build-master
Fix build with rust master
2 parents 196f4b1 + a317456 commit d23c2a5

File tree

10 files changed

+14
-19
lines changed

10 files changed

+14
-19
lines changed

src/rust-crypto/aessafe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ define_aes_enc_x8!(AesSafe256EncryptorX8, 14)
321321
define_aes_dec_x8!(AesSafe256DecryptorX8, 14)
322322

323323
fn rotate(r: u32, rotate: u32) -> u32 {
324-
return (r >> rotate) | (r << (32 - rotate));
324+
return (r >> rotate as uint) | (r << (32 - rotate) as uint);
325325
}
326326

327327
fn ffmulx(x: u32) -> u32 {

src/rust-crypto/bcrypt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn bcrypt(cost: uint, salt: &[u8], password: &[u8], output: &mut [u8]) {
2929
// OrpheanBeholderScryDoubt
3030
let mut ctext = [0x4f727068, 0x65616e42, 0x65686f6c, 0x64657253, 0x63727944, 0x6f756274];
3131
for i in range_step(0u, 6u, 2u) {
32-
for _ in range(0, 64) {
32+
for _ in range(0u, 64) {
3333
let (l, r) = state.encrypt(ctext[i], ctext[i+1]);
3434
ctext[i] = l;
3535
ctext[i+1] = r;

src/rust-crypto/bcrypt_pbkdf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn bcrypt_hash(hpass: &[u8], hsalt: &[u8], output: &mut [u8, ..32]) {
1414
let mut bf = Blowfish::init_state();
1515
bf.salted_expand_key(hsalt, hpass);
1616

17-
for _ in range(0, 64) {
17+
for _ in range(0u, 64) {
1818
bf.expand_key(hsalt);
1919
bf.expand_key(hpass);
2020
}
@@ -23,7 +23,7 @@ fn bcrypt_hash(hpass: &[u8], hsalt: &[u8], output: &mut [u8, ..32]) {
2323
read_u32v_be(buf, b"OxychromaticBlowfishSwatDynamite");
2424

2525
for i in range_step(0u, 8, 2) {
26-
for _ in range(0, 64) {
26+
for _ in range(0u, 64) {
2727
let (l, r) = bf.encrypt(buf[i], buf[i+1]);
2828
buf[i] = l;
2929
buf[i+1] = r;

src/rust-crypto/blockmodes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ mod test {
11551155
rng2.gen_range(0, max_size)
11561156
};
11571157

1158-
for _ in range(0, 1000) {
1158+
for _ in range(0u, 1000) {
11591159
let mut enc = new_enc();
11601160
let mut dec = new_dec();
11611161

src/rust-crypto/chacha20.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl ChaCha20 {
7272
fn update(&mut self) {
7373
let mut x = self.state;
7474

75-
for _ in range(0, 10) {
75+
for _ in range(0u, 10) {
7676
quater_round!(x[0], x[4], x[ 8], x[12]);
7777
quater_round!(x[1], x[5], x[ 9], x[13]);
7878
quater_round!(x[2], x[6], x[10], x[14]);

src/rust-crypto/digest.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::num::ToStrRadix;
12-
1311
/**
1412
* The Digest trait specifies an interface common to digest functions, such as SHA-1 and the SHA-2
1513
* family of digest functions.
@@ -81,10 +79,7 @@ pub trait Digest {
8179
fn to_hex(rr: &[u8]) -> String {
8280
let mut s = String::new();
8381
for b in rr.iter() {
84-
let hex = (*b as uint).to_str_radix(16u);
85-
if hex.len() == 1 {
86-
s.push_char('0');
87-
}
82+
let hex = format!("{:02x}", *b);
8883
s.push_str(hex.as_slice());
8984
}
9085
return s;

src/rust-crypto/md5.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl Md5State {
5757
}
5858

5959
fn rotate_left(x: u32, n: u32) -> u32 {
60-
return (x << n) | (x >> (32 - n));
60+
return (x << n as uint) | (x >> (32 - n as uint));
6161
}
6262

6363
fn op_f(w: u32, x: u32, y: u32, z: u32, m: u32, s: u32) -> u32 {

src/rust-crypto/salsa20.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl Salsa20 {
137137
let mut z = [0u32, ..16];
138138
read_u32v_le(x.as_mut_slice(), self.state);
139139
read_u32v_le(z.as_mut_slice(), self.state);
140-
for _ in range(0, 10) {
140+
for _ in range(0u, 10) {
141141
doubleround(&mut z);
142142
}
143143
for i in range(0u, 16) {
@@ -151,7 +151,7 @@ impl Salsa20 {
151151
fn hsalsa20_hash(&mut self) {
152152
let mut x = [0u32, ..16];
153153
read_u32v_le(x.as_mut_slice(), self.state);
154-
for _ in range(0, 10) {
154+
for _ in range(0u, 10) {
155155
doubleround(&mut x);
156156
}
157157
for i in range(0u, 16) {

src/rust-crypto/scrypt.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn salsa20_8(input: &[u8], output: &mut [u8]) {
4343
} }
4444
)
4545

46-
for _ in range(0, rounds / 2) {
46+
for _ in range(0u, rounds / 2) {
4747
run_round!(
4848
0x4, 0x0, 0xc, 7;
4949
0x8, 0x4, 0x0, 9;
@@ -168,7 +168,7 @@ impl ScryptParams {
168168
assert!(log_n > 0);
169169
assert!((log_n as uint) < size_of::<uint>() * 8);
170170

171-
let n = 1u32 << log_n;
171+
let n = 1u32 << log_n as uint;
172172

173173
let rp = match r.checked_mul(&p) {
174174
Some(x) => x,
@@ -232,7 +232,7 @@ pub fn scrypt(password: &[u8], salt: &[u8], params: &ScryptParams, output: &mut
232232
assert!(output.len() / 32 <= 0xffffffff);
233233

234234
// The checks in the ScryptParams constructor guarantee that the following is safe:
235-
let n = 1u << params.log_n;
235+
let n = 1u << params.log_n as uint;
236236
let r = params.r as uint;
237237
let p = params.p as uint;
238238

src/rust-crypto/sha1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn process_msg_block(data: &[u8], h: &mut [u32, ..DIGEST_BUF_LEN]) {
125125
}
126126

127127
fn circular_shift(bits: u32, word: u32) -> u32 {
128-
return word << bits | word >> 32u32 - bits;
128+
return word << bits as uint | word >> (32u32 - bits) as uint;
129129
}
130130

131131
fn mk_result(st: &mut Sha1, rs: &mut [u8]) {

0 commit comments

Comments
 (0)