diff options
Diffstat (limited to 'runtime/lmcry_gcry.c')
-rw-r--r-- | runtime/lmcry_gcry.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/runtime/lmcry_gcry.c b/runtime/lmcry_gcry.c index 31fab0d4..decb8591 100644 --- a/runtime/lmcry_gcry.c +++ b/runtime/lmcry_gcry.c @@ -211,13 +211,14 @@ finalize_it: static rsRetVal -OnFileOpen(void *pT, uchar *fn, void *pGF) +OnFileOpen(void *pT, uchar *fn, void *pGF, char openMode) { lmcry_gcry_t *pThis = (lmcry_gcry_t*) pT; gcryfile *pgf = (gcryfile*) pGF; DEFiRet; +dbgprintf("DDDD: open file '%s', mode '%c'\n", fn, openMode); - CHKiRet(rsgcryInitCrypt(pThis->ctx, pgf, fn)); + CHKiRet(rsgcryInitCrypt(pThis->ctx, pgf, fn, openMode)); finalize_it: /* TODO: enable this error message (need to cleanup loop first ;)) errmsg.LogError(0, iRet, "Encryption Provider" @@ -227,6 +228,16 @@ finalize_it: } static rsRetVal +Decrypt(void *pF, uchar *rec, size_t *lenRec) +{ + DEFiRet; + iRet = rsgcryDecrypt(pF, rec, lenRec); + + RETiRet; +} + + +static rsRetVal Encrypt(void *pF, uchar *rec, size_t *lenRec) { DEFiRet; @@ -254,6 +265,7 @@ CODESTARTobjQueryInterface(lmcry_gcry) pIf->Destruct = (rsRetVal(*)(void*)) lmcry_gcryDestruct; pIf->OnFileOpen = OnFileOpen; pIf->Encrypt = Encrypt; + pIf->Decrypt = Decrypt; pIf->OnFileClose = OnFileClose; finalize_it: ENDobjQueryInterface(lmcry_gcry) |