Git Product home page Git Product logo

botan's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

botan's Issues

botan.block.xtea crashes DMD

import botan.block.xtea;

A single line crashes DMD 2.079.0.
dmd -v outputs the following:

semantic  main
Enhanced memory security is enabled.
import    memutils.securepool   (..\..\AppData\Local\dub\packages\memutils-0.4.10\memutils\source\memutils\securepool.d)
Memory debugger enabled
import    core.bitop    (C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\bitop.d)
import    std.typetuple (C:\D\dmd2\windows\bin\..\..\src\phobos\std\typetuple.d)
import    core.checkedint       (C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\checkedint.d)
import    memutils.rbtree       (..\..\AppData\Local\dub\packages\memutils-0.4.10\memutils\source\memutils\rbtree.d)
import    std.utf       (C:\D\dmd2\windows\bin\..\..\src\phobos\std\utf.d)

object.Error@(0): Access Violation
----------------
0x00483769
0x00495AC3
0x004D912B
0x004D97B1
0x004A6F70

Build with ldc2-0.17.0 under linux is failing

Just updating some vibe server with latest packages and compilers (botan 1.12.4)
dub build -b release --compiler ldc2 ends with

botan:base 1.12.4: building configuration "full"...
Enhanced memory security is enabled.
Instruction does not dominate all uses!
  %58 = load %botan.math.bigint.bigint.BigInt*, %botan.math.bigint.bigint.BigInt** %condtmp
  %69 = bitcast %botan.math.bigint.bigint.BigInt* %58 to i8*
Instruction does not dominate all uses!
  %106 = load %botan.math.bigint.bigint.BigInt*, %botan.math.bigint.bigint.BigInt** %condtmp20
  %116 = bitcast %botan.math.bigint.bigint.BigInt* %106 to i8*
Instruction does not dominate all uses!
  %151 = load %botan.math.bigint.bigint.BigInt*, %botan.math.bigint.bigint.BigInt** %condtmp43
  %161 = bitcast %botan.math.bigint.bigint.BigInt* %151 to i8*
LLVM ERROR: Broken function found, compilation aborted!
ldc2 failed with exit code 1.

on 64bit fedora linux server

bcrypt doesn't work on Windows

I use function check_bcrypt to check password:

                auto pass = "";
                auto hash = "$2a$10$I0fc8gzfwMLFS2H79LFxHOJ6CMd8jB7s1MizshLwQqrwe5DlMJnNC";
                if (Botan::check_bcrypt(pass, hash)) {
                    LOG_INFO("Success");
                } else {
                    LOG_INFO("Unsuccess");
                }

This code works perfect in Linux and the function returns true as it must do. On Windows it returns false.

Linux version is compiled by gcc-6.3.3 for x64 architecture. Windows version uses VisualStudio 2017 compiler for x86 architecture.
Botan's version is 2.6.

Slow build using DMD with release switch

dub build --config=32mscoff -b release

It takes over 3 minutes to build for me.

dmd params are: -m32mscoff -lib -release -inline -O -w

if -inline is removed, it builds within 12s.
On the linux it is a similar story.

DMD version: 2.068.0
OS: Windows 8.1 x86_64

I've posted this upstream: https://issues.dlang.org/show_bug.cgi?id=14939
But as an user only, I have no idea what's wrong or how can I help with it.

I guess that botan is so complex that dmd optimisations in release slows it down too much, but..
I event thought originally, that it is stuck, because dmd used just about 15% of CPU, but it actually compiled with enough time..

Compilation fails on latest dmd and ldc

DMD: DMD64 D Compiler v2.100.2
LDC: LDC - the LLVM D compiler (1.30.0)

botan-math 1.0.3: target for configuration "regular" is up to date. memutils 1.0.4: building configuration "secure"... ../../../.dub/packages/memutils-1.0.4/memutils/source/memutils/rbtree.d(734,2): Deprecation: Usage of the bodykeyword is deprecated. Usedoinstead. ../../../.dub/packages/memutils-1.0.4/memutils/source/memutils/rbtree.d(777,2): Deprecation: Usage of thebodykeyword is deprecated. Usedoinstead. ../../../.dub/packages/memutils-1.0.4/memutils/source/memutils/rbtree.d(806,2): Deprecation: Usage of thebodykeyword is deprecated. Usedoinstead. ../../../.dub/packages/memutils-1.0.4/memutils/source/memutils/allocators.d(18,8): Error: modulestd.exceptionimportenforceExnot found, did you mean templatestd.exception.enforce(E : Throwable = Exception) if (is(typeof(new E("", string.init, size_t.init)) : Throwable) || is(typeof(new E(string.init, size_t.init)) : Throwable))?

undefined identifier pbes2Encrypt

While specifying configuration pubkey syntax errors are thrown:

{
	"dependencies": {
		"botan": "1.12.18"
	},
    "subConfigurations": {
        "botan": "pubkey"
    },
	"name": "t3"
}

....\AppData\Local\dub\packages\botan-1.12.18\botan\source\botan\pubkey\pkcs8.d(101,3): Error: undefined identifier pbes2Encrypt
....\AppData\Local\dub\packages\botan-1.12.18\botan\source\botan\pubkey\pkcs8.d(295,11): Error: undefined identifier pbes2Decrypt

AES sample ?

Would it be possible for you to show a tiny AES sample ?

Thanks in advance ;)

Build failing with DMD 2.072.0

Build is failing with the following error:

../../.dub/packages/botan-1.12.7/botan/source/botan/utils/http_util/http_util.d(29,12): Error: module stream is in file 'std/stream.d' which cannot be read

This appears related to the removal std.stream in 2.072.0

Tried running dub upgrade. No change.

Bcrypt example

Would it be possible for you to provide a bcrypt example? I do see unittest but it would be nice to have an example as well.

OSX issue with botan

Having trouble using botan on OSX. This my first go w/ botan so I may be missing something but I tried on debian and everything worked fine.

import botan.passhash.bcrypt;
import std.stdio;
import botan.rng.rng;
import botan.rng.auto_rng;
import memutils.unique;
void main() {
    string password = "ObJ_3fjeEtKJzNs135!4384$_29!^  _)";
    Unique!AutoSeededRNG rng = new AutoSeededRNG;

}

DMD64 D Compiler v2.071.1

DUB version 0.9.25, built on May 24 2016

dmd -of.dub/build/application-debug-posix.osx-x86_64-dmd_2071-24704D4A7E3E024137147B97F5FF9B76/btan .dub/build/application-debug-posix.osx-x86_64-dmd_2071-24704D4A7E3E024137147B97F5FF9B76/btan.o ../../../../.dub/packages/botan-1.12.5/build/libbotan_passhash.a ../../../../.dub/packages/botan-1.12.5/build/libbotan_base.a ../../../../.dub/packages/botan-math-1.0.2/build/libbotan_math.a ../../../../.dub/packages/memutils-0.4.6/libmemutils.a -L-ldl -g
ld: in ../../../../.dub/packages/botan-1.12.5/build/libbotan_base.a(unique_41f9_3b6.o), in section __TEXT,__textcoal_nt reloc 2: symbol index out of range for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1
FAIL .dub/build/application-debug-posix.osx-x86_64-dmd_2071-24704D4A7E3E024137147B97F5FF9B76/ btan executable
dmd failed with exit code 1.
Full exception: object.Exception@source/dub/compilers/compiler.d(142): dmd failed with exit code 1.
----------------
4   dub                                 0x0000000100092807 pure @safe void std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong, const(char[])) + 123
5   dub                                 0x00000001000928e0 pure @safe bool std.exception.enforce!(Exception, bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) + 100
6   dub                                 0x00000001000aa75f void dub.compilers.compiler.Compiler.invokeTool(immutable(char)[][], void delegate(int, immutable(char)[])) + 739
7   dub                                 0x00000001000ac063 void dub.compilers.dmd.DMDCompiler.invokeLinker(const(dub.compilers.buildsettings.BuildSettings), const(dub.platform.BuildPlatform), immutable(char)[][], void delegate(int, immutable(char)[])) + 919
8   dub                                 0x00000001000bbe82 void dub.generators.build.BuildGenerator.buildWithCompiler(dub.generators.generator.GeneratorSettings, dub.compilers.buildsettings.BuildSettings) + 1974
9   dub                                 0x00000001000b92c2 bool dub.generators.build.BuildGenerator.performCachedBuild(dub.generators.generator.GeneratorSettings, dub.compilers.buildsettings.BuildSettings, const(dub.package_.Package), immutable(char)[], immutable(char)[], const(dub.package_.Package[]), const(dub.internal.vibecompat.inet.path.Path[])) + 1062
10  dub                                 0x00000001000b8cdc bool dub.generators.build.BuildGenerator.buildTarget(dub.generators.generator.GeneratorSettings, dub.compilers.buildsettings.BuildSettings, const(dub.package_.Package), immutable(char)[], const(dub.package_.Package[]), const(dub.internal.vibecompat.inet.path.Path[])) + 728
11  dub                                 0x00000001000b8814 D3dub10generators5build14BuildGenerator15generateTargetsMFS3dub10generators9generator17GeneratorSettingsxHAyaS3dub10generators9generator16ProjectGenerator10TargetInfoZ14buildTargetRecMFAyaZv + 1136
12  dub                                 0x00000001000b830a void dub.generators.build.BuildGenerator.generateTargets(dub.generators.generator.GeneratorSettings, const(dub.generators.generator.ProjectGenerator.TargetInfo[immutable(char)[]])) + 494
13  dub                                 0x00000001000c0fdf void dub.generators.generator.ProjectGenerator.generate(dub.generators.generator.GeneratorSettings) + 899
14  dub                                 0x0000000100024fb7 void dub.dub.Dub.generateProject(immutable(char)[], dub.generators.generator.GeneratorSettings) + 155
15  dub                                 0x0000000100009ca0 int dub.commandline.GenerateCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) + 1484
16  dub                                 0x000000010000a021 int dub.commandline.BuildCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) + 125
17  dub                                 0x000000010000a211 int dub.commandline.RunCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) + 125
18  dub                                 0x00000001000067b7 int dub.commandline.runDubCommandLine(immutable(char)[][]) + 2755
19  dub                                 0x0000000100001887 _Dmain + 31
20  dub                                 0x00000001001b8c73 D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 39
21  dub                                 0x00000001001b8ba7 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 35
22  dub                                 0x00000001001b8c18 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() + 44
23  dub                                 0x00000001001b8ba7 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 35
24  dub                                 0x00000001001b8b0d _d_run_main + 497
25  dub                                 0x000000010000191f main + 15
26  dub                                 0x000000010000185f start + 51
27  ???                                 0x0000000000000002 0x0 + 2

CVE issue tracking

Just wondering if it's possible to keep track of the list of vulnerabilities in Botan as they apply to this D port? E.g., a list of CVE numbers? I see that the current Botan version is listed as 1.11.10, which at least in the C++ version seems to be vulnerable to CVE-2017-14737, CVE-2016-9132, CVE-2016-6879, CVE-2016-6878, CVE-2016-2850, CVE-2016-2849, CVE-2016-2196, CVE-2016-2195, CVE-2016-2194, ... and a bunch of others. But I don't know how many of these apply to the D port, since presumably some of the buffer overflows ought to be prevented by bounds checking in D, and perhaps some of the other issues may also be prevented by other D features.

I guess the point is, is there some way to track which issue(s) affect this D port of Botan? Because it's not clear, at a glance, what vulnerabilities may exist.

Many deprecation warnings

DMD64 D Compiler v2.079.0, compiling in into Vibe 0.8.3

/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/asn1/asn1_time.d(182,53): Deprecation: The delete keyword has been deprecated.  Use object.destroy() instead.
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/asn1/asn1_time.d(242,53): Deprecation: The delete keyword has been deprecated.  Use object.destroy() instead.
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/compression/lzma.d(109,35): Deprecation: The delete keyword has been deprecated.  Use object.destroy() instead.
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/cert/x509/ocsp.d(261,8): Deprecation: Symbol core.sync.mutex.Mutex is not visible from module ocsp because it is privately imported in module concurrency
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/test.d(80,8): Deprecation: struct `std.datetime.StopWatch` is deprecated - Use std.datetime.stopwatch.StopWatch.
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/test.d(80,8): Deprecation: struct `std.datetime.StopWatch` is deprecated - Use std.datetime.stopwatch.StopWatch.
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/test.d(81,11): Deprecation: struct `std.datetime.StopWatch` is deprecated - Use std.datetime.stopwatch.StopWatch.
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/asn1/ber_dec.d(280,36): Deprecation: integral promotion not done for ~obj.value.opIndex(i), use '-transition=intpromote' switch or ~cast(int)(obj.value.opIndex(i))
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/asn1/der_enc.d(219,33): Deprecation: integral promotion not done for ~m_contents.opIndex(i), use '-transition=intpromote' switch or ~cast(int)(m_contents.opIndex(i))
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/idea.d(84,20): Deprecation: integral promotion not done for -this.m_EK.opIndex(2LU), use '-transition=intpromote' switch or -cast(int)(this.m_EK.opIndex(2LU))
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/idea.d(85,20): Deprecation: integral promotion not done for -this.m_EK.opIndex(1LU), use '-transition=intpromote' switch or -cast(int)(this.m_EK.opIndex(1LU))
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/idea.d(93,31): Deprecation: integral promotion not done for -this.m_EK.opIndex(j + 3LU), use '-transition=intpromote' switch or -cast(int)(this.m_EK.opIndex(j + 3LU))
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/idea.d(94,31): Deprecation: integral promotion not done for -this.m_EK.opIndex(j + 4LU), use '-transition=intpromote' switch or -cast(int)(this.m_EK.opIndex(j + 4LU))
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/idea.d(101,19): Deprecation: integral promotion not done for -this.m_EK.opIndex(50LU), use '-transition=intpromote' switch or -cast(int)(this.m_EK.opIndex(50LU))
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/idea.d(102,19): Deprecation: integral promotion not done for -this.m_EK.opIndex(49LU), use '-transition=intpromote' switch or -cast(int)(this.m_EK.opIndex(49LU))
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/idea.d(127,56): Deprecation: integral promotion not done for ~P_mask, use '-transition=intpromote' switch or ~cast(int)(P_mask)
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/rc2.d(41,29): Deprecation: integral promotion not done for ~R3, use '-transition=intpromote' switch or ~cast(int)(R3)
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/rc2.d(44,29): Deprecation: integral promotion not done for ~R0, use '-transition=intpromote' switch or ~cast(int)(R0)
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/rc2.d(47,29): Deprecation: integral promotion not done for ~R1, use '-transition=intpromote' switch or ~cast(int)(R1)
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/rc2.d(50,29): Deprecation: integral promotion not done for ~R2, use '-transition=intpromote' switch or ~cast(int)(R2)
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/rc2.d(84,29): Deprecation: integral promotion not done for ~R2, use '-transition=intpromote' switch or ~cast(int)(R2)
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/rc2.d(87,29): Deprecation: integral promotion not done for ~R1, use '-transition=intpromote' switch or ~cast(int)(R1)
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/rc2.d(90,29): Deprecation: integral promotion not done for ~R0, use '-transition=intpromote' switch or ~cast(int)(R0)
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/block/rc2.d(93,29): Deprecation: integral promotion not done for ~R3, use '-transition=intpromote' switch or ~cast(int)(R3)
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/asn1/der_enc.d(219,33): Deprecation: integral promotion not done for ~m_contents.opIndex(i), use '-transition=intpromote' switch or ~cast(int)(m_contents.opIndex(i))
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/asn1/asn1_time.d(182,53): /home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/asn1/asn1_time.d(242,53): /home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/cert/x509/ocsp.d(261,8): Deprecation: Symbol core.sync.mutex.Mutex is not visible from module ocsp because it is privately imported in module concurrency
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/asn1/der_enc.d(219,33): Deprecation: integral promotion not done for ~m_contents.opIndex(i), use '-transition=intpromote' switch or ~cast(int)(m_contents.opIndex(i))
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/asn1/asn1_time.d(182,53): Deprecation: The delete keyword has been deprecated.  Use object.destroy() instead.
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/asn1/asn1_time.d(242,53): Deprecation: The delete keyword has been deprecated.  Use object.destroy() instead.
/home/vagrant/.dub/packages/botan-1.12.9/botan/source/botan/cert/x509/ocsp.d(261,8): Deprecation: Symbol core.sync.mutex.Mutex is not visible from module ocsp because it is privately imported in module concurrency

Compilation fails on Linux if user's default shell is not bash-compatible

Botan imported into project through Dub dependencies

Default shell is fish, version 2.6.0

Attempting to build the project yields this output:

Running pre-generate commands for botan...
fish: Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.
ld -v | grep 'gold' > /dev/null || echo 'Notice: Botan uses many symbols. Look into switching from ld (bfd) to ld (Gold) linker to reduce link times from >15s to <2s'
                                 ^

Command failed with exit code 127
Builder finished with result 2

Botan vs OpenSSL?

I would like to know how will this be compared to OpenSSL? Like does botan depend on openssl, and if not how secured is it vs openssl? How well does it perform and how is the compatibility between the two?

Can't build on Windows (32 bit or 64 bit)

Hi,

I'm trying to build using the subConfigurations option for 32 bit, or the arch option for 64 bit on Windows; however I get the following errors:

64 Bit:

dub --arch=x86_64
Running pre-generate commands for botan...
Error executing command run: Command failed with exit code 1

32 Bit (after dub clean):

dub --force
Building memutils 0.3.5 configuration "secure", build type debug.
Running dmd...
Enhanced memory security is enabled.
Building botan 1.11.12 configuration "32mscoff", build type debug.
Running dmd...
Enhanced memory security is enabled.
Building test ~master configuration "application", build type debug.
Compiling using dmd...
Linking...
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
.dub\build\application-debug-windows-x86-dmd_2067-    C50BC4185BBE7C980ABADA87EFB92331\test.obj Offset 00000H Record Type 004C
 Error 138: Module or Dictionary corrupt
--- errorlevel 1
FAIL .dub\build\application-debug-windows-x86-dmd_2067-     C50BC4185BBE7C980ABADA87EFB92331\ test executable
Error executing command run: dmd failed with exit code 1.

Any suggestions to remedy this?

DUB failing using ldc

Compiler: ldc
OS Architecture: x86_64
Linux distribution: 4.15.6-1-ARCH
Dub.sdl:

dependency "vibe-d" version="~>0.8.3-beta.1"
dependency "vibe-d:tls" version="~>0.8.3-beta.1"
versions "VibeDefaultMain"
subConfiguration "vibe-d:tls" "botan"

Error log: https://hastebin.com/wubujowezi.coffeescript
When did start to happen: Yesterday I updated my DUB package to version 1.8.0

Cannot use botan.cert.x509.x509self

Hey, thanks for your work!

However, I can't get botan.cert.x509.x509self to work. When imported, the D compiler is complaining:

../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/crl_ent.d(27,18): Error: template instance `RefCounted!CRLEntryImpl` template `RefCounted` is not defined
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/allocators.d(138,29): Error: class `X509CRLImpl` is forward referenced
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/allocators.d(139,20): Error: class `X509CRLImpl` is forward referenced
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/utils.d(38,18): Error: template instance `memutils.allocators.AllocSize!(X509CRLImpl)` error instantiating
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/refcounted.d(31,20):        instantiated from here: `ObjectAllocator!(X509CRLImpl, ThreadMem)`
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/refcounted.d(199,29):        instantiated from here: `opCall!()`
../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/x509_crl.d(30,17):        instantiated from here: `RefCounted!(X509CRLImpl, ThreadMem)`
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/refcounted.d(15,2): Error: mixin `memutils.refcounted.RefCounted!(X509CRLImpl, ThreadMem).RefCounted.Embed!(m_object, false)` error instantiating
../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/certstor.d(85,28): Error: function `botan.cert.x509.certstor.CertificateStoreInMemory.allSubjects` does not override any function
../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/certstor.d(95,30): Error: function `botan.cert.x509.certstor.CertificateStoreInMemory.findCertRef` does not override any function
../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/certstor.d(159,28): Error: function `botan.cert.x509.certstor.CertificateStoreOverlay.allSubjects` does not override any function
../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/certstor.d(167,30): Error: function `botan.cert.x509.certstor.CertificateStoreOverlay.findCertRef` does not override any function

Botan fails to build with D 2.084

Botan fails to build with DMD 2.084.

Performing "debug" build using /usr/bin/dmd for x86_64.
botan-math 1.0.3: target for configuration "regular" is up to date.
memutils 0.4.11: target for configuration "secure" is up to date.
botan 1.12.10: building configuration "full"...
Enhanced memory security is enabled.
Memory debugger enabled
../../../.dub/packages/botan-1.12.10/botan/source/botan/cert/x509/ocsp.d(261,8): Deprecation: Symbol `core.sync.mutex.Mutex` is not visible from module `ocsp` because it is privately imported in module `concurrency`
/usr/include/dmd/druntime/import/object.d(518,9): Error: union `object.destroy!(true, RTSS).destroy.UntypedInit` has forward references
../../../.dub/packages/memutils-0.4.11/memutils/source/memutils/utils.d(163,56): Error: template instance `object.destroy!(true, RTSS)` error instantiating
../../../.dub/packages/memutils-0.4.11/memutils/source/memutils/vector.d(74,24):        instantiated from here: `freeArray!(RTSS, ThreadMem)`
../../../.dub/packages/botan-1.12.10/botan/source/botan/constructs/tss.d(43,12):        instantiated from here: `Vector!(RTSS, ThreadMem)`
../../../.dub/packages/memutils-0.4.11/memutils/source/memutils/refcounted.d(13,2): Error: mixin `memutils.refcounted.RefCounted!(Vector!(RTSS, ThreadMem), ThreadMem).RefCounted.Embed!(m_object, false)` error instantiating
../../../.dub/packages/memutils-0.4.11/memutils/source/memutils/vector.d(299,12): Error: template instance `memutils.refcounted.RefCounted!(Vector!(RTSS, ThreadMem), ThreadMem)` error instantiating
../../../.dub/packages/botan-1.12.10/botan/source/botan/constructs/tss.d(43,12):        instantiated from here: `Vector!(RTSS, ThreadMem)`
../../../.dub/packages/botan-1.12.10/botan/source/botan/test.d(80,8): Deprecation: struct `std.datetime.StopWatch` is deprecated - Use std.datetime.stopwatch.StopWatch.
../../../.dub/packages/botan-1.12.10/botan/source/botan/test.d(80,8): Deprecation: struct `std.datetime.StopWatch` is deprecated - Use std.datetime.stopwatch.StopWatch.
../../../.dub/packages/botan-1.12.10/botan/source/botan/test.d(81,11): Deprecation: struct `std.datetime.StopWatch` is deprecated - Use std.datetime.stopwatch.StopWatch.
/usr/bin/dmd failed with exit code 1.

Note: I forgot to mention: Botan does build successfully for with DMD 2.083.1 or earlier.

Use slices instead of ptr-length-pairs

Like the C++ code, on many places the API requires a ptr-length-pair:

    this(const(ubyte)* input, size_t length, Base base = Binary)

The proper D way would be to provide a slice instead:

    this(const(ubyte)[] input, Base base = Binary)

I can make this change, but would like to know if this is OK, @etcimon .

Seg fault when using RSA keys

Using OSX 10.12.5, ldc 1.2.0, vibe 0.8.0-beta6, botan 1.12.8, botan-math 1.0.3.

I tried to use a PKCS8 RSA key with no password. Might be related to #25.

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x5fbfd410)
    frame #0: 0x0000000100738f63 raft`_D10botan_math7mp_word11word8_madd3FKG8mKxG8mmmZm at mp_word.d:869
   866                          add RAX, RCX;
   867                          adc RDX, 0;
   868                          mov carry, RDX;
-> 869                          mov [RDI+56], RAX;
   870                  }
   871                  z[0 .. 8] = ret[0..8];
   872                  return carry;
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x5fbfd410)
  * frame #0: 0x0000000100738f63 raft`_D10botan_math7mp_word11word8_madd3FKG8mKxG8mmmZm at mp_word.d:869
    frame #1: 0x0000000100738067 raft`_D10botan_math8mp_monty17bigint_monty_redcFPmxPmmmPmZv at mp_monty.d:182
    frame #2: 0x0000000100737f55 raft`_D10botan_math8mp_monty16bigint_monty_mulFPmmxPmmmxPmmmxPmmmPmZv at mp_monty.d:134
    frame #3: 0x000000010065f4e9 raft`_D5botan4math12numbertheory8def_powm23MontgomeryExponentiator7setBaseMFKxS5botan4math6bigint6bigint6BigIntZv at def_powm.d:135
    frame #4: 0x000000010066ae6e raft`_D5botan4math12numbertheory7pow_mod8PowerMod12__T7setBaseZ7setBaseMFKxS5botan4math6bigint6bigint6BigIntZv at pow_mod.d:126
    frame #5: 0x000000010066b1ef raft`_D5botan4math12numbertheory7pow_mod25FixedExponentPowerModImpl11__T6opCallZ6opCallMFKxS5botan4math6bigint6bigint6BigIntZS5botan4math6bigint6bigint6BigInt at pow_mod.d:174
    frame #6: 0x0000000100661565 raft`_D5botan4math12numbertheory7numthry12__T7isPrimeZ7isPrimeFKxS5botan4math6bigint6bigint6BigIntC5botan3rng3rng21RandomNumberGeneratormbZb at numthry.d:479
    frame #7: 0x00000001006be744 raft`_D5botan6pubkey4algo7if_algo18IFSchemePrivateKey12checkKeyImplMxFC5botan3rng3rng21RandomNumberGeneratorbZb at if_algo.d:207
    frame #8: 0x00000001006c5da0 raft`_D5botan6pubkey4algo3rsa10RSAOptions8checkKeyFxC5botan6pubkey4algo7if_algo18IFSchemePrivateKeyC5botan3rng3rng21RandomNumberGeneratorbZb at rsa.d:38
    frame #9: 0x00000001006be0c6 raft`_D5botan6pubkey4algo7if_algo18IFSchemePrivateKey8checkKeyMxFC5botan3rng3rng21RandomNumberGeneratorbZb at if_algo.d:192
    frame #10: 0x00000001006d4e52 raft`_D5botan6pubkey7pk_keys9PublicKey9loadCheckMxFC5botan3rng3rng21RandomNumberGeneratorZv at pk_keys.d:107
    frame #11: 0x00000001006bf587 raft`_D5botan6pubkey4algo7if_algo18IFSchemePrivateKey47__T6__ctorTS5botan6pubkey4algo3rsa10RSAOptionsZ6__ctorMFxS5botan6pubkey4algo3rsa10RSAOptionsC5botan3rng3rng21RandomNumberGeneratorxS8memutils10refcounted88__T10RefCountedTC5botan4asn16alg_id23AlgorithmIdentifierImplTS8memutils5utils9ThreadMemZ10RefCountedKxS8memutils6vector40__T6VectorThTS8memutils5utils9SecureMemZ6VectorZC5botan6pubkey4algo7if_algo18IFSchemePrivateKey at if_algo.d:149
    frame #12: 0x00000001006c6a62 raft`_D5botan6pubkey4algo3rsa13RSAPrivateKey6__ctorMFNcxS8memutils10refcounted88__T10RefCountedTC5botan4asn16alg_id23AlgorithmIdentifierImplTS8memutils5utils9ThreadMemZ10RefCountedKxS8memutils6vector40__T6VectorThTS8memutils5utils9SecureMemZ6VectorC5botan3rng3rng21RandomNumberGeneratorZS5botan6pubkey4algo3rsa13RSAPrivateKey at rsa.d:97
    frame #13: 0x00000001006d3b2b raft`_D5botan6pubkey7pk_algs14makePrivateKeyFKxS8memutils10refcounted88__T10RefCountedTC5botan4asn16alg_id23AlgorithmIdentifierImplTS8memutils5utils9ThreadMemZ10RefCountedKxS8memutils6vector40__T6VectorThTS8memutils5utils9SecureMemZ6VectorC5botan3rng3rng21RandomNumberGeneratorZC5botan6pubkey7pk_keys10PrivateKey at pk_algs.d:102
    frame #14: 0x00000001006d6658 raft`_D5botan6pubkey5pkcs87loadKeyFS8memutils10refcounted81__T10RefCountedTC5botan7filters8data_src14DataSourceImplTS8memutils5utils6AppMemZ10RefCountedC5botan3rng3rng21RandomNumberGeneratorDFZAyaZC5botan6pubkey7pk_keys10PrivateKey at pkcs8.d:155
    frame #15: 0x00000001006d7f37 raft`_D5botan6pubkey5pkcs87loadKeyFxAyaC5botan3rng3rng21RandomNumberGeneratorDFZAyaZC5botan6pubkey7pk_keys10PrivateKey at pkcs8.d:186
    frame #16: 0x00000001006d8016 raft`_D5botan6pubkey5pkcs87loadKeyFxAyaC5botan3rng3rng21RandomNumberGeneratorxAyaZC5botan6pubkey7pk_keys10PrivateKey at pkcs8.d:201
    frame #17: 0x00000001002f215a raft`_D4vibe6stream5botan15BotanTLSContext17usePrivateKeyFileMFAyaZ9__lambda2MFNeZC5botan6pubkey7pk_keys10PrivateKey at botan.d:456
    frame #18: 0x00000001002f20b7 raft`_D4vibe6stream5botan15BotanTLSContext17usePrivateKeyFileMFNfAyaZv at botan.d:456
    frame #19: 0x000000010001c5d7 raft`_Dmain at app.d:46
    frame #20: 0x0000000100a1091f raft`_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 15
    frame #21: 0x0000000100a10864 raft`_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 20
    frame #22: 0x0000000100a1078d raft`_d_run_main + 461
    frame #23: 0x00000001000b3a45 raft`main at __entrypoint.d:8
    frame #24: 0x00007fffd4d17235 libdyld.dylib`start + 1
    frame #25: 0x00007fffd4d17235 libdyld.dylib`start + 1

SegFault while encoding PEM+BER for Public/Private ECC Keys

Given:

auto rng = new AutoSeededRNG();
auto ecg = ECGroup("secp384r1");
auto key = ECDHPrivateKey(rng, ecg);
auto privKey = key.m_priv;
auto pubKey = cast(ECPublicKey)key.m_priv;

This will fail for public keys:

import botan.pubkey.x509_key : PEM_encode;
import botan.pubkey.x509_key : BER_encode;
auto ber = BER_encode(pubKey);
auto pem = PEM_encode(pubKey);
return pem;

This will fail for private keys without password:

import botan.pubkey.pkcs8 : PEM_encode;
return PEM_encode(privKey);

Same for with password. Any time I try to encode to PEM or BER I am greeted with a SegFault.

This is with the latest LDC. The DMD build is broken on OSX

Build failing with DMD 2.078.1

..\..\src\druntime\import\object.d(3440,23): Error: template memutils.refcounted.RefCounted!(X509CertificateImpl, ThreadMem).RefCounted.opCast does not match any template declaration
..\..\src\druntime\import\object.d(3440,49): Error: template memutils.refcounted.RefCounted!(X509CertificateImpl, ThreadMem).RefCounted.opCast does not match any template declaration
..\..\src\druntime\import\object.d(3441,39): Error: template memutils.refcounted.RefCounted!(X509CertificateImpl, ThreadMem).RefCounted.opCast does not match any template declaration
..\..\AppData\Roaming\dub\packages\memutils-0.4.9\memutils\source\memutils\vector.d(790,10): Error: template instance object.__equals!(const(RefCounted!(X509CertificateImpl, ThreadMem)), const(RefCounted!(X509CertificateImpl, ThreadMem))) error instantiating
..\..\AppData\Roaming\dub\packages\memutils-0.4.9\memutils\source\memutils\helpers.d(71,27):        instantiated from here: opEquals!()
..\..\AppData\Roaming\dub\packages\memutils-0.4.9\memutils\source\memutils\refcounted.d(10,1):        instantiated from here: opEquals!(RefCounted!(Vector!(RefCounted!(X509CertificateImpl, ThreadMem), ThreadMem), ThreadMem))

dub build fails with the error above. Also occurs on Linux.
Blame me for not opening the issue in the repo of memutils.

Performance vs openssl

Out of curiosity I tried simple benchmark of JWTD library (https://github.com/chalucha/jwtd/tree/benchmark/benchmark)

With dmd-2.068 it resulted in:
dub -c openssl -b release

JWT None:       64 ms, 465 ฮผs, and 3 hnsecs
JWT HS256:      95 ms and 851 ฮผs
JWT RS256:      16 secs, 60 ms, 674 ฮผs, and 6 hnsecs
JWT ES256:      4 secs, 461 ms, 714 ฮผs, and 7 hnsecs

dub -c botan -b release

JWT None:       63 ms, 50 ฮผs, and 8 hnsecs
JWT HS256:      255 ms and 901 ฮผs
JWT RS256:      12 minutes, 46 secs, 316 ms, 390 ฮผs, and 6 hnsecs
JWT ES256:      47 secs, 519 ms, 877 ฮผs, and 3 hnsecs

JWT None is not using openssl neither botan, so it's the same.
There is a huge difference (48x) with RS256.

I know that DMD is bad for any benchmarks, but unfortunatelly it does not build for me with any of:
GDC (Gentoo 4.8.4 p1.6, pie-0.6.1) 4.8.4
LDC - the LLVM D compiler (0.15.1) based on DMD v2.066.1 and LLVM 3.6.0

Failed to load path based dependency memutils: No package file found in ../memutils/, expected one of dub.json/dub.sdl/package.json

http://code.dlang.org/packages/botan.json
my dub.json contains:

  "dependencies": {
    "vibe-d": "~>0.7.30",
    "ggplotd": "~>1.1.3",
    "msgpack-d": "~>1.0.0-beta.6",
    "msgpack-rpc": "~>0.1.2",
    "dproto": "~>2.1.1",
    "dcv": {"path": "/home/timothee/git_clone/D/dcv", "version": "~master",},
    "dub": "~>1.3.0",
    "mir": "~>1.1.0",
  },

dub build shows:

Sub package botan:passhash doesn't exist in botan ~fix-tls.
Invalid package in dependency tree: botan:passhash ~fix-tls
Failed to load path based dependency memutils: No package file found in ../memutils/, expected one of dub.json/dub.sdl/package.json
Full error: object.Exception@source/dub/package_.d(159): No package file found in ../memutils/, expected one of dub.json/dub.sdl/package.json
----------------
??:? [0x49c25e]
??:? [0x49caac]
??:? [0x45b056]
??:? [0x452d7a]
??:? [0x44d07c]
??:? [0x44c411]
??:? [0x44009e]
??:? [0x44033a]
??:? [0x44033a]
??:? [0x44033a]
??:? [0x44033a]
??:? [0x43f82c]
??:? [0x44b9f8]
??:? [0x445f4c]
??:? [0x40a755]
??:? [0x40b11a]
??:? [0x40b855]
??:? [0x407ed5]
??:? [0x404593]
??:? [0x5a919e]
??:? [0x5a90e8]
??:? [0x5a915a]
??:? [0x5a90e8]
??:? [0x5a9066]
??:? [0x406de9]
??:? __libc_start_main [0x4551c82f]
Search for versions of libevent (1 package suppliers)
Downloading metadata for libevent
Getting from http://code.dlang.org/packages/libevent.json

looking at http://code.dlang.org/packages/botan.json it contains:

["Locking_Allocator","SHA2_32","SHA2_64","MD4","MD5","SHA1","CRC24"]}],"workingDirectory":"build","commitID":"7110ce2142003165ae0b0642261c45ab807a6b6b","buildOptions":["inline"],"name":"botan","version":"1.11.10","targetType":"staticLibrary","license":"2-BSD","readmeFile":"/README.md","date":"2015-02-17T19:08:12Z","targetName":"botan","description":"A D library for crypto and TLS","libs":["dl"],"targetPath":"build","dependencies":{"memutils":{"path":"../memutils","version":">=0.0.0"}},"versions":["Have_botan"]},

which has a "path"; which I believe causes the above error; this seems wrong for a published package ?

found 'pure' when expecting '{'

Attempting to compile my project using dub, and I am getting the following compile errors. I tried creating a new project as well to see if there was a conflict, the error below was from this new project with nothing but botan in the dependencies and no other code written:

Running pre-generate commands for botan...
Notice: Botan uses many symbols. Look into switching from ld (bfd) to ld (Gold) linker to reduce link times from >15s to <2s
Building memutils 0.4.1 configuration "secure", build type debug.
Running dmd...
Enhanced memory security is enabled.
Building botan 1.12.0 configuration "full", build type debug.
Running dmd...
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1769): Error: found 'pure' when expecting '{'
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1771): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1772): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1773): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1774): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1775): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1776): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1777): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1778): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1779): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1780): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1784): Error: found 'else' instead of statement
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1812): Error: found 'pure' when expecting '{'
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1813): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1814): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1815): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1816): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1817): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1818): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1819): Error: mismatched number of curly brackets
../../../../../../shananra/.dub/packages/botan-1.12.0/source/botan/math/mp/mp_core.d(1820): Error: mismatched number of curly brackets
FAIL ../../../../../../shananra/.dub/packages/botan-1.12.0/.dub/build/full-debug-linux.posix-x86_64-dmd_2066-EBCDE32E6948503DC31BAE384BD48A40/ botan staticLibrary
Error executing command run: dmd failed with exit code 1.

The above was an attempt to build with "dub test --arch=x86_64"

Crash in src/engine/gnump/gmp_mem.cpp

Hi, I was trying to investigate a crash in LibKTorrent (https://cgit.kde.org/libktorrent.git/) and somehow it points to Botan. Although, the crash looks very strange, so maybe it is not Botan's fault... Any ideas?

Just before the crash I get the message
terminate called after throwing an instance of 'Botan::Invalid_State'
what(): Pointer released to the wrong allocator

Backtrace:

Using host libthread_db library "/lib64/libthread_db.so.1".
[KCrash Handler]
#6 0x00007fec2b50b278 in raise () from /lib64/libc.so.6
#7 0x00007fec2b50c69a in abort () from /lib64/libc.so.6
#8 0x00007fec2be3b19d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libstdc++.so.6
#9 0x00007fec2be38f26 in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libstdc++.so.6
#10 0x00007fec2be37e79 in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libstdc++.so.6
#11 0x00007fec2be3885d in __gxx_personality_v0 () from /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libstdc++.so.6
#12 0x00007fec2b885b13 in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libgcc_s.so.1
#13 0x00007fec2b886009 in _Unwind_Resume () from /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libgcc_s.so.1
#14 0x00007fec09a7716c in Botan::Pooling_Allocator::deallocate (this=0x7fec00004480, ptr=0x1c1e8f0, n=104) at src/alloc/mem_pool/mem_pool.cpp:175
#15 0x00007fec09b10431 in Botan::(anonymous namespace)::gmp_free (ptr=0x1c1e8f0, n=104) at src/engine/gnump/gmp_mem.cpp:46
#16 0x00007fec2f8436c4 in mse::BigInt::~BigInt() () from /home/andrius/repositories/kde/libktorrent/build/src/libKF5Torrent.so.6
#17 0x00007fec2b50df07 in __cxa_finalize () from /lib64/libc.so.6
#18 0x00007fec2f80ca73 in ?? () from /home/andrius/repositories/kde/libktorrent/build/src/libKF5Torrent.so.6
#19 0x00007ffe10fadba0 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Error compiling on Ubuntu 14.04, x86

I get warning:

Running pre-generate commands for botan:base...
Notice: Botan uses many symbols. Look into switching from ld (bfd) to ld (Gold) linker to reduce link times from >15s to <2s
Performing "debug" build using dmd for x86.
botan-math 1.0.3: target for configuration "regular" is up to date.

and finally exit with error:

Enhanced memory security is enabled.
Memory debugger enabled
../../../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/stream/botan.d(775,16): Error: undefined identifier 'BigInt'
dmd failed with exit code 1.

How to use blowfish?

I've been trying to go through the docs, but I'm still at a complete loss: If I want to create blowfish hashes, paramaterized by complexity (as is a large part of the point of blowfish, vs say SHA2), then...how do I do that in botan?

Feature request: Add support for X.509 extensions without editing the source code of the library

I use Botan to load iOS development certificates, however, those X.509 certificates have another extension "1.2.840.113635.100.6.1.2", and that prevents Botan from loading them (it is marked as critical, "Encountered unknown X.509 extension marked as critical"). I will probably fork the library in the meantime to ignore this field (and maybe add proper support if needed), but I would be interested to stay up-to-date without relying on a fork.

broken dmd release build

Always end up in botan.tls.extensions.SupportedEllipticCurves.nameToCurveId w/ no arguments and a broken stack trace. I'd guess because of some memory corruption.

#0  botan.tls.extensions.SupportedEllipticCurves.nameToCurveId(const(immutable(char)[])) (name=...)
    at ../../../../.dub/packages/botan-1.12.7/botan/source/botan/tls/extensions.d:791
#1  0x0000000000000000 in ?? ()

import botan.* causes crash DMD

/+ dub.json:
{
  "name": "crypto",
  "targetType_": "library",
  "dependencies": {
    "botan": "~>1.12.9"
  }
}
+/

void main()
{
  // Enabling any of this imports causes DMD fail:
  import botan.passhash.bcrypt;
  import botan.rng.rng;
  import botan.rng.auto_rng;
}
$ dub run --single crypto.d
Running pre-generate commands for botan...
Notice: Botan uses many symbols. Look into switching from ld (bfd) to ld (Gold) linker to reduce link times from >15s to <2s
Performing "debug" build using /usr/bin/dmd for x86_64.
botan-math 1.0.3: target for configuration "regular" is up to date.
memutils 0.4.10: target for configuration "secure" is up to date.
botan 1.12.9: target for configuration "full" is up to date.
crypto ~master: building configuration "application"...
/home/denizzz/.dub/packages/memutils-0.4.10/memutils/source/memutils/refcounted.d(54,2): Deprecation: const postblit is deprecated. Please use an unqualified postblit.
Enhanced memory security is enabled.
Memory debugger enabled
Segmentation fault (core dumped)
/usr/bin/dmd failed with exit code 139.

Tested on DMD 2.079 and 2.080

Build errors with DMD 2.100

The errors for some reason are not present when building the botan itself, but I see them when I try to build a project using it.

Fedora 36 + DMD 2.100.

The project calls the following pieces:

  • RandomNumberGenerator.makeRng
  • generatePasshash9
  • checkPasshash9
../../botan/source/botan/tls/channel.d(574,13): Error: `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply` called with argument types `(int delegate(ref const(ushort) k, ref const(ConnectionCipherState) v) @system)` matches both:
../../memutils/source/memutils/hashmap.d(153,6):     `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply(int delegate(ref const(ushort), ref ConnectionCipherState) del)`
and:
../../memutils/source/memutils/hashmap.d(162,6):     `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply(int delegate(in ref ushort, in ref ConnectionCipherState) del) const`
../../botan/source/botan/tls/channel.d(580,13): Error: `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply` called with argument types `(int delegate(ref const(ushort) k, ref const(ConnectionCipherState) v) @system)` matches both:
../../memutils/source/memutils/hashmap.d(153,6):     `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply(int delegate(ref const(ushort), ref ConnectionCipherState) del)`
and:
../../memutils/source/memutils/hashmap.d(162,6):     `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply(int delegate(in ref ushort, in ref ConnectionCipherState) del) const`
../../botan/source/botan/tls/channel.d(839,9): Error: `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply` called with argument types `(int delegate(ref const(ushort) k, ref const(ConnectionCipherState) v) nothrow @system)` matches both:
../../memutils/source/memutils/hashmap.d(153,6):     `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply(int delegate(ref const(ushort), ref ConnectionCipherState) del)`
and:
../../memutils/source/memutils/hashmap.d(162,6):     `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply(int delegate(in ref ushort, in ref ConnectionCipherState) del) const`
../../botan/source/botan/tls/channel.d(844,9): Error: `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply` called with argument types `(int delegate(ref const(ushort) k, ref const(ConnectionCipherState) v) nothrow @system)` matches both:
../../memutils/source/memutils/hashmap.d(153,6):     `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply(int delegate(ref const(ushort), ref ConnectionCipherState) del)`
and:
../../memutils/source/memutils/hashmap.d(162,6):     `memutils.hashmap.HashMap!(ushort, ConnectionCipherState, ThreadMem).HashMap.opApply(int delegate(in ref ushort, in ref ConnectionCipherState) del) const`

Yes, I have cloned memutils โ€“ the latest tag won't build with the latest DMD, but the master will.

Error decompressing zlib data in a Pipe

Using new TransformationFilter(new ZlibDecompression) in a Pipe and using processMsg to write the zlib-compressed data to the pipe fails with "zlib deflate error: -5". I'm guessing this is due to TransformationFilter splitting it up?

As a workaround I'm pre-processing with std.zlib.uncompress(), but I was wondering if this can be done with TransformationFilter somehow.

Additionally, I was wondering why there are no Zlib filters? The wiki and API reference seem to have them.

Botan fails to build with x86-ldc

Build fails in ldc x86 environment. dub build -a=x86 --compiler=ldc2 (on Windows and Linux both)
https://github.com/shoo/Cookbook/runs/1986323878?check_suite_focus=true#step:5:129

 ../../../.dub/packages/botan-15ff68b93eb60a9291c98e066fb1a94af66509d4/botan/source/botan/entropy/rdrand.d(72,23): Error: unknown opcode `rdrand`

I saw @etcimon discussing this in the ldc development project:
ldc-developers/ldc#3299
I'm interested in the results.

In addition to this, there are other errors in

string LOAD_AND_SBOX(alias SBOX)(ubyte MSG) {

source\botan\block\serp_x86_32.d(235,5): Error: Statement not allowed in naked function

Error Compiling on intel MacOS 11.6

I've tried to compile my program which utilises the botan library, but I'm getting an error in linking:

ld: in ../../.dub/packages/botan-1.13.4/botan/.dub/build/full-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-546FB64FC7DE8C501100DC4B35E7C7EF/libbotan.a(unique_2fcf_3b6.o), in section __TEXT,__textcoal_nt reloc 0: symbol index out of range
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1

The full output from dub build -v is shown below:

andrew.lalis@C02GG1DPMD6T scrambler % dub build -v
Using dub registry url 'https://code.dlang.org/'
Refreshing local packages (refresh existing: true)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/andrew.lalis/.dub/packages/local-packages.json
Looking for local package map at /Users/andrew.lalis/andrewlalis-github/scrambler/.dub/packages/local-packages.json
Determined package version using GIT: scrambler ~main
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/andrew.lalis/.dub/packages/local-packages.json
Looking for local package map at /Users/andrew.lalis/andrewlalis-github/scrambler/.dub/packages/local-packages.json
  Found dependency botan 1.13.4
    Found dependency botan-math 1.0.4
    Found dependency memutils 1.0.9
    Version selection for dependency openssl (openssl) of botan is missing.
    Missing dependency openssl ~>1.1.7 (optional) of botan
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/andrew.lalis/.dub/packages/local-packages.json
Looking for local package map at /Users/andrew.lalis/andrewlalis-github/scrambler/.dub/packages/local-packages.json
  Found dependency botan 1.13.4
    Found dependency botan-math 1.0.4
    Found dependency memutils 1.0.9
    Version selection for dependency openssl (openssl) of botan is missing.
    Missing dependency openssl ~>1.1.7 (optional) of botan
Generating using build
Configuring dependent scrambler, deps:"botan"
  Configuring dependent botan, deps:"botan-math", "memutils"
    Configuring dependent botan-math, deps:
    Configuring dependent memutils, deps:
Performing "debug" build using /Library/D/dmd/bin/dmd for x86_64.
botan-math 1.0.4: target for configuration "library" is up to date.
Using existing build in /Users/andrew.lalis/.dub/packages/botan-math-1.0.4/botan-math/.dub/build/library-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-FABAC836F029A06F331C0D49ECDCFF92/.
Copying target from /Users/andrew.lalis/.dub/packages/botan-math-1.0.4/botan-math/.dub/build/library-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-FABAC836F029A06F331C0D49ECDCFF92/libbotan_math.a to /Users/andrew.lalis/.dub/packages/botan-math-1.0.4/botan-math/build
memutils 1.0.9: target for configuration "secure" is up to date.
Using existing build in /Users/andrew.lalis/.dub/packages/memutils-1.0.9/memutils/.dub/build/secure-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-9570F4075D74A1216698E417EC8AAAE4/.
Copying target from /Users/andrew.lalis/.dub/packages/memutils-1.0.9/memutils/.dub/build/secure-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-9570F4075D74A1216698E417EC8AAAE4/libmemutils.a to /Users/andrew.lalis/.dub/packages/memutils-1.0.9/memutils
botan 1.13.4: target for configuration "full" is up to date.
Using existing build in /Users/andrew.lalis/.dub/packages/botan-1.13.4/botan/.dub/build/full-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-546FB64FC7DE8C501100DC4B35E7C7EF/.
Copying target from /Users/andrew.lalis/.dub/packages/botan-1.13.4/botan/.dub/build/full-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-546FB64FC7DE8C501100DC4B35E7C7EF/libbotan.a to /Users/andrew.lalis/.dub/packages/botan-1.13.4/botan/build
Target '/Users/andrew.lalis/andrewlalis-github/scrambler/.dub/build/application-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-F7556BC6214436E82C98CF93F8BD91C2/scrambler' doesn't exist, need rebuild.
scrambler ~main: building configuration "application"...
pkg-config failed: Executable file not found: pkg-config
Falling back to direct -l... flags.
/Library/D/dmd/bin/dmd -c -of.dub/build/application-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-F7556BC6214436E82C98CF93F8BD91C2/scrambler.o -debug -g -w -version=Have_scrambler -version=Have_botan -version=Botan -version=CanTest -version=SHA2_32 -version=SHA2_64 -version=MD4 -version=MD5 -version=SHA1 -version=CRC24 -version=PBKDF1 -version=PBKDF2 -version=CTR_BE -version=HMAC -version=POLY1305 -version=EMSA1 -version=EMSA1_BSI -version=EMSA_X931 -version=EMSA_PKCS1 -version=EMSA_PSSR -version=EMSA_RAW -version=EME_OAEP -version=EME_PKCS1v15 -version=PBE_PKCSv20 -version=Self_Tests -version=ECB -version=CBC -version=XTS -version=OFB -version=CFB -version=AEAD_FILTER -version=AEAD_CCM -version=AEAD_EAX -version=AEAD_OCB -version=AEAD_GCM -version=AEAD_SIV -version=AEAD_CHACHA20_POLY1305 -version=RFC6979 -version=RSA -version=RW -version=DLIES -version=DSA -version=ECDSA -version=ElGamal -version=GOST_3410 -version=Curve25519 -version=Nyberg_Rueppel -version=Diffie_Hellman -version=ECDH -version=AES -version=Blowfish -version=Camellia -version=CAST -version=Cascade -version=DES -version=GOST_28147 -version=IDEA -version=KASUMI -version=LION -version=MARS -version=MISTY1 -version=NOEKEON -version=RC2 -version=RC5 -version=RC6 -version=SAFER -version=SEED -version=Serpent -version=TEA -version=Twofish -version=Threefish -version=XTEA -version=Adler32 -version=CRC32 -version=GOST_3411 -version=HAS_160 -version=Keccak -version=MD2 -version=RIPEMD_128 -version=RIPEMD_160 -version=Skein_512 -version=Tiger -version=Whirlpool -version=ParallelHash -version=Comb4P -version=CBC_MAC -version=CMAC -version=SSL3_MAC -version=ANSI_X919_MAC -version=RC4 -version=ChaCha -version=Salsa20 -version=Serpent_SIMD -version=SIMD_Scalar -version=Noekeon_SIMD -version=XTEA_SIMD -version=Engine_AES_ISA -version=Entropy_DevRand -version=Entropy_EGD -version=Entropy_UnixProc -version=Entropy_Win32 -version=Entropy_ProcWalk -version=X931_RNG -version=HMAC_DRBG -version=KDF1 -version=KDF2 -version=SSL_V3_PRF -version=TLS_V10_PRF -version=TLS_V12_PRF -version=X942_PRF -version=TLS -version=X509 -version=PUBKEY -version=FPE_FE1 -version=RFC3394 -version=PassHash9 -version=BCrypt -version=SRP6 -version=TSS -version=CryptoBox -version=CryptoBox_PSK -version=Engine_ASM -version=Entropy_Rdrand -version=Entropy_HRTimer -version=SHA1_x86_64 -version=AES_NI -version=SIMD_SSE2 -version=AES_SSSE3 -version=IDEA_SSE2 -version=SHA1_SSE2 -version=Engine_SIMD -version=ZLib -version=Have_botan_math -version=Have_memutils -version=CryptoSafe -Isource/ -I../../.dub/packages/botan-1.13.4/botan/source/ -I../../.dub/packages/botan-math-1.0.4/botan-math/source/ -I../../.dub/packages/memutils-1.0.9/memutils/source/ source/app.d source/cipher_utils.d source/cli_utils.d -vcolumns
Enhanced memory security is enabled.
Memory debugger enabled
Linking...
/Library/D/dmd/bin/dmd -of.dub/build/application-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-F7556BC6214436E82C98CF93F8BD91C2/scrambler .dub/build/application-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-F7556BC6214436E82C98CF93F8BD91C2/scrambler.o ../../.dub/packages/botan-1.13.4/botan/.dub/build/full-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-546FB64FC7DE8C501100DC4B35E7C7EF/libbotan.a ../../.dub/packages/botan-math-1.0.4/botan-math/.dub/build/library-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-FABAC836F029A06F331C0D49ECDCFF92/libbotan_math.a ../../.dub/packages/memutils-1.0.9/memutils/.dub/build/secure-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-9570F4075D74A1216698E417EC8AAAE4/libmemutils.a -L-ldl -g
ld: in ../../.dub/packages/botan-1.13.4/botan/.dub/build/full-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-546FB64FC7DE8C501100DC4B35E7C7EF/libbotan.a(unique_2fcf_3b6.o), in section __TEXT,__textcoal_nt reloc 0: symbol index out of range
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
FAIL .dub/build/application-debug-posix.osx.darwin-x86_64-dmd_v2.100.2-F7556BC6214436E82C98CF93F8BD91C2/ scrambler executable
uncaught exception
dub.compilers.compiler.CompilerInvocationException@source/dub/compilers/compiler.d(145): /Library/D/dmd/bin/dmd failed with exit code 1.
----------------
??:? void dub.compilers.compiler.Compiler.invokeTool(immutable(char)[][], void delegate(int, immutable(char)[]), immutable(char)[][immutable(char)[]]) [0x10c785a80]
??:? void dub.compilers.dmd.DMDCompiler.invokeLinker(in dub.compilers.buildsettings.BuildSettings, in dub.platform.BuildPlatform, immutable(char)[][], void delegate(int, immutable(char)[])) [0x10c78f1f4]
??:? void dub.generators.build.BuildGenerator.buildWithCompiler(dub.generators.generator.GeneratorSettings, dub.compilers.buildsettings.BuildSettings) [0x10c7796ba]
??:? bool dub.generators.build.BuildGenerator.performCachedBuild(dub.generators.generator.GeneratorSettings, dub.compilers.buildsettings.BuildSettings, in dub.package_.Package, immutable(char)[], immutable(char)[], in dub.package_.Package[], in dub.internal.vibecompat.inet.path.NativePath[], out dub.internal.vibecompat.inet.path.NativePath) [0x10c7779e3]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.