Lines Matching refs:md
66 static int digest_md5_final(EVP_MD_CTX *ctx, unsigned char *md);
72 EVP_MD *md;
74 if ((md = EVP_MD_meth_new(NID_md5, NID_md5WithRSAEncryption)) == NULL
75 || !EVP_MD_meth_set_result_size(md, MD5_DIGEST_LENGTH)
76 || !EVP_MD_meth_set_input_blocksize(md, MD5_CBLOCK)
77 || !EVP_MD_meth_set_app_datasize(md,
79 || !EVP_MD_meth_set_flags(md, 0)
80 || !EVP_MD_meth_set_init(md, digest_md5_init)
81 || !EVP_MD_meth_set_update(md, digest_md5_update)
82 || !EVP_MD_meth_set_final(md, digest_md5_final)) {
83 EVP_MD_meth_free(md);
84 md = NULL;
86 _hidden_md5_md = md;
95 static int digest_sha1_final(EVP_MD_CTX *ctx, unsigned char *md);
101 EVP_MD *md;
103 if ((md = EVP_MD_meth_new(NID_sha1, NID_sha1WithRSAEncryption)) == NULL
104 || !EVP_MD_meth_set_result_size(md, SHA_DIGEST_LENGTH)
105 || !EVP_MD_meth_set_input_blocksize(md, SHA_CBLOCK)
106 || !EVP_MD_meth_set_app_datasize(md,
108 || !EVP_MD_meth_set_flags(md, EVP_MD_FLAG_DIGALGID_ABSENT)
109 || !EVP_MD_meth_set_init(md, digest_sha1_init)
110 || !EVP_MD_meth_set_update(md, digest_sha1_update)
111 || !EVP_MD_meth_set_final(md, digest_sha1_final)) {
112 EVP_MD_meth_free(md);
113 md = NULL;
115 _hidden_sha1_md = md;
124 static int digest_sha256_final(EVP_MD_CTX *ctx, unsigned char *md);
130 EVP_MD *md;
132 if ((md = EVP_MD_meth_new(NID_sha256, NID_sha256WithRSAEncryption)) == NULL
133 || !EVP_MD_meth_set_result_size(md, SHA256_DIGEST_LENGTH)
134 || !EVP_MD_meth_set_input_blocksize(md, SHA256_CBLOCK)
135 || !EVP_MD_meth_set_app_datasize(md,
137 || !EVP_MD_meth_set_flags(md, EVP_MD_FLAG_DIGALGID_ABSENT)
138 || !EVP_MD_meth_set_init(md, digest_sha256_init)
139 || !EVP_MD_meth_set_update(md, digest_sha256_update)
140 || !EVP_MD_meth_set_final(md, digest_sha256_final)) {
141 EVP_MD_meth_free(md);
142 md = NULL;
144 _hidden_sha256_md = md;
153 static int digest_sha384_final(EVP_MD_CTX *ctx, unsigned char *md);
158 static int digest_sha512_final(EVP_MD_CTX *ctx, unsigned char *md);
164 EVP_MD *md;
166 if ((md = EVP_MD_meth_new(NID_sha384, NID_sha384WithRSAEncryption)) == NULL
167 || !EVP_MD_meth_set_result_size(md, SHA384_DIGEST_LENGTH)
168 || !EVP_MD_meth_set_input_blocksize(md, SHA512_CBLOCK)
169 || !EVP_MD_meth_set_app_datasize(md,
171 || !EVP_MD_meth_set_flags(md, EVP_MD_FLAG_DIGALGID_ABSENT)
172 || !EVP_MD_meth_set_init(md, digest_sha384_init)
173 || !EVP_MD_meth_set_update(md, digest_sha384_update)
174 || !EVP_MD_meth_set_final(md, digest_sha384_final)) {
175 EVP_MD_meth_free(md);
176 md = NULL;
178 _hidden_sha384_md = md;
186 EVP_MD *md;
188 if ((md = EVP_MD_meth_new(NID_sha512, NID_sha512WithRSAEncryption)) == NULL
189 || !EVP_MD_meth_set_result_size(md, SHA512_DIGEST_LENGTH)
190 || !EVP_MD_meth_set_input_blocksize(md, SHA512_CBLOCK)
191 || !EVP_MD_meth_set_app_datasize(md,
193 || !EVP_MD_meth_set_flags(md, EVP_MD_FLAG_DIGALGID_ABSENT)
194 || !EVP_MD_meth_set_init(md, digest_sha512_init)
195 || !EVP_MD_meth_set_update(md, digest_sha512_update)
196 || !EVP_MD_meth_set_final(md, digest_sha512_final)) {
197 EVP_MD_meth_free(md);
198 md = NULL;
200 _hidden_sha512_md = md;
224 const EVP_MD *md;
225 if ((md = digest_md5()) != NULL)
226 digest_nids[pos++] = EVP_MD_get_type(md);
227 if ((md = digest_sha1()) != NULL)
228 digest_nids[pos++] = EVP_MD_get_type(md);
229 if ((md = digest_sha256()) != NULL)
230 digest_nids[pos++] = EVP_MD_get_type(md);
231 if ((md = digest_sha384()) != NULL)
232 digest_nids[pos++] = EVP_MD_get_type(md);
233 if ((md = digest_sha512()) != NULL)
234 digest_nids[pos++] = EVP_MD_get_type(md);
554 static void fill_known_data(unsigned char *md, unsigned int len)
559 md[i] = (unsigned char)(i & 0xff);
580 static int digest_md5_final(EVP_MD_CTX *ctx, unsigned char *md)
582 int ret = EVP_MD_meth_get_final(EVP_md5())(ctx, md);
585 fill_known_data(md, MD5_DIGEST_LENGTH);
604 static int digest_sha1_final(EVP_MD_CTX *ctx, unsigned char *md)
606 int ret = EVP_MD_meth_get_final(EVP_sha1())(ctx, md);
609 fill_known_data(md, SHA_DIGEST_LENGTH);
628 static int digest_sha256_final(EVP_MD_CTX *ctx, unsigned char *md)
630 int ret = EVP_MD_meth_get_final(EVP_sha256())(ctx, md);
633 fill_known_data(md, SHA256_DIGEST_LENGTH);
652 static int digest_sha384_final(EVP_MD_CTX *ctx, unsigned char *md)
654 int ret = EVP_MD_meth_get_final(EVP_sha384())(ctx, md);
657 fill_known_data(md, SHA384_DIGEST_LENGTH);
676 static int digest_sha512_final(EVP_MD_CTX *ctx, unsigned char *md)
678 int ret = EVP_MD_meth_get_final(EVP_sha512())(ctx, md);
681 fill_known_data(md, SHA512_DIGEST_LENGTH);