BN_CTX_start(ctx);
x = BN_CTX_get(ctx);
if (x == NULL) {
- ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
goto err;
}
* * peer_public_key.
*/
if (EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) {
- if (!EC_GROUP_get_cofactor(group, x, NULL) ||
- !BN_mul(x, x, priv_key, ctx)) {
- ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
+ if (!EC_GROUP_get_cofactor(group, x, NULL)) {
+ ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
+ goto err;
+ }
+ if (!BN_mul(x, x, priv_key, ctx)) {
+ ERR_raise(ERR_LIB_EC, ERR_R_BN_LIB);
goto err;
}
priv_key = x;
}
if ((tmp = EC_POINT_new(group)) == NULL) {
- ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
goto err;
}
ERR_raise(ERR_LIB_EC, ERR_R_INTERNAL_ERROR);
goto err;
}
- if ((buf = OPENSSL_malloc(buflen)) == NULL) {
- ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
+ if ((buf = OPENSSL_malloc(buflen)) == NULL)
goto err;
- }
memset(buf, 0, buflen - len);
if (len != (size_t)BN_bn2bin(x, buf + buflen - len)) {