libaacs | branch: master | npzacs <[email protected]> | Tue Nov 9 18:38:36 2010 +0200| [aa302074085ae11707276da5149e9bc7643d10d3] | committer: npzacs
Create random Hk and calculate corresponding Hv instead of reading Hv from config file (AACS spec, section 4.3, steps 23-24) > http://git.videolan.org/gitweb.cgi/libaacs.git/?a=commit;h=aa302074085ae11707276da5149e9bc7643d10d3 --- src/libaacs/mmc.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/src/libaacs/mmc.c b/src/libaacs/mmc.c index f4a7209..525046e 100644 --- a/src/libaacs/mmc.c +++ b/src/libaacs/mmc.c @@ -1,6 +1,7 @@ /* * This file is part of libaacs * Copyright (C) 2009-2010 Obliter0n + * Copyright (C) 2010 npzacs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -88,6 +89,7 @@ struct mmc { #endif uint8_t host_priv_key[20], host_cert[92]; uint8_t host_nonce[20]; + uint8_t host_key[20]; uint8_t host_key_point[40]; }; @@ -362,7 +364,6 @@ MMC *mmc_open(const char *path, const uint8_t *host_priv_key, if (host_priv_key) memcpy(mmc->host_priv_key, host_priv_key, 20); if (host_cert) memcpy(mmc->host_cert, host_cert, 92); - if (host_key_point) memcpy(mmc->host_key_point, host_key_point, 40); if (host_nonce) { memcpy(mmc->host_nonce, host_nonce, 20); @@ -375,6 +376,19 @@ MMC *mmc_open(const char *path, const uint8_t *host_priv_key, print_hex(str, mmc->host_nonce, sizeof(mmc->host_nonce))); } + if (host_key_point) { + memcpy(mmc->host_key_point, host_key_point, 40); + + } else { + crypto_create_host_key_pair(mmc->host_key, mmc->host_key_point); + + char str[sizeof(mmc->host_key_point)*2 + 1]; + DEBUG(DBG_MMC, "Created host key (Hk): %s\n", + print_hex(str, mmc->host_key, sizeof(mmc->host_key))); + DEBUG(DBG_MMC, "Created host key point (Hv): %s\n", + print_hex(str, mmc->host_key_point, sizeof(mmc->host_key_point))); + } + #if defined(HAVE_MNTENT_H) char *file_path = (char*)malloc(strlen(path) + 1); _______________________________________________ libaacs-devel mailing list [email protected] http://mailman.videolan.org/listinfo/libaacs-devel
