projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix memory leak.
[oweals/openssl.git]
/
crypto
/
evp
/
p5_crpt2.c
diff --git
a/crypto/evp/p5_crpt2.c
b/crypto/evp/p5_crpt2.c
index b9c4dcbeda4d7984aecbb64f3d418a3edc05c86d..27e3fa5017fb97a16d0ca515295e0db229a10315 100644
(file)
--- a/
crypto/evp/p5_crpt2.c
+++ b/
crypto/evp/p5_crpt2.c
@@
-59,7
+59,6
@@
#include <stdio.h>
#include <stdlib.h>
#include "cryptlib.h"
#include <stdio.h>
#include <stdlib.h>
#include "cryptlib.h"
-#if !defined(OPENSSL_NO_HMAC)
# include <openssl/x509.h>
# include <openssl/evp.h>
# include <openssl/hmac.h>
# include <openssl/x509.h>
# include <openssl/evp.h>
# include <openssl/hmac.h>
@@
-195,6
+194,7
@@
int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
int plen;
PBE2PARAM *pbe2 = NULL;
const EVP_CIPHER *cipher;
int plen;
PBE2PARAM *pbe2 = NULL;
const EVP_CIPHER *cipher;
+ EVP_PBE_KEYGEN *kdf;
int rv = 0;
int rv = 0;
@@
-212,8
+212,8
@@
int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
}
/* See if we recognise the key derivation function */
}
/* See if we recognise the key derivation function */
-
-
if (OBJ_obj2nid(pbe2->keyfunc->algorithm) != NID_id_pbkdf2
) {
+ if (!EVP_PBE_find(EVP_PBE_TYPE_KDF, OBJ_obj2nid(pbe2->keyfunc->algorithm),
+
NULL, NULL, &kdf)
) {
EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,
EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION);
goto err;
EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,
EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION);
goto err;
@@
-237,8
+237,7
@@
int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, EVP_R_CIPHER_PARAMETER_ERROR);
goto err;
}
EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, EVP_R_CIPHER_PARAMETER_ERROR);
goto err;
}
- rv = PKCS5_v2_PBKDF2_keyivgen(ctx, pass, passlen,
- pbe2->keyfunc->parameter, c, md, en_de);
+ rv = kdf(ctx, pass, passlen, pbe2->keyfunc->parameter, NULL, NULL, en_de);
err:
PBE2PARAM_free(pbe2);
return rv;
err:
PBE2PARAM_free(pbe2);
return rv;
@@
-331,4
+330,3
@@
static void h__dump(const unsigned char *p, int len)
fprintf(stderr, "\n");
}
# endif
fprintf(stderr, "\n");
}
# endif
-#endif