libidav/resource.c

changeset 155
b85248a8aee2
parent 151
a316613205dc
child 178
e137883e620f
equal deleted inserted replaced
154:3cfb4670d9e6 155:b85248a8aee2
676 char *hash = NULL; 676 char *hash = NULL;
677 if(dec) { 677 if(dec) {
678 // get hash 678 // get hash
679 char sha[SHA256_DIGEST_LENGTH]; 679 char sha[SHA256_DIGEST_LENGTH];
680 dav_get_hash(&dec->sha256, sha); 680 dav_get_hash(&dec->sha256, sha);
681 hash = util_hexstr(sha, 32); 681 hash = util_hexstr((unsigned char*)sha, 32);
682 682
683 aes_decrypter_close(dec); 683 aes_decrypter_close(dec);
684 } 684 }
685 685
686 int status = 0; 686 int status = 0;
692 char *res_hash = dav_get_property_ns(res, DAV_NS, "crypto-hash"); 692 char *res_hash = dav_get_property_ns(res, DAV_NS, "crypto-hash");
693 693
694 if(res_hash) { 694 if(res_hash) {
695 size_t len = 0; 695 size_t len = 0;
696 char *dec_hash = aes_decrypt(res_hash, &len, key); 696 char *dec_hash = aes_decrypt(res_hash, &len, key);
697 char *hex_hash = util_hexstr(dec_hash, 32); 697 char *hex_hash = util_hexstr((unsigned char*)dec_hash, 32);
698 if(strcmp(hash, hex_hash)) { 698 if(strcmp(hash, hex_hash)) {
699 verify_failed = 1; 699 verify_failed = 1;
700 } 700 }
701 free(dec_hash); 701 free(dec_hash);
702 free(hex_hash); 702 free(hex_hash);

mercurial