projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve style
[openssl.git]
/
crypto
/
dsa
/
dsa_meth.c
diff --git
a/crypto/dsa/dsa_meth.c
b/crypto/dsa/dsa_meth.c
index 57bc9f0971856d0c987135daaa425662f76537a4..51a486b2ec1d22fef2da12beead2426cdd3bad8d 100644
(file)
--- a/
crypto/dsa/dsa_meth.c
+++ b/
crypto/dsa/dsa_meth.c
@@
-17,48
+17,50
@@
#include "dsa_locl.h"
#include <string.h>
#include "dsa_locl.h"
#include <string.h>
+#include <openssl/err.h>
DSA_METHOD *DSA_meth_new(const char *name, int flags)
{
DSA_METHOD *DSA_meth_new(const char *name, int flags)
{
- DSA_METHOD *dsam = OPENSSL_zalloc(sizeof(
DSA_METHOD
));
+ DSA_METHOD *dsam = OPENSSL_zalloc(sizeof(
*dsam
));
if (dsam != NULL) {
if (dsam != NULL) {
- dsam->name = OPENSSL_strdup(name);
- if (dsam->name == NULL) {
- OPENSSL_free(dsam);
- return NULL;
- }
dsam->flags = flags;
dsam->flags = flags;
+
+ dsam->name = OPENSSL_strdup(name);
+ if (dsam->name != NULL)
+ return dsam;
+
+ OPENSSL_free(dsam);
}
}
- return dsam;
+ DSAerr(DSA_F_DSA_METH_NEW, ERR_R_MALLOC_FAILURE);
+ return NULL;
}
void DSA_meth_free(DSA_METHOD *dsam)
{
if (dsam != NULL) {
}
void DSA_meth_free(DSA_METHOD *dsam)
{
if (dsam != NULL) {
- if (dsam->name != NULL)
- OPENSSL_free(dsam->name);
+ OPENSSL_free(dsam->name);
OPENSSL_free(dsam);
}
}
DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam)
{
OPENSSL_free(dsam);
}
}
DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam)
{
- DSA_METHOD *ret;
-
- ret = OPENSSL_malloc(sizeof(DSA_METHOD));
+ DSA_METHOD *ret = OPENSSL_malloc(sizeof(*ret));
if (ret != NULL) {
memcpy(ret, dsam, sizeof(*dsam));
if (ret != NULL) {
memcpy(ret, dsam, sizeof(*dsam));
+
ret->name = OPENSSL_strdup(dsam->name);
ret->name = OPENSSL_strdup(dsam->name);
- if (ret->name
== NULL) {
-
OPENSSL_free(ret)
;
- return NULL;
- }
+ if (ret->name
!= NULL)
+
return ret
;
+
+ OPENSSL_free(ret);
}
}
- return ret;
+ DSAerr(DSA_F_DSA_METH_DUP, ERR_R_MALLOC_FAILURE);
+ return NULL;
}
const char *DSA_meth_get0_name(const DSA_METHOD *dsam)
}
const char *DSA_meth_get0_name(const DSA_METHOD *dsam)
@@
-68,11
+70,12
@@
const char *DSA_meth_get0_name(const DSA_METHOD *dsam)
int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name)
{
int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name)
{
- char *tmpname;
+ char *tmpname
= OPENSSL_strdup(name)
;
- tmpname = OPENSSL_strdup(name);
- if (tmpname == NULL)
+ if (tmpname == NULL) {
+ DSAerr(DSA_F_DSA_METH_SET1_NAME, ERR_R_MALLOC_FAILURE);
return 0;
return 0;
+ }
OPENSSL_free(dsam->name);
dsam->name = tmpname;
OPENSSL_free(dsam->name);
dsam->name = tmpname;
@@
-129,7
+132,7
@@
int DSA_meth_set_sign_setup(DSA_METHOD *dsam,
}
int (*DSA_meth_get_verify(const DSA_METHOD *dsam))
}
int (*DSA_meth_get_verify(const DSA_METHOD *dsam))
- (const unsigned char *, int
, DSA_SIG *, DSA *)
+ (const unsigned char *, int, DSA_SIG *, DSA *)
{
return dsam->dsa_do_verify;
}
{
return dsam->dsa_do_verify;
}
@@
-142,29
+145,30
@@
int DSA_meth_set_verify(DSA_METHOD *dsam,
}
int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))
}
int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))
- (DSA *, BIGNUM *,
BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *,
BIGNUM *,
- BN_CTX *, BN_MONT_CTX *)
+ (DSA *, BIGNUM *,
const BIGNUM *, const BIGNUM *, const
BIGNUM *,
+
const BIGNUM *, const BIGNUM *,
BN_CTX *, BN_MONT_CTX *)
{
return dsam->dsa_mod_exp;
}
int DSA_meth_set_mod_exp(DSA_METHOD *dsam,
{
return dsam->dsa_mod_exp;
}
int DSA_meth_set_mod_exp(DSA_METHOD *dsam,
- int (*mod_exp) (DSA *, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *,
- BIGNUM *, BN_CTX *, BN_MONT_CTX *))
+ int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,
+ const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *,
+ BN_MONT_CTX *))
{
dsam->dsa_mod_exp = mod_exp;
return 1;
}
int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))
{
dsam->dsa_mod_exp = mod_exp;
return 1;
}
int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))
- (DSA *, BIGNUM *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *,
+ (DSA *, BIGNUM *,
const
BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *,
BN_MONT_CTX *)
{
return dsam->bn_mod_exp;
}
int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam,
BN_MONT_CTX *)
{
return dsam->bn_mod_exp;
}
int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam,
- int (*bn_mod_exp) (DSA *, BIGNUM *, BIGNUM *, const BIGNUM *,
+ int (*bn_mod_exp) (DSA *, BIGNUM *,
const
BIGNUM *, const BIGNUM *,
const BIGNUM *, BN_CTX *, BN_MONT_CTX *))
{
dsam->bn_mod_exp = bn_mod_exp;
const BIGNUM *, BN_CTX *, BN_MONT_CTX *))
{
dsam->bn_mod_exp = bn_mod_exp;