Skip to content

Commit

Permalink
it compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
arvid220u committed Jun 30, 2022
1 parent df1618c commit 1907b2b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions daemon/crypto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cc_library(
visibility = ["//daemon:__subpackages__"],
deps = [
"@asphr//asphr:asphr_lib",
"@asphr//schema:asyncinvitation_proto_cc",
"@asphr//schema:daemon_cc_grpc",
"@asphr//schema:message_proto_cc",
"@asphr//schema:server_cc_grpc",
Expand Down
7 changes: 6 additions & 1 deletion daemon/crypto/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ constexpr int MAX_ASYNC_FRIEND_REQUESTS = 500;
constexpr int ASYNC_FRIEND_REQUEST_BATCH_SIZE = 1000;
// TODO: figure out a reasonable limit here...
constexpr size_t ASYNC_INVITATION_SIZE = MESSAGE_SIZE; // arbitrary
constexpr int INVITATION_MESSAGE_MAX_PLAINTEXT_SIZE = ASYNC_INVITATION_SIZE;
// TODO: optimize this size. we have a protobuf in asyncinvitation.proto
// it also contains the public ID. the public ID should never be bigger than
// 190, and the protobuf should never add more than 10 extra bytes, so 200 is
// very safe.
constexpr int INVITATION_MESSAGE_MAX_PLAINTEXT_SIZE =
ASYNC_INVITATION_SIZE - 200;
static_assert(
INVITATION_MESSAGE_MAX_PLAINTEXT_SIZE < ASYNC_INVITATION_SIZE,
"INVITATION_MESSAGE_MAX_PLAINTEXT_SIZE must be < "
Expand Down
3 changes: 1 addition & 2 deletions daemon/crypto/crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ auto decrypt_async_invitation(const string& self_invitation_private_key,
// TODO: specifically, we need to verify that the public_id in the body
// corresponds to the public_id that the message was authenticated with
// otherwise, someone might impersonate the real receiver
return make_pair(async_invitation.public_id(),
async_invitation.invitation_id());
return make_pair(async_invitation.my_public_id(), async_invitation.message());
}
} // namespace crypto
2 changes: 1 addition & 1 deletion daemon/crypto/crypto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string>

#include "constants.hpp"
#include "schema/asyncinvitation.proto"
#include "schema/asyncinvitation.pb.h"
#include "schema/message.pb.h"

/* Crypto implements an IND-CCA2 secure scheme.
Expand Down

0 comments on commit 1907b2b

Please sign in to comment.