module Botan.Low.SRP6
(
SRP6ServerSession(..)
, withSRP6ServerSession
, srp6ServerSessionInit
, srp6ServerSessionDestroy
, srp6ServerSessionStep1
, srp6ServerSessionStep2
, srp6GenerateVerifier
, srp6ClientAgree
, srp6GroupSize
, SRP6Verifier(..)
, SRP6BValue(..)
, SRP6AValue(..)
, SRP6SharedSecret(..)
, pattern MODP_SRP_1024
, pattern MODP_SRP_1536
, pattern MODP_SRP_2048
, pattern MODP_SRP_3072
, pattern MODP_SRP_4096
, pattern MODP_SRP_6144
, pattern MODP_SRP_8192
) where
import qualified Data.ByteString as ByteString
import Botan.Bindings.SRP6
import Botan.Low.Error
import Botan.Low.Hash
import Botan.Low.Make
import Botan.Low.Prelude
import Botan.Low.Remake
import Botan.Low.RNG
import Botan.Low.PubKey
type Identifier = ByteString
type Password = ByteString
type Salt = ByteString
type SRP6Verifier = ByteString
type SRP6BValue = ByteString
type SRP6AValue = ByteString
type SRP6SharedSecret = ByteString
newtype SRP6ServerSession = MkSRP6ServerSession { SRP6ServerSession -> ForeignPtr BotanSRP6ServerSessionStruct
getSRP6ServerSessionForeignPtr :: ForeignPtr BotanSRP6ServerSessionStruct }
newSRP6ServerSession :: BotanSRP6ServerSession -> IO SRP6ServerSession
withSRP6ServerSession :: SRP6ServerSession -> (BotanSRP6ServerSession -> IO a) -> IO a
srp6ServerSessionDestroy :: SRP6ServerSession -> IO ()
createSRP6ServerSession :: (Ptr BotanSRP6ServerSession -> IO CInt) -> IO SRP6ServerSession
(BotanSRP6ServerSession -> IO SRP6ServerSession
newSRP6ServerSession, SRP6ServerSession -> (BotanSRP6ServerSession -> IO a) -> IO a
withSRP6ServerSession, SRP6ServerSession -> IO ()
srp6ServerSessionDestroy, (Ptr BotanSRP6ServerSession -> IO CInt) -> IO SRP6ServerSession
createSRP6ServerSession, (Ptr BotanSRP6ServerSession -> Ptr CSize -> IO CInt)
-> IO [SRP6ServerSession]
_)
= (Ptr BotanSRP6ServerSessionStruct -> BotanSRP6ServerSession)
-> (BotanSRP6ServerSession -> Ptr BotanSRP6ServerSessionStruct)
-> (ForeignPtr BotanSRP6ServerSessionStruct -> SRP6ServerSession)
-> (SRP6ServerSession -> ForeignPtr BotanSRP6ServerSessionStruct)
-> FinalizerPtr BotanSRP6ServerSessionStruct
-> (BotanSRP6ServerSession -> IO SRP6ServerSession,
SRP6ServerSession -> (BotanSRP6ServerSession -> IO a) -> IO a,
SRP6ServerSession -> IO (),
(Ptr BotanSRP6ServerSession -> IO CInt) -> IO SRP6ServerSession,
(Ptr BotanSRP6ServerSession -> Ptr CSize -> IO CInt)
-> IO [SRP6ServerSession])
forall botan struct object a.
Storable botan =>
(Ptr struct -> botan)
-> (botan -> Ptr struct)
-> (ForeignPtr struct -> object)
-> (object -> ForeignPtr struct)
-> FinalizerPtr struct
-> (botan -> IO object, object -> (botan -> IO a) -> IO a,
object -> IO (), (Ptr botan -> IO CInt) -> IO object,
(Ptr botan -> Ptr CSize -> IO CInt) -> IO [object])
mkBindings
Ptr BotanSRP6ServerSessionStruct -> BotanSRP6ServerSession
MkBotanSRP6ServerSession BotanSRP6ServerSession -> Ptr BotanSRP6ServerSessionStruct
runBotanSRP6ServerSession
ForeignPtr BotanSRP6ServerSessionStruct -> SRP6ServerSession
MkSRP6ServerSession SRP6ServerSession -> ForeignPtr BotanSRP6ServerSessionStruct
getSRP6ServerSessionForeignPtr
FinalizerPtr BotanSRP6ServerSessionStruct
botan_srp6_server_session_destroy
srp6ServerSessionInit
:: IO SRP6ServerSession
srp6ServerSessionInit :: IO SRP6ServerSession
srp6ServerSessionInit = (Ptr BotanSRP6ServerSession -> IO CInt) -> IO SRP6ServerSession
createSRP6ServerSession Ptr BotanSRP6ServerSession -> IO CInt
botan_srp6_server_session_init
withSRP6ServerSessionInit :: (SRP6ServerSession -> IO a) -> IO a
withSRP6ServerSessionInit :: forall a. (SRP6ServerSession -> IO a) -> IO a
withSRP6ServerSessionInit = IO SRP6ServerSession
-> (SRP6ServerSession -> IO ())
-> (SRP6ServerSession -> IO a)
-> IO a
forall t a. IO t -> (t -> IO ()) -> (t -> IO a) -> IO a
mkWithTemp IO SRP6ServerSession
srp6ServerSessionInit SRP6ServerSession -> IO ()
srp6ServerSessionDestroy
srp6ServerSessionStep1
:: SRP6ServerSession
-> SRP6Verifier
-> DLGroupName
-> HashName
-> RNG
-> IO SRP6BValue
srp6ServerSessionStep1 :: SRP6ServerSession
-> SRP6Verifier
-> SRP6Verifier
-> SRP6Verifier
-> RNG
-> IO SRP6Verifier
srp6ServerSessionStep1 SRP6ServerSession
srp6 SRP6Verifier
verifier SRP6Verifier
groupId SRP6Verifier
hashId RNG
rng = SRP6ServerSession
-> (BotanSRP6ServerSession -> IO SRP6Verifier) -> IO SRP6Verifier
forall a.
SRP6ServerSession -> (BotanSRP6ServerSession -> IO a) -> IO a
withSRP6ServerSession SRP6ServerSession
srp6 ((BotanSRP6ServerSession -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (BotanSRP6ServerSession -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ BotanSRP6ServerSession
srp6Ptr -> do
SRP6Verifier
-> (Ptr Word8 -> CSize -> IO SRP6Verifier) -> IO SRP6Verifier
forall byte a. SRP6Verifier -> (Ptr byte -> CSize -> IO a) -> IO a
asBytesLen SRP6Verifier
verifier ((Ptr Word8 -> CSize -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (Ptr Word8 -> CSize -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr Word8
verifierPtr CSize
verifierLen -> do
SRP6Verifier -> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
groupId ((Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
groupIdPtr -> do
SRP6Verifier -> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
hashId ((Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
hashIdPtr -> do
RNG -> (BotanRNG -> IO SRP6Verifier) -> IO SRP6Verifier
forall a. RNG -> (BotanRNG -> IO a) -> IO a
withRNG RNG
rng ((BotanRNG -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (BotanRNG -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ BotanRNG
botanRNG -> do
(Ptr Word8 -> Ptr CSize -> IO CInt) -> IO SRP6Verifier
forall byte. (Ptr byte -> Ptr CSize -> IO CInt) -> IO SRP6Verifier
allocBytesQuerying ((Ptr Word8 -> Ptr CSize -> IO CInt) -> IO SRP6Verifier)
-> (Ptr Word8 -> Ptr CSize -> IO CInt) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr Word8
outPtr Ptr CSize
outLen -> BotanSRP6ServerSession
-> ConstPtr Word8
-> CSize
-> ConstPtr CChar
-> ConstPtr CChar
-> BotanRNG
-> Ptr Word8
-> Ptr CSize
-> IO CInt
botan_srp6_server_session_step1
BotanSRP6ServerSession
srp6Ptr
(Ptr Word8 -> ConstPtr Word8
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr Word8
verifierPtr)
CSize
verifierLen
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
groupIdPtr)
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
hashIdPtr)
BotanRNG
botanRNG
Ptr Word8
outPtr
Ptr CSize
outLen
srp6ServerSessionStep2
:: SRP6ServerSession
-> SRP6AValue
-> IO SRP6SharedSecret
srp6ServerSessionStep2 :: SRP6ServerSession -> SRP6Verifier -> IO SRP6Verifier
srp6ServerSessionStep2 SRP6ServerSession
srp6 SRP6Verifier
a = SRP6ServerSession
-> (BotanSRP6ServerSession -> IO SRP6Verifier) -> IO SRP6Verifier
forall a.
SRP6ServerSession -> (BotanSRP6ServerSession -> IO a) -> IO a
withSRP6ServerSession SRP6ServerSession
srp6 ((BotanSRP6ServerSession -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (BotanSRP6ServerSession -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ BotanSRP6ServerSession
srp6Ptr -> do
SRP6Verifier
-> (Ptr Word8 -> CSize -> IO SRP6Verifier) -> IO SRP6Verifier
forall byte a. SRP6Verifier -> (Ptr byte -> CSize -> IO a) -> IO a
asBytesLen SRP6Verifier
a ((Ptr Word8 -> CSize -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (Ptr Word8 -> CSize -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr Word8
aPtr CSize
aLen -> do
(Ptr Word8 -> Ptr CSize -> IO CInt) -> IO SRP6Verifier
forall byte. (Ptr byte -> Ptr CSize -> IO CInt) -> IO SRP6Verifier
allocBytesQuerying ((Ptr Word8 -> Ptr CSize -> IO CInt) -> IO SRP6Verifier)
-> (Ptr Word8 -> Ptr CSize -> IO CInt) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr Word8
outPtr Ptr CSize
outLen -> BotanSRP6ServerSession
-> ConstPtr Word8 -> CSize -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_srp6_server_session_step2
BotanSRP6ServerSession
srp6Ptr
(Ptr Word8 -> ConstPtr Word8
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr Word8
aPtr)
CSize
aLen
Ptr Word8
outPtr
Ptr CSize
outLen
srp6GenerateVerifier
:: Identifier
-> Password
-> Salt
-> DLGroupName
-> HashName
-> IO SRP6Verifier
srp6GenerateVerifier :: SRP6Verifier
-> SRP6Verifier
-> SRP6Verifier
-> SRP6Verifier
-> SRP6Verifier
-> IO SRP6Verifier
srp6GenerateVerifier SRP6Verifier
identifier SRP6Verifier
password SRP6Verifier
salt SRP6Verifier
groupId SRP6Verifier
hashId = SRP6Verifier -> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
identifier ((Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
identifierPtr -> do
SRP6Verifier -> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
password ((Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
passwordPtr -> do
SRP6Verifier
-> (Ptr Word8 -> CSize -> IO SRP6Verifier) -> IO SRP6Verifier
forall byte a. SRP6Verifier -> (Ptr byte -> CSize -> IO a) -> IO a
asBytesLen SRP6Verifier
salt ((Ptr Word8 -> CSize -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (Ptr Word8 -> CSize -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr Word8
saltPtr CSize
saltLen -> do
SRP6Verifier -> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
groupId ((Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
groupIdPtr -> do
SRP6Verifier -> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
hashId ((Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier)
-> (Ptr CChar -> IO SRP6Verifier) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
hashIdPtr -> do
(Ptr Word8 -> Ptr CSize -> IO CInt) -> IO SRP6Verifier
forall byte. (Ptr byte -> Ptr CSize -> IO CInt) -> IO SRP6Verifier
allocBytesQuerying ((Ptr Word8 -> Ptr CSize -> IO CInt) -> IO SRP6Verifier)
-> (Ptr Word8 -> Ptr CSize -> IO CInt) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr Word8
outPtr Ptr CSize
outLen -> ConstPtr CChar
-> ConstPtr CChar
-> ConstPtr Word8
-> CSize
-> ConstPtr CChar
-> ConstPtr CChar
-> Ptr Word8
-> Ptr CSize
-> IO CInt
botan_srp6_generate_verifier
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
identifierPtr)
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
passwordPtr)
(Ptr Word8 -> ConstPtr Word8
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr Word8
saltPtr)
CSize
saltLen
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
groupIdPtr)
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
hashIdPtr)
Ptr Word8
outPtr
Ptr CSize
outLen
srp6ClientAgree
:: Identifier
-> Password
-> DLGroupName
-> HashName
-> Salt
-> SRP6BValue
-> RNG
-> IO (SRP6AValue, SRP6SharedSecret)
srp6ClientAgree :: SRP6Verifier
-> SRP6Verifier
-> SRP6Verifier
-> SRP6Verifier
-> SRP6Verifier
-> SRP6Verifier
-> RNG
-> IO (SRP6Verifier, SRP6Verifier)
srp6ClientAgree SRP6Verifier
identifier SRP6Verifier
password SRP6Verifier
groupId SRP6Verifier
hashId SRP6Verifier
salt SRP6Verifier
b RNG
rng = do
SRP6Verifier
-> (Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
identifier ((Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier))
-> (Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
identifierPtr -> do
SRP6Verifier
-> (Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
password ((Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier))
-> (Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
passwordPtr -> do
SRP6Verifier
-> (Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
groupId ((Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier))
-> (Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
groupIdPtr -> do
SRP6Verifier
-> (Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
hashId ((Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier))
-> (Ptr CChar -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
hashIdPtr -> do
SRP6Verifier
-> (Ptr Word8 -> CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall byte a. SRP6Verifier -> (Ptr byte -> CSize -> IO a) -> IO a
asBytesLen SRP6Verifier
salt ((Ptr Word8 -> CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier))
-> (Ptr Word8 -> CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. (a -> b) -> a -> b
$ \ Ptr Word8
saltPtr CSize
saltLen -> do
SRP6Verifier
-> (Ptr Word8 -> CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall byte a. SRP6Verifier -> (Ptr byte -> CSize -> IO a) -> IO a
asBytesLen SRP6Verifier
b ((Ptr Word8 -> CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier))
-> (Ptr Word8 -> CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. (a -> b) -> a -> b
$ \ Ptr Word8
bPtr CSize
bLen -> do
RNG
-> (BotanRNG -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a. RNG -> (BotanRNG -> IO a) -> IO a
withRNG RNG
rng ((BotanRNG -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier))
-> (BotanRNG -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. (a -> b) -> a -> b
$ \ BotanRNG
botanRNG -> do
(Ptr CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier))
-> (Ptr CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. (a -> b) -> a -> b
$ \ Ptr CSize
aSzPtr -> do
(Ptr CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier))
-> (Ptr CSize -> IO (SRP6Verifier, SRP6Verifier))
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. (a -> b) -> a -> b
$ \ Ptr CSize
kSzPtr -> do
CInt
_ <- ConstPtr CChar
-> ConstPtr CChar
-> ConstPtr CChar
-> ConstPtr CChar
-> ConstPtr Word8
-> CSize
-> ConstPtr Word8
-> CSize
-> BotanRNG
-> Ptr Word8
-> Ptr CSize
-> Ptr Word8
-> Ptr CSize
-> IO CInt
botan_srp6_client_agree
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
identifierPtr)
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
passwordPtr)
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
groupIdPtr)
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
hashIdPtr)
(Ptr Word8 -> ConstPtr Word8
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr Word8
saltPtr)
CSize
saltLen
(Ptr Word8 -> ConstPtr Word8
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr Word8
bPtr)
CSize
bLen
BotanRNG
botanRNG
Ptr Word8
forall a. Ptr a
nullPtr
Ptr CSize
aSzPtr
Ptr Word8
forall a. Ptr a
nullPtr
Ptr CSize
kSzPtr
Int
kSz <- CSize -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> Int) -> IO CSize -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr CSize -> IO CSize
forall a. Storable a => Ptr a -> IO a
peek Ptr CSize
kSzPtr
Int
aSz <- CSize -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> Int) -> IO CSize -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr CSize -> IO CSize
forall a. Storable a => Ptr a -> IO a
peek Ptr CSize
aSzPtr
Int
-> (Ptr Word8 -> IO SRP6Verifier)
-> IO (SRP6Verifier, SRP6Verifier)
forall byte a. Int -> (Ptr byte -> IO a) -> IO (a, SRP6Verifier)
allocBytesWith Int
kSz ((Ptr Word8 -> IO SRP6Verifier) -> IO (SRP6Verifier, SRP6Verifier))
-> (Ptr Word8 -> IO SRP6Verifier)
-> IO (SRP6Verifier, SRP6Verifier)
forall a b. (a -> b) -> a -> b
$ \ Ptr Word8
kPtr -> do
Int -> (Ptr Word8 -> IO ()) -> IO SRP6Verifier
forall byte. Int -> (Ptr byte -> IO ()) -> IO SRP6Verifier
allocBytes Int
aSz ((Ptr Word8 -> IO ()) -> IO SRP6Verifier)
-> (Ptr Word8 -> IO ()) -> IO SRP6Verifier
forall a b. (a -> b) -> a -> b
$ \ Ptr Word8
aPtr -> do
HasCallStack => IO CInt -> IO ()
IO CInt -> IO ()
throwBotanIfNegative_ (IO CInt -> IO ()) -> IO CInt -> IO ()
forall a b. (a -> b) -> a -> b
$ ConstPtr CChar
-> ConstPtr CChar
-> ConstPtr CChar
-> ConstPtr CChar
-> ConstPtr Word8
-> CSize
-> ConstPtr Word8
-> CSize
-> BotanRNG
-> Ptr Word8
-> Ptr CSize
-> Ptr Word8
-> Ptr CSize
-> IO CInt
botan_srp6_client_agree
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
identifierPtr)
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
passwordPtr)
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
groupIdPtr)
(Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
hashIdPtr)
(Ptr Word8 -> ConstPtr Word8
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr Word8
saltPtr)
CSize
saltLen
(Ptr Word8 -> ConstPtr Word8
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr Word8
bPtr)
CSize
bLen
BotanRNG
botanRNG
Ptr Word8
aPtr
Ptr CSize
aSzPtr
Ptr Word8
kPtr
Ptr CSize
kSzPtr
srp6GroupSize
:: DLGroupName
-> IO Int
srp6GroupSize :: SRP6Verifier -> IO Int
srp6GroupSize SRP6Verifier
groupId = SRP6Verifier -> (Ptr CChar -> IO Int) -> IO Int
forall a. SRP6Verifier -> (Ptr CChar -> IO a) -> IO a
asCString SRP6Verifier
groupId ((Ptr CChar -> IO Int) -> IO Int)
-> (Ptr CChar -> IO Int) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
groupIdPtr -> do
(Ptr CSize -> IO Int) -> IO Int
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CSize -> IO Int) -> IO Int)
-> (Ptr CSize -> IO Int) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ Ptr CSize
szPtr -> do
HasCallStack => IO CInt -> IO ()
IO CInt -> IO ()
throwBotanIfNegative_ (IO CInt -> IO ()) -> IO CInt -> IO ()
forall a b. (a -> b) -> a -> b
$ ConstPtr CChar -> Ptr CSize -> IO CInt
botan_srp6_group_size (Ptr CChar -> ConstPtr CChar
forall a. Ptr a -> ConstPtr a
ConstPtr Ptr CChar
groupIdPtr) Ptr CSize
szPtr
CSize -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> Int) -> IO CSize -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr CSize -> IO CSize
forall a. Storable a => Ptr a -> IO a
peek Ptr CSize
szPtr