#include <string.h>
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
#include "internal/bn_int.h"
#include "ec_lcl.h"
ret = 1;
err:
- if (table_storage)
- OPENSSL_free(table_storage);
- if (p_str)
- OPENSSL_free(p_str);
- if (scalars)
- OPENSSL_free(scalars);
+ OPENSSL_free(table_storage);
+ OPENSSL_free(p_str);
+ OPENSSL_free(scalars);
return ret;
}
BN_CTX_free(new_ctx);
ecp_nistz256_pre_comp_free(pre_comp);
- if (precomp_storage)
- OPENSSL_free(precomp_storage);
+ OPENSSL_free(precomp_storage);
EC_POINT_free(P);
EC_POINT_free(T);
return ret;
ret = EC_POINT_set_affine_coordinates_GFp(group, out, x, y, ctx);
- if (x)
- BN_free(x);
- if (y)
- BN_free(y);
+ BN_free(x);
+ BN_free(y);
return ret;
}
if (ctx)
BN_CTX_end(ctx);
BN_CTX_free(new_ctx);
- if (new_points)
- OPENSSL_free(new_points);
- if (new_scalars)
- OPENSSL_free(new_scalars);
+ OPENSSL_free(new_points);
+ OPENSSL_free(new_scalars);
return ret;
}
if (!group)
return NULL;
- ret = (EC_PRE_COMP *)OPENSSL_malloc(sizeof(EC_PRE_COMP));
+ ret = OPENSSL_malloc(sizeof(*ret));
if (!ret) {
ECerr(EC_F_ECP_NISTZ256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
if (i > 0)
return;
- if (pre->precomp_storage)
- OPENSSL_free(pre->precomp_storage);
-
+ OPENSSL_free(pre->precomp_storage);
OPENSSL_free(pre);
}
if (i > 0)
return;
- if (pre->precomp_storage) {
- OPENSSL_cleanse(pre->precomp,
- 32 * sizeof(unsigned char) * (1 << pre->w) * 2 * 37);
- OPENSSL_free(pre->precomp_storage);
- }
- OPENSSL_cleanse(pre, sizeof *pre);
- OPENSSL_free(pre);
+ OPENSSL_clear_free(pre->precomp,
+ 32 * sizeof(unsigned char) * (1 << pre->w) * 2 * 37);
+ OPENSSL_clear_free(pre, sizeof(*pre));
}
static int ecp_nistz256_window_have_precompute_mult(const EC_GROUP *group)