Loading include/cryptography.h +0 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,6 @@ #include "types.h" void print_computed_hash(sigil_t *sgl); /** @brief Compute a message digest (hash) for the PKCS#1 signature type * * @param sgl context Loading include/sigil.h +6 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,12 @@ sigil_err_t sigil_get_original_digest(sigil_t *sgl, ASN1_OCTET_STRING **digest); */ sigil_err_t sigil_get_computed_digest(sigil_t *sgl, ASN1_OCTET_STRING **digest); /** @brief Print provided message digest to the standard output * * @param digest input - digest to be printed */ void sigil_print_digest(const ASN1_OCTET_STRING *digest); /** @brief Gets the subfilter value from the provided context * * @param sgl context Loading lib/cryptography.c +0 −14 Original line number Diff line number Diff line Loading @@ -61,20 +61,6 @@ static sigil_err_t hex_to_dec(const char *in, size_t in_len, unsigned char *out, return ERR_NONE; } //void print_computed_hash(sigil_t *sgl) //{ // if (sgl == NULL || sgl->computed_hash_len <= 0) // return; // // printf("\nCOMPUTED HASH: "); // // for (int i = 0; i < sgl->computed_hash_len; i++) { // printf("%02x ", sgl->computed_hash[i]); // } // // printf("\n"); //} sigil_err_t compute_digest_pkcs1(sigil_t *sgl) { sigil_err_t err; Loading lib/sigil.c +19 −0 Original line number Diff line number Diff line Loading @@ -413,6 +413,25 @@ sigil_err_t sigil_get_computed_digest(sigil_t *sgl, ASN1_OCTET_STRING **digest) return ERR_NONE; } void sigil_print_digest(const ASN1_OCTET_STRING *digest) { const unsigned char *digest_data; int digest_len; if (digest == NULL) return; digest_len = ASN1_STRING_length(digest); digest_data = ASN1_STRING_get0_data(digest); if (digest_len < 0 || digest_data == NULL) return; for (int i = 0; i < digest_len; i++) { printf("%02x ", digest_data[i]); } } sigil_err_t sigil_get_subfilter(sigil_t *sgl, int *subfilter) { if (sgl == NULL || subfilter == NULL) Loading Loading
include/cryptography.h +0 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,6 @@ #include "types.h" void print_computed_hash(sigil_t *sgl); /** @brief Compute a message digest (hash) for the PKCS#1 signature type * * @param sgl context Loading
include/sigil.h +6 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,12 @@ sigil_err_t sigil_get_original_digest(sigil_t *sgl, ASN1_OCTET_STRING **digest); */ sigil_err_t sigil_get_computed_digest(sigil_t *sgl, ASN1_OCTET_STRING **digest); /** @brief Print provided message digest to the standard output * * @param digest input - digest to be printed */ void sigil_print_digest(const ASN1_OCTET_STRING *digest); /** @brief Gets the subfilter value from the provided context * * @param sgl context Loading
lib/cryptography.c +0 −14 Original line number Diff line number Diff line Loading @@ -61,20 +61,6 @@ static sigil_err_t hex_to_dec(const char *in, size_t in_len, unsigned char *out, return ERR_NONE; } //void print_computed_hash(sigil_t *sgl) //{ // if (sgl == NULL || sgl->computed_hash_len <= 0) // return; // // printf("\nCOMPUTED HASH: "); // // for (int i = 0; i < sgl->computed_hash_len; i++) { // printf("%02x ", sgl->computed_hash[i]); // } // // printf("\n"); //} sigil_err_t compute_digest_pkcs1(sigil_t *sgl) { sigil_err_t err; Loading
lib/sigil.c +19 −0 Original line number Diff line number Diff line Loading @@ -413,6 +413,25 @@ sigil_err_t sigil_get_computed_digest(sigil_t *sgl, ASN1_OCTET_STRING **digest) return ERR_NONE; } void sigil_print_digest(const ASN1_OCTET_STRING *digest) { const unsigned char *digest_data; int digest_len; if (digest == NULL) return; digest_len = ASN1_STRING_length(digest); digest_data = ASN1_STRING_get0_data(digest); if (digest_len < 0 || digest_data == NULL) return; for (int i = 0; i < digest_len; i++) { printf("%02x ", digest_data[i]); } } sigil_err_t sigil_get_subfilter(sigil_t *sgl, int *subfilter) { if (sgl == NULL || subfilter == NULL) Loading