mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ci,crypto: fix -cstrict compilation
This commit is contained in:
@@ -87,37 +87,37 @@ fn encrypt_block(l u32, r u32, mut bf Blowfish) []u32 {
|
||||
mut xr := r
|
||||
xl ^= bf.p[0]
|
||||
xr ^= ((bf.s[0][byte(xl >> 24)] + bf.s[1][byte(xl >> 16)]) ^ bf.s[2][byte(xl >> 8)]) +
|
||||
bf.s[3][byte(xl)] ^ bf.p[1]
|
||||
(bf.s[3][byte(xl)] ^ bf.p[1])
|
||||
xl ^= ((bf.s[0][byte(xr >> 24)] + bf.s[1][byte(xr >> 16)]) ^ bf.s[2][byte(xr >> 8)]) +
|
||||
bf.s[3][byte(xr)] ^ bf.p[2]
|
||||
(bf.s[3][byte(xr)] ^ bf.p[2])
|
||||
xr ^= ((bf.s[0][byte(xl >> 24)] + bf.s[1][byte(xl >> 16)]) ^ bf.s[2][byte(xl >> 8)]) +
|
||||
bf.s[3][byte(xl)] ^ bf.p[3]
|
||||
(bf.s[3][byte(xl)] ^ bf.p[3])
|
||||
xl ^= ((bf.s[0][byte(xr >> 24)] + bf.s[1][byte(xr >> 16)]) ^ bf.s[2][byte(xr >> 8)]) +
|
||||
bf.s[3][byte(xr)] ^ bf.p[4]
|
||||
(bf.s[3][byte(xr)] ^ bf.p[4])
|
||||
xr ^= ((bf.s[0][byte(xl >> 24)] + bf.s[1][byte(xl >> 16)]) ^ bf.s[2][byte(xl >> 8)]) +
|
||||
bf.s[3][byte(xl)] ^ bf.p[5]
|
||||
(bf.s[3][byte(xl)] ^ bf.p[5])
|
||||
xl ^= ((bf.s[0][byte(xr >> 24)] + bf.s[1][byte(xr >> 16)]) ^ bf.s[2][byte(xr >> 8)]) +
|
||||
bf.s[3][byte(xr)] ^ bf.p[6]
|
||||
(bf.s[3][byte(xr)] ^ bf.p[6])
|
||||
xr ^= ((bf.s[0][byte(xl >> 24)] + bf.s[1][byte(xl >> 16)]) ^ bf.s[2][byte(xl >> 8)]) +
|
||||
bf.s[3][byte(xl)] ^ bf.p[7]
|
||||
(bf.s[3][byte(xl)] ^ bf.p[7])
|
||||
xl ^= ((bf.s[0][byte(xr >> 24)] + bf.s[1][byte(xr >> 16)]) ^ bf.s[2][byte(xr >> 8)]) +
|
||||
bf.s[3][byte(xr)] ^ bf.p[8]
|
||||
(bf.s[3][byte(xr)] ^ bf.p[8])
|
||||
xr ^= ((bf.s[0][byte(xl >> 24)] + bf.s[1][byte(xl >> 16)]) ^ bf.s[2][byte(xl >> 8)]) +
|
||||
bf.s[3][byte(xl)] ^ bf.p[9]
|
||||
(bf.s[3][byte(xl)] ^ bf.p[9])
|
||||
xl ^= ((bf.s[0][byte(xr >> 24)] + bf.s[1][byte(xr >> 16)]) ^ bf.s[2][byte(xr >> 8)]) +
|
||||
bf.s[3][byte(xr)] ^ bf.p[10]
|
||||
(bf.s[3][byte(xr)] ^ bf.p[10])
|
||||
xr ^= ((bf.s[0][byte(xl >> 24)] + bf.s[1][byte(xl >> 16)]) ^ bf.s[2][byte(xl >> 8)]) +
|
||||
bf.s[3][byte(xl)] ^ bf.p[11]
|
||||
(bf.s[3][byte(xl)] ^ bf.p[11])
|
||||
xl ^= ((bf.s[0][byte(xr >> 24)] + bf.s[1][byte(xr >> 16)]) ^ bf.s[2][byte(xr >> 8)]) +
|
||||
bf.s[3][byte(xr)] ^ bf.p[12]
|
||||
(bf.s[3][byte(xr)] ^ bf.p[12])
|
||||
xr ^= ((bf.s[0][byte(xl >> 24)] + bf.s[1][byte(xl >> 16)]) ^ bf.s[2][byte(xl >> 8)]) +
|
||||
bf.s[3][byte(xl)] ^ bf.p[13]
|
||||
(bf.s[3][byte(xl)] ^ bf.p[13])
|
||||
xl ^= ((bf.s[0][byte(xr >> 24)] + bf.s[1][byte(xr >> 16)]) ^ bf.s[2][byte(xr >> 8)]) +
|
||||
bf.s[3][byte(xr)] ^ bf.p[14]
|
||||
(bf.s[3][byte(xr)] ^ bf.p[14])
|
||||
xr ^= ((bf.s[0][byte(xl >> 24)] + bf.s[1][byte(xl >> 16)]) ^ bf.s[2][byte(xl >> 8)]) +
|
||||
bf.s[3][byte(xl)] ^ bf.p[15]
|
||||
(bf.s[3][byte(xl)] ^ bf.p[15])
|
||||
xl ^= ((bf.s[0][byte(xr >> 24)] + bf.s[1][byte(xr >> 16)]) ^ bf.s[2][byte(xr >> 8)]) +
|
||||
bf.s[3][byte(xr)] ^ bf.p[16]
|
||||
(bf.s[3][byte(xr)] ^ bf.p[16])
|
||||
xr ^= bf.p[17]
|
||||
return [xl, xr]
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ pub mut:
|
||||
}
|
||||
|
||||
pub fn new_cipher(key []byte) ?Blowfish {
|
||||
mut bf := Blowfish{p, s}
|
||||
mut bf := Blowfish{}
|
||||
unsafe { vmemcpy(&bf.p[0], &p[0], int(sizeof(bf.p))) }
|
||||
unsafe { vmemcpy(&bf.s[0], &s[0], int(sizeof(bf.s))) }
|
||||
if key.len < 1 || key.len > 56 {
|
||||
return error('invalid key')
|
||||
}
|
||||
@@ -20,7 +22,9 @@ pub fn new_salted_cipher(key []byte, salt []byte) ?Blowfish {
|
||||
if salt.len == 0 {
|
||||
return new_cipher(key)
|
||||
}
|
||||
mut bf := Blowfish{p, s}
|
||||
mut bf := Blowfish{}
|
||||
unsafe { vmemcpy(&bf.p[0], &p[0], int(sizeof(bf.p))) }
|
||||
unsafe { vmemcpy(&bf.s[0], &s[0], int(sizeof(bf.s))) }
|
||||
if key.len < 1 {
|
||||
return error('invalid key')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user