~andersk/ubuntu/oneiric/openssl/spurious-reboot

« back to all changes in this revision

Viewing changes to crypto/evp/p_sign.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-05-01 23:51:53 UTC
  • mfrom: (11.1.20 sid)
  • Revision ID: james.westby@ubuntu.com-20110501235153-bjcxitndquaezb68
Tags: 1.0.0d-2ubuntu1
* Resynchronise with Debian (LP: #675566).  Remaining changes:
  - debian/libssl1.0.0.postinst:
    + Display a system restart required notification bubble on libssl1.0.0
      upgrade.
    + Use a different priority for libssl1.0.0/restart-services depending
      on whether a desktop, or server dist-upgrade is being performed.
  - debian/{libssl1.0.0-udeb.dirs, control, rules}: Create
    libssl1.0.0-udeb, for the benefit of wget-udeb (no wget-udeb package
    in Debian).
  - debian/{libcrypto1.0.0-udeb.dirs, libssl1.0.0.dirs, libssl1.0.0.files,
    rules}: Move runtime libraries to /lib, for the benefit of
    wpasupplicant.
  - debian/patches/aesni.patch: Backport Intel AES-NI support, now from
    http://rt.openssl.org/Ticket/Display.html?id=2065 rather than the
    0.9.8 variant.
  - debian/patches/Bsymbolic-functions.patch: Link using
    -Bsymbolic-functions.
  - debian/patches/perlpath-quilt.patch: Don't change perl #! paths under
    .pc.
  - debian/rules:
    + Don't run 'make test' when cross-building.
    + Use host compiler when cross-building.  Patch from Neil Williams.
    + Don't build for processors no longer supported: i486, i586 (on
      i386), v8 (on sparc).
    + Fix Makefile to properly clean up libs/ dirs in clean target.
    + Replace duplicate files in the doc directory with symlinks.
* Update architectures affected by Bsymbolic-functions.patch.
* Drop debian/patches/no-sslv2.patch; Debian now adds the 'no-ssl2'
  configure option, which compiles out SSLv2 support entirely, so this is
  no longer needed.
* Drop openssl-doc in favour of the libssl-doc package introduced by
  Debian.  Add Conflicts/Replaces until the next LTS release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
        unsigned char m[EVP_MAX_MD_SIZE];
82
82
        unsigned int m_len;
83
83
        int i,ok=0,v;
84
 
        MS_STATIC EVP_MD_CTX tmp_ctx;
 
84
        EVP_MD_CTX tmp_ctx;
85
85
 
86
86
        *siglen=0;
 
87
        EVP_MD_CTX_init(&tmp_ctx);
 
88
        EVP_MD_CTX_copy_ex(&tmp_ctx,ctx);   
 
89
        EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len);
 
90
        EVP_MD_CTX_cleanup(&tmp_ctx);
 
91
 
 
92
        if (ctx->digest->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE)
 
93
                {
 
94
                EVP_PKEY_CTX *pkctx = NULL;
 
95
                size_t sltmp = (size_t)EVP_PKEY_size(pkey);
 
96
                i = 0;
 
97
                pkctx = EVP_PKEY_CTX_new(pkey, NULL);
 
98
                if (!pkctx)
 
99
                        goto err;
 
100
                if (EVP_PKEY_sign_init(pkctx) <= 0)
 
101
                        goto err;
 
102
                if (EVP_PKEY_CTX_set_signature_md(pkctx, ctx->digest) <= 0)
 
103
                        goto err;
 
104
                if (EVP_PKEY_sign(pkctx, sigret, &sltmp, m, m_len) <= 0)
 
105
                        goto err;
 
106
                *siglen = sltmp;
 
107
                i = 1;
 
108
                err:
 
109
                EVP_PKEY_CTX_free(pkctx);
 
110
                return i;
 
111
                }
 
112
 
87
113
        for (i=0; i<4; i++)
88
114
                {
89
115
                v=ctx->digest->required_pkey_type[i];
99
125
                EVPerr(EVP_F_EVP_SIGNFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE);
100
126
                return(0);
101
127
                }
 
128
 
102
129
        if (ctx->digest->sign == NULL)
103
130
                {
104
131
                EVPerr(EVP_F_EVP_SIGNFINAL,EVP_R_NO_SIGN_FUNCTION_CONFIGURED);
105
132
                return(0);
106
133
                }
107
 
        EVP_MD_CTX_init(&tmp_ctx);
108
 
        EVP_MD_CTX_copy_ex(&tmp_ctx,ctx);
109
 
        if (ctx->digest->flags & EVP_MD_FLAG_SVCTX)
110
 
                {
111
 
                EVP_MD_SVCTX sctmp;
112
 
                sctmp.mctx = &tmp_ctx;
113
 
                sctmp.key = pkey->pkey.ptr;
114
 
                i = ctx->digest->sign(ctx->digest->type,
115
 
                        NULL, -1, sigret, siglen, &sctmp);
116
 
                }
117
 
        else
118
 
                {
119
 
                EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len);
120
 
                i = ctx->digest->sign(ctx->digest->type,m,m_len,sigret,siglen,
121
 
                                        pkey->pkey.ptr);
122
 
                }
123
 
        EVP_MD_CTX_cleanup(&tmp_ctx);
124
 
        return i;
 
134
        return(ctx->digest->sign(ctx->digest->type,m,m_len,sigret,siglen,
 
135
                pkey->pkey.ptr));
125
136
        }
126
137