~ubuntu-branches/ubuntu/trusty/openssl/trusty

« back to all changes in this revision

Viewing changes to doc/crypto/EVP_PKEY_verify_recover.pod

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-05-21 16:31:47 UTC
  • mfrom: (11.1.41 sid)
  • Revision ID: package-import@ubuntu.com-20130521163147-96isrq0asz929zm6
Tags: 1.0.1e-2ubuntu1
* Resynchronise with Debian unstable.  Remaining changes:
  - debian/libssl1.0.0.postinst:
    + Display a system restart required notification on libssl1.0.0
      upgrade on servers.
    + 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/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: i586 (on i386)
    + Fix Makefile to properly clean up libs/ dirs in clean target.
    + Replace duplicate files in the doc directory with symlinks.
  - Unapply patch c_rehash-multi and comment it out in the series as it
    breaks parsing of certificates with CRLF line endings and other cases
    (see Debian #642314 for discussion), it also changes the semantics of
    c_rehash directories by requiring applications to parse hash link
    targets as files containing potentially *multiple* certificates rather
    than exactly one.
  - debian/patches/tls12_workarounds.patch: Workaround large client hello
    issues when TLS 1.1 and lower is in use
  - debian/control: Mark Debian Vcs-* as XS-Debian-Vcs-*
  - debian/patches/ubuntu_deb676533_arm_asm.patch: Enable arm assembly
    code.
  - debian/patches/arm64-support: Add basic arm64 support (no assembler)
  - debian/rules: Enable optimized 64bit elliptic curve code contributed
    by Google.
* debian/patches/tls12_workarounds.patch: updated to also disable TLS 1.2
  in test suite since we disable it in the client.
* Dropped changes:
  - debian/patches/CVE-2013-0169.patch: upstream.
  - debian/patches/fix_key_decoding_deadlock.patch: upstream.
  - debian/patches/CVE-2013-0166.patch: upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=pod
 
2
 
 
3
=head1 NAME
 
4
 
 
5
EVP_PKEY_verify_recover_init, EVP_PKEY_verify_recover - recover signature using a public key algorithm
 
6
 
 
7
=head1 SYNOPSIS
 
8
 
 
9
 #include <openssl/evp.h>
 
10
 
 
11
 int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);
 
12
 int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,
 
13
                        unsigned char *rout, size_t *routlen,
 
14
                        const unsigned char *sig, size_t siglen);
 
15
 
 
16
=head1 DESCRIPTION
 
17
 
 
18
The EVP_PKEY_verify_recover_init() function initializes a public key algorithm
 
19
context using key B<pkey> for a verify recover operation.
 
20
 
 
21
The EVP_PKEY_verify_recover() function recovers signed data
 
22
using B<ctx>. The signature is specified using the B<sig> and
 
23
B<siglen> parameters. If B<rout> is B<NULL> then the maximum size of the output
 
24
buffer is written to the B<routlen> parameter. If B<rout> is not B<NULL> then
 
25
before the call the B<routlen> parameter should contain the length of the
 
26
B<rout> buffer, if the call is successful recovered data is written to
 
27
B<rout> and the amount of data written to B<routlen>.
 
28
 
 
29
=head1 NOTES
 
30
 
 
31
Normally an application is only interested in whether a signature verification
 
32
operation is successful in those cases the EVP_verify() function should be 
 
33
used.
 
34
 
 
35
Sometimes however it is useful to obtain the data originally signed using a
 
36
signing operation. Only certain public key algorithms can recover a signature
 
37
in this way (for example RSA in PKCS padding mode).
 
38
 
 
39
After the call to EVP_PKEY_verify_recover_init() algorithm specific control
 
40
operations can be performed to set any appropriate parameters for the
 
41
operation.
 
42
 
 
43
The function EVP_PKEY_verify_recover() can be called more than once on the same
 
44
context if several operations are performed using the same parameters.
 
45
 
 
46
=head1 RETURN VALUES
 
47
 
 
48
EVP_PKEY_verify_recover_init() and EVP_PKEY_verify_recover() return 1 for success
 
49
and 0 or a negative value for failure. In particular a return value of -2
 
50
indicates the operation is not supported by the public key algorithm.
 
51
 
 
52
=head1 EXAMPLE
 
53
 
 
54
Recover digest originally signed using PKCS#1 and SHA256 digest:
 
55
 
 
56
 #include <openssl/evp.h>
 
57
 #include <openssl/rsa.h>
 
58
 
 
59
 EVP_PKEY_CTX *ctx;
 
60
 unsigned char *rout, *sig;
 
61
 size_t routlen, siglen; 
 
62
 EVP_PKEY *verify_key;
 
63
 /* NB: assumes verify_key, sig and siglen are already set up
 
64
  * and that verify_key is an RSA public key
 
65
  */
 
66
 ctx = EVP_PKEY_CTX_new(verify_key);
 
67
 if (!ctx)
 
68
        /* Error occurred */
 
69
 if (EVP_PKEY_verify_recover_init(ctx) <= 0)
 
70
        /* Error */
 
71
 if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)
 
72
        /* Error */
 
73
 if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0)
 
74
        /* Error */
 
75
 
 
76
 /* Determine buffer length */
 
77
 if (EVP_PKEY_verify_recover(ctx, NULL, &routlen, sig, siglen) <= 0)
 
78
        /* Error */
 
79
 
 
80
 rout = OPENSSL_malloc(routlen);
 
81
 
 
82
 if (!rout)
 
83
        /* malloc failure */
 
84
 
 
85
 if (EVP_PKEY_verify_recover(ctx, rout, &routlen, sig, siglen) <= 0)
 
86
        /* Error */
 
87
 
 
88
 /* Recovered data is routlen bytes written to buffer rout */
 
89
 
 
90
=head1 SEE ALSO
 
91
 
 
92
L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
 
93
L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
 
94
L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
 
95
L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
 
96
L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
 
97
L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> 
 
98
 
 
99
=head1 HISTORY
 
100
 
 
101
These functions were first added to OpenSSL 1.0.0.
 
102
 
 
103
=cut