~ubuntu-branches/ubuntu/feisty/wpasupplicant/feisty

« back to all changes in this revision

Viewing changes to crypto.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2007-04-01 10:53:37 UTC
  • Revision ID: james.westby@ubuntu.com-20070401105337-3dd89n3g8ecdhjsl
Tags: 0.5.7-0ubuntu2
Apply patch from upstream after private email discussion:
http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=33673d3f43da6f5ec0f0aa5a8245a1617b6eb2fd#patch1
Fixes LP: #98895, #98925

Show diffs side-by-side

added added

removed removed

Lines of Context:
183
183
 * (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
184
184
 * to implement this.
185
185
 */
186
 
int crypto_hash_finish(struct crypto_hash *ctx, u8 *hash, size_t *len);
 
186
int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len);
187
187
 
188
188
 
189
189
enum crypto_cipher_alg {
252
252
 
253
253
 
254
254
struct crypto_public_key;
255
 
struct crypto_private_key;
256
255
 
257
256
/**
258
257
 * crypto_public_key_import - Import an RSA public key
259
258
 * @key: Key buffer (DER encoded RSA public key)
260
259
 * @len: Key buffer length in bytes
261
 
 * Returns: Pointer to the public key or %NULL on failure
 
260
 * Returns: Pointer to public key or %NULL on failure
262
261
 *
263
262
 * This function can just return %NULL if the crypto library supports X.509
264
263
 * parsing. In that case, crypto_public_key_from_cert() is used to import the
271
270
struct crypto_public_key * crypto_public_key_import(const u8 *key, size_t len);
272
271
 
273
272
/**
274
 
 * crypto_private_key_import - Import an RSA private key
275
 
 * @key: Key buffer (DER encoded RSA private key)
276
 
 * @len: Key buffer length in bytes
277
 
 * Returns: Pointer to the private key or %NULL on failure
278
 
 *
279
 
 * This function is only used with internal TLSv1 implementation
280
 
 * (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
281
 
 * to implement this.
282
 
 */
283
 
struct crypto_private_key * crypto_private_key_import(const u8 *key,
284
 
                                                      size_t len);
285
 
 
286
 
/**
287
273
 * crypto_public_key_from_cert - Import an RSA public key from a certificate
288
274
 * @buf: DER encoded X.509 certificate
289
275
 * @len: Certificate buffer length in bytes
318
304
                                        u8 *out, size_t *outlen);
319
305
 
320
306
/**
321
 
 * crypto_private_key_sign_pkcs1 - Sign with private key (PKCS #1)
322
 
 * @key: Private key from crypto_private_key_import()
323
 
 * @in: Plaintext buffer
324
 
 * @inlen: Length of plaintext buffer in bytes
325
 
 * @out: Output buffer for encrypted (signed) data
326
 
 * @outlen: Length of output buffer in bytes; set to used length on success
327
 
 * Returns: 0 on success, -1 on failure
328
 
 *
329
 
 * This function is only used with internal TLSv1 implementation
330
 
 * (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
331
 
 * to implement this.
332
 
 */
333
 
int crypto_private_key_sign_pkcs1(struct crypto_private_key *key,
334
 
                                  const u8 *in, size_t inlen,
335
 
                                  u8 *out, size_t *outlen);
336
 
 
337
 
/**
338
307
 * crypto_public_key_free - Free public key
339
308
 * @key: Public key
340
309
 *
344
313
 */
345
314
void crypto_public_key_free(struct crypto_public_key *key);
346
315
 
347
 
/**
348
 
 * crypto_private_key_free - Free private key
349
 
 * @key: Private key from crypto_private_key_import()
350
 
 *
351
 
 * This function is only used with internal TLSv1 implementation
352
 
 * (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need
353
 
 * to implement this.
354
 
 */
355
 
void crypto_private_key_free(struct crypto_private_key *key);
356
 
 
357
 
/**
358
 
 * crypto_public_key_decrypt_pkcs1 - Decrypt PKCS #1 signature
359
 
 * @key: Public key
360
 
 * @crypt: Encrypted signature data (using the private key)
361
 
 * @crypt_len: Encrypted signature data length
362
 
 * @plain: Buffer for plaintext (at least crypt_len bytes)
363
 
 * @plain_len: Plaintext length (max buffer size on input, real len on output);
364
 
 * Returns: 0 on success, -1 on failure
365
 
 */
366
 
int crypto_public_key_decrypt_pkcs1(struct crypto_public_key *key,
367
 
                                    const u8 *crypt, size_t crypt_len,
368
 
                                    u8 *plain, size_t *plain_len);
369
316
 
370
317
/**
371
318
 * crypto_global_init - Initialize crypto wrapper
393
340
 * @power_len: Length of power integer in bytes
394
341
 * @modulus: Modulus integer (big endian byte array)
395
342
 * @modulus_len: Length of modulus integer in bytes
396
 
 * @result: Buffer for the result
397
 
 * @result_len: Result length (max buffer size on input, real len on output)
398
343
 * Returns: 0 on success, -1 on failure
399
344
 *
400
345
 * This function calculates result = base ^ power mod modulus. modules_len is