Warmcat homepage andy@warmcat.com
libwebsockets
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1750651685, "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":"70cc2c5af8c3c326a44d3ce6ea864243", "commit": {"type":"commit", "time": 1519131570, "time_ofs": 0, "oid_tree": { "oid": "b3974478aa89b2172143e92e2d7703e5a665fe14", "alias": []}, "oid":{ "oid": "c255e98ed2f6cc686b8fd22eba403fb2e828b5cd", "alias": []}, "msg": "Use OpenSSL shake256", "sig_commit": { "git_time": { "time": 1519131570, "offset": 0 }, "name": "Matt Caswell", "email": "matt@openssl.org", "md5": "10f7b441a32d5790efad9fc68cae4af2" }, "sig_author": { "git_time": { "time": 1511868894, "offset": 0 }, "name": "Matt Caswell", "email": "matt@openssl.org", "md5": "10f7b441a32d5790efad9fc68cae4af2" }}, "body": "Use OpenSSL shake256\n\nConvert the curve448 test to use the OpenSSL implementation of shake256.\n\nReviewed-by: Bernd Edlinger \u003cbernd.edlinger@hotmail.de\u003e\n(Merged from https://github.com/openssl/openssl/pull/5105)\n" , "diff": "diff --git a/crypto/ec/curve448/curve448_lcl.h b/crypto/ec/curve448/curve448_lcl.h\nindex 13dff0d..d859d52 100644\n--- a/crypto/ec/curve448/curve448_lcl.h\n+++ b/crypto/ec/curve448/curve448_lcl.h\n@@ -1,7 +1,4 @@\n #include \u0022curve448utils.h\u0022\n-#include \u0022shake.h\u0022\n-\n-#define decaf_ed448_prehash_ctx_t decaf_shake256_ctx_t\n \n int X448(uint8_t out_shared_key[56], const uint8_t private_key[56],\n const uint8_t peer_public_value[56]);\ndiff --git a/crypto/ec/curve448/curve448_test.c b/crypto/ec/curve448/curve448_test.c\nindex 22684f3..43c062d 100644\n--- a/crypto/ec/curve448/curve448_test.c\n+++ b/crypto/ec/curve448/curve448_test.c\n@@ -1,6 +1,7 @@\n #include \u003cstdio.h\u003e\n #include \u003cstring.h\u003e\n #include \u003copenssl/e_os2.h\u003e\n+#include \u003copenssl/evp.h\u003e\n #include \u0022curve448_lcl.h\u0022\n \n /* Test vectors from RFC7748 for X448 */\n@@ -568,15 +569,15 @@ const uint8_t phsig2[114] \u003d {\n 0xeb, 0x51, 0x1d, 0x13, 0x21, 0x00\n };\n \n-static const uint8_t *dohash(const uint8_t *msg, size_t msglen)\n+static const uint8_t *dohash(EVP_MD_CTX *hashctx, const uint8_t *msg,\n+ size_t msglen)\n {\n- decaf_ed448_prehash_ctx_t hashctx;\n static uint8_t hashout[64];\n \n- decaf_shake256_init(hashctx);\n- decaf_shake256_update(hashctx, msg, msglen);\n- decaf_shake256_final(hashctx,hashout,sizeof(hashout));\n- decaf_shake256_destroy(hashctx);\n+ if (!EVP_DigestInit_ex(hashctx, EVP_shake256(), NULL)\n+ || !EVP_DigestUpdate(hashctx, msg, msglen)\n+ || !EVP_DigestFinalXOF(hashctx, hashout, sizeof(hashout)))\n+ return NULL;\n \n return hashout;\n }\n@@ -585,76 +586,86 @@ static const uint8_t *dohash(const uint8_t *msg, size_t msglen)\n static int test_eddsa(void)\n {\n uint8_t outsig[114];\n+ EVP_MD_CTX *hashctx \u003d EVP_MD_CTX_new();\n+ int ret \u003d 0;\n+\n+ if (hashctx \u003d\u003d NULL) {\n+ printf(\u0022Failed to allocate EVP_MD_CTX\u005cn\u0022);\n+ return 0;\n+ }\n \n ED448_sign(outsig, NULL, 0, pubkey1, privkey1, NULL, 0);\n if (memcmp(sig1, outsig, sizeof(sig1)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (1)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n ED448_sign(outsig, msg2, sizeof(msg2), pubkey2, privkey2, NULL, 0);\n if (memcmp(sig2, outsig, sizeof(sig2)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (2)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n ED448_sign(outsig, msg3, sizeof(msg3), pubkey3, privkey3, context3, sizeof(context3));\n if (memcmp(sig3, outsig, sizeof(sig3)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (3)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n ED448_sign(outsig, msg4, sizeof(msg4), pubkey4, privkey4, NULL, 0);\n if (memcmp(sig4, outsig, sizeof(sig4)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (4)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n ED448_sign(outsig, msg5, sizeof(msg5), pubkey5, privkey5, NULL, 0);\n if (memcmp(sig5, outsig, sizeof(sig5)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (5)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n ED448_sign(outsig, msg6, sizeof(msg6), pubkey6, privkey6, NULL, 0);\n if (memcmp(sig6, outsig, sizeof(sig6)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (6)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n ED448_sign(outsig, msg7, sizeof(msg7), pubkey7, privkey7, NULL, 0);\n if (memcmp(sig7, outsig, sizeof(sig7)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (7)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n ED448_sign(outsig, msg8, sizeof(msg8), pubkey8, privkey8, NULL, 0);\n if (memcmp(sig8, outsig, sizeof(sig8)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (8)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n ED448_sign(outsig, msg9, sizeof(msg9), pubkey9, privkey9, NULL, 0);\n if (memcmp(sig9, outsig, sizeof(sig9)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (9)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n- ED448ph_sign(outsig, dohash(phmsg1, sizeof(phmsg1)), phpubkey1,\n+ ED448ph_sign(outsig, dohash(hashctx, phmsg1, sizeof(phmsg1)), phpubkey1,\n phprivkey1, NULL, 0);\n if (memcmp(phsig1, outsig, sizeof(phsig1)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (ph 1)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n- ED448ph_sign(outsig, dohash(phmsg2, sizeof(phmsg2)), phpubkey2,\n+ ED448ph_sign(outsig, dohash(hashctx, phmsg2, sizeof(phmsg2)), phpubkey2,\n phprivkey2, phcontext2, sizeof(phcontext2));\n if (memcmp(phsig2, outsig, sizeof(phsig2)) !\u003d 0) {\n printf(\u0022Calculated sig and expected sig differ (ph 2)\u005cn\u0022);\n- return 0;\n+ goto err;\n }\n \n- return 1;\n+ ret \u003d 1;\n+ err:\n+ EVP_MD_CTX_free(hashctx);\n+ return ret;\n }\n \n int main(int argc, char *argv[])\n","s":{"c":1750651685,"u": 38977}} ],"g": 40104,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}