├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── libsscrypto.sln ├── libsscrypto ├── cipher_get_size_ex.c ├── hkdf.c ├── libsscrypto.def ├── libsscrypto.vcxproj └── libsscrypto.vcxproj.filters └── openssl-prebuilt-lib ├── README.txt └── Win32 ├── libcrypto.lib └── ossl_static.pdb /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | # Visual Studio 2015 Update 2 IntelliSense database 77 | *.VC.db 78 | 79 | # Visual Studio profiler 80 | *.psess 81 | *.vsp 82 | *.vspx 83 | 84 | # TFS 2012 Local Workspace 85 | $tf/ 86 | 87 | # Guidance Automation Toolkit 88 | *.gpState 89 | 90 | # ReSharper is a .NET coding add-in 91 | _ReSharper*/ 92 | *.[Rr]e[Ss]harper 93 | *.DotSettings.user 94 | 95 | # JustCode is a .NET coding addin-in 96 | .JustCode 97 | 98 | # TeamCity is a build add-in 99 | _TeamCity* 100 | 101 | # DotCover is a Code Coverage Tool 102 | *.dotCover 103 | 104 | # NCrunch 105 | _NCrunch_* 106 | .*crunch*.local.xml 107 | 108 | # MightyMoose 109 | *.mm.* 110 | AutoTest.Net/ 111 | 112 | # Web workbench (sass) 113 | .sass-cache/ 114 | 115 | # Installshield output folder 116 | [Ee]xpress/ 117 | 118 | # DocProject is a documentation generator add-in 119 | DocProject/buildhelp/ 120 | DocProject/Help/*.HxT 121 | DocProject/Help/*.HxC 122 | DocProject/Help/*.hhc 123 | DocProject/Help/*.hhk 124 | DocProject/Help/*.hhp 125 | DocProject/Help/Html2 126 | DocProject/Help/html 127 | 128 | # Click-Once directory 129 | publish/ 130 | 131 | # Publish Web Output 132 | *.[Pp]ublish.xml 133 | *.azurePubxml 134 | # TODO: Comment the next line if you want to checkin your web deploy settings 135 | # but database connection strings (with potential passwords) will be unencrypted 136 | *.pubxml 137 | *.publishproj 138 | 139 | # NuGet Packages 140 | *.nupkg 141 | # The packages folder can be ignored because of Package Restore 142 | **/packages/* 143 | # except build/, which is used as an MSBuild target. 144 | !**/packages/build/ 145 | # Uncomment if necessary however generally it will be regenerated when needed 146 | #!**/packages/repositories.config 147 | 148 | # Windows Azure Build Output 149 | csx/ 150 | *.build.csdef 151 | 152 | # Windows Store app package directory 153 | AppPackages/ 154 | 155 | # Others 156 | *.[Cc]ache 157 | ClientBin/ 158 | [Ss]tyle[Cc]op.* 159 | ~$* 160 | *~ 161 | *.dbmdl 162 | *.dbproj.schemaview 163 | *.pfx 164 | *.publishsettings 165 | node_modules/ 166 | bower_components/ 167 | 168 | # RIA/Silverlight projects 169 | Generated_Code/ 170 | 171 | # Backup & report files from converting an old project file 172 | # to a newer Visual Studio version. Backup files are not needed, 173 | # because we have git ;-) 174 | _UpgradeReport_Files/ 175 | Backup*/ 176 | UpgradeLog*.XML 177 | UpgradeLog*.htm 178 | 179 | # SQL Server files 180 | *.mdf 181 | *.ldf 182 | 183 | # Business Intelligence projects 184 | *.rdl.data 185 | *.bim.layout 186 | *.bim_*.settings 187 | 188 | # Microsoft Fakes 189 | FakesAssemblies/ 190 | 191 | # Node.js Tools for Visual Studio 192 | .ntvs_analysis.dat 193 | 194 | # Visual Studio 6 build log 195 | *.plg 196 | 197 | # Visual Studio 6 workspace options file 198 | *.opt 199 | 200 | # openssl prebuilt lib 201 | !/openssl-prebuilt-lib/** 202 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libsodium"] 2 | path = libsodium 3 | url = https://github.com/jedisct1/libsodium.git 4 | ignore = dirty 5 | [submodule "mbedtls"] 6 | path = mbedtls 7 | url = https://github.com/ARMmbed/mbedtls.git 8 | ignore = dirty 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # libsscrypto 2 | 3 | Build libsscrypto.dll for shadowsocks-windows. 4 | 5 | ## Build 6 | 7 | 1) Get source code 8 | 9 | ``` 10 | git clone https://github.com/shadowsocks/libsscrypto.git 11 | cd libsscrypto 12 | git submodule update --init 13 | ``` 14 | 15 | 2) Compile 16 | 17 | a) Open libsscrypto.sln with Visual Studio 2017. 18 | 19 | b) Change the configuration to Release 20 | 21 | c) Change the platform to Win32. 22 | 23 | d) Right click the project mbedTLS, and select Properties. 24 | 25 | i) Select General on left panel, and change Platform Toolset to v141. 26 | 27 | ii) Select C/C++ / Code Generation, and change Runtime Library to /MT . 28 | 29 | e) Right click Solution, and select Build Solution. 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /libsscrypto.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.10 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsscrypto", "libsscrypto\libsscrypto.vcxproj", "{827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554} 9 | {A185B162-6CB6-4502-B03F-B56F7699A8D9} = {A185B162-6CB6-4502-B03F-B56F7699A8D9} 10 | EndProjectSection 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbedTLS", "mbedtls\visualc\VS2010\mbedTLS.vcxproj", "{46CF2D25-6A36-4189-B59C-E4815388E554}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsodium", "libsodium\builds\msvc\vs2017\libsodium\libsodium.vcxproj", "{A185B162-6CB6-4502-B03F-B56F7699A8D9}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|x64 = Debug|x64 19 | Debug|x86 = Debug|x86 20 | DebugDLL|x64 = DebugDLL|x64 21 | DebugDLL|x86 = DebugDLL|x86 22 | DebugLIB|x64 = DebugLIB|x64 23 | DebugLIB|x86 = DebugLIB|x86 24 | DebugLTCG|x64 = DebugLTCG|x64 25 | DebugLTCG|x86 = DebugLTCG|x86 26 | Release|x64 = Release|x64 27 | Release|x86 = Release|x86 28 | ReleaseDLL|x64 = ReleaseDLL|x64 29 | ReleaseDLL|x86 = ReleaseDLL|x86 30 | ReleaseLIB|x64 = ReleaseLIB|x64 31 | ReleaseLIB|x86 = ReleaseLIB|x86 32 | ReleaseLTCG|x64 = ReleaseLTCG|x64 33 | ReleaseLTCG|x86 = ReleaseLTCG|x86 34 | EndGlobalSection 35 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 36 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.Debug|x64.ActiveCfg = Debug|x64 37 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.Debug|x64.Build.0 = Debug|x64 38 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.Debug|x86.ActiveCfg = Debug|Win32 39 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.Debug|x86.Build.0 = Debug|Win32 40 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugDLL|x64.ActiveCfg = Debug|x64 41 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugDLL|x64.Build.0 = Debug|x64 42 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugDLL|x86.ActiveCfg = Debug|Win32 43 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugDLL|x86.Build.0 = Debug|Win32 44 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugLIB|x64.ActiveCfg = Debug|x64 45 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugLIB|x64.Build.0 = Debug|x64 46 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugLIB|x86.ActiveCfg = Debug|Win32 47 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugLIB|x86.Build.0 = Debug|Win32 48 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugLTCG|x64.ActiveCfg = Debug|x64 49 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugLTCG|x64.Build.0 = Debug|x64 50 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugLTCG|x86.ActiveCfg = Debug|Win32 51 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.DebugLTCG|x86.Build.0 = Debug|Win32 52 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.Release|x64.ActiveCfg = Release|x64 53 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.Release|x64.Build.0 = Release|x64 54 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.Release|x86.ActiveCfg = Release|Win32 55 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.Release|x86.Build.0 = Release|Win32 56 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseDLL|x64.ActiveCfg = Release|x64 57 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseDLL|x64.Build.0 = Release|x64 58 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseDLL|x86.ActiveCfg = Release|Win32 59 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseDLL|x86.Build.0 = Release|Win32 60 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseLIB|x64.ActiveCfg = Release|x64 61 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseLIB|x64.Build.0 = Release|x64 62 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseLIB|x86.ActiveCfg = Release|Win32 63 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseLIB|x86.Build.0 = Release|Win32 64 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseLTCG|x64.ActiveCfg = Release|x64 65 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseLTCG|x64.Build.0 = Release|x64 66 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseLTCG|x86.ActiveCfg = Release|Win32 67 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C}.ReleaseLTCG|x86.Build.0 = Release|Win32 68 | {46CF2D25-6A36-4189-B59C-E4815388E554}.Debug|x64.ActiveCfg = Debug|x64 69 | {46CF2D25-6A36-4189-B59C-E4815388E554}.Debug|x64.Build.0 = Debug|x64 70 | {46CF2D25-6A36-4189-B59C-E4815388E554}.Debug|x86.ActiveCfg = Debug|Win32 71 | {46CF2D25-6A36-4189-B59C-E4815388E554}.Debug|x86.Build.0 = Debug|Win32 72 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugDLL|x64.ActiveCfg = Debug|x64 73 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugDLL|x64.Build.0 = Debug|x64 74 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugDLL|x86.ActiveCfg = Debug|Win32 75 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugDLL|x86.Build.0 = Debug|Win32 76 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugLIB|x64.ActiveCfg = Debug|x64 77 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugLIB|x64.Build.0 = Debug|x64 78 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugLIB|x86.ActiveCfg = Debug|Win32 79 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugLIB|x86.Build.0 = Debug|Win32 80 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugLTCG|x64.ActiveCfg = Debug|x64 81 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugLTCG|x64.Build.0 = Debug|x64 82 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugLTCG|x86.ActiveCfg = Debug|Win32 83 | {46CF2D25-6A36-4189-B59C-E4815388E554}.DebugLTCG|x86.Build.0 = Debug|Win32 84 | {46CF2D25-6A36-4189-B59C-E4815388E554}.Release|x64.ActiveCfg = Release|x64 85 | {46CF2D25-6A36-4189-B59C-E4815388E554}.Release|x64.Build.0 = Release|x64 86 | {46CF2D25-6A36-4189-B59C-E4815388E554}.Release|x86.ActiveCfg = Release|Win32 87 | {46CF2D25-6A36-4189-B59C-E4815388E554}.Release|x86.Build.0 = Release|Win32 88 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseDLL|x64.ActiveCfg = Release|x64 89 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseDLL|x64.Build.0 = Release|x64 90 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseDLL|x86.ActiveCfg = Release|Win32 91 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseDLL|x86.Build.0 = Release|Win32 92 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseLIB|x64.ActiveCfg = Release|x64 93 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseLIB|x64.Build.0 = Release|x64 94 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseLIB|x86.ActiveCfg = Release|Win32 95 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseLIB|x86.Build.0 = Release|Win32 96 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseLTCG|x64.ActiveCfg = Release|x64 97 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseLTCG|x64.Build.0 = Release|x64 98 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseLTCG|x86.ActiveCfg = Release|Win32 99 | {46CF2D25-6A36-4189-B59C-E4815388E554}.ReleaseLTCG|x86.Build.0 = Release|Win32 100 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.Debug|x64.ActiveCfg = DebugDLL|x64 101 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.Debug|x64.Build.0 = DebugDLL|x64 102 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.Debug|x86.ActiveCfg = DebugDLL|Win32 103 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.Debug|x86.Build.0 = DebugDLL|Win32 104 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugDLL|x64.ActiveCfg = DebugDLL|x64 105 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugDLL|x64.Build.0 = DebugDLL|x64 106 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugDLL|x86.ActiveCfg = DebugDLL|Win32 107 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugDLL|x86.Build.0 = DebugDLL|Win32 108 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugLIB|x64.ActiveCfg = DebugLIB|x64 109 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugLIB|x64.Build.0 = DebugLIB|x64 110 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugLIB|x86.ActiveCfg = DebugLIB|Win32 111 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugLIB|x86.Build.0 = DebugLIB|Win32 112 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugLTCG|x64.ActiveCfg = DebugLTCG|x64 113 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugLTCG|x64.Build.0 = DebugLTCG|x64 114 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugLTCG|x86.ActiveCfg = DebugLTCG|Win32 115 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugLTCG|x86.Build.0 = DebugLTCG|Win32 116 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.Release|x64.ActiveCfg = ReleaseLIB|x64 117 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.Release|x64.Build.0 = ReleaseLIB|x64 118 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.Release|x86.ActiveCfg = ReleaseLIB|Win32 119 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.Release|x86.Build.0 = ReleaseLIB|Win32 120 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseDLL|x64.ActiveCfg = ReleaseDLL|x64 121 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseDLL|x64.Build.0 = ReleaseDLL|x64 122 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseDLL|x86.ActiveCfg = ReleaseDLL|Win32 123 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseDLL|x86.Build.0 = ReleaseDLL|Win32 124 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseLIB|x64.ActiveCfg = ReleaseLIB|x64 125 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseLIB|x64.Build.0 = ReleaseLIB|x64 126 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseLIB|x86.ActiveCfg = ReleaseLIB|Win32 127 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseLIB|x86.Build.0 = ReleaseLIB|Win32 128 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseLTCG|x64.ActiveCfg = ReleaseLTCG|x64 129 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseLTCG|x64.Build.0 = ReleaseLTCG|x64 130 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseLTCG|x86.ActiveCfg = ReleaseLTCG|Win32 131 | {A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseLTCG|x86.Build.0 = ReleaseLTCG|Win32 132 | EndGlobalSection 133 | GlobalSection(SolutionProperties) = preSolution 134 | HideSolutionNode = FALSE 135 | EndGlobalSection 136 | EndGlobal 137 | -------------------------------------------------------------------------------- /libsscrypto/cipher_get_size_ex.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t cipher_get_size_ex() 4 | { 5 | return sizeof(mbedtls_cipher_context_t); 6 | } -------------------------------------------------------------------------------- /libsscrypto/hkdf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /** 5 | * \name X509 Error codes 6 | * \{ 7 | */ 8 | #define MBEDTLS_ERR_HKDF_BAD_PARAM -0x5300 /**< Bad parameter */ 9 | /* \} name */ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | /** 16 | * \brief HMAC-based Extract-and-Expand Key Derivation Function 17 | * 18 | * \param md a hash function; md.size denotes the length of the hash 19 | * function output in bytes 20 | * \param salt optional salt value (a non-secret random value); 21 | * if not provided, it is set to a string of md.size zeros. 22 | * \param salt_len length in bytes of the optional \p salt 23 | * \param ikm (low-entropy) input keying material 24 | * \param ikm_len length in bytes of \p ikm 25 | * \param info optional context and application specific information 26 | * (can be a zero-length string) 27 | * \param info_len length of \p info in bytes 28 | * \param okm output keying material (of \p okm_len bytes) 29 | * \param okm_len length of output keying material in octets 30 | * (<= 255*md.size) 31 | * 32 | * \return 0 on success or one of the failure codes from mbedtls_hkdf_extract 33 | * or mbedtls_hkdf_expand 34 | */ 35 | int mbedtls_hkdf(const unsigned char *salt, 36 | int salt_len, const unsigned char *ikm, int ikm_len, 37 | const unsigned char *info, int info_len, unsigned char *okm, 38 | int okm_len); 39 | 40 | /** 41 | * \brief Take the input keying material \p ikm and extract from it a 42 | * fixed-length pseudorandom key \p prk 43 | * 44 | * \param md a hash function; md.size denotes the length of the hash 45 | * function output in bytes 46 | * \param salt optional salt value (a non-secret random value); 47 | * if not provided, it is set to a string of md.size zeros. 48 | * \param salt_len length in bytes of the optional \p salt 49 | * \param ikm (low-entropy) input keying material 50 | * \param ikm_len length in bytes of \p ikm 51 | * \param prk a pseudorandom key (of md.size bytes) 52 | * 53 | * \return 0 on success, MBEDTLS_ERR_HKDF_BAD_PARAM or one of mbedtls_md_* 54 | * error codes on failure 55 | */ 56 | int mbedtls_hkdf_extract(const mbedtls_md_info_t *md, const unsigned char *salt, 57 | int salt_len, const unsigned char *ikm, int ikm_len, 58 | unsigned char *prk); 59 | 60 | /** 61 | * \brief Expand the supplied \p prk into several additional pseudorandom keys 62 | * (the output of the KDF). 63 | * 64 | * \param md a hash function; md.size denotes the length of the hash 65 | * function output in bytes 66 | * \param prk a pseudorandom key of at least md.size bytes; usually, 67 | * the output from the extract step 68 | * \param prk_len length of \p prk in bytes 69 | * \param info optional context and application specific information 70 | * (can be a zero-length string) 71 | * \param info_len length of \p info in bytes 72 | * \param okm output keying material (of \p okm_len bytes) 73 | * \param okm_len length of output keying material in octets 74 | * (<= 255*md.size) 75 | * 76 | * \return 0 on success, MBEDTLS_ERR_HKDF_BAD_PARAM or a failure code from the 77 | * mbedtls_md_* family 78 | */ 79 | int mbedtls_hkdf_expand(const mbedtls_md_info_t *md, const unsigned char *prk, 80 | int prk_len, const unsigned char *info, int info_len, 81 | unsigned char *okm, int okm_len); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | /* HKDF-Extract + HKDF-Expand */ 88 | int mbedtls_hkdf(const unsigned char *salt, 89 | int salt_len, const unsigned char *ikm, int ikm_len, 90 | const unsigned char *info, int info_len, unsigned char *okm, 91 | int okm_len) 92 | { 93 | // HKDF_SHA1 94 | const mbedtls_md_info_t *md = mbedtls_md_info_from_type(MBEDTLS_MD_SHA1); 95 | 96 | unsigned char prk[MBEDTLS_MD_MAX_SIZE]; 97 | 98 | return mbedtls_hkdf_extract(md, salt, salt_len, ikm, ikm_len, prk) || 99 | mbedtls_hkdf_expand(md, prk, mbedtls_md_get_size(md), info, info_len, 100 | okm, okm_len); 101 | } 102 | 103 | /* HKDF-Extract(salt, IKM) -> PRK */ 104 | int mbedtls_hkdf_extract(const mbedtls_md_info_t *md, const unsigned char *salt, 105 | int salt_len, const unsigned char *ikm, int ikm_len, 106 | unsigned char *prk) 107 | { 108 | int hash_len; 109 | unsigned char null_salt[MBEDTLS_MD_MAX_SIZE] = { '\0' }; 110 | 111 | if (salt_len < 0) { 112 | return MBEDTLS_ERR_HKDF_BAD_PARAM; 113 | } 114 | 115 | hash_len = mbedtls_md_get_size(md); 116 | 117 | if (salt == NULL) { 118 | salt = null_salt; 119 | salt_len = hash_len; 120 | } 121 | 122 | return mbedtls_md_hmac(md, salt, salt_len, ikm, ikm_len, prk); 123 | } 124 | 125 | /* HKDF-Expand(PRK, info, L) -> OKM */ 126 | int mbedtls_hkdf_expand(const mbedtls_md_info_t *md, const unsigned char *prk, 127 | int prk_len, const unsigned char *info, int info_len, 128 | unsigned char *okm, int okm_len) 129 | { 130 | int hash_len; 131 | int N; 132 | int T_len = 0, where = 0, i, ret; 133 | mbedtls_md_context_t ctx; 134 | unsigned char T[MBEDTLS_MD_MAX_SIZE]; 135 | 136 | if (info_len < 0 || okm_len < 0 || okm == NULL) { 137 | return MBEDTLS_ERR_HKDF_BAD_PARAM; 138 | } 139 | 140 | hash_len = mbedtls_md_get_size(md); 141 | 142 | if (prk_len < hash_len) { 143 | return MBEDTLS_ERR_HKDF_BAD_PARAM; 144 | } 145 | 146 | if (info == NULL) { 147 | info = (const unsigned char *)""; 148 | } 149 | 150 | N = okm_len / hash_len; 151 | 152 | if ((okm_len % hash_len) != 0) { 153 | N++; 154 | } 155 | 156 | if (N > 255) { 157 | return MBEDTLS_ERR_HKDF_BAD_PARAM; 158 | } 159 | 160 | mbedtls_md_init(&ctx); 161 | 162 | if ((ret = mbedtls_md_setup(&ctx, md, 1)) != 0) { 163 | mbedtls_md_free(&ctx); 164 | return ret; 165 | } 166 | 167 | /* Section 2.3. */ 168 | for (i = 1; i <= N; i++) { 169 | unsigned char c = i; 170 | 171 | ret = mbedtls_md_hmac_starts(&ctx, prk, prk_len) || 172 | mbedtls_md_hmac_update(&ctx, T, T_len) || 173 | mbedtls_md_hmac_update(&ctx, info, info_len) || 174 | /* The constant concatenated to the end of each T(n) is a single 175 | octet. */ 176 | mbedtls_md_hmac_update(&ctx, &c, 1) || 177 | mbedtls_md_hmac_finish(&ctx, T); 178 | 179 | if (ret != 0) { 180 | mbedtls_md_free(&ctx); 181 | return ret; 182 | } 183 | 184 | memcpy(okm + where, T, (i != N) ? hash_len : (okm_len - where)); 185 | where += hash_len; 186 | T_len = hash_len; 187 | } 188 | 189 | mbedtls_md_free(&ctx); 190 | 191 | return 0; 192 | } -------------------------------------------------------------------------------- /libsscrypto/libsscrypto.def: -------------------------------------------------------------------------------- 1 | LIBRARY 2 | 3 | EXPORTS 4 | cipher_update=mbedtls_cipher_update 5 | cipher_info_from_string=mbedtls_cipher_info_from_string 6 | cipher_init=mbedtls_cipher_init 7 | cipher_setup=mbedtls_cipher_setup 8 | cipher_setkey=mbedtls_cipher_setkey 9 | cipher_set_iv=mbedtls_cipher_set_iv 10 | cipher_reset=mbedtls_cipher_reset 11 | cipher_free=mbedtls_cipher_free 12 | cipher_auth_encrypt=mbedtls_cipher_auth_encrypt 13 | cipher_auth_decrypt=mbedtls_cipher_auth_decrypt 14 | crypto_stream_chacha20_xor_ic 15 | crypto_stream_chacha20_ietf_xor_ic 16 | crypto_stream_salsa20_xor_ic 17 | crypto_aead_chacha20poly1305_ietf_encrypt 18 | crypto_aead_chacha20poly1305_ietf_decrypt 19 | crypto_aead_xchacha20poly1305_ietf_encrypt 20 | crypto_aead_xchacha20poly1305_ietf_decrypt 21 | crypto_aead_aes256gcm_encrypt 22 | crypto_aead_aes256gcm_decrypt 23 | crypto_aead_aes256gcm_is_available 24 | sodium_increment 25 | sodium_init 26 | cipher_get_size_ex 27 | md5_ret=mbedtls_md5_ret 28 | hkdf=mbedtls_hkdf 29 | EVP_CIPHER_CTX_new 30 | EVP_CIPHER_CTX_free 31 | EVP_CIPHER_CTX_reset 32 | EVP_CipherInit_ex 33 | EVP_CipherUpdate 34 | EVP_CipherFinal_ex 35 | EVP_CIPHER_CTX_set_padding 36 | EVP_CIPHER_CTX_set_key_length 37 | EVP_CIPHER_CTX_ctrl 38 | EVP_get_cipherbyname -------------------------------------------------------------------------------- /libsscrypto/libsscrypto.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {827C6D45-7F84-44A5-BF15-A5CD7ED79A9C} 23 | Win32Proj 24 | libsscrypto2 25 | 8.1 26 | libsscrypto 27 | 28 | 29 | 30 | DynamicLibrary 31 | true 32 | v140 33 | NotSet 34 | 35 | 36 | DynamicLibrary 37 | false 38 | v141 39 | true 40 | NotSet 41 | 42 | 43 | DynamicLibrary 44 | true 45 | v141 46 | NotSet 47 | 48 | 49 | DynamicLibrary 50 | false 51 | v141 52 | true 53 | NotSet 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | $(SolutionDir)libsodium\src\libsodium\include;$(SolutionDir)mbedtls\include;$(SolutionDir)shadowsocks-libev\src;$(IncludePath) 76 | $(SolutionDir)libsodium\bin\Win32\Debug\v140\static;$(SolutionDir)$(Configuration);$(LibraryPath) 77 | 78 | 79 | true 80 | $(SolutionDir)libsodium\src\libsodium\include;$(SolutionDir)mbedtls\include;$(IncludePath) 81 | $(SolutionDir)libsodium\bin\x64\Debug\v140\static;$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath) 82 | $(ProjectName)64 83 | 84 | 85 | false 86 | $(SolutionDir)libsodium\src\libsodium\include;$(SolutionDir)mbedtls\include;$(SolutionDir)shadowsocks-libev\src;$(IncludePath) 87 | $(SolutionDir)libsodium\bin\Win32\Release\v141\static;$(SolutionDir)$(Configuration);$(SolutionDir)openssl-prebuilt-lib\$(Platform)\;$(LibraryPath) 88 | 89 | 90 | false 91 | $(SolutionDir)libsodium\src\libsodium\include;$(SolutionDir)mbedtls\include;$(IncludePath) 92 | $(SolutionDir)libsodium\bin\x64\Release\v140\static;$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath) 93 | $(ProjectName)64 94 | 95 | 96 | 97 | NotUsing 98 | Level3 99 | Disabled 100 | WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSSCRYPTO_EXPORTS;SODIUM_STATIC;%(PreprocessorDefinitions) 101 | MultiThreadedDebug 102 | 103 | 104 | Windows 105 | true 106 | Ws2_32.lib;libsodium.lib;mbedTLS.lib;%(AdditionalDependencies) 107 | libsscrypto.def 108 | 109 | 110 | 111 | 112 | NotUsing 113 | Level3 114 | Disabled 115 | _DEBUG;_WINDOWS;_USRDLL;LIBSSCRYPTO_EXPORTS;SODIUM_STATIC;%(PreprocessorDefinitions) 116 | MultiThreadedDebug 117 | 118 | 119 | Windows 120 | true 121 | libsscrypto.def 122 | Ws2_32.lib;libsodium.lib;mbedTLS.lib;%(AdditionalDependencies) 123 | 124 | 125 | 126 | 127 | Level3 128 | NotUsing 129 | Full 130 | true 131 | true 132 | WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSSCRYPTO_EXPORTS;SODIUM_STATIC;%(PreprocessorDefinitions) 133 | MultiThreaded 134 | Speed 135 | 136 | 137 | Windows 138 | true 139 | true 140 | true 141 | Ws2_32.lib;crypt32.lib;libsodium.lib;mbedTLS.lib;libcrypto.lib;%(AdditionalDependencies) 142 | libsscrypto.def 143 | 144 | 145 | 146 | 147 | Level3 148 | NotUsing 149 | MaxSpeed 150 | true 151 | true 152 | NDEBUG;_WINDOWS;_USRDLL;LIBSSCRYPTO_EXPORTS;SODIUM_STATIC;%(PreprocessorDefinitions) 153 | MultiThreaded 154 | 155 | 156 | Windows 157 | true 158 | true 159 | true 160 | libsscrypto.def 161 | Ws2_32.lib;libsodium.lib;mbedTLS.lib;%(AdditionalDependencies) 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /libsscrypto/libsscrypto.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | 源文件 23 | 24 | 25 | 26 | 27 | 源文件 28 | 29 | 30 | 31 | 32 | 头文件 33 | 34 | 35 | 头文件 36 | 37 | 38 | -------------------------------------------------------------------------------- /openssl-prebuilt-lib/README.txt: -------------------------------------------------------------------------------- 1 | OpenSSL static library guide for VS2017 2 | 3 | # Read NOTES.WIN and NOTES.PERL 4 | 5 | # https://github.com/openssl/openssl/issues/1061 6 | # Add 'crypt32.lib' to linker command 7 | # Otherwise we get 8 | # 1>libcrypto.lib(e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertOpenStore 9 | # 1>libcrypto.lib(e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertCloseStore 10 | # 1>libcrypto.lib(e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertEnumCertificatesInStore 11 | # 1>libcrypto.lib(e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertFindCertificateInStore 12 | # 1>libcrypto.lib(e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertDuplicateCertificateContext 13 | # 1>libcrypto.lib(e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext 14 | # 1>libcrypto.lib(e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertGetCertificateContextProperty 15 | 16 | # use Visual Studio native tools command prompt 17 | # use activeperl, install NASM assembler 18 | ppm install dmake 19 | 20 | # Win32 x86 21 | set PATH=D:\NASM-32;%PATH% 22 | # configure with no zlib 23 | perl Configure VC-WIN32 no-shared --release --prefix=C:\Users\home\Downloads\openssl-1.1.0g\x86-build --openssldir=C:\Users\home\Downloads\openssl-1.1.0g\x86-install 24 | nmake 25 | nmake test 26 | # to rebuild 27 | nmake distclean 28 | 29 | # x64 30 | set PATH=D:\NASM-64;%PATH% 31 | perl Configure VC-WIN64A no-shared --release --prefix=C:\Users\home\Downloads\openssl-1.1.0g\x64-build --openssldir=C:\Users\home\Downloads\openssl-1.1.0g\x64-install 32 | # others are the same as x86 33 | -------------------------------------------------------------------------------- /openssl-prebuilt-lib/Win32/libcrypto.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shadowsocks/libsscrypto/fb70231e3a2321b6e2d34b18c0a8bc4426132158/openssl-prebuilt-lib/Win32/libcrypto.lib -------------------------------------------------------------------------------- /openssl-prebuilt-lib/Win32/ossl_static.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shadowsocks/libsscrypto/fb70231e3a2321b6e2d34b18c0a8bc4426132158/openssl-prebuilt-lib/Win32/ossl_static.pdb --------------------------------------------------------------------------------