mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
See ChangeLog: Sat Jun 26 12:15:59 CEST 1999 Werner Koch
This commit is contained in:
parent
1423b4239b
commit
080c9ca49f
39 changed files with 2651 additions and 1912 deletions
|
@ -1,3 +1,13 @@
|
|||
Sat Jun 26 12:15:59 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
|
||||
* rndegd.c (do_write): s/ssize_t/int/ due to SunOS 4.1 probs.
|
||||
|
||||
* cipher.c (do_cbc_encrypt, do_cbc_decrypt): New.
|
||||
|
||||
* dynload.c (HAVE_DL_SHL_LOAD): Map hpux API to dlopen (Dave Dykstra).
|
||||
* Makefile.am (install-exec-hook): Removed.
|
||||
|
||||
Sun May 23 14:20:22 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
* cipher.c (setup_cipher_table): Enable Twofish
|
||||
|
|
|
@ -98,11 +98,3 @@ rndegd: $(srcdir)/rndegd.c
|
|||
|
||||
|
||||
|
||||
install-exec-hook:
|
||||
@list='$(pkglib_PROGRAMS)'; for p in $$list; do \
|
||||
if test -f $(pkglibdir)/$$p; then \
|
||||
echo "chmod 644 $(pkglibdir)/$$p"; \
|
||||
chmod 644 $(pkglibdir)/$$p; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
|
|
|
@ -408,6 +408,49 @@ do_ecb_decrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nblocks )
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
do_cbc_encrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nblocks )
|
||||
{
|
||||
unsigned int n;
|
||||
byte *ivp;
|
||||
int i;
|
||||
size_t blocksize = c->blocksize;
|
||||
|
||||
for(n=0; n < nblocks; n++ ) {
|
||||
/* fixme: the xor should works on words and not on
|
||||
* bytes. Maybe it is a good idea to enhance the cipher backend
|
||||
* API to allow for CBC handling in the backend */
|
||||
for(ivp=c->iv,i=0; i < blocksize; i++ )
|
||||
outbuf[i] ^= *ivp++;
|
||||
(*c->encrypt)( &c->context.c, outbuf, outbuf );
|
||||
memcpy(c->iv, outbuf, blocksize );
|
||||
inbuf += c->blocksize;
|
||||
outbuf += c->blocksize;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
do_cbc_decrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nblocks )
|
||||
{
|
||||
unsigned int n;
|
||||
byte *ivp;
|
||||
int i;
|
||||
size_t blocksize = c->blocksize;
|
||||
|
||||
for(n=0; n < nblocks; n++ ) {
|
||||
/* because outbuf and inbuf might be the same, we have
|
||||
* to save the original ciphertext block. We use lastiv
|
||||
* for this here because it is not used otherwise */
|
||||
memcpy(c->lastiv, inbuf, blocksize );
|
||||
(*c->decrypt)( &c->context.c, outbuf, inbuf );
|
||||
for(ivp=c->iv,i=0; i < blocksize; i++ )
|
||||
outbuf[i] ^= *ivp++;
|
||||
memcpy(c->iv, c->lastiv, blocksize );
|
||||
inbuf += c->blocksize;
|
||||
outbuf += c->blocksize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
do_cfb_encrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nbytes )
|
||||
|
@ -524,6 +567,10 @@ cipher_encrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nbytes )
|
|||
assert(!(nbytes%8));
|
||||
do_ecb_encrypt(c, outbuf, inbuf, nbytes/8 );
|
||||
break;
|
||||
case CIPHER_MODE_CBC:
|
||||
assert(!(nbytes%8)); /* fixme: should be blocksize */
|
||||
do_cbc_encrypt(c, outbuf, inbuf, nbytes/8 );
|
||||
break;
|
||||
case CIPHER_MODE_CFB:
|
||||
case CIPHER_MODE_PHILS_CFB:
|
||||
do_cfb_encrypt(c, outbuf, inbuf, nbytes );
|
||||
|
@ -550,6 +597,10 @@ cipher_decrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nbytes )
|
|||
assert(!(nbytes%8));
|
||||
do_ecb_decrypt(c, outbuf, inbuf, nbytes/8 );
|
||||
break;
|
||||
case CIPHER_MODE_CBC:
|
||||
assert(!(nbytes%8)); /* fixme: should assert on blocksize */
|
||||
do_cbc_decrypt(c, outbuf, inbuf, nbytes/8 );
|
||||
break;
|
||||
case CIPHER_MODE_CFB:
|
||||
case CIPHER_MODE_PHILS_CFB:
|
||||
do_cfb_decrypt(c, outbuf, inbuf, nbytes );
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#include <dlfcn.h>
|
||||
#elif defined(HAVE_DLD_DLD_LINK)
|
||||
#include <dld.h>
|
||||
#elif defined(HAVE_DL_SHL_LOAD)
|
||||
#include <dl.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include "util.h"
|
||||
#include "cipher.h"
|
||||
|
@ -45,6 +48,27 @@
|
|||
#define RTLD_NOW 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DL_SHL_LOAD /* HPUX has shl_load instead of dlopen */
|
||||
#define HAVE_DL_DLOPEN
|
||||
#define dlopen(PATHNAME,MODE) \
|
||||
((void *) shl_load(PATHNAME, DYNAMIC_PATH | \
|
||||
(((MODE) & RTLD_NOW) ? BIND_IMMEDIATE : BIND_DEFERRED), 0L))
|
||||
#define dlclose(HANDLE) shl_unload((shl_t) (HANDLE))
|
||||
#define dlerror() (errno == 0 ? NULL : strerror(errno))
|
||||
|
||||
static void *
|
||||
dlsym(void *handle, char *name)
|
||||
{
|
||||
void *addr;
|
||||
if (shl_findsym((shl_t *)&handle,name,(short)TYPE_UNDEFINED,&addr) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
#endif /*HAVE_DL_SHL_LOAD*/
|
||||
|
||||
|
||||
|
||||
typedef struct ext_list {
|
||||
struct ext_list *next;
|
||||
int internal;
|
||||
|
|
|
@ -341,12 +341,16 @@ md_final(MD_HANDLE a)
|
|||
{
|
||||
struct md_digest_list_s *r;
|
||||
|
||||
if( a->finalized )
|
||||
return;
|
||||
|
||||
if( a->bufcount )
|
||||
md_write( a, NULL, 0 );
|
||||
|
||||
for(r=a->list; r; r = r->next ) {
|
||||
(*r->final)( &r->context.c );
|
||||
}
|
||||
a->finalized = 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ static int
|
|||
do_write( int fd, void *buf, size_t nbytes )
|
||||
{
|
||||
size_t nleft = nbytes;
|
||||
ssize_t nwritten;
|
||||
int nwritten;
|
||||
|
||||
while( nleft > 0 ) {
|
||||
nwritten = write( fd, buf, nleft);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue