static int
afalg_cipher_init(gnutls_cipher_algorithm_t algorithm, void **_ctx, int enc)
{
- struct kcapi_handle *handle = NULL;
+ struct kcapi_handle *handle;
struct kcapi_ctx *ctx;
if (kcapi_cipher_init(&handle, gnutls_cipher_map[algorithm], 0) < 0) {
return GNUTLS_E_INTERNAL_ERROR;
}
- ctx = (struct kcapi_ctx *)gnutls_calloc(1, sizeof(struct kcapi_ctx));
+ ctx = gnutls_malloc(sizeof(struct kcapi_ctx));
if (ctx == NULL) {
gnutls_assert();
kcapi_cipher_destroy(handle);
for (i = 0;
i < sizeof(gnutls_cipher_map) / sizeof(gnutls_cipher_map[0]);
i++) {
- struct kcapi_handle *handle = NULL;
+ struct kcapi_handle *handle;
if (gnutls_cipher_map[i] == 0)
continue;
static int
afalg_aead_init(gnutls_cipher_algorithm_t algorithm, void **_ctx, int enc)
{
- struct kcapi_handle *handle = NULL;
+ struct kcapi_handle *handle;
struct kcapi_aead_ctx *ctx;
if (kcapi_aead_init(&handle, gnutls_aead_map[algorithm], 0) < 0) {
return GNUTLS_E_MEMORY_ERROR;
}
- ctx = (struct kcapi_aead_ctx *)gnutls_calloc(1,
- sizeof(struct kcapi_aead_ctx));
+ ctx = gnutls_malloc(sizeof(struct kcapi_aead_ctx));
if (ctx == NULL) {
gnutls_assert();
kcapi_aead_destroy(handle);
for (i = 0;
i < sizeof(gnutls_aead_map) / sizeof(gnutls_aead_map[0]);
i++) {
- struct kcapi_handle *handle = NULL;
+ struct kcapi_handle *handle;
if (gnutls_aead_map[i] == 0)
continue;
static int afalg_mac_init(gnutls_mac_algorithm_t algorithm, void **ctx)
{
- struct kcapi_handle *handle = NULL;
+ struct kcapi_handle *handle;
if (kcapi_md_init(&handle, gnutls_mac_map[algorithm], 0) < 0) {
gnutls_assert();
size_t nonce_size, const void *key, size_t keysize,
const void *text, size_t textsize, void *digest)
{
- struct kcapi_handle *handle = NULL;
+ struct kcapi_handle *handle;
int ret = GNUTLS_E_ENCRYPTION_FAILED;
if (kcapi_md_init(&handle, gnutls_mac_map[algorithm], 0) < 0) {
for (i = 0;
i < sizeof(gnutls_mac_map) / sizeof(gnutls_mac_map[0]);
i++) {
- struct kcapi_handle *handle = NULL;
+ struct kcapi_handle *handle;
if (gnutls_mac_map[i] == 0)
continue;
static int afalg_digest_init(gnutls_digest_algorithm_t algorithm, void **ctx)
{
- struct kcapi_handle *handle = NULL;
+ struct kcapi_handle *handle;
if (kcapi_md_init(&handle, gnutls_digest_map[algorithm], 0) < 0) {
gnutls_assert();
static int afalg_digest_fast(gnutls_digest_algorithm_t algorithm,
const void *text, size_t textsize, void *digest)
{
- struct kcapi_handle *handle = NULL;
+ struct kcapi_handle *handle;
int ret = GNUTLS_E_ENCRYPTION_FAILED;
if (kcapi_md_init(&handle, gnutls_digest_map[algorithm], 0) < 0) {
for (i = 0;
i < sizeof(gnutls_digest_map) / sizeof(gnutls_digest_map[0]);
i++) {
- struct kcapi_handle *handle = NULL;
+ struct kcapi_handle *handle;
if (gnutls_digest_map[i] == 0)
continue;