Warmcat homepage andy@warmcat.com
libwebsockets
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1756843611, "reponame":"openssl", "desc":"OpenSSL", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/openssl", "f":3, "items": [ {"schema":"libjg2-1", "cid":"1f0c6df9b8b06d7a187388fe663fa341", "commit": {"type":"commit", "time": 1466770960, "time_ofs": 60, "oid_tree": { "oid": "fff1531b407a571af5431c53c0f17cea6248b95a", "alias": []}, "oid":{ "oid": "a6211814c4c6f29358f29f639d468387b01518f8", "alias": []}, "msg": "Add a getter to obtain the HMAC_CTX md", "sig_commit": { "git_time": { "time": 1466770960, "offset": 60 }, "name": "Matt Caswell", "email": "matt@openssl.org", "md5": "10f7b441a32d5790efad9fc68cae4af2" }, "sig_author": { "git_time": { "time": 1466410090, "offset": 60 }, "name": "Matt Caswell", "email": "matt@openssl.org", "md5": "10f7b441a32d5790efad9fc68cae4af2" }}, "body": "Add a getter to obtain the HMAC_CTX md\n\nAs a result of opaque HMAC_CTX apps need a getter for the HMAC_CTX md.\n\nGitHub Issue #1152\n\nReviewed-by: Tim Hudson \u003ctjh@openssl.org\u003e\n" , "diff": "diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c\nindex da7f586..3374105 100644\n--- a/crypto/hmac/hmac.c\n+++ b/crypto/hmac/hmac.c\n@@ -233,3 +233,8 @@ void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags)\n EVP_MD_CTX_set_flags(ctx-\u003eo_ctx, flags);\n EVP_MD_CTX_set_flags(ctx-\u003emd_ctx, flags);\n }\n+\n+const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx)\n+{\n+ return ctx-\u003emd;\n+}\ndiff --git a/include/openssl/hmac.h b/include/openssl/hmac.h\nindex 809ca34..9f06896 100644\n--- a/include/openssl/hmac.h\n+++ b/include/openssl/hmac.h\n@@ -40,6 +40,7 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,\n __owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);\n \n void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);\n+const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx);\n \n #ifdef __cplusplus\n }\ndiff --git a/test/hmactest.c b/test/hmactest.c\nindex 145c467..0f4348b 100644\n--- a/test/hmactest.c\n+++ b/test/hmactest.c\n@@ -123,6 +123,11 @@ int main(int argc, char *argv[])\n err++;\n goto end;\n }\n+ if (HMAC_CTX_get_md(ctx) !\u003d NULL) {\n+ printf(\u0022Message digest not NULL for HMAC (test 4)\u005cn\u0022);\n+ err++;\n+ goto test5;\n+ }\n if (HMAC_Init_ex(ctx, NULL, 0, NULL, NULL)) {\n printf(\u0022Should fail to initialise HMAC with empty MD and key (test 4)\u005cn\u0022);\n err++;\n@@ -155,6 +160,11 @@ test5:\n }\n \n HMAC_CTX_reset(ctx);\n+ if (HMAC_CTX_get_md(ctx) !\u003d NULL) {\n+ printf(\u0022Message digest not NULL for HMAC (test 5)\u005cn\u0022);\n+ err++;\n+ goto test6;\n+ }\n if (HMAC_Init_ex(ctx, test[4].key, test[4].key_len, NULL, NULL)) {\n printf(\u0022Should fail to initialise HMAC with empty MD (test 5)\u005cn\u0022);\n err++;\n@@ -202,6 +212,11 @@ test5:\n err++;\n goto test6;\n }\n+ if (HMAC_CTX_get_md(ctx) !\u003d EVP_sha256()) {\n+ printf(\u0022Unexpected message digest for HMAC (test 5)\u005cn\u0022);\n+ err++;\n+ goto test6;\n+ }\n if (!HMAC_Update(ctx, test[5].data, test[5].data_len)) {\n printf(\u0022Error updating HMAC with data (sha256) (test 5)\u005cn\u0022);\n err++;\ndiff --git a/util/libcrypto.num b/util/libcrypto.num\nindex fa07ecf..fc118b1 100644\n--- a/util/libcrypto.num\n+++ b/util/libcrypto.num\n@@ -4149,3 +4149,4 @@ X509_get_pathlen 4092\t1_1_0\tEXIST::FUNCTION:\n ECDSA_SIG_set0 4093\t1_1_0\tEXIST::FUNCTION:EC\n DSA_SIG_set0 4094\t1_1_0\tEXIST::FUNCTION:DSA\n EVP_PKEY_get0_hmac 4095\t1_1_0\tEXIST::FUNCTION:\n+HMAC_CTX_get_md 4096\t1_1_0\tEXIST::FUNCTION:\n","s":{"c":1756843611,"u": 16655}} ],"g": 17424,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}