~ubuntu-branches/ubuntu/quantal/gnutls26/quantal

« back to all changes in this revision

Viewing changes to lib/gnutls_cipher_int.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-05-20 13:07:18 UTC
  • mfrom: (12.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110520130718-db41dybbanzfvlji
Tags: 2.10.5-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Fix build failure with --no-add-needed.
  - Build for multiarch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2000, 2004, 2005, 2008 Free Software Foundation
 
2
 * Copyright (C) 2009, 2010 Free Software Foundation, Inc.
3
3
 *
4
4
 * Author: Nikos Mavrogiannopoulos
5
5
 *
6
 
 * This file is part of GNUTLS.
 
6
 * This file is part of GnuTLS.
7
7
 *
8
 
 * The GNUTLS library is free software; you can redistribute it and/or
 
8
 * The GnuTLS is free software; you can redistribute it and/or
9
9
 * modify it under the terms of the GNU Lesser General Public License
10
10
 * as published by the Free Software Foundation; either version 2.1 of
11
11
 * the License, or (at your option) any later version.
40
40
                     const gnutls_datum_t * key, const gnutls_datum_t * iv)
41
41
{
42
42
  int ret = GNUTLS_E_INTERNAL_ERROR;
43
 
  gnutls_crypto_single_cipher_st *cc = NULL;
 
43
  const gnutls_crypto_cipher_st *cc = NULL;
44
44
 
45
45
  /* check if a cipher has been registered
46
46
   */
49
49
    {
50
50
      handle->registered = 1;
51
51
      handle->hd.rh.cc = cc;
52
 
      SR (cc->init (&handle->hd.rh.ctx), cc_cleanup);
 
52
      SR (cc->init (cipher, &handle->hd.rh.ctx), cc_cleanup);
53
53
      SR (cc->setkey (handle->hd.rh.ctx, key->data, key->size), cc_cleanup);
54
 
      if (iv->data && iv->size && cc->setiv)
 
54
      if (iv && iv->data && iv->size && cc->setiv)
55
55
        SR (cc->setiv (handle->hd.rh.ctx, iv->data, iv->size), cc_cleanup);
56
56
      return 0;
57
57
    }
75
75
      return ret;
76
76
    }
77
77
 
78
 
  if (iv->data != NULL && iv->size > 0)
 
78
  if (iv && iv->data != NULL && iv->size > 0)
79
79
    _gnutls_cipher_ops.setiv (handle->hd.gc, iv->data, iv->size);
80
80
 
81
81
  return 0;