Skip to content

Commit

Permalink
Merge branch 'release/v0.11.0'
Browse files Browse the repository at this point in the history
Bugfix:
  - Lib/Foundation: Fixed crash when import private key from valid ASN.1 but not a private key

Features:
  - Lib/Foundation: Operations "sign then encrypt" and "decrypt then verify" were added to "RecipientCipher" class
  - Lib/Foundation: Method "hasKeyRecipient()" was added to class "RecipientCipher"
  - Lib/Foundation: Method "preciseEncryptedLen()" was added to interface "Encrypt"

Changes:
  - Lib/Foundation: Interface "CipherAuth" now inherit interface "Cipher"
  - Lib/Foundation/Wrappers: Listed methods where removed from class "MessageInfo":
    * addKeyRecipient()
    * addPasswordRecipient()
    * setDataEncryptionAlgInfo()
    * setCustomParams()
    * clearRecipients()
  - Lib/Foundation/Wrappers: Method "add()" was removed from class "KeyRecipientInfoList"
  - Lib/Foundation/Wrappers: Method "add()" was removed from class "PasswordRecipientInfoList"
  • Loading branch information
SergeySeroshtan committed Oct 7, 2019
2 parents 9b5d767 + fd4cfe0 commit b035582
Show file tree
Hide file tree
Showing 277 changed files with 16,891 additions and 1,093 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

cmake_minimum_required(VERSION 3.11 FATAL_ERROR)

project(virgil_crypto VERSION 0.10.3 LANGUAGES C)
project(virgil_crypto VERSION 0.11.0 LANGUAGES C)


# ---------------------------------------------------------------------------
Expand Down
25 changes: 25 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
# virgil-crypto-c ChangeLog (Sorted by date)


## Version 0.11.0 released 2019-10-07

### Bugfix

- Lib/Foundation: Fixed crash when import private key from valid ASN.1 but not a private key

### Features

- Lib/Foundation: Operations "sign then encrypt" and "decrypt then verify" were added to "RecipientCipher" class
- Lib/Foundation: Method "hasKeyRecipient()" was added to class "RecipientCipher"
- Lib/Foundation: Method "preciseEncryptedLen()" was added to interface "Encrypt"

### Changes

- Lib/Foundation: Interface "CipherAuth" now inherit interface "Cipher"
- Lib/Foundation/Wrappers: Listed methods where removed from class "MessageInfo":
* addKeyRecipient()
* addPasswordRecipient()
* setDataEncryptionAlgInfo()
* setCustomParams()
* clearRecipients()
- Lib/Foundation/Wrappers: Method "add()" was removed from class "KeyRecipientInfoList"
- Lib/Foundation/Wrappers: Method "add()" was removed from class "PasswordRecipientInfoList"


## Version 0.10.3 released 2019-09-10

### Changes
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.10.3
0.11.0
4 changes: 2 additions & 2 deletions VSCCrypto.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "VSCCrypto"
s.version = "0.10.3"
s.version = "0.11.0"
s.license = { :type => "BSD", :file => "Carthage/LICENSE" }
s.summary = "Contains basic c functions classes for creating key pairs, encrypting/decrypting data, signing data and verifying signatures."
s.homepage = "https://github.com/VirgilSecurity/virgil-crypto-c"
s.authors = { "Virgil Security" => "https://virgilsecurity.com/" }
s.source = { :http => "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v0.10.3/VSCCrypto.framework.zip" }
s.source = { :http => "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v0.11.0/VSCCrypto.framework.zip" }
s.ios.deployment_target = "9.0"
s.osx.deployment_target = "10.9"
s.tvos.deployment_target = "9.0"
Expand Down
2 changes: 1 addition & 1 deletion codegen/interface.gsl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function interface_resolve_inherit (inherit, source, destination)
my.interface = interface_find (my.inherit.interface, my.source)

for my.interface.inherit as upper_inherit
my.destination_inherit = my.destination->inherit (interface = upper_inherit.interface) ?
my.destination_inherit = my.destination->inherit (inherit.interface = upper_inherit.interface) ?
if ! defined (my.destination_inherit)
new inherit to my.destination
.interface = upper_inherit.interface
Expand Down
43 changes: 31 additions & 12 deletions codegen/java_c.gsl
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,12 @@ function java_derive_buffer_length_getter (class, method, argument, java_project
return "$(my.proxy_method:)($(my.proxy_args?:))"

elsif defined (my.length.constant)
my.proxy_constant = java_derive_c_real_constant_name(my.length.constant, my.proxy_object, my.java_project)
return "$(my.proxy_constant:)"

if regexp.match ("\\d+", my.length.constant)
return my.length.constant
else
my.proxy_constant = java_derive_c_real_constant_name(my.length.constant, my.proxy_object, my.java_project)
return "$(my.proxy_constant:)"
endif
elsif defined (my.length.argument)
my.proxy_argument = "j$(java_derive_argument_name_str (my.length.argument):)"
return my.proxy_argument
Expand Down Expand Up @@ -915,22 +918,38 @@ function java_create_c_class_method_call (class, method, java_class, java_method

# Wrap input buffers
my.struct_buffer = ".(c_project_common_class_buffer_struct_buffer)"
my.method_buffer_init = ".(c_project_common_class_buffer_method_new_with_capacity)"
my.method_buffer_len = ".(c_project_common_class_buffer_method_len)"
my.method_buffer_bytes = ".(c_project_common_class_buffer_method_bytes)"

for my.method.argument where defined (0.class) & 0.class = "buffer"
my.init_data ?= terminator + "// Wrap input buffers"
my.buffer_name = java_derive_c_instance_name (argument)
my.length_getter = java_derive_buffer_length_getter (my.class, my.method, argument, my.java_project)
my.init_data += format_left("\
$(my.struct_buffer:) *$(my.buffer_name:) = $(my.method_buffer_init:)($(my.length_getter:));
") + terminator

if string_in (argument.access, "readonly, retain, readwrite, disown")
my.buffer_jni_name = "j$(argument.name:Camel)"
my.data_name = "$(my.buffer_name:)_data"
my.method_buffer_init = ".(c_project_common_class_buffer_method_new_with_data)"

my.init_data += format_left("\
byte* $(my.data_name:)_arr = (byte*) (*jenv)->GetByteArrayElements(jenv, $(my.buffer_jni_name:), NULL);
$(my.struct_data:) $(my.data_name:) = $(my.method_data_init:)($(my.data_name:)_arr, (*jenv)->GetArrayLength(jenv, $(my.buffer_jni_name:)));
$(my.struct_buffer:) *$(my.buffer_name:) = $(my.method_buffer_init:)($(my.data_name:));
") + terminator
else
my.method_buffer_init = ".(c_project_common_class_buffer_method_new_with_capacity)"
my.length_getter = java_derive_buffer_length_getter (my.class, my.method, argument, my.java_project)

my.init_data += format_left("\
$(my.struct_buffer:) *$(my.buffer_name:) = $(my.method_buffer_init:)($(my.length_getter:));
") + terminator
endif

my.free_resources ?= terminator + "// Free resources"
my.free_resources += format_left("\
.(c_project_common_class_buffer_method_delete)($(my.buffer_name:));
") + terminator
if !string_in (argument.access, "disown")
my.free_resources += format_left("\
.(c_project_common_class_buffer_method_delete)($(my.buffer_name:));
") + terminator
endif
endfor

# Wrap errors
Expand Down Expand Up @@ -978,7 +997,7 @@ function java_create_c_class_method_call (class, method, java_class, java_method
endfor

# Create shallow copies for objects that is passed as "disown" argument.
for my.method.argument where argument.access = "disown"
for my.method.argument where argument.access = "disown" & !string_in (argument.class, "data, buffer")
my.method_shallow_copy = java_derive_c_method_shallow_copy (argument)
my.class_type = java_derive_c_type (argument)

Expand Down
2 changes: 1 addition & 1 deletion codegen/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<library name="nanopb"/>
<library name="relic"/>

<version major="0" minor="10" patch="3"/>
<version major="0" minor="11" patch="0"/>

<project name="common" skip_codegen="0" skip_codegen_c="0" skip_codegen_wrappers="0"/>
<project name="foundation" skip_codegen="0" skip_codegen_c="0" skip_codegen_wrappers="0"/>
Expand Down
12 changes: 12 additions & 0 deletions codegen/models/project_common/class_buffer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,18 @@
</method>


<method name="append data">
Copy data to the buffer and reallocate if needed by coping.

Precondition: buffer should be an owner of the bytes.

Note, this operation can be slow if copy operation occurred.
Note, buffer capacity is doubled.

<argument name="data" class="data"/>
</method>


<method name="reset">
Reset to the initial state.
After reset inner buffer can be re-used.
Expand Down
2 changes: 1 addition & 1 deletion codegen/models/project_common/project_common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
wrappers="python"
>

<version major="0" minor="10" patch="3"/>
<version major="0" minor="11" patch="0"/>

<license>
Copyright (C) 2015-2019 Virgil Security, Inc.
Expand Down
46 changes: 46 additions & 0 deletions codegen/models/project_foundation/class_footer_info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<class name="footer info">
Handle meta information about footer.

<property name="signed data info" class="signed data info"/>
<property name="data size" type="size"/>

<method name="has signed data info" is_const="1">
Retrun true if signed data info present.

<return type="boolean"/>
</method>

<method name="set signed data info" visibility="private">
Setup signed data info.

<argument name="signed data info" class="signed data info" access="disown"/>
</method>

<method name="signed data info" is_const="1">
Return signed data info.

<return class="signed data info"/>
</method>

<method name="signed data info m" visibility="private">
Return mutable signed data info.

<return class="signed data info" access="readwrite"/>
</method>

<method name="remove signed data info" visibility="private">
Remove signed data info.
</method>

<method name="set data size">
Set data size.

<argument name="data size" type="size"/>
</method>

<method name="data size" is_const="1">
Return data size.

<return type="size"/>
</method>
</class>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Handles a list of "key recipient info" class objects.

<property name="item" class="key recipient info"/>
<property name="next" class="key recipient info list"/>
<property name="prev" class="key recipient info list"/>
<property name="next" class="self"/>
<property name="prev" class="self"/>

<method name="add">
<method name="add" visibility="private">
Add new item to the list.
Note, ownership is transfered.

Expand Down
90 changes: 83 additions & 7 deletions codegen/models/project_foundation/class_message_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@
<property name="password recipients" class="password recipient info list"/>
<property name="data encryption alg info" interface="alg info"/>
<property name="custom params" class="message info custom params"/>
<property name="cipher kdf alg info" interface="alg info"/>
<property name="footer info" class="footer info"/>


<method name="add key recipient">
<method name="add key recipient" visibility="private">
Add recipient that is defined by Public Key.

<argument name="key recipient" class="key recipient info" access="disown"/>
</method>


<method name="add password recipient">
<method name="add password recipient" visibility="private">
Add recipient that is defined by password.

<argument name="password recipient" class="password recipient info" access="disown"/>
</method>


<method name="set data encryption alg info">
<method name="set data encryption alg info" visibility="private">
Set information about algorithm that was used for data encryption.

<argument name="data encryption alg info" interface="alg info" access="disown"/>
Expand Down Expand Up @@ -56,12 +58,26 @@
<return class="password recipient info list"/>
</method>

<method name="set custom params">

<method name="clear recipients" visibility="private">
Remove all recipients.
</method>


<method name="set custom params" visibility="private">
Setup custom params.

<argument name="custom params" class="message info custom params" access="retain"/>
<argument name="custom params" class="message info custom params" access="disown"/>
</method>


<method name="has custom params" is_const="1">
Return true if message info contains at least one custom param.

<return type="boolean"/>
</method>


<method name="custom params">
Provide access to the custom params object.
The returned object can be used to add custom params or read it.
Expand All @@ -70,7 +86,67 @@
<return class="message info custom params" access="readwrite"/>
</method>

<method name="clear recipients">
Remove all recipients.

<method name="has cipher kdf alg info" is_const="1">
Return true if cipher kdf alg info exists.

<return type="boolean"/>
</method>


<method name="set cipher kdf alg info" visibility="private">
Setup cipher kdf alg info.

<argument name="cipher kdf alg info" interface="alg info" access="disown"/>
</method>


<method name="cipher kdf alg info" is_const="1">
Return cipher kdf alg info.

<return interface="alg info"/>
</method>


<method name="remove cipher kdf alg info" visibility="private">
Remove cipher kdf alg info.
</method>


<method name="has footer info" is_const="1">
Return true if footer info exists.

<return type="boolean"/>
</method>


<method name="set footer info" visibility="private">
Setup footer info.

<argument name="footer info" class="footer info" access="disown"/>
</method>


<method name="footer info" is_const="1">
Return footer info.

<return class="footer info"/>
</method>


<method name="footer info m" visibility="private">
Return mutable footer info.

<return class="footer info" access="readwrite"/>
</method>


<method name="remove footer info" visibility="private">
Remove footer info.
</method>


<method name="clear">
Remove all infos.
</method>
</class>
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
<return class="list key value node"/>
</method>

<method name="has params" is_const="1">
Return true if at least one param exists.

<return type="boolean"/>
</method>

<method name="first param" scope="internal" is_const="1">
Return first param, or NULL if does not exist.

Expand Down
Loading

0 comments on commit b035582

Please sign in to comment.