Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Few comment glitches |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
8a76861556c3ee11bc419ac944e932af |
| User & Date: | jan.nijtmans 2017-03-02 12:37:58.716 |
Context
|
2017-03-02
| ||
| 16:20 | Cherry-pick ac760db072 from SQLite: Fix a use-after-free problem in the shell tool code that could occur if an SQL statement were executed after an ".open" command with invalid options. check-in: 69b9b9563f user: jan.nijtmans tags: trunk | |
| 12:37 | Few comment glitches check-in: 8a76861556 user: jan.nijtmans tags: trunk | |
| 12:08 | Few (textual) typos. Eliminate unneccary spacing. check-in: b098c9398a user: jan.nijtmans tags: trunk | |
Changes
Changes to src/hname.c.
| ︙ | ︙ | |||
58 59 60 61 62 63 64 |
const char *hname_alg(int nHash){
if( nHash==HNAME_LEN_SHA1 ) return "SHA1";
if( nHash==HNAME_LEN_K256 ) return "SHA3-256";
return "?";
}
/*
| | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
const char *hname_alg(int nHash){
if( nHash==HNAME_LEN_SHA1 ) return "SHA1";
if( nHash==HNAME_LEN_K256 ) return "SHA3-256";
return "?";
}
/*
** Return the integer hash algorithm code number (ex: HNAME_K256) for
** the hash string provided. Or return HNAME_ERROR (0) if the input string
** is not a valid artifact hash string.
*/
int hname_validate(const char *zHash, int nHash){
int id;
switch( nHash ){
case HNAME_LEN_SHA1: id = HNAME_SHA1; break;
|
| ︙ | ︙ | |||
80 81 82 83 84 85 86 | /* ** Verify that zHash is a valid hash for the content in pContent. ** Return true if the hash is correct. Return false if the content ** does not match the hash. ** ** Actually, the returned value is one of the hash algorithm constants ** corresponding to the hash that matched if the hash is correct. | | | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
/*
** Verify that zHash is a valid hash for the content in pContent.
** Return true if the hash is correct. Return false if the content
** does not match the hash.
**
** Actually, the returned value is one of the hash algorithm constants
** corresponding to the hash that matched if the hash is correct.
** (Examples: HNAME_SHA1 or HNAME_K256). And the return is HNAME_ERROR
** if the hash does not match.
*/
int hname_verify_hash(Blob *pContent, const char *zHash, int nHash){
int id = HNAME_ERROR;
switch( nHash ){
case HNAME_LEN_SHA1: {
Blob hash;
|
| ︙ | ︙ | |||
112 113 114 115 116 117 118 | ** disk named zFile. ** ** Return true if the hash is correct. Return false if the content ** does not match the hash. ** ** Actually, the returned value is one of the hash algorithm constants ** corresponding to the hash that matched if the hash is correct. | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
** disk named zFile.
**
** Return true if the hash is correct. Return false if the content
** does not match the hash.
**
** Actually, the returned value is one of the hash algorithm constants
** corresponding to the hash that matched if the hash is correct.
** (Examples: HNAME_SHA1 or HNAME_K256). And the return is HNAME_ERROR
** if the hash does not match.
*/
int hname_verify_file_hash(const char *zFile, const char *zHash, int nHash){
int id = HNAME_ERROR;
switch( nHash ){
case HNAME_LEN_SHA1: {
Blob hash;
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
748 749 750 751 752 753 754 | db_finalize(&q); } /* ** Compute an hash on the tail of pMsg. Verify that it matches the ** the hash given in pHash. Return non-zero for an error and 0 on success. ** | | | 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 |
db_finalize(&q);
}
/*
** Compute an hash on the tail of pMsg. Verify that it matches the
** the hash given in pHash. Return non-zero for an error and 0 on success.
**
** The type of hash computed (SHA1, SHA3-256) is determined by
** the length of the input hash in pHash.
*/
static int check_tail_hash(Blob *pHash, Blob *pMsg){
Blob tail;
int rc;
blob_tail(pMsg, &tail);
rc = hname_verify_hash(&tail, blob_buffer(pHash), blob_size(pHash));
|
| ︙ | ︙ |