[Cryptech-Commits] [sw/libhal] 01/01: Merge branch 'master' into macosx.

git at cryptech.is git at cryptech.is
Fri Jul 1 02:56:57 UTC 2016


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch macosx
in repository sw/libhal.

commit 57a33b0e84d7977ed531982604236ccb9daa9495
Merge: 3ed08b6 3ba7ca4
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Thu Jun 30 22:53:08 2016 -0400

    Merge branch 'master' into macosx.

 daemon.c            |  40 +++-----
 hal_internal.h      |   2 +-
 rpc_client.c        | 273 +++++++++++++++++++++++++++++++++++++++++++---------
 rpc_client_serial.c |   5 +-
 rpc_server.c        |  51 +++++++++-
 xdr.c               |  11 +++
 xdr_internal.h      |   2 +
 7 files changed, 303 insertions(+), 81 deletions(-)

diff --cc daemon.c
index 951b920,7991710..81851ed
--- a/daemon.c
+++ b/daemon.c
@@@ -271,36 -290,17 +271,17 @@@ int main(int argc, char *argv[]
  
                  /* client data socket */
                  else {
-                     uint8_t *bufptr = obuf.buf;
 -                    const uint8_t * const limit = obuf.buf + MAX_PKT_SIZE;
 +                    const uint8_t * const limit = obuf.buf + HAL_RPC_MAX_PKT_SIZE;
-                     /* First word of the request is the client ID. */
-                     hal_xdr_encode_int(&bufptr, limit, pollfds[i].fd);
                      /* Get the client's rpc request packet. */
-                     obuf.len = recv(pollfds[i].fd, bufptr, HAL_RPC_MAX_PKT_SIZE - 4, 0);
 -                    obuf.len = recv(pollfds[i].fd, obuf.buf, MAX_PKT_SIZE, 0);
++                    obuf.len = recv(pollfds[i].fd, obuf.buf, HAL_RPC_MAX_PKT_SIZE, 0);
  #ifdef DEBUG
                      printf("data socket %d received request:\n", pollfds[i].fd);
-                     hexdump(obuf.buf, obuf.len + 4);
+                     hexdump(obuf.buf, obuf.len);
  #endif
  
- 		    /* Fill in the client handle arg as needed. */
- 		    uint32_t opcode;
- 		    hal_xdr_decode_int((const uint8_t ** const)&bufptr, limit, &opcode);
- 		    switch (opcode) {
- 		    case RPC_FUNC_SET_PIN:
- 		    case RPC_FUNC_LOGIN:
- 		    case RPC_FUNC_LOGOUT:
- 		    case RPC_FUNC_IS_LOGGED_IN:
- 		    case RPC_FUNC_HASH_INITIALIZE:
- 		    case RPC_FUNC_PKEY_LOAD:
- 		    case RPC_FUNC_PKEY_FIND:
- 		    case RPC_FUNC_PKEY_GENERATE_RSA:
- 		    case RPC_FUNC_PKEY_GENERATE_EC:
- 			/* first argument is client handle */
- 			hal_xdr_encode_int(&bufptr, limit, pollfds[i].fd);
- 			break;
- 		    default:
- 			break;
- 		    }
+ 		    /* Fill in the client handle arg - first field after opcode. */
+                     uint8_t *bufptr = obuf.buf + 4;
+                     hal_xdr_encode_int(&bufptr, limit, pollfds[i].fd);
  
                      if (obuf.len > 0) {
  #ifdef DEBUG



More information about the Commits mailing list