projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Swap to using _longjmp/_setjmp instead of longjmp/setjmp
[oweals/openssl.git]
/
crypto
/
asn1
/
x_pubkey.c
diff --git
a/crypto/asn1/x_pubkey.c
b/crypto/asn1/x_pubkey.c
index 4b682018c2de409bb88b96ca03880eace67a27a9..d20019005c92c52a33bcdb395f52f8c4e3d7d2fc 100644
(file)
--- a/
crypto/asn1/x_pubkey.c
+++ b/
crypto/asn1/x_pubkey.c
@@
-57,10
+57,10
@@
*/
#include <stdio.h>
*/
#include <stdio.h>
-#include "cryptlib.h"
+#include "
internal/
cryptlib.h"
#include <openssl/asn1t.h>
#include <openssl/x509.h>
#include <openssl/asn1t.h>
#include <openssl/x509.h>
-#include "
asn1_locl
.h"
+#include "
internal/asn1_int
.h"
#ifndef OPENSSL_NO_RSA
# include <openssl/rsa.h>
#endif
#ifndef OPENSSL_NO_RSA
# include <openssl/rsa.h>
#endif
@@
-112,15
+112,12
@@
int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
goto error;
}
goto error;
}
- if (*x != NULL)
- X509_PUBKEY_free(*x);
-
+ X509_PUBKEY_free(*x);
*x = pk;
*x = pk;
-
return 1;
return 1;
+
error:
error:
- if (pk != NULL)
- X509_PUBKEY_free(pk);
+ X509_PUBKEY_free(pk);
return 0;
}
return 0;
}
@@
-174,8
+171,7
@@
EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
return ret;
error:
return ret;
error:
- if (ret != NULL)
- EVP_PKEY_free(ret);
+ EVP_PKEY_free(ret);
return (NULL);
}
return (NULL);
}
@@
-188,13
+184,16
@@
EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length)
{
X509_PUBKEY *xpk;
EVP_PKEY *pktmp;
{
X509_PUBKEY *xpk;
EVP_PKEY *pktmp;
- xpk = d2i_X509_PUBKEY(NULL, pp, length);
+ const unsigned char *q;
+ q = *pp;
+ xpk = d2i_X509_PUBKEY(NULL, &q, length);
if (!xpk)
return NULL;
pktmp = X509_PUBKEY_get(xpk);
X509_PUBKEY_free(xpk);
if (!pktmp)
return NULL;
if (!xpk)
return NULL;
pktmp = X509_PUBKEY_get(xpk);
X509_PUBKEY_free(xpk);
if (!pktmp)
return NULL;
+ *pp = q;
if (a) {
EVP_PKEY_free(*a);
*a = pktmp;
if (a) {
EVP_PKEY_free(*a);
*a = pktmp;
@@
-247,7
+246,7
@@
int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp)
if (!a)
return 0;
pktmp = EVP_PKEY_new();
if (!a)
return 0;
pktmp = EVP_PKEY_new();
- if (
!pktmp
) {
+ if (
pktmp == NULL
) {
ASN1err(ASN1_F_I2D_RSA_PUBKEY, ERR_R_MALLOC_FAILURE);
return 0;
}
ASN1err(ASN1_F_I2D_RSA_PUBKEY, ERR_R_MALLOC_FAILURE);
return 0;
}
@@
-287,7
+286,7
@@
int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp)
if (!a)
return 0;
pktmp = EVP_PKEY_new();
if (!a)
return 0;
pktmp = EVP_PKEY_new();
- if (
!pktmp
) {
+ if (
pktmp == NULL
) {
ASN1err(ASN1_F_I2D_DSA_PUBKEY, ERR_R_MALLOC_FAILURE);
return 0;
}
ASN1err(ASN1_F_I2D_DSA_PUBKEY, ERR_R_MALLOC_FAILURE);
return 0;
}
@@
-344,8
+343,7
@@
int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval))
return 0;
if (penc) {
if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval))
return 0;
if (penc) {
- if (pub->public_key->data)
- OPENSSL_free(pub->public_key->data);
+ OPENSSL_free(pub->public_key->data);
pub->public_key->data = penc;
pub->public_key->length = penclen;
/* Set number of unused bits to zero */
pub->public_key->data = penc;
pub->public_key->length = penclen;
/* Set number of unused bits to zero */