diff --git a/examples/6_serialization.jl b/examples/6_serialization.jl index ddf653f..b05de59 100644 --- a/examples/6_serialization.jl +++ b/examples/6_serialization.jl @@ -90,8 +90,8 @@ function example_serialization() encrypt!(encrypted2, plain2, encryptor) sym_encryptor = Encryptor(context, sk) - sym_encrypted1 = encrypt_symmetric!(plain1, sym_encryptor) - sym_encrypted2 = encrypt_symmetric!(plain2, sym_encryptor) + sym_encrypted1 = encrypt_symmetric(plain1, sym_encryptor) + sym_encrypted2 = encrypt_symmetric(plain2, sym_encryptor) resize!(data_stream2, save_size(sym_encrypted1)) size_sym_encrypted1 = save!(data_stream2, sym_encrypted1) diff --git a/src/SEAL.jl b/src/SEAL.jl index 366917a..bff0b56 100644 --- a/src/SEAL.jl +++ b/src/SEAL.jl @@ -68,7 +68,7 @@ include("ciphertext.jl") export Ciphertext, scale, scale!, parms_id, size, length, save_size, save!, load! include("encryptor.jl") -export Encryptor, encrypt!, encrypt_symmetric! +export Encryptor, encrypt!, encrypt_symmetric, encrypt_symmetric! include("evaluator.jl") export Evaluator, square!, square_inplace!, relinearize!, relinearize_inplace!, rescale_to_next!, diff --git a/src/encryptor.jl b/src/encryptor.jl index 891dbcc..207ba23 100644 --- a/src/encryptor.jl +++ b/src/encryptor.jl @@ -61,7 +61,7 @@ function encrypt_symmetric!(destination::Ciphertext, plain::Plaintext, encryptor @check_return_value retval return destination end -function encrypt_symmetric!(plain::Plaintext, encryptor::Encryptor) +function encrypt_symmetric(plain::Plaintext, encryptor::Encryptor) destination = Ciphertext() retval = ccall((:Encryptor_EncryptSymmetric, libsealc), Clong, (Ptr{Cvoid}, Ptr{Cvoid}, UInt8, Ptr{Cvoid}, Ptr{Cvoid}), diff --git a/test/test_6_serialization.jl b/test/test_6_serialization.jl index f924f22..aff034c 100644 --- a/test/test_6_serialization.jl +++ b/test/test_6_serialization.jl @@ -100,12 +100,14 @@ end sym_encryptor = Encryptor(context, sk) - @testset "encrypt_symmetric!" begin - @test encrypt_symmetric!(plain1, sym_encryptor) isa Ciphertext - @test encrypt_symmetric!(plain2, sym_encryptor) isa Ciphertext - end - sym_encrypted1 = encrypt_symmetric!(plain1, sym_encryptor) - sym_encrypted2 = encrypt_symmetric!(plain2, sym_encryptor) + @testset "encrypt_symmetric, encrypt_symmetric!" begin + @test encrypt_symmetric(plain1, sym_encryptor) isa Ciphertext + @test encrypt_symmetric(plain2, sym_encryptor) isa Ciphertext + c = Ciphertext() + @test encrypt_symmetric!(c, plain2, sym_encryptor) == c + end + sym_encrypted1 = encrypt_symmetric(plain1, sym_encryptor) + sym_encrypted2 = encrypt_symmetric(plain2, sym_encryptor) @testset "save! Ciphertext" begin @test save_size(sym_encrypted1) == 131298