X509_ALGOR_free(a->algor);
M_ASN1_BIT_STRING_free(a->public_key);
if (a->pkey != NULL) EVP_PKEY_free(a->pkey);
- Free((char *)a);
+ OPENSSL_free(a);
}
int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
dsa->write_params=0;
ASN1_TYPE_free(a->parameter);
i=i2d_DSAparams(dsa,NULL);
- p=(unsigned char *)Malloc(i);
+ p=(unsigned char *)OPENSSL_malloc(i);
pp=p;
i2d_DSAparams(dsa,&pp);
a->parameter=ASN1_TYPE_new();
a->parameter->type=V_ASN1_SEQUENCE;
a->parameter->value.sequence=ASN1_STRING_new();
ASN1_STRING_set(a->parameter->value.sequence,p,i);
- Free(p);
+ OPENSSL_free(p);
}
else
#endif
}
if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err;
- if ((s=(unsigned char *)Malloc(i+1)) == NULL) goto err;
+ if ((s=(unsigned char *)OPENSSL_malloc(i+1)) == NULL) goto err;
p=s;
i2d_PublicKey(pkey,&p);
if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err;
pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT;
- Free(s);
+ OPENSSL_free(s);
+#if 0
CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
pk->pkey=pkey;
+#endif
if (*x != NULL)
X509_PUBKEY_free(*x);
/* The following are equivalents but which return RSA and DSA
* keys
*/
-
+#ifndef NO_RSA
RSA *d2i_RSA_PUBKEY(RSA **a, unsigned char **pp,
long length)
{
q = *pp;
pkey = d2i_PUBKEY(NULL, &q, length);
if(!pkey) return NULL;
- key = EVP_PKEY_rget_RSA(pkey);
+ key = EVP_PKEY_get1_RSA(pkey);
EVP_PKEY_free(pkey);
if(!key) return NULL;
*pp = q;
ASN1err(ASN1_F_I2D_RSA_PUBKEY, ERR_R_MALLOC_FAILURE);
return 0;
}
- EVP_PKEY_rset_RSA(pktmp, a);
+ EVP_PKEY_set1_RSA(pktmp, a);
ret = i2d_PUBKEY(pktmp, pp);
EVP_PKEY_free(pktmp);
return ret;
}
+#endif
+#ifndef NO_DSA
DSA *d2i_DSA_PUBKEY(DSA **a, unsigned char **pp,
long length)
{
q = *pp;
pkey = d2i_PUBKEY(NULL, &q, length);
if(!pkey) return NULL;
- key = EVP_PKEY_rget_DSA(pkey);
+ key = EVP_PKEY_get1_DSA(pkey);
EVP_PKEY_free(pkey);
if(!key) return NULL;
*pp = q;
ASN1err(ASN1_F_I2D_DSA_PUBKEY, ERR_R_MALLOC_FAILURE);
return 0;
}
- EVP_PKEY_rset_DSA(pktmp, a);
+ EVP_PKEY_set1_DSA(pktmp, a);
ret = i2d_PUBKEY(pktmp, pp);
EVP_PKEY_free(pktmp);
return ret;
}
+#endif