{"action":"created","issue":{"url":"https://api.github.com/repos/briansmith/ring/issues/14","labels_url":"https://api.github.com/repos/briansmith/ring/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/briansmith/ring/issues/14/comments","events_url":"https://api.github.com/repos/briansmith/ring/issues/14/events","html_url":"https://github.com/briansmith/ring/issues/14","id":106422712,"number":14,"title":"OPENSSL_cleanse should use memset_s","user":{"login":"briansmith","id":16816,"avatar_url":"https://avatars.githubusercontent.com/u/16816?v=3","gravatar_id":"","url":"https://api.github.com/users/briansmith","html_url":"https://github.com/briansmith","followers_url":"https://api.github.com/users/briansmith/followers","following_url":"https://api.github.com/users/briansmith/following{/other_user}","gists_url":"https://api.github.com/users/briansmith/gists{/gist_id}","starred_url":"https://api.github.com/users/briansmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briansmith/subscriptions","organizations_url":"https://api.github.com/users/briansmith/orgs","repos_url":"https://api.github.com/users/briansmith/repos","events_url":"https://api.github.com/users/briansmith/events{/privacy}","received_events_url":"https://api.github.com/users/briansmith/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-14T20:36:25Z","updated_at":"2015-09-14T20:45:02Z","closed_at":null,"body":"WE should juse use `memset_s`. If necessary, we can supply a default implementation of `memset_s` for platforms that don't provide it, if any. Alternatively, we can drop support for older versions of compilers that don't supply it.\r\n\r\n```\r\nvoid OPENSSL_cleanse(void *ptr, size_t len) {\r\n#if defined(OPENSSL_WINDOWS)\r\n\tSecureZeroMemory(ptr, len);\r\n#else\r\n\tmemset(ptr, 0, len);\r\n\r\n#if !defined(OPENSSL_NO_ASM)\r\n  /* As best as we can tell, this is sufficient to break any optimisations that\r\n     might try to eliminate \"superfluous\" memsets. If there's an easy way to\r\n     detect memset_s, it would be better to use that. */\r\n  __asm__ __volatile__(\"\" : : \"r\"(ptr) : \"memory\");\r\n#endif\r\n#endif  /* !OPENSSL_NO_ASM */\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/briansmith/ring/issues/comments/140200529","html_url":"https://github.com/briansmith/ring/issues/14#issuecomment-140200529","issue_url":"https://api.github.com/repos/briansmith/ring/issues/14","id":140200529,"user":{"login":"briansmith","id":16816,"avatar_url":"https://avatars.githubusercontent.com/u/16816?v=3","gravatar_id":"","url":"https://api.github.com/users/briansmith","html_url":"https://github.com/briansmith","followers_url":"https://api.github.com/users/briansmith/followers","following_url":"https://api.github.com/users/briansmith/following{/other_user}","gists_url":"https://api.github.com/users/briansmith/gists{/gist_id}","starred_url":"https://api.github.com/users/briansmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briansmith/subscriptions","organizations_url":"https://api.github.com/users/briansmith/orgs","repos_url":"https://api.github.com/users/briansmith/repos","events_url":"https://api.github.com/users/briansmith/events{/privacy}","received_events_url":"https://api.github.com/users/briansmith/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T20:45:02Z","updated_at":"2015-09-14T20:45:02Z","body":"See https://github.com/pyca/cryptography/issues/7 and http://www.daemonology.net/blog/2014-09-05-erratum.html (especially the comments)."}}