diff options
author | Fabiano FidĂȘncio <fidencio@redhat.com> | 2015-09-16 23:24:44 +0200 |
---|---|---|
committer | Fabiano FidĂȘncio <fidencio@redhat.com> | 2016-01-19 11:31:07 +0100 |
commit | 63e52afd5b9a378918ea3591e2da8fe78c201407 (patch) | |
tree | 9d90a3b4a9d61fa4c90b815ef37da83a04fabc12 /src/external | |
parent | 6f60449e184ef8066c2c5bd5ad165cbde507aa92 (diff) | |
download | libssh-63e52afd5b9a378918ea3591e2da8fe78c201407.tar.gz libssh-63e52afd5b9a378918ea3591e2da8fe78c201407.tar.xz libssh-63e52afd5b9a378918ea3591e2da8fe78c201407.zip |
cleanup: use ssh_ prefix in the blf (non-static) functions
Having "ssh_" prefix in the functions' name will avoid possible clashes
when compiling libssh statically.
Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/external')
-rw-r--r-- | src/external/bcrypt_pbkdf.c | 4 | ||||
-rw-r--r-- | src/external/blowfish.c | 42 |
2 files changed, 23 insertions, 23 deletions
diff --git a/src/external/bcrypt_pbkdf.c b/src/external/bcrypt_pbkdf.c index 4cca9d8b..00314c21 100644 --- a/src/external/bcrypt_pbkdf.c +++ b/src/external/bcrypt_pbkdf.c @@ -63,7 +63,7 @@ static void bcrypt_hash(uint8_t *sha2pass, uint8_t *sha2salt, uint8_t *out) { - blf_ctx state; + ssh_blf_ctx state; uint8_t ciphertext[BCRYPT_HASHSIZE] = "OxychromaticBlowfishSwatDynamite"; uint32_t cdata[BCRYPT_BLOCKS]; @@ -85,7 +85,7 @@ bcrypt_hash(uint8_t *sha2pass, uint8_t *sha2salt, uint8_t *out) cdata[i] = Blowfish_stream2word(ciphertext, sizeof(ciphertext), &j); for (i = 0; i < 64; i++) - blf_enc(&state, cdata, sizeof(cdata) / sizeof(uint64_t)); + ssh_blf_enc(&state, cdata, sizeof(cdata) / sizeof(uint64_t)); /* copy out */ for (i = 0; i < BCRYPT_BLOCKS; i++) { diff --git a/src/external/blowfish.c b/src/external/blowfish.c index 99f9cc31..4008a9c0 100644 --- a/src/external/blowfish.c +++ b/src/external/blowfish.c @@ -70,7 +70,7 @@ #define BLFRND(s,p,i,j,n) (i ^= F(s,j) ^ (p)[n]) void -Blowfish_encipher(blf_ctx *c, uint32_t *xl, uint32_t *xr) +Blowfish_encipher(ssh_blf_ctx *c, uint32_t *xl, uint32_t *xr) { uint32_t Xl; uint32_t Xr; @@ -95,7 +95,7 @@ Blowfish_encipher(blf_ctx *c, uint32_t *xl, uint32_t *xr) } void -Blowfish_decipher(blf_ctx *c, uint32_t *xl, uint32_t *xr) +Blowfish_decipher(ssh_blf_ctx *c, uint32_t *xl, uint32_t *xr) { uint32_t Xl; uint32_t Xr; @@ -120,11 +120,11 @@ Blowfish_decipher(blf_ctx *c, uint32_t *xl, uint32_t *xr) } void -Blowfish_initstate(blf_ctx *c) +Blowfish_initstate(ssh_blf_ctx *c) { /* P-box and S-box tables initialized with digits of Pi */ - static const blf_ctx initstate = + static const ssh_blf_ctx initstate = { { { 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, @@ -420,7 +420,7 @@ Blowfish_stream2word(const uint8_t *data, uint16_t databytes, } void -Blowfish_expand0state(blf_ctx *c, const uint8_t *key, uint16_t keybytes) +Blowfish_expand0state(ssh_blf_ctx *c, const uint8_t *key, uint16_t keybytes) { uint16_t i; uint16_t j; @@ -458,7 +458,7 @@ Blowfish_expand0state(blf_ctx *c, const uint8_t *key, uint16_t keybytes) void -Blowfish_expandstate(blf_ctx *c, const uint8_t *data, uint16_t databytes, +Blowfish_expandstate(ssh_blf_ctx *c, const uint8_t *data, uint16_t databytes, const uint8_t *key, uint16_t keybytes) { uint16_t i; @@ -501,7 +501,7 @@ Blowfish_expandstate(blf_ctx *c, const uint8_t *data, uint16_t databytes, } void -blf_key(blf_ctx *c, const uint8_t *k, uint16_t len) +ssh_blf_key(ssh_blf_ctx *c, const uint8_t *k, uint16_t len) { /* Initialize S-boxes and subkeys with Pi */ Blowfish_initstate(c); @@ -511,7 +511,7 @@ blf_key(blf_ctx *c, const uint8_t *k, uint16_t len) } void -blf_enc(blf_ctx *c, uint32_t *data, uint16_t blocks) +ssh_blf_enc(ssh_blf_ctx *c, uint32_t *data, uint16_t blocks) { uint32_t *d; uint16_t i; @@ -524,7 +524,7 @@ blf_enc(blf_ctx *c, uint32_t *data, uint16_t blocks) } void -blf_dec(blf_ctx *c, uint32_t *data, uint16_t blocks) +ssh_blf_dec(ssh_blf_ctx *c, uint32_t *data, uint16_t blocks) { uint32_t *d; uint16_t i; @@ -537,7 +537,7 @@ blf_dec(blf_ctx *c, uint32_t *data, uint16_t blocks) } void -blf_ecb_encrypt(blf_ctx *c, uint8_t *data, uint32_t len) +ssh_blf_ecb_encrypt(ssh_blf_ctx *c, uint8_t *data, uint32_t len) { uint32_t l, r; uint32_t i; @@ -559,7 +559,7 @@ blf_ecb_encrypt(blf_ctx *c, uint8_t *data, uint32_t len) } void -blf_ecb_decrypt(blf_ctx *c, uint8_t *data, uint32_t len) +ssh_blf_ecb_decrypt(ssh_blf_ctx *c, uint8_t *data, uint32_t len) { uint32_t l, r; uint32_t i; @@ -581,7 +581,7 @@ blf_ecb_decrypt(blf_ctx *c, uint8_t *data, uint32_t len) } void -blf_cbc_encrypt(blf_ctx *c, uint8_t *iv, uint8_t *data, uint32_t len) +ssh_blf_cbc_encrypt(ssh_blf_ctx *c, uint8_t *iv, uint8_t *data, uint32_t len) { uint32_t l, r; uint32_t i, j; @@ -606,7 +606,7 @@ blf_cbc_encrypt(blf_ctx *c, uint8_t *iv, uint8_t *data, uint32_t len) } void -blf_cbc_decrypt(blf_ctx *c, uint8_t *iva, uint8_t *data, uint32_t len) +ssh_blf_cbc_decrypt(ssh_blf_ctx *c, uint8_t *iva, uint8_t *data, uint32_t len) { uint32_t l, r; uint8_t *iv; @@ -659,7 +659,7 @@ void main(void) { - blf_ctx c; + ssh_blf_ctx c; char key[] = "AAAAA"; char key2[] = "abcdefghijklmnopqrstuvwxyz"; @@ -673,19 +673,19 @@ main(void) for (i = 0; i < 10; i++) data[i] = i; - blf_key(&c, (uint8_t *) key, 5); - blf_enc(&c, data, 5); - blf_dec(&c, data, 1); - blf_dec(&c, data + 2, 4); + ssh_blf_key(&c, (uint8_t *) key, 5); + ssh_blf_enc(&c, data, 5); + ssh_blf_dec(&c, data, 1); + ssh_blf_dec(&c, data + 2, 4); printf("Should read as 0 - 9.\n"); report(data, 10); /* Second test */ - blf_key(&c, (uint8_t *) key2, strlen(key2)); - blf_enc(&c, data2, 1); + ssh_blf_key(&c, (uint8_t *) key2, strlen(key2)); + ssh_blf_enc(&c, data2, 1); printf("\nShould read as: 0x324ed0fe 0xf413a203.\n"); report(data2, 2); - blf_dec(&c, data2, 1); + ssh_blf_dec(&c, data2, 1); report(data2, 2); } #endif |