ret = BN_CTX_get(ctx);
num = BN_num_bytes(rsa->n);
buf = OPENSSL_malloc(num);
- if (ret == NULL || buf == NULL) {
- ERR_raise(ERR_LIB_RSA, ERR_R_MALLOC_FAILURE);
+ if (ret == NULL || buf == NULL)
goto err;
- }
switch (padding) {
case RSA_PKCS1_PADDING:
ret = BN_CTX_get(ctx);
num = BN_num_bytes(rsa->n);
buf = OPENSSL_malloc(num);
- if (ret == NULL || buf == NULL) {
- ERR_raise(ERR_LIB_RSA, ERR_R_MALLOC_FAILURE);
+ if (ret == NULL || buf == NULL)
goto err;
- }
switch (padding) {
case RSA_PKCS1_PADDING:
if (blinding != NULL) {
if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) {
- ERR_raise(ERR_LIB_RSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB);
goto err;
}
if (!rsa_blinding_convert(blinding, f, unblind, ctx))
} else {
BIGNUM *d = BN_new();
if (d == NULL) {
- ERR_raise(ERR_LIB_RSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB);
goto err;
}
if (rsa->d == NULL) {
BN_CTX_start(ctx);
f = BN_CTX_get(ctx);
ret = BN_CTX_get(ctx);
+ if (ret == NULL) {
+ ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB);
+ goto err;
+ }
num = BN_num_bytes(rsa->n);
buf = OPENSSL_malloc(num);
- if (ret == NULL || buf == NULL) {
- ERR_raise(ERR_LIB_RSA, ERR_R_MALLOC_FAILURE);
+ if (buf == NULL)
goto err;
- }
/*
* This check was for equality but PGP does evil things and chops off the
if (blinding != NULL) {
if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) {
- ERR_raise(ERR_LIB_RSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB);
goto err;
}
if (!rsa_blinding_convert(blinding, f, unblind, ctx))
} else {
BIGNUM *d = BN_new();
if (d == NULL) {
- ERR_raise(ERR_LIB_RSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB);
goto err;
}
if (rsa->d == NULL) {
BN_CTX_start(ctx);
f = BN_CTX_get(ctx);
ret = BN_CTX_get(ctx);
+ if (ret == NULL) {
+ ERR_raise(ERR_LIB_RSA, ERR_R_BN_LIB);
+ goto err;
+ }
num = BN_num_bytes(rsa->n);
buf = OPENSSL_malloc(num);
- if (ret == NULL || buf == NULL) {
- ERR_raise(ERR_LIB_RSA, ERR_R_MALLOC_FAILURE);
+ if (buf == NULL)
goto err;
- }
/*
* This check was for equality but PGP does evil things and chops off the