System.Data.SQLite
Check-in [4029ce4a8a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Coding style and readability improvements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4029ce4a8a1233c109ac4172853f05f433b7df78
User & Date: mistachkin 2017-10-27 00:23:10
Context
2017-10-27
03:30
Update SQLite core library to the 3.21.0 release. check-in: 24e3dd0f10 user: mistachkin tags: trunk
00:23
Coding style and readability improvements. check-in: 4029ce4a8a user: mistachkin tags: trunk
2017-10-25
17:07
Temporarily re-enable the legacy CryptoAPI codec. check-in: 9486553a2c user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to SQLite.Interop/src/win/crypt.c.

    30     30   
    31     31   /* Needed for re-keying */
    32     32   static void * sqlite3pager_get_codecarg(Pager *pPager)
    33     33   {
    34     34     return (pPager->xCodec) ? pPager->pCodec: NULL;
    35     35   }
    36     36   
    37         -void sqlite3_activate_see(const char *info)
    38         -{
    39         -}
    40         -
    41     37   /* Create a cryptographic context.  Use the enhanced provider because it is available on
    42     38   ** most platforms
    43     39   */
    44     40   static BOOL InitializeProvider()
    45     41   {
    46     42     MUTEX_LOGIC( sqlite3_mutex *pMaster = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER); )
    47     43     sqlite3_mutex_enter(pMaster);
................................................................................
   148    144     {
   149    145       CreateCryptBlock(pBlock->hReadKey, pBlock->pPager, pageSize, pBlock);
   150    146       /* If this fails, pvCrypt will be NULL, and the next time sqlite3Codec() is called, it will result in an error */
   151    147     }
   152    148   }
   153    149   
   154    150   /* Encrypt/Decrypt functionality, called by pager.c */
   155         -void * sqlite3Codec(void *pArg, void *data, Pgno nPageNum, int nMode)
          151  +static void *sqlite3Codec(void *pArg, void *data, Pgno nPageNum, int nMode)
   156    152   {
   157    153     LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)pArg;
   158    154     DWORD dwPageSize;
   159    155     LPVOID pvTemp = NULL;
   160    156   
   161    157     if (!pBlock) return data;
   162    158     if (pBlock->pvCrypt == NULL) return NULL; /* This only happens if CreateCryptBlock() failed to make scratch space */
................................................................................
   321    317     Btree *pbt = db->aDb[0].pBt;
   322    318     Pager *p = sqlite3BtreePager(pbt);
   323    319     LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);
   324    320   
   325    321     if (ppKey) *ppKey = 0;
   326    322     if (pnKeyLen) *pnKeyLen = pBlock ? 1: 0;
   327    323   }
          324  +
          325  +SQLITE_API void sqlite3_activate_see(const char *info)
          326  +{
          327  +}
   328    328   
   329    329   /* We do not attach this key to the temp store, only the main database. */
   330    330   SQLITE_API int sqlite3_key_v2(sqlite3 *db, const char *zDbName, const void *pKey, int nKey)
   331    331   {
   332    332     return sqlite3CodecAttach(db, 0, pKey, nKey);
   333    333   }
   334    334   
   335    335   SQLITE_API int sqlite3_key(sqlite3 *db, const void *pKey, int nKey)
   336    336   {
   337    337     return sqlite3_key_v2(db, 0, pKey, nKey);
   338    338   }
          339  +
          340  +SQLITE_API int sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey)
          341  +{
          342  +  return sqlite3_rekey_v2(db, 0, pKey, nKey);
          343  +}
   339    344   
   340    345   /* Changes the encryption key for an existing database. */
   341    346   SQLITE_API int sqlite3_rekey_v2(sqlite3 *db, const char *zDbName, const void *pKey, int nKey)
   342    347   {
   343    348     Btree *pbt = db->aDb[0].pBt;
   344    349     Pager *p = sqlite3BtreePager(pbt);
   345    350     LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);
................................................................................
   452    457     }
   453    458   
   454    459     sqlite3_mutex_leave(db->mutex);
   455    460   
   456    461     return rc;
   457    462   }
   458    463   
   459         -SQLITE_API int sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey)
   460         -{
   461         -  return sqlite3_rekey_v2(db, 0, pKey, nKey);
   462         -}
   463         -
   464    464   #endif /* SQLITE_HAS_CODEC */
   465    465   #endif /* SQLITE_OMIT_DISKIO */