GithubHelp home page GithubHelp logo

Can't read from NV memory about wolftpm HOT 3 CLOSED

wolfssl avatar wolfssl commented on August 25, 2024
Can't read from NV memory

from wolftpm.

Comments (3)

dgarske avatar dgarske commented on August 25, 2024 1

Hi @horver ,

This is because the auth is not set in the case when wolfTPM2_NVCreateAuth is called and the handle already exists.

The right solution would be to call wolfTPM2_NVReadPublic first to see if it exists. If it does then you'll need to set the NV handle like this:

nv.handle.hndl = (TPM_HANDLE) 0x01800000;
nv.handle.auth.size = sizeof(gNvAuth) - 1;
XMEMCPY(nv.handle.auth.buffer, gNvAuth, nvhandle.auth.size);

Then call wolfTPM2_NVReadAuth.

You do bring up a good improvement that could be made to the wrapper, so I've pushed a PR here:
#99

Thanks,
David Garske, wolfSSL

from wolftpm.

horver avatar horver commented on August 25, 2024 1

Hello @tomoveu @dgarske,

Thank you very much for your answer and the quick fix!
Now I understand the mechanism and it works! :)

from wolftpm.

tomoveu avatar tomoveu commented on August 25, 2024

Hi @horver,

This also means, you should handle the return code TPM_RC_NV_DEFINED in your application not as error case. After #99 the wrapper now sets the auth and you can perform the NVReadAuth.

Of course, you are left with the challenge to know that you are the owner of this NV field. This is why you should check the outcome of NV_ReadAuth to figure if the NV field written matches your auth, thus verifying "aha , this is my field and the value inside is the one i stored" :)

ps: @dgarske nice fix! Simple and quick.

from wolftpm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.