aboutsummaryrefslogtreecommitdiff
path: root/captain/crypt.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2023-09-20 08:49:58 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2023-09-20 08:49:58 -0400
commit8217283bed26f052ea0d29afec18b224d63d4fb2 (patch)
tree5e112f6952d6e40ffa5a4e0f8961249f1737ee75 /captain/crypt.f90
parent10547ba1064ca5a1dd04e782b0df99a22b60de3f (diff)
downloadlevitating-8217283bed26f052ea0d29afec18b224d63d4fb2.tar.gz
levitating-8217283bed26f052ea0d29afec18b224d63d4fb2.zip
Transfer buffers for gemini file transfers extended from 64 bytes to 4K to fix client download issues. Minor fixes to the crypt routines to use c_char arrays rather than strings.
Diffstat (limited to 'captain/crypt.f90')
-rw-r--r--captain/crypt.f909
1 files changed, 6 insertions, 3 deletions
diff --git a/captain/crypt.f90 b/captain/crypt.f90
index c14d4bb..c19efdc 100644
--- a/captain/crypt.f90
+++ b/captain/crypt.f90
@@ -28,7 +28,7 @@ contains
character(len=*), intent(in)::phrase
character(len=:), pointer::hash
- character(len=:,kind=c_char), pointer::c_phrase
+ character(kind=c_char), dimension(:), pointer::c_phrase
type(c_ptr)::c_res_ptr, c_salt_ptr
character(kind=c_char), dimension(:), pointer::c_res
character(len=5, kind=c_char), target::prefix
@@ -48,8 +48,11 @@ contains
prefix = "$2b$"//c_null_char
c_salt_ptr = crypt_gensalt_c(c_loc(prefix), int(16,kind=c_long), c_null_ptr, 0)
- allocate(character(len=len_trim(phrase)+1) :: c_phrase)
- c_phrase = trim(phrase)//c_null_char
+ allocate(c_phrase(len_trim(phrase)+1))
+ do i = 1,len_trim(phrase)
+ c_phrase(i) = phrase(i:i)
+ end do
+ c_phrase(len_trim(phrase)+1) = c_null_char
c_res_ptr = crypt_c(c_loc(c_phrase), c_salt_ptr)
if(c_associated(c_res_ptr)) then