diff options
author | Werner Koch <wk@gnupg.org> | 2003-06-18 18:27:59 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2003-06-18 18:27:59 +0000 |
commit | 3c9d0b4898f05b9b494a8fa505d2c16b51483e4d (patch) | |
tree | 872e481fcdac200030b46d9b160c2eb1dc76decf | |
parent | b99f9e0dc418ed042c574328948a4f7827430454 (diff) | |
download | libgcrypt-3c9d0b4898f05b9b494a8fa505d2c16b51483e4d.tar.gz |
* basic.c (check_cbc_mac_cipher): Adjusted for new API of get_blklen
and get_keylen.
(check_ctr_cipher): Ditto.
(check_one_cipher): Ditto.
(check_one_md): Adjusted for new API of gcry_md_copy.
* benchmark.c (cipher_bench): Adjusted for new API of get_blklen
and get_keylen.
* gcrypt.h (gcry_cipher_get_algo_blklen)
(gcry_cipher_get_algo_keylen): Replaced macro by funcion.
* cipher.c (gcry_cipher_get_algo_keylen): New.
(gcry_cipher_get_algo_blklen): New.
-rw-r--r-- | INSTALL | 28 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | cipher/ChangeLog | 5 | ||||
-rw-r--r-- | cipher/cipher.c | 23 | ||||
-rwxr-xr-x | scripts/install-sh | 2 | ||||
-rwxr-xr-x | scripts/missing | 10 | ||||
-rw-r--r-- | src/ChangeLog | 10 | ||||
-rw-r--r-- | src/benchmark.c | 16 | ||||
-rw-r--r-- | src/gcrypt.h | 6 | ||||
-rw-r--r-- | tests/ChangeLog | 8 | ||||
-rw-r--r-- | tests/basic.c | 38 |
11 files changed, 95 insertions, 54 deletions
@@ -1,5 +1,5 @@ -Copyright 1994, 1995, 1996, 1999, 2000, 2001 Free Software Foundation, -Inc. +Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. @@ -71,8 +71,9 @@ Compilers and Options the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. - You can give `configure' initial values for variables by setting -them in the environment. You can do that on the command line like this: + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix @@ -137,9 +138,10 @@ Specifying the System Type ========================== There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it cannot guess the host type, give it the +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: @@ -151,20 +153,16 @@ where SYSTEM can have one of these forms: See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't -need to know the host type. +need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the host -platform (i.e., that on which the generated programs will eventually be -run) with `--host=TYPE'. In this case, you should also specify the -build platform with `--build=TYPE', because, in this case, it may not -be possible to guess the build platform (it sometimes involves -compiling and running simple test programs, and this can't be done if -the compiler is a cross compiler). +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. Sharing Defaults ================ @@ -35,6 +35,9 @@ gcry_md_open CHANGED gcry_md_copy CHANGED gcry_md_is_enabled NEW gcry_md_is_secure REPLACED macro by a function. +gcry_cipher_get_algo_keylen REPLACED macro by a function. +gcry_cipher_get_algo_blklen REPLACED macro by a function. + ... fixme add other changes ... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/cipher/ChangeLog b/cipher/ChangeLog index 447251df..72cf4f2d 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,8 @@ +2003-06-18 Werner Koch <wk@gnupg.org> + + * cipher.c (gcry_cipher_get_algo_keylen): New. + (gcry_cipher_get_algo_blklen): New. + 2003-06-18 Moritz Schulte <moritz@g10code.com> * arcfour.c, cipher.c, blowfish.c, md.c, cast5.c, pubkey.c, crc.c, diff --git a/cipher/cipher.c b/cipher/cipher.c index 3cc509d8..185ac9f7 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -1248,6 +1248,29 @@ gcry_cipher_algo_info (int algo, int what, void *buffer, size_t *nbytes) return gpg_error (err); } + +size_t +gcry_cipher_get_algo_keylen (int algo) +{ + size_t n; + + if (gcry_cipher_algo_info( algo, GCRYCTL_GET_KEYLEN, NULL, &n)) + n = 0; + return n; +} + + +size_t +gcry_cipher_get_algo_blklen (int algo) +{ + size_t n; + + if (gcry_cipher_algo_info( algo, GCRYCTL_GET_BLKLEN, NULL, &n)) + n = 0; + return n; +} + + gpg_err_code_t _gcry_cipher_init (void) { diff --git a/scripts/install-sh b/scripts/install-sh index 398a88e1..11870f1b 100755 --- a/scripts/install-sh +++ b/scripts/install-sh @@ -128,7 +128,7 @@ else # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. - if [ -f $src -o -d $src ] + if [ -f "$src" ] || [ -d "$src" ] then : else diff --git a/scripts/missing b/scripts/missing index dd583709..6a37006e 100755 --- a/scripts/missing +++ b/scripts/missing @@ -1,6 +1,6 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -293,23 +293,23 @@ WARNING: \`$1' is missing on your system. You should only need it if # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then - gnutar ${1+"$@"} && exit 0 + gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then - gtar ${1+"$@"} && exit 0 + gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" ${1+"$@"} && exit 0 + tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" ${1+"$@"} && exit 0 + tar "$firstarg" "$@" && exit 0 ;; esac fi diff --git a/src/ChangeLog b/src/ChangeLog index e3f65788..99cbdc54 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2003-06-18 Werner Koch <wk@gnupg.org> + + * benchmark.c (cipher_bench): Adjusted for new API of get_blklen + and get_keylen. + + * gcrypt.h (gcry_cipher_get_algo_blklen) + (gcry_cipher_get_algo_keylen): Replaced macro by funcion. + 2003-06-18 Moritz Schulte <moritz@g10code.com> * cipher.h: Renamed types GcryDigestSpec, GcryCipherSpec and @@ -82,7 +90,7 @@ * gcrypt.h (gcry_md_get_algo): Reverted to old API. This is a convenience function anyway and error checking is not approriate. (gcry_md_is_enabled): New. - (gcry_md_is_secure): Replaed macro by function and reverted to old + (gcry_md_is_secure): Replaced macro by function and reverted to old API. 2003-06-11 Werner Koch <wk@gnupg.org> diff --git a/src/benchmark.c b/src/benchmark.c index fa326fcb..52b43209 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -185,11 +185,11 @@ cipher_bench ( const char *algoname ) exit (1); } - err = gcry_cipher_get_algo_keylen (algo, &keylen); - if (err) + keylen = gcry_cipher_get_algo_keylen (algo); + if (!keylen) { - fprintf (stderr, PGM ": failed to get key length for algorithm `%s': %s\n", - algoname, gpg_strerror (err)); + fprintf (stderr, PGM ": failed to get key length for algorithm `%s'\n", + algoname); exit (1); } if ( keylen > sizeof key ) @@ -201,11 +201,11 @@ cipher_bench ( const char *algoname ) for (i=0; i < keylen; i++) key[i] = i + (clock () & 0xff); - err = gcry_cipher_get_algo_blklen (algo, &blklen); - if (err) + blklen = gcry_cipher_get_algo_blklen (algo); + if (!blklen) { - fprintf (stderr, PGM ": failed to get block length for algorithm `%s': %s\n", - algoname, gpg_strerror (err)); + fprintf (stderr, PGM ": failed to get block length for algorithm `%s'\n", + algoname); exit (1); } diff --git a/src/gcrypt.h b/src/gcrypt.h index ae391b2c..d72ad3bf 100644 --- a/src/gcrypt.h +++ b/src/gcrypt.h @@ -641,12 +641,10 @@ gpg_error_t gcry_cipher_decrypt (gcry_cipher_hd_t h, (char*)(k), (l) ) /* Retrieved the key length used with algorithm A. */ -#define gcry_cipher_get_algo_keylen(a, b) \ - gcry_cipher_algo_info( (a), GCRYCTL_GET_KEYLEN, NULL, b) +size_t gcry_cipher_get_algo_keylen (int algo); /* Retrieve the block length used with algorithm A. */ -#define gcry_cipher_get_algo_blklen(a, b) \ - gcry_cipher_algo_info( (a), GCRYCTL_GET_BLKLEN, NULL, b) +size_t gcry_cipher_get_algo_blklen (int algo); /* Return 0 if the algorithm A is available for use. */ #define gcry_cipher_test_algo(a) \ diff --git a/tests/ChangeLog b/tests/ChangeLog index 32d2ae68..0766e70a 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +2003-06-18 Werner Koch <wk@gnupg.org> + + * basic.c (check_cbc_mac_cipher): Adjusted for new API of get_blklen + and get_keylen. + (check_ctr_cipher): Ditto. + (check_one_cipher): Ditto. + (check_one_md): Adjusted for new API of gcry_md_copy. + 2003-06-18 Moritz Schulte <moritz@g10code.com> * register.c: Replace old type GcryModule with newer one: diff --git a/tests/basic.c b/tests/basic.c index ba1a4549..10a6404a 100644 --- a/tests/basic.c +++ b/tests/basic.c @@ -122,20 +122,20 @@ check_cbc_mac_cipher (void) return; } - err = gcry_cipher_get_algo_blklen (tv[i].algo, &blklen); - if (err) + blklen = gcry_cipher_get_algo_blklen(tv[i].algo); + if (!blklen) { - fail ("cbc-mac algo %d, gcry_cipher_get_algo_blklen failed: %s\n", - tv[i].algo, gpg_strerror (err)); + fail ("cbc-mac algo %d, gcry_cipher_get_algo_blklen failed\n", + tv[i].algo); gcry_cipher_close (hd); return; } - err = gcry_cipher_get_algo_keylen (tv[i].algo, &keylen); - if (err) + keylen = gcry_cipher_get_algo_keylen (tv[i].algo); + if (!keylen) { - fail ("cbc-mac algo %d, gcry_cipher_get_algo_keylen failed: %s\n", - tv[i].algo, gpg_strerror (err)); + fail ("cbc-mac algo %d, gcry_cipher_get_algo_keylen failed\n", + tv[i].algo); return; } @@ -381,11 +381,10 @@ check_ctr_cipher (void) return; } - err = gcry_cipher_get_algo_keylen (tv[i].algo, &keylen); - if (err) + keylen = gcry_cipher_get_algo_keylen(tv[i].algo); + if (!keylen) { - fail ("aes-ctr, gcry_cipher_get_algo_keylen failed: %s\n", - gpg_strerror (err)); + fail ("aes-ctr, gcry_cipher_get_algo_keylen failed\n"); return; } @@ -401,11 +400,10 @@ check_ctr_cipher (void) return; } - err = gcry_cipher_get_algo_blklen (tv[i].algo, &blklen); - if (err) + blklen = gcry_cipher_get_algo_blklen(tv[i].algo); + if (!blklen) { - fail ("aes-ctr, gcry_cipher_get_algo_blklen failed: %s\n", - gpg_strerror (err)); + fail ("aes-ctr, gcry_cipher_get_algo_blklen failed\n"); return; } @@ -469,11 +467,11 @@ check_one_cipher (int algo, int mode, int flags) memcpy (plain, "foobar42FOOBAR17", 16); gpg_error_t err = 0; - err = gcry_cipher_get_algo_keylen (algo, &keylen); - if (err) + keylen = gcry_cipher_get_algo_keylen (algo); + if (!keylen) { - fail ("algo %d, mode %d, gcry_cipher_get_algo_keylen failed: %s\n", - algo, mode, gpg_strerror (err)); + fail ("algo %d, mode %d, gcry_cipher_get_algo_keylen failed\n", + algo, mode); return; } |