struct asymmetric_key {
gcry_sexp_t sexp;
- int num_bytes;
};
static const char *gcrypt_strerror(gcry_error_t gret)
ret = -E_SEXP_BUILD;
goto free_params;
}
- key = para_malloc(sizeof(*key));
+ key = alloc(sizeof(*key));
key->sexp = sexp;
*result = key;
ret = bits;
goto release_n;
}
PARA_INFO_LOG("successfully read %u bit ssh public key\n", bits);
- key = para_malloc(sizeof(*key));
- key->num_bytes = ret;
+ key = alloc(sizeof(*key));
key->sexp = sexp;
*result = key;
- ret = bits;
+ ret = bits / 8;
release_n:
gcry_mpi_release(n);
release_e:
size_t nbytes;
int ret;
- PARA_INFO_LOG("encrypting %u byte input with %d-byte key\n", len, pub->num_bytes);
-
/* get pub key */
pub_key = gcry_sexp_find_token(pub->sexp, "public-key", 0);
if (!pub_key)
struct stream_cipher *sc_new(const unsigned char *data, int len)
{
gcry_error_t gret;
- struct stream_cipher *sc = para_malloc(sizeof(*sc));
+ struct stream_cipher *sc = alloc(sizeof(*sc));
assert(len >= 2 * AES_CRT128_BLOCK_SIZE);
gret = gcry_cipher_open(&sc->handle, GCRY_CIPHER_AES128,