diff options
author | Moritz Schulte <mo@g10code.com> | 2003-04-17 15:07:33 +0000 |
---|---|---|
committer | Moritz Schulte <mo@g10code.com> | 2003-04-17 15:07:33 +0000 |
commit | 1354946a152a149e6173cefe5192fd225a051859 (patch) | |
tree | 156d1a1ff98798a3ebf306e1988e3dade199acd4 /src/cipher.h | |
parent | fdb1d43e8f93b0b06bc7ac39da743e3f4dfb9990 (diff) | |
download | libgcrypt-1354946a152a149e6173cefe5192fd225a051859.tar.gz |
2003-04-17 Moritz Schulte <moritz@g10code.com>
* g10lib.h (GcryModule): New typedef.
* gcrypt.h (gcry_cipher_register, gcry_cipher_unregister,
gcry_digest_register, gcry_digest_unregister,
gcry_pubkey_register, gcry_pubkey_unregister): Function
declarations removed - for now.
* gcrypt.h (GcryModule): Declaration removed.
* gcrypt.h (GcryPubkeySpec, GcryDigestSpec, GcryCipherSpec):
Types Moved...
* cipher.h: ... here.
Diffstat (limited to 'src/cipher.h')
-rw-r--r-- | src/cipher.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/cipher.h b/src/cipher.h index 7e129dad..4bff1dec 100644 --- a/src/cipher.h +++ b/src/cipher.h @@ -52,6 +52,56 @@ void _gcry_register_primegen_progress (void (*cb)(void *,const char *, int,int,int), void *cb_data ); +typedef struct gcry_pubkey_spec +{ + const char *name; + int id; + int npkey; + int nskey; + int nenc; + int nsig; + int use; + int (*generate) (int algo, unsigned int nbits, unsigned long use_e, + GcryMPI *skey, GcryMPI **retfactors); + int (*check_secret_key) (int algo, GcryMPI *skey); + int (*encrypt) (int algo, GcryMPI *resarr, GcryMPI data, GcryMPI *pkey, int flags); + int (*decrypt) (int algo, GcryMPI *result, GcryMPI *data, GcryMPI *skey, int flags); + int (*sign) (int algo, GcryMPI *resarr, GcryMPI data, GcryMPI *skey); + int (*verify) (int algo, GcryMPI hash, GcryMPI *data, GcryMPI *pkey, + int (*cmp)(void *, GcryMPI), void *opaquev); + unsigned (*get_nbits) (int algo, GcryMPI *pkey); +} GcryPubkeySpec; + +typedef struct gcry_digest_spec +{ + const char *name; + int id; + unsigned char *asnoid; + int asnlen; + int mdlen; + void (*init) (void *c); + void (*write) (void *c, unsigned char *buf, size_t nbytes); + void (*final) (void *c); + unsigned char *(*read) (void *c); + size_t contextsize; /* allocate this amount of context */ +} GcryDigestSpec; + +typedef struct gcry_cipher_spec +{ + const char *name; + int id; + size_t blocksize; + size_t keylen; + size_t contextsize; + int (*setkey) (void *c, const unsigned char *key, unsigned keylen); + void (*encrypt) (void *c, unsigned char *outbuf, const unsigned char *inbuf); + void (*decrypt) (void *c, unsigned char *outbuf, const unsigned char *inbuf); + void (*stencrypt) (void *c, unsigned char *outbuf, const unsigned char *inbuf, + unsigned int n); + void (*stdecrypt) (void *c, unsigned char *outbuf, const unsigned char *inbuf, + unsigned int n); +} GcryCipherSpec; + /* Declarations for the cipher specifications. */ extern GcryCipherSpec cipher_spec_blowfish; extern GcryCipherSpec cipher_spec_des; @@ -82,5 +132,6 @@ extern GcryPubkeySpec pubkey_spec_rsa; extern GcryPubkeySpec pubkey_spec_elg; extern GcryPubkeySpec pubkey_spec_dsa; + #endif /*G10_CIPHER_H*/ |