Switching to libtomcrypt 1.02

(still has problems)

--HG--
extra : convert_revision : 4dfd70544ed9a766876ddda9f6ac3f26054eb3db
This commit is contained in:
Matt Johnston 2005-05-09 09:32:33 +00:00
parent eb741b9cc9
commit 7b403dc57f
4 changed files with 8 additions and 5 deletions

4
algo.h
View File

@ -51,13 +51,13 @@ extern const struct dropbear_cipher dropbear_nocipher;
extern const struct dropbear_hash dropbear_nohash; extern const struct dropbear_hash dropbear_nohash;
struct dropbear_cipher { struct dropbear_cipher {
const struct _cipher_descriptor *cipherdesc; const struct ltc_cipher_descriptor *cipherdesc;
unsigned long keysize; unsigned long keysize;
unsigned char blocksize; unsigned char blocksize;
}; };
struct dropbear_hash { struct dropbear_hash {
const struct _hash_descriptor *hashdesc; const struct ltc_hash_descriptor *hashdesc;
unsigned long keysize; unsigned long keysize;
unsigned char hashsize; unsigned char hashsize;
}; };

View File

@ -125,7 +125,7 @@ algo_type sshkex[] = {
* This should be run before using any of the ciphers/hashes */ * This should be run before using any of the ciphers/hashes */
void crypto_init() { void crypto_init() {
const struct _cipher_descriptor *regciphers[] = { const struct ltc_cipher_descriptor *regciphers[] = {
#ifdef DROPBEAR_AES128_CBC #ifdef DROPBEAR_AES128_CBC
&aes_desc, &aes_desc,
#endif #endif
@ -141,7 +141,7 @@ void crypto_init() {
NULL NULL
}; };
const struct _hash_descriptor *reghashes[] = { const struct ltc_hash_descriptor *reghashes[] = {
/* we need sha1 for hostkey stuff regardless */ /* we need sha1 for hostkey stuff regardless */
&sha1_desc, &sha1_desc,
#ifdef DROPBEAR_MD5_HMAC #ifdef DROPBEAR_MD5_HMAC

View File

@ -111,7 +111,7 @@
#include <libgen.h> #include <libgen.h>
#endif #endif
#include "libtomcrypt/mycrypt.h" #include "libtomcrypt/src/headers/tomcrypt.h"
#include "libtommath/tommath.h" #include "libtommath/tommath.h"
#include "compat.h" #include "compat.h"

View File

@ -201,6 +201,7 @@ static void read_packet_init() {
/* decrypt it */ /* decrypt it */
if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize), if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize),
buf_getwriteptr(ses.decryptreadbuf,blocksize), buf_getwriteptr(ses.decryptreadbuf,blocksize),
blocksize,
&ses.keys->recv_symmetric_struct) != CRYPT_OK) { &ses.keys->recv_symmetric_struct) != CRYPT_OK) {
dropbear_exit("error decrypting"); dropbear_exit("error decrypting");
} }
@ -254,6 +255,7 @@ void decrypt_packet() {
while (ses.readbuf->pos < ses.readbuf->len - macsize) { while (ses.readbuf->pos < ses.readbuf->len - macsize) {
if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize), if (cbc_decrypt(buf_getptr(ses.readbuf, blocksize),
buf_getwriteptr(ses.decryptreadbuf, blocksize), buf_getwriteptr(ses.decryptreadbuf, blocksize),
blocksize,
&ses.keys->recv_symmetric_struct) != CRYPT_OK) { &ses.keys->recv_symmetric_struct) != CRYPT_OK) {
dropbear_exit("error decrypting"); dropbear_exit("error decrypting");
} }
@ -491,6 +493,7 @@ void encrypt_packet() {
while (clearwritebuf->pos < clearwritebuf->len) { while (clearwritebuf->pos < clearwritebuf->len) {
if (cbc_encrypt(buf_getptr(clearwritebuf, blocksize), if (cbc_encrypt(buf_getptr(clearwritebuf, blocksize),
buf_getwriteptr(writebuf, blocksize), buf_getwriteptr(writebuf, blocksize),
blocksize,
&ses.keys->trans_symmetric_struct) != CRYPT_OK) { &ses.keys->trans_symmetric_struct) != CRYPT_OK) {
dropbear_exit("error encrypting"); dropbear_exit("error encrypting");
} }