static void free_CSWIFT_LIBNAME(void)
{
- if (CSWIFT_LIBNAME)
- OPENSSL_free((void *)CSWIFT_LIBNAME);
+ OPENSSL_free(CSWIFT_LIBNAME);
CSWIFT_LIBNAME = NULL;
}
CSWIFTerr(CSWIFT_F_CSWIFT_INIT, CSWIFT_R_NOT_LOADED);
goto err;
}
- if (!(p1 = (t_swAcquireAccContext *)
- DSO_bind_func(cswift_dso, CSWIFT_F1)) ||
- !(p2 = (t_swAttachKeyParam *)
- DSO_bind_func(cswift_dso, CSWIFT_F2)) ||
- !(p3 = (t_swSimpleRequest *)
- DSO_bind_func(cswift_dso, CSWIFT_F3)) ||
- !(p4 = (t_swReleaseAccContext *)
- DSO_bind_func(cswift_dso, CSWIFT_F4))) {
+
+#define BINDIT(t, name) (t *)DSO_bind_func(cswift_dso, name)
+ if ((p1 = BINDIT(t_swAcquireAccContext, CSWIFT_F1)) == NULL
+ || (p2 = BINDIT(t_swAttachKeyParam, CSWIFT_F2)) == NULL
+ || (p3 = BINDIT(t_swSimpleRequest *) DSO_bind_func(cswift_dso, CSWIFT_F3)) == NULL
+ || (p4 = BINDIT(t_swReleaseAccContext *) DSO_bind_func(cswift_dso, CSWIFT_F4)) == NULL) {
CSWIFTerr(CSWIFT_F_CSWIFT_INIT, CSWIFT_R_NOT_LOADED);
goto err;
}
/* Everything's fine. */
return 1;
err:
- if (cswift_dso) {
- DSO_free(cswift_dso);
- cswift_dso = NULL;
- }
+ DSO_free(cswift_dso);
+ cswift_dso = NULL;
p_CSwift_AcquireAccContext = NULL;
p_CSwift_AttachKeyParam = NULL;
p_CSwift_SimpleRequest = NULL;
BN_bin2bn((unsigned char *)result->d, res.nbytes, r);
to_return = 1;
err:
- if (sw_param.up.crt.p.value)
- OPENSSL_free(sw_param.up.crt.p.value);
- if (sw_param.up.crt.q.value)
- OPENSSL_free(sw_param.up.crt.q.value);
- if (sw_param.up.crt.dmp1.value)
- OPENSSL_free(sw_param.up.crt.dmp1.value);
- if (sw_param.up.crt.dmq1.value)
- OPENSSL_free(sw_param.up.crt.dmq1.value);
- if (sw_param.up.crt.iqmp.value)
- OPENSSL_free(sw_param.up.crt.iqmp.value);
- if (result)
- BN_free(result);
- if (argument)
- BN_free(argument);
+ OPENSSL_free(sw_param.up.crt.p.value);
+ OPENSSL_free(sw_param.up.crt.q.value);
+ OPENSSL_free(sw_param.up.crt.dmp1.value);
+ OPENSSL_free(sw_param.up.crt.dmq1.value);
+ OPENSSL_free(sw_param.up.crt.iqmp.value);
+ BN_free(result);
+ BN_free(argument);
if (acquired)
release_context(hac);
return to_return;
err:
if (acquired)
release_context(hac);
- if (ctx) {
+ if (ctx)
BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
+ BN_CTX_free(ctx);
return to_return;
}
err:
if (acquired)
release_context(hac);
- if (ctx) {
+ if (ctx)
BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
+ BN_CTX_free(ctx);
return to_return;
}
# endif