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

« back to all changes in this revision

Viewing changes to crypto/ecdsa/ecdsa.h

  • 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:
4
4
 * \author Written by Nils Larsch for the OpenSSL project
5
5
 */
6
6
/* ====================================================================
7
 
 * Copyright (c) 2000-2003 The OpenSSL Project.  All rights reserved.
 
7
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
8
8
 *
9
9
 * Redistribution and use in source and binary forms, with or without
10
10
 * modification, are permitted provided that the following conditions
81
81
        BIGNUM *s;
82
82
        } ECDSA_SIG;
83
83
 
84
 
/** ECDSA_SIG *ECDSA_SIG_new(void)
85
 
 * allocates and initialize a ECDSA_SIG structure
86
 
 * \return pointer to a ECDSA_SIG structure or NULL if an error occurred
 
84
/** Allocates and initialize a ECDSA_SIG structure
 
85
 *  \return pointer to a ECDSA_SIG structure or NULL if an error occurred
87
86
 */
88
87
ECDSA_SIG *ECDSA_SIG_new(void);
89
88
 
90
 
/** ECDSA_SIG_free
91
 
 * frees a ECDSA_SIG structure
92
 
 * \param a pointer to the ECDSA_SIG structure
93
 
 */
94
 
void      ECDSA_SIG_free(ECDSA_SIG *a);
95
 
 
96
 
/** i2d_ECDSA_SIG
97
 
 * DER encode content of ECDSA_SIG object (note: this function modifies *pp
98
 
 * (*pp += length of the DER encoded signature)).
99
 
 * \param a  pointer to the ECDSA_SIG object
100
 
 * \param pp pointer to a unsigned char pointer for the output or NULL
101
 
 * \return the length of the DER encoded ECDSA_SIG object or 0 
102
 
 */
103
 
int       i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **pp);
104
 
 
105
 
/** d2i_ECDSA_SIG
106
 
 * decodes a DER encoded ECDSA signature (note: this function changes *pp
107
 
 * (*pp += len)). 
108
 
 * \param v pointer to ECDSA_SIG pointer (may be NULL)
109
 
 * \param pp buffer with the DER encoded signature
110
 
 * \param len bufferlength
111
 
 * \return pointer to the decoded ECDSA_SIG structure (or NULL)
112
 
 */
113
 
ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **v, const unsigned char **pp, long len);
114
 
 
115
 
/** ECDSA_do_sign
116
 
 * computes the ECDSA signature of the given hash value using
117
 
 * the supplied private key and returns the created signature.
118
 
 * \param dgst pointer to the hash value
119
 
 * \param dgst_len length of the hash value
120
 
 * \param eckey pointer to the EC_KEY object containing a private EC key
121
 
 * \return pointer to a ECDSA_SIG structure or NULL
 
89
/** frees a ECDSA_SIG structure
 
90
 *  \param  sig  pointer to the ECDSA_SIG structure
 
91
 */
 
92
void      ECDSA_SIG_free(ECDSA_SIG *sig);
 
93
 
 
94
/** DER encode content of ECDSA_SIG object (note: this function modifies *pp
 
95
 *  (*pp += length of the DER encoded signature)).
 
96
 *  \param  sig  pointer to the ECDSA_SIG object
 
97
 *  \param  pp   pointer to a unsigned char pointer for the output or NULL
 
98
 *  \return the length of the DER encoded ECDSA_SIG object or 0 
 
99
 */
 
100
int       i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp);
 
101
 
 
102
/** Decodes a DER encoded ECDSA signature (note: this function changes *pp
 
103
 *  (*pp += len)). 
 
104
 *  \param  sig  pointer to ECDSA_SIG pointer (may be NULL)
 
105
 *  \param  pp   memory buffer with the DER encoded signature
 
106
 *  \param  len  length of the buffer
 
107
 *  \return pointer to the decoded ECDSA_SIG structure (or NULL)
 
108
 */
 
109
ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len);
 
110
 
 
111
/** Computes the ECDSA signature of the given hash value using
 
112
 *  the supplied private key and returns the created signature.
 
113
 *  \param  dgst      pointer to the hash value
 
114
 *  \param  dgst_len  length of the hash value
 
115
 *  \param  eckey     EC_KEY object containing a private EC key
 
116
 *  \return pointer to a ECDSA_SIG structure or NULL if an error occurred
122
117
 */
123
118
ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst,int dgst_len,EC_KEY *eckey);
124
119
 
125
 
/** ECDSA_do_sign_ex
126
 
 * computes ECDSA signature of a given hash value using the supplied
127
 
 * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
128
 
 * \param dgst pointer to the hash value to sign
129
 
 * \param dgstlen length of the hash value
130
 
 * \param kinv optional pointer to a pre-computed inverse k
131
 
 * \param rp optional pointer to the pre-computed rp value (see 
132
 
 *        ECDSA_sign_setup
133
 
 * \param eckey pointer to the EC_KEY object containing a private EC key
134
 
 * \return pointer to a ECDSA_SIG structure or NULL
 
120
/** Computes ECDSA signature of a given hash value using the supplied
 
121
 *  private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
 
122
 *  \param  dgst     pointer to the hash value to sign
 
123
 *  \param  dgstlen  length of the hash value
 
124
 *  \param  kinv     BIGNUM with a pre-computed inverse k (optional)
 
125
 *  \param  rp       BIGNUM with a pre-computed rp value (optioanl), 
 
126
 *                   see ECDSA_sign_setup
 
127
 *  \param  eckey    EC_KEY object containing a private EC key
 
128
 *  \return pointer to a ECDSA_SIG structure or NULL if an error occurred
135
129
 */
136
130
ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, 
137
131
                const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);
138
132
 
139
 
/** ECDSA_do_verify
140
 
 * verifies that the supplied signature is a valid ECDSA
141
 
 * signature of the supplied hash value using the supplied public key.
142
 
 * \param dgst pointer to the hash value
143
 
 * \param dgst_len length of the hash value
144
 
 * \param sig  pointer to the ECDSA_SIG structure
145
 
 * \param eckey pointer to the EC_KEY object containing a public EC key
146
 
 * \return 1 if the signature is valid, 0 if the signature is invalid and -1 on error
 
133
/** Verifies that the supplied signature is a valid ECDSA
 
134
 *  signature of the supplied hash value using the supplied public key.
 
135
 *  \param  dgst      pointer to the hash value
 
136
 *  \param  dgst_len  length of the hash value
 
137
 *  \param  sig       ECDSA_SIG structure
 
138
 *  \param  eckey     EC_KEY object containing a public EC key
 
139
 *  \return 1 if the signature is valid, 0 if the signature is invalid
 
140
 *          and -1 on error
147
141
 */
148
142
int       ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
149
143
                const ECDSA_SIG *sig, EC_KEY* eckey);
150
144
 
151
145
const ECDSA_METHOD *ECDSA_OpenSSL(void);
152
146
 
153
 
/** ECDSA_set_default_method
154
 
 * sets the default ECDSA method
155
 
 * \param meth the new default ECDSA_METHOD
 
147
/** Sets the default ECDSA method
 
148
 *  \param  meth  new default ECDSA_METHOD
156
149
 */
157
150
void      ECDSA_set_default_method(const ECDSA_METHOD *meth);
158
151
 
159
 
/** ECDSA_get_default_method
160
 
 * returns the default ECDSA method
161
 
 * \return pointer to ECDSA_METHOD structure containing the default method
 
152
/** Returns the default ECDSA method
 
153
 *  \return pointer to ECDSA_METHOD structure containing the default method
162
154
 */
163
155
const ECDSA_METHOD *ECDSA_get_default_method(void);
164
156
 
165
 
/** ECDSA_set_method
166
 
 * sets method to be used for the ECDSA operations
167
 
 * \param eckey pointer to the EC_KEY object
168
 
 * \param meth  pointer to the new method
169
 
 * \return 1 on success and 0 otherwise 
 
157
/** Sets method to be used for the ECDSA operations
 
158
 *  \param  eckey  EC_KEY object
 
159
 *  \param  meth   new method
 
160
 *  \return 1 on success and 0 otherwise 
170
161
 */
171
162
int       ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);
172
163
 
173
 
/** ECDSA_size
174
 
 * returns the maximum length of the DER encoded signature
175
 
 * \param  eckey pointer to a EC_KEY object
176
 
 * \return numbers of bytes required for the DER encoded signature
 
164
/** Returns the maximum length of the DER encoded signature
 
165
 *  \param  eckey  EC_KEY object
 
166
 *  \return numbers of bytes required for the DER encoded signature
177
167
 */
178
168
int       ECDSA_size(const EC_KEY *eckey);
179
169
 
180
 
/** ECDSA_sign_setup
181
 
 * precompute parts of the signing operation. 
182
 
 * \param eckey pointer to the EC_KEY object containing a private EC key
183
 
 * \param ctx  pointer to a BN_CTX object (may be NULL)
184
 
 * \param kinv pointer to a BIGNUM pointer for the inverse of k
185
 
 * \param rp   pointer to a BIGNUM pointer for x coordinate of k * generator
186
 
 * \return 1 on success and 0 otherwise
 
170
/** Precompute parts of the signing operation
 
171
 *  \param  eckey  EC_KEY object containing a private EC key
 
172
 *  \param  ctx    BN_CTX object (optional)
 
173
 *  \param  kinv   BIGNUM pointer for the inverse of k
 
174
 *  \param  rp     BIGNUM pointer for x coordinate of k * generator
 
175
 *  \return 1 on success and 0 otherwise
187
176
 */
188
177
int       ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, 
189
178
                BIGNUM **rp);
190
179
 
191
 
/** ECDSA_sign
192
 
 * computes ECDSA signature of a given hash value using the supplied
193
 
 * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
194
 
 * \param type this parameter is ignored
195
 
 * \param dgst pointer to the hash value to sign
196
 
 * \param dgstlen length of the hash value
197
 
 * \param sig buffer to hold the DER encoded signature
198
 
 * \param siglen pointer to the length of the returned signature
199
 
 * \param eckey pointer to the EC_KEY object containing a private EC key
200
 
 * \return 1 on success and 0 otherwise
 
180
/** Computes ECDSA signature of a given hash value using the supplied
 
181
 *  private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
 
182
 *  \param  type     this parameter is ignored
 
183
 *  \param  dgst     pointer to the hash value to sign
 
184
 *  \param  dgstlen  length of the hash value
 
185
 *  \param  sig      memory for the DER encoded created signature
 
186
 *  \param  siglen   pointer to the length of the returned signature
 
187
 *  \param  eckey    EC_KEY object containing a private EC key
 
188
 *  \return 1 on success and 0 otherwise
201
189
 */
202
190
int       ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, 
203
191
                unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
204
192
 
205
193
 
206
 
/** ECDSA_sign_ex
207
 
 * computes ECDSA signature of a given hash value using the supplied
208
 
 * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
209
 
 * \param type this parameter is ignored
210
 
 * \param dgst pointer to the hash value to sign
211
 
 * \param dgstlen length of the hash value
212
 
 * \param sig buffer to hold the DER encoded signature
213
 
 * \param siglen pointer to the length of the returned signature
214
 
 * \param kinv optional pointer to a pre-computed inverse k
215
 
 * \param rp optional pointer to the pre-computed rp value (see 
216
 
 *        ECDSA_sign_setup
217
 
 * \param eckey pointer to the EC_KEY object containing a private EC key
218
 
 * \return 1 on success and 0 otherwise
 
194
/** Computes ECDSA signature of a given hash value using the supplied
 
195
 *  private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
 
196
 *  \param  type     this parameter is ignored
 
197
 *  \param  dgst     pointer to the hash value to sign
 
198
 *  \param  dgstlen  length of the hash value
 
199
 *  \param  sig      buffer to hold the DER encoded signature
 
200
 *  \param  siglen   pointer to the length of the returned signature
 
201
 *  \param  kinv     BIGNUM with a pre-computed inverse k (optional)
 
202
 *  \param  rp       BIGNUM with a pre-computed rp value (optioanl), 
 
203
 *                   see ECDSA_sign_setup
 
204
 *  \param  eckey    EC_KEY object containing a private EC key
 
205
 *  \return 1 on success and 0 otherwise
219
206
 */
220
207
int       ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, 
221
208
                unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv,
222
209
                const BIGNUM *rp, EC_KEY *eckey);
223
210
 
224
 
/** ECDSA_verify
225
 
 * verifies that the given signature is valid ECDSA signature
226
 
 * of the supplied hash value using the specified public key.
227
 
 * \param type this parameter is ignored
228
 
 * \param dgst pointer to the hash value 
229
 
 * \param dgstlen length of the hash value
230
 
 * \param sig  pointer to the DER encoded signature
231
 
 * \param siglen length of the DER encoded signature
232
 
 * \param eckey pointer to the EC_KEY object containing a public EC key
233
 
 * \return 1 if the signature is valid, 0 if the signature is invalid and -1 on error
 
211
/** Verifies that the given signature is valid ECDSA signature
 
212
 *  of the supplied hash value using the specified public key.
 
213
 *  \param  type     this parameter is ignored
 
214
 *  \param  dgst     pointer to the hash value 
 
215
 *  \param  dgstlen  length of the hash value
 
216
 *  \param  sig      pointer to the DER encoded signature
 
217
 *  \param  siglen   length of the DER encoded signature
 
218
 *  \param  eckey    EC_KEY object containing a public EC key
 
219
 *  \return 1 if the signature is valid, 0 if the signature is invalid
 
220
 *          and -1 on error
234
221
 */
235
222
int       ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, 
236
223
                const unsigned char *sig, int siglen, EC_KEY *eckey);