Drop localisation and checkpoint tracing in files not covered by the merge.
[tinc] / src / gcrypt / cipher.c
index e1f1e05..bb7da5d 100644 (file)
@@ -55,7 +55,7 @@ static struct {
 };
 
 static bool nametocipher(const char *name, int *algo, int *mode) {
-       int i;
+       size_t i;
 
        for(i = 0; i < sizeof ciphertable / sizeof *ciphertable; i++) {
                if(ciphertable[i].name && !strcasecmp(name, ciphertable[i].name)) {
@@ -69,7 +69,7 @@ static bool nametocipher(const char *name, int *algo, int *mode) {
 }
 
 static bool nidtocipher(int nid, int *algo, int *mode) {
-       int i;
+       size_t i;
 
        for(i = 0; i < sizeof ciphertable / sizeof *ciphertable; i++) {
                if(nid == ciphertable[i].nid) {
@@ -83,7 +83,7 @@ static bool nidtocipher(int nid, int *algo, int *mode) {
 }
 
 static bool ciphertonid(int algo, int mode, int *nid) {
-       int i;
+       size_t i;
 
        for(i = 0; i < sizeof ciphertable / sizeof *ciphertable; i++) {
                if(algo == ciphertable[i].algo && mode == ciphertable[i].mode) {
@@ -99,12 +99,12 @@ static bool cipher_open(cipher_t *cipher, int algo, int mode) {
        gcry_error_t err;
 
        if(!ciphertonid(algo, mode, &cipher->nid)) {
-               logger(LOG_DEBUG, _("Cipher %d mode %d has no corresponding nid!"), algo, mode);
+               logger(LOG_DEBUG, "Cipher %d mode %d has no corresponding nid!", algo, mode);
                return false;
        }
 
        if((err = gcry_cipher_open(&cipher->handle, algo, mode, 0))) {
-               logger(LOG_DEBUG, _("Unable to intialise cipher %d mode %d: %s"), algo, mode, gcry_strerror(err));
+               logger(LOG_DEBUG, "Unable to intialise cipher %d mode %d: %s", algo, mode, gcry_strerror(err));
                return false;
        }
 
@@ -122,7 +122,7 @@ bool cipher_open_by_name(cipher_t *cipher, const char *name) {
        int algo, mode;
 
        if(!nametocipher(name, &algo, &mode)) {
-               logger(LOG_DEBUG, _("Unknown cipher name '%s'!"), name);
+               logger(LOG_DEBUG, "Unknown cipher name '%s'!", name);
                return false;
        }
 
@@ -133,7 +133,7 @@ bool cipher_open_by_nid(cipher_t *cipher, int nid) {
        int algo, mode;
 
        if(!nidtocipher(nid, &algo, &mode)) {
-               logger(LOG_DEBUG, _("Unknown cipher ID %d!"), nid);
+               logger(LOG_DEBUG, "Unknown cipher ID %d!", nid);
                return false;
        }
 
@@ -173,7 +173,7 @@ bool cipher_set_key(cipher_t *cipher, void *key, bool encrypt) {
        return true;
 }
 
-bool cipher_set_key(cipher_t *cipher, void *key, size_t len, bool encrypt) {
+bool cipher_set_key_from_rsa(cipher_t *cipher, void *key, size_t len, bool encrypt) {
        memcpy(cipher->key, key + len - cipher->keylen, cipher->keylen + cipher->blklen);
        memcpy(cipher->key + cipher->keylen, key + len - cipher->keylen - cipher->blklen, cipher->blklen);
 
@@ -227,26 +227,26 @@ static bool cipher_remove_padding(cipher_t *cipher, void *indata, size_t inlen,
        return true;
 }
 
-bool cipher_encrypt(cipher_t *cipher, void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) {
+bool cipher_encrypt(cipher_t *cipher, const void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) {
        gcry_error_t err;
 
        // To be fixed
 
        if((err = gcry_cipher_encrypt(cipher->handle, outdata, inlen, indata, inlen))) {
-               logger(LOG_ERR, _("Error while encrypting: %s"), gcry_strerror(err));
+               logger(LOG_ERR, "Error while encrypting: %s", gcry_strerror(err));
                return false;
        }
 
        return true;
 }
 
-bool cipher_decrypt(cipher_t *cipher, void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) {
+bool cipher_decrypt(cipher_t *cipher, const void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) {
        gcry_error_t err;
 
        // To be fixed
 
        if((err = gcry_cipher_decrypt(cipher->handle, outdata, inlen, indata, inlen))) {
-               logger(LOG_ERR, _("Error while decrypting: %s"), gcry_strerror(err));
+               logger(LOG_ERR, "Error while decrypting: %s", gcry_strerror(err));
                return false;
        }