Latest update
This commit is contained in:
+34
-34
@@ -112,7 +112,7 @@ X509 *d2i_X509_fp(FILE *fp, X509 **x509)
|
||||
return ASN1_item_d2i_fp(ASN1_ITEM_rptr(X509), fp, x509);
|
||||
}
|
||||
|
||||
int i2d_X509_fp(FILE *fp, X509 *x509)
|
||||
int i2d_X509_fp(FILE *fp, const X509 *x509)
|
||||
{
|
||||
return ASN1_item_i2d_fp(ASN1_ITEM_rptr(X509), fp, x509);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ X509 *d2i_X509_bio(BIO *bp, X509 **x509)
|
||||
return ASN1_item_d2i_bio(ASN1_ITEM_rptr(X509), bp, x509);
|
||||
}
|
||||
|
||||
int i2d_X509_bio(BIO *bp, X509 *x509)
|
||||
int i2d_X509_bio(BIO *bp, const X509 *x509)
|
||||
{
|
||||
return ASN1_item_i2d_bio(ASN1_ITEM_rptr(X509), bp, x509);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl)
|
||||
return ASN1_item_d2i_fp(ASN1_ITEM_rptr(X509_CRL), fp, crl);
|
||||
}
|
||||
|
||||
int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl)
|
||||
int i2d_X509_CRL_fp(FILE *fp, const X509_CRL *crl)
|
||||
{
|
||||
return ASN1_item_i2d_fp(ASN1_ITEM_rptr(X509_CRL), fp, crl);
|
||||
}
|
||||
@@ -145,7 +145,7 @@ X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl)
|
||||
return ASN1_item_d2i_bio(ASN1_ITEM_rptr(X509_CRL), bp, crl);
|
||||
}
|
||||
|
||||
int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl)
|
||||
int i2d_X509_CRL_bio(BIO *bp, const X509_CRL *crl)
|
||||
{
|
||||
return ASN1_item_i2d_bio(ASN1_ITEM_rptr(X509_CRL), bp, crl);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7)
|
||||
return ASN1_item_d2i_fp(ASN1_ITEM_rptr(PKCS7), fp, p7);
|
||||
}
|
||||
|
||||
int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7)
|
||||
int i2d_PKCS7_fp(FILE *fp, const PKCS7 *p7)
|
||||
{
|
||||
return ASN1_item_i2d_fp(ASN1_ITEM_rptr(PKCS7), fp, p7);
|
||||
}
|
||||
@@ -167,7 +167,7 @@ PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7)
|
||||
return ASN1_item_d2i_bio(ASN1_ITEM_rptr(PKCS7), bp, p7);
|
||||
}
|
||||
|
||||
int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7)
|
||||
int i2d_PKCS7_bio(BIO *bp, const PKCS7 *p7)
|
||||
{
|
||||
return ASN1_item_i2d_bio(ASN1_ITEM_rptr(PKCS7), bp, p7);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req)
|
||||
return ASN1_item_d2i_fp(ASN1_ITEM_rptr(X509_REQ), fp, req);
|
||||
}
|
||||
|
||||
int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req)
|
||||
int i2d_X509_REQ_fp(FILE *fp, const X509_REQ *req)
|
||||
{
|
||||
return ASN1_item_i2d_fp(ASN1_ITEM_rptr(X509_REQ), fp, req);
|
||||
}
|
||||
@@ -189,7 +189,7 @@ X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req)
|
||||
return ASN1_item_d2i_bio(ASN1_ITEM_rptr(X509_REQ), bp, req);
|
||||
}
|
||||
|
||||
int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req)
|
||||
int i2d_X509_REQ_bio(BIO *bp, const X509_REQ *req)
|
||||
{
|
||||
return ASN1_item_i2d_bio(ASN1_ITEM_rptr(X509_REQ), bp, req);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa)
|
||||
return ASN1_item_d2i_fp(ASN1_ITEM_rptr(RSAPrivateKey), fp, rsa);
|
||||
}
|
||||
|
||||
int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa)
|
||||
int i2d_RSAPrivateKey_fp(FILE *fp, const RSA *rsa)
|
||||
{
|
||||
return ASN1_item_i2d_fp(ASN1_ITEM_rptr(RSAPrivateKey), fp, rsa);
|
||||
}
|
||||
@@ -219,12 +219,12 @@ RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa)
|
||||
(void **)rsa);
|
||||
}
|
||||
|
||||
int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa)
|
||||
int i2d_RSAPublicKey_fp(FILE *fp, const RSA *rsa)
|
||||
{
|
||||
return ASN1_item_i2d_fp(ASN1_ITEM_rptr(RSAPublicKey), fp, rsa);
|
||||
}
|
||||
|
||||
int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa)
|
||||
int i2d_RSA_PUBKEY_fp(FILE *fp, const RSA *rsa)
|
||||
{
|
||||
return ASN1_i2d_fp((I2D_OF(void))i2d_RSA_PUBKEY, fp, rsa);
|
||||
}
|
||||
@@ -235,7 +235,7 @@ RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa)
|
||||
return ASN1_item_d2i_bio(ASN1_ITEM_rptr(RSAPrivateKey), bp, rsa);
|
||||
}
|
||||
|
||||
int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa)
|
||||
int i2d_RSAPrivateKey_bio(BIO *bp, const RSA *rsa)
|
||||
{
|
||||
return ASN1_item_i2d_bio(ASN1_ITEM_rptr(RSAPrivateKey), bp, rsa);
|
||||
}
|
||||
@@ -250,12 +250,12 @@ RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa)
|
||||
return ASN1_d2i_bio_of(RSA, RSA_new, d2i_RSA_PUBKEY, bp, rsa);
|
||||
}
|
||||
|
||||
int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa)
|
||||
int i2d_RSAPublicKey_bio(BIO *bp, const RSA *rsa)
|
||||
{
|
||||
return ASN1_item_i2d_bio(ASN1_ITEM_rptr(RSAPublicKey), bp, rsa);
|
||||
}
|
||||
|
||||
int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa)
|
||||
int i2d_RSA_PUBKEY_bio(BIO *bp, const RSA *rsa)
|
||||
{
|
||||
return ASN1_i2d_bio_of(RSA, i2d_RSA_PUBKEY, bp, rsa);
|
||||
}
|
||||
@@ -268,9 +268,9 @@ DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa)
|
||||
return ASN1_d2i_fp_of(DSA, DSA_new, d2i_DSAPrivateKey, fp, dsa);
|
||||
}
|
||||
|
||||
int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa)
|
||||
int i2d_DSAPrivateKey_fp(FILE *fp, const DSA *dsa)
|
||||
{
|
||||
return ASN1_i2d_fp_of_const(DSA, i2d_DSAPrivateKey, fp, dsa);
|
||||
return ASN1_i2d_fp_of(DSA, i2d_DSAPrivateKey, fp, dsa);
|
||||
}
|
||||
|
||||
DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa)
|
||||
@@ -278,7 +278,7 @@ DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa)
|
||||
return ASN1_d2i_fp_of(DSA, DSA_new, d2i_DSA_PUBKEY, fp, dsa);
|
||||
}
|
||||
|
||||
int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa)
|
||||
int i2d_DSA_PUBKEY_fp(FILE *fp, const DSA *dsa)
|
||||
{
|
||||
return ASN1_i2d_fp_of(DSA, i2d_DSA_PUBKEY, fp, dsa);
|
||||
}
|
||||
@@ -289,9 +289,9 @@ DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa)
|
||||
return ASN1_d2i_bio_of(DSA, DSA_new, d2i_DSAPrivateKey, bp, dsa);
|
||||
}
|
||||
|
||||
int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa)
|
||||
int i2d_DSAPrivateKey_bio(BIO *bp, const DSA *dsa)
|
||||
{
|
||||
return ASN1_i2d_bio_of_const(DSA, i2d_DSAPrivateKey, bp, dsa);
|
||||
return ASN1_i2d_bio_of(DSA, i2d_DSAPrivateKey, bp, dsa);
|
||||
}
|
||||
|
||||
DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa)
|
||||
@@ -299,7 +299,7 @@ DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa)
|
||||
return ASN1_d2i_bio_of(DSA, DSA_new, d2i_DSA_PUBKEY, bp, dsa);
|
||||
}
|
||||
|
||||
int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa)
|
||||
int i2d_DSA_PUBKEY_bio(BIO *bp, const DSA *dsa)
|
||||
{
|
||||
return ASN1_i2d_bio_of(DSA, i2d_DSA_PUBKEY, bp, dsa);
|
||||
}
|
||||
@@ -313,7 +313,7 @@ EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey)
|
||||
return ASN1_d2i_fp_of(EC_KEY, EC_KEY_new, d2i_EC_PUBKEY, fp, eckey);
|
||||
}
|
||||
|
||||
int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey)
|
||||
int i2d_EC_PUBKEY_fp(FILE *fp, const EC_KEY *eckey)
|
||||
{
|
||||
return ASN1_i2d_fp_of(EC_KEY, i2d_EC_PUBKEY, fp, eckey);
|
||||
}
|
||||
@@ -323,7 +323,7 @@ EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey)
|
||||
return ASN1_d2i_fp_of(EC_KEY, EC_KEY_new, d2i_ECPrivateKey, fp, eckey);
|
||||
}
|
||||
|
||||
int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey)
|
||||
int i2d_ECPrivateKey_fp(FILE *fp, const EC_KEY *eckey)
|
||||
{
|
||||
return ASN1_i2d_fp_of(EC_KEY, i2d_ECPrivateKey, fp, eckey);
|
||||
}
|
||||
@@ -333,7 +333,7 @@ EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey)
|
||||
return ASN1_d2i_bio_of(EC_KEY, EC_KEY_new, d2i_EC_PUBKEY, bp, eckey);
|
||||
}
|
||||
|
||||
int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *ecdsa)
|
||||
int i2d_EC_PUBKEY_bio(BIO *bp, const EC_KEY *ecdsa)
|
||||
{
|
||||
return ASN1_i2d_bio_of(EC_KEY, i2d_EC_PUBKEY, bp, ecdsa);
|
||||
}
|
||||
@@ -343,7 +343,7 @@ EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey)
|
||||
return ASN1_d2i_bio_of(EC_KEY, EC_KEY_new, d2i_ECPrivateKey, bp, eckey);
|
||||
}
|
||||
|
||||
int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey)
|
||||
int i2d_ECPrivateKey_bio(BIO *bp, const EC_KEY *eckey)
|
||||
{
|
||||
return ASN1_i2d_bio_of(EC_KEY, i2d_ECPrivateKey, bp, eckey);
|
||||
}
|
||||
@@ -415,7 +415,7 @@ X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8)
|
||||
return ASN1_d2i_fp_of(X509_SIG, X509_SIG_new, d2i_X509_SIG, fp, p8);
|
||||
}
|
||||
|
||||
int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8)
|
||||
int i2d_PKCS8_fp(FILE *fp, const X509_SIG *p8)
|
||||
{
|
||||
return ASN1_i2d_fp_of(X509_SIG, i2d_X509_SIG, fp, p8);
|
||||
}
|
||||
@@ -426,7 +426,7 @@ X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8)
|
||||
return ASN1_d2i_bio_of(X509_SIG, X509_SIG_new, d2i_X509_SIG, bp, p8);
|
||||
}
|
||||
|
||||
int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8)
|
||||
int i2d_PKCS8_bio(BIO *bp, const X509_SIG *p8)
|
||||
{
|
||||
return ASN1_i2d_bio_of(X509_SIG, i2d_X509_SIG, bp, p8);
|
||||
}
|
||||
@@ -439,13 +439,13 @@ PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
|
||||
d2i_PKCS8_PRIV_KEY_INFO, fp, p8inf);
|
||||
}
|
||||
|
||||
int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf)
|
||||
int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, const PKCS8_PRIV_KEY_INFO *p8inf)
|
||||
{
|
||||
return ASN1_i2d_fp_of(PKCS8_PRIV_KEY_INFO, i2d_PKCS8_PRIV_KEY_INFO, fp,
|
||||
p8inf);
|
||||
}
|
||||
|
||||
int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key)
|
||||
int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, const EVP_PKEY *key)
|
||||
{
|
||||
PKCS8_PRIV_KEY_INFO *p8inf;
|
||||
int ret;
|
||||
@@ -457,7 +457,7 @@ int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey)
|
||||
int i2d_PrivateKey_fp(FILE *fp, const EVP_PKEY *pkey)
|
||||
{
|
||||
return ASN1_i2d_fp_of(EVP_PKEY, i2d_PrivateKey, fp, pkey);
|
||||
}
|
||||
@@ -467,7 +467,7 @@ EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a)
|
||||
return ASN1_d2i_fp_of(EVP_PKEY, EVP_PKEY_new, d2i_AutoPrivateKey, fp, a);
|
||||
}
|
||||
|
||||
int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey)
|
||||
int i2d_PUBKEY_fp(FILE *fp, const EVP_PKEY *pkey)
|
||||
{
|
||||
return ASN1_i2d_fp_of(EVP_PKEY, i2d_PUBKEY, fp, pkey);
|
||||
}
|
||||
@@ -486,13 +486,13 @@ PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
|
||||
d2i_PKCS8_PRIV_KEY_INFO, bp, p8inf);
|
||||
}
|
||||
|
||||
int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf)
|
||||
int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, const PKCS8_PRIV_KEY_INFO *p8inf)
|
||||
{
|
||||
return ASN1_i2d_bio_of(PKCS8_PRIV_KEY_INFO, i2d_PKCS8_PRIV_KEY_INFO, bp,
|
||||
p8inf);
|
||||
}
|
||||
|
||||
int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key)
|
||||
int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, const EVP_PKEY *key)
|
||||
{
|
||||
PKCS8_PRIV_KEY_INFO *p8inf;
|
||||
int ret;
|
||||
@@ -504,7 +504,7 @@ int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey)
|
||||
int i2d_PrivateKey_bio(BIO *bp, const EVP_PKEY *pkey)
|
||||
{
|
||||
return ASN1_i2d_bio_of(EVP_PKEY, i2d_PrivateKey, bp, pkey);
|
||||
}
|
||||
@@ -514,7 +514,7 @@ EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a)
|
||||
return ASN1_d2i_bio_of(EVP_PKEY, EVP_PKEY_new, d2i_AutoPrivateKey, bp, a);
|
||||
}
|
||||
|
||||
int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey)
|
||||
int i2d_PUBKEY_bio(BIO *bp, const EVP_PKEY *pkey)
|
||||
{
|
||||
return ASN1_i2d_bio_of(EVP_PKEY, i2d_PUBKEY, bp, pkey);
|
||||
}
|
||||
|
||||
+16
-11
@@ -28,7 +28,7 @@ static int x509_name_ex_d2i(ASN1_VALUE **val,
|
||||
const ASN1_ITEM *it,
|
||||
int tag, int aclass, char opt, ASN1_TLC *ctx);
|
||||
|
||||
static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out,
|
||||
static int x509_name_ex_i2d(const ASN1_VALUE **val, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass);
|
||||
static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it);
|
||||
static void x509_name_ex_free(ASN1_VALUE **val, const ASN1_ITEM *it);
|
||||
@@ -36,10 +36,10 @@ static void x509_name_ex_free(ASN1_VALUE **val, const ASN1_ITEM *it);
|
||||
static int x509_name_encode(X509_NAME *a);
|
||||
static int x509_name_canon(X509_NAME *a);
|
||||
static int asn1_string_canon(ASN1_STRING *out, const ASN1_STRING *in);
|
||||
static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) * intname,
|
||||
static int i2d_name_canon(const STACK_OF(STACK_OF_X509_NAME_ENTRY) * intname,
|
||||
unsigned char **in);
|
||||
|
||||
static int x509_name_ex_print(BIO *out, ASN1_VALUE **pval,
|
||||
static int x509_name_ex_print(BIO *out, const ASN1_VALUE **pval,
|
||||
int indent,
|
||||
const char *fname, const ASN1_PCTX *pctx);
|
||||
|
||||
@@ -156,6 +156,7 @@ static int x509_name_ex_d2i(ASN1_VALUE **val,
|
||||
int i, j, ret;
|
||||
STACK_OF(X509_NAME_ENTRY) *entries;
|
||||
X509_NAME_ENTRY *entry;
|
||||
|
||||
if (len > X509_NAME_MAX)
|
||||
len = X509_NAME_MAX;
|
||||
q = p;
|
||||
@@ -207,11 +208,12 @@ static int x509_name_ex_d2i(ASN1_VALUE **val,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out,
|
||||
static int x509_name_ex_i2d(const ASN1_VALUE **val, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass)
|
||||
{
|
||||
int ret;
|
||||
X509_NAME *a = (X509_NAME *)*val;
|
||||
|
||||
if (a->modified) {
|
||||
ret = x509_name_encode(a);
|
||||
if (ret < 0)
|
||||
@@ -232,7 +234,7 @@ static int x509_name_encode(X509_NAME *a)
|
||||
{
|
||||
union {
|
||||
STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
|
||||
ASN1_VALUE *a;
|
||||
const ASN1_VALUE *a;
|
||||
} intname = {
|
||||
NULL
|
||||
};
|
||||
@@ -241,6 +243,7 @@ static int x509_name_encode(X509_NAME *a)
|
||||
STACK_OF(X509_NAME_ENTRY) *entries = NULL;
|
||||
X509_NAME_ENTRY *entry;
|
||||
int i, set = -1;
|
||||
|
||||
intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
|
||||
if (!intname.s)
|
||||
goto memerr;
|
||||
@@ -277,7 +280,7 @@ static int x509_name_encode(X509_NAME *a)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int x509_name_ex_print(BIO *out, ASN1_VALUE **pval,
|
||||
static int x509_name_ex_print(BIO *out, const ASN1_VALUE **pval,
|
||||
int indent,
|
||||
const char *fname, const ASN1_PCTX *pctx)
|
||||
{
|
||||
@@ -460,11 +463,11 @@ static int asn1_string_canon(ASN1_STRING *out, const ASN1_STRING *in)
|
||||
|
||||
}
|
||||
|
||||
static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) * _intname,
|
||||
static int i2d_name_canon(const STACK_OF(STACK_OF_X509_NAME_ENTRY) * _intname,
|
||||
unsigned char **in)
|
||||
{
|
||||
int i, len, ltmp;
|
||||
ASN1_VALUE *v;
|
||||
const ASN1_VALUE *v;
|
||||
STACK_OF(ASN1_VALUE) *intname = (STACK_OF(ASN1_VALUE) *)_intname;
|
||||
|
||||
len = 0;
|
||||
@@ -479,14 +482,16 @@ static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) * _intname,
|
||||
return len;
|
||||
}
|
||||
|
||||
int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
|
||||
int X509_NAME_set(X509_NAME **xn, const X509_NAME *name)
|
||||
{
|
||||
X509_NAME *name_copy;
|
||||
|
||||
if (*xn == name)
|
||||
return *xn != NULL;
|
||||
if ((name = X509_NAME_dup(name)) == NULL)
|
||||
if ((name_copy = X509_NAME_dup(name)) == NULL)
|
||||
return 0;
|
||||
X509_NAME_free(*xn);
|
||||
*xn = name;
|
||||
*xn = name_copy;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+23
-13
@@ -57,6 +57,7 @@ ASN1_SEQUENCE_cb(X509_PUBKEY, pubkey_cb) = {
|
||||
|
||||
IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY)
|
||||
|
||||
/* TODO should better be called X509_PUBKEY_set1 */
|
||||
int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
|
||||
{
|
||||
X509_PUBKEY *pk = NULL;
|
||||
@@ -67,7 +68,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
|
||||
if ((pk = X509_PUBKEY_new()) == NULL)
|
||||
goto error;
|
||||
|
||||
if (pkey->ameth) {
|
||||
if (pkey != NULL && pkey->ameth) {
|
||||
if (pkey->ameth->pub_encode) {
|
||||
if (!pkey->ameth->pub_encode(pk, pkey)) {
|
||||
X509err(X509_F_X509_PUBKEY_SET,
|
||||
@@ -86,8 +87,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
|
||||
X509_PUBKEY_free(*x);
|
||||
*x = pk;
|
||||
pk->pkey = pkey;
|
||||
EVP_PKEY_up_ref(pkey);
|
||||
return 1;
|
||||
return EVP_PKEY_up_ref(pkey);
|
||||
|
||||
error:
|
||||
X509_PUBKEY_free(pk);
|
||||
@@ -200,15 +200,22 @@ EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length)
|
||||
return pktmp;
|
||||
}
|
||||
|
||||
int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
|
||||
int i2d_PUBKEY(const EVP_PKEY *a, unsigned char **pp)
|
||||
{
|
||||
X509_PUBKEY *xpk = NULL;
|
||||
int ret;
|
||||
if (!a)
|
||||
int ret = -1;
|
||||
|
||||
if (a == NULL)
|
||||
return 0;
|
||||
if (!X509_PUBKEY_set(&xpk, a))
|
||||
if ((xpk = X509_PUBKEY_new()) == NULL)
|
||||
return -1;
|
||||
if (a->ameth != NULL && a->ameth->pub_encode != NULL
|
||||
&& !a->ameth->pub_encode(xpk, a))
|
||||
goto error;
|
||||
xpk->pkey = (EVP_PKEY *)a;
|
||||
ret = i2d_X509_PUBKEY(xpk, pp);
|
||||
xpk->pkey = NULL;
|
||||
error:
|
||||
X509_PUBKEY_free(xpk);
|
||||
return ret;
|
||||
}
|
||||
@@ -238,7 +245,7 @@ RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length)
|
||||
return key;
|
||||
}
|
||||
|
||||
int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp)
|
||||
int i2d_RSA_PUBKEY(const RSA *a, unsigned char **pp)
|
||||
{
|
||||
EVP_PKEY *pktmp;
|
||||
int ret;
|
||||
@@ -249,8 +256,9 @@ int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp)
|
||||
ASN1err(ASN1_F_I2D_RSA_PUBKEY, ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
EVP_PKEY_set1_RSA(pktmp, a);
|
||||
(void)EVP_PKEY_assign_RSA(pktmp, (RSA *)a);
|
||||
ret = i2d_PUBKEY(pktmp, pp);
|
||||
pktmp->pkey.ptr = NULL;
|
||||
EVP_PKEY_free(pktmp);
|
||||
return ret;
|
||||
}
|
||||
@@ -278,7 +286,7 @@ DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length)
|
||||
return key;
|
||||
}
|
||||
|
||||
int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp)
|
||||
int i2d_DSA_PUBKEY(const DSA *a, unsigned char **pp)
|
||||
{
|
||||
EVP_PKEY *pktmp;
|
||||
int ret;
|
||||
@@ -289,8 +297,9 @@ int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp)
|
||||
ASN1err(ASN1_F_I2D_DSA_PUBKEY, ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
EVP_PKEY_set1_DSA(pktmp, a);
|
||||
(void)EVP_PKEY_assign_DSA(pktmp, (DSA *)a);
|
||||
ret = i2d_PUBKEY(pktmp, pp);
|
||||
pktmp->pkey.ptr = NULL;
|
||||
EVP_PKEY_free(pktmp);
|
||||
return ret;
|
||||
}
|
||||
@@ -318,7 +327,7 @@ EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length)
|
||||
return key;
|
||||
}
|
||||
|
||||
int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp)
|
||||
int i2d_EC_PUBKEY(const EC_KEY *a, unsigned char **pp)
|
||||
{
|
||||
EVP_PKEY *pktmp;
|
||||
int ret;
|
||||
@@ -328,8 +337,9 @@ int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp)
|
||||
ASN1err(ASN1_F_I2D_EC_PUBKEY, ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
EVP_PKEY_set1_EC_KEY(pktmp, a);
|
||||
(void)EVP_PKEY_assign_EC_KEY(pktmp, (EC_KEY *)a);
|
||||
ret = i2d_PUBKEY(pktmp, pp);
|
||||
pktmp->pkey.ptr = NULL;
|
||||
EVP_PKEY_free(pktmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,6 @@ ASN1_SEQUENCE_ref(X509, x509_cb) = {
|
||||
} ASN1_SEQUENCE_END_ref(X509, X509)
|
||||
|
||||
IMPLEMENT_ASN1_FUNCTIONS(X509)
|
||||
|
||||
IMPLEMENT_ASN1_DUP_FUNCTION(X509)
|
||||
|
||||
int X509_set_ex_data(X509 *r, int idx, void *arg)
|
||||
@@ -163,7 +162,7 @@ X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length)
|
||||
* error path, but that depends on similar hygiene in lower-level functions.
|
||||
* Here we avoid compounding the problem.
|
||||
*/
|
||||
static int i2d_x509_aux_internal(X509 *a, unsigned char **pp)
|
||||
static int i2d_x509_aux_internal(const X509 *a, unsigned char **pp)
|
||||
{
|
||||
int length, tmplen;
|
||||
unsigned char *start = pp != NULL ? *pp : NULL;
|
||||
@@ -197,7 +196,7 @@ static int i2d_x509_aux_internal(X509 *a, unsigned char **pp)
|
||||
* the allocation, nor can we allow i2d_X509_CERT_AUX() to increment the
|
||||
* allocated buffer.
|
||||
*/
|
||||
int i2d_X509_AUX(X509 *a, unsigned char **pp)
|
||||
int i2d_X509_AUX(const X509 *a, unsigned char **pp)
|
||||
{
|
||||
int length;
|
||||
unsigned char *tmp;
|
||||
|
||||
Reference in New Issue
Block a user