projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove MD2 from digest algorithm table. This follows the recommendation in
[oweals/openssl.git]
/
crypto
/
evp
/
evp_pbe.c
diff --git
a/crypto/evp/evp_pbe.c
b/crypto/evp/evp_pbe.c
index 229ac673a7beaa67df7d019a6583e6fb8cc32a9a..5e830be65fff7c58848e7e0d376ed58cd47c9e37 100644
(file)
--- a/
crypto/evp/evp_pbe.c
+++ b/
crypto/evp/evp_pbe.c
@@
-1,5
+1,5
@@
/* evp_pbe.c */
/* evp_pbe.c */
-/* Written by Dr Stephen N Henson (s
henson@bigfoot.com
) for the OpenSSL
+/* Written by Dr Stephen N Henson (s
teve@openssl.org
) for the OpenSSL
* project 1999.
*/
/* ====================================================================
* project 1999.
*/
/* ====================================================================
@@
-57,9
+57,9
@@
*/
#include <stdio.h>
*/
#include <stdio.h>
+#include "cryptlib.h"
#include <openssl/evp.h>
#include <openssl/x509.h>
#include <openssl/evp.h>
#include <openssl/x509.h>
-#include "cryptlib.h"
/* Password based encryption (PBE) functions */
/* Password based encryption (PBE) functions */
@@
-69,12
+69,12
@@
static STACK *pbe_algs;
typedef struct {
int pbe_nid;
typedef struct {
int pbe_nid;
-EVP_CIPHER *cipher;
-EVP_MD *md;
+
const
EVP_CIPHER *cipher;
+
const
EVP_MD *md;
EVP_PBE_KEYGEN *keygen;
} EVP_PBE_CTL;
EVP_PBE_KEYGEN *keygen;
} EVP_PBE_CTL;
-int EVP_PBE_CipherInit
(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
+int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de)
{
ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de)
{
@@
-87,8
+87,8
@@
int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
if (i == -1) {
char obj_tmp[80];
EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM);
if (i == -1) {
char obj_tmp[80];
EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM);
- if (!pbe_obj)
strcpy (obj_tmp, "NULL"
);
- else i2t_ASN1_OBJECT(obj_tmp,
80
, pbe_obj);
+ if (!pbe_obj)
BUF_strlcpy (obj_tmp, "NULL", sizeof obj_tmp
);
+ else i2t_ASN1_OBJECT(obj_tmp,
sizeof obj_tmp
, pbe_obj);
ERR_add_error_data(2, "TYPE=", obj_tmp);
return 0;
}
ERR_add_error_data(2, "TYPE=", obj_tmp);
return 0;
}
@@
-104,18
+104,20
@@
int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
return 1;
}
return 1;
}
-static int pbe_cmp
(EVP_PBE_CTL **pbe1, EVP_PBE_CTL **pbe2
)
+static int pbe_cmp
(const char * const *a, const char * const *b
)
{
{
+ const EVP_PBE_CTL * const *pbe1 = (const EVP_PBE_CTL * const *) a,
+ * const *pbe2 = (const EVP_PBE_CTL * const *)b;
return ((*pbe1)->pbe_nid - (*pbe2)->pbe_nid);
}
/* Add a PBE algorithm */
return ((*pbe1)->pbe_nid - (*pbe2)->pbe_nid);
}
/* Add a PBE algorithm */
-int EVP_PBE_alg_add
(int nid, EVP_CIPHER *cipher,
EVP_MD *md,
+int EVP_PBE_alg_add
(int nid, const EVP_CIPHER *cipher, const
EVP_MD *md,
EVP_PBE_KEYGEN *keygen)
{
EVP_PBE_CTL *pbe_tmp;
EVP_PBE_KEYGEN *keygen)
{
EVP_PBE_CTL *pbe_tmp;
- if (!pbe_algs) pbe_algs = sk_new
((int (*)())
pbe_cmp);
+ if (!pbe_algs) pbe_algs = sk_new
(
pbe_cmp);
if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) {
EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
return 0;
if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) {
EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
return 0;