summaryrefslogtreecommitdiffstats
path: root/crypto/crmf/crmf_pbm.c
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2019-08-10 14:07:22 +0200
committerMatt Caswell <matt@openssl.org>2019-09-27 10:53:11 +0100
commit7960dbec6801c1c98c848b81ca00e73625e8970b (patch)
tree58045a9618ce5668f8b95b966810a35b3285deb3 /crypto/crmf/crmf_pbm.c
parent0c452a51a5dfe061e5080ae484f1cd06772d8f47 (diff)
Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL
Also includes CRMF (RFC 4211) and HTTP transfer (RFC 6712) CMP and CRMF API is added to libcrypto, and the "cmp" app to the openssl CLI. Adds extensive man pages and tests. Integration into build scripts. Incremental pull request based on OpenSSL commit 8869ad4a39f of 2019-04-02 4th chunk: CMP context/parameters and utilities in crypto/cmp/cmp_ctx.c, crypto/cmp/cmp_util.c, and related files Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9107)
Diffstat (limited to 'crypto/crmf/crmf_pbm.c')
-rw-r--r--crypto/crmf/crmf_pbm.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/crypto/crmf/crmf_pbm.c b/crypto/crmf/crmf_pbm.c
index a3ac45557d..47dc86a550 100644
--- a/crypto/crmf/crmf_pbm.c
+++ b/crypto/crmf/crmf_pbm.c
@@ -41,20 +41,16 @@ OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(size_t slen, int owfnid,
OSSL_CRMF_PBMPARAMETER *pbm = NULL;
unsigned char *salt = NULL;
- if ((pbm = OSSL_CRMF_PBMPARAMETER_new()) == NULL) {
- CRMFerr(CRMF_F_OSSL_CRMF_PBMP_NEW, ERR_R_MALLOC_FAILURE);
+ if ((pbm = OSSL_CRMF_PBMPARAMETER_new()) == NULL)
goto err;
- }
/*
* salt contains a randomly generated value used in computing the key
* of the MAC process. The salt SHOULD be at least 8 octets (64
* bits) long.
*/
- if ((salt = OPENSSL_malloc(slen)) == NULL) {
- CRMFerr(CRMF_F_OSSL_CRMF_PBMP_NEW, ERR_R_MALLOC_FAILURE);
+ if ((salt = OPENSSL_malloc(slen)) == NULL)
goto err;
- }
if (RAND_bytes(salt, (int)slen) <= 0) {
CRMFerr(CRMF_F_OSSL_CRMF_PBMP_NEW, CRMF_R_FAILURE_OBTAINING_RANDOM);
goto err;
@@ -145,10 +141,8 @@ int OSSL_CRMF_pbm_new(const OSSL_CRMF_PBMPARAMETER *pbmp,
CRMFerr(CRMF_F_OSSL_CRMF_PBM_NEW, CRMF_R_NULL_ARGUMENT);
goto err;
}
- if ((mac_res = OPENSSL_malloc(EVP_MAX_MD_SIZE)) == NULL) {
- CRMFerr(CRMF_F_OSSL_CRMF_PBM_NEW, ERR_R_MALLOC_FAILURE);
+ if ((mac_res = OPENSSL_malloc(EVP_MAX_MD_SIZE)) == NULL)
goto err;
- }
/*
* owf identifies the hash algorithm and associated parameters used to
@@ -160,10 +154,8 @@ int OSSL_CRMF_pbm_new(const OSSL_CRMF_PBMPARAMETER *pbmp,
goto err;
}
- if ((ctx = EVP_MD_CTX_new()) == NULL) {
- CRMFerr(CRMF_F_OSSL_CRMF_PBM_NEW, ERR_R_MALLOC_FAILURE);
+ if ((ctx = EVP_MD_CTX_new()) == NULL)
goto err;
- }
/* compute the basekey of the salted secret */
if (!EVP_DigestInit_ex(ctx, m, NULL))