diff options
Diffstat (limited to '')
-rw-r--r-- | g10/cipher.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/g10/cipher.c b/g10/cipher.c index 52da03b58..8e6c91aa9 100644 --- a/g10/cipher.c +++ b/g10/cipher.c @@ -74,6 +74,13 @@ cipher_filter( void *opaque, int control, blowfish_setiv( cfx->bf_ctx, NULL ); blowfish_encode_cfb( cfx->bf_ctx, temp, temp, 10); } + else if( cfx->dek->algo == CIPHER_ALGO_CAST ) { + cfx->cast5_ctx = m_alloc_secure( sizeof *cfx->cast5_ctx ); + cast5_setkey( cfx->cast5_ctx, cfx->dek->key, cfx->dek->keylen ); + cast5_setiv( cfx->cast5_ctx, NULL ); + cast5_encode_cfb( cfx->cast5_ctx, temp, temp, 10); + cast5_sync_cfb( cfx->cast5_ctx ); + } else log_bug("no cipher algo %d\n", cfx->dek->algo); @@ -84,6 +91,9 @@ cipher_filter( void *opaque, int control, if( cfx->dek->algo == CIPHER_ALGO_BLOWFISH || cfx->dek->algo == CIPHER_ALGO_BLOWFISH128 ) blowfish_encode_cfb( cfx->bf_ctx, buf, buf, size); + else if( cfx->dek->algo == CIPHER_ALGO_CAST ) + cast5_encode_cfb( cfx->cast5_ctx, buf, buf, size); + if( iobuf_write( a, buf, size ) ) rc = G10ERR_WRITE_FILE; } @@ -91,6 +101,8 @@ cipher_filter( void *opaque, int control, if( cfx->dek->algo == CIPHER_ALGO_BLOWFISH || cfx->dek->algo == CIPHER_ALGO_BLOWFISH128 ) m_free(cfx->bf_ctx); + else if( cfx->dek->algo == CIPHER_ALGO_CAST ) + m_free(cfx->cast5_ctx); } else if( control == IOBUFCTRL_DESC ) { *(char**)buf = "cipher_filter"; |