add X509_CRL_sign_ctx function
authorDr. Stephen Henson <steve@openssl.org>
Sun, 14 Mar 2010 12:52:38 +0000 (12:52 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 14 Mar 2010 12:52:38 +0000 (12:52 +0000)
crypto/asn1/a_sign.c
crypto/x509/x509.h
crypto/x509/x_all.c

index f1ec73a..7b4a193 100644 (file)
@@ -224,13 +224,13 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
                EVP_MD_CTX_cleanup(&ctx);
                return 0;
                }
-       return ASN1_item_sign_ctx(&ctx, it, algor1, algor2, signature, asn);
+       return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx);
        }
                
 
-int ASN1_item_sign_ctx(EVP_MD_CTX *ctx,
-               const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
-               ASN1_BIT_STRING *signature, void *asn)
+int ASN1_item_sign_ctx(const ASN1_ITEM *it,
+               X509_ALGOR *algor1, X509_ALGOR *algor2,
+               ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx)
        {
        const EVP_MD *type;
        EVP_PKEY *pkey;
index abd526e..9376ab0 100644 (file)
@@ -660,8 +660,11 @@ int X509_signature_dump(BIO *bp,const ASN1_STRING *sig, int indent);
 int X509_signature_print(BIO *bp,X509_ALGOR *alg, ASN1_STRING *sig);
 
 int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
 int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
 int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
 int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
 
 int X509_pubkey_digest(const X509 *data,const EVP_MD *type,
@@ -897,9 +900,9 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1,
 int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
        ASN1_BIT_STRING *signature,
        void *data, EVP_PKEY *pkey, const EVP_MD *type);
-int ASN1_item_sign_ctx(EVP_MD_CTX *ctx,
-               const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
-               ASN1_BIT_STRING *signature, void *asn);
+int ASN1_item_sign_ctx(const ASN1_ITEM *it,
+               X509_ALGOR *algor1, X509_ALGOR *algor2,
+               ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx);
 #endif
 
 int            X509_set_version(X509 *x,long version);
index ebae30b..080a2de 100644 (file)
@@ -94,12 +94,25 @@ int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
                x->sig_alg, x->signature, x->cert_info,pkey,md));
        }
 
+int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx)
+       {
+       return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CINF),
+               x->cert_info->signature,
+               x->sig_alg, x->signature, x->cert_info, ctx);
+       }
+
 int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md)
        {
        return(ASN1_item_sign(ASN1_ITEM_rptr(X509_REQ_INFO),x->sig_alg, NULL,
                x->signature, x->req_info,pkey,md));
        }
 
+int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx)
+       {
+       return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_REQ_INFO),
+               x->sig_alg, NULL, x->signature, x->req_info, ctx);
+       }
+
 int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md)
        {
        x->crl->enc.modified = 1;
@@ -107,6 +120,12 @@ int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md)
                x->sig_alg, x->signature, x->crl,pkey,md));
        }
 
+int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx)
+       {
+       return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CRL_INFO),
+               x->crl->sig_alg, x->sig_alg, x->signature, x->crl, ctx);
+       }
+
 int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md)
        {
        return(ASN1_item_sign(ASN1_ITEM_rptr(NETSCAPE_SPKAC), x->sig_algor,NULL,