• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/libgcrypt-1.5.0/cipher/

Lines Matching refs:cipher

0 /* cipher.c  -	cipher dispatcher
28 #include "cipher.h"
36 /* Try to use 16 byte aligned cipher context for better performance.
53 gcry_cipher_spec_t *cipher;
167 gcry_cipher_spec_t *cipher;
177 API) we need to keep these function pointers here. The cipher
226 /* What follows are two contexts of the cipher in use. The first
227 one needs to be aligned well enough for the cipher operation
237 /* These dummy functions are used in case a cipher implementation
304 for (i = 0; !err && cipher_table[i].cipher; i++)
306 if (! cipher_table[i].cipher->setkey)
307 cipher_table[i].cipher->setkey = dummy_setkey;
308 if (! cipher_table[i].cipher->encrypt)
309 cipher_table[i].cipher->encrypt = dummy_encrypt_block;
310 if (! cipher_table[i].cipher->decrypt)
311 cipher_table[i].cipher->decrypt = dummy_decrypt_block;
312 if (! cipher_table[i].cipher->stencrypt)
313 cipher_table[i].cipher->stencrypt = dummy_encrypt_stream;
314 if (! cipher_table[i].cipher->stdecrypt)
315 cipher_table[i].cipher->stdecrypt = dummy_decrypt_stream;
322 (void *) cipher_table[i].cipher,
335 gcry_cipher_spec_t *cipher = (gcry_cipher_spec_t *) spec;
337 const char **aliases = cipher->aliases;
338 int i, ret = ! stricmp (name, cipher->name);
351 gcry_cipher_spec_t *cipher = (gcry_cipher_spec_t *) spec;
353 gcry_cipher_oid_spec_t *oid_specs = cipher->oids;
364 /* Internal function. Lookup a cipher entry by it's name. */
368 gcry_module_t cipher;
370 cipher = _gcry_module_lookup (ciphers_registered, (void *) name,
373 return cipher;
376 /* Internal function. Lookup a cipher entry by it's oid. */
380 gcry_module_t cipher;
382 cipher = _gcry_module_lookup (ciphers_registered, (void *) oid,
385 return cipher;
388 /* Register a new cipher module whose specification can be found in
392 _gcry_cipher_register (gcry_cipher_spec_t *cipher,
406 (void *)cipher,
420 /* Unregister the cipher identified by MODULE, which must have been
450 gcry_cipher_spec_t *cipher = module->spec;
453 for (i = 0; cipher->oids[i].oid && !ret; i++)
454 if (! stricmp (oid, cipher->oids[i].oid))
459 *oid_spec = cipher->oids[i];
468 /* Map STRING to the cipher algorithm identifier. Returns the
469 algorithm ID of the cipher for the given name or 0 if the name is
475 gcry_module_t cipher;
492 cipher = gcry_cipher_lookup_name (string);
493 if (cipher)
495 algorithm = cipher->mod_id;
496 _gcry_module_release (cipher);
507 function returns the cipher mode (GCRY_CIPHER_MODE_*) associated
529 /* Map the cipher algorithm whose ID is contained in ALGORITHM to a
535 gcry_module_t cipher;
541 cipher = _gcry_module_lookup_id (ciphers_registered, algorithm);
542 if (cipher)
544 name = ((gcry_cipher_spec_t *) cipher->spec)->name;
545 _gcry_module_release (cipher);
554 /* Map the cipher algorithm identifier ALGORITHM to a string
565 /* Flag the cipher algorithm with the identifier ALGORITHM as
572 gcry_module_t cipher;
577 cipher = _gcry_module_lookup_id (ciphers_registered, algorithm);
578 if (cipher)
580 if (! (cipher->flags & FLAG_MODULE_DISABLED))
581 cipher->flags |= FLAG_MODULE_DISABLED;
582 _gcry_module_release (cipher);
588 /* Return 0 if the cipher algorithm with identifier ALGORITHM is
595 gcry_module_t cipher;
600 cipher = _gcry_module_lookup_id (ciphers_registered, algorithm);
601 if (cipher)
603 if (cipher->flags & FLAG_MODULE_DISABLED)
605 _gcry_module_release (cipher);
615 /* Return the standard length of the key for the cipher algorithm with
622 gcry_module_t cipher;
628 cipher = _gcry_module_lookup_id (ciphers_registered, algorithm);
629 if (cipher)
631 len = ((gcry_cipher_spec_t *) cipher->spec)->keylen;
633 log_bug ("cipher %d w/o key length\n", algorithm);
634 _gcry_module_release (cipher);
637 log_bug ("cipher %d not found\n", algorithm);
643 /* Return the block length of the cipher algorithm with the identifier
650 gcry_module_t cipher;
656 cipher = _gcry_module_lookup_id (ciphers_registered, algorithm);
657 if (cipher)
659 len = ((gcry_cipher_spec_t *) cipher->spec)->blocksize;
661 log_bug ("cipher %d w/o blocksize\n", algorithm);
662 _gcry_module_release (cipher);
665 log_bug ("cipher %d not found\n", algorithm);
673 Open a cipher handle for use with cipher algorithm ALGORITHM, using
674 the cipher mode MODE (one of the GCRY_CIPHER_MODE_*) and return a
691 gcry_cipher_spec_t *cipher = NULL;
703 /* Fetch the according module and check whether the cipher is marked
718 cipher = (gcry_cipher_spec_t *) module->spec;
746 if ((cipher->encrypt == dummy_encrypt_block)
747 || (cipher->decrypt == dummy_decrypt_block))
752 if ((cipher->stencrypt == dummy_encrypt_stream)
753 || (cipher->stdecrypt == dummy_decrypt_stream))
778 + 2 * cipher->contextsize
809 h->cipher = cipher;
856 /* Release all resources associated with the cipher handle H. H may be
898 ret = (*c->cipher->setkey) (&c->context.c, key, keylen);
902 memcpy ((void *) ((char *) &c->context.c + c->cipher->contextsize),
904 c->cipher->contextsize);
919 memset (c->u_iv.iv, 0, c->cipher->blocksize);
922 if (ivlen != c->cipher->blocksize)
925 ivlen, (unsigned int)c->cipher->blocksize);
928 if (ivlen > c->cipher->blocksize)
929 ivlen = c->cipher->blocksize;
939 /* Reset the cipher context to the initial context. This is basically
945 (char *) &c->context.c + c->cipher->contextsize,
946 c->cipher->contextsize);
948 memset (c->u_iv.iv, 0, c->cipher->blocksize);
949 memset (c->lastiv, 0, c->cipher->blocksize);
950 memset (c->u_ctr.ctr, 0, c->cipher->blocksize);
961 unsigned int blocksize = c->cipher->blocksize;
969 nblocks = inbuflen / c->cipher->blocksize;
973 c->cipher->encrypt (&c->context.c, outbuf, (byte*)/*arggg*/inbuf);
985 unsigned int blocksize = c->cipher->blocksize;
992 nblocks = inbuflen / c->cipher->blocksize;
996 c->cipher->decrypt (&c->context.c, outbuf, (byte*)/*arggg*/inbuf );
1013 size_t blocksize = c->cipher->blocksize;
1019 if ((inbuflen % c->cipher->blocksize)
1020 && !(inbuflen > c->cipher->blocksize
1044 c->cipher->encrypt ( &c->context.c, outbuf, outbuf );
1074 c->cipher->encrypt (&c->context.c, outbuf, outbuf);
1090 size_t blocksize = c->cipher->blocksize;
1096 if ((inbuflen % c->cipher->blocksize)
1097 && !(inbuflen > c->cipher->blocksize
1123 c->cipher->decrypt ( &c->context.c, outbuf, inbuf );
1127 inbuf += c->cipher->blocksize;
1128 outbuf += c->cipher->blocksize;
1144 c->cipher->decrypt ( &c->context.c, outbuf, inbuf );
1151 c->cipher->decrypt (&c->context.c, outbuf, c->u_iv.iv);
1167 size_t blocksize = c->cipher->blocksize;
1177 for (ivp=c->u_iv.iv+c->cipher->blocksize - c->unused;
1209 c->cipher->encrypt ( &c->context.c, c->u_iv.iv, c->u_iv.iv );
1222 c->cipher->encrypt ( &c->context.c, c->u_iv.iv, c->u_iv.iv );
1232 c->cipher->encrypt ( &c->context.c, c->u_iv.iv, c->u_iv.iv );
1251 size_t blocksize = c->cipher->blocksize;
1300 c->cipher->encrypt ( &c->context.c, c->u_iv.iv, c->u_iv.iv );
1316 c->cipher->encrypt ( &c->context.c, c->u_iv.iv, c->u_iv.iv );
1331 c->cipher->encrypt ( &c->context.c, c->u_iv.iv, c->u_iv.iv );
1352 size_t blocksize = c->cipher->blocksize;
1361 for (ivp=c->u_iv.iv+c->cipher->blocksize - c->unused;
1381 c->cipher->encrypt ( &c->context.c, c->u_iv.iv, c->u_iv.iv );
1390 c->cipher->encrypt ( &c->context.c, c->u_iv.iv, c->u_iv.iv );
1405 size_t blocksize = c->cipher->blocksize;
1431 c->cipher->encrypt ( &c->context.c, c->u_iv.iv, c->u_iv.iv );
1440 c->cipher->encrypt ( &c->context.c, c->u_iv.iv, c->u_iv.iv );
1457 unsigned int blocksize = c->cipher->blocksize;
1499 c->cipher->encrypt (&c->context.c, tmp, c->u_ctr.ctr);
1535 implement this as a mode usable with any cipher algorithm of
1549 /* We require a cipher with a 128 bit block length. */
1550 if (c->cipher->blocksize != 16)
1590 c->cipher->encrypt (&c->context.c, b, b);
1610 implement this as a mode usable with any cipher algorithm of
1624 /* We require a cipher with a 128 bit block length. */
1625 if (c->cipher->blocksize != 16)
1667 c->cipher->decrypt (&c->context.c, b, b);
1737 c->cipher->stencrypt (&c->context.c,
1745 fips_signal_error ("cipher mode NONE used");
1829 c->cipher->stdecrypt (&c->context.c,
1837 fips_signal_error ("cipher mode NONE used");
1884 c->u_iv.iv, c->cipher->blocksize - c->unused);
1886 c->lastiv + c->cipher->blocksize - c->unused, c->unused);
1912 if (ctr && ctrlen == hd->cipher->blocksize)
1914 memcpy (hd->u_ctr.ctr, ctr, hd->cipher->blocksize);
1919 memset (hd->u_ctr.ctr, 0, hd->cipher->blocksize);
1997 if (buflen < (1 + h->cipher->blocksize))
2006 n = h->cipher->blocksize;
2007 gcry_assert (n <= h->cipher->blocksize);
2009 ivp = h->u_iv.iv + h->cipher->blocksize - n;
2023 /* Return information about the cipher handle H. CMD is the kind of
2049 /* Return information about the given cipher algorithm ALGO.
2171 /* Get a list consisting of the IDs of the loaded cipher modules. If
2172 LIST is zero, write the number of loaded cipher modules to
2175 according size. In case there are less cipher modules than
2190 /* Run the selftests for cipher algorithm ALGO with optional reporting
2212 report ("cipher", algo, "module",