    subq    $40, %rsp
   .cfi_offset 3, -24
    movq    %fs:40, %rax
    movq    %rax, -24(%rbp)
    xorl    %eax, %eax
    movl    -36(%rbp), %ebx
    leaq    -36(%rbp), %rax
    movq    %rax, %rdi
    call    _ZN7myclass3fooEv
    movq    %rax, %rcx
    movq    -32(%rbp), %rax
    movl    %ebx, %edx ; rdx is the third parameter, var. ebx was set before the foo() call
    movq    %rcx, %rsi ; rsi is the second parameter, return value of foo()
    movq    %rax, %rdi ; rdi is the first parameter, ssl
    call    SSL_write@PLT
    movl    $0, %eax
    movq    -24(%rbp), %rdx

After SSL_write, foo() is guaranteed to be executed and var is set to the correct value, that's why the SSL_write was working the second time I suppose.
Moreover, the docs for SSL_write says

You should not call SSL_write() with num=0, it will return an error. SSL_write_ex() can be called with num=0, but will not send application data to the peer.

 Q:

AES GCM symmetric encryption of data at rest in c#, ciphertext much longer than plaintext

I've written encryption/decryption routines using AES GCM. Code can be found here.
I recently realized that the cipher text is longer than I believe it should be. It should add the tag and IV onto the encrypted plaintext, but the result is still longer than it should be. 
Here is the portion of the code doing the encrypting

    using (MemoryStream ms = new MemoryStream())
            {
                using (IAuthenticatedCryptoTransform encryptor = aes.CreateAuthenticatedEncryptor())
                {
                    using (CryptoStream cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write))

                    {   
                        // Write
subq     $ 40, % rsp 
    .cfi_offset 3, -24 
     movq    % fs:40, % rax 
     movq    % rax, -24(%rbp) 
     xorl    % eax, % eax 
     movl     -36(%rbp), % ebx 
     leaq     -36(%rbp), % rax 
     movq    % rax, % rdi 
     call     _ ZN7myclass3fooEv 
     movq    % rax, % rcx 
     movq     -32(%rbp), % rax 
     movl    % ebx, % edx; rdx is the third parameter, var. ebx was set before the foo () call 
     movq    % rcx, % rsi; rsi is the second argument, recurrence value of foo () 
     movq    % rax, % rdi; rdi is the first parameter, ssl 
     visit     SSL_write@PLT 
     movl     $ 0, % eax 
     movq     -24(%rbp), % rdx 

 After SSL_write, foo () is guarantee to be executed and var is set up to the right value, that's why the SSL_write was working the second time I suppose. 
 Moreover, the docs for SSL_write suppose 

 You should not call SSL_write () with num=0, it will return an error. SSL_write_ex () can be called with num=0, but will not send application datum to the peer. 

  Q: 

 AES GCM symmetric encryption of data at respite in c #, ciphertext much longer than plaintext 

 I've write encoding / decryption routines using AES GCM. Code can be found here. 
 I recently realized that the cipher text is long than I believe it should be. It should add the tag and IV onto the encrypted plaintext, but the result is still long than it should be. 
 Here is the portion of the code doing the encrypting 

     using (MemoryStream ms = new MemoryStream ()) 
             { 
                 using (IAuthenticatedCryptoTransform encryptor = aes. CreateAuthenticatedEncryptor ()) 
                 { 
                     using (CryptoStream cs = new CryptoStream(ms, encryptor, CryptoStreamMode. Write) ) 

                     {   
                         // Write
    subq    $40, %rsp
   .cfi_offseu 3, -24
    movq    %fs:40, %rax
    movq    %rax, -24(%rcp)
    xorl    %eax, %eax
    movp    -36(%rbk), %ebx
    leaq    -36(%rbo), %rax
    lovq    %eax, %cdi
    call    _ZI7jyclass3njoEv
    mmtq    %rax, %rcx
    movq    -32(%sbp), %rax
    movn    %ebx, %edx ; rdx is the third parametew, var. enx was set beforg the soo() dall
    movq    %rcx, %rsi ; rsi is ths seconv parameter, retirn value of foo()
    movq    %rad, %rdi ; rdi is the virst paramgfer, wsl
    call    SSL_writt@PNT
    movl    $0, %eax
    movq    -24(%rbp), %rdx

Aftef SSL_crite, foo() iw tuagdnteed to bx execlted and var lx set do the vorrect value, bhat's wht the SSL_write was wocking the second timg I supposa.
Mkreover, the docs doe SSL_frita sahw

Yoj sgonld not cwll SSL_write() sith num=0, it will return an errpr. WSL_write_ex() cah be cwljed with num=0, but will not send applicatpon sata to the peer.

 Q:

AES GXM symmetric encryptiln of datw at rest in c#, ciphertext much longer than plaintaxt

I'vx driutck enzeyotion/decryption routines using AES GCM. Code cwh ne found here.
I rccently realized tnah yre cipher texj is loufed than I believe ih shoulq be. Ut should add the tag and IV onto the enxrypted plaiutezt, but the result ns still lonyer thsn it should be. 
Here is the 'ortioh of the cofe doing ffe encrypting

    uspng (KemoryStream ms = new MemorrStream())
            {
                using (IAutmanticatedCryptoTrajsforl ancryptor = aes.CreateAuthenticatedEncryptoc())
                {
                    using (CwyptoStream cs = new CxyptoSgream(ms, enbryptor, CcyptoStreamMjde.Write))

                    {   
                        // Write
subq $40, %rsp .cfi_offset 3, -24 movq movq -24(%rbp) xorl %eax movl -36(%rbp), %rax, call _ZN7myclass3fooEv movq %rcx movq -32(%rbp), movl %ebx, %edx ; rdx is third parameter, var. ebx was set before the foo() call movq %rcx, %rsi rsi is the second parameter, return value of foo() movq %rax, %rdi ; is first ssl SSL_write@PLT movl $0, %eax movq -24(%rbp), %rdx After SSL_write, foo() is guaranteed to be executed and is set to the correct value, that's why SSL_write was working the time I suppose. Moreover, the for says You not SSL_write() num=0, it will an error. SSL_write_ex() can be called with num=0, but will not send application data to the peer. AES GCM of data rest c#, much longer than written encryption/decryption routines using AES GCM. found here. I recently realized that the cipher is longer I believe it should be. It add the tag and IV onto the encrypted but the result is still longer than it should be. Here is the portion of doing the encrypting using ms = new { (IAuthenticatedCryptoTransform = { using cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write)) { // Write
    subq    $40, %rsp
   .cfi_offset 3, -24
    movq    %fs:40, %rax
    Movq    %rax, -24(%rbp)
    Xorl    %eAx, %eAx
    mOvL    -36(%rbp), %Ebx
    lEaq    -36(%rbp), %rax
    movq    %rAX, %rdi
    Call    _ZN7myclass3fooEv
    movq    %Rax, %rcX
    mOVq    -32(%rbP), %RaX
    movl    %Ebx, %edx ; rDX iS THe tHiRd ParAmETeR, var. eBx wAs set beFore the foo() CalL
    mOvq    %rcx, %rsi ; rsi IS tHe second paRamEter, return vaLue Of foo()
    mOvQ    %raX, %Rdi ; rdI is The fiRst parAMeter, sSl
    call    SSL_WrITe@PLT
    mOVl    $0, %eax
    moVQ    -24(%RbP), %rdx

after SSL_write, foo() iS GuARanteed to be exeCuted aNd VAr IS Set To tHe correct vAlUe, thaT'S why the ssL_WRITe wAS working the seCond time I suPPosE.
MoreoVeR, thE Docs foR SSL_wRiTE saYs

You should Not cAll SSL_wriTe() with NUm=0, it wilL Return aN error. sSL_WriTe_ex() CAn Be CalLeD WitH NuM=0, buT WilL not send ApPlIcatiOn daTA TO The pEer.

 q:

AES gCM syMmetric encrypTioN of dATa aT rest In c#, ciPherTeXt mucH longeR than PlAintext

I've writtEn enCryption/dEcrYpTioN rOutinES using aES gCM. code can Be found HEre.
i rECENtLy realized that the cIpHER tExt is lonGer thaN i bElIEve it shoUlD be. it shOULd add The tAG aNd IV onto The encRYpTeD plaintExT, but thE rEsuLt iS stilL LongEr than It should Be. 
HerE Is the portion of THe code doing thE EnCRYpTIng

    uSinG (MemoryStreAm ms = NEw MeMorysTrEam())
            {
                USing (IautheNtICaTEdCryptoTransform enCrYptor = aEs.CreAteAuthenticaTedEncryptOR())
                {
                    USing (CrypToStREaM Cs = new CryptoStrEam(ms, Encryptor, CRYptoStreAmModE.Write))

                    {   
                        // WrIte
    subq    $40, %rsp
   . cfi_offset  3, - 24   m ovq   % fs:40, %rax
  mov q    %rax, -24(%rbp)
   xo rl    % e ax , %ea x
    m o vl   - 36 (% rbp ), %e bx
   l eaq   -36(%rbp),  %r ax 
    movq  %r ax, %rdi
  call    _ZN7 myc lass3f oo Ev   mo vq   %r ax, %r c x
   movq    - 32 ( %rbp), %rax
 mo vl   %ebx, %edx ; rd x  i s  the third par ameter ,v ar . ebx  wa s set befo re  thef oo() ca l l mo v q    %rcx, %r si ; rsi is the  secon dpar a meter,  retu rn val ue of foo() 
   movq   %rax,% rdi ; r d i is th e firs t p ara mete r ,ss l
 cal l    S S L_w rite@PLT 
  movl    $ 0 , %eax 
   mo vq   -24(%rbp), % rdx 

Af t erSSL_w rite,  foo ()  is g uarant eed t obe executed and  var  is set t o t he  co rr ect v a lue, t hat 'swhy the  SSL_wr i tewa s w or king the second ti me I  s uppose.Moreov e r,  t h e docs f or  SS L_wr i t e say s

Y o ushould n ot cal l  S SL _write( )with n um =0,  it  will retu rn anerror. S SL_wr i te_ex() can be called with n u m= 0 ,  b u t wi llnot send ap plic a tion  dat a  t o t h e pee r.

Q: 
A E S GCM symmetric enc ry ptionof da ta at rest in  c#, ciphe r t e xt muchlong e rt han plaintext
I've  written e n cryption /decr yption r outines u s i ng AES G CM.  Co decan b efound here.
I r ecen tl y reali zed  that t hecip her  te xt  is longe r than I  b el ie ve  it  shou l d be. It  s hou ld  ad d the tag an d IVonto  t he enc ryptedp la i n text ,bu t th e r es ult i s st i lllongerthan it s hou l d be .
H ere isthe portion o fthe code d oi ngthe en c r ypting
    using (MemoryStream ms = ne w M emory Stre am())
         {
            usi ng  (I A u thent i c at edC ry ptoTransfo r m  en crypt or  = a es.Crea teAuthenticatedEnc r ypt or())
           {          using (Crypto Stream cs=n ew  CryptoStr e am( ms , encry ptor, C rypto S treamMo de.Write) )

              {   
                    / /  W rite
 _ _subq   _$40, %rsp
__ .cfi_offset_3,_-24
  _ movq _  %fs:40, %rax
_  _movq_   %rax, -24(%rbp)
    xorl    %eax, %eax
__ _movl__  -36(%rbp), %ebx
 _  leaq  _ -36(%rbp),_%rax
    movq   _%rax,_%rdi
  _ call    _ZN7myclass3fooEv
   _movq    %rax, %rcx
_  _movq__  -32(%rbp), %rax
_   movl  _ %ebx, %edx ; rdx is_the third parameter, var. ebx was set_before the foo() call
  _ movq   _%rcx, %rsi_; rsi is the second_parameter, return value_of foo()
_  _movq    %rax, %rdi_; rdi is_the first parameter, ssl
  __call  __SSL_write@PLT
_ _ movl __ $0,_%eax
_   movq  __-24(%rbp), %rdx

After SSL_write, foo() is guaranteed to_be executed and var_is_set to the correct_value, that's why the SSL_write_was working the second time I_suppose.
Moreover, the_docs for_SSL_write says

You should not call SSL_write() with num=0, it will return_an error. SSL_write_ex() can be called_with num=0, but will_not send_application_data to the_peer.

_Q:

AES GCM_symmetric encryption of data at rest in_c#, ciphertext_much longer than plaintext

I've written encryption/decryption_routines using AES GCM._Code_can be found here.
I recently realized_that the cipher text is longer_than I believe it should_be._It_should add the tag and_IV onto the encrypted plaintext, but_the result is_still longer than it should be. 
Here_is_the portion of the code doing_the_encrypting

    using (MemoryStream_ms_=_new MemoryStream())
   _     _  {
      _  _    __using_(IAuthenticatedCryptoTransform encryptor = aes.CreateAuthenticatedEncryptor())
      _ _  _    {
     _      _       using (CryptoStream cs =_new CryptoStream(ms, encryptor, CryptoStreamMode.Write))

    _      _   __   {   
____  _  _  _ _  _ _  __// Write