Latest update.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include <string.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/buffer.h>
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include <openssl/des.h>
|
||||
#include <openssl/engine.h>
|
||||
|
||||
|
||||
@@ -117,10 +117,11 @@ EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
|
||||
int klen;
|
||||
EVP_PKEY *ret;
|
||||
char psbuf[PEM_BUFSIZE];
|
||||
|
||||
p8 = d2i_PKCS8_bio(bp, NULL);
|
||||
if (!p8)
|
||||
if (p8 == NULL)
|
||||
return NULL;
|
||||
if (cb)
|
||||
if (cb != NULL)
|
||||
klen = cb(psbuf, PEM_BUFSIZE, 0, u);
|
||||
else
|
||||
klen = PEM_def_callback(psbuf, PEM_BUFSIZE, 0, u);
|
||||
@@ -132,13 +133,13 @@ EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
|
||||
p8inf = PKCS8_decrypt(p8, psbuf, klen);
|
||||
X509_SIG_free(p8);
|
||||
OPENSSL_cleanse(psbuf, klen);
|
||||
if (!p8inf)
|
||||
if (p8inf == NULL)
|
||||
return NULL;
|
||||
ret = EVP_PKCS82PKEY(p8inf);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
if (!ret)
|
||||
return NULL;
|
||||
if (x) {
|
||||
if (x != NULL) {
|
||||
EVP_PKEY_free(*x);
|
||||
*x = ret;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/dh.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/evp_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
|
||||
int pem_check_suffix(const char *pem_str, const char *suffix);
|
||||
|
||||
@@ -40,10 +40,10 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
|
||||
if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) {
|
||||
PKCS8_PRIV_KEY_INFO *p8inf;
|
||||
p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len);
|
||||
if (!p8inf)
|
||||
if (p8inf == NULL)
|
||||
goto p8err;
|
||||
ret = EVP_PKCS82PKEY(p8inf);
|
||||
if (x) {
|
||||
if (x != NULL) {
|
||||
EVP_PKEY_free((EVP_PKEY *)*x);
|
||||
*x = ret;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
|
||||
int klen;
|
||||
char psbuf[PEM_BUFSIZE];
|
||||
p8 = d2i_X509_SIG(NULL, &p, len);
|
||||
if (!p8)
|
||||
if (p8 == NULL)
|
||||
goto p8err;
|
||||
if (cb)
|
||||
klen = cb(psbuf, PEM_BUFSIZE, 0, u);
|
||||
@@ -68,7 +68,7 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
|
||||
p8inf = PKCS8_decrypt(p8, psbuf, klen);
|
||||
X509_SIG_free(p8);
|
||||
OPENSSL_cleanse(psbuf, klen);
|
||||
if (!p8inf)
|
||||
if (p8inf == NULL)
|
||||
goto p8err;
|
||||
ret = EVP_PKCS82PKEY(p8inf);
|
||||
if (x) {
|
||||
|
||||
+2
-1
@@ -617,6 +617,7 @@ static int do_PVK_header(const unsigned char **in, unsigned int length,
|
||||
{
|
||||
const unsigned char *p = *in;
|
||||
unsigned int pvk_magic, is_encrypted;
|
||||
|
||||
if (skip_magic) {
|
||||
if (length < 20) {
|
||||
PEMerr(PEM_F_DO_PVK_HEADER, PEM_R_PVK_TOO_SHORT);
|
||||
@@ -645,7 +646,7 @@ static int do_PVK_header(const unsigned char **in, unsigned int length,
|
||||
if (*pkeylen > PVK_MAX_KEYLEN || *psaltlen > PVK_MAX_SALTLEN)
|
||||
return 0;
|
||||
|
||||
if (is_encrypted && !*psaltlen) {
|
||||
if (is_encrypted && *psaltlen == 0) {
|
||||
PEMerr(PEM_F_DO_PVK_HEADER, PEM_R_INCONSISTENT_HEADER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user