   }
 
   for i in 0..<32 {
-    x[i] = r[i]
+    x[i] = Int64( r[i] ) // *** R
   }
 
   for i in 0..<32 {
     for j in 0..<32 {
-      x[i+j] += h[i] * sk[j]
+      x[i+j] += Int64( h[i] ) * Int64( sk[j] ) // *** R 
     }
   }
 

    }
}

func pack25519(_ o:inout [Int], _ n:[Int64]) {
    var b: Int64
    var m = gf()
    var t = gf()

  return n + 64
}

func curve25519_sign(_ sm:inout [UInt8], _ m:[UInt8], _ n:Int, _ sk:[UInt8], _ opt_rnd:[UInt8]?) -> Int {
  // If opt_rnd is provided, sm must have n + 128,
  // otherwise it must have n + 64 bytes.

  // Convert Curve25519 secret key into Ed25519 secret key (includes pub key).
  var edsk = [UInt8](repeating: 0, count: 64)
  var p: [[Int64]] = [gf(), gf(), gf(), gf()]

  for i in 0..<32 {
